Prompt Versions

A prompt’s history with what each change did to the score. The pairing is the point: a history without outcomes says what happened, a score chart without edits says something changed, and neither answers which edit made it worse.

src/components/ui/prompt-versions.tsx

About

From the component's own source, where it was written.

A prompt's version history, with what each change did to the score.

The pairing that makes this useful: a version and its eval result on the same row. A history that lists edits without outcomes tells you what happened; a dashboard that shows scores without the edits tells you something changed. Neither answers "which edit made it worse", which is the only question anyone opens this for.

**Deltas are against the previous version, not against the best.** Regression hunting walks backwards one step at a time, and a delta against a distant high-water mark makes every version after it look equally bad.

The live version is marked rather than sorted to the top — its position in the sequence is information, and moving it hides how many versions have shipped since.

Install

npx astralyx-ui add prompt-versions

Usage

import { PromptVersions } from '@/components/ui/prompt-versions'

<PromptVersions versions={versions} onCompare={(a, b) => openDiff(a, b)} />

Composer

Change the props and the source below follows.

Versions

Props
tsx
<PromptVersions
  versions={versions}
  onSelect={select}
  onCompare={(a, b) => openDiff(a, b)}
/>

Examples

A regression in v5

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

PromptVersions

A prompt's version history, with what each change did to the score.

Extends Omit<ComponentProps<'div'>, 'onSelect'>.

PropTypeDefaultDescription
versionsPromptVersion[]required{ id, label, at?, author?, note?, score?, live? }. Newest first — order is preserved because position in the sequence is information.
selectedIdstring——
onSelect(version: PromptVersion) => void——
onCompare(a: PromptVersion, b: PromptVersion) => void—Usually opens a PromptDiff between a version and the one before it.
compareLabelstring'Diff'—
liveLabelstring'Live'—
unscoredLabelstring'not scored'—
emptyLabelstring'No versions yet.'—
formatScore(score: number) => string(score) => `${Math.round(score * 100)}%`—
labelstring'Versions'—

Types

PromptVersion

FieldTypeDescription
idstring—
labelstringA label, tag or hash — whatever you version by.
at?stringAlready formatted — this component does not own your locale.
author?string—
note?ReactNodeOne line on what changed.
score?numberEval score, 0–1. Omit for a version that was never scored.
live?booleanMarked in place rather than sorted to the top — moving it hides how many versions have shipped since.

Behaviour

TopicDetailDescription
deltasvs the previous versionNot against the best. Regression hunting walks backwards one step at a time; a delta against a distant high-water mark makes everything after it look equally bad.