refactor: centralize model IDs into model_config.py#42
Draft
joshbouncesecurity wants to merge 1 commit intoknostic:masterfrom
Draft
refactor: centralize model IDs into model_config.py#42joshbouncesecurity wants to merge 1 commit intoknostic:masterfrom
joshbouncesecurity wants to merge 1 commit intoknostic:masterfrom
Conversation
Adds libs/openant-core/utilities/model_config.py exposing MODEL_PRIMARY,
MODEL_AUXILIARY, and MODEL_DEFAULT, and replaces hardcoded
claude-opus-* / claude-sonnet-* string literals across the codebase
with imports from that module. Future model bumps become one-line.
Defaults match the canonical strings already in upstream
(claude-opus-4-20250514 and claude-sonnet-4-20250514). The
claude-opus-4-6 alias call sites are unified to MODEL_PRIMARY; both
forms route to the same Claude Opus 4 model on the Anthropic API
(the upstream MODEL_PRICING table already mapped both keys to the
same prices), so behavior is unchanged.
Adds tests:
- tests/test_model_config.py asserts the constants exist, are
non-empty strings, and match the expected claude-(opus|sonnet|haiku)-...
model-id format.
- A regression test scans every libs/openant-core/**/*.py file and
fails if any hardcoded claude-opus-*/claude-sonnet-* literal
reappears outside model_config.py itself.
Addresses item 15 from #16 (does not close).
6 tasks
Contributor
Author
Manual verificationPure refactor — no behavior change.
|
Contributor
Author
Local test resultsVerified the refactor on Windows. Commands run: Outcome:
|
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
Adds a single
model_config.pyexposingMODEL_PRIMARY,MODEL_AUXILIARY, andMODEL_DEFAULT, and replaces hardcoded model strings across the codebase with imports from that module. Future model bumps become one-line.Default values match the strings currently in upstream (
claude-opus-4-20250514andclaude-sonnet-4-20250514) — pure refactor, no behavior change. A handful of call sites that used theclaude-opus-4-6alias are unified toMODEL_PRIMARY; both forms route to the same Claude Opus 4 model on the Anthropic API (upstream'sMODEL_PRICINGtable already mapped both keys to identical prices).Addresses item 15 from #16 (does not close the issue).
Test plan
claude-opus-*/claude-sonnet-*literals remain in non-config code (covered by a regression test in this PR).MODEL_PRIMARY/MODEL_AUXILIARYexist and have valid model-id format.