Input Variable Handling
Thepl.run() function handles input variables in the following ways:
- Normal Usage:
- Missing Variables:
- Extra Variables:
release_year variable will be ignored in the LLM request if it’s not part of the current template.
When you need to add new input variables to your prompt template, it’s important to keep your source code in sync with the template changes. This guide outlines the process for deploying these updates to your production environment.
Example Scenario
Assume you have a prompt template version tagged withprod that uses only one input variable, favorite_movie:
Update Process
Follow these steps to safely add a newmood variable to your prompt template:
-
Create a new template version with the new
moodvariable -
Apply a unique temporary label (e.g.,
new-var) to the new version - Update and deploy your code to use the new template version and include the new variable:
-
In the PromptLayer UI, move the
prodlabel to the most recent prompt version -
Update your source code to reference the
prodprompt version again and deploy:
- Delete the temporary
new-varlabel from the PromptLayer UI

