Concepts

Prompt Template

Formats prompts by replacing template variables with user input.

Why it exists

Keeps prompt text separate from the values filled into it, so the same template can be reused with different inputs.

View source on GitHub
educhain.py
from educhain.prompts import PromptTemplate

prompt = PromptTemplate(
    template="Explain {topic} in simple words.",
    input_variables=["topic"]
)

Related