Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix: recognize Qwen3.8-Max vision support

Kevin Xia115a78ae1ba9
diff --git a/deeptutor/services/llm/capabilities.py b/deeptutor/services/llm/capabilities.py
index 098067ec3..53ece3229 100644
--- a/deeptutor/services/llm/capabilities.py
+++ b/deeptutor/services/llm/capabilities.py
@@ -259,6 +259,11 @@ MODEL_OVERRIDES: dict[str, dict[str, object]] = {
# 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.
+ # Qwen3.8-Max is natively multimodal despite not using the historical
+ # ``-vl`` suffix. Keep this override narrow so other Qwen text models remain
+ # fail-closed.
+ # https://help.aliyun.com/zh/model-studio/vision-model
+ "qwen3.8-max": {"supports_vision": True},
"qwen/qwen2.5-vl": {"has_thinking_tags": True, "supports_vision": True},
"qwen/qwen3-vl": {"has_thinking_tags": True, "supports_vision": True},
"qwen/qwen2-vl": {"has_thinking_tags": True, "supports_vision": True},
diff --git a/tests/services/llm/test_capabilities.py b/tests/services/llm/test_capabilities.py
index a030af2b3..180f68745 100644
--- a/tests/services/llm/test_capabilities.py
+++ b/tests/services/llm/test_capabilities.py
@@ -125,3 +125,8 @@ def test_kimi_k3_is_vision_capable() -> None:
"""Kimi K3 is natively multimodal, like the K2.5/K2.6 entries above it."""
assert supports_vision("moonshot", "kimi-k3") is True
assert supports_vision("custom", "kimi-k3") is True
+
+
+def test_qwen38_max_enables_vision_without_legacy_vl_suffix() -> None:
+ """Qwen3.8-Max is multimodal despite not carrying the legacy ``-vl`` suffix."""
+ assert supports_vision("dashscope", "qwen3.8-max") is True
diff --git a/tests/services/llm/test_multimodal.py b/tests/services/llm/test_multimodal.py
index deb68c303..de300f00b 100644
--- a/tests/services/llm/test_multimodal.py
+++ b/tests/services/llm/test_multimodal.py
@@ -161,6 +161,8 @@ def test_should_degrade_only_for_non_vision_model_with_images() -> None:
assert should_degrade_to_text("moonshot", "moonshot-v1-8k", msgs) is True
# Known vision-capable model → keep images, surface the real error.
assert should_degrade_to_text("openai", "gpt-4o", 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
# 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
diff --git a/tests/services/rag/test_llamaindex_document_loader.py b/tests/services/rag/test_llamaindex_document_loader.py
index d14b53416..92cf9c2ca 100644
--- a/tests/services/rag/test_llamaindex_document_loader.py
+++ b/tests/services/rag/test_llamaindex_document_loader.py
@@ -175,12 +175,14 @@ def test_loader_skips_images_when_embedding_provider_is_text_only(
assert documents == []
-def test_loader_embeds_images_when_embedding_provider_is_multimodal(
+def test_loader_embeds_images_with_qwen38_max_vision_capability(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
pytest.importorskip("llama_index.core")
from llama_index.core.schema import ImageNode
+ from deeptutor.services.llm.client import LLMClient
+ from deeptutor.services.llm.config import LLMConfig
from deeptutor.services.rag.pipelines.llamaindex import document_loader as loader_module
image_path = tmp_path / "photo.png"
@@ -197,19 +199,24 @@ def test_loader_embeds_images_when_embedding_provider_is_multimodal(
captured["contents"] = contents
return [[0.1, 0.2, 0.3]]
- class _VisionClient:
- config = type("Config", (), {"binding": "openai", "model": "gpt-4o"})()
+ vision_client = LLMClient(
+ LLMConfig(
+ binding="dashscope",
+ model="qwen3.8-max",
+ api_key="test-key",
+ base_url="https://example.invalid/v1",
+ )
+ )
- def supports_multimodal_images(self) -> bool:
- return True
+ async def _complete(prompt: str, **kwargs: object) -> str:
+ captured["llm_prompt"] = prompt
+ captured["llm_kwargs"] = kwargs
+ return "A logo image with visible HKU text."
- async def complete(self, prompt, **kwargs):
- captured["llm_prompt"] = prompt
- captured["llm_kwargs"] = kwargs
- return "A logo image with visible HKU text."
+ monkeypatch.setattr(vision_client, "complete", _complete)
monkeypatch.setattr(loader_module, "get_embedding_client", lambda: _MultimodalClient())
- monkeypatch.setattr(loader_module, "get_llm_client", lambda: _VisionClient())
+ monkeypatch.setattr(loader_module, "get_llm_client", lambda: vision_client)
documents = asyncio.run(loader_module.LlamaIndexDocumentLoader().load([str(image_path)]))