Zero Downtime Releases
Input Variable Handling
The pl.run()
function handles input variables in the following ways:
- Normal Usage:
Provide all required variables as defined in your prompt template:
- Missing Variables:
If you don’t provide the required input variables, you’ll receive a warning in the console, but the prompt template will still run. The missing variables will be sent to the LLM as unprocessed strings:
- Extra Variables:
If you include extra variables that aren’t in the template, they will be ignored:
In this case, the 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 with prod
that uses only one input variable, favorite_movie
:
Update Process
Follow these steps to safely add a new mood
variable to your prompt template:
-
Create a new template version with the new
mood
variable -
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
prod
label to the most recent prompt version -
Update your source code to reference the
prod
prompt version again and deploy:
- Delete the temporary
new-var
label from the PromptLayer UI