Learn how to version your prompts, retrieve them programmatically, and keep them organized in PromptLayer.
It’s easy to organize and version your prompts inside of PromptLayer. This guide explains how to save a new version and retrieve the latest one programmatically.
This module requires an existing prompt in your PromptLayer account. Please
follow the Getting Started guide to
create one if needed.
Every time you update a prompt in PromptLayer, a new version is created. You will always be able to track changes, compare versions, or revert if needed.
In the Getting Started Onboarding, we created a prompt called “ai-poet” to generate a haiku on a given topic. Initially, it uses a single input variable for the topic:
Copy
Ask AI
SYSTEM:You are a skilled poet specializing in haikus.Your task is to write a haiku based on a topic provided by the user.The haiku must have 17 syllables, structured in three lines of 5, 7, and 5.USER:{topic}
Next, we will update the prompt to allow users to specify a language.
First, add a new input variable {language}
Update the system prompt to instruct the AI to consider both the topic and the language.