Skip to content

Commit 3ab62ce

Browse files
authored
Merge pull request SciSharp#1248 from iceljc/master
refine parameters
2 parents 3eda3e9 + c79e0e4 commit 3ab62ce

3 files changed

Lines changed: 19 additions & 16 deletions

File tree

src/Infrastructure/BotSharp.Abstraction/MLTasks/Utilities/LlmUtility.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ public static class LlmUtility
1414
{
1515
res = VerifyModelParameter(curVal, value.Default, value.Options);
1616
}
17+
else
18+
{
19+
res = curVal;
20+
}
1721

1822
return res;
1923
}

src/Plugins/BotSharp.Plugin.OpenAI/Providers/Chat/ChatCompletionProvider.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -588,16 +588,19 @@ private ChatCompletionOptions InitChatCompletionOption(Agent agent)
588588
/// Parse reasoning setting: returns (temperature, reasoning effort level)
589589
/// </summary>
590590
/// <param name="settings"></param>
591+
/// <param name="agent"></param>
591592
/// <returns></returns>
592-
private (float?, ChatReasoningEffortLevel?) ParseReasoning(
593-
ReasoningSetting? settings,
594-
Agent agent)
593+
private (float?, ChatReasoningEffortLevel?) ParseReasoning(ReasoningSetting? settings, Agent agent)
595594
{
596595
float? temperature = null;
597596
ChatReasoningEffortLevel? reasoningEffortLevel = null;
598597

598+
var level = _state.GetState("reasoning_effort_level")
599+
.IfNullOrEmptyAs(agent?.LlmConfig?.ReasoningEffortLevel);
600+
599601
if (settings == null)
600602
{
603+
reasoningEffortLevel = ParseReasoningEffortLevel(level);
601604
return (temperature, reasoningEffortLevel);
602605
}
603606

@@ -606,22 +609,18 @@ private ChatCompletionOptions InitChatCompletionOption(Agent agent)
606609
temperature = settings.Temperature;
607610
}
608611

609-
610-
var defaultLevel = settings?.EffortLevel;
611-
612-
if (settings?.Parameters != null
613-
&& settings.Parameters.TryGetValue("EffortLevel", out var settingValue)
614-
&& !string.IsNullOrEmpty(settingValue?.Default))
612+
if (string.IsNullOrEmpty(level))
615613
{
616-
defaultLevel = settingValue.Default;
614+
level = settings?.EffortLevel;
615+
if (settings?.Parameters != null
616+
&& settings.Parameters.TryGetValue("EffortLevel", out var settingValue)
617+
&& !string.IsNullOrEmpty(settingValue?.Default))
618+
{
619+
level = settingValue.Default;
620+
}
617621
}
618622

619-
var level = _state.GetState("reasoning_effort_level")
620-
.IfNullOrEmptyAs(agent?.LlmConfig?.ReasoningEffortLevel)
621-
.IfNullOrEmptyAs(defaultLevel);
622-
623623
reasoningEffortLevel = ParseReasoningEffortLevel(level);
624-
625624
return (temperature, reasoningEffortLevel);
626625
}
627626

src/WebStarter/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@
511511
"Id": "gpt-5",
512512
"Name": "gpt-5.1",
513513
"Version": "gpt-5.1",
514-
"ApiKey": "o",
514+
"ApiKey": "",
515515
"Type": "chat",
516516
"MultiModal": true,
517517
"Capabilities": [

0 commit comments

Comments
 (0)