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.
31 lines
968 B
C#
31 lines
968 B
C#
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; }
|
|
} |