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.tsxAbout
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
<PromptVersions
versions={versions}
onSelect={select}
onCompare={(a, b) => openDiff(a, b)}
/>Examples
A regression in v5
<PromptVersions versions={versions} onCompare={openDiff} />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'>.
| Prop | Type | Default | Description |
|---|---|---|---|
| versions | PromptVersion[] | required | { id, label, at?, author?, note?, score?, live? }. Newest first — order is preserved because position in the sequence is information. |
| selectedId | string | — | — |
| onSelect | (version: PromptVersion) => void | — | — |
| onCompare | (a: PromptVersion, b: PromptVersion) => void | — | Usually opens a PromptDiff between a version and the one before it. |
| compareLabel | string | 'Diff' | — |
| liveLabel | string | 'Live' | — |
| unscoredLabel | string | 'not scored' | — |
| emptyLabel | string | 'No versions yet.' | — |
| formatScore | (score: number) => string | (score) => `${Math.round(score * 100)}%` | — |
| label | string | 'Versions' | — |
Types
PromptVersion
| Field | Type | Description |
|---|---|---|
| id | string | — |
| label | string | A label, tag or hash — whatever you version by. |
| at? | string | Already formatted — this component does not own your locale. |
| author? | string | — |
| note? | ReactNode | One line on what changed. |
| score? | number | Eval score, 0–1. Omit for a version that was never scored. |
| live? | boolean | Marked in place rather than sorted to the top — moving it hides how many versions have shipped since. |
Behaviour
| Topic | Detail | Description |
|---|---|---|
| deltas | vs the previous version | Not 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. |