Share via


IPromptTemplate.RenderAsync Method

Definition

Renders the template using the supplied kernel and arguments.

public System.Threading.Tasks.Task<string> RenderAsync (Microsoft.SemanticKernel.Kernel kernel, Microsoft.SemanticKernel.KernelArguments? arguments = default, System.Threading.CancellationToken cancellationToken = default);
abstract member RenderAsync : Microsoft.SemanticKernel.Kernel * Microsoft.SemanticKernel.KernelArguments * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Function RenderAsync (kernel As Kernel, Optional arguments As KernelArguments = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of String)

Parameters

kernel
Kernel

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

arguments
KernelArguments

The arguments to use to satisfy any input variables in the prompt template.

cancellationToken
CancellationToken

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

Returns

The prompt rendered to a string.

Exceptions

kernel is null.

Applies to