Class KernelFunctionFromPrompt.Builder<T>
- java.lang.Object
-
- com.microsoft.semantickernel.semanticfunctions.KernelFunctionFromPrompt.Builder<T>
-
- Type Parameters:
T- the type of the return value of the function
- All Implemented Interfaces:
KernelFunction.FromPromptBuilder<T>
- Enclosing class:
- KernelFunctionFromPrompt<T>
public static final class KernelFunctionFromPrompt.Builder<T> extends Object implements KernelFunction.FromPromptBuilder<T>
A builder for creating aKernelFunctionfrom a prompt template.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KernelFunction<T>build()Create a new KernelFunction instance from the builder.KernelFunction.FromPromptBuilder<T>withDefaultExecutionSettings(PromptExecutionSettings executionSettings)Set the default execution settings for the function.KernelFunction.FromPromptBuilder<T>withDescription(String description)Set the description of the function.KernelFunction.FromPromptBuilder<T>withExecutionSettings(Map<String,PromptExecutionSettings> executionSettings)Set the execution settings for the function.KernelFunction.FromPromptBuilder<T>withInputParameters(List<InputVariable> inputVariables)Set the input parameters for the function.KernelFunction.FromPromptBuilder<T>withName(String name)Set the name of the function.<U> KernelFunction.FromPromptBuilder<U>withOutputVariable(OutputVariable<U> outputVariable)Set the output variable for the function.KernelFunction.FromPromptBuilder<T>withOutputVariable(String description, String type)Set the output variable for the function.KernelFunction.FromPromptBuilder<T>withPromptTemplate(PromptTemplate promptTemplate)Set the prompt template for the function.KernelFunction.FromPromptBuilder<T>withPromptTemplateConfig(PromptTemplateConfig promptTemplateConfig)Set the prompt template config used to build the function.KernelFunction.FromPromptBuilder<T>withPromptTemplateFactory(PromptTemplateFactory promptTemplateFactory)Set the prompt template factory used to build the function.KernelFunction.FromPromptBuilder<T>withTemplate(String template)Set the template for the function.KernelFunction.FromPromptBuilder<T>withTemplateFormat(String templateFormat)Set the template format for the function.
-
-
-
Method Detail
-
withName
public KernelFunction.FromPromptBuilder<T> withName(@Nullable String name)
Description copied from interface:KernelFunction.FromPromptBuilderSet the name of the function.- Specified by:
withNamein interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
name- The name of the function- Returns:
- The builder
-
withInputParameters
public KernelFunction.FromPromptBuilder<T> withInputParameters(@Nullable List<InputVariable> inputVariables)
Description copied from interface:KernelFunction.FromPromptBuilderSet the input parameters for the function.- Specified by:
withInputParametersin interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
inputVariables- The input parameters for the function- Returns:
- The builder
-
withPromptTemplate
public KernelFunction.FromPromptBuilder<T> withPromptTemplate(@Nullable PromptTemplate promptTemplate)
Description copied from interface:KernelFunction.FromPromptBuilderSet the prompt template for the function.- Specified by:
withPromptTemplatein interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
promptTemplate- The prompt template for the function- Returns:
- The builder
-
withExecutionSettings
public KernelFunction.FromPromptBuilder<T> withExecutionSettings(@Nullable Map<String,PromptExecutionSettings> executionSettings)
Description copied from interface:KernelFunction.FromPromptBuilderSet the execution settings for the function.- Specified by:
withExecutionSettingsin interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
executionSettings- The execution settings for the function- Returns:
- The builder
-
withDefaultExecutionSettings
public KernelFunction.FromPromptBuilder<T> withDefaultExecutionSettings(@Nullable PromptExecutionSettings executionSettings)
Description copied from interface:KernelFunction.FromPromptBuilderSet the default execution settings for the function.- Specified by:
withDefaultExecutionSettingsin interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
executionSettings- The default execution settings for the function- Returns:
- The builder
-
withDescription
public KernelFunction.FromPromptBuilder<T> withDescription(@Nullable String description)
Description copied from interface:KernelFunction.FromPromptBuilderSet the description of the function.- Specified by:
withDescriptionin interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
description- The description of the function- Returns:
- The builder
-
withTemplate
public KernelFunction.FromPromptBuilder<T> withTemplate(@Nullable String template)
Description copied from interface:KernelFunction.FromPromptBuilderSet the template for the function.- Specified by:
withTemplatein interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
template- The template for the function- Returns:
- The builder
-
withTemplateFormat
public KernelFunction.FromPromptBuilder<T> withTemplateFormat(String templateFormat)
Description copied from interface:KernelFunction.FromPromptBuilderSet the template format for the function.- Specified by:
withTemplateFormatin interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
templateFormat- The template format for the function- Returns:
- The builder
-
withOutputVariable
public <U> KernelFunction.FromPromptBuilder<U> withOutputVariable(@Nullable OutputVariable<U> outputVariable)
Description copied from interface:KernelFunction.FromPromptBuilderSet the output variable for the function.- Specified by:
withOutputVariablein interfaceKernelFunction.FromPromptBuilder<T>- Type Parameters:
U- The type of the output variable- Parameters:
outputVariable- The output variable for the function- Returns:
- The builder
-
withOutputVariable
public KernelFunction.FromPromptBuilder<T> withOutputVariable(@Nullable String description, String type)
Description copied from interface:KernelFunction.FromPromptBuilderSet the output variable for the function.- Specified by:
withOutputVariablein interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
description- The description of the output variabletype- The type of the output variable- Returns:
- The builder
-
withPromptTemplateFactory
public KernelFunction.FromPromptBuilder<T> withPromptTemplateFactory(@Nullable PromptTemplateFactory promptTemplateFactory)
Description copied from interface:KernelFunction.FromPromptBuilderSet the prompt template factory used to build the function.- Specified by:
withPromptTemplateFactoryin interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
promptTemplateFactory- The prompt template factory for the function- Returns:
- The builder
-
withPromptTemplateConfig
public KernelFunction.FromPromptBuilder<T> withPromptTemplateConfig(@Nullable PromptTemplateConfig promptTemplateConfig)
Description copied from interface:KernelFunction.FromPromptBuilderSet the prompt template config used to build the function.- Specified by:
withPromptTemplateConfigin interfaceKernelFunction.FromPromptBuilder<T>- Parameters:
promptTemplateConfig- The prompt template config for the function- Returns:
- The builder
-
build
public KernelFunction<T> build()
Description copied from interface:KernelFunction.FromPromptBuilderCreate a new KernelFunction instance from the builder.- Specified by:
buildin interfaceKernelFunction.FromPromptBuilder<T>- Returns:
- The new KernelFunction instance
-
-