This module requires an existing prompt in your PromptLayer account. Please
follow the Getting Started guide to
create one if needed.
Update an Existing Prompt
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.Example
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:- First, add a new input variable
{language}
- Update the system prompt to instruct the AI to consider both the topic and the language.
Instructions
- Navigate to the Prompt Registry.
- Select the existing prompt you want to update (e.g., “ai-poet”).
- Click the Edit Version #1 button to open the prompt in an editor.
- Make some changes
- Click Update Template to save these edits as a new version.
Additional Features
- Label prompt versions for better organization (e.g., “prod” or “dev”). (Learn more about release labels.)
- Compare previous iterations to track improvements.
- Use A/B testing to evaluate performance differences. (Learn more)
Retrieve Your Prompts from Code
To keep your PromptLayer prompts synchronized with your codebase, fetch the latest prompt version using the SDK.- Obtain an API Key by going to Settings → PromptLayer API Keys.
- Initialize the PromptLayer client in your application.
- Retrieve the prompt and run it. This will pull the latest prompt version, run it client side, and log the results.
- The latest or production version of your prompts will always synchronized.
- New prompt versions can be deployed without requiring engineering code deploys.
Additional Resources:
- Set up Continuous Integration using PromptLayer
- Learn more about the Prompt Registry here.