Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

refactor: remove unnecessary ImportError handling for langchain-community

LearningCircuita4beee9abec8
diff --git a/src/local_deep_research/embeddings/providers/implementations/ollama.py b/src/local_deep_research/embeddings/providers/implementations/ollama.py
index 82f53c839f..015fb04a8f 100644
--- a/src/local_deep_research/embeddings/providers/implementations/ollama.py
+++ b/src/local_deep_research/embeddings/providers/implementations/ollama.py
@@ -2,6 +2,7 @@
from typing import Any, Dict, List, Optional
+from langchain_community.embeddings import OllamaEmbeddings
from langchain_core.embeddings import Embeddings
from loguru import logger
@@ -86,15 +87,6 @@ class OllamaEmbeddingsProvider(BaseEmbeddingProvider):
Returns:
OllamaEmbeddings instance
"""
- try:
- from langchain_community.embeddings import OllamaEmbeddings
- except ImportError as e:
- logger.exception("langchain-ollama not installed")
- raise ImportError(
- "langchain-community with Ollama support is required. "
- "Install with: pip install langchain-community"
- ) from e
-
# Get model from settings if not specified
if model is None:
model = get_setting_from_snapshot(
@@ -124,7 +116,6 @@ class OllamaEmbeddingsProvider(BaseEmbeddingProvider):
"""Check if Ollama is available."""
try:
import requests
- from langchain_community.embeddings import OllamaEmbeddings # noqa: F401
# Get Ollama URL
base_url = cls._get_ollama_base_url(settings_snapshot)
@@ -136,8 +127,6 @@ class OllamaEmbeddingsProvider(BaseEmbeddingProvider):
except requests.exceptions.RequestException:
return False
- except ImportError:
- return False
except Exception:
logger.exception("Error checking Ollama availability")
return False