BotSharp/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs

102 lines
2.3 KiB
C#
Raw Normal View History

2023-06-11 15:22:48 +00:00
namespace BotSharp.Abstraction.Agents.Models;
public class Agent
{
public string Id { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
2023-09-07 22:04:34 +00:00
public string Description { get; set; }
2023-06-11 15:22:48 +00:00
public DateTime CreatedDateTime { get; set; }
public DateTime UpdatedDateTime { get; set; }
2023-06-23 04:43:00 +00:00
/// <summary>
/// Instruction
/// </summary>
public string Instruction { get; set; }
/// <summary>
/// Samples
/// </summary>
public string Samples { get; set; }
2023-06-29 23:14:57 +00:00
/// <summary>
2023-07-26 21:05:30 +00:00
/// Functions
2023-06-29 23:14:57 +00:00
/// </summary>
2023-09-02 05:10:46 +00:00
public List<string> Functions { get; set; }
2023-06-29 23:14:57 +00:00
2023-06-11 15:22:48 +00:00
/// <summary>
2023-09-02 05:10:46 +00:00
/// Responses
2023-06-11 15:22:48 +00:00
/// </summary>
2023-09-02 05:10:46 +00:00
public List<string> Responses { get; set; }
2023-08-17 04:04:23 +00:00
2023-08-28 05:28:14 +00:00
/// <summary>
2023-09-02 05:10:46 +00:00
/// Domain knowledges
2023-08-28 05:28:14 +00:00
/// </summary>
2023-09-02 05:10:46 +00:00
public string Knowledges { get; set; }
2023-08-28 05:28:14 +00:00
2023-09-04 15:15:11 +00:00
public bool IsPublic { get; set; }
2023-08-17 04:04:23 +00:00
public override string ToString()
=> $"{Name} {Id}";
2023-09-02 05:10:46 +00:00
2023-09-07 22:04:34 +00:00
public static Agent Clone(Agent agent)
{
return new Agent
{
Id = agent.Id,
Name = agent.Name,
Description = agent.Description,
Instruction = agent.Instruction,
Functions = agent.Functions,
Responses = agent.Responses,
Samples = agent.Samples,
Knowledges = agent.Knowledges,
IsPublic = agent.IsPublic,
CreatedDateTime = agent.CreatedDateTime,
UpdatedDateTime = agent.UpdatedDateTime,
};
}
2023-09-02 05:10:46 +00:00
public Agent SetInstruction(string instruction)
{
Instruction = instruction;
return this;
}
public Agent SetFunctions(List<string> functions)
{
2023-09-03 04:11:53 +00:00
Functions = functions ?? new List<string>();
2023-09-02 05:10:46 +00:00
return this;
}
public Agent SetResponses(List<string> responses)
{
2023-09-03 04:11:53 +00:00
Responses = responses ?? new List<string>(); ;
2023-09-02 05:10:46 +00:00
return this;
}
2023-09-07 22:04:34 +00:00
public Agent SetId(string id)
{
Id = id;
return this;
}
public Agent SetName(string name)
{
Name = name;
return this;
}
public Agent SetDescription(string description)
{
Description = description;
return this;
}
public Agent SetIsPublic(bool isPublic)
{
IsPublic = isPublic;
return this;
}
2023-06-11 15:22:48 +00:00
}