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:
Soumil Rathi
2026-04-02 11:04:38 -07:00
co-authored by Claude Opus 4.6
parent 70c62ea54f
commit 9c9b3d54e2
3 changed files with 17 additions and 3 deletions
+3 -1
View File
@@ -21,10 +21,12 @@ dependencies = [
"pytz>=2024.1",
"sqlalchemy>=2.0.31",
"protobuf>=5.29.0,<6.0.0",
"spacy>=3.7.0",
]
[project.optional-dependencies]
nlp = [
"spacy>=3.7.0",
]
graph = [
"langchain-neo4j>=0.4.0",
"langchain-aws>=0.2.23",