diff --git a/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs b/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs index e8431cce..6faf6471 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/Handlers/RouteToAgentRoutingHandler.cs @@ -11,20 +11,20 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler public List Parameters => new List { - 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.", diff --git a/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instructions/instruction.liquid b/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instructions/instruction.liquid index bc614f81..182a2584 100644 --- a/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instructions/instruction.liquid +++ b/src/Infrastructure/BotSharp.Core/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instructions/instruction.liquid @@ -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 %} diff --git a/src/Plugins/BotSharp.Plugin.PythonInterpreter/InterpreterPlugin.cs b/src/Plugins/BotSharp.Plugin.PythonInterpreter/InterpreterPlugin.cs index 075038e1..be2e7c06 100644 --- a/src/Plugins/BotSharp.Plugin.PythonInterpreter/InterpreterPlugin.cs +++ b/src/Plugins/BotSharp.Plugin.PythonInterpreter/InterpreterPlugin.cs @@ -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(); services.AddScoped(); } + + public void Configure(IApplicationBuilder app) + { + var settings = app.ApplicationServices.GetRequiredService(); + + // 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(); + } }