Share via


IChatClient.CompleteStreamingAsync Method

Definition

Sends chat messages to the model and streams the response messages.

public System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.StreamingChatCompletionUpdate> CompleteStreamingAsync (System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage> chatMessages, Microsoft.Extensions.AI.ChatOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CompleteStreamingAsync : System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Extensions.AI.ChatOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.StreamingChatCompletionUpdate>
Public Function CompleteStreamingAsync (chatMessages As IList(Of ChatMessage), Optional options As ChatOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of StreamingChatCompletionUpdate)

Parameters

chatMessages
IList<ChatMessage>

The chat content 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.

Remarks

The returned messages will not have been added to chatMessages. However, any intermediate messages generated implicitly by the client, including any messages for roundtrips to the model as part of the implementation of this request, will be included.

Applies to