Prompt Management
Prompt Version Control
9 min
role based access controls in abv docid\ pbfajefyaxn6r9u7athrx in abv, version control & deployment of prompts is managed via versions and labels versions & labels each prompt version is automatically assigned a version id additionally, you can assign labels to follow your own versioning scheme labels can be used to assign prompts to environments (staging, production), tenants (tenant 1, tenant 2), or experiments (prod a, prod b) ui use the abv ui to assign labels to a prompt python sdk use the python sdk to assign labels to a prompt when creating a new prompt version abv create prompt( name="movie critic", type="text", prompt="as a {{criticlevel}} movie critic, do you like {{movie}}?", labels=\["production"], # add the label "production" to the prompt version ) alternatively, you can also update the labels of an existing prompt version using the python sdk abv = abv() abv update prompt( name="movie critic", version=1, new labels=\["john", "doe"], # assign these labels to the prompt version ) js/ts sdk use the js/ts sdk to assign labels to a prompt when creating a new prompt version import { abvclient } from "@abvdev/client"; const abv = new abvclient(); await abv prompt create({ name "movie critic", type "text", prompt "as a {{criticlevel}} critic, do you like {{movie}}?", labels \["production"], // add the label "production" to the prompt version }); alternatively, you can also update the labels of an existing prompt version using the js/ts sdk await abv prompt update({ name "movie critic", version 1, newlabels \["john", "doe"], }); fetching by label or version when fetching prompts to use them in your application you can either do you by fetching a specific version or label here are code examples for fetching prompts by label or version to "deploy" a prompt version , you have to assign the label production or any environment label you created to that prompt version some notes on fetching prompts the latest label points to the most recently created version when using a prompt without s pecifying a label , abv will serve the version with the production label python sdk from abvdev import get client \# initialize abv client abv = get client() \# get specific version prompt = abv get prompt("movie critic", version=1) \# get specific label prompt = abv get prompt("movie critic", label="staging") \# get latest prompt version the 'latest' label is automatically maintained by abv prompt = abv get prompt("movie critic", label="latest") js/ts sdk import { abvclient } from "@abvdev/client"; const abv = new abvclient(); // get specific version of a prompt (here version 1) const prompt = await abv prompt get("movie critic", { version 1, }); // get specific label const prompt = await abv prompt get("movie critic", { label "staging", }); // get latest prompt version the 'latest' label is automatically maintained by abv const prompt = await abv prompt get("movie critic", { label "latest", }); rollbacks when a prompt has a production label, then that version will be served by default in the sdks you can quickly rollback to a previous version by setting the production label to that previous version in the abv ui prompt diffs the prompt version diff view shows you the changes you made to the prompt over time this helps you understand how the prompt has evolved and what changes have been made to debug issues or understand the impact of changes protected prompt labels protected prompt labels give project admins and owners ( role based access controls in abv docid\ pbfajefyaxn6r9u7athrx ) the ability to prevent labels from being modified or deleted, ensuring better control over prompt deployment once a label such as production is marked as protected viewer and member roles cannot modify or delete the label from prompts, preventing changes to the production prompt version this also blocks the deletion of the prompt admin and owner roles can still modify or delete the label, effectively changing the production prompt version admins and owners can update a label's protection status in the project settings