Share via


PromptyKernelExtensions.CreateFunctionFromPromptyFile Method

Definition

Create a KernelFunction from a prompty template file.

public static Microsoft.SemanticKernel.KernelFunction CreateFunctionFromPromptyFile (this Microsoft.SemanticKernel.Kernel kernel, string promptyFilePath, Microsoft.SemanticKernel.IPromptTemplateFactory? promptTemplateFactory = default);
static member CreateFunctionFromPromptyFile : Microsoft.SemanticKernel.Kernel * string * Microsoft.SemanticKernel.IPromptTemplateFactory -> Microsoft.SemanticKernel.KernelFunction
<Extension()>
Public Function CreateFunctionFromPromptyFile (kernel As Kernel, promptyFilePath 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.

promptyFilePath
String

Path to the file containing the 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

promptyFilePath is null.

promptyFilePath is empty or composed entirely of whitespace.

Applies to