AI-Studio/app/MindWork AI Studio/Provider/OpenRouter/OpenRouterModel.cs

25 lines
942 B
C#
Raw Normal View History

2025-12-15 18:31:51 +00:00
namespace AIStudio.Provider.OpenRouter;
/// <summary>
/// A data model for an OpenRouter model from the API.
/// </summary>
/// <param name="Id">The model's ID.</param>
/// <param name="Name">The model's human-readable display name.</param>
2026-09-10 15:02:25 +00:00
/// <param name="Reasoning">The model's provider-reported reasoning behavior.</param>
public readonly record struct OpenRouterModel(string Id, string? Name, OpenRouterReasoning? Reasoning)
{
2026-09-10 15:32:38 +00:00
/// <summary>
/// Converts the catalog entry into the model the rest of the app works with.
/// </summary>
2026-09-10 15:02:25 +00:00
public Model ToModel() => new(this.Id, this.Name)
{
ReasoningBehavior = this.Reasoning switch
{
{ Mandatory: true } => ModelReasoningBehavior.ALWAYS_ON,
{ DefaultEnabled: true } => ModelReasoningBehavior.DEFAULT_ON,
not null => ModelReasoningBehavior.OPTIONAL,
_ => ModelReasoningBehavior.UNKNOWN,
},
};
}