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:
2026-04-04 04:10:39 +02:00
parent a4ed65e452
commit 1c42c8c006
18 changed files with 515 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
using Microsoft.Extensions.AI;
namespace Luna.Providers.Abstractions;
public interface IProvider
{
public static virtual string Name { get; } = null!;
public sealed IChatClient GetChatClient(string modelId)
{
var client = CreateChatClient(modelId);
return new ChatClientBuilder(client)
.UseFunctionInvocation()
.Build();
}
protected IChatClient CreateChatClient(string model);
}