Repository navigation
fix(ai): send choice values as descriptions for hosts that require them - #68743
rekram1-node wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Looks sound. The new System One test fails on the base (technical: null) and passes here (technical: "technical"). Decision and model-resolver tests pass, and ai and core type-check cleanly. I couldn't check the live hosts because there are no provider credentials. The flag gets the same treatment as mediaInput. On the chat path the extra key is harmless, and Google Decisions gets the behaviour through the shared encodeQuestions.
Public API: adds an optional requireChoiceDescriptions: boolean to Model.Compatibility and Provider.Compatibility (config compatibility, OpenAPI, client, plugin and cli-rs types). It also reads an optional models.dev compatibility.require_choice_descriptions. Both are additive and backwards compatible: when the flag is unset, requests don't change.
No blocking concerns.
Parallel's decision model (on OpenRouter and Vercel) and ScaleDown's (on OpenRouter) reject choice questions whose options have no description. This adds a compatibility flag that sends the option's value as its description, only for models that set it.
choices: [{ value: "ui" }, { value: "payments" }, { value: "docs" }] # System One (OpenRouter) -criteria: { ui: null, payments: null, docs: null } → 400 +criteria: { ui: "ui", payments: "payments", docs: "docs" } # OpenAI Decisions (Vercel): description is already omitted, Parallel still 422s -choices: [{ value: "ui" }, …] +choices: [{ value: "ui", description: "ui" }, …]Omitting the field doesn't help: the OpenAI Decisions adapter already leaves it out and Vercel's Parallel still returns 422, and on System One the options are the criteria map's keys, so they can't be left out. So it's an opt-in flag,
requireChoiceDescriptions, read the same way asmediaInput: models.dev[api.*] compatibility.require_choice_descriptions = true(orcompatibilityin opencode config) →models-dev.ts→model-resolver.ts→DecisionModelCompatibility→ the System One / OpenAI Decisions adapters. Descriptions stay optional in our API. It's scoped rather than global because it changes answers on some models (gemini-decision-1 moved from ui 0.50 to payments 0.65 with value-as-description).The flag does nothing until models.dev sets it on openrouter
parallel/decisions-fast, openrouterscaledown/classify-1and vercelparallel/parallel-decisions-fast. That needs a follow-up in models.dev (its schema only allows known compatibility keys).Live, same input and choices without descriptions, flag off → on:
question 1 has missing or null instructions or criteriaexpected string, received nullatarea.criteria.uiRequest validation error.Checks:
bun typecheckin ai, core, schema;bun test test/decision.test.ts test/provider*in ai;model-resolver.test.tsin core. I regenerated the client, openapi and cli-rs types.Added by the opencode bot (AI-generated).
Public API: adds optional
requireChoiceDescriptionsto model/providercompatibilityconfig and the OpenAPI/client types (backwards compatible)