Skip to content

fix(ai): send choice values as descriptions for hosts that require them - #68743

Open
rekram1-node wants to merge 1 commit into
devfrom
choice-description
Open

rekram1-node wants to merge 1 commit into
devfrom
choice-description

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Dec 6, 2026 •

Copy link
Copy Markdown
Member

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 as mediaInput: models.dev [api.*] compatibility.require_choice_descriptions = true (or compatibility in 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, openrouter scaledown/classify-1 and vercel parallel/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:

model off on
openrouter/parallel/decisions-fast 400 question 1 has missing or null instructions or criteria payments 0.49
openrouter/scaledown/classify-1 400 expected string, received null at area.criteria.ui ui 0.75
vercel/parallel/parallel-decisions-fast 422 Request validation error. payments 0.69

Checks: bun typecheck in ai, core, schema; bun test test/decision.test.ts test/provider* in ai; model-resolver.test.ts in core. I regenerated the client, openapi and cli-rs types.


Added by the opencode bot (AI-generated).

Public API: adds optional requireChoiceDescriptions to model/provider compatibility config and the OpenAPI/client types (backwards compatible)

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant