From 090a86ce1b79efd131f7845f5de1e2c62b056c15 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Sat, 4 Apr 2026 22:16:17 -0700 Subject: [PATCH] =?UTF-8?q?refactor:=20update=20LLMRouter=20lazy=20import?= =?UTF-8?q?=20=E2=80=94=20circuitforge=5Fcore.resources.client=20=E2=86=92?= =?UTF-8?q?=20circuitforge=5Forch.client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- circuitforge_core/llm/router.py | 2 +- tests/test_llm_router.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/circuitforge_core/llm/router.py b/circuitforge_core/llm/router.py index 61f436f..b09a3b4 100644 --- a/circuitforge_core/llm/router.py +++ b/circuitforge_core/llm/router.py @@ -123,7 +123,7 @@ class LLMRouter: if not orch_url: return None try: - from circuitforge_core.resources.client import CFOrchClient + from circuitforge_orch.client import CFOrchClient client = CFOrchClient(orch_url) service = orch_cfg.get("service", "vllm") candidates = orch_cfg.get("model_candidates", []) diff --git a/tests/test_llm_router.py b/tests/test_llm_router.py index 3cb6ca0..8894971 100644 --- a/tests/test_llm_router.py +++ b/tests/test_llm_router.py @@ -77,3 +77,12 @@ def test_complete_raises_when_all_backends_exhausted(): with patch.object(router, "_is_reachable", return_value=False): with pytest.raises(RuntimeError, match="exhausted"): router.complete("test") + + +def test_try_cf_orch_alloc_import_path(): + """Verify lazy import points to circuitforge_orch, not circuitforge_core.resources.""" + import inspect + from circuitforge_core.llm import router as router_module + src = inspect.getsource(router_module.LLMRouter._try_cf_orch_alloc) + assert "circuitforge_orch.client" in src + assert "circuitforge_core.resources.client" not in src