2023-08-28 03:50:10 +00:00
|
|
|
using BotSharp.Abstraction.Routing.Models;
|
2023-09-22 20:38:58 +00:00
|
|
|
using System.Text.Json;
|
2023-08-28 03:50:10 +00:00
|
|
|
|
|
|
|
|
namespace BotSharp.Abstraction.Functions.Models;
|
|
|
|
|
|
2023-09-25 22:46:00 +00:00
|
|
|
public class FunctionCallFromLlm : RoutingArgs
|
2023-08-28 03:50:10 +00:00
|
|
|
{
|
2023-09-22 20:38:58 +00:00
|
|
|
[JsonPropertyName("question")]
|
|
|
|
|
public string? Question { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonPropertyName("args")]
|
|
|
|
|
public JsonDocument Arguments { get; set; } = JsonDocument.Parse("{}");
|
2023-09-19 12:17:50 +00:00
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2023-09-25 22:46:00 +00:00
|
|
|
var route = string.IsNullOrEmpty(AgentName) ? "" : $"<Route to {AgentName.ToUpper()} because {Reason}>";
|
|
|
|
|
|
2023-09-22 20:38:58 +00:00
|
|
|
if (string.IsNullOrEmpty(Answer))
|
|
|
|
|
{
|
2023-09-25 22:46:00 +00:00
|
|
|
return $"[{Function} {route} {JsonSerializer.Serialize(Arguments)}]: {Question}";
|
2023-09-22 20:38:58 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-09-25 22:46:00 +00:00
|
|
|
return $"[{Function} {route} {JsonSerializer.Serialize(Arguments)}]: {Question} => {Answer}";
|
2023-09-22 20:38:58 +00:00
|
|
|
}
|
2023-09-19 12:17:50 +00:00
|
|
|
}
|
2023-08-28 03:50:10 +00:00
|
|
|
}
|