Share via


PromptTemplateConfig Class

  • java.lang.Object
    • com.microsoft.semantickernel.semanticfunctions.PromptTemplateConfig

public class PromptTemplateConfig

Metadata for a prompt template.

Field Summary

Modifier and Type Field and Description
static final int CURRENT_SCHEMA

The current prompt template config schema version.

static final java.lang.String DEFAULT_CONFIG_NAME

The default name for a prompt template config.

static final java.lang.String SEMANTIC_KERNEL_TEMPLATE_FORMAT

The default template format for a prompt template config.

Constructor Summary

Modifier Constructor Description
PromptTemplateConfig(PromptTemplateConfig promptTemplate)

Copy constructor.

PromptTemplateConfig(Integer schema, String name, String template, String templateFormat, Set<PromptTemplateOption> promptTemplateOptions, String description, List<InputVariable> inputVariables, OutputVariable outputVariable, Map<String,PromptExecutionSettings> executionSettings)

Constructor for a prompt template config

protected PromptTemplateConfig(String template)

Constructor for a prompt template config

protected PromptTemplateConfig(String name, String template, String templateFormat, Set<PromptTemplateOption> promptTemplateOptions, String description, List<InputVariable> inputVariables, OutputVariable outputVariable, Map<String,PromptExecutionSettings> executionSettings)

Constructor for a prompt template config

Method Summary

Modifier and Type Method and Description
static Builder builder()

Create a builder for a prompt template config.

Builder copy()

Create a builder for a prompt template config which is a clone of the current object.

static Builder defaultTemplateBuilder()

Create a builder for a prompt template config, where the constructed template will be considered the default to be used if no other config is selected.

boolean equals(Object obj)
java.lang.String getDescription()

Get the description of the prompt template config.

java.util.Map<java.lang.String,PromptExecutionSettings> getExecutionSettings()

Get the prompt execution settings of the prompt template config.

java.util.List<InputVariable> getInputVariables()

Get the inputVariables of the prompt template config.

java.util.List<InputVariable> getKernelParametersMetadata()

Get the parameters metadata.

OutputVariable<?> getKernelReturnParameterMetadata()

Get the return parameter metadata.

java.lang.String getName()

Get the name of the prompt template config.

OutputVariable getOutputVariable()

Get the output variable of the prompt template config.

java.util.Set<PromptTemplateOption> getPromptTemplateOptions()

Get the prompt template options of the prompt template config.

int getSchema()

Get the schema version of the prompt template config.

java.lang.String getTemplate()

Get the template of the prompt template config.

java.lang.String getTemplateFormat()

Get the template format of the prompt template config.

int hashCode()
static PromptTemplateConfig parseFromJson(String json)

Deserialize the JSON string to a PromptTemplateConfig.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Field Details

CURRENT_SCHEMA

public static final int CURRENT_SCHEMA

The current prompt template config schema version.

DEFAULT_CONFIG_NAME

public static final String DEFAULT_CONFIG_NAME

The default name for a prompt template config.

SEMANTIC_KERNEL_TEMPLATE_FORMAT

public static final String SEMANTIC_KERNEL_TEMPLATE_FORMAT

The default template format for a prompt template config.

Constructor Details

PromptTemplateConfig

public PromptTemplateConfig(PromptTemplateConfig promptTemplate)

Copy constructor.

Parameters:

promptTemplate - The prompt template to copy.

PromptTemplateConfig

public PromptTemplateConfig(Integer schema, String name, String template, String templateFormat, Set promptTemplateOptions, String description, List inputVariables, OutputVariable outputVariable, Map executionSettings)

Constructor for a prompt template config

Parameters:

schema - Schema version
name - Name of the template
template - Template string
templateFormat - Template format
promptTemplateOptions - Prompt template options
description - Description of the template
inputVariables - Input variables
outputVariable - Output variable
executionSettings - Execution settings

PromptTemplateConfig

protected PromptTemplateConfig(String template)

Constructor for a prompt template config

Parameters:

template - Template string

PromptTemplateConfig

protected PromptTemplateConfig(String name, String template, String templateFormat, Set promptTemplateOptions, String description, List inputVariables, OutputVariable outputVariable, Map executionSettings)

Constructor for a prompt template config

Parameters:

name - Name of the template
template - Template string
templateFormat - Template format
promptTemplateOptions
description - Description of the template
inputVariables - Input variables
outputVariable - Output variable
executionSettings - Execution settings

Method Details

builder

public static PromptTemplateConfig.Builder builder()

Create a builder for a prompt template config.

Returns:

The prompt template config builder.

copy

public PromptTemplateConfig.Builder copy()

Create a builder for a prompt template config which is a clone of the current object.

Returns:

The prompt template config builder.

defaultTemplateBuilder

public static PromptTemplateConfig.Builder defaultTemplateBuilder()

Create a builder for a prompt template config, where the constructed template will be considered the default to be used if no other config is selected.

Returns:

The default prompt template config.

equals

public boolean equals(Object obj)

Overrides:

PromptTemplateConfig.equals(Object obj)

Parameters:

obj

getDescription

public String getDescription()

Get the description of the prompt template config.

Returns:

The description of the prompt template config.

getExecutionSettings

public Map getExecutionSettings()

Get the prompt execution settings of the prompt template config.

Returns:

The prompt execution settings of the prompt template config.

getInputVariables

public List getInputVariables()

Get the inputVariables of the prompt template config.

Returns:

The input variables of the prompt template config.

getKernelParametersMetadata

public List getKernelParametersMetadata()

Get the parameters metadata.

Returns:

The parameters metadata.

getKernelReturnParameterMetadata

public OutputVariable getKernelReturnParameterMetadata()

Get the return parameter metadata.

Returns:

The return parameter metadata.

getName

public String getName()

Get the name of the prompt template config.

Returns:

The name of the prompt template config.

getOutputVariable

public OutputVariable getOutputVariable()

Get the output variable of the prompt template config.

Returns:

The output variable of the prompt template config.

getPromptTemplateOptions

public Set getPromptTemplateOptions()

Get the prompt template options of the prompt template config.

Returns:

The prompt template options of the prompt template config.

getSchema

public int getSchema()

Get the schema version of the prompt template config.

Returns:

The schema version of the prompt template config.

getTemplate

public String getTemplate()

Get the template of the prompt template config.

Returns:

The template of the prompt template config.

getTemplateFormat

public String getTemplateFormat()

Get the template format of the prompt template config.

Returns:

The template format of the prompt template config.

hashCode

public int hashCode()

Overrides:

PromptTemplateConfig.hashCode()

parseFromJson

public static PromptTemplateConfig parseFromJson(String json)

Deserialize the JSON string to a PromptTemplateConfig.

Parameters:

json - The JSON string to parse

Returns:

The PromptTemplateConfig object

Throws:

SKException - If the prompt template config cannot be deserialized.

Applies to