feat: catch invalid model params before the provider does - #169
Closed
brunobuddy wants to merge 1 commit into
Closed
feat: catch invalid model params before the provider does#169brunobuddy wants to merge 1 commit into
brunobuddy wants to merge 1 commit into
Conversation
The catalog has always recorded which parameter combinations providers reject, but nothing acted on it. parseParams even said so in a comment. Adds three ways to consume it: - POST /api/v1/validate returns the problems plus a corrected payload. Stateless Vercel Function with the catalog compiled in, no backend. - modelparams-mcp, an MCP server with four read-only tools over the catalog, so an agent can look parameters up instead of guessing. - An llm-model-parameters agent skill in skills.sh format. Underneath, the modelparams package gains the engine all three share: checkApplicability, isApplicable, dropUnsupported and resolveModelId. parseParams now enforces cross-parameter rules. 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. Both packages ship in lockstep and modelparams-mcp pins modelparams exactly, so a given server version carries one known catalog. That also avoids a caret trap: for 0.0.x, ^0.0.1 resolves to >=0.0.1 <0.0.2, which would have frozen the server on the first catalog forever.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
Author
|
Superseded by a stack of four, one per feature, so each can be reviewed on its own:
Same work, plus two fixes the split surfaced: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💭 Why
The catalog has always recorded which parameter combinations providers reject. Nothing acted on it.
parseParamseven said so in a comment: cross-parameter rules were "not yet enforced".So the data that makes this catalog different from a model-metadata list was display-only.
✨ What changed
POST /api/v1/validatereturns the problems plus a correctedsafeParamspayload.modelparams-mcppackage: 4 read-only MCP tools, stdio, catalog bundled in.llm-model-parametersagent skill (skills.sh format).modelparamsgainscheckApplicability,isApplicable,dropUnsupported,resolveModelId.parseParamsnow enforces cross-parameter rules.modelparams-mcppinsmodelparamsexactly.👤 For users
Three issue codes come back:
unknown_parameter,invalid_value,not_applicable(withconflictsWith).safeParamsis always a payload that passes validation, so a caller can spread it and move on.Catches the cases people currently hit as provider 400s:
top_pwith a non-defaulttemperatureon Anthropic, sampling knobs on reasoning models, a thinking budget without thinking enabled.🔧 For operators
modelparams-mcpneeds its own npm trusted publisher before the first release, pointing atrelease-modelparams.yml(orgmnfst, repomodelparams.dev). Without it that publish step fails. Renaming the workflow file breaks trusted publishing for both packages.Submitting the server to the MCP registry is still manual.
📝 Notes
vercel build: the function builds and runs, and static/api/v1/*.jsonis unaffected. Header rules layer, so theno-storerule for/api/v1/validatehas to stay after the general/api/(.*)s-maxagerule or verdicts get cached across callers.