Просмотр исходного кода

fix: _detect_provider — respect explicit dashscope/openai/ prefix

When model name has explicit provider prefix (dashscope/qwen-max),
skip Ollama auto-detection. Fixes: Ollama running locally would
hijack dashscope/qwen-max → 404 (Ollama doesn't have qwen-max).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kenny67nju 8 месяцев назад
Родитель
Сommit
a25de7a6e1
1 измененных файлов с 10 добавлено и 0 удалено
  1. 10 0
      lambdagent/primitives.py

+ 10 - 0
lambdagent/primitives.py

@@ -67,6 +67,16 @@ class Lam(Term):
 
     def _detect_provider(self) -> str:
         m = self.model.lower()
+        # Explicit provider prefix takes priority
+        if m.startswith('dashscope/'):
+            return 'dashscope'
+        if m.startswith('anthropic/'):
+            return 'anthropic'
+        if m.startswith('openai/'):
+            return 'openai'
+        if m.startswith('ollama/'):
+            return 'ollama'
+        # Auto-detect by model name
         if 'claude' in m or 'anthropic' in m:
             return 'anthropic'
         elif 'gpt' in m or 'openai' in m: