Taal

ChatResponseExtensions.ToChatResponseAsync Methode

Definitie

Hiermee worden ChatResponseUpdate exemplaren gecombineerd tot één ChatResponse.

public static System.Threading.Tasks.Task<Microsoft.Extensions.AI.ChatResponse> ToChatResponseAsync(this System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> updates, System.Threading.CancellationToken cancellationToken = default);
static member ToChatResponseAsync : System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Extensions.AI.ChatResponse>
<Extension()>
Public Function ToChatResponseAsync (updates As IAsyncEnumerable(Of ChatResponseUpdate), Optional cancellationToken As CancellationToken = Nothing) As Task(Of ChatResponse)

Parameters

updates
IAsyncEnumerable<ChatResponseUpdate>

De updates die moeten worden gecombineerd.

cancellationToken
CancellationToken

De CancellationToken te controleren op annuleringsaanvragen. De standaardwaarde is None.

Retouren

De gecombineerde ChatResponse.

Uitzonderingen

updates is null.

Opmerkingen

Als onderdeel van het combineren updates in één ChatResponse, probeert de methode instanties te reconstrueren ChatMessage . Dit omvat het gebruik MessageId om berichtgrenzen te bepalen, evenals het samenvoegen van aaneengesloten AIContent items, indien van toepassing, bijvoorbeeld meerdere TextContent exemplaren in een rij kunnen worden gecombineerd tot één TextContent.

Van toepassing op