KernelFunctionFactory.CreateFromPrompt Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreateFromPrompt(IPromptTemplate, PromptTemplateConfig, ILoggerFactory) |
Creates a KernelFunction instance for a prompt specified via a prompt template and prompt template configuration. |
CreateFromPrompt(PromptTemplateConfig, IPromptTemplateFactory, ILoggerFactory) |
Creates a KernelFunction instance for a prompt specified via a prompt template configuration. |
CreateFromPrompt(String, PromptExecutionSettings, String, String, String, IPromptTemplateFactory, ILoggerFactory) |
Creates a KernelFunction instance for a prompt specified via a prompt template. |
CreateFromPrompt(String, IEnumerable<PromptExecutionSettings>, String, String, String, IPromptTemplateFactory, ILoggerFactory) |
Creates a KernelFunction instance for a prompt specified via a prompt template. |
CreateFromPrompt(IPromptTemplate, PromptTemplateConfig, ILoggerFactory)
Creates a KernelFunction instance for a prompt specified via a prompt template and prompt template configuration.
public static Microsoft.SemanticKernel.KernelFunction CreateFromPrompt (Microsoft.SemanticKernel.IPromptTemplate promptTemplate, Microsoft.SemanticKernel.PromptTemplateConfig promptConfig, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default);
static member CreateFromPrompt : Microsoft.SemanticKernel.IPromptTemplate * Microsoft.SemanticKernel.PromptTemplateConfig * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.SemanticKernel.KernelFunction
Public Shared Function CreateFromPrompt (promptTemplate As IPromptTemplate, promptConfig As PromptTemplateConfig, Optional loggerFactory As ILoggerFactory = Nothing) As KernelFunction
Parameters
- promptTemplate
- IPromptTemplate
Prompt template for the function.
- promptConfig
- PromptTemplateConfig
Configuration information describing the prompt.
- loggerFactory
- ILoggerFactory
The ILoggerFactory to use for logging. If null, no logging will be performed.
Returns
The created KernelFunction for invoking the prompt.
Applies to
CreateFromPrompt(PromptTemplateConfig, IPromptTemplateFactory, ILoggerFactory)
Creates a KernelFunction instance for a prompt specified via a prompt template configuration.
public static Microsoft.SemanticKernel.KernelFunction CreateFromPrompt (Microsoft.SemanticKernel.PromptTemplateConfig promptConfig, Microsoft.SemanticKernel.IPromptTemplateFactory? promptTemplateFactory = default, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default);
static member CreateFromPrompt : Microsoft.SemanticKernel.PromptTemplateConfig * Microsoft.SemanticKernel.IPromptTemplateFactory * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.SemanticKernel.KernelFunction
Public Shared Function CreateFromPrompt (promptConfig As PromptTemplateConfig, Optional promptTemplateFactory As IPromptTemplateFactory = Nothing, Optional loggerFactory As ILoggerFactory = Nothing) As KernelFunction
Parameters
- 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.
- loggerFactory
- ILoggerFactory
The ILoggerFactory to use for logging. If null, no logging will be performed.
Returns
The created KernelFunction for invoking the prompt.
Applies to
CreateFromPrompt(String, PromptExecutionSettings, String, String, String, IPromptTemplateFactory, ILoggerFactory)
Creates a KernelFunction instance for a prompt specified via a prompt template.
public static Microsoft.SemanticKernel.KernelFunction CreateFromPrompt (string promptTemplate, Microsoft.SemanticKernel.PromptExecutionSettings? executionSettings = default, string? functionName = default, string? description = default, string? templateFormat = default, Microsoft.SemanticKernel.IPromptTemplateFactory? promptTemplateFactory = default, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default);
static member CreateFromPrompt : string * Microsoft.SemanticKernel.PromptExecutionSettings * string * string * string * Microsoft.SemanticKernel.IPromptTemplateFactory * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.SemanticKernel.KernelFunction
Public Shared Function CreateFromPrompt (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, Optional loggerFactory As ILoggerFactory = Nothing) As KernelFunction
Parameters
- 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.
- loggerFactory
- ILoggerFactory
The ILoggerFactory to use for logging. If null, no logging will be performed.
Returns
The created KernelFunction for invoking the prompt.
Applies to
CreateFromPrompt(String, IEnumerable<PromptExecutionSettings>, String, String, String, IPromptTemplateFactory, ILoggerFactory)
Creates a KernelFunction instance for a prompt specified via a prompt template.
public static Microsoft.SemanticKernel.KernelFunction CreateFromPrompt (string promptTemplate, System.Collections.Generic.IEnumerable<Microsoft.SemanticKernel.PromptExecutionSettings>? executionSettings, string? functionName = default, string? description = default, string? templateFormat = default, Microsoft.SemanticKernel.IPromptTemplateFactory? promptTemplateFactory = default, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default);
static member CreateFromPrompt : string * seq<Microsoft.SemanticKernel.PromptExecutionSettings> * string * string * string * Microsoft.SemanticKernel.IPromptTemplateFactory * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.SemanticKernel.KernelFunction
Public Shared Function CreateFromPrompt (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, Optional loggerFactory As ILoggerFactory = Nothing) As KernelFunction
Parameters
- promptTemplate
- String
Prompt template for the function.
- executionSettings
- IEnumerable<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.
- loggerFactory
- ILoggerFactory
The ILoggerFactory to use for logging. If null, no logging will be performed.
Returns
The created KernelFunction for invoking the prompt.