RealtimeClientBuilder class

Builds a pipeline of real-time client middleware.

The pipeline is composed by calling use or useWithServices one or more times, then calling build to produce the final RealtimeClient. Middleware factories are applied in reverse order so that the first call adds the outermost wrapper.

This is an experimental feature.

Available extensions
Annotations
  • @Source(name: 'RealtimeClientBuilder.cs', namespace: 'Microsoft.Extensions.AI', repository: 'dotnet/extensions', path: 'src/Libraries/Microsoft.Extensions.AI/Realtime/', commit: '2e537166e4231e50cceb66832b9dfd1382e24d1b')

Constructors

RealtimeClientBuilder(RealtimeClient innerClient)
Creates a new RealtimeClientBuilder wrapping innerClient.
RealtimeClientBuilder.fromFactory(InnerRealtimeClientFactory innerClientFactory)
Creates a new RealtimeClientBuilder from a factory function.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build([ServiceProvider? services]) RealtimeClient
Builds the pipeline and returns the outermost RealtimeClient.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
use(RealtimeClientFactory clientFactory) RealtimeClientBuilder
Adds a middleware factory to the pipeline.
useFunctionInvocation({LoggerFactory? loggerFactory, ConfigureFunctionInvokingRealtimeClient? configure}) RealtimeClientBuilder

Available on RealtimeClientBuilder, provided by the FunctionInvokingRealtimeClientBuilderExtensions extension

Enables automatic function-call invocation on the real-time pipeline.
useLogging({LoggerFactory? loggerFactory, ConfigureLoggingRealtimeClient? configure}) RealtimeClientBuilder

Available on RealtimeClientBuilder, provided by the LoggingRealtimeClientBuilderExtensions extension

Adds logging to the real-time client pipeline.
useOpenTelemetry({String? modelId, String? system, bool? enableSensitiveData}) RealtimeClientBuilder

Available on RealtimeClientBuilder, provided by the OpenTelemetryRealtimeClientBuilderExtensions extension

Adds an OpenTelemetryRealtimeClient to the pipeline.
useWithServices(RealtimeClientFactoryWithServices clientFactory) RealtimeClientBuilder
Adds a middleware factory to the pipeline that receives the active ServiceProvider.

Operators

operator ==(Object other) bool
The equality operator.
inherited