default as route_to_agent

This commit is contained in:
Haiping Chen 2024-08-23 10:16:37 -05:00
parent 13e9ef0067
commit 22fa6e4f68
3 changed files with 30 additions and 7 deletions

View file

@ -11,20 +11,20 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler
public List<ParameterPropertyDef> Parameters => new List<ParameterPropertyDef>
{
new ParameterPropertyDef("next_action_reason",
/*new ParameterPropertyDef("next_action_reason",
"the reason why route to this virtual agent.",
required: true),
required: true),*/
new ParameterPropertyDef("next_action_agent",
"agent for next action based on user latest response, if user is replying last agent's question, you must route to this agent.",
required: true),
new ParameterPropertyDef("args",
"useful parameters of next action agent, format: { }",
type: "object"),
new ParameterPropertyDef("user_goal_description",
/*new ParameterPropertyDef("user_goal_description",
"user goal based on user initial task.",
required: true),
required: true),*/
new ParameterPropertyDef("user_goal_agent",
"agent who can acheive user initial task, must align with user_goal_description.",
"agent who can acheive user initial task.",
required: true),
new ParameterPropertyDef("conversation_end",
"user is ending the conversation.",

View file

@ -19,7 +19,6 @@ Follow these steps to handle user request:
# {{ handler.description}}
{% if handler.parameters and handler.parameters != empty -%}
Parameters:
- function: {{ handler.name }}
{% for p in handler.parameters -%}
- {{ p.name }} {% if p.required -%}(required){%- endif %}: {{ p.description }}{{ "\r\n " }}
{%- endfor %}

View file

@ -1,8 +1,12 @@
using BotSharp.Abstraction.Interpreters.Settings;
using BotSharp.Plugin.PythonInterpreter.Hooks;
using Microsoft.AspNetCore.Builder;
using Python.Runtime;
using System.IO;
namespace BotSharp.Plugin.PythonInterpreter;
public class InterpreterPlugin : IBotSharpPlugin
public class InterpreterPlugin : IBotSharpAppPlugin
{
public string Id => "23174e08-e866-4173-824a-cf1d97afa8d0";
public string Name => "Python Interpreter";
@ -14,4 +18,24 @@ public class InterpreterPlugin : IBotSharpPlugin
services.AddScoped<IAgentHook, InterpreterAgentHook>();
services.AddScoped<IAgentUtilityHook, InterpreterUtilityHook>();
}
public void Configure(IApplicationBuilder app)
{
var settings = app.ApplicationServices.GetRequiredService<InterpreterSettings>();
// For Python interpreter plugin
if (File.Exists(settings.Python.PythonDLL))
{
Runtime.PythonDLL = settings.Python.PythonDLL;
PythonEngine.Initialize();
PythonEngine.BeginAllowThreads();
}
else
{
Serilog.Log.Error("Python DLL found at {PythonDLL}", settings.Python.PythonDLL);
}
// Shut down the Python engine
// PythonEngine.Shutdown();
}
}