BotSharp/src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionCallFromLlm.cs
2023-09-22 15:38:58 -05:00

35 lines
950 B
C#

using BotSharp.Abstraction.Routing.Models;
using System.Text.Json;
namespace BotSharp.Abstraction.Functions.Models;
public class FunctionCallFromLlm
{
[JsonPropertyName("function")]
public string Function { get; set; } = string.Empty;
[JsonPropertyName("route")]
public RoutingArgs Route { get; set; } = new RoutingArgs();
[JsonPropertyName("question")]
public string? Question { get; set; }
[JsonPropertyName("answer")]
public string? Answer { get; set; }
[JsonPropertyName("args")]
public JsonDocument Arguments { get; set; } = JsonDocument.Parse("{}");
public override string ToString()
{
if (string.IsNullOrEmpty(Answer))
{
return $"[{Function} {Route} {JsonSerializer.Serialize(Arguments)}]: {Question}";
}
else
{
return $"[{Function} {Route} {JsonSerializer.Serialize(Arguments)}]: {Question} => {Answer}";
}
}
}