Partager via


PromptyKernelExtensions.CreateFunctionFromPrompty Method

Definition

Create a KernelFunction from a prompty template.

public static Microsoft.SemanticKernel.KernelFunction CreateFunctionFromPrompty (this Microsoft.SemanticKernel.Kernel kernel, string promptyTemplate, Microsoft.SemanticKernel.IPromptTemplateFactory? promptTemplateFactory = default);
static member CreateFunctionFromPrompty : Microsoft.SemanticKernel.Kernel * string * Microsoft.SemanticKernel.IPromptTemplateFactory -> Microsoft.SemanticKernel.KernelFunction
<Extension()>
Public Function CreateFunctionFromPrompty (kernel As Kernel, promptyTemplate As String, Optional promptTemplateFactory As IPromptTemplateFactory = Nothing) As KernelFunction

Parameters

kernel
Kernel

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

promptyTemplate
String

Prompty representation of a prompt-based KernelFunction.

promptTemplateFactory
IPromptTemplateFactory

The IPromptTemplateFactory to use when interpreting the prompt template configuration into a IPromptTemplate. If null, a AggregatorPromptTemplateFactory will be used with support for Liquid and Handlebars prompt templates.

Returns

The created KernelFunction.

Exceptions

promptyTemplate is null.

promptyTemplate is empty or composed entirely of whitespace.

Applies to