Share via


ChatCompletionServiceExtensions.GetStreamingChatMessageContentsAsync Method

Definition

Get streaming chat message contents for the chat history provided using the specified settings.

public static System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingChatMessageContent> GetStreamingChatMessageContentsAsync (this Microsoft.SemanticKernel.ChatCompletion.IChatCompletionService chatCompletionService, string prompt, Microsoft.SemanticKernel.PromptExecutionSettings? executionSettings = default, Microsoft.SemanticKernel.Kernel? kernel = default, System.Threading.CancellationToken cancellationToken = default);
static member GetStreamingChatMessageContentsAsync : Microsoft.SemanticKernel.ChatCompletion.IChatCompletionService * string * Microsoft.SemanticKernel.PromptExecutionSettings * Microsoft.SemanticKernel.Kernel * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingChatMessageContent>
<Extension()>
Public Function GetStreamingChatMessageContentsAsync (chatCompletionService As IChatCompletionService, prompt As String, Optional executionSettings As PromptExecutionSettings = Nothing, Optional kernel As Kernel = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of StreamingChatMessageContent)

Parameters

chatCompletionService
IChatCompletionService

The target IChatCompletionService interface to extend.

prompt
String

The standardized prompt input.

executionSettings
PromptExecutionSettings

The AI execution settings (optional).

kernel
Kernel

The Kernel containing services, plugins, and other state for use throughout the operation.

cancellationToken
CancellationToken

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

Returns

Streaming list of different completion streaming string updates generated by the remote model

Exceptions

Throws if the specified type is not the same or fail to cast

Applies to