Personal AI, On Personal Devices
Python
Fixing lemonade server when used in proxy
Eddie Richter8f6ee7ae10fe
diff --git a/src/openjarvis/engine/openai_compat_engines.py b/src/openjarvis/engine/openai_compat_engines.pyindex a5827d3d..95ec1200 100644--- a/src/openjarvis/engine/openai_compat_engines.py+++ b/src/openjarvis/engine/openai_compat_engines.py@@ -13,7 +13,7 @@ _ENGINES = {"nexa": ("NexaEngine", "http://localhost:18181", "/v1"),"uzu": ("UzuEngine", "http://localhost:8000", ""),"apple_fm": ("AppleFmEngine", "http://localhost:8079", "/v1"),- "lemonade": ("LemonadeEngine", "http://localhost:8000", "/api/v0"),+ "lemonade": ("LemonadeEngine", "http://localhost:8000", "/v1"),}for _key, (_cls_name, _default_host, _api_prefix) in _ENGINES.items():diff --git a/tests/engine/test_lemonade.py b/tests/engine/test_lemonade.pyindex d882455c..bfbe0030 100644--- a/tests/engine/test_lemonade.py+++ b/tests/engine/test_lemonade.py@@ -1,6 +1,6 @@"""Tests for the Lemonade engine backend.-Validates that the ``/api/v0`` prefix is used correctly for models listing+Validates that the ``/v1`` prefix is used correctly for models listingand chat completions."""@@ -30,7 +30,7 @@ class TestLemonadeEngineBasics:assert LemonadeEngine._default_host == "http://localhost:8000"def test_api_prefix(self) -> None:- assert LemonadeEngine._api_prefix == "/api/v0"+ assert LemonadeEngine._api_prefix == "/v1"def test_registry_registration(self) -> None:EngineRegistry.register_value("lemonade", LemonadeEngine)@@ -40,7 +40,7 @@ class TestLemonadeEngineBasics:class TestLemonadeGenerate:def test_generate_uses_api_v0_prefix(self, engine: LemonadeEngine) -> None:with respx.mock:- respx.post("http://testhost:8000/api/v0/chat/completions").mock(+ respx.post("http://testhost:8000/v1/chat/completions").mock(return_value=httpx.Response(200,json={@@ -67,7 +67,7 @@ class TestLemonadeGenerate:def test_generate_connection_error(self, engine: LemonadeEngine) -> None:with respx.mock:- respx.post("http://testhost:8000/api/v0/chat/completions").mock(+ respx.post("http://testhost:8000/v1/chat/completions").mock(side_effect=httpx.ConnectError("refused"))with pytest.raises(EngineConnectionError):@@ -80,14 +80,14 @@ class TestLemonadeGenerate:class TestLemonadeHealth:def test_health_true(self, engine: LemonadeEngine) -> None:with respx.mock:- respx.get("http://testhost:8000/api/v0/models").mock(+ respx.get("http://testhost:8000/v1/models").mock(return_value=httpx.Response(200, json={"data": []}))assert engine.health() is Truedef test_health_false(self, engine: LemonadeEngine) -> None:with respx.mock:- respx.get("http://testhost:8000/api/v0/models").mock(+ respx.get("http://testhost:8000/v1/models").mock(side_effect=httpx.ConnectError("refused"))assert engine.health() is False@@ -96,7 +96,7 @@ class TestLemonadeHealth:class TestLemonadeListModels:def test_list_models_uses_api_v0_prefix(self, engine: LemonadeEngine) -> None:with respx.mock:- respx.get("http://testhost:8000/api/v0/models").mock(+ respx.get("http://testhost:8000/v1/models").mock(return_value=httpx.Response(200,json={