IntelligenceX

API Reference

Class

OpenAIRealtimeSession

Namespace IntelligenceX.OpenAI.Realtime
Assembly IntelligenceX
Implements
IDisposable
Modifiers sealed

Owns an active OpenAI Realtime WebSocket session.

Inheritance

  • Object
  • OpenAIRealtimeSession

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Methods

public Task AppendAudioAsync(Byte[] audioBytes, CancellationToken cancellationToken = null) #
Returns: Task

Appends base64-encoded PCM audio bytes to the session input buffer.

Parameters

audioBytes System.Byte[] requiredposition: 0
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
public async Task CloseAsync(CancellationToken cancellationToken = null) #
Returns: Task

Closes the Realtime WebSocket when possible.

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
public async Task CommitAudioAsync(Boolean requestResponse = true, CancellationToken cancellationToken = null) #
Returns: Task

Commits the current input audio buffer and optionally asks the model to respond.

Parameters

requestResponse System.Boolean = true optionalposition: 0
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
public virtual Void Dispose() #
Returns: Void
public async Task<OpenAIRealtimeEvent> ReceiveEventAsync(CancellationToken cancellationToken = null) #
Returns: Task<OpenAIRealtimeEvent>

Receives the next complete Realtime server event. Only one receive operation may run at a time.

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
public Task RequestResponseAsync(CancellationToken cancellationToken = null) #
Returns: Task

Requests a model response for the current conversation state.

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
public async Task SendEventAsync(String eventJson, CancellationToken cancellationToken = null) #
Returns: Task

Sends a raw Realtime client event.

Parameters

eventJson System.String requiredposition: 0
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
public async Task SendImageAsync(String imageUrl, Boolean requestResponse = true, CancellationToken cancellationToken = null) #
Returns: Task

Sends an image URL or data URL as a user input item and optionally asks the model to respond.

Parameters

imageUrl System.String requiredposition: 0
requestResponse System.Boolean = true optionalposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
public async Task SendTextAsync(String text, Boolean requestResponse = true, CancellationToken cancellationToken = null) #
Returns: Task

Sends a user text item and optionally asks the model to respond.

Parameters

text System.String requiredposition: 0
requestResponse System.Boolean = true optionalposition: 1
cancellationToken System.Threading.CancellationToken = null optionalposition: 2

Properties

public String Model { get; } #

Gets the connected Realtime model.

public WebSocketState State { get; } #

Gets the current WebSocket state.