Add provider abstraction layer with Mistral and Ollama implementations
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.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user