rag-plusplus
High-performance retrieval for memory-conditioned selection with Python bindings to a Rust core.
Installation
pip install rag-plusplus
Features
- SIMD-accelerated vector search - AVX2-optimized distance calculations
- HNSW indexing - Approximate nearest neighbor with sub-linear scaling
- Trajectory coordinates - 5D positioning for conversation context
- IRCP propagator - Information-Relevance Causal Propagation
- Salience scoring - Turn importance with recency decay
- Chain management - Cross-conversation knowledge links
Quick Start
import numpy as np
from rag_plusplus import HNSWIndex, FlatIndex, InMemoryStore, MemoryRecord
# Create an HNSW index for fast approximate search
index = HNSWIndex(dimension=128, m=16, ef_construction=200)
# Add vectors
for i in range(1000):
vec = np.random.randn(128).astype(np.float32)
index.add(f"vec_{i}", vec)
# Search
query = np.random.randn(128).astype(np.float32)
results = index.search(query, k=10)
for result in results:
print(f"{result.id}: score={result.score:.4f}")
Trajectory Coordinates
from rag_plusplus import TrajectoryCoordinate5D, trajectory_weighted_cosine_5d
# Create 5D trajectory coordinates
# (depth, sibling_order, homogeneity, temporal, complexity)
coord1 = TrajectoryCoordinate5D(3, 0, 0.9, 0.7, 1)
coord2 = TrajectoryCoordinate5D(4, 1, 0.8, 0.6, 2)
# Trajectory-weighted similarity
score = trajectory_weighted_cosine_5d(vec1, vec2, coord1, coord2, coord_weight=0.3)
IRCP Propagation
from rag_plusplus import IRCPPropagator, IRCPConfig
config = IRCPConfig() # temperature=1.0, spatial_weight=0.3
propagator = IRCPPropagator(config)
# Propagate attention through conversation turns
# attention_weights = propagator.propagate(...)
Available Classes
Core
HNSWIndex- Hierarchical Navigable Small World graph for ANNFlatIndex- Exact brute-force searchInMemoryStore- Fast in-memory record storageMemoryRecord- Record with embedding and outcomeQueryCache- LRU cache with TTL
Trajectory
TrajectoryCoordinate- 4D coordinate (depth, sibling, homogeneity, temporal)TrajectoryCoordinate5D- 5D coordinate (+complexity)TrajectoryPhase- Conversation phase enumPhaseInferencer- Infer phase from turn features
IRCP & Salience
IRCPPropagator- Attention propagationSalienceScorer- Turn importance scoringTurnSalience- Salience result with factors
Chain Systems
ChainManager- Cross-conversation chain managementChainLinkEstimator- Link strength estimationTrajectoryGraph- Episode graph structure
Performance
The Rust core provides:
- ~10x faster vector distance than pure Python
- Sub-linear search with HNSW indexing
- Zero-copy numpy array handling
- Parallel search across multiple indexes
License
MIT
Metadata
Release files for rag-plusplus 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rag_plusplus-0.1.0.tar.gz | 227.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rag_plusplus-0.1.0-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 833.3 kB
Release files / rag_plusplus-0.1.0.tar.gz
| Download URL | rag_plusplus-0.1.0.tar.gz |
|---|---|
| Size | 227.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea3cfd733149c6847149bb32ff489ab595bceeec800b52d7dd2b8134bf1d316a
|
|
BLAKE2b-256 checksum How to use checksums |
551e164d83c07159926ef6f9b77046f7d7de154e96d2bcbbf64afe51e549cf14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|
Release files / rag_plusplus-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | rag_plusplus-0.1.0-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 606.1 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e78bec0cb75d134225d8c0a3210a145364ca4725965174cc50c77d7c3dca039c
|
|
BLAKE2b-256 checksum How to use checksums |
1f600121821799ff2086e24bc314a36f502e4c7f2c4e141efd4bb29214602ac1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.10.2
|