ProjectsRealtimeClient.StartSessionAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Starts and connects a realtime session for the named voice agent. Overrides OpenAI.Realtime.RealtimeClient.StartSessionAsync(System.String,System.String,OpenAI.Realtime.RealtimeSessionClientOptions,System.Threading.CancellationToken) rather than introducing a differently-named method: this is the public, documented way to start a voice-agent session -- get a ProjectsRealtimeClient from ProjectsRealtimeClient, then call this (inherited/overridden) method on it, the same way an OpenAI OpenAI.Realtime.RealtimeClient consumer would.
public override System.Threading.Tasks.Task<OpenAI.Realtime.RealtimeSessionClient> StartSessionAsync(string model, string intent, OpenAI.Realtime.RealtimeSessionClientOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member StartSessionAsync : string * string * OpenAI.Realtime.RealtimeSessionClientOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<OpenAI.Realtime.RealtimeSessionClient>
override this.StartSessionAsync : string * string * OpenAI.Realtime.RealtimeSessionClientOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<OpenAI.Realtime.RealtimeSessionClient>
Public Overrides Function StartSessionAsync (model As String, intent As String, Optional options As RealtimeSessionClientOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of RealtimeSessionClient)
Parameters
- model
- String
The name of the voice agent to connect to (used as the {agentName} path segment).
- intent
- String
The client intent.
- options
- OpenAI.Realtime.RealtimeSessionClientOptions
Additional connection options. OpenAI.Realtime.RealtimeSessionClientOptions.QueryString is
used to pass Foundry's "store" option (a Foundry-only concept with no equivalent on this
method's own signature) as "store=true" or "store=false"; see
ConnectAsync(String, IDictionary<String,String>, CancellationToken), which merges it with api-version.
- cancellationToken
- CancellationToken
Returns
An already-connected ProjectsRealtimeSessionClient (returned as the base
OpenAI.Realtime.RealtimeSessionClient type: Task<T> isn't covariant in T
even under C# 9+ override covariance, unlike a method's own direct return type).