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