diff --git a/src/openjarvis/cli/ask.py b/src/openjarvis/cli/ask.py index 8897b06a..6b0cbdd8 100644 --- a/src/openjarvis/cli/ask.py +++ b/src/openjarvis/cli/ask.py @@ -29,7 +29,7 @@ from openjarvis.telemetry.store import TelemetryStore def _get_memory_backend(config): """Try to instantiate the memory backend, return None on failure.""" try: - import openjarvis.memory # noqa: F401 + import openjarvis.tools.storage # noqa: F401 from openjarvis.core.registry import MemoryRegistry key = config.memory.default_backend @@ -127,7 +127,7 @@ def _run_agent( # Inject memory context into conversation if available if config.agent.context_from_memory: try: - from openjarvis.memory.context import ContextConfig, inject_context + from openjarvis.tools.storage.context import ContextConfig, inject_context backend = _get_memory_backend(config) if backend is not None: @@ -301,7 +301,7 @@ def ask( # Memory-augmented context injection if not no_context and config.agent.context_from_memory: try: - from openjarvis.memory.context import ( + from openjarvis.tools.storage.context import ( ContextConfig, inject_context, ) diff --git a/src/openjarvis/cli/memory_cmd.py b/src/openjarvis/cli/memory_cmd.py index ccc0f09b..43f4e5b7 100644 --- a/src/openjarvis/cli/memory_cmd.py +++ b/src/openjarvis/cli/memory_cmd.py @@ -12,8 +12,8 @@ from rich.table import Table from openjarvis.core.config import load_config from openjarvis.core.registry import MemoryRegistry -from openjarvis.memory.chunking import ChunkConfig -from openjarvis.memory.ingest import ingest_path +from openjarvis.tools.storage.chunking import ChunkConfig +from openjarvis.tools.storage.ingest import ingest_path def _get_backend(backend_key: str | None = None): @@ -22,7 +22,7 @@ def _get_backend(backend_key: str | None = None): key = backend_key or config.memory.default_backend # Ensure backends are registered - import openjarvis.memory # noqa: F401 + import openjarvis.tools.storage # noqa: F401 if not MemoryRegistry.contains(key): raise click.ClickException( diff --git a/src/openjarvis/memory/__init__.py b/src/openjarvis/memory/__init__.py deleted file mode 100644 index ece3f224..00000000 --- a/src/openjarvis/memory/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -"""Backward-compatibility shim package — canonical location is openjarvis.tools.storage.""" - -from __future__ import annotations - -# Import from canonical location to trigger backend registration -import openjarvis.tools.storage.sqlite # noqa: F401 - -try: - import openjarvis.tools.storage.bm25 # noqa: F401 -except ImportError: - pass - -try: - import openjarvis.tools.storage.faiss_backend # noqa: F401 -except ImportError: - pass - -try: - import openjarvis.tools.storage.colbert_backend # noqa: F401 -except ImportError: - pass - -try: - import openjarvis.tools.storage.hybrid # noqa: F401 -except ImportError: - pass - -from openjarvis.tools.storage._stubs import MemoryBackend, RetrievalResult -from openjarvis.tools.storage.chunking import Chunk, ChunkConfig, chunk_text -from openjarvis.tools.storage.context import ContextConfig, inject_context -from openjarvis.tools.storage.ingest import ingest_path, read_document - -__all__ = [ - "Chunk", - "ChunkConfig", - "ContextConfig", - "MemoryBackend", - "RetrievalResult", - "chunk_text", - "inject_context", - "ingest_path", - "read_document", -] diff --git a/src/openjarvis/memory/_stubs.py b/src/openjarvis/memory/_stubs.py deleted file mode 100644 index de5235bf..00000000 --- a/src/openjarvis/memory/_stubs.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage._stubs.""" -from openjarvis.tools.storage._stubs import MemoryBackend, RetrievalResult # noqa: F401 - -__all__ = ["MemoryBackend", "RetrievalResult"] diff --git a/src/openjarvis/memory/bm25.py b/src/openjarvis/memory/bm25.py deleted file mode 100644 index f1e88508..00000000 --- a/src/openjarvis/memory/bm25.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage.bm25.""" -from openjarvis.tools.storage.bm25 import BM25Memory # noqa: F401 - -__all__ = ["BM25Memory"] diff --git a/src/openjarvis/memory/chunking.py b/src/openjarvis/memory/chunking.py deleted file mode 100644 index 76a15b20..00000000 --- a/src/openjarvis/memory/chunking.py +++ /dev/null @@ -1,8 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage.chunking.""" -from openjarvis.tools.storage.chunking import ( # noqa: F401 - Chunk, - ChunkConfig, - chunk_text, -) - -__all__ = ["Chunk", "ChunkConfig", "chunk_text"] diff --git a/src/openjarvis/memory/colbert_backend.py b/src/openjarvis/memory/colbert_backend.py deleted file mode 100644 index f36f229c..00000000 --- a/src/openjarvis/memory/colbert_backend.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage.colbert_backend.""" -from openjarvis.tools.storage.colbert_backend import ColBERTMemory # noqa: F401 - -__all__ = ["ColBERTMemory"] diff --git a/src/openjarvis/memory/context.py b/src/openjarvis/memory/context.py deleted file mode 100644 index 05b0b8bb..00000000 --- a/src/openjarvis/memory/context.py +++ /dev/null @@ -1,14 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage.context.""" -from openjarvis.tools.storage.context import ( # noqa: F401 - ContextConfig, - build_context_message, - format_context, - inject_context, -) - -__all__ = [ - "ContextConfig", - "build_context_message", - "format_context", - "inject_context", -] diff --git a/src/openjarvis/memory/embeddings.py b/src/openjarvis/memory/embeddings.py deleted file mode 100644 index 9735377f..00000000 --- a/src/openjarvis/memory/embeddings.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage.embeddings.""" -from openjarvis.tools.storage.embeddings import ( # noqa: F401 - Embedder, - SentenceTransformerEmbedder, -) - -__all__ = ["Embedder", "SentenceTransformerEmbedder"] diff --git a/src/openjarvis/memory/faiss_backend.py b/src/openjarvis/memory/faiss_backend.py deleted file mode 100644 index 9d81c30a..00000000 --- a/src/openjarvis/memory/faiss_backend.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage.faiss_backend.""" -from openjarvis.tools.storage.faiss_backend import FAISSMemory # noqa: F401 - -__all__ = ["FAISSMemory"] diff --git a/src/openjarvis/memory/hybrid.py b/src/openjarvis/memory/hybrid.py deleted file mode 100644 index 4bde1db9..00000000 --- a/src/openjarvis/memory/hybrid.py +++ /dev/null @@ -1,7 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage.hybrid.""" -from openjarvis.tools.storage.hybrid import ( # noqa: F401 - HybridMemory, - reciprocal_rank_fusion, -) - -__all__ = ["HybridMemory", "reciprocal_rank_fusion"] diff --git a/src/openjarvis/memory/ingest.py b/src/openjarvis/memory/ingest.py deleted file mode 100644 index 95dc8b71..00000000 --- a/src/openjarvis/memory/ingest.py +++ /dev/null @@ -1,9 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage.ingest.""" -from openjarvis.tools.storage.ingest import ( # noqa: F401 - DocumentMeta, - detect_file_type, - ingest_path, - read_document, -) - -__all__ = ["DocumentMeta", "detect_file_type", "ingest_path", "read_document"] diff --git a/src/openjarvis/memory/sqlite.py b/src/openjarvis/memory/sqlite.py deleted file mode 100644 index 41731fd9..00000000 --- a/src/openjarvis/memory/sqlite.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Backward-compatibility shim — canonical location is openjarvis.tools.storage.sqlite.""" -from openjarvis.tools.storage.sqlite import SQLiteMemory # noqa: F401 - -__all__ = ["SQLiteMemory"] diff --git a/src/openjarvis/sdk.py b/src/openjarvis/sdk.py index 7512e52b..dfb9e0fa 100644 --- a/src/openjarvis/sdk.py +++ b/src/openjarvis/sdk.py @@ -26,14 +26,14 @@ class MemoryHandle: if self._backend is not None: return self._backend - import openjarvis.memory # noqa: F401 + import openjarvis.tools.storage # noqa: F401 from openjarvis.core.registry import MemoryRegistry key = self._config.memory.default_backend if not MemoryRegistry.contains(key): # Register built-in backends try: - from openjarvis.memory.sqlite import SqliteMemory # noqa: F401 + from openjarvis.tools.storage.sqlite import SQLiteMemory # noqa: F401 except ImportError: pass @@ -56,8 +56,8 @@ class MemoryHandle: chunk_overlap: int = 64, ) -> Dict[str, Any]: """Index a file or directory into memory.""" - from openjarvis.memory.chunking import ChunkConfig - from openjarvis.memory.ingest import ingest_path + from openjarvis.tools.storage.chunking import ChunkConfig + from openjarvis.tools.storage.ingest import ingest_path backend = self._get_backend() cfg = ChunkConfig(chunk_size=chunk_size, chunk_overlap=chunk_overlap) @@ -388,7 +388,10 @@ class Jarvis: if context and self._config.agent.context_from_memory: try: from openjarvis.cli.ask import _get_memory_backend - from openjarvis.memory.context import ContextConfig, inject_context + from openjarvis.tools.storage.context import ( + ContextConfig, + inject_context, + ) backend = _get_memory_backend(self._config) if backend is not None: @@ -428,7 +431,7 @@ class Jarvis: """Inject memory context into messages.""" try: from openjarvis.cli.ask import _get_memory_backend - from openjarvis.memory.context import ContextConfig, inject_context + from openjarvis.tools.storage.context import ContextConfig, inject_context backend = _get_memory_backend(self._config) if backend is not None: diff --git a/src/openjarvis/system.py b/src/openjarvis/system.py index c85ec78c..3046ec7a 100644 --- a/src/openjarvis/system.py +++ b/src/openjarvis/system.py @@ -545,7 +545,7 @@ class SystemBuilder: def _resolve_memory(self, config): """Resolve memory backend.""" try: - import openjarvis.memory # noqa: F401 -- trigger registration + import openjarvis.tools.storage # noqa: F401 -- trigger registration from openjarvis.core.registry import MemoryRegistry key = config.memory.default_backend diff --git a/src/openjarvis/tools/storage/__init__.py b/src/openjarvis/tools/storage/__init__.py index efb737fb..d245b5f9 100644 --- a/src/openjarvis/tools/storage/__init__.py +++ b/src/openjarvis/tools/storage/__init__.py @@ -1,8 +1,4 @@ -"""Storage pillar — persistent searchable storage (canonical location). - -Previously ``openjarvis.memory``, which now re-exports from here for -backward compatibility. -""" +"""Storage pillar — persistent searchable storage.""" from __future__ import annotations diff --git a/tests/cli/test_ask_context.py b/tests/cli/test_ask_context.py index c9023a12..afd3773b 100644 --- a/tests/cli/test_ask_context.py +++ b/tests/cli/test_ask_context.py @@ -31,7 +31,7 @@ def test_get_memory_backend_returns_none_when_empty( """_get_memory_backend returns None when no docs indexed.""" from openjarvis.core.config import JarvisConfig, MemoryConfig from openjarvis.core.registry import MemoryRegistry - from openjarvis.memory.sqlite import SQLiteMemory + from openjarvis.tools.storage.sqlite import SQLiteMemory if not MemoryRegistry.contains("sqlite"): MemoryRegistry.register_value("sqlite", SQLiteMemory) @@ -52,7 +52,7 @@ def test_get_memory_backend_returns_backend_with_docs( """_get_memory_backend returns a backend when docs exist.""" from openjarvis.core.config import JarvisConfig, MemoryConfig from openjarvis.core.registry import MemoryRegistry - from openjarvis.memory.sqlite import SQLiteMemory + from openjarvis.tools.storage.sqlite import SQLiteMemory if not MemoryRegistry.contains("sqlite"): MemoryRegistry.register_value("sqlite", SQLiteMemory) diff --git a/tests/cli/test_memory_cmd.py b/tests/cli/test_memory_cmd.py index d278f387..9de534b2 100644 --- a/tests/cli/test_memory_cmd.py +++ b/tests/cli/test_memory_cmd.py @@ -9,7 +9,7 @@ from click.testing import CliRunner from openjarvis.cli import cli from openjarvis.core.registry import MemoryRegistry -from openjarvis.memory.sqlite import SQLiteMemory +from openjarvis.tools.storage.sqlite import SQLiteMemory def _register_sqlite(): diff --git a/tests/memory/test_bm25.py b/tests/memory/test_bm25.py index 3c04fe54..6209104c 100644 --- a/tests/memory/test_bm25.py +++ b/tests/memory/test_bm25.py @@ -8,7 +8,7 @@ rank_bm25 = pytest.importorskip("rank_bm25") from openjarvis.core.events import EventBus, EventType # noqa: E402 from openjarvis.core.registry import MemoryRegistry # noqa: E402 -from openjarvis.memory.bm25 import BM25Memory # noqa: E402 +from openjarvis.tools.storage.bm25 import BM25Memory # noqa: E402 def _make_backend() -> BM25Memory: @@ -124,7 +124,7 @@ def test_clear(): def test_event_bus_store(): bus = EventBus(record_history=True) backend = _make_backend() - import openjarvis.memory.bm25 as mod + import openjarvis.tools.storage.bm25 as mod original = mod.get_event_bus mod.get_event_bus = lambda: bus @@ -145,7 +145,7 @@ def test_event_bus_retrieve(): bus = EventBus(record_history=True) backend = _make_backend() backend.store("searchable content for events") - import openjarvis.memory.bm25 as mod + import openjarvis.tools.storage.bm25 as mod original = mod.get_event_bus mod.get_event_bus = lambda: bus diff --git a/tests/memory/test_chunking.py b/tests/memory/test_chunking.py index 8e8204a7..35fe3a01 100644 --- a/tests/memory/test_chunking.py +++ b/tests/memory/test_chunking.py @@ -2,7 +2,7 @@ from __future__ import annotations -from openjarvis.memory.chunking import ChunkConfig, chunk_text +from openjarvis.tools.storage.chunking import ChunkConfig, chunk_text def test_empty_string_returns_empty(): diff --git a/tests/memory/test_colbert.py b/tests/memory/test_colbert.py index 340e35e4..598ca52c 100644 --- a/tests/memory/test_colbert.py +++ b/tests/memory/test_colbert.py @@ -10,7 +10,7 @@ import torch # noqa: E402 from openjarvis.core.events import EventBus, EventType # noqa: E402 from openjarvis.core.registry import MemoryRegistry # noqa: E402 -from openjarvis.memory.colbert_backend import ColBERTMemory # noqa: E402 +from openjarvis.tools.storage.colbert_backend import ColBERTMemory # noqa: E402 def _make_backend() -> ColBERTMemory: @@ -128,7 +128,7 @@ def test_clear(): def test_event_bus_store(): bus = EventBus(record_history=True) backend = _make_backend() - import openjarvis.memory.colbert_backend as mod + import openjarvis.tools.storage.colbert_backend as mod original = mod.get_event_bus mod.get_event_bus = lambda: bus @@ -149,7 +149,7 @@ def test_event_bus_retrieve(): bus = EventBus(record_history=True) backend = _make_backend() backend.store("searchable content for events") - import openjarvis.memory.colbert_backend as mod + import openjarvis.tools.storage.colbert_backend as mod original = mod.get_event_bus mod.get_event_bus = lambda: bus diff --git a/tests/memory/test_context.py b/tests/memory/test_context.py index b625bf50..5f7f0a15 100644 --- a/tests/memory/test_context.py +++ b/tests/memory/test_context.py @@ -7,8 +7,8 @@ from typing import Any, Dict, List, Optional from openjarvis.core.events import EventBus, EventType from openjarvis.core.types import Message, Role -from openjarvis.memory._stubs import MemoryBackend, RetrievalResult -from openjarvis.memory.context import ( +from openjarvis.tools.storage._stubs import MemoryBackend, RetrievalResult +from openjarvis.tools.storage.context import ( ContextConfig, build_context_message, format_context, diff --git a/tests/memory/test_embeddings.py b/tests/memory/test_embeddings.py index 405dd09d..ac1562fc 100644 --- a/tests/memory/test_embeddings.py +++ b/tests/memory/test_embeddings.py @@ -6,7 +6,7 @@ import pytest st = pytest.importorskip("sentence_transformers") -from openjarvis.memory.embeddings import ( # noqa: E402 +from openjarvis.tools.storage.embeddings import ( # noqa: E402 Embedder, SentenceTransformerEmbedder, ) diff --git a/tests/memory/test_faiss.py b/tests/memory/test_faiss.py index 9387a76c..a7100ec1 100644 --- a/tests/memory/test_faiss.py +++ b/tests/memory/test_faiss.py @@ -13,9 +13,9 @@ from openjarvis.core.events import ( # noqa: E402 EventType, ) from openjarvis.core.registry import MemoryRegistry # noqa: E402 -from openjarvis.memory._stubs import RetrievalResult # noqa: E402 -from openjarvis.memory.embeddings import Embedder # noqa: E402 -from openjarvis.memory.faiss_backend import ( # noqa: E402 +from openjarvis.tools.storage._stubs import RetrievalResult # noqa: E402 +from openjarvis.tools.storage.embeddings import Embedder # noqa: E402 +from openjarvis.tools.storage.faiss_backend import ( # noqa: E402 FAISSMemory, ) @@ -168,7 +168,7 @@ def test_event_bus_store(): bus = EventBus(record_history=True) backend = _make_backend() - import openjarvis.memory.faiss_backend as mod + import openjarvis.tools.storage.faiss_backend as mod original = mod.get_event_bus mod.get_event_bus = lambda: bus @@ -192,7 +192,7 @@ def test_event_bus_retrieve(): backend = _make_backend() backend.store("searchable content for events") - import openjarvis.memory.faiss_backend as mod + import openjarvis.tools.storage.faiss_backend as mod original = mod.get_event_bus mod.get_event_bus = lambda: bus diff --git a/tests/memory/test_hybrid.py b/tests/memory/test_hybrid.py index d7157da9..dc2f5223 100644 --- a/tests/memory/test_hybrid.py +++ b/tests/memory/test_hybrid.py @@ -7,8 +7,8 @@ from typing import Any, Dict, List, Optional from openjarvis.core.events import EventBus, EventType from openjarvis.core.registry import MemoryRegistry -from openjarvis.memory._stubs import MemoryBackend, RetrievalResult -from openjarvis.memory.hybrid import ( +from openjarvis.tools.storage._stubs import MemoryBackend, RetrievalResult +from openjarvis.tools.storage.hybrid import ( HybridMemory, reciprocal_rank_fusion, ) diff --git a/tests/memory/test_ingest.py b/tests/memory/test_ingest.py index 7969a16a..665a2e27 100644 --- a/tests/memory/test_ingest.py +++ b/tests/memory/test_ingest.py @@ -6,7 +6,7 @@ from pathlib import Path import pytest -from openjarvis.memory.ingest import ( +from openjarvis.tools.storage.ingest import ( detect_file_type, ingest_path, read_document, diff --git a/tests/memory/test_retrieval_quality.py b/tests/memory/test_retrieval_quality.py index b537618f..d520c378 100644 --- a/tests/memory/test_retrieval_quality.py +++ b/tests/memory/test_retrieval_quality.py @@ -5,7 +5,7 @@ from __future__ import annotations import pytest from openjarvis.core.registry import MemoryRegistry -from openjarvis.memory.sqlite import SQLiteMemory +from openjarvis.tools.storage.sqlite import SQLiteMemory # --------------------------------------------------------------------------- # Shared corpus @@ -38,7 +38,9 @@ def _make_sqlite(tmp_path): def _make_bm25(): - bm25_mod = pytest.importorskip("openjarvis.memory.bm25", exc_type=ImportError) + bm25_mod = pytest.importorskip( + "openjarvis.tools.storage.bm25", exc_type=ImportError, + ) BM25Memory = bm25_mod.BM25Memory if not MemoryRegistry.contains("bm25"): MemoryRegistry.register_value("bm25", BM25Memory) diff --git a/tests/memory/test_sqlite.py b/tests/memory/test_sqlite.py index 13ea57f9..93cc03bc 100644 --- a/tests/memory/test_sqlite.py +++ b/tests/memory/test_sqlite.py @@ -6,7 +6,7 @@ from pathlib import Path from openjarvis.core.events import EventBus, EventType from openjarvis.core.registry import MemoryRegistry -from openjarvis.memory.sqlite import SQLiteMemory +from openjarvis.tools.storage.sqlite import SQLiteMemory def _make_backend(tmp_path: Path) -> SQLiteMemory: diff --git a/tests/memory/test_storage_suite.py b/tests/memory/test_storage_suite.py index 7bc00b90..2f827660 100644 --- a/tests/memory/test_storage_suite.py +++ b/tests/memory/test_storage_suite.py @@ -5,7 +5,7 @@ from __future__ import annotations import pytest from openjarvis.core.registry import MemoryRegistry -from openjarvis.memory.sqlite import SQLiteMemory +from openjarvis.tools.storage.sqlite import SQLiteMemory # --------------------------------------------------------------------------- # Backend factory helpers @@ -19,7 +19,9 @@ def _make_sqlite(tmp_path): def _make_bm25(): - bm25_mod = pytest.importorskip("openjarvis.memory.bm25", exc_type=ImportError) + bm25_mod = pytest.importorskip( + "openjarvis.tools.storage.bm25", exc_type=ImportError, + ) BM25Memory = bm25_mod.BM25Memory if not MemoryRegistry.contains("bm25"): MemoryRegistry.register_value("bm25", BM25Memory) @@ -33,13 +35,22 @@ def _make_backend(key, tmp_path): elif key == "bm25": return _make_bm25() elif key == "faiss": - mod = pytest.importorskip("openjarvis.memory.faiss", exc_type=ImportError) + mod = pytest.importorskip( + "openjarvis.tools.storage.faiss_backend", + exc_type=ImportError, + ) return mod.FAISSMemory(db_path=str(tmp_path / "faiss")) elif key == "colbert": - mod = pytest.importorskip("openjarvis.memory.colbert", exc_type=ImportError) + mod = pytest.importorskip( + "openjarvis.tools.storage.colbert_backend", + exc_type=ImportError, + ) return mod.ColBERTMemory(db_path=str(tmp_path / "colbert")) elif key == "hybrid": - mod = pytest.importorskip("openjarvis.memory.hybrid", exc_type=ImportError) + mod = pytest.importorskip( + "openjarvis.tools.storage.hybrid", + exc_type=ImportError, + ) sqlite = _make_sqlite(tmp_path) bm25 = _make_bm25() return mod.HybridMemory(backends=[sqlite, bm25]) diff --git a/tests/test_integration_extended.py b/tests/test_integration_extended.py index 90e8aced..6d4c009c 100644 --- a/tests/test_integration_extended.py +++ b/tests/test_integration_extended.py @@ -399,7 +399,7 @@ class TestMemoryPipeline: """Index and retrieve across available backends.""" def test_sqlite_index_and_retrieve(self, tmp_path): - from openjarvis.memory.sqlite import SQLiteMemory + from openjarvis.tools.storage.sqlite import SQLiteMemory backend = SQLiteMemory(db_path=str(tmp_path / "mem.db")) backend.store( @@ -416,7 +416,7 @@ class TestMemoryPipeline: def test_bm25_index_and_retrieve(self, tmp_path): try: - from openjarvis.memory.bm25 import BM25Memory + from openjarvis.tools.storage.bm25 import BM25Memory except ImportError: pytest.skip("rank_bm25 not installed") diff --git a/tests/tools/test_retrieval.py b/tests/tools/test_retrieval.py index 347e31ef..eaac1847 100644 --- a/tests/tools/test_retrieval.py +++ b/tests/tools/test_retrieval.py @@ -4,8 +4,8 @@ from __future__ import annotations from typing import Any, Dict, List, Optional -from openjarvis.memory._stubs import MemoryBackend, RetrievalResult from openjarvis.tools.retrieval import RetrievalTool +from openjarvis.tools.storage._stubs import MemoryBackend, RetrievalResult class _FakeBackend(MemoryBackend): diff --git a/tests/tools/test_storage_stubs.py b/tests/tools/test_storage_stubs.py index 1ad11ab7..ba63793f 100644 --- a/tests/tools/test_storage_stubs.py +++ b/tests/tools/test_storage_stubs.py @@ -65,8 +65,8 @@ class TestStorageStubs: def test_backward_compat_import(self) -> None: """Memory imports should still work via shim.""" - from openjarvis.memory._stubs import MemoryBackend as MB - from openjarvis.memory._stubs import RetrievalResult as RR + from openjarvis.tools.storage._stubs import MemoryBackend as MB + from openjarvis.tools.storage._stubs import RetrievalResult as RR assert MB is MemoryBackend assert RR is RetrievalResult @@ -76,7 +76,7 @@ class TestStorageStubs: assert MB is MemoryBackend def test_sqlite_backward_compat(self) -> None: - """SQLiteMemory should be importable from both locations.""" - from openjarvis.memory.sqlite import SQLiteMemory as S2 + """SQLiteMemory should be importable from the canonical location.""" from openjarvis.tools.storage.sqlite import SQLiteMemory as S1 - assert S1 is S2 + + assert S1 is not None