Repository navigation
Conversation
`model` can now be a tier name (small, medium, large, reasoning) instead of
an OpenRouter ID, so tasks keep working when a model is retired: the
tier-to-model mapping lives in one dict in evaluation_function/models.py.
Each tier has a primary model and a built-in fallback from another
provider; the reasoning tier also sends `reasoning: {"effort": "low"}`.
Omitting `model` now uses the medium tier instead of openai/gpt-4o-mini.
Fallbacks were previously passed to OpenRouter's `models` field, which only
acts on errors OpenRouter sees, never on our 8s client timeout, so a slow
primary was retried rather than replaced. The retry loop now moves to the
next model on each retry (tier fallback, then any `fallback_models`), and a
404 also moves on, so a retired model falls back. Each step gets at least
two attempts and can try every model while the deadline allows; Retry-After
is skipped when switching model. `models` is no longer sent to OpenRouter.
An opt-in test (CHECK_MODEL_TIERS_ZDR=1) checks every tier model against
OpenRouter's live ZDR endpoint list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Staging showed two gaps in the model fallback: - OpenRouter rejects an unknown or retired model ID with a 400 "is not a valid model ID", not a 404, so the fallback never triggered. A 400 or 404 (other than a content filter block) now moves on to the next model. - Every Claude model's output failed to parse as JSON, and a parse failure returned the "please try again" feedback without trying the fallback. JSON wrapped in a code fence or surrounded by text is now accepted, output that still can't be parsed moves on to the next model, and a non-object JSON value counts as a parse failure instead of raising. Logs record only whether the output was fenced, never its content. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Thanks for the suggested changes. I've found significant differences between Gemini and GPT, when prompting feedback. Do you think it would be reasonable - i.e. not too complicated - to have a tier per major model supplier? E.g. an extensible list starting with Google, OpenAI, Anthropic, DeepSeek? Separately, where is the ideal place to manage model tiers? Eval Function or tenant? |
A task can set `provider` (openai, google, anthropic, deepseek) next to a tier name to use that provider's version of the tier. Provider tiers fall back only to models from the same provider, so feedback style stays consistent. An unknown provider is a configuration error; provider is ignored for explicit model IDs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Thanks for the comment. I've switched to having a provider parameter and different models per provider instead of different ones on each. I think default parameters could be part of the tenant; as we upgrade the params in the future, this could be added then. |
This branch has not been deployed
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.
Summary
configuration.params.modelcan now be a tier name instead of a specific OpenRouter ID, so tasks keep working when a model is retired. The tier-to-model mapping lives in one dict inevaluation_function/models.py. Replacing a retired model means editing that dict and redeploying.smallopenai/gpt-6-lunaanthropic/claude-haiku-5.5medium(new default)google/gemini-3.8-flashopenai/gpt-6.1-terralargeanthropic/claude-sonnet-5.5openai/gpt-6.2-solreasoningopenai/gpt-6.2-sol(sendsreasoning: {"effort": "low"})anthropic/claude-sonnet-5.5Explicit model IDs behave as before. If
modelis omitted, themediumtier is used instead ofopenai/gpt-4o-mini.Fallback models are now actually tried
Fallbacks used to go in OpenRouter's
modelsfield. OpenRouter only falls back on errors it sees itself, never on our own 8s per-attempt timeout, so a slow primary model was retried but never replaced. The retry loop in_request_jsonnow handles fallbacks itself, andmodelsis no longer sent to OpenRouter:fallback_models. When the list runs out, the last model is reused.is not a valid model ID, not a 404, as staging showed. A content-filter 400 still counts as failing moderation and doesn't fall back.Claude JSON parsing fix
Every Claude model was failing on staging with
failed to parse ... result as JSON, includingclaude-haiku-4.5from the README examples. The usual cause is Claude wrapping its JSON in a Markdown code fence even whenresponse_formatasks for plain JSON. JSON wrapped in a code fence or surrounded by text is now accepted. A JSON value that isn't an object, such as a baretrue, counts as a parse failure instead of raising an error. Logs record only whether the output was fenced, never its content.I didn't switch to structured outputs because Bedrock's ZDR endpoints for the Claude 5.x models don't support them.
Behaviour changes to note
"Medium"is treated as an OpenRouter ID and fails as an invalid model.fallback_modelstakes OpenRouter IDs only. Tier names in it are not expanded.Test plan
poetry run pytest: 77 passed, 1 skipped (the opt-in live check)CHECK_MODEL_TIERS_ZDR=1 poetry run pytest evaluation_function/models_test.py -k zdr: all 8 tier models have a ZDR endpoint that supportsresponse_formatLLM_Caller-staging, deployed from this branch at7e93103): 13/13 cases passsmall,medium,large,reasoningmediumandlargewith a wrong answerclaude-sonnet-5.5andclaude-haiku-5.5alone (no fallback)fallback_modelsopenai/gpt-4o-mini"Medium"The staging logs also show the timeout fallback working on a real request. Correctness timed out on
gemini-3.8-flashafter 8s, and the retry ongpt-6.1-terraanswered in 1.95s.reasoningtook 3.8s, well under the 8s per-attempt cap.🤖 Generated with Claude Code