Move model capability tables into ai-config, add inferModelCapabilities#13
Conversation
wch
left a comment
There was a problem hiding this comment.
Looks good overall! Some automated review feedback:
Findings
- must-fix —
packages/ai-config/src/model-capabilities/infer.ts:152: Posit AI Gemma inference spreadsrequiresChatTemplateKwargsinto the returned object, but the strictcustomModelSchemadoes not accept that key (schema.ts:65) andcustomModelToModelInfocannot carry it (resolve-models.ts:192). Since this API was added to synthesizemodels.customentries during migration, the natural{ id, name, ...inferModelCapabilities(...) }result is rejected for Gemma 4; add the field to the model schemas and resolver pipeline (with a schema-to-resolver regression test), or deliberately strip it if persisted custom Gemma thinking is unsupported. - must-fix —
packages/ai-config/README.md:160: The README saysai-provider-bridgere-exportsinferModelCapabilities, but its root export list only re-exports the five pre-existing helpers plusopenaiMaxInputTokens(ai-provider-bridge/src/index.ts:75). Either add the advertised export or correct the claim so consumers are not directed to an import that does not exist.
Suggestions
packages/ai-provider-bridge/src/model-capabilities/gemini-interactions.ts:25: Splitting the capability table intoai-configleaves each eligible model's thinking levels duplicated across packages and explicitly requires maintainers to update both. Keep only the fail-closed eligible-ID set here and derive each profile'sthinkingLevelsfromgetGeminiModelCapabilities; then eligibility remains bridge routing policy while the allowed levels have one source of truth.
|
Thanks @wch — went through all three. Fixes pushed in 8c19152. Item 1 (Gemma Item 2 (README re-export claim) — fixed. You're right, the bridge root doesn't re-export Item 3 (derive Interactions
Deriving one from the other would mean filtering out |
Summary
Moves the LLM model-capability tables (Anthropic, DeepSeek, Gemini, Gemma, OpenAI, Posit AI) from
ai-provider-bridgeintoai-config, and addsinferModelCapabilities(providerId, modelId)as the single entry point for merging the generic baseline with provider-family inference. This lets anyai-configconsumer (in particular, Positron's authentication extension) synthesize model capabilities without taking the bridge's dependency tree.The Gemini Interactions API allowlist (
getGeminiInteractionsProfile,isInteractionsEligible) stays in the bridge since it's SDK-routing logic rather than a dependency-free capability table. The bridge re-exports every capability helper it used to own directly fromai-config, so its public export surface is unchanged.Also adds
tsxas an explicitai-configdevDependency -- itsprebuildscript already invokedtsxbut relied on hoisting from the workspace root rather than declaring its own dependency.Closes #9.
Test plan
npm run check-types/npm test/npm run lint/npm run format:checkall pass for every packagetypechecks/) passesgit diff main -- packages/ai-config/src/model-capabilitiesconfirms the moved tables are byte-identical apart from import linespackages/ai-provider-bridge/dist/index.d.tsstill declares every previously-exported capability namegrep -rn "model-capabilities" packages/ai-provider-bridge/srcshows onlygemini-interactionsreferences