feat(oss): make spaCy an optional dependency
Move spacy from core dependencies to optional [nlp] extra. The system gracefully degrades without spaCy: - Lemmatization falls back to raw text - Entity extraction returns empty (no entity boost) - BM25 keyword search still works on raw text - Semantic search and additive scoring unaffected Install with NLP support: pip install mem0ai[nlp] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
70c62ea54f
commit
9c9b3d54e2
@@ -19,8 +19,13 @@ _lock = threading.Lock()
|
||||
|
||||
|
||||
def _ensure_model_available():
|
||||
"""Download en_core_web_sm if not already installed. Does not load the model."""
|
||||
import spacy
|
||||
"""Download en_core_web_sm if spaCy is installed but model is missing."""
|
||||
try:
|
||||
import spacy
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"spaCy is not installed. Install it with: pip install mem0ai[nlp]"
|
||||
)
|
||||
|
||||
if not spacy.util.is_package("en_core_web_sm"):
|
||||
logger.info("Downloading spaCy model en_core_web_sm...")
|
||||
|
||||
Reference in New Issue
Block a user