mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
53c33f1575
commit
ae8a046b4f
2 changed files with 18 additions and 0 deletions
|
|
@ -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
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue