revert reasoning effor level
This commit is contained in:
parent
bf56fa9d43
commit
81b2f299cd
|
|
@ -46,7 +46,7 @@
|
|||
<PackageVersion Include="Whisper.net.Runtime" Version="1.8.1" />
|
||||
<PackageVersion Include="NCrontab" Version="3.3.3" />
|
||||
<PackageVersion Include="Azure.AI.OpenAI" Version="2.2.0-beta.5" />
|
||||
<PackageVersion Include="OpenAI" Version="2.2.0-beta.4" />
|
||||
<PackageVersion Include="OpenAI" Version="2.3.0" />
|
||||
<PackageVersion Include="MailKit" Version="4.11.0" />
|
||||
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.8" />
|
||||
<PackageVersion Include="MySql.Data" Version="9.0.0" />
|
||||
|
|
|
|||
|
|
@ -3,5 +3,4 @@ namespace BotSharp.Abstraction.Agents.Constants;
|
|||
public static class LlmConstant
|
||||
{
|
||||
public const int DEFAULT_MAX_OUTPUT_TOKEN = 1024;
|
||||
public const string DEFAULT_REASONING_EFFORT_LEVEL = "low";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,4 @@ public class AgentLlmConfig
|
|||
[JsonPropertyName("max_output_tokens")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public int? MaxOutputTokens { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reasoning effort level
|
||||
/// </summary>
|
||||
[JsonPropertyName("reasoning_effort_level")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? ReasoningEffortLevel { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ public class AgentLlmConfigMongoElement
|
|||
public bool IsInherit { get; set; }
|
||||
public int MaxRecursionDepth { get; set; }
|
||||
public int? MaxOutputTokens { get; set; }
|
||||
public string? ReasoningEffortLevel { get; set; }
|
||||
|
||||
public static AgentLlmConfigMongoElement? ToMongoElement(AgentLlmConfig? config)
|
||||
{
|
||||
|
|
@ -22,8 +21,7 @@ public class AgentLlmConfigMongoElement
|
|||
Model = config.Model,
|
||||
IsInherit = config.IsInherit,
|
||||
MaxRecursionDepth = config.MaxRecursionDepth,
|
||||
MaxOutputTokens = config.MaxOutputTokens,
|
||||
ReasoningEffortLevel = config.ReasoningEffortLevel
|
||||
MaxOutputTokens = config.MaxOutputTokens
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -37,8 +35,7 @@ public class AgentLlmConfigMongoElement
|
|||
Model = config.Model,
|
||||
IsInherit = config.IsInherit,
|
||||
MaxRecursionDepth = config.MaxRecursionDepth,
|
||||
MaxOutputTokens = config.MaxOutputTokens,
|
||||
ReasoningEffortLevel = config.ReasoningEffortLevel
|
||||
MaxOutputTokens = config.MaxOutputTokens
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -504,42 +504,13 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
? tokens
|
||||
: agent.LlmConfig?.MaxOutputTokens ?? LlmConstant.DEFAULT_MAX_OUTPUT_TOKEN;
|
||||
|
||||
var level = state.GetState("reasoning_effort_level")
|
||||
.IfNullOrEmptyAs(agent?.LlmConfig?.ReasoningEffortLevel ?? string.Empty)
|
||||
.IfNullOrEmptyAs(LlmConstant.DEFAULT_REASONING_EFFORT_LEVEL);
|
||||
var reasoningEffortLevel = ParseReasoningEffortLevel(level);
|
||||
|
||||
return new ChatCompletionOptions()
|
||||
{
|
||||
Temperature = temperature,
|
||||
MaxOutputTokenCount = maxTokens,
|
||||
ReasoningEffortLevel = reasoningEffortLevel
|
||||
MaxOutputTokenCount = maxTokens
|
||||
};
|
||||
}
|
||||
|
||||
private ChatReasoningEffortLevel? ParseReasoningEffortLevel(string? level)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(level) || !_defaultTemperature.ContainsKey(_model))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var effortLevel = ChatReasoningEffortLevel.Low;
|
||||
switch (level.ToLower())
|
||||
{
|
||||
case "medium":
|
||||
effortLevel = ChatReasoningEffortLevel.Medium;
|
||||
break;
|
||||
case "high":
|
||||
effortLevel = ChatReasoningEffortLevel.High;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return effortLevel;
|
||||
}
|
||||
|
||||
public void SetModelName(string model)
|
||||
{
|
||||
_model = model;
|
||||
|
|
|
|||
Loading…
Reference in a new issue