refactor(model_prices): move fallback_generalizations under sample_spec, above all models - #36416
Conversation
…he registry Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Greptile SummaryThe PR moves the unchanged
Confidence Score: 5/5The PR appears safe to merge because it only reorders an unchanged JSON object and current consumers handle the metadata by key rather than position. The canonical loader removes
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Moves the unchanged fallback-generalization metadata from the final key to the first key without changing registry semantics. |
| litellm/model_prices_and_context_window_backup.json | Applies the same content-preserving key reorder to the bundled backup registry. |
Reviews (1): Last reviewed commit: "refactor(model_prices): move fallback_ge..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ons right below it Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…izations_top Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
TLDR
Problem this solves:
fallback_generalizationsHow it solves it:
sample_specin both registry filesUser Flow
No end user flow changes. The block moves within the JSON, and key order carries no meaning for lookups, so both files parse to exactly the same content as before
Before: a maintainer adding a model appends it to the end of
model_prices_and_context_window.json, which puts it after thefallback_generalizationsblock sitting in the middle of the fileAfter: the same append lands after every model entry and the rules stay put
sample_specno matter how many models get added laterRelevant issues
Linear ticket
Pre-Submission checklist
Note on tests: this is a pure key reorder with no behavior to test, so no new tests were added. The existing
tests/test_litellm/litellm_core_utils/test_get_model_cost_map.pyandtest_fallback_generalizations.pyalready pin that the block is extracted from the map and never treated as a model entry, and both pass. The reorder was done with a script that asserts the parsed JSON is byte-for-byte equal in content to the previous revisionScreenshots / Proof of Fix
Content equality against the base revision, run at ba0d01a:
Type
🧹 Refactoring
Changes
fallback_generalizationsmoves directly belowsample_specinmodel_prices_and_context_window.jsonand its bundled backup, verbatim with no edits to any rule, so the doc placeholder stays first and every model entry sits below the rules.model_prices_and_context_window.schema.jsonis regenerated byci_cd/generate_model_prices_schema.pyso the generated file matches the new key orderA follow-up PR will pull the block out into its own JSON file with its own remote URL, which removes the ordering question entirely; this is the small fix in the meantime
Link to Devin session: https://app.devin.ai/sessions/b8d7e177e9144ff6a370b11e7e0e7c9c
Requested by: @mateo-berri