Skip to content
askdareDocumentation

    Prompt versions

    You rewrite a bot's instructions and want to know what the rewrite did: does it cost less, get fewer ๐Ÿ‘Ž, hand off less often? askdare lets one bot carry several named versions of its instructions, send a share of new conversations to each, and report which version answered every turn (ADR-0039). There is no second bot, no second embed snippet, and the site does nothing.

    Name the bot's instructions

    Every bot has a version: its own instructions, named default unless you name them.

    // askdare.config.ts
    export const support = defineBot({
      id: 'support',
      model: process.env.ASKDARE_MODEL!,
      instructions: supportV1,
      version: 'v1',
    });

    A name is 1โ€“32 lowercase letters, digits or dashes, starting with a letter. It is in every report and admin record, so naming the version is useful even without an experiment: bump it when you edit the instructions (v1, then v2), and the reports and the dashboard show when the new text took over.

    Change the text, change the name. askdare can't tell when the text behind a name changed (a function's output can't be fingerprinted), so two texts under one name read as one version in every report. Use each name once in a bot's life.

    Draft a version

    Add the new wording under versions, next to the bot's own:

    export const support = defineBot({
      id: 'support',
      model: process.env.ASKDARE_MODEL!,
      instructions: supportV1,
      version: 'v1',
      versions: {
        shorter: { instructions: supportShorter },
      },
    });

    A version's instructions is a string or a function of the context, as the bot's own. A version replaces the instructions only: the model, tools, knowledge, limits, forms, handoff and widget are the bot's, the same for every version. A bot has at most 10 versions, its own included, all with different names.

    Without an experiment the new version answers no visitor. Try it in the admin console's Playground: pick it next to the bot, and the conversation runs on it to the end (a new pick starts a new conversation). Playground turns are recorded with source: 'console' and the version, and the dashboard leaves them out. The Bots view shows every version's instructions and share.

    Before giving it visitors, run your eval cases against it, so a version that is cheaper or better rated doesn't also cite worse:

    npx @boldare/askdare eval --version v1 --version shorter

    runs every case against both, reports them side by side, and compares each version with its own baseline: shorter's cases are new until you record its baseline with --update-baseline --version shorter. Eval runs the version you name, never the experiment's split, and writes no admin records. See Testing answers. The console's Tests view has the playground's version picker too, for the cases passed to eval.cases.

    Run npx @boldare/askdare doctor after adding a version: it lists the bot's versions and split, and resolves every version's instructions for an anonymous visitor, so a function that throws for one version fails there and not on a visitor's first message.

    Split new conversations

    An experiment gives each version a share of new conversations:

    experiment: {
      name: 'shorter-answers',
      split: { v1: 90, shorter: 10 },
    },
    • Shares are whole numbers from 0 to 100 that add up to 100, keyed by the bot's version and the names in versions. A version with 0, or left out, gets no new conversations.
    • By visitor: a new conversation's version comes from a bucket of 0 to 99, a hash of the bot, the experiment's name and the visitor's pseudonym (the visitor that onUsage reports). The shares become ranges in the split's order: v1 0โ€“89, shorter 90โ€“99. So the same visitor lands in the same version in every new conversation, and a signed-in user does on every device. A visitor who clears the widget's storage gets a new visitor ID and may land elsewhere.
    • Once per conversation: a conversation keeps the version it started with, across turns, reloads and signing in.
    • Sealed: the version is in the conversation's encrypted handles. The visitor can't pick a version, not even for testing, and can't see which one they got. QA uses the playground.

    defineBot checks the names, the split's keys and the sum, so a bad split fails at startup.

    Changing the split

    The experiment is code, so a change takes a deploy. Conversations already started keep their version in every case:

    ChangeNew conversations
    Shares change, say from 90/10 to 50/50Follow the new shares. Since the ranges keep their order, only the visitors whose bucket crosses a moved boundary change version.
    name changesEveryone is bucketed again: it is a new experiment.
    experiment is removedThe bot's own version. This is the off switch.
    A version is removed from versionsNot given it. Its conversations continue on the bot's own instructions and are still reported under the removed name, since that is what they started with; the server warns once per name.

    Read the numbers

    Every report and admin record carries version:

    • onUsage, onTranscript, onHandoff and onLead report the conversation's version, and onFeedback the version that wrote the rated answer (Observability).
    • The admin store keeps the version on each turn, rating, transcript and handoff or lead count, and its daily rows are per version. AdminRange.version filters the daily rows, the conversations and the ratings, for one bot. A conversation's version is the one of its first turn, and the console's review shows it.
    • The dashboard has a Version filter next to the bot filter, on every view, once you pick a bot: the totals, the days, the conversations and the ๐Ÿ‘Ž answers are then that version's only.
    • Its Versions view compares one bot's versions over the chosen days, one row per version, from the daily totals. Playground turns are left out.
    ColumnWhat it isIts n
    First dayThe first day in the range the version answered a turn. A version that answered none, say one that got a ๐Ÿ‘Ž on an older answer, shows โ€“ and comes last
    ConversationsNew conversations started on the version
    Turns, FailedTurns it answered, and those that failed
    Cost, Per conversationPriced by the dashboard's prices; "no price" when a model it answered with has none
    ๐Ÿ‘, ๐Ÿ‘Ž, ๐Ÿ‘Ž shareRatings of its answers, and ๐Ÿ‘Ž over rated answersRated answers
    UnansweredTurns counted as unanswered (a heuristic: no sources from a bot with knowledge, withheld or failed) over turnsTurns
    Handoff rateHandoffs in any final state but limited, over new conversations. Handoffs aren't tied to a conversation, so it is a ratio of daily counts, capped at 100 %New conversations
    Leads / 100Leads per 100 new conversationsNew conversations

    Reading a comparison

    askdare shows numbers, not verdicts: no p-values, confidence intervals or "winner" badges, and it never promotes a version for you. Ratings are sparse and come from visitors who chose to rate, the unanswered count is a heuristic, and the handoff rate is a ratio of daily counts, so read them with care:

    • Read every rate next to its n, the number of rated answers, turns or conversations behind it. The table prints it as n=.
    • Compare over a range that starts after the split last changed. The First day column shows when each version started answering: pick a range from there on. Days before it mix in another split.
    • Wait for a few hundred conversations per version before reading anything into a difference. A version with 10 % of traffic gets there last.
    • Check the difference. A difference between two rates pโ‚ and pโ‚‚, over nโ‚ and nโ‚‚, is worth acting on when it is larger than 2ยทโˆš(pโ‚(1โˆ’pโ‚)/nโ‚ + pโ‚‚(1โˆ’pโ‚‚)/nโ‚‚). It is a rough two-proportion check, about 95 % sure, and enough to tell a real difference from noise in this table. Teams that need more export the numbers.
    • Before promoting a version, run your eval cases on both, so a version that is cheaper or better rated doesn't also cite worse.

    For example, v1 has 600 rated answers with 12 % ๐Ÿ‘Ž, and shorter 150 with 20 % ๐Ÿ‘Ž: the table shows 12% n=600 and 20% n=150.

    1. The bound is 2ยทโˆš(0.12ยท0.88/600 + 0.20ยท0.80/150) = 2ยทโˆš(0.000176 + 0.001067) = 2ยทโˆš0.001243 โ‰ˆ 2ยท0.0353 โ‰ˆ 0.071, or 7.1 points.
    2. The difference is 20 โˆ’ 12 = 8 points, larger than 7.1: shorter does get more ๐Ÿ‘Ž.
    3. With 100 rated answers for shorter, the bound would be 2ยทโˆš(0.000176 + 0.0016) โ‰ˆ 0.084, or 8.4 points, and the same 8 points could be chance: wait for more.

    The same check works for the unanswered share (over turns) and the handoff rate (over new conversations).

    Promote a version

    When a version wins, make it the bot's own: move its text to instructions and its name to version, and remove the experiment and the old version.

    export const support = defineBot({
      id: 'support',
      model: process.env.ASKDARE_MODEL!,
      instructions: supportShorter,
      version: 'shorter',
    });

    Conversations started on v1 continue on the bot's own instructions, now shorter's, and are still reported as v1 (the table above). To leave them on v1's text until they end, keep v1 in versions with a share of 0, or out of the split, for a while.

    Limits of 0.8

    • A version is instructions only. A version with its own model may come in 0.9.
    • The page can't force a version: use the playground, or eval.
    • @boldare/askdare-otel doesn't add the version to its spans.