diff --git a/haiku_rag_slim/haiku/rag/embeddings/__init__.py b/haiku_rag_slim/haiku/rag/embeddings/__init__.py index f17416e1..53d3036f 100644 --- a/haiku_rag_slim/haiku/rag/embeddings/__init__.py +++ b/haiku_rag_slim/haiku/rag/embeddings/__init__.py @@ -128,7 +128,7 @@ def get_embedder(config: AppConfig = Config) -> EmbedderWrapper: if provider == "voyageai": try: from haiku.rag.embeddings.voyageai import VoyageAIEmbeddingModel - except ImportError: + except ImportError: # pragma: no cover raise ImportError( "VoyageAI embedder requires the 'voyageai' package. " "Please install haiku.rag with the 'voyageai' extra: " diff --git a/haiku_rag_slim/haiku/rag/inspector/__init__.py b/haiku_rag_slim/haiku/rag/inspector/__init__.py index bac3b5e8..6eebb52d 100644 --- a/haiku_rag_slim/haiku/rag/inspector/__init__.py +++ b/haiku_rag_slim/haiku/rag/inspector/__init__.py @@ -1,6 +1,6 @@ try: from haiku.rag.inspector.app import run_inspector -except ImportError as e: +except ImportError as e: # pragma: no cover raise ImportError( "textual is not installed. Please install it with `pip install 'haiku.rag-slim[tui]'` or use the full haiku.rag package." ) from e diff --git a/haiku_rag_slim/haiku/rag/reranking/__init__.py b/haiku_rag_slim/haiku/rag/reranking/__init__.py index b3502db6..b5e52c50 100644 --- a/haiku_rag_slim/haiku/rag/reranking/__init__.py +++ b/haiku_rag_slim/haiku/rag/reranking/__init__.py @@ -30,7 +30,7 @@ def get_reranker(config: AppConfig = Config) -> RerankerBase | None: os.environ["TOKENIZERS_PARALLELISM"] = "true" reranker = MxBAIReranker() - except ImportError: + except ImportError: # pragma: no cover reranker = None elif config.reranking.model and config.reranking.model.provider == "cohere": @@ -38,7 +38,7 @@ def get_reranker(config: AppConfig = Config) -> RerankerBase | None: from haiku.rag.reranking.cohere import CohereReranker reranker = CohereReranker() - except ImportError: + except ImportError: # pragma: no cover reranker = None elif config.reranking.model and config.reranking.model.provider == "vllm": @@ -49,7 +49,7 @@ def get_reranker(config: AppConfig = Config) -> RerankerBase | None: if not base_url: raise ValueError("vLLM reranker requires base_url in reranking.model") reranker = VLLMReranker(config.reranking.model.name, base_url) - except ImportError: + except ImportError: # pragma: no cover reranker = None elif config.reranking.model and config.reranking.model.provider == "zeroentropy": @@ -59,7 +59,7 @@ def get_reranker(config: AppConfig = Config) -> RerankerBase | None: # Use configured model or default to zerank-1 model = config.reranking.model.name or "zerank-1" reranker = ZeroEntropyReranker(model) - except ImportError: + except ImportError: # pragma: no cover reranker = None _reranker_cache[config_id] = reranker diff --git a/haiku_rag_slim/haiku/rag/reranking/cohere.py b/haiku_rag_slim/haiku/rag/reranking/cohere.py index 3d7786b6..9d38a631 100644 --- a/haiku_rag_slim/haiku/rag/reranking/cohere.py +++ b/haiku_rag_slim/haiku/rag/reranking/cohere.py @@ -3,7 +3,7 @@ from haiku.rag.store.models.chunk import Chunk try: import cohere -except ImportError as e: +except ImportError as e: # pragma: no cover raise ImportError( "cohere is not installed. Please install it with `pip install cohere` or use the cohere optional dependency." ) from e