Partager via


PromptyKernelExtensions.CreateFunctionFromPromptyFile Method

Definition

Overloads

CreateFunctionFromPromptyFile(Kernel, IFileInfo, IPromptTemplateFactory)

Create a KernelFunction from a prompty template file.

CreateFunctionFromPromptyFile(Kernel, String, IPromptTemplateFactory)

Create a KernelFunction from a prompty template file.

CreateFunctionFromPromptyFile(Kernel, String, IFileProvider, IPromptTemplateFactory)

Create a KernelFunction from a prompty template file.

CreateFunctionFromPromptyFile(Kernel, IFileInfo, IPromptTemplateFactory)

Create a KernelFunction from a prompty template file.

public static Microsoft.SemanticKernel.KernelFunction CreateFunctionFromPromptyFile (this Microsoft.SemanticKernel.Kernel kernel, Microsoft.Extensions.FileProviders.IFileInfo fileInfo, Microsoft.SemanticKernel.IPromptTemplateFactory? promptTemplateFactory = default);
static member CreateFunctionFromPromptyFile : Microsoft.SemanticKernel.Kernel * Microsoft.Extensions.FileProviders.IFileInfo * Microsoft.SemanticKernel.IPromptTemplateFactory -> Microsoft.SemanticKernel.KernelFunction
<Extension()>
Public Function CreateFunctionFromPromptyFile (kernel As Kernel, fileInfo As IFileInfo, Optional promptTemplateFactory As IPromptTemplateFactory = Nothing) As KernelFunction

Parameters

kernel
Kernel

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

fileInfo
IFileInfo

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

fileInfo is null.

fileInfo path is not found.

Applies to

CreateFunctionFromPromptyFile(Kernel, String, IPromptTemplateFactory)

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

CreateFunctionFromPromptyFile(Kernel, String, IFileProvider, IPromptTemplateFactory)

Create a KernelFunction from a prompty template file.

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

fileProvider
IFileProvider

The representation of the file system to use to retrieve the prompty file. Defaults to PhysicalFileProvider scoped to the current directory.

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