From ae8a046b4f7b6a001eac1e6c671e5ee698000bbb Mon Sep 17 00:00:00 2001 From: Santazuki Date: Wed, 10 Jun 2026 01:44:49 +0800 Subject: [PATCH] fix(capabilities): Address Greptile review feedback - Add missing bridge parameters: supports_response_schema (maps to structured_output) and supports_reasoning - Add comprehensive tests for parameter mapping (response_schema -> structured_output, reasoning) - Fix capability loss bug identified in Greptile review This ensures the bridge function can migrate all model_cost_map capabilities without data loss. Addresses feedback from greptile-apps bot review. Co-Authored-By: Claude Opus 4.7 --- litellm/provider_capabilities.py | 4 ++++ tests/test_provider_capabilities.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/litellm/provider_capabilities.py b/litellm/provider_capabilities.py index 78a5769cfc7..c9c6538805c 100644 --- a/litellm/provider_capabilities.py +++ b/litellm/provider_capabilities.py @@ -176,6 +176,8 @@ def capabilities_from_model_info( supports_audio_input: bool = False, supports_audio_output: bool = False, supports_prompt_caching: bool = False, + supports_response_schema: bool = False, + supports_reasoning: bool = False, **_: object, # ignore unknown keys from model_cost_map ) -> ProviderCapabilities: """Bridge: construct ProviderCapabilities from existing model_cost_map flags. @@ -188,9 +190,11 @@ def capabilities_from_model_info( vision=supports_vision, streaming=supports_streaming, function_calling=supports_function_calling, + structured_output=supports_response_schema, audio_input=supports_audio_input, audio_output=supports_audio_output, prompt_caching=supports_prompt_caching, + reasoning=supports_reasoning, ), # strengths comes from model_cost_map scoring or defaults to neutral ) diff --git a/tests/test_provider_capabilities.py b/tests/test_provider_capabilities.py index 539814b1b01..8fd7250b73b 100644 --- a/tests/test_provider_capabilities.py +++ b/tests/test_provider_capabilities.py @@ -161,3 +161,17 @@ class TestCapabilitiesFromModelInfo: supports_vision=True, ) assert cap.supports_vision is True + + def test_maps_response_schema_to_structured_output(self): + """supports_response_schema should map to structured_output.""" + cap = capabilities_from_model_info( + supports_response_schema=True, + ) + assert cap.supports_structured_output is True + + def test_maps_reasoning_flag(self): + """supports_reasoning should be preserved.""" + cap = capabilities_from_model_info( + supports_reasoning=True, + ) + assert cap.supports.reasoning is True