Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(vlm): skip zhipu prefix when model already uses zai/ (LiteLLM) (#789)
Protocol Zerod245c0241138
diff --git a/openviking/models/vlm/backends/litellm_vlm.py b/openviking/models/vlm/backends/litellm_vlm.pyindex 118c774d3..db70fc233 100644--- a/openviking/models/vlm/backends/litellm_vlm.py+++ b/openviking/models/vlm/backends/litellm_vlm.py@@ -131,7 +131,9 @@ class LiteLLMVLMProvider(VLMBase):if provider and provider in PROVIDER_CONFIGS:prefix = PROVIDER_CONFIGS[provider]["litellm_prefix"]- if prefix and not model.startswith(f"{prefix}/"):+ # LiteLLM uses the `zai/` prefix for Zhipu GLM; do not prepend `zhipu/` (see #784).+ is_zhipu_zai_model = provider == "zhipu" and model.startswith("zai/")+ if prefix and not model.startswith(f"{prefix}/") and not is_zhipu_zai_model:return f"{prefix}/{model}"return modeldiff --git a/tests/unit/test_extra_headers_vlm.py b/tests/unit/test_extra_headers_vlm.pyindex 87b3e8037..2a5c8b283 100644--- a/tests/unit/test_extra_headers_vlm.py+++ b/tests/unit/test_extra_headers_vlm.py@@ -4,6 +4,7 @@from unittest.mock import MagicMock, patch+from openviking.models.vlm.backends.litellm_vlm import LiteLLMVLMProviderfrom openviking.models.vlm.backends.openai_vlm import OpenAIVLM@@ -219,3 +220,30 @@ class TestVLMConfigExtraHeaders:"HTTP-Referer": "https://example.com","X-Title": "My App",}+++class TestLiteLLMVLMModelResolution:+ """Regression tests for LiteLLM model prefix resolution."""++ def test_zhipu_zai_model_keeps_existing_zai_prefix(self):+ """Zhipu GLM models already using LiteLLM's zai/ prefix must not be double-prefixed."""+ vlm = LiteLLMVLMProvider(+ {+ "model": "zai/glm-4.5",+ "provider": "litellm",+ }+ )++ assert vlm._resolve_model("zai/glm-4.5") == "zai/glm-4.5"++ def test_non_zhipu_provider_still_applies_prefix(self):+ """The zai/ exception should not affect other providers."""+ vlm = LiteLLMVLMProvider(+ {+ "model": "zai/custom-model",+ "provider": "gemini",+ "api_key": "sk-test",+ }+ )++ assert vlm._resolve_model("zai/custom-model") == "gemini/zai/custom-model"