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,31 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Luna.Providers.Mistral.DTOs;
|
||||
|
||||
public class MistralChatCompletionRequest
|
||||
{
|
||||
[JsonPropertyName("model")]
|
||||
public required string Model { get; set; }
|
||||
|
||||
[JsonPropertyName("messages")]
|
||||
public required List<MistralMessage> Messages { get; set; }
|
||||
|
||||
[JsonPropertyName("temperature")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public float? Temperature { get; set; }
|
||||
|
||||
[JsonPropertyName("max_tokens")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public int? MaxTokens { get; set; }
|
||||
|
||||
[JsonPropertyName("top_p")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public float? TopP { get; set; }
|
||||
|
||||
[JsonPropertyName("stream")]
|
||||
public bool Stream { get; set; }
|
||||
|
||||
[JsonPropertyName("response_format")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public ResponseFormat? ResponseFormat { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user