通过


MicrosoftExtensionsAIChatExtensions.AsChatResponseUpdatesAsync 方法

定义

根据 OpenAI ChatResponseUpdate 实例的指定序列创建 Microsoft.Extensions.AI StreamingChatCompletionUpdate 实例序列。

[System.Diagnostics.CodeAnalysis.Experimental("OPENAI001")]
public static System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> AsChatResponseUpdatesAsync(this System.Collections.Generic.IAsyncEnumerable<OpenAI.Chat.StreamingChatCompletionUpdate> chatCompletionUpdates, OpenAI.Chat.ChatCompletionOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> AsChatResponseUpdatesAsync(this System.Collections.Generic.IAsyncEnumerable<OpenAI.Chat.StreamingChatCompletionUpdate> chatCompletionUpdates, OpenAI.Chat.ChatCompletionOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.Experimental("OPENAI001")>]
static member AsChatResponseUpdatesAsync : System.Collections.Generic.IAsyncEnumerable<OpenAI.Chat.StreamingChatCompletionUpdate> * OpenAI.Chat.ChatCompletionOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate>
static member AsChatResponseUpdatesAsync : System.Collections.Generic.IAsyncEnumerable<OpenAI.Chat.StreamingChatCompletionUpdate> * OpenAI.Chat.ChatCompletionOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate>
<Extension()>
Public Function AsChatResponseUpdatesAsync (chatCompletionUpdates As IAsyncEnumerable(Of StreamingChatCompletionUpdate), Optional options As ChatCompletionOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of ChatResponseUpdate)

参数

chatCompletionUpdates
IAsyncEnumerable<StreamingChatCompletionUpdate>

更新实例。

options
ChatCompletionOptions

创建响应时采用的选项。

cancellationToken
CancellationToken

CancellationToken 监视取消请求。 默认值为 None

返回

ChatResponseUpdate 转换的实例序列。

属性

例外

chatCompletionUpdatesnull

适用于