57 lines
1.3 KiB
C#
57 lines
1.3 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace Toak.Api.Models;
|
|
|
|
public class OpenAiRequestMessage
|
|
{
|
|
[JsonPropertyName("role")]
|
|
public string Role { get; set; } = string.Empty;
|
|
[JsonPropertyName("content")]
|
|
public string Content { get; set; } = string.Empty;
|
|
}
|
|
|
|
public class OpenAiRequest
|
|
{
|
|
[JsonPropertyName("model")]
|
|
public string Model { get; set; } = "llama-3.1-8b-instant";
|
|
[JsonPropertyName("messages")]
|
|
public OpenAiRequestMessage[] Messages { get; set; } = [];
|
|
[JsonPropertyName("temperature")]
|
|
public double Temperature { get; set; } = 0.0;
|
|
[JsonPropertyName("stream")]
|
|
public bool? Stream { get; set; }
|
|
[JsonPropertyName("reasoning_effort")]
|
|
public string? ReasoningEffort { get; set; }
|
|
}
|
|
|
|
public class OpenAiResponse
|
|
{
|
|
[JsonPropertyName("choices")]
|
|
public OpenAiChoice[] Choices { get; set; } = [];
|
|
}
|
|
|
|
public class OpenAiChoice
|
|
{
|
|
[JsonPropertyName("message")]
|
|
public OpenAiRequestMessage Message { get; set; } = new();
|
|
}
|
|
|
|
public class OpenAiStreamResponse
|
|
{
|
|
[JsonPropertyName("choices")]
|
|
public OpenAiStreamChoice[] Choices { get; set; } = [];
|
|
}
|
|
|
|
public class OpenAiStreamChoice
|
|
{
|
|
[JsonPropertyName("delta")]
|
|
public OpenAiStreamDelta Delta { get; set; } = new();
|
|
}
|
|
|
|
public class OpenAiStreamDelta
|
|
{
|
|
[JsonPropertyName("content")]
|
|
public string? Content { get; set; }
|
|
}
|
|
|