feat: implement capability aware translation - #2369
Open
hustxiayang wants to merge 4 commits into
Open
hustxiayang wants to merge 4 commits into
hustxiayang wants to merge 4 commits into
Conversation
hustxiayang
marked this pull request as draft
July 14, 2026 16:56
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2369 +/- ##
==========================================
+ Coverage 84.82% 84.85% +0.03%
==========================================
Files 148 148
Lines 21838 21874 +36
==========================================
+ Hits 18524 18562 +38
+ Misses 2194 2193 -1
+ Partials 1120 1119 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
hustxiayang
force-pushed
the
model-hints
branch
from
August 3, 2026 20:38
26f55a7 to
24390b5
Compare
hustxiayang
marked this pull request as ready for review
August 5, 2026 20:15
hustxiayang
force-pushed
the
model-hints
branch
from
September 10, 2026 17:29
24390b5 to
fecbf81
Compare
✅ Deploy Preview for theagentrouter ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: yxia216 <yxia216@bloomberg.net>
hustxiayang
force-pushed
the
model-hints
branch
from
September 22, 2026 13:38
fecbf81 to
9cb6818
Compare
Signed-off-by: yxia216 <yxia216@bloomberg.net>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: yxia216 <yxia216@bloomberg.net>
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.
Description
Fixes #2368
Motivation
Several translators make model-specific decisions by string-matching the model name — Anthropic
max_tokensdefaulting to0, Gemini JSON-schema gating on"2.5"/"3"substrings, and hardcodedeffortModels/outputConfigModelslists. These are silently wrong for new models (e.g. the substring gate breaks for a futuregemini-4, and each Claude release needs a new list entry) and costly to maintain.Change
Adds an optional
modelTranslationHintsfield toAIServiceBackendSpecso operators can declare per-model capabilities that translators use instead of heuristics. It is a list keyed bymodelNameOverride, with these hint fields per entry:maxOutputTokens— defaultmax_tokensfor Anthropic when the client omits itsupportsResponseJsonSchema— Gemini JSON-schema gatesupportsReasoningEffort— Gemini thinking / Anthropicoutput_config.effortsupportsOutputConfig— Anthropic structured outputWhy
AIServiceBackendSpecBased on the comments in Fixes #2368, translation hints are a property of a model on a specific backend, not of a routing decision. Placing them on
AIServiceBackendSpecavoids duplication: anAIServiceBackendis a single object referenced by many routes/rules, so hints are declared once and every reference picks them up via the existing backend lookup — instead of repeating the same values on everybackendRef.Keying by the exact
modelNameOverride(not a fuzzy match) keeps this provider-scoped and precise: because anAIServiceBackendhas exactly oneschema, the same logical model hosted on two providers (e.g. Claude on AWS Bedrock vs. GCP Vertex AI) is configured as separate entries on separate backends — which is correct, since providers can genuinely support different features for what is nominally the same model (e.g.output_configon Bedrock but not on Vertex).Backward compatibility
This change is fully backward compatible and introduces no behavior change for existing users. The hardcoded lists and substring heuristics are retained as fallbacks; hints only take precedence when explicitly set:
maxOutputTokens) never disables an unrelated feature that still relies on the heuristic.This lets both mechanisms coexist during a transition window: operators migrate to explicit config at their own pace. A follow-up PR will remove the hardcoded lists/heuristics once config is the source of truth; the lists are marked deprecated in code to make that removal a mechanical change.