You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add reasoning effort level configuration to agent LLM settings
Implement parsing logic for low/medium/high effort levels
Update MongoDB storage to persist reasoning effort level
Downgrade OpenAI package version for compatibility
Diagram Walkthrough
flowchart LR
A["LlmConstant"] --> B["AgentLlmConfig"]
B --> C["MongoDB Storage"]
B --> D["ChatCompletionProvider"]
D --> E["ReasoningEffortLevel Parsing"]
Parsing of reasoning effort level returns null when model not in default temperature map, which may unintentionally disable the feature for valid levels on other models.
The new reasoning_effort_level is applied unconditionally when a model has a defaultTemperature entry, but there’s no check that the selected OpenAI model or SDK version actually supports ChatReasoningEffortLevel, which risks runtime failures or silent no-ops across providers. Gate the option by model capability (e.g., only for o3/o4 or known-supported models) and the installed SDK version, and consider logging a warning or ignoring the setting when unsupported.
privateChatReasoningEffortLevel?ParseReasoningEffortLevel(string?level){if(string.IsNullOrWhiteSpace(level)||!_defaultTemperature.ContainsKey(_model)){returnnull;}// ... logic to parse level and return effortLevel}
After:
privateboolIsReasoningEffortSupported(stringmodel){// Explicitly check for models that support this featurereturnmodel.StartsWith("gpt-4o")||model.StartsWith("gpt-4-turbo");}privateChatReasoningEffortLevel?ParseReasoningEffortLevel(string?level){if(string.IsNullOrWhiteSpace(level)||!IsReasoningEffortSupported(_model)){returnnull;}// ... logic to parse level and return effortLevel}
Suggestion importance[1-10]: 9
__
Why: This suggestion correctly identifies a critical flaw where ReasoningEffortLevel is applied based on an indirect condition (_defaultTemperature.ContainsKey), which could cause runtime failures if the selected model does not support this feature.
High
Possible issue
Use invariant float parsing
Avoid culture-sensitive parsing for temperature to prevent exceptions or incorrect values in locales using comma decimals. Use invariant culture and safe parsing with a fallback.
-var temperature = float.Parse(state.GetState("temperature", "0.0"));+var temperatureStr = state.GetState("temperature", "0.0");+if (!float.TryParse(temperatureStr, NumberStyles.Float, CultureInfo.InvariantCulture, out var temperature))+{+ temperature = 0.0f;+}
if (_defaultTemperature.ContainsKey(_model))
{
temperature = _defaultTemperature[_model];
}
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 7
__
Why: This suggestion correctly identifies a potential culture-specific bug in float.Parse and proposes a robust solution using float.TryParse with CultureInfo.InvariantCulture, improving code reliability.
Medium
General
Improve parsing robustness
Normalize input safely and handle unexpected values explicitly. Use ToLowerInvariant() and return null on unrecognized values to avoid silently forcing "low" when an invalid string is supplied.
Why: The suggestion correctly points out that the current implementation defaults to "low" for any invalid input; returning null for unrecognized values is more robust and explicit.
Low
More
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Enhancement
Description
Add reasoning effort level configuration to agent LLM settings
Implement parsing logic for low/medium/high effort levels
Update MongoDB storage to persist reasoning effort level
Downgrade OpenAI package version for compatibility
Diagram Walkthrough
File Walkthrough
LlmConstant.cs
Add default reasoning effort level constantsrc/Infrastructure/BotSharp.Abstraction/Agents/Constants/LlmConstant.cs
AgentLlmConfig.cs
Add reasoning effort level property to agent configsrc/Infrastructure/BotSharp.Abstraction/Agents/Models/AgentLlmConfig.cs
ReasoningEffortLevelproperty with JSON serialization attributesAgentLlmConfigMongoElement.cs
Update MongoDB model for reasoning effort levelsrc/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentLlmConfigMongoElement.cs
ReasoningEffortLevelproperty to MongoDB modelChatCompletionProvider.cs
Implement reasoning effort level parsing and configurationsrc/Plugins/BotSharp.Plugin.OpenAI/Providers/Chat/ChatCompletionProvider.cs
ParseReasoningEffortLevelmethod with low/medium/highmapping
QdrantDb.cs
Refactor string comparison in sort order logicsrc/Plugins/BotSharp.Plugin.Qdrant/QdrantDb.cs
IsEqualTomethod for sort orderDirectory.Packages.props
Downgrade OpenAI package versionDirectory.Packages.props