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
|
|
|
|
2024-02-22 12:22:26 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Model version
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Version { get; set; } = "1106-Preview";
|
|
|
|
|
|
2024-01-22 02:39:13 +00:00
|
|
|
/// <summary>
|
2024-07-24 22:54:49 +00:00
|
|
|
/// 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; }
|
|
|
|
|
|
2024-06-24 19:32:52 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// If true, allow generating images
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool ImageGeneration { get; set; }
|
|
|
|
|
|
2024-08-22 20:23:22 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Embedding dimension
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int Dimension { get; set; }
|
|
|
|
|
|
2025-08-12 16:33:51 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Settings for reasoning model
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ReasoningSetting? Reasoning { get; set; }
|
|
|
|
|
|
2025-08-19 18:37:34 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Settings for web search
|
|
|
|
|
/// </summary>
|
|
|
|
|
public WebSearchSetting? WebSearch { get; set; }
|
|
|
|
|
|
2025-08-19 20:43:45 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Settings for images
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ImageSetting? Image { get; set; }
|
|
|
|
|
|
2025-08-12 16:33:51 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Settings for llm cost
|
|
|
|
|
/// </summary>
|
|
|
|
|
public LlmCostSetting Cost { get; set; } = new();
|
2025-03-21 22:32:29 +00:00
|
|
|
|
2023-12-13 18:12:25 +00:00
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return $"[{Type}] {Name} {Endpoint}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-12 16:33:51 +00:00
|
|
|
public class ReasoningSetting
|
|
|
|
|
{
|
|
|
|
|
public float Temperature { get; set; } = 1.0f;
|
|
|
|
|
public string? EffortLevel { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-19 18:37:34 +00:00
|
|
|
public class WebSearchSetting
|
|
|
|
|
{
|
|
|
|
|
public string? SearchContextSize { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-19 20:43:45 +00:00
|
|
|
public class ImageSetting
|
|
|
|
|
{
|
|
|
|
|
public ImageGenerationSetting? Generation { get; set; }
|
|
|
|
|
public ImageEditSetting? Edit { get; set; }
|
|
|
|
|
public ImageVariationSetting? Variation { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ImageGenerationSetting
|
|
|
|
|
{
|
|
|
|
|
public ModelSettingBase? Style { get; set; }
|
|
|
|
|
public ModelSettingBase? Size { get; set; }
|
|
|
|
|
public ModelSettingBase? Quality { get; set; }
|
|
|
|
|
public ModelSettingBase? ResponseFormat { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ImageEditSetting
|
|
|
|
|
{
|
|
|
|
|
public ModelSettingBase? Size { get; set; }
|
|
|
|
|
public ModelSettingBase? ResponseFormat { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ImageVariationSetting
|
|
|
|
|
{
|
|
|
|
|
public ModelSettingBase? Size { get; set; }
|
|
|
|
|
public ModelSettingBase? ResponseFormat { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ModelSettingBase
|
|
|
|
|
{
|
|
|
|
|
public string? Default { get; set; }
|
|
|
|
|
public IEnumerable<string>? Options { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-04-21 16:19:56 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Cost per 1K tokens
|
|
|
|
|
/// </summary>
|
2025-08-12 16:33:51 +00:00
|
|
|
public class LlmCostSetting
|
2025-03-21 22:32:29 +00:00
|
|
|
{
|
2025-04-21 16:19:56 +00:00
|
|
|
// Input
|
|
|
|
|
public float TextInputCost { get; set; } = 0f;
|
|
|
|
|
public float CachedTextInputCost { get; set; } = 0f;
|
|
|
|
|
public float AudioInputCost { get; set; } = 0f;
|
|
|
|
|
public float CachedAudioInputCost { get; set; } = 0f;
|
|
|
|
|
|
|
|
|
|
// Output
|
|
|
|
|
public float TextOutputCost { get; set; } = 0f;
|
|
|
|
|
public float AudioOutputCost { get; set; } = 0f;
|
2025-03-21 22:32:29 +00:00
|
|
|
}
|
|
|
|
|
|
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,
|
2025-04-02 17:02:02 +00:00
|
|
|
Audio = 5,
|
|
|
|
|
Realtime = 6,
|
2023-12-13 18:12:25 +00:00
|
|
|
}
|