Define IProvider interface and implement concrete providers for Mistral (with custom DTOs for chat completion API) and Ollama (via OllamaSharp). Includes DI registration extensions using Microsoft.Extensions.AI.
17 lines
584 B
C#
17 lines
584 B
C#
using Luna.Providers.Abstractions;
|
|
using Microsoft.Extensions.AI;
|
|
|
|
namespace Luna.Providers.Mistral;
|
|
|
|
/// <summary>
|
|
/// Mistral API provider implementation for the Luna AI Assistant.
|
|
/// Uses Mistral's OpenAI-compatible chat completion API endpoint.
|
|
/// Reference: https://docs.mistral.ai/api/
|
|
/// </summary>
|
|
public sealed class MistralProvider(IHttpClientFactory httpClientFactory) : IProvider
|
|
{
|
|
public static string Name => "Mistral";
|
|
|
|
public IChatClient CreateChatClient(string modelId)
|
|
=> new MistralChatClient(httpClientFactory.CreateClient(Name), modelId);
|
|
} |