diff --git a/deeptutor/services/llm/capabilities.py b/deeptutor/services/llm/capabilities.py index 6a856b4bb..3e43e4cc3 100644 --- a/deeptutor/services/llm/capabilities.py +++ b/deeptutor/services/llm/capabilities.py @@ -293,6 +293,22 @@ MODEL_OVERRIDES: dict[str, dict[str, object]] = { "has_thinking_tags": True, "supports_vision": False, }, + # DeepSeek-V4.1-Flash is natively multimodal: the vision add-on of the + # experimental V4 Flash became part of the main model. ``deepseek-flash`` + # is its name on DeepSeek's own API; gateways publish dated ids such as + # ``deepseek-v4.1-flash-1017``. Keep these overrides narrow so every other + # DeepSeek text model stays fail-closed, and keep them vision-only so the + # broader ``deepseek`` entry still supplies response-format and + # thinking-tag handling. Gateways that namespace model ids (OpenRouter, + # resellers on Model Studio) need their own entries, as the Qwen-VL rules + # below already do. + # https://api-docs.deepseek.com/news/news260910/ + "deepseek-v4.1-flash": {"supports_vision": True}, + "deepseek-flash": {"supports_vision": True}, + "deepseek-v4-flash-vision-exp": {"supports_vision": True}, + "deepseek/deepseek-v4.1-flash": {"supports_vision": True}, + "deepseek/deepseek-flash": {"supports_vision": True}, + "vanchin/deepseek-v4.1-flash": {"supports_vision": True}, # Qwen text models often share the same provider/gateway as Qwen-VL. # Keep thinking-tag handling broad, but only mark explicit VL/vision model # names as image-capable so RAG image indexing can fail closed. diff --git a/tests/services/llm/test_capabilities.py b/tests/services/llm/test_capabilities.py index 88a275bd0..f49910345 100644 --- a/tests/services/llm/test_capabilities.py +++ b/tests/services/llm/test_capabilities.py @@ -172,3 +172,32 @@ def test_models_prefix_does_not_change_other_vendor_verdicts() -> None: assert supports_vision("custom", "openai/gpt-3.5-turbo") is False # The bare id keeps resolving exactly as before. assert supports_vision("custom", "gemini-2.5-flash") is True + + +def test_deepseek_v41_flash_is_vision_capable() -> None: + """DeepSeek-V4.1-Flash is natively multimodal under each of its published ids.""" + for model in ( + "deepseek-flash", + "deepseek-v4.1-flash", + "deepseek-v4.1-flash-1017", + "DeepSeek-V4.1-Flash-1017", + "deepseek-v4-flash-vision-exp", + # Gateways namespace the id; resolution must survive the prefix. + "deepseek/deepseek-flash", + "deepseek/deepseek-v4.1-flash-1017", + "vanchin/deepseek-v4.1-flash-1017", + ): + assert supports_vision("dashscope", model) is True, model + assert supports_vision("deepseek", model) is True, model + + +def test_deepseek_text_models_stay_fail_closed() -> None: + """The vision overrides must not leak to other DeepSeek models.""" + for model in ("deepseek-chat", "deepseek-reasoner", "deepseek-v3.2"): + assert supports_vision("deepseek", model) is False, model + + +def test_deepseek_vision_override_keeps_sibling_capabilities() -> None: + """Vision-only overrides still fall through to the broader ``deepseek`` entry.""" + assert has_thinking_tags("deepseek", "deepseek-v4.1-flash-1017") is True + assert supports_response_format("deepseek", "deepseek-v4.1-flash-1017") is False diff --git a/tests/services/llm/test_multimodal.py b/tests/services/llm/test_multimodal.py index 709750cb3..36362d67f 100644 --- a/tests/services/llm/test_multimodal.py +++ b/tests/services/llm/test_multimodal.py @@ -191,6 +191,8 @@ def test_should_degrade_only_for_non_vision_model_with_images() -> None: assert should_degrade_to_text("openai_codex", "gpt-5.6-sol", msgs) is False # Qwen3.8-Max is multimodal even though its model ID has no ``-vl`` suffix. assert should_degrade_to_text("dashscope", "qwen3.8-max", msgs) is False + # DeepSeek-V4.1-Flash is natively multimodal under its dated gateway id. + assert should_degrade_to_text("dashscope", "deepseek-v4.1-flash-1017", msgs) is False # An allowlisted provider (VolcEngine) is trusted even for a model we have # no per-model entry for. assert should_degrade_to_text("volcengine", "doubao-1.5-vision-pro", msgs) is False