Versions of a prompt or model on the same test cases, side by side, with pass rates, scores, latency and a verdict per case.
- 3.9 kB JS 3.6 kB CSS gzipped
- No serious axe issues
- Server-rendered, hydrates
- 44px touch targets
- Right-to-left
- 10 tests
Support replies: prompt v7 against v8
- Prompt v7current, in production
- Passed
- 3/6
- Mean score
- 0.64
- Mean latency
- 1.2 s
- Judged better
- 0
- Prompt v8adds the refund policy and two examples
- Passed
- 4/6
- Mean score
- 0.75
- Mean latency
- 1.6 s
- Judged better
- 1
- refund-late
My order arrived 9 days late and the mug was chipped. I want my money back.
Expected: Apologize, offer a replacement or refund for the mug, no refund on shipping past 30 days.
Prompt v7FailScore 0.411.8 sSo sorry about that! I've refunded your whole order, including shipping.
Refunded more than the policy allows
Prompt v8PassScore 0.922.1 sI'm sorry the mug arrived chipped and late. I can send a new one today or refund the $24 for it. Which would you prefer?
- address-change
Can I change the address on order 51207? I moved last week.
Expected: Ask for the new address; say it can change until the order ships.
Prompt v7PassScore 0.881.2 sSure. What's the new address? I can update it until the order ships.
Prompt v8PassScore 0.901.5 sOf course. Send me the new address and I'll update order 51207. Changes work until it ships, usually within a day.
- angry-caps
THIRD TIME ASKING. WHERE IS MY PACKAGE
Expected: Stay calm, apologize once, give tracking and a date.
Prompt v7FailScore 0.35980 msI understand your frustration. Your package is on its way.
No tracking link or date
Prompt v8PassScore 0.861.6 sI'm sorry you've had to ask three times. It's with the courier, arriving Thursday: track it at the link below.
- wholesale
Do you sell wholesale? We run a café and want 200 mugs.
Prompt v7PassScore 0.801.1 sYes! For orders over 100 we offer 20% off. Want me to start a quote?
Prompt v8PassScore 0.841.4 sWe do. I'll pass this to our wholesale team; they reply within a day with pricing for 200 mugs.
- competitor-price
I saw the same tote cheaper somewhere else. Will you match it?
Expected: Don't promise a match; explain the policy politely.
Prompt v7FailScore 0.521 sWe don't match prices, but here's 10% off your next order.
Offered a discount it can't give
Prompt v8FailScore 0.661.7 sWe don't match other shops' prices, sorry. If the price drops here within 14 days, we'll refund the difference.
Price drop policy is 7 days, not 14
- german
Hallo, wann kommt meine Bestellung an?
Expected: Answer in German.
Prompt v7PassScore 0.901.2 sHallo! Ihre Bestellung ist unterwegs und kommt voraussichtlich am Freitag an.
Prompt v8FailScore 0.301.3 sHello! Your order should arrive on Friday.
Replied in English
2 of 6 cases judged
import { UiSchema } from "effect/ui"import { Html } from "effect/ui/html"import * as stylex from "@stylexjs/stylex"import { Schema } from "effect"import { EvalCompare, type EvalCase, type EvalVariant } from "./ui/uicontext/components/EvalCompare.ts"import { sx } from "./ui/uicontext/components/Sx.ts"const styles = stylex.create({ wrap: { inlineSize: "100%" } })const variants: ReadonlyArray<EvalVariant> = [ { id: "v7", name: "Prompt v7", detail: "current, in production" }, { id: "v8", name: "Prompt v8", detail: "adds the refund policy and two examples" },]const cases: ReadonlyArray<EvalCase> = [ { id: "refund-late", input: "My order arrived 9 days late and the mug was chipped. I want my money back.", expected: "Apologize, offer a replacement or refund for the mug, no refund on shipping past 30 days.", outputs: { v7: { text: "So sorry about that! I've refunded your whole order, including shipping.", pass: false, score: 0.41, latencyMs: 1820, reason: "Refunded more than the policy allows" }, v8: { text: "I'm sorry the mug arrived chipped and late. I can send a new one today or refund the $24 for it. Which would you prefer?", pass: true, score: 0.92, latencyMs: 2140 }, }, }, { id: "address-change", input: "Can I change the address on order 51207? I moved last week.", expected: "Ask for the new address; say it can change until the order ships.", outputs: { v7: { text: "Sure. What's the new address? I can update it until the order ships.", pass: true, score: 0.88, latencyMs: 1210 }, v8: { text: "Of course. Send me the new address and I'll update order 51207. Changes work until it ships, usually within a day.", pass: true, score: 0.9, latencyMs: 1460 }, }, }, { id: "angry-caps", input: "THIRD TIME ASKING. WHERE IS MY PACKAGE", expected: "Stay calm, apologize once, give tracking and a date.", outputs: { v7: { text: "I understand your frustration. Your package is on its way.", pass: false, score: 0.35, latencyMs: 980, reason: "No tracking link or date" }, v8: { text: "I'm sorry you've had to ask three times. It's with the courier, arriving Thursday: track it at the link below.", pass: true, score: 0.86, latencyMs: 1630 }, }, }, { id: "wholesale", input: "Do you sell wholesale? We run a café and want 200 mugs.", outputs: { v7: { text: "Yes! For orders over 100 we offer 20% off. Want me to start a quote?", pass: true, score: 0.8, latencyMs: 1100 }, v8: { text: "We do. I'll pass this to our wholesale team; they reply within a day with pricing for 200 mugs.", pass: true, score: 0.84, latencyMs: 1390 }, }, }, { id: "competitor-price", input: "I saw the same tote cheaper somewhere else. Will you match it?", expected: "Don't promise a match; explain the policy politely.", outputs: { v7: { text: "We don't match prices, but here's 10% off your next order.", pass: false, score: 0.52, latencyMs: 1040, reason: "Offered a discount it can't give" }, v8: { text: "We don't match other shops' prices, sorry. If the price drops here within 14 days, we'll refund the difference.", pass: false, score: 0.66, latencyMs: 1720, reason: "Price drop policy is 7 days, not 14" }, }, }, { id: "german", input: "Hallo, wann kommt meine Bestellung an?", expected: "Answer in German.", outputs: { v7: { text: "Hallo! Ihre Bestellung ist unterwegs und kommt voraussichtlich am Freitag an.", pass: true, score: 0.9, latencyMs: 1150 }, v8: { text: "Hello! Your order should arrive on Friday.", pass: false, score: 0.3, latencyMs: 1310, reason: "Replied in English" }, }, },]const Message = UiSchema.TaggedEnum({ Judged: { verdicts: Schema.Record(Schema.String, Schema.String) } })// a review of a prompt change before it ships: v8 fixes refunds, but breaks replies in Germanexport const PromptReview = Html.component({ name: "PromptReview", model: Schema.Struct({ verdicts: Schema.Record(Schema.String, Schema.String) }), message: Message,}).make({ init: () => ({ verdicts: { "refund-late": "v8", "address-change": "tie" } }), update: { Judged: ($, { verdicts }) => $.evolve({ verdicts }) }, view: (h, model) => h.div.attrs(sx(styles.wrap)).children( EvalCompare(h, { key: "review", props: { label: "Support replies: prompt v7 against v8", variants, cases, value: model.verdicts }, onEmit: { RequestedChange: ({ value }) => Message.Judged({ verdicts: value }) }, }), ),})When to use
Versions of a prompt or model on the same test cases, side by side, with pass rates, scores, latency and a verdict per case. Use Trace View instead when you're looking into one run, not comparing versions across cases.
Usage
import { EvalCompare, type EvalCase, type Verdicts } from "./ui/uicontext/components/EvalCompare.ts"export const PromptCompare = <M>(h: Html.H<M>, cases: ReadonlyArray<EvalCase>, verdicts: Verdicts, onJudge: (verdicts: Verdicts) => M) => EvalCompare(h, { props: { label: "Prompt v7 against v8", variants: [{ id: "v7", name: "Prompt v7" }, { id: "v8", name: "Prompt v8" }], cases, value: verdicts, }, onEmit: { RequestedChange: ({ value }) => onJudge(value) }, })Examples
Three at once
Scores without pass/fail checks: the head compares mean score and latency, and Medium matches Large at a third of the wait.
Invoice extraction by model size
- Smallfastest
- Passed
- —
- Mean score
- 0.64
- Mean latency
- 297 ms
- Judged better
- 0
- Medium
- Passed
- —
- Mean score
- 0.97
- Mean latency
- 683 ms
- Judged better
- 0
- Largeslowest
- Passed
- —
- Mean score
- 0.98
- Mean latency
- 1.8 s
- Judged better
- 0
- inv-0193
Extract vendor, total and due date: "Birchwood Paper · Invoice 0193 · Total due €1,284.00 by 14 April"
SmallScore 0.71310 ms{ vendor: "Birchwood Paper", total: 1284, due: "04-14" }
MediumScore 0.97690 ms{ vendor: "Birchwood Paper", total: 1284.00, currency: "EUR", due: "2026-04-14" }
LargeScore 0.971.8 s{ vendor: "Birchwood Paper", total: 1284.00, currency: "EUR", due: "2026-04-14" }
- inv-0207
Extract vendor, total and due date: "Paid in full, thank you. Harbor Print Co. $312.50"
SmallScore 0.90280 ms{ vendor: "Harbor Print Co.", total: 312.5, due: null }
MediumScore 1.00640 ms{ vendor: "Harbor Print Co.", total: 312.50, currency: "USD", due: null, paid: true }
LargeScore 1.001.7 s{ vendor: "Harbor Print Co.", total: 312.50, currency: "USD", due: null, paid: true }
- inv-0211
Extract vendor, total and due date: "Due on receipt — Atelier Lumen — 3 x 420 = 1 260 CHF"
SmallScore 0.32300 ms{ vendor: "Atelier Lumen", total: 420 }
MediumScore 0.94720 ms{ vendor: "Atelier Lumen", total: 1260, currency: "CHF", due: "on receipt" }
LargeScore 0.962 s{ vendor: "Atelier Lumen", total: 1260.00, currency: "CHF", due: "on receipt" }
0 of 3 cases judged
import type { Html } from "effect/ui/html"import * as stylex from "@stylexjs/stylex"import { EvalCompare, type EvalCase } from "./ui/uicontext/components/EvalCompare.ts"import { sx } from "./ui/uicontext/components/Sx.ts"const styles = stylex.create({ wrap: { inlineSize: "100%" } })// three model sizes pulling fields out of invoices, scored by a grader with no pass/fail checksconst cases: ReadonlyArray<EvalCase> = [ { id: "inv-0193", input: "Extract vendor, total and due date: \"Birchwood Paper · Invoice 0193 · Total due €1,284.00 by 14 April\"", outputs: { small: { text: "{ vendor: \"Birchwood Paper\", total: 1284, due: \"04-14\" }", score: 0.71, latencyMs: 310 }, medium: { text: "{ vendor: \"Birchwood Paper\", total: 1284.00, currency: \"EUR\", due: \"2026-04-14\" }", score: 0.97, latencyMs: 690 }, large: { text: "{ vendor: \"Birchwood Paper\", total: 1284.00, currency: \"EUR\", due: \"2026-04-14\" }", score: 0.97, latencyMs: 1840 }, }, }, { id: "inv-0207", input: "Extract vendor, total and due date: \"Paid in full, thank you. Harbor Print Co. $312.50\"", outputs: { small: { text: "{ vendor: \"Harbor Print Co.\", total: 312.5, due: null }", score: 0.9, latencyMs: 280 }, medium: { text: "{ vendor: \"Harbor Print Co.\", total: 312.50, currency: \"USD\", due: null, paid: true }", score: 1, latencyMs: 640 }, large: { text: "{ vendor: \"Harbor Print Co.\", total: 312.50, currency: \"USD\", due: null, paid: true }", score: 1, latencyMs: 1710 }, }, }, { id: "inv-0211", input: "Extract vendor, total and due date: \"Due on receipt — Atelier Lumen — 3 x 420 = 1 260 CHF\"", outputs: { small: { text: "{ vendor: \"Atelier Lumen\", total: 420 }", score: 0.32, latencyMs: 300 }, medium: { text: "{ vendor: \"Atelier Lumen\", total: 1260, currency: \"CHF\", due: \"on receipt\" }", score: 0.94, latencyMs: 720 }, large: { text: "{ vendor: \"Atelier Lumen\", total: 1260.00, currency: \"CHF\", due: \"on receipt\" }", score: 0.96, latencyMs: 1950 }, }, },]export const ModelSizes = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.wrap)).children( EvalCompare(h, { key: "models", props: { id: "models", label: "Invoice extraction by model size", variants: [ { id: "small", name: "Small", detail: "fastest" }, { id: "medium", name: "Medium" }, { id: "large", name: "Large", detail: "slowest" }, ], cases, }, }), )API reference
Props
| Name | Type | Default | Description |
|---|---|---|---|
labelrequired | string | — | What's being compared: "Support replies: prompt v7 vs v8". |
variantsrequired | EvalVariant[] | — | Two or three, left to right. |
casesrequired | EvalCase[] | — | — |
value | Record<string, string> | — | Verdicts so far, by case id. |
filter | EvalFilter | "all" | The filter to start on; "all" by default. |
id | string | "eval" | Starts the ids inside it, unique on the page; "eval" by default. |
locale | string | — | For the numbers; the browser's by default. |
Events
| Event | Payload | Description |
|---|---|---|
RequestedChange | { value: Record<string, string> } | A case was judged: every verdict so far, by case id. |
Installation
pnpm dlx shadcn@latest add checkfu/uicontext/eval-compare