Kernel.InvokeStreamingAsync 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.
Overloads
InvokeStreamingAsync(KernelFunction, KernelArguments, CancellationToken) |
Invokes the KernelFunction and streams its results. |
InvokeStreamingAsync(String, String, KernelArguments, CancellationToken) |
Invokes the KernelFunction and streams its results. |
InvokeStreamingAsync<T>(KernelFunction, KernelArguments, CancellationToken) |
Invokes the KernelFunction and streams its results. |
InvokeStreamingAsync<T>(String, String, KernelArguments, CancellationToken) |
Invokes the KernelFunction and streams its results. |
InvokeStreamingAsync(KernelFunction, KernelArguments, CancellationToken)
Invokes the KernelFunction and streams its results.
public System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingKernelContent> InvokeStreamingAsync (Microsoft.SemanticKernel.KernelFunction function, Microsoft.SemanticKernel.KernelArguments? arguments = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeStreamingAsync : Microsoft.SemanticKernel.KernelFunction * Microsoft.SemanticKernel.KernelArguments * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingKernelContent>
Public Function InvokeStreamingAsync (function As KernelFunction, Optional arguments As KernelArguments = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of StreamingKernelContent)
Parameters
- function
- KernelFunction
The KernelFunction to invoke.
- 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.
Exceptions
function
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
InvokeStreamingAsync(String, String, KernelArguments, CancellationToken)
Invokes the KernelFunction and streams its results.
public System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingKernelContent> InvokeStreamingAsync (string? pluginName, string functionName, Microsoft.SemanticKernel.KernelArguments? arguments = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeStreamingAsync : string * string * Microsoft.SemanticKernel.KernelArguments * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.SemanticKernel.StreamingKernelContent>
Public Function InvokeStreamingAsync (pluginName As String, functionName As String, Optional arguments As KernelArguments = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of StreamingKernelContent)
Parameters
- pluginName
- String
The name of the plugin containing the function to invoke. If null, all plugins will be searched for the first function of the specified name.
- functionName
- String
The name of the function to invoke.
- 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.
Exceptions
functionName
is null.
functionName
is composed entirely of whitespace.
The KernelFunction's invocation was canceled.
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<T>(KernelFunction, KernelArguments, CancellationToken)
Invokes the KernelFunction and streams its results.
public System.Collections.Generic.IAsyncEnumerable<T> InvokeStreamingAsync<T> (Microsoft.SemanticKernel.KernelFunction function, Microsoft.SemanticKernel.KernelArguments? arguments = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeStreamingAsync : Microsoft.SemanticKernel.KernelFunction * Microsoft.SemanticKernel.KernelArguments * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'T>
Public Function InvokeStreamingAsync(Of T) (function As KernelFunction, Optional arguments As KernelArguments = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of T)
Type Parameters
- T
Parameters
- function
- KernelFunction
The KernelFunction to invoke.
- 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.
Exceptions
function
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
InvokeStreamingAsync<T>(String, String, KernelArguments, CancellationToken)
Invokes the KernelFunction and streams its results.
public System.Collections.Generic.IAsyncEnumerable<T> InvokeStreamingAsync<T> (string? pluginName, string functionName, Microsoft.SemanticKernel.KernelArguments? arguments = default, System.Threading.CancellationToken cancellationToken = default);
member this.InvokeStreamingAsync : string * string * Microsoft.SemanticKernel.KernelArguments * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'T>
Public Function InvokeStreamingAsync(Of T) (pluginName As String, functionName As String, Optional arguments As KernelArguments = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of T)
Type Parameters
- T
Parameters
- pluginName
- String
The name of the plugin containing the function to invoke. If null, all plugins will be searched for the first function of the specified name.
- functionName
- String
The name of the function to invoke.
- 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.
Exceptions
functionName
is null.
functionName
is composed entirely of whitespace.
The KernelFunction's invocation was canceled.
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().