次の方法で共有


KernelFunction.InvokeStreamingAsync Method

Definition

Overloads

InvokeStreamingAsync(Kernel, KernelArguments, CancellationToken)

Invokes the KernelFunction and streams its results.

InvokeStreamingAsync<TResult>(Kernel, KernelArguments, CancellationToken)

Invokes the KernelFunction and streams its results.

InvokeStreamingAsync(Kernel, KernelArguments, CancellationToken)

Invokes the KernelFunction and streams its results.

public System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingKernelContent> InvokeStreamingAsync (Microsoft.SemanticKernel.Kernel kernel, Microsoft.SemanticKernel.KernelArguments? arguments = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeStreamingAsync : Microsoft.SemanticKernel.Kernel * Microsoft.SemanticKernel.KernelArguments * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingKernelContent>
Public Function InvokeStreamingAsync (kernel As Kernel, Optional arguments As KernelArguments = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of StreamingKernelContent)

Parameters

kernel
Kernel

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

arguments
KernelArguments

The arguments to pass to the function's invocation, including any PromptExecutionSettings.

cancellationToken
CancellationToken

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

Returns

An IAsyncEnumerable<T> for streaming the results of the function's invocation.

Remarks

The function will not be invoked until an enumerator is retrieved from the returned IAsyncEnumerable<T> and its iteration initiated via an initial call to MoveNextAsync().

Applies to

InvokeStreamingAsync<TResult>(Kernel, KernelArguments, CancellationToken)

Invokes the KernelFunction and streams its results.

public System.Collections.Generic.IAsyncEnumerable<TResult> InvokeStreamingAsync<TResult> (Microsoft.SemanticKernel.Kernel kernel, Microsoft.SemanticKernel.KernelArguments? arguments = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeStreamingAsync : Microsoft.SemanticKernel.Kernel * Microsoft.SemanticKernel.KernelArguments * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Result>
Public Function InvokeStreamingAsync(Of TResult) (kernel As Kernel, Optional arguments As KernelArguments = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TResult)

Type Parameters

TResult

Specifies the type of the result values of the function.

Parameters

kernel
Kernel

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

arguments
KernelArguments

The arguments to pass to the function's invocation, including any PromptExecutionSettings.

cancellationToken
CancellationToken

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

Returns

IAsyncEnumerable<TResult>

An IAsyncEnumerable<T> for streaming the results of the function's invocation.

Exceptions

kernel is null.

Remarks

The function will not be invoked until an enumerator is retrieved from the returned IAsyncEnumerable<T> and its iteration initiated via an initial call to MoveNextAsync().

Applies to