Skip to content

feat: reject parameter combinations providers won't accept - #170

Open
brunobuddy wants to merge 2 commits into
mainfrom
feat/param-applicability-engine
Open

feat: reject parameter combinations providers won't accept#170
brunobuddy wants to merge 2 commits into
mainfrom
feat/param-applicability-engine

Conversation

@brunobuddy

Copy link
Copy Markdown
Member

First of four. The endpoint, MCP server and agent skill all build on this, so it goes first on its own.

💭 Why

Each parameter in the catalog can carry applicability rules describing when a provider accepts it. Nothing enforced them. parseParams said as much in a comment: cross-parameter rules were "not yet enforced".

So the data that separates this catalog from a model-metadata list was display-only.

✨ What changed

  • checkApplicability reports supplied parameters that conflict with the rest of the request, naming what caused each conflict.
  • isApplicable answers the same for a single parameter.
  • dropUnsupported strips what a model won't accept and returns a payload safe to spread into a provider call, plus what went and why.
  • resolveModelId maps a bare slug or full id onto a catalog id, reporting ambiguity instead of guessing.
  • parseParams enforces conflicts, after per-value type and range checks pass.
  • checkValue moves to its own module instead of being duplicated.

👤 For users

Catches what people currently hit as provider 400s: top_p with a non-default temperature on Anthropic, sampling knobs on reasoning models, a thinking budget without thinking enabled.

dropUnsupported is the catalog-driven equivalent of LiteLLM's drop_params, extended to conditional conflicts.

📝 Notes

  • Rules evaluate against the request the provider will actually see. A parameter the request omits falls back to its catalog default, because that is what the provider applies instead. top_p alone is fine on Claude 3 Opus (temperature defaults to 1); top_p with temperature: 0.5 is reported.
  • A default on a conditionally-gated parameter describes the value used once the gate opens, not one that is always live. thinking.budget_tokens defaults to 4096 and still only applies when thinking is enabled.
  • 33 new tests. Includes a whole-catalog invariant that dropUnsupported converges and never emits a request it would itself reject, which guards its fixed-point loop against non-termination.

The catalog records which parameter combinations providers reject, in each
parameter's `applicability` rules. Nothing enforced them. parseParams said
so in a comment: cross-parameter rules were "not yet enforced", so the
data that distinguishes this catalog from a metadata list was only ever
rendered on the site.

Adds the engine:

- checkApplicability reports supplied parameters that conflict with the
  rest of the request, with the parameters that caused each conflict.
- isApplicable answers the same question for one parameter.
- dropUnsupported strips everything a model won't accept and returns a
  payload safe to spread into a provider call, plus what it removed and
  why. Catalog-driven equivalent of LiteLLM's drop_params, extended to
  conditional conflicts.
- resolveModelId maps a bare model slug or full id onto a catalog id,
  reporting ambiguity rather than guessing.
- parseParams now enforces conflicts, after each value passes its own
  type and range check so a range error doesn't surface as a conflict.

When a rule references a parameter the request omitted, evaluation falls
back to that parameter's catalog default, since that is what the provider
applies instead. So top_p alone is fine on Claude 3 Opus, which defaults
temperature to 1, while top_p with temperature 0.5 is reported.

checkValue moves to its own module, shared with parseParams rather than
duplicated.
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
modelparams.dev Ready Ready Preview Jul 30, 2026 1:16pm

Request Review

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

Labels

meta Repo docs, CI, and config

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant