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;
|
|
|
|
|
|
|
|
|
|
public class FunctionCallFromLlm
|
|
|
|
|
{
|
|
|
|
|
[JsonPropertyName("function")]
|
2023-09-21 13:08:27 +00:00
|
|
|
public string Function { get; set; } = string.Empty;
|
|
|
|
|
|
2023-09-22 20:38:58 +00:00
|
|
|
[JsonPropertyName("route")]
|
|
|
|
|
public RoutingArgs Route { get; set; } = new 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("answer")]
|
|
|
|
|
public string? Answer { 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-22 20:38:58 +00:00
|
|
|
if (string.IsNullOrEmpty(Answer))
|
|
|
|
|
{
|
|
|
|
|
return $"[{Function} {Route} {JsonSerializer.Serialize(Arguments)}]: {Question}";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return $"[{Function} {Route} {JsonSerializer.Serialize(Arguments)}]: {Question} => {Answer}";
|
|
|
|
|
}
|
2023-09-19 12:17:50 +00:00
|
|
|
}
|
2023-08-28 03:50:10 +00:00
|
|
|
}
|