-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(algo): let any model run — litellm-backed context window + base-name capability tables #2508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shmulc8
wants to merge
4
commits into
The-PR-Agent:main
Choose a base branch
from
shmulc8:refactor/model-capabilities-base-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
de0a4e1
refactor(algo): key model capability tables by base model name
shmulik-apiiro 684d529
feat(algo): never fail on unknown models; resolve context window via …
shmulik-apiiro d73a9d1
fix(algo): correct stale context windows; drop retired/Claude-3 models
shmulik-apiiro 3943da6
refactor: collapse MAX_TOKENS Claude/Gemini rows to base-name keys
shmulik-apiiro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| from pr_agent.algo import ( | ||
| CLAUDE_EXTENDED_THINKING_MODELS, | ||
| NO_SUPPORT_TEMPERATURE_MODELS, | ||
| STREAMING_REQUIRED_MODELS, | ||
| base_model_name, | ||
| ) | ||
|
|
||
|
|
||
| class TestBaseModelName: | ||
| def test_provider_prefix_stripped(self): | ||
| """anthropic/, bedrock/ (with region+vendor+version), and vertex_ai/ collapse to one base""" | ||
| for variant in [ | ||
| "claude-opus-4-8", | ||
| "anthropic/claude-opus-4-8", | ||
| "vertex_ai/claude-opus-4-8", | ||
| "bedrock/anthropic.claude-opus-4-8", | ||
| "bedrock/us.anthropic.claude-opus-4-8", | ||
| "bedrock/global.anthropic.claude-opus-4-8", | ||
| ]: | ||
| assert base_model_name(variant) == "claude-opus-4-8" | ||
|
|
||
| def test_date_and_cloud_version_suffixes(self): | ||
| """vertex '@date' and bedrock '-v1:0' normalize to the anthropic spelling""" | ||
| expected = "claude-sonnet-4-5-20250929" | ||
| for variant in [ | ||
| "claude-sonnet-4-5-20250929", | ||
| "anthropic/claude-sonnet-4-5-20250929", | ||
| "vertex_ai/claude-sonnet-4-5@20250929", | ||
| "bedrock/anthropic.claude-sonnet-4-5-20250929-v1:0", | ||
| "bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0", | ||
| ]: | ||
| assert base_model_name(variant) == expected | ||
|
|
||
| def test_dotted_version_preserved(self): | ||
| """A model version containing a dot must not be truncated""" | ||
| assert base_model_name("gpt-5.2-codex") == "gpt-5.2-codex" | ||
| assert base_model_name("openai/qwq-plus") == "qwq-plus" | ||
|
|
||
| def test_capability_set_membership(self): | ||
| """Provider-prefixed models resolve into the base-name capability sets""" | ||
| assert base_model_name("bedrock/eu.anthropic.claude-opus-4-8") in NO_SUPPORT_TEMPERATURE_MODELS | ||
| assert base_model_name("vertex_ai/claude-opus-4-6") in CLAUDE_EXTENDED_THINKING_MODELS | ||
| assert base_model_name("openai/qwq-plus") in STREAMING_REQUIRED_MODELS | ||
| # a model with no special capability resolves out of every set | ||
| assert base_model_name("gpt-4o") not in NO_SUPPORT_TEMPERATURE_MODELS |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. base_model_name import unsorted
📘 Rule violation⚙ MaintainabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools