Playground
Variables
Working with Variables
Variables are a powerful feature in Langtail that allow you to dynamically customize your prompts and models. They enable you to create reusable components and inject context-specific information into your language models.
1
Creating a Variable
- Log into Langtail and select your project.
- Navigate to ‘Prompts’ to either open an existing prompt or create a new one.
- In the ‘Template’ section, craft your prompt.
- Add new variable by using curls
{{ }}
- Navigate to the Variables panel
- Enter the variable value (text, number, or other data types supported by Langtail).
2
Using Variables in Prompts
- In the prompt editor, use the
{{variable_name}}
syntax to reference your variable. - Langtail will automatically replace the variable placeholder with its corresponding value when processing the prompt.
Example:
Let’s create a variable called company_name
with the value “Acme Inc.” and use it in a prompt:
Was this page helpful?