Class RealtimeEvent
Handles all the different types of Realtime API events
that can be sent to or received from the OpenAI API.
Implements
Inherited Members
Namespace: Glitch9.AIDevKit.OpenAI.Realtime
Assembly: Glitch9.AIDevKit.Provider.OpenAI.dll
Syntax
public class RealtimeEvent : IWebSocketMessage
Properties
| Edit this page View SourceArguments
The final arguments as a JSON string.
Declaration
[JsonProperty("arguments")]
public string Arguments { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Audio
Base64-encoded audio bytes.
Declaration
[JsonProperty("audio")]
public string Audio { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
This property is only used when the event type is Server.InputAudioBufferAppend.
AudioEndMs
Inclusive duration up to which audio is truncated, in milliseconds.
Declaration
[JsonProperty("audio_end_ms")]
public long? AudioEndMs { get; set; }
Property Value
| Type | Description |
|---|---|
| long? |
AudioStartMs
Milliseconds since the session started when speech was detected.
Declaration
[JsonProperty("audio_start_ms")]
public long? AudioStartMs { get; set; }
Property Value
| Type | Description |
|---|---|
| long? |
CallId
The ID of the function call.
Declaration
[JsonProperty("call_id")]
public string CallId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ContentIndex
The index of the content part in the item's content array.
Declaration
[JsonProperty("content_index")]
public int? ContentIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Conversation
The conversation resource.
Declaration
[JsonProperty("conversation")]
public Conversation Conversation { get; set; }
Property Value
| Type | Description |
|---|---|
| Conversation |
Cts
Cancellation token source for this event, allowing it to be cancelled if needed.
Declaration
[JsonIgnore]
public CancellationTokenSource Cts { get; set; }
Property Value
| Type | Description |
|---|---|
| CancellationTokenSource |
Delta
Server.ResponseTextDelta: The text delta.
Server.ResponseAudioTranscriptDelta: The transcript delta.
Server.ResponseAudioDelta: Base64-encoded audio data delta.
Server.ResponseFunctionCallArgumentsDelta: The arguments delta as a JSON string.
Declaration
[JsonProperty("delta")]
public string Delta { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Error
Details of the error.
Declaration
[JsonProperty("error")]
public BackendException Error { get; set; }
Property Value
| Type | Description |
|---|---|
| BackendException |
EventId
Requests: Optional client-generated ID used to identify this event.
Responses: The unique ID of the realtime event.
Declaration
[JsonProperty("event_id")]
public string EventId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Item
The item to add to the conversation.
Declaration
[JsonProperty("item")]
public RealtimeItem Item { get; set; }
Property Value
| Type | Description |
|---|---|
| RealtimeItem |
ItemId
The ID of the item or the function call item.
Declaration
[JsonProperty("item_id")]
public string ItemId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Obfuscation
If present, indicates the delta text was obfuscated.
Declaration
[JsonProperty("obfuscation")]
public string Obfuscation { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
OutputIndex
The index of the output item in the response.
Declaration
[JsonProperty("output_index")]
public int? OutputIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| int? |
Part
Server.ResponseContentPartAdded: The content part that was added.
Server.ResponseContentPartDone: The content part that is done.
Declaration
[JsonProperty("part")]
public RealtimeItemContent Part { get; set; }
Property Value
| Type | Description |
|---|---|
| RealtimeItemContent |
PreviousItemId
The ID of the preceding item after which the new item will be inserted.
Declaration
[JsonProperty("previous_item_id")]
public string PreviousItemId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
RateLimits
List of rate limit information.
Declaration
[JsonProperty("rate_limits")]
public RealtimeRateLimit[] RateLimits { get; set; }
Property Value
| Type | Description |
|---|---|
| RealtimeRateLimit[] |
ResponseId
The ID of the response.
Declaration
[JsonProperty("response_id")]
public string ResponseId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ResponseItem
Client.ResponseCreate: Configuration for the response.
Declaration
[JsonProperty("response")]
public RealtimeItem ResponseItem { get; set; }
Property Value
| Type | Description |
|---|---|
| RealtimeItem |
Session
The session resource.
Declaration
[JsonProperty("session")]
public RealtimeSession Session { get; set; }
Property Value
| Type | Description |
|---|---|
| RealtimeSession |
Text
The final text content.
Declaration
[JsonProperty("text")]
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Transcript
Server.ResponseAudioTranscriptDone: The final transcript of the audio.
Declaration
[JsonProperty("transcript")]
public string Transcript { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Type
The event type.
Declaration
[JsonProperty("type")]
public string Type { get; set; }
Property Value
| Type | Description |
|---|---|
| string |