Interface PromptTemplateFactory
-
- All Known Implementing Classes:
AggregatorPromptTemplateFactory,HandlebarsPromptTemplateFactory,KernelPromptTemplateFactory
public interface PromptTemplateFactoryThe interface that aPromptTemplateFactoryimplementation must provide.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPromptTemplateFactory.UnknownTemplateFormatExceptionException thrown when the template format is not supported.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static PromptTemplatebuild(PromptTemplateConfig templateConfig)Create a prompt template, if possible, from the given configuration.PromptTemplatetryCreate(PromptTemplateConfig templateConfig)Create a prompt template, if possible, from the given configuration.
-
-
-
Method Detail
-
build
static PromptTemplate build(PromptTemplateConfig templateConfig)
Create a prompt template, if possible, from the given configuration. This is a convenience method that wraps theKernelPromptTemplateFactory.tryCreate(PromptTemplateConfig)method.- Parameters:
templateConfig- The configuration for the prompt template.- Returns:
- The prompt template.
- Throws:
PromptTemplateFactory.UnknownTemplateFormatException- If the template format is not supported.- See Also:
PromptTemplateConfig.getTemplateFormat()
-
tryCreate
PromptTemplate tryCreate(PromptTemplateConfig templateConfig)
Create a prompt template, if possible, from the given configuration. If thePromptTemplateConfigis not supported, the method should throw anUnknownTemplateFormatException.- Parameters:
templateConfig- The configuration for the prompt template.- Returns:
- The prompt template.
- Throws:
PromptTemplateFactory.UnknownTemplateFormatException- If the template format is not supported.- See Also:
PromptTemplateConfig.getTemplateFormat()
-
-