mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
fix(ollama): Include provider in model list for ollama (#26135)
* Include provider in model names for ollama * Fix unit tests
This commit is contained in:
parent
d120ddf678
commit
db687bfeca
2 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue