diff --git a/src/Infrastructure/BotSharp.Abstraction/Routing/Models/RoutingArgs.cs b/src/Infrastructure/BotSharp.Abstraction/Routing/Models/RoutingArgs.cs index 1c9bf32e..d3c1bb65 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Routing/Models/RoutingArgs.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Routing/Models/RoutingArgs.cs @@ -9,12 +9,10 @@ public class RoutingArgs public string Reason { get; set; } = string.Empty; [JsonPropertyName("answer")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Answer { get; set; } + public string Answer { get; set; } = string.Empty; [JsonPropertyName("agent")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? AgentName { get; set; } + public string AgentName { get; set; } = string.Empty; public override string ToString() { diff --git a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetNextInstruction.cs b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetNextInstruction.cs index 84fe62b0..4b0468cb 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetNextInstruction.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.GetNextInstruction.cs @@ -9,23 +9,13 @@ public partial class RoutingService { public async Task GetNextInstruction(string prompt) { - var responseRouteToAgent = _settings.EnableReasoning ? + var responseFormat = _settings.EnableReasoning ? JsonSerializer.Serialize(new FunctionCallFromLlm()) : JsonSerializer.Serialize(new RoutingArgs { - Function = "route_to_agent", - AgentName = "" + Function = "route_to_agent" }); - - var responseResponseToUser = _settings.EnableReasoning ? - JsonSerializer.Serialize(new FunctionCallFromLlm()) : - JsonSerializer.Serialize(new RoutingArgs - { - Function = "response_to_user", - Answer = "" - }); - - var content = $"{prompt}\r\nIf need to route to specific agent, output in JSON {responseRouteToAgent}.\r\nIf you can handle the request directly, output in JSON {responseResponseToUser}."; + var content = $"{prompt} Response must be in JSON format {responseFormat}"; var state = _services.GetRequiredService();