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.
13 lines
387 B
C#
13 lines
387 B
C#
using Luna.Providers.Abstractions;
|
|
using Microsoft.Extensions.AI;
|
|
using OllamaSharp;
|
|
|
|
namespace Luna.Providers.Ollama;
|
|
|
|
public sealed class OllamaProvider(IHttpClientFactory httpClientFactory) : IProvider
|
|
{
|
|
public static string Name => "Ollama";
|
|
|
|
public IChatClient CreateChatClient(string model)
|
|
=> new OllamaApiClient(httpClientFactory.CreateClient(Name), model);
|
|
} |