mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-30 10:52:15 +00:00
refactor: remove memory/ backward-compat shim package
Delete the entire src/openjarvis/memory/ directory (11 files) which was a pure re-export shim pointing to openjarvis.tools.storage.*. Update all imports across src/ and tests/ to use the canonical openjarvis.tools.storage imports directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
cf12b9b28c
commit
1e7d0fe1de
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
@@ -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"]
|
||||
@@ -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"]
|
||||
@@ -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"]
|
||||
@@ -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"]
|
||||
@@ -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",
|
||||
]
|
||||
@@ -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"]
|
||||
@@ -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"]
|
||||
@@ -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"]
|
||||
@@ -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"]
|
||||
@@ -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"]
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user