Variables

Pipes have built-in support for variables to handle dynamic prompts. Any text written between {{}} in your prompt instructions acts as a variable to which you can assign different values using the variable section inside a Pipe. Variables will appear once you add them using {{variableName}}.

Variables power you to build applications where you can get their value from your external or internal users. Based on these variable values, you can generate completion using the Pipe API.


How to use Variables

Follow this quick guide to learn how to use Variables inside a Pipe.


Step #1Create a Variable

Variables are created using {{variableName}} syntax. Navigate to any of your Langbase Pipes and anywhere in system, user or assistant prompt instructions, write a variable name using the syntax.

An example of a system prompt with a variable:

You are helpful AI assistant that creates creative blog {{titles}}.

Step #2Assign a Value

Inside the Pipe, there is a Variable section on the left where you can assign a value to the variable you created.

Let's give the value AI applications to the variable {{titles}}.