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

75 lines
2.3 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")]
2025-02-09 23:31:46 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2025-02-07 17:18:47 +00:00
public string Id { get; set; } = null!;
[JsonPropertyName("object")]
2025-02-09 23:31:46 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2025-02-07 17:18:47 +00:00
public string Object { get; set; } = null!;
2025-02-03 04:02:36 +00:00
[JsonPropertyName("model")]
2025-02-09 23:31:46 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2025-02-07 17:18:47 +00:00
public string Model { get; set; } = null!;
2025-02-03 04:02:36 +00:00
[JsonPropertyName("temperature")]
2025-02-09 23:31:46 +00:00
public float Temperature { get; set; } = 0.8f;
2025-02-03 04:02:36 +00:00
[JsonPropertyName("modalities")]
public string[] Modalities { get; set; } = ["audio", "text"];
2025-02-09 23:31:46 +00:00
[JsonPropertyName("input_audio_format")]
public string InputAudioFormat { get; set; } = "pcm16";
[JsonPropertyName("output_audio_format")]
public string OutputAudioFormat { get; set; } = "pcm16";
2025-02-11 23:27:07 +00:00
[JsonPropertyName("input_audio_transcription")]
public InputAudioTranscription InputAudioTranscription { get; set; } = new();
2025-02-03 04:02:36 +00:00
[JsonPropertyName("instructions")]
public string Instructions { get; set; } = "You are a friendly assistant.";
2025-02-09 23:31:46 +00:00
[JsonPropertyName("voice")]
public string Voice { get; set; } = "sage";
2025-02-03 04:02:36 +00:00
[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")]
2025-03-05 22:57:58 +00:00
public RealtimeSessionTurnDetection? TurnDetection { get; set; } = new();
2025-02-03 04:02:36 +00:00
}
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";
2025-02-11 23:27:07 +00:00
}
public class InputAudioTranscription
{
[JsonPropertyName("model")]
public string Model { get; set; } = null!;
2025-02-03 04:02:36 +00:00
}