-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
81 lines (67 loc) · 2.19 KB
/
Copy path__init__.py
File metadata and controls
81 lines (67 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"""TurboMemory - Lightweight semantic storage engine with compressed embeddings.
TurboMemory is a lightweight semantic storage engine that combines:
- SQLite metadata indexing
- Packed embedding storage (4/6/8-bit TurboQuant compression)
- Append-only transaction logs for replication
- Hybrid search (BM25 + vector fusion)
- Portable TMF format for easy data portability
Usage:
from turbomemory import TurboMemory
tm = TurboMemory(root="./data")
tm.add_memory("topic", "Your text here")
results = tm.query("search query")
"""
# Try to use turboquant if available, fallback to internal
try:
from turboquant import quantize as _quantize, dequantize as _dequantize, Quantizer as _Quantizer
quantize_packed = _quantize
dequantize_packed = _dequantize
Quantizer = _Quantizer
except ImportError:
from .quantization import quantize_packed, dequantize_packed, Quantizer
from .core import TurboMemory, TurboMemoryConfig, ExclusionRules, QualityScore, VerificationResult, MemoryMetrics
from .storage import StorageManager, SQLitePool, RetryConfig, MigrationManager
from .retrieval import RetrievalEngine, cosine_similarity
from .formats import TMFFormat, TMFIndex, TMFVectorStore, TMFEventLog, validate_format
from .replication import TurboSync, create_sync
from .hybrid_search import HybridSearch, BM25, HybridSearchEngine
__version__ = "0.5.1"
__author__ = "Kubenew"
__description__ = "Lightweight semantic storage with TurboQuant compression"
# Alias for compatibility
cosine_sim = cosine_similarity
__all__ = [
# Core
"TurboMemory",
"TurboMemoryConfig",
"ExclusionRules",
"QualityScore",
"VerificationResult",
"MemoryMetrics",
# Quantization
"quantize_packed",
"dequantize_packed",
"Quantizer",
"cosine_sim",
# Storage
"StorageManager",
"SQLitePool",
"RetryConfig",
"MigrationManager",
# Retrieval
"RetrievalEngine",
"cosine_similarity",
# TMF Format
"TMFFormat",
"TMFIndex",
"TMFVectorStore",
"TMFEventLog",
"validate_format",
# Replication
"TurboSync",
"create_sync",
# Hybrid Search
"HybridSearch",
"BM25",
"HybridSearchEngine",
]