Annotation Based Prompt Template
Annotation provides a simple way to define prompt templates with variables using annotations. This library has two main parts:
@Prompt
annotation: Used to define a prompt template with variables, examples, and an optional name for the prompt.PromptProcessor
class: Responsible for processing the@Prompt
and@Prompts
annotations on a class and creating aPromptTemplate
based on the annotations and the fields of the annotated class.
Usage:
Example
Here's an example of using the @Prompt
annotation:
Using multiple prompts
When you have multiple prompt templates in a single class, use the @Prompts
annotation as a container for multiple @Prompt
annotations. In this case, provide a unique name for each prompt:
Last updated