From c5dad6422cf1a3a35ea0586eaec041ef185a7ca5 Mon Sep 17 00:00:00 2001 From: "nick.yi" Date: Thu, 26 Nov 2026 09:26:22 +0800 Subject: [PATCH] fix(chart,python,file): apply the configured reasoning effort to inner agents Chart plotting, python code generation and file select built their inner agent's LlmConfig without a model, so the provider never matched it against the request model and ignored the configured ReasoningEffortLevel. Pass the provider and model in, and drop the hardcoded "minimal" default, which models such as gpt-6-luna reject. Without a configured effort, the model's default in LlmProviders applies, as before. Co-Authored-By: Claude Opus 5.5 --- .../Services/Instruct/FileInstructService.SelectFile.cs | 8 +++++--- .../BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs | 5 ++++- .../Functions/PyProgrammerFn.cs | 5 ++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.SelectFile.cs b/src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.SelectFile.cs index 7ea41da39..7c7ce8f98 100644 --- a/src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.SelectFile.cs +++ b/src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.SelectFile.cs @@ -140,6 +140,9 @@ private async Task> SelectFiles(IEnumerable(); + var provider = options.Provider ?? agentSettings.LlmConfig.Provider; + var model = options?.Model ?? agentSettings.LlmConfig.Model; var foundAgent = await agentService.GetAgent(agentId); var agent = new Agent { @@ -148,6 +151,8 @@ private async Task> SelectFiles(IEnumerable> SelectFiles(IEnumerable(); - var provider = options.Provider ?? agentSettings.LlmConfig.Provider; - var model = options?.Model ?? agentSettings.LlmConfig.Model; var completion = CompletionProvider.GetChatCompletion(_services, provider: provider, model: model); var response = await completion.GetChatCompletions(agent, innerDialogs); diff --git a/src/Plugins/BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs b/src/Plugins/BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs index fdee36c88..21559250b 100644 --- a/src/Plugins/BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs +++ b/src/Plugins/BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs @@ -150,10 +150,13 @@ private async Task GetChartPlotInstruction(string agentId) private AgentLlmConfig GetLlmConfig() { var maxOutputTokens = _settings?.ChartPlot?.MaxOutputTokens ?? 8192; - var reasoningEffortLevel = _settings?.ChartPlot?.ReasoningEffortLevel ?? "minimal"; + var reasoningEffortLevel = _settings?.ChartPlot?.ReasoningEffortLevel; + var (provider, model) = GetLlmProviderModel(); return new AgentLlmConfig { + Provider = provider, + Model = model, MaxOutputTokens = maxOutputTokens, ReasoningEffortLevel = reasoningEffortLevel }; diff --git a/src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/PyProgrammerFn.cs b/src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/PyProgrammerFn.cs index f43e45932..a20c3d8b4 100644 --- a/src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/PyProgrammerFn.cs +++ b/src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/PyProgrammerFn.cs @@ -193,10 +193,13 @@ private async Task GetPyCodeInterpreterInstruction(string agentId) private AgentLlmConfig GetLlmConfig() { var maxOutputTokens = _codingSettings?.CodeGeneration?.MaxOutputTokens ?? 8192; - var reasoningEffortLevel = _codingSettings?.CodeGeneration?.ReasoningEffortLevel ?? "minimal"; + var reasoningEffortLevel = _codingSettings?.CodeGeneration?.ReasoningEffortLevel; + var (provider, model) = GetLlmProviderModel(); return new AgentLlmConfig { + Provider = provider, + Model = model, MaxOutputTokens = maxOutputTokens, ReasoningEffortLevel = reasoningEffortLevel };