Partager via


KernelExtensions.CreateFunctionFromPrompt Method

Definition

Overloads

CreateFunctionFromPrompt(Kernel, String, PromptExecutionSettings, String, String, String, IPromptTemplateFactory)

Creates a KernelFunction instance for a prompt specified via a prompt template.

CreateFunctionFromPrompt(Kernel, String, IEnumerable<PromptExecutionSettings>, String, String, String, IPromptTemplateFactory)

Creates a KernelFunction instance for a prompt specified via a prompt template.

CreateFunctionFromPrompt(Kernel, PromptTemplateConfig, IPromptTemplateFactory)

Creates a KernelFunction instance for a prompt specified via a prompt template configuration.

CreateFunctionFromPrompt(Kernel, String, PromptExecutionSettings, String, String, String, IPromptTemplateFactory)

Creates a KernelFunction instance for a prompt specified via a prompt template.

public static Microsoft.SemanticKernel.KernelFunction CreateFunctionFromPrompt (this Microsoft.SemanticKernel.Kernel kernel, string promptTemplate, Microsoft.SemanticKernel.PromptExecutionSettings? executionSettings = default, string? functionName = default, string? description = default, string? templateFormat = default, Microsoft.SemanticKernel.IPromptTemplateFactory? promptTemplateFactory = default);
static member CreateFunctionFromPrompt : Microsoft.SemanticKernel.Kernel * string * Microsoft.SemanticKernel.PromptExecutionSettings * string * string * string * Microsoft.SemanticKernel.IPromptTemplateFactory -> Microsoft.SemanticKernel.KernelFunction
<Extension()>
Public Function CreateFunctionFromPrompt (kernel As Kernel, promptTemplate As String, Optional executionSettings As PromptExecutionSettings = Nothing, Optional functionName As String = Nothing, Optional description As String = Nothing, Optional templateFormat As String = Nothing, Optional promptTemplateFactory As IPromptTemplateFactory = Nothing) As KernelFunction

Parameters

kernel
Kernel

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

promptTemplate
String

Prompt template for the function.

executionSettings
PromptExecutionSettings

Default execution settings to use when invoking this prompt function.

functionName
String

The name to use for the function. If null, it will default to a randomly generated name.

description
String

The description to use for the function.

templateFormat
String

The template format of promptTemplate. This must be provided if promptTemplateFactory is not null.

promptTemplateFactory
IPromptTemplateFactory

The IPromptTemplateFactory to use when interpreting the promptTemplate into a IPromptTemplate. If null, a default factory will be used.

Returns

The created KernelFunction for invoking the prompt.

Applies to

CreateFunctionFromPrompt(Kernel, String, IEnumerable<PromptExecutionSettings>, String, String, String, IPromptTemplateFactory)

Creates a KernelFunction instance for a prompt specified via a prompt template.

public static Microsoft.SemanticKernel.KernelFunction CreateFunctionFromPrompt (this Microsoft.SemanticKernel.Kernel kernel, string promptTemplate, System.Collections.Generic.IEnumerable<Microsoft.SemanticKernel.PromptExecutionSettings>? executionSettings, string? functionName = default, string? description = default, string? templateFormat = default, Microsoft.SemanticKernel.IPromptTemplateFactory? promptTemplateFactory = default);
static member CreateFunctionFromPrompt : Microsoft.SemanticKernel.Kernel * string * seq<Microsoft.SemanticKernel.PromptExecutionSettings> * string * string * string * Microsoft.SemanticKernel.IPromptTemplateFactory -> Microsoft.SemanticKernel.KernelFunction
<Extension()>
Public Function CreateFunctionFromPrompt (kernel As Kernel, promptTemplate As String, executionSettings As IEnumerable(Of PromptExecutionSettings), Optional functionName As String = Nothing, Optional description As String = Nothing, Optional templateFormat As String = Nothing, Optional promptTemplateFactory As IPromptTemplateFactory = Nothing) As KernelFunction

Parameters

kernel
Kernel

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

promptTemplate
String

Prompt template for the function.

executionSettings
IEnumerable<PromptExecutionSettings>

List of execution settings to use when invoking this prompt function.

functionName
String

The name to use for the function. If null, it will default to a randomly generated name.

description
String

The description to use for the function.

templateFormat
String

The template format of promptTemplate. This must be provided if promptTemplateFactory is not null.

promptTemplateFactory
IPromptTemplateFactory

The IPromptTemplateFactory to use when interpreting the promptTemplate into a IPromptTemplate. If null, a default factory will be used.

Returns

The created KernelFunction for invoking the prompt.

Applies to

CreateFunctionFromPrompt(Kernel, PromptTemplateConfig, IPromptTemplateFactory)

Creates a KernelFunction instance for a prompt specified via a prompt template configuration.

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

Parameters

kernel
Kernel

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

promptConfig
PromptTemplateConfig

Configuration information describing the prompt.

promptTemplateFactory
IPromptTemplateFactory

The IPromptTemplateFactory to use when interpreting the promptConfig into a IPromptTemplate. If null, a default factory will be used.

Returns

The created KernelFunction for invoking the prompt.

Applies to