Edit

Share via


MicrosoftExtensionsAIResponsesExtensions.AsChatResponseUpdatesAsync Method

Definition

Creates a sequence of Microsoft.Extensions.AI ChatResponseUpdate instances from the specified sequence of OpenAI StreamingResponseUpdate instances.

public static System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> AsChatResponseUpdatesAsync(this System.Collections.Generic.IAsyncEnumerable<OpenAI.Responses.StreamingResponseUpdate> responseUpdates, OpenAI.Responses.ResponseCreationOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member AsChatResponseUpdatesAsync : System.Collections.Generic.IAsyncEnumerable<OpenAI.Responses.StreamingResponseUpdate> * OpenAI.Responses.ResponseCreationOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate>
<Extension()>
Public Function AsChatResponseUpdatesAsync (responseUpdates As IAsyncEnumerable(Of StreamingResponseUpdate), Optional options As ResponseCreationOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of ChatResponseUpdate)

Parameters

responseUpdates
IAsyncEnumerable<StreamingResponseUpdate>

The update instances.

options
ResponseCreationOptions

The options employed in the creation of the response.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

A sequence of converted ChatResponseUpdate instances.

Exceptions

responseUpdates is null.

Applies to