From ef727ddffd73bd3f44ade3b0aa0eea1a9dcd435b Mon Sep 17 00:00:00 2001 From: Bogdan Buduroiu <bogdan@buduroiu.com> Date: Tue, 16 Jan 2024 21:47:39 +0800 Subject: [PATCH] Fixes ModuleNotFoundError when not installed with `local` extras --- docs/05-local-execution.ipynb | 2 +- semantic_router/llms/__init__.py | 3 +-- tests/unit/llms/test_llm_llamacpp.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/05-local-execution.ipynb b/docs/05-local-execution.ipynb index f02ecf15..cdb6c3fe 100644 --- a/docs/05-local-execution.ipynb +++ b/docs/05-local-execution.ipynb @@ -342,7 +342,7 @@ "from semantic_router import RouteLayer\n", "\n", "from llama_cpp import Llama\n", - "from semantic_router.llms import LlamaCppLLM\n", + "from semantic_router.llms.llamacpp import LlamaCppLLM\n", "\n", "enable_gpu = True # offload LLM layers to the GPU (must fit in memory)\n", "\n", diff --git a/semantic_router/llms/__init__.py b/semantic_router/llms/__init__.py index 02b3fd5b..e5aedc85 100644 --- a/semantic_router/llms/__init__.py +++ b/semantic_router/llms/__init__.py @@ -1,7 +1,6 @@ from semantic_router.llms.base import BaseLLM from semantic_router.llms.cohere import CohereLLM -from semantic_router.llms.llamacpp import LlamaCppLLM from semantic_router.llms.openai import OpenAILLM from semantic_router.llms.openrouter import OpenRouterLLM -__all__ = ["BaseLLM", "OpenAILLM", "OpenRouterLLM", "CohereLLM", "LlamaCppLLM"] +__all__ = ["BaseLLM", "OpenAILLM", "OpenRouterLLM", "CohereLLM"] diff --git a/tests/unit/llms/test_llm_llamacpp.py b/tests/unit/llms/test_llm_llamacpp.py index 5793c2d2..f0a5253f 100644 --- a/tests/unit/llms/test_llm_llamacpp.py +++ b/tests/unit/llms/test_llm_llamacpp.py @@ -1,7 +1,7 @@ import pytest from llama_cpp import Llama -from semantic_router.llms import LlamaCppLLM +from semantic_router.llms.llamacpp import LlamaCppLLM from semantic_router.schema import Message -- GitLab