BotSharp/src/Infrastructure/BotSharp.Abstraction/Routing/Models/RoutingArgs.cs

61 lines
1.8 KiB
C#
Raw Normal View History

2023-08-28 03:50:10 +00:00
namespace BotSharp.Abstraction.Routing.Models;
public class RoutingArgs
{
2023-09-26 16:18:42 +00:00
[JsonPropertyName("function")]
2023-10-13 20:08:59 +00:00
public string Function { get; set; }
2023-09-26 16:18:42 +00:00
/// <summary>
/// The reason why you select this function or agent
/// </summary>
[JsonPropertyName("next_action_reason")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2024-03-22 19:06:20 +00:00
public string? NextActionReason { get; set; }
[JsonPropertyName("reason")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Reason { get; set; }
[JsonPropertyName("conversation_end")]
public bool ConversationEnd { get; set; }
2023-09-26 16:18:42 +00:00
/// <summary>
/// The content of replying to user
/// </summary>
[JsonPropertyName("response")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string Response { get; set; }
2023-09-26 16:18:42 +00:00
/// <summary>
/// Agent for next action based on user latest response
/// </summary>
[JsonPropertyName("next_action_agent")]
2023-10-20 03:47:14 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string AgentName { get; set; }
/// <summary>
/// Agent who can achieve user original goal
/// </summary>
[JsonPropertyName("user_goal_agent")]
2023-10-20 03:47:14 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string OriginalAgent { get; set; }
[JsonPropertyName("user_goal_description")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string UserGoal { get; set; }
public override string ToString()
{
2024-03-22 19:06:20 +00:00
var route = string.IsNullOrEmpty(AgentName) ? "" : $"<Route to {AgentName.ToUpper()} because {NextActionReason}>";
2023-09-26 16:18:42 +00:00
if (string.IsNullOrEmpty(Response))
2023-09-26 16:18:42 +00:00
{
return $"[{Function} {route}]";
}
else
{
return $"[{Function} {route}] => {Response}";
2023-09-26 16:18:42 +00:00
}
}
}