liveBook · Manning

Prompt version

As explained in Build AI-Enhanced Web Apps

Prompt versioning is the practice of maintaining identifiable revisions of prompts so their changes and behavior can be tracked.

A prompt version is an identifiable revision of a prompt. Keeping revisions lets a team track how wording changes affect AI outputs and user experience, compare alternatives, and return to an earlier prompt when needed. section 5.6 section 5.1.3

Choose a storage approach that fits how prompts change:

  • Keep named prompt files when revisions can move with application code. Translation examples distinguish both provider and revision in filenames such as translation_openai_v1.0.1.ts and translation_openai_v1.1.0.ts. section 5.1.3
  • Store prompts in a database when they must change without redeploying. Multiple stored versions support A/B tests and rollback; database access control can limit who modifies them. section 5.1.3
  • Test a change before relying on it. Mock generateText() with Vitest for predictable checks, or check generated text against similarity and word-count or required-word constraints. section 5.1.3
// prompts/translation_openai_v1.0.1.ts
export const translationPrompt_openai_v1_0_1 = 
"Translate the following text from {source_lang} 
to {target_lang}: {text}";
// prompts/translation_openai_v1.1.0.ts
export const translationPrompt_openai_v1_1_0 = 
"You are a professional translator. Translate the 
following text from {source_lang} to {target_lang}, 
maintaining the original tone and style: {text}";

// prompts/translation_anthropic_v1.0.0.ts
export const translationPrompt_anthropic_v1_0_0 = 
"As an AI language model, please translate the given
 text from {source_lang} to {target_lang}. 
Ensure that the translation is accurate 
and natural-sounding. Text to translate: {text}";

The translation prompt files show two OpenAI revisions and a separate Anthropic variant. Compare their instructions to see what each named revision preserves or changes. section 5.1.3

The Vercel AI SDK does not include built-in prompt management. A prompt store therefore sits alongside generation code: the application retrieves the chosen prompt, then passes it into its AI generation flow. Version names make that choice explicit rather than hiding a wording change inside application logic. section 5.1.3

How Build AI-Enhanced Web Apps covers it

How deep it goes
Explains storage choices, revision examples, and output tests, but stops short of a complete database-backed implementation.
Examples
Contrasts workout-blog wording and provider-specific translation files, then checks generated output with Vitest mocks, similarity, and constraints.
What it assumes
Assumes familiarity with React, Next.js, the Vercel AI SDK, and basic AI model interactions and state management.
What you can do after
Operate/configure it by keeping identifiable revisions for comparison and rollback, with database storage when updates must avoid redeployment.
How it connects
Links prompt management with A/B testing, rollback, access control, and prompt testing.

Also explained in

Compare how 2 books explain prompt version →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build AI-Enhanced Web Apps. The section links point to the parts of the book it draws on.