using BotSharp.Abstraction.Functions.Models; using BotSharp.Abstraction.Repositories; using BotSharp.Abstraction.Routing; using BotSharp.Abstraction.Routing.Models; using BotSharp.Abstraction.Routing.Settings; using BotSharp.Core.Planning; namespace BotSharp.Core.Routing.Handlers; /// /// Retrieve information from specific agent /// public class RetrieveDataFromAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler { public string Name => "retrieve_data_from_agent"; public string Description => "Retrieve data from appropriate agent."; public List Parameters => new List { new ParameterPropertyDef("reason", "why retrieve data"), new ParameterPropertyDef("question", "the question you will ask the agent to get the necessary data"), new ParameterPropertyDef("next_action_agent", "agent that can handle the question"), new ParameterPropertyDef("args", "required parameters extracted from question and hand over to the next agent") { Type = "object" } }; public List Planers => new List { nameof(ReasoningPlanner) }; public RetrieveDataFromAgentRoutingHandler(IServiceProvider services, ILogger logger, RoutingSettings settings) : base(services, logger, settings) { } public async Task Handle(IRoutingService routing, FunctionCallFromLlm inst, RoleDialogModel message) { var context = _services.GetRequiredService(); var ret = await routing.InvokeAgent(context.GetCurrentAgentId(), message); return ret; } }