ChatClientExtensions.GetStreamingResponseAsync 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.
Overloads
GetStreamingResponseAsync(IChatClient, ChatMessage, ChatOptions, CancellationToken) |
Sends a chat message and streams the response messages. |
GetStreamingResponseAsync(IChatClient, String, ChatOptions, CancellationToken) |
Sends a user chat text message and streams the response messages. |
GetStreamingResponseAsync(IChatClient, ChatMessage, ChatOptions, CancellationToken)
Sends a chat message and streams the response messages.
public static System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> GetStreamingResponseAsync(this Microsoft.Extensions.AI.IChatClient client, Microsoft.Extensions.AI.ChatMessage chatMessage, Microsoft.Extensions.AI.ChatOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member GetStreamingResponseAsync : Microsoft.Extensions.AI.IChatClient * Microsoft.Extensions.AI.ChatMessage * Microsoft.Extensions.AI.ChatOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate>
<Extension()>
Public Function GetStreamingResponseAsync (client As IChatClient, chatMessage As ChatMessage, Optional options As ChatOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of ChatResponseUpdate)
Parameters
- client
- IChatClient
The chat client.
- chatMessage
- ChatMessage
The chat message to send.
- options
- ChatOptions
The chat options to configure the request.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The response messages generated by the client.
Applies to
GetStreamingResponseAsync(IChatClient, String, ChatOptions, CancellationToken)
Sends a user chat text message and streams the response messages.
public static System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> GetStreamingResponseAsync(this Microsoft.Extensions.AI.IChatClient client, string chatMessage, Microsoft.Extensions.AI.ChatOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member GetStreamingResponseAsync : Microsoft.Extensions.AI.IChatClient * string * Microsoft.Extensions.AI.ChatOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate>
<Extension()>
Public Function GetStreamingResponseAsync (client As IChatClient, chatMessage As String, Optional options As ChatOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of ChatResponseUpdate)
Parameters
- client
- IChatClient
The chat client.
- chatMessage
- String
The text content for the chat message to send.
- options
- ChatOptions
The chat options to configure the request.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The response messages generated by the client.