BotSharp/src/Infrastructure/BotSharp.Abstraction/MLTasks/Settings/LlmModelSetting.cs

89 lines
2.1 KiB
C#
Raw Normal View History

2023-12-13 18:12:25 +00:00
namespace BotSharp.Abstraction.MLTasks.Settings;
public class LlmModelSetting
{
2024-01-22 02:39:13 +00:00
/// <summary>
2025-03-22 00:28:22 +00:00
/// Model Id, like "gpt-4", "gpt-4o", "o1".
2024-01-22 02:39:13 +00:00
/// </summary>
2025-03-22 00:28:22 +00:00
public string Id { get; set; } = null!;
2024-01-22 02:39:13 +00:00
/// <summary>
/// Deployment model name
/// </summary>
2025-03-22 00:28:22 +00:00
public string Name { get; set; } = null!;
2024-01-22 02:39:13 +00:00
/// <summary>
/// Model version
/// </summary>
public string Version { get; set; } = "1106-Preview";
2024-01-22 02:39:13 +00:00
/// <summary>
/// Api version
/// </summary>
public string? ApiVersion { get; set; }
/// <summary>
2024-01-22 02:39:13 +00:00
/// Deployment same functional model in a group.
/// It can be used to deploy same model in different regions.
/// </summary>
public string? Group { get; set; }
2025-03-22 00:28:22 +00:00
public string ApiKey { get; set; } = null!;
public string? Endpoint { get; set; }
2023-12-13 18:12:25 +00:00
public LlmModelType Type { get; set; } = LlmModelType.Chat;
2024-05-13 21:53:41 +00:00
/// <summary>
/// If true, allow sending images/vidoes to this model
/// </summary>
public bool MultiModal { get; set; }
2025-02-03 04:02:36 +00:00
/// <summary>
/// If true, allow real-time interaction
/// </summary>
public bool RealTime { get; set; }
2024-06-24 19:32:52 +00:00
/// <summary>
/// If true, allow generating images
/// </summary>
public bool ImageGeneration { get; set; }
2023-12-13 18:12:25 +00:00
/// <summary>
/// Prompt cost per 1K token
/// </summary>
public float PromptCost { get; set; }
/// <summary>
/// Completion cost per 1K token
/// </summary>
public float CompletionCost { get; set; }
2024-08-22 20:23:22 +00:00
/// <summary>
/// Embedding dimension
/// </summary>
public int Dimension { get; set; }
2025-03-21 22:32:29 +00:00
public LlmCost AdditionalCost { get; set; } = new();
2023-12-13 18:12:25 +00:00
public override string ToString()
{
return $"[{Type}] {Name} {Endpoint}";
}
}
2025-03-21 22:32:29 +00:00
public class LlmCost
{
public float CachedPromptCost { get; set; } = 0f;
public float AudioPromptCost { get; set; } = 0f;
public float ReasoningCompletionCost { get; } = 0f;
public float AudioCompletionCost { get; } = 0f;
}
2023-12-13 18:12:25 +00:00
public enum LlmModelType
{
Text = 1,
2024-06-24 18:03:05 +00:00
Chat = 2,
2024-07-01 02:14:02 +00:00
Image = 3,
2024-08-26 22:24:07 +00:00
Embedding = 4,
Audio = 5
2023-12-13 18:12:25 +00:00
}