ChatResponseUpdateExtensions.ToChatResponseAsync 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.
Combines ChatResponseUpdate instances into a single ChatResponse.
public static System.Threading.Tasks.Task<Microsoft.Extensions.AI.ChatResponse> ToChatResponseAsync(this System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> updates, bool coalesceContent = true, System.Threading.CancellationToken cancellationToken = default);
static member ToChatResponseAsync : System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Extensions.AI.ChatResponse>
<Extension()>
Public Function ToChatResponseAsync (updates As IAsyncEnumerable(Of ChatResponseUpdate), Optional coalesceContent As Boolean = true, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ChatResponse)
Parameters
- updates
- IAsyncEnumerable<ChatResponseUpdate>
The updates to be combined.
- coalesceContent
- Boolean
true
to attempt to coalesce contiguous AIContent items, where applicable,
into a single AIContent, in order to reduce the number of individual content items that are included in
the manufactured ChatMessage instances. When false
, the original content items are used.
The default is true
.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The combined ChatResponse.