rename and refine instructions

This commit is contained in:
Jicheng Lu 2025-07-01 12:01:09 -05:00
parent e4ad50cb7b
commit ba485cef48
11 changed files with 31 additions and 29 deletions

View file

@ -86,7 +86,6 @@
<None Remove="data\agents\01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a\templates\conversation.summary.liquid" />
<None Remove="data\agents\01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a\templates\response_with_function.liquid" />
<None Remove="data\agents\01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a\templates\translation_prompt.liquid" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\select_file_prompt.liquid" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-routing-fallback_to_router.fn.liquid" />
<None Remove="data\agents\dfd9b46d-d00c-40af-8a75-3fbdc2b89869\agent.json" />
<None Remove="data\agents\dfd9b46d-d00c-40af-8a75-3fbdc2b89869\instructions\instruction.liquid" />
@ -97,6 +96,7 @@
<None Remove="data\agents\dfd9b46d-d00c-40af-8a75-3fbdc2b89869\templates\instruction.simulator.liquid" />
<None Remove="data\plugins\config.json" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-file-select_file_instruction.liquid" />
<None Remove="data\agents\01e2fc5c-2c89-4ec7-8470-7688608b496c\functions\get_weather.json" />
</ItemGroup>
@ -188,7 +188,7 @@
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\instructions\instruction.liquid">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\select_file_prompt.liquid">
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-file-select_file_instruction.liquid">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="data\agents\dfd9b46d-d00c-40af-8a75-3fbdc2b89869\templates\instruction.simulator.liquid">

View file

@ -65,7 +65,7 @@ public partial class FileInstructService
}).ToList();
var agentId = !string.IsNullOrWhiteSpace(options.AgentId) ? options.AgentId : BuiltInAgentId.UtilityAssistant;
var template = !string.IsNullOrWhiteSpace(options.Template) ? options.Template : "select_file_prompt";
var template = !string.IsNullOrWhiteSpace(options.Template) ? options.Template : "util-file-select_file_instruction";
var foundAgent = db.GetAgent(agentId);
var prompt = db.GetAgentTemplate(BuiltInAgentId.UtilityAssistant, template);

View file

@ -7,18 +7,19 @@
</PropertyGroup>
<ItemGroup>
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-chart-generate_chart.json" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-chart-generate_chart.fn.liquid" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-chart-plot_chart.json" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-chart-plot_chart.fn.liquid" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-chart-plot_instruction.liquid" />
</ItemGroup>
<ItemGroup>
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-chart-generate_chart.json">
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-chart-plot_chart.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-chart-generate_chart.fn.liquid">
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-chart-plot_chart.fn.liquid">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-chart-plot-instruction.liquid">
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-chart-plot_instruction.liquid">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

View file

@ -2,5 +2,5 @@ namespace BotSharp.Plugin.ChartHandler.Enums;
public class UtilityName
{
public const string ChartGenerator = "chart-generator";
public const string ChartPlotter = "chart-plotter";
}

View file

@ -2,18 +2,18 @@ using BotSharp.Abstraction.Messaging.Models.RichContent.Template;
namespace BotSharp.Plugin.ChartHandler.Functions;
public class GenerateChartFn : IFunctionCallback
public class PlotChartFn : IFunctionCallback
{
private readonly IServiceProvider _services;
private readonly ILogger<GenerateChartFn> _logger;
private readonly ILogger<PlotChartFn> _logger;
public string Name => "util-chart-generate_chart";
public string Indication => "Generating chart";
public string Name => "util-chart-plot_chart";
public string Indication => "Plotting chart";
public GenerateChartFn(
public PlotChartFn(
IServiceProvider services,
ILogger<GenerateChartFn> logger)
ILogger<PlotChartFn> logger)
{
_services = services;
_logger = logger;
@ -27,7 +27,7 @@ public class GenerateChartFn : IFunctionCallback
var args = JsonSerializer.Deserialize<LlmContextIn>(message.FunctionArgs);
var agent = await agentService.GetAgent(message.CurrentAgentId);
var inst = db.GetAgentTemplate(BuiltInAgentId.UtilityAssistant, "util-chart-plot-instruction");
var inst = db.GetAgentTemplate(BuiltInAgentId.UtilityAssistant, "util-chart-plot_instruction");
var innerAgent = new Agent
{
Id = agent.Id,
@ -48,7 +48,7 @@ public class GenerateChartFn : IFunctionCallback
}
]);
message.Content = response;
message.Content = "Here is the chart you ask for:";
message.RichContent = new RichContent<IRichMessage>
{
Recipient = new Recipient { Id = convService.ConversationId },

View file

@ -2,21 +2,21 @@ namespace BotSharp.Plugin.ChartHandler.Hooks;
public class ChartHandlerUtilityHook : IAgentUtilityHook
{
private const string GENERATE_CHART_FN = "util-chart-generate_chart";
private const string PLOT_CHART_FN = "util-chart-plot_chart";
public void AddUtilities(List<AgentUtility> utilities)
{
var item = new AgentUtility
{
Category = "chart",
Name = UtilityName.ChartGenerator,
Name = UtilityName.ChartPlotter,
Items = [
new UtilityItem
{
FunctionName = GENERATE_CHART_FN,
TemplateName = $"{GENERATE_CHART_FN}.fn"
}
]
new UtilityItem
{
FunctionName = PLOT_CHART_FN,
TemplateName = $"{PLOT_CHART_FN}.fn"
}
]
};
utilities.Add(item);

View file

@ -1,12 +1,12 @@
{
"name": "util-chart-generate_chart",
"description": "If the user requests you plotting or generating chart, you can call this function to generate chart in any format that user requested.",
"name": "util-chart-plot_chart",
"description": "If the user requests you plotting or generating charts, you can call this function to generate charts in any format that user requested.",
"parameters": {
"type": "object",
"properties": {
"plotting_requirement": {
"type": "string",
"description": "The requirement that user posted for plotting or generating chart."
"description": "The requirement that user posted for plotting or generating charts."
}
},
"required": [ "plotting_requirement" ]

View file

@ -1 +0,0 @@
Please call function util-chart-generate_chart if user wants to generate a chart.

View file

@ -0,0 +1 @@
Please call function util-chart-plot_chart if user wants to plot or generate charts.

View file

@ -9,4 +9,5 @@ Please take a look at "Plotting Requirement" and generate a javascript code that
** You must not create any new html element.
** You must output the javascript code only, and wrap it between the script tag.
** You need to import Plotly.js in the same script tag. The script source should be "https://cdn.plot.ly/plotly-3.0.1.min.js".
** You need to add the MODE bar for each chart you plot.
** You must not apply any styles on the div html element.