Prompts
Prompt Templates
This page will tell you how to use prompt templates with Flush. Prompt templates are pre-defined recipes for generating prompts for language models.
from flush import PromptTemplate
Prompt Template
We use Python’s f-string as the template format for prompt templates.
template = "Tell me a {adjective} joke about {content}."
prompt_template = PromptTemplate(template)
To get the formatted output from a PromptTemplate
, simply do the following:
print(prompt_template.format(adjective="funny", content="chickens"))
# Output: Tell me a funny joke about chickens.
This can then be passed as model input with chains as shown here.