AI Gateway decision fallbacks can help prioritize translation review when source UI copy changes. Ask Jev whether the old and new text differ in meaning, then have GPT-6 Luna reassess the same text when Jev's probability falls within your uncertainty range. Use the result as review metadata alongside the source diff, while retaining your normal translation workflow.
Copy link to headingWhat counts as a change in meaning?
Compare two versions of the source text in the same language. The question is whether an edit changes what the interface tells users, such as who can perform an action or when a condition applies. Evaluating an existing translation requires a separate review of the translated text.
Consider these English strings in the help text for member invitations:
Removing "Only" drops an explicit restriction. The new sentence says owners can invite members but leaves other roles unspecified. That difference deserves attention from a translator even though most words stayed the same.
Pass the string key and UI context with both versions to identify the affected message and explain where it appears. Record the source revisions used for the comparison so a result for an earlier edit isn't applied to a later one.
Copy link to headingCheck for changes in meaning with a conditional fallback
Use Node.js 22.18 or later and install the packages with npm install ai @ai-sdk/gateway. The experimental AI SDK decision API exposes experimental_decide in ai 7.0.128 or later; the decision quickstart covers setup.
Authenticate with AI_GATEWAY_API_KEY in your server environment, or use Vercel OIDC. For local OIDC, run vercel link, then vercel env pull .env.local in your project. Run node --env-file=.env.local translation-review.mjs to load the downloaded token, refreshing it if it expires. If you exported a Gateway API key instead, run node translation-review.mjs.
import { experimental_decide as decide } from 'ai';import { gateway } from '@ai-sdk/gateway';
const state = { copyKey: 'workspace.members.inviteHelp', sourceLanguage: 'en', uiContext: 'Help text beside the button for inviting workspace members.', oldSource: 'Only workspace owners can invite members.', newSource: 'Workspace owners can invite members.',};
try { const result = await decide({ model: gateway.decisionModel('typesafe-ai/jev'), state, questions: { meaningChanged: { type: 'boolean', instructions: 'Does the new source copy change the meaning conveyed to users ' + 'in this UI context? Compare the two English versions. ' + 'Treat changes to restrictions, conditions, timing, or negation ' + 'as changes in meaning. Do not infer permissions the text leaves unstated.', criteria: { true: 'The edit changes or removes information conveyed to the user.', false: 'The edit preserves the meaning and changes only its wording.', }, }, }, providerOptions: { gateway: { models: [ { model: 'openai/gpt-6-luna', when: { question: 'meaningChanged', probabilityBetween: [0.4, 0.6], }, }, ], }, }, });
const answer = result.answers.meaningChanged; console.dir( { copyKey: state.copyKey, answer, finalModel: result.response.modelId, routing: result.providerMetadata?.gateway?.routing, }, { depth: null }, );} catch (error) { console.error('Source-copy comparison failed. Keep this item for review.', error); process.exitCode = 1;}The script prints the prediction and routing information without changing translation files. Its 0.4–0.6 band is illustrative. Choose the band from reviewed examples of your own UI edits before using the result to prioritize work.
Copy link to headingHow does Gateway handle an uncertain comparison?
Boolean answers estimate P(true), which here is the probability that the edit changed the text's meaning. Values near zero favor unchanged meaning; uncertainty is near the middle. The inclusive probabilityBetween: [0.4, 0.6] condition triggers Luna when Jev's probability falls within that range. Use this Boolean condition rather than confidenceBelow, which applies to Choice and Score answers.
The conditional object must be first in models, and only one is allowed. When it matches, Gateway reruns the original state and every question with Luna. The fallback result replaces Jev's result, and Gateway does not check the condition again. There are at most two successful stages; a final probability inside the band remains a result for your application to review.
Through this Gateway configuration, Luna answers using structured output. This path is distinct from OpenAI's native Decisions API. The Boolean answer still supplies a probability, but neither the shared range nor the shared question establishes equivalent calibration between the models.
Inspect result.response.modelId to see which model produced the answer. Routing metadata includes modelAttempts; a condition-triggered attempt carries triggeredBy with the reason probability_between. Refusal can also match a condition covering that question, with reason refused. Treat an unusable final output as a failed check and keep the item for review.
Primary execution errors can also send the request to Luna. If the fallback fails, the request fails instead of returning Jev's earlier answer. Both stages are billed when a conditional fallback runs. The broader confidence-based decision fallback guide explains how to distinguish uncertainty escalation from execution-error handling.
Copy link to headingWhat should remain in the translation workflow?
Use the prediction to help a reviewer find edits that change the instructions or conditions communicated to users. Show the old and new copy with the string key and UI context. Keep the probability and final model beside that evidence so reviewers can assess the prediction rather than treating a flag as a verdict.
Keep placeholder, plural, and ICU message validation in deterministic tooling suited to your message format. Checking for changes in meaning does not establish that a variable name exists, every required plural case is present, or an ICU message parses. Run those checks even when the model predicts unchanged meaning.
Unchanged source meaning also does not establish that an existing translation is valid. Terminology, context, and prior translation errors can still require work. This example neither generates translations nor approves their reuse or publication.
Before using the flag to order a review queue, compare predictions with edits reviewed by translators. Include removed restrictions, changed time periods, and wording-only edits. Look for changes in meaning that went unflagged, as well as unnecessary flags. Confident mistakes can fall outside the fallback band, so retain review of unflagged samples when assessing the policy.
Copy link to headingFrequently asked questions
Copy link to headingCan I reuse a translation when the model says the meaning is unchanged?
No. The check compares two source-language versions and does not assess the existing translation. Keep your normal translation review and validation requirements before reusing or publishing translated copy.
Copy link to headingDoes the model validate placeholders and ICU messages?
No. Keep placeholder names, plural cases, and ICU syntax checks in deterministic tooling for your message format. The model's assessment of the text's meaning should not override a failed validation check.
Copy link to headingDoes a low probability mean the model is uncertain?
For this question, a low probability means the model estimates that the source meaning did not change. Uncertainty lies closer to the middle of the probability range, which is why the example uses an inclusive middle band to trigger fallback.
Copy link to headingDoes the fallback rewrite translations?
No. The example asks for a Boolean judgment about the old and new source copy, then prints the result. It contains no translation-generation, file-update, or publishing step.