Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/Plugins/BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public async Task<bool> Execute(RoleDialogModel message)
Id = agent.Id,
Name = agent.Name,
Instruction = inst,
LlmConfig = new AgentLlmConfig
{
MaxOutputTokens = _settings?.ChartPlot?.MaxOutputTokens ?? 8192
},
LlmConfig = GetLlmConfig(),
TemplateDict = new Dictionary<string, object>
{
{ "plotting_requirement", args?.PlottingRequirement ?? string.Empty },
Expand Down Expand Up @@ -147,4 +144,20 @@ private string GetChartPlotInstruction(string agentId)

return (provider, model);
}

private AgentLlmConfig GetLlmConfig()
{
var maxOutputTokens = _settings?.ChartPlot?.MaxOutputTokens ?? 8192;
var reasoningEffortLevel = _settings?.ChartPlot?.ReasoningEffortLevel ?? "minimal";

var state = _services.GetRequiredService<IConversationStateService>();
maxOutputTokens = int.TryParse(state.GetState("chart_plot_max_output_tokens"), out var tokens) ? tokens : maxOutputTokens;
reasoningEffortLevel = state.GetState("chart_plot_reasoning_effort_level").IfNullOrEmptyAs(reasoningEffortLevel);

return new AgentLlmConfig
{
MaxOutputTokens = maxOutputTokens,
ReasoningEffortLevel = reasoningEffortLevel
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ public class ChartPlotSetting
public string? LlmProvider { get; set; }
public string? LlmModel { get; set; }
public int? MaxOutputTokens { get; set; }
public string? ReasoningEffortLevel { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You must strictly follow the "Hard Requirements", "Render Requirements", "Code R
* Ensure the chart fully expands and scales to the entire screen when fullscreen is active.
* fullscreenBtn must be a fully-formed object {show: true, name, title, icon: 'path://M3 3 H9 V5 H5 V9 H3 Z M15 3 H21 V9 H19 V5 H15 Z M3 15 H5 V19 H9 V21 H3 Z M19 15 H21 V21 H15 V19 H19 Z', onclick}.
* When using "chart.setOption" to define the fullscreen button, DO NOT use "graphic". Include the fullscreenBtn object in toolbox.feature with name 'myFullscreen'.
** Initialize the chart with explicit non-zero width (at least 800px) and non-zero height (at least 500px).
** You must initialize the chart with explicit non-zero width (at least 800px) and non-zero height (at least 500px).


***** Render Requirements *****
Expand Down
4 changes: 3 additions & 1 deletion src/WebStarter/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@
"ChartHandler": {
"ChartPlot": {
"LlmProvider": "openai",
"LlmModel": "gpt-5"
"LlmModel": "gpt-5",
"MaxOutputTokens": 8192,
"ReasoningEffortLevel": "minimal"
}
},

Expand Down
Loading