Improve Ollama endpoint error messages

This commit is contained in:
Prakhya
2026-06-02 02:23:50 +05:30
committed by GitHub
parent 7a830e504d
commit a96593a99b
2 changed files with 46 additions and 1 deletions
+20
View File
@@ -296,3 +296,23 @@ class TestSetupProbeSafety:
monkeypatch.setattr(model_routes.httpx, "get", fake_get)
assert _probe_endpoint("https://api.anthropic.com/v1") == ANTHROPIC_MODELS
def test_ollama_endpoint_error_message_includes_troubleshooting():
msg = model_routes._model_endpoint_error_message(
"http://localhost:11434/v1",
{"error": "Connection refused"},
)
assert "No Ollama models found" in msg
assert "Connection refused" in msg
assert "http://localhost:11434/v1" in msg
assert "ollama list" in msg
def test_generic_endpoint_error_message_preserves_probe_error():
msg = model_routes._model_endpoint_error_message(
"https://api.example.com/v1",
{"error": "HTTP 401"},
)
assert msg == "No models found for that provider/key. Last probe error: HTTP 401."