Share via


PromptTemplateFactory Interface

public interface PromptTemplateFactory

The interface that a PromptTemplateFactory implementation must provide.

Method Summary

Modifier and Type Method and Description
static PromptTemplate build(PromptTemplateConfig templateConfig)

Create a prompt template, if possible, from the given configuration.

abstract PromptTemplate tryCreate(PromptTemplateConfig templateConfig)

Create a prompt template, if possible, from the given configuration.

Method Details

build

public static PromptTemplate build(PromptTemplateConfig templateConfig)

Create a prompt template, if possible, from the given configuration. This is a convenience method that wraps the tryCreate(PromptTemplateConfig templateConfig) method.

Parameters:

templateConfig - The configuration for the prompt template.

Returns:

The prompt template.

tryCreate

public abstract PromptTemplate tryCreate(PromptTemplateConfig templateConfig)

Create a prompt template, if possible, from the given configuration. If the PromptTemplateConfig is not supported, the method should throw an UnknownTemplateFormatException.

Parameters:

templateConfig - The configuration for the prompt template.

Returns:

The prompt template.

Applies to