fix(vision): proactive downgrade for providers rejecting list-type tool content (#41072)

Xiaomi MiMo (and potentially other providers) support multimodal user
messages but reject list-type tool message content with 400 'text is not
set'. Previously this was handled reactively — the API call would fail,
images would be stripped, and the request retried, losing visual info.

Fix: add supports_vision_tool_messages field to ProviderProfile (default
True). Xiaomi sets it to False. _tool_result_content_for_active_model
now checks this field proactively and returns a text summary instead of
list content, avoiding the round-trip failure entirely.
This commit is contained in:
islam666
2026-06-07 21:50:57 -07:00
committed by Teknium
parent 41f0714287
commit 9513793ad7
5 changed files with 269 additions and 22 deletions
@@ -10,6 +10,7 @@ xiaomi = ProviderProfile(
base_url="https://api.xiaomimimo.com/v1",
supports_health_check=False, # /v1/models returns 401 even with valid key
supports_vision=True, # mimo-v2-omni is vision-capable
supports_vision_tool_messages=False, # rejects list-type tool content (400 "text is not set")
)
register_provider(xiaomi)