BotSharp/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs

66 lines
1.9 KiB
C#
Raw Normal View History

2023-08-19 00:15:02 +00:00
using BotSharp.Abstraction.Agents.Models;
2023-09-27 20:49:44 +00:00
using BotSharp.Abstraction.Functions.Models;
2023-09-18 23:14:24 +00:00
using BotSharp.Abstraction.Routing.Models;
2023-08-19 00:15:02 +00:00
namespace BotSharp.OpenAPI.ViewModels.Agents;
public class AgentCreationModel
{
public string Name { get; set; }
public string Description { get; set; }
2023-10-09 00:05:17 +00:00
/// <summary>
/// LLM default system instructions
/// </summary>
public string Instruction { get; set; } = string.Empty;
/// <summary>
/// LLM extensible Instructions in addition to the default Instructions
/// </summary>
public List<AgentTemplate>? Templates { get; set; }
/// <summary>
/// LLM callable function definition
/// </summary>
public List<FunctionDef> Functions { get; set; } = new List<FunctionDef>();
/// <summary>
/// Response template
/// </summary>
public List<AgentResponse>? Responses { get; set; }
2023-09-04 15:15:11 +00:00
public bool IsPublic { get; set; }
2023-10-09 00:05:17 +00:00
/// <summary>
/// Whether to allow Router to transfer Request to this Agent
/// </summary>
2023-09-18 23:14:24 +00:00
public bool AllowRouting { get; set; }
public bool Disabled { get; set; }
2023-10-09 00:05:17 +00:00
/// <summary>
/// Combine different Agents together to form a Profile.
/// </summary>
public List<string> Profiles { get; set; } = new List<string>();
public List<RoutingRuleUpdateModel> RoutingRules { get; set; } = new List<RoutingRuleUpdateModel>();
2023-08-19 00:15:02 +00:00
public Agent ToAgent()
{
return new Agent
{
Name = Name,
2023-08-28 05:28:14 +00:00
Description = Description,
Instruction = Instruction,
2023-09-12 22:08:58 +00:00
Templates = Templates,
2023-08-28 05:28:14 +00:00
Functions = Functions,
2023-09-04 15:15:11 +00:00
Responses = Responses,
2023-09-18 23:14:24 +00:00
IsPublic = IsPublic,
AllowRouting = AllowRouting,
Disabled = Disabled,
Profiles = Profiles,
2023-09-19 18:18:29 +00:00
RoutingRules = RoutingRules?
2023-10-09 00:05:17 +00:00
.Select(x => RoutingRuleUpdateModel.ToDomainElement(x))?
.ToList() ?? new List<RoutingRule>()
2023-08-19 00:15:02 +00:00
};
}
}