diff --git a/litellm/llms/ollama/common_utils.py b/litellm/llms/ollama/common_utils.py index 8aedd9b3500..e7264ed6e0b 100644 --- a/litellm/llms/ollama/common_utils.py +++ b/litellm/llms/ollama/common_utils.py @@ -108,7 +108,7 @@ class OllamaModelInfo(BaseLLMModelInfo): continue nm = entry.get("name") or entry.get("model") if isinstance(nm, str): - names.add(nm) + names.add(f"ollama/{nm}") except Exception as e: verbose_logger.warning(f"Error retrieving ollama tag endpoint: {e}") # If tags endpoint fails, fall back to static list diff --git a/tests/test_litellm/llms/ollama/test_ollama_model_info.py b/tests/test_litellm/llms/ollama/test_ollama_model_info.py index 95fc80b7fd6..83d120d877d 100644 --- a/tests/test_litellm/llms/ollama/test_ollama_model_info.py +++ b/tests/test_litellm/llms/ollama/test_ollama_model_info.py @@ -73,7 +73,7 @@ class TestOllamaModelInfo: info = OllamaModelInfo() models = info.get_models() # Only 'alpha' and 'zeta' should be returned, sorted alphabetically - assert models == ["alpha", "zeta"] + assert models == ["ollama/alpha", "ollama/zeta"] # Ensure correct endpoint was called assert calls and calls[0].endswith("/api/tags") assert call_headers and call_headers[0] == {} @@ -122,7 +122,7 @@ class TestOllamaModelInfo: monkeypatch.setattr(httpx, "get", mock_get) info = OllamaModelInfo() models = info.get_models() - assert models == ["m1", "m2"] + assert models == ["ollama/m1", "ollama/m2"] def test_get_models_fallback_on_error(self, monkeypatch): """