fix: filter image_url for non-vision models at provider layer
- Add field to ProviderSpec (default True) - Add and methods in LiteLLMProvider - Filter image_url content blocks in before sending to non-vision models - Reverts session-layer filtering from original PR (wrong layer) This fixes the issue where switching from Claude (vision-capable) to non-vision models (e.g., Baidu Qianfan) causes API errors due to unsupported image_url content blocks. The provider layer is the correct place for this filtering because: 1. It has access to model/provider capabilities 2. It only affects non-vision models 3. It preserves session layer purity (storage should not know about model capabilities)
This commit is contained in:
@@ -61,6 +61,9 @@ class ProviderSpec:
|
||||
# Provider supports cache_control on content blocks (e.g. Anthropic prompt caching)
|
||||
supports_prompt_caching: bool = False
|
||||
|
||||
# Provider supports vision/image inputs (most modern models do)
|
||||
supports_vision: bool = True
|
||||
|
||||
@property
|
||||
def label(self) -> str:
|
||||
return self.display_name or self.name.title()
|
||||
|
||||
Reference in New Issue
Block a user