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,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);
|
||||
}
|
||||
Reference in New Issue
Block a user