OpenAISerializationHelpers.SerializeStreamingAsync 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.
Serializes a Microsoft.Extensions.AI streaming completion using the OpenAI wire format.
public static System.Threading.Tasks.Task SerializeStreamingAsync (System.IO.Stream stream, System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.StreamingChatCompletionUpdate> streamingChatCompletionUpdates, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member SerializeStreamingAsync : System.IO.Stream * System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.AI.StreamingChatCompletionUpdate> * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Shared Function SerializeStreamingAsync (stream As Stream, streamingChatCompletionUpdates As IAsyncEnumerable(Of StreamingChatCompletionUpdate), Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- stream
- Stream
The stream to write the value.
- streamingChatCompletionUpdates
- IAsyncEnumerable<StreamingChatCompletionUpdate>
The streaming chat completions to serialize.
- options
- JsonSerializerOptions
The JsonSerializerOptions governing function call content serialization.
- cancellationToken
- CancellationToken
A token used to cancel the serialization operation.
Returns
A task tracking the serialization operation.
Applies to
Spolupracujte s námi na GitHubu
Zdroj tohoto obsahu najdete na GitHubu, kde můžete také vytvářet a kontrolovat problémy a žádosti o přijetí změn. Další informace najdete v našem průvodci pro přispěvatele.