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:
coldxiangyu
2026-03-15 22:32:34 +08:00
committed by Xubin Ren
parent 196e0ddbb6
commit de0b5b3d91
2 changed files with 33 additions and 0 deletions
+3
View File
@@ -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()