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

90 lines
2.7 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-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; }
2024-01-26 04:32:48 +00:00
public string Type { get; set; } = AgentType.Task;
2023-10-09 00:05:17 +00:00
/// <summary>
/// LLM default system instructions
/// </summary>
public string Instruction { get; set; } = string.Empty;
2024-08-13 21:36:12 +00:00
/// <summary>
///
/// </summary>
public List<ChannelInstruction> ChannelInstructions { get; set; } = new();
2023-10-09 00:05:17 +00:00
/// <summary>
/// LLM extensible Instructions in addition to the default Instructions
/// </summary>
2024-08-13 21:36:12 +00:00
public List<AgentTemplate> Templates { get; set; } = new();
2023-10-09 00:05:17 +00:00
/// <summary>
/// LLM callable function definition
/// </summary>
2024-08-13 21:36:12 +00:00
public List<FunctionDef> Functions { get; set; } = new();
2023-10-09 00:05:17 +00:00
/// <summary>
/// Response template
/// </summary>
2024-08-13 21:36:12 +00:00
public List<AgentResponse> Responses { get; set; } = new();
public List<string> Samples { get; set; } = new();
2023-10-09 00:05:17 +00:00
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>
2024-08-13 21:36:12 +00:00
public List<string> Profiles { get; set; } = new();
2024-11-20 23:57:44 +00:00
2025-01-30 17:14:52 +00:00
public List<string> Labels { get; set; } = new();
2024-11-20 23:57:44 +00:00
public bool MergeUtility { get; set; }
2024-12-13 20:34:17 +00:00
public int? MaxMessageCount { get; set; }
2024-11-20 23:10:38 +00:00
public List<AgentUtility> Utilities { get; set; } = new();
2024-08-13 21:36:12 +00:00
public List<RoutingRuleUpdateModel> RoutingRules { get; set; } = new();
2024-12-30 03:49:38 +00:00
public List<AgentKnowledgeBase> KnowledgeBases { get; set; } = new();
2025-01-07 19:50:50 +00:00
public List<AgentRule> Rules { get; set; } = new();
2023-12-13 20:26:46 +00:00
public AgentLlmConfig? LlmConfig { get; set; }
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,
2024-08-13 21:36:12 +00:00
ChannelInstructions = ChannelInstructions,
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,
Samples = Samples,
2024-07-02 18:36:45 +00:00
Utilities = Utilities,
2023-09-18 23:14:24 +00:00
IsPublic = IsPublic,
2024-01-26 04:32:48 +00:00
Type = Type,
2023-09-18 23:14:24 +00:00
Disabled = Disabled,
2024-11-20 23:57:44 +00:00
MergeUtility = MergeUtility,
2024-12-13 20:34:17 +00:00
MaxMessageCount = MaxMessageCount,
2023-09-18 23:14:24 +00:00
Profiles = Profiles,
2025-01-30 17:14:52 +00:00
Labels = Labels,
2024-12-30 03:49:38 +00:00
LlmConfig = LlmConfig,
KnowledgeBases = KnowledgeBases,
2025-01-07 19:50:50 +00:00
Rules = Rules,
2024-12-30 03:49:38 +00:00
RoutingRules = RoutingRules?.Select(x => RoutingRuleUpdateModel.ToDomainElement(x))?.ToList() ?? [],
2023-08-19 00:15:02 +00:00
};
}
}