VoiceLiveSession Class
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.
Represents a WebSocket-based session for real-time voice communication with the Azure VoiceLive service.
public class VoiceLiveSession : IAsyncDisposable, IDisposable
type VoiceLiveSession = class
interface IDisposable
interface IAsyncDisposable
Public Class VoiceLiveSession
Implements IAsyncDisposable, IDisposable
- Inheritance
-
VoiceLiveSession
- Implements
Remarks
This class abstracts bidirectional communication between the caller and service, simultaneously sending and receiving WebSocket messages.
Constructors
| VoiceLiveSession(VoiceLiveClient, Uri, AzureKeyCredential) |
Initializes a new instance of the VoiceLiveSession class. |
| VoiceLiveSession(VoiceLiveClient, Uri, TokenCredential) |
Initializes a new instance of the VoiceLiveSession class. |
Properties
| ConnectionState |
Gets the current state of the WebSocket connection. |
| IsConnected |
Gets a value indicating whether the session is connected and ready to send/receive messages. |
Methods
| AddItemAsync(ConversationRequestItem, CancellationToken) |
Adds an item to the conversation. |
| AddItemAsync(ConversationRequestItem, String, CancellationToken) |
Adds an item to the conversation at a specific position. |
| AppendAudioToTurnAsync(String, BinaryData, CancellationToken) |
Appends audio data to an ongoing input turn. |
| AppendAudioToTurnAsync(String, Byte[], CancellationToken) |
Appends audio data to an ongoing input turn. |
| CancelAudioTurnAsync(String, CancellationToken) |
Cancels an in-progress input audio turn. |
| CancelResponseAsync(CancellationToken) |
Cancels the current response generation. |
| ClearInputAudioAsync(CancellationToken) |
Clears the input audio buffer. |
| ClearStreamingAudioAsync(CancellationToken) |
Clears all input audio currently being streamed. |
| CloseAsync(CancellationToken) |
Closes the WebSocket connection gracefully. |
| CommitInputAudioAsync(CancellationToken) |
Commits the input audio buffer. |
| ConfigureSessionAsync(VoiceLiveSessionOptions, CancellationToken) |
Updates the session configuration. |
| ConnectAsync(IDictionary<String,String>, CancellationToken) |
Initializes an underlying Azure.AI.VoiceLive.VoiceLiveSession.WebSocket instance for communication with the VoiceLive service and then connects to the service using this socket. |
| ConnectAvatarAsync(String, CancellationToken) |
Connects and provides the client's SDP (Session Description Protocol) for avatar-related media negotiation. |
| DeleteItemAsync(String, CancellationToken) |
Deletes an item from the conversation. |
| Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
| Dispose(Boolean) |
Releases the unmanaged resources used by the VoiceLiveSession and optionally releases the managed resources. |
| DisposeAsync() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously. |
| DisposeAsyncCore() |
Releases the unmanaged resources used by the VoiceLiveSession asynchronously. |
| EndAudioTurnAsync(String, CancellationToken) |
Marks the end of an audio input turn. |
| GetUpdatesAsync(CancellationToken) |
Gets all server events from the VoiceLive service as an asynchronous enumerable. |
| GetUpdatesAsync<T>(CancellationToken) |
Gets server events of a specific type from the VoiceLive service. |
| ReceiveUpdatesAsync(CancellationToken) |
Receives updates from the service asynchronously. |
| RequestItemRetrievalAsync(String, CancellationToken) |
Retrieves an item from the conversation. |
| SendCommandAsync(BinaryData, CancellationToken) |
Sends raw data to the service asynchronously. |
| SendCommandAsync(RequestContent, CancellationToken) |
Sends raw data to the service asynchronously. |
| SendInputAudioAsync(BinaryData, CancellationToken) |
Transmits audio data from BinaryData. |
| SendInputAudioAsync(Byte[], CancellationToken) |
Transmits audio data from a byte array. |
| SendInputAudioAsync(Stream, CancellationToken) |
Transmits audio data from a stream, ending the client turn once the stream is complete. |
| StartAudioTurnAsync(String, CancellationToken) |
Starts a new audio input turn. |
| StartResponseAsync(CancellationToken) |
Starts a new response generation. |
| StartResponseAsync(String, CancellationToken) |
Starts a new response generation with additional instructions. |
| StartResponseAsync(VoiceLiveSessionOptions, CancellationToken) |
Starts a new response generation with specific options. |
| TruncateConversationAsync(String, Int32, TimeSpan, CancellationToken) |
Truncates the conversation history. |
| WaitForUpdateAsync<T>(CancellationToken) |
Waits for the next server event of a specific type. |