BotSharp/src/Plugins/BotSharp.Plugin.OpenAI/Models/Realtime/RealtimeSessionBody.cs

54 lines
1.5 KiB
C#
Raw Normal View History

2025-02-03 04:02:36 +00:00
using BotSharp.Abstraction.Functions.Models;
2025-02-07 17:18:47 +00:00
namespace BotSharp.Plugin.OpenAI.Models.Realtime;
2025-02-03 04:02:36 +00:00
2025-02-07 17:18:47 +00:00
public class RealtimeSessionBody
2025-02-03 04:02:36 +00:00
{
2025-02-07 17:18:47 +00:00
[JsonPropertyName("id")]
public string Id { get; set; } = null!;
[JsonPropertyName("object")]
public string Object { get; set; } = null!;
2025-02-03 04:02:36 +00:00
[JsonPropertyName("model")]
2025-02-07 17:18:47 +00:00
public string Model { get; set; } = null!;
2025-02-03 04:02:36 +00:00
[JsonPropertyName("temperature")]
public float temperature { get; set; } = 0.8f;
[JsonPropertyName("modalities")]
public string[] Modalities { get; set; } = ["audio", "text"];
[JsonPropertyName("instructions")]
public string Instructions { get; set; } = "You are a friendly assistant.";
[JsonPropertyName("max_response_output_tokens")]
public int MaxResponseOutputTokens { get; set; } = 512;
[JsonPropertyName("tool_choice")]
public string ToolChoice { get; set; } = "auto";
[JsonPropertyName("tools")]
public FunctionDef[] Tools { get; set; } = [];
[JsonPropertyName("turn_detection")]
public RealtimeSessionTurnDetection TurnDetection { get; set; } = new();
}
public class RealtimeSessionTurnDetection
{
/// <summary>
/// Milliseconds
/// </summary>
[JsonPropertyName("prefix_padding_ms")]
public int PrefixPadding { get; set; } = 300;
[JsonPropertyName("silence_duration_ms")]
public int SilenceDuration { get; set; } = 500;
[JsonPropertyName("threshold")]
public float Threshold { get; set; } = 0.5f;
[JsonPropertyName("type")]
public string Type { get; set; } = "server_vad";
}