Repository navigation
fix: get_model_info now returns supports_xhigh/none/minimal_reasoning_effort fields - #25099
abhishekDeshmukh74 wants to merge 2 commits into
Conversation
…l_info get_model_info was not returning supports_xhigh_reasoning_effort, supports_none_reasoning_effort, or supports_minimal_reasoning_effort even though these fields exist in model_prices_and_context_window.json. The _get_model_info_helper function builds a ModelInfoBase object by explicitly passing each field, but these three reasoning-effort capability fields were missing from the constructor call. Also added supports_parallel_function_calling which was similarly omitted. Changes: - litellm/utils.py: add the four missing fields to ModelInfoBase(...) constructor in _get_model_info_helper - litellm/types/utils.py: add supports_minimal_reasoning_effort to ProviderSpecificModelInfo TypedDict (it was already in the JSON and used in gpt_5_transformation.py but not in the type definition) - tests/test_litellm/test_utils.py: add regression test for the bug (issue BerriAI#25096) Fixes BerriAI#25096
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes a gap in
Both issues flagged in the previous Greptile review (global state leak, missing Confidence Score: 5/5Safe to merge — targeted, additive fix with no backwards-incompatible changes and a proper regression test. All changes are purely additive: new fields in a TypedDict and new keyword arguments in a constructor call. No existing behaviour is altered. The regression test covers all four fixed fields and cleans up global state. Both previous review concerns are resolved. No P0 or P1 findings remain. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/types/utils.py | Adds supports_minimal_reasoning_effort to ProviderSpecificModelInfo TypedDict, which was present in the JSON cost map and used in transformation code but missing from the type definition. |
| litellm/utils.py | Adds four previously-omitted capability fields (supports_parallel_function_calling, supports_none_reasoning_effort, supports_xhigh_reasoning_effort, supports_minimal_reasoning_effort) to the ModelInfoBase constructor call in _get_model_info_helper, closing the gap between litellm.model_cost and litellm.get_model_info. |
| tests/test_litellm/test_utils.py | Adds regression test test_get_model_info_shows_supports_xhigh_reasoning_effort covering all four fixed fields for gpt-5.4; properly restores litellm.model_cost and the env-var in a try/finally block, addressing the global-state concern raised in the prior review. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["litellm.get_model_info(model)"] --> B["_get_model_info_helper()"]
B --> C["_model_info = litellm.model_cost[model]"]
C --> D["ModelInfoBase(...) constructor"]
D --> E["supports_function_calling ✅"]
D --> F["supports_vision ✅"]
D --> G["supports_reasoning ✅"]
D --> H["supports_computer_use ✅"]
D --> I["supports_parallel_function_calling\n(was missing, now fixed ✅)"]
D --> J["supports_none_reasoning_effort\n(was missing, now fixed ✅)"]
D --> K["supports_xhigh_reasoning_effort\n(was missing, now fixed ✅)"]
D --> L["supports_minimal_reasoning_effort\n(was missing, now fixed ✅)"]
D --> M["... other fields ..."]
Reviews (2): Last reviewed commit: "test: address review comments - add glob..." | Re-trigger Greptile
…_function_calling assertion - Wrap test body in try/finally to restore os.environ and litellm.model_cost after the test completes, preventing state leakage to subsequent tests - Add assertion for supports_parallel_function_calling (the fourth field added to _get_model_info_helper, now fully covered by the test)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
The fix for #25096 was merged. Closing this |
Relevant issues
Fixes #25096
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewType
🐛 Bug Fix
Changes
Root Cause
litellm.get_model_infowas not returningsupports_xhigh_reasoning_effort(and related reasoning-effort capability flags) even though the values exist inmodel_prices_and_context_window.json.The
_get_model_info_helperfunction inlitellm/utils.pybuilds aModelInfoBaseTypedDict object by explicitly passing each field in the constructor. Four capability fields were missing from that constructor call:supports_xhigh_reasoning_effortsupports_none_reasoning_effortsupports_minimal_reasoning_effortsupports_parallel_function_callingThis meant that calling
litellm.get_model_info("gpt-5.4").get("supports_xhigh_reasoning_effort")returnedNoneeven thoughlitellm.model_cost["gpt-5.4"]["supports_xhigh_reasoning_effort"]wasTrue.Fix
litellm/utils.py— Add the four missing fields to theModelInfoBase(...)constructor call in_get_model_info_helper:litellm/types/utils.py— Addsupports_minimal_reasoning_effortto theProviderSpecificModelInfoTypedDict. The field was already present inmodel_prices_and_context_window.jsonand used ingpt_5_transformation.pybut not declared in the type definition.tests/test_litellm/test_utils.py— Addtest_get_model_info_shows_supports_xhigh_reasoning_effortregression test that verifiesget_model_inforeturns the same values forsupports_xhigh_reasoning_effort,supports_none_reasoning_effort, andsupports_minimal_reasoning_effortaslitellm.model_costforgpt-5.4.