feat(oss): port v3 pipeline with hybrid search, entity extraction, and additive scoring (#4805)

Co-authored-by: Soumil Rathi <soumilrathi@gmail.com>
Co-authored-by: Saket Aryan <saketaryan2002@gmail.com>
Co-authored-by: chaithanyak42 <chaithanya.kumar42a@gmail.com>
Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
This commit is contained in:
soumil-rathi
2026-04-14 05:30:58 -07:00
committed by GitHub
parent 57f944e18a
commit a488e19044
120 changed files with 10107 additions and 17135 deletions
-49
View File
@@ -1,4 +1,3 @@
import asyncio
import threading
from unittest.mock import MagicMock, patch
@@ -291,11 +290,6 @@ class TestMemoryLifecycle:
m.db = MagicMock()
return m
def test_close_calls_db_close(self):
m = self._make_mock_memory()
m.close()
m.db.close.assert_called_once()
def test_double_close_is_safe(self):
"""close() should be safe to call twice (SQLiteManager.close sets connection=None)."""
m = self._make_mock_memory()
@@ -319,21 +313,6 @@ class TestMemoryLifecycle:
# db attribute not set at all
m.close() # should not raise due to hasattr guard
def test_context_manager(self):
"""Memory should support `with` statement and close on exit."""
m = self._make_mock_memory()
with m:
pass
m.db.close.assert_called_once()
def test_context_manager_closes_on_exception(self):
"""Memory should close even if the with-block raises."""
m = self._make_mock_memory()
with pytest.raises(ValueError):
with m:
raise ValueError("boom")
m.db.close.assert_called_once()
class TestAsyncMemoryLifecycle:
"""Verify AsyncMemory.close() and async context manager support."""
@@ -346,11 +325,6 @@ class TestAsyncMemoryLifecycle:
m.db = MagicMock()
return m
def test_close_calls_db_close(self):
m = self._make_mock_async_memory()
m.close()
m.db.close.assert_called_once()
def test_close_when_db_is_none(self):
m = self._make_mock_async_memory()
m.db = None
@@ -363,29 +337,6 @@ class TestAsyncMemoryLifecycle:
m = AsyncMemory.__new__(AsyncMemory)
m.close() # should not raise
def test_async_context_manager(self):
"""AsyncMemory should support `async with` and close on exit."""
m = self._make_mock_async_memory()
async def run():
async with m:
pass
asyncio.run(run())
m.db.close.assert_called_once()
def test_async_context_manager_closes_on_exception(self):
"""AsyncMemory should close even if the async with-block raises."""
m = self._make_mock_async_memory()
async def run():
async with m:
raise ValueError("boom")
with pytest.raises(ValueError):
asyncio.run(run())
m.db.close.assert_called_once()
class TestTelemetryEnvVar:
"""Verify the MEM0_TELEMETRY env var parsing logic."""