Share via


OpenAIRealtimeClientSession Class

Definition

Represents an IRealtimeClientSession for the OpenAI Realtime API over WebSocket.

public ref class OpenAIRealtimeClientSession sealed : IAsyncDisposable, Microsoft::Extensions::AI::IRealtimeClientSession
[System.Diagnostics.CodeAnalysis.Experimental("MEAI001", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")]
public sealed class OpenAIRealtimeClientSession : IAsyncDisposable, Microsoft.Extensions.AI.IRealtimeClientSession
public sealed class OpenAIRealtimeClientSession : IAsyncDisposable, Microsoft.Extensions.AI.IRealtimeClientSession
[<System.Diagnostics.CodeAnalysis.Experimental("MEAI001", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")>]
type OpenAIRealtimeClientSession = class
    interface IRealtimeClientSession
    interface IAsyncDisposable
type OpenAIRealtimeClientSession = class
    interface IRealtimeClientSession
    interface IAsyncDisposable
Public NotInheritable Class OpenAIRealtimeClientSession
Implements IAsyncDisposable, IRealtimeClientSession
Inheritance
OpenAIRealtimeClientSession
Attributes
Implements

Constructors

Name Description
OpenAIRealtimeClientSession(String, String)

Initializes a new instance of the OpenAIRealtimeClientSession class.

Properties

Name Description
Options

Gets the current session options.

Methods

Name Description
ConnectAsync(CancellationToken)

Connects the WebSocket to the OpenAI Realtime API.

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

GetStreamingResponseAsync(CancellationToken)

Streams the response from the real-time session.

SendAsync(RealtimeClientMessage, CancellationToken)

Sends a client message to the session.

Explicit Interface Implementations

Name Description
IRealtimeClientSession.GetService(Type, Object)

Asks the IRealtimeClientSession for an object of the specified type serviceType.

Extension Methods

Name Description
ConfigureAwait(IAsyncDisposable, Boolean)

Configures how awaits on the tasks returned from an async disposable will be performed.

GetRequiredService(IRealtimeClientSession, Type, Object)

Asks the IRealtimeClientSession for an object of the specified type serviceType and throws an exception if one isn't available.

GetRequiredService<TService>(IRealtimeClientSession, Object)

Asks the IRealtimeClientSession for an object of type TService and throws an exception if one isn't available.

GetService<TService>(IRealtimeClientSession, Object)

Asks the IRealtimeClientSession for an object of type TService.

Applies to