add reasoning effort in chart plot

This commit is contained in:
Jicheng Lu 2025-09-10 14:31:03 -05:00
parent 11d85805d8
commit ee758e02ec
4 changed files with 22 additions and 6 deletions

View file

@ -36,10 +36,7 @@ public class PlotChartFn : IFunctionCallback
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 },
@ -147,4 +144,20 @@ public class PlotChartFn : IFunctionCallback
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
};
}
}

View file

@ -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; }
}

View file

@ -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 *****

View file

@ -320,7 +320,9 @@
"ChartHandler": {
"ChartPlot": {
"LlmProvider": "openai",
"LlmModel": "gpt-5"
"LlmModel": "gpt-5",
"MaxOutputTokens": 8192,
"ReasoningEffortLevel": "minimal"
}
},