Crate rag_plusplus_core

Crate rag_plusplus_core 

Source
Expand description

RAG++ Core Library

High-performance retrieval engine for memory-conditioned candidate selection.

§Overview

RAG++ retrieves outcome-annotated trajectories and provides statistical priors for downstream conditioning. It does NOT train models - pure retrieval + statistics.

§Invariants

  • INV-001: Record immutability after creation
  • INV-002: Welford numerical stability
  • INV-003: WAL-before-buffer for durability
  • INV-004: Index-record consistency

§Modules

  • types: Core data structures (MemoryRecord, QueryBundle, PriorBundle)
  • stats: Outcome statistics with Welford’s algorithm
  • error: Error types and Result aliases
  • index: Vector index implementations (Flat, HNSW)
  • filter: Metadata filter expressions and evaluation
  • store: Record storage (in-memory, persistent)
  • wal: Write-ahead log for durability
  • buffer: Write buffering for batched operations
  • retrieval: Query execution and reranking
  • cache: Query result caching
  • observability: Metrics and tracing
  • eval: Evaluation metrics and benchmarking
  • api: Public API contracts and traits
  • trajectory: Trajectory memory algorithms (DAG traversal, phase inference, salience)
  • distance: Vector distance operations with SIMD and batch support

Re-exports§

pub use buffer::BufferStats;
pub use buffer::WriteBuffer;
pub use buffer::WriteBufferConfig;
pub use cache::CacheConfig;
pub use cache::CacheKey;
pub use cache::CacheStats;
pub use cache::QueryCache;
pub use error::Error;
pub use error::Result;
pub use filter::CompiledFilter;
pub use filter::FilterEvaluator;
pub use filter::FilterExpr;
pub use filter::FilterOp;
pub use filter::FilterValue;
pub use index::DistanceType;
pub use index::FlatIndex;
pub use index::FusedResult;
pub use index::FusionConfig;
pub use index::FusionStrategy;
pub use index::HNSWConfig;
pub use index::HNSWIndex;
pub use index::IndexConfig;
pub use index::IndexInfo;
pub use index::IndexRegistry;
pub use index::MultiIndexResult;
pub use index::MultiIndexResults;
pub use index::ParallelSearchConfig;
pub use index::ParallelSearcher;
pub use index::ResultsAggregator;
pub use index::ScoreFusion;
pub use index::SearchResult;
pub use index::SharedRegistry;
pub use index::VectorIndex;
pub use index::parallel_add_batch;
pub use index::rrf_fuse;
pub use index::rrf_fuse_top_k;
pub use index::shared_registry;
pub use stats::OutcomeStats;
pub use store::InMemoryStore;
pub use store::RecordStore;
pub use store::SharedStore;
pub use types::MemoryRecord;
pub use types::PriorBundle;
pub use types::QueryBundle;
pub use types::RecordId;
pub use types::VectorRef;
pub use observability::Metrics;
pub use observability::MetricsConfig;
pub use observability::QuerySpan;
pub use observability::SpanContext;
pub use retrieval::QueryEngine;
pub use retrieval::QueryEngineConfig;
pub use retrieval::QueryRequest;
pub use retrieval::QueryResponse;
pub use retrieval::Reranker;
pub use retrieval::RerankerConfig;
pub use retrieval::RerankerType;
pub use wal::WalConfig;
pub use wal::WalEntry;
pub use wal::WalEntryType;
pub use wal::WalReader;
pub use wal::WalWriter;
pub use eval::Evaluator;
pub use eval::EvaluationSummary;
pub use eval::QueryEvaluation;
pub use eval::Benchmarker;
pub use eval::BenchmarkResult;
pub use trajectory::TrajectoryGraph;
pub use trajectory::Episode;
pub use trajectory::Edge;
pub use trajectory::EdgeType;
pub use trajectory::NodeId as EpisodeId;
pub use trajectory::PathSelectionPolicy;
pub use trajectory::TraversalOrder;
pub use trajectory::BranchInfo;
pub use trajectory::PathResult;
pub use trajectory::TrajectoryPhase;
pub use trajectory::PhaseInferencer;
pub use trajectory::PhaseConfig;
pub use trajectory::TurnFeatures;
pub use trajectory::PhaseTransition;
pub use trajectory::SalienceScorer;
pub use trajectory::SalienceConfig;
pub use trajectory::SalienceFactors;
pub use trajectory::TurnSalience;
pub use trajectory::CorpusSalienceStats;
pub use trajectory::Feedback;
pub use trajectory::TrajectoryCoordinate;
pub use trajectory::NormalizedCoordinate;
pub use trajectory::compute_trajectory_coordinates;
pub use trajectory::TrajectoryCoordinate5D;
pub use trajectory::NormalizedCoordinate5D;
pub use trajectory::Ring;
pub use trajectory::RingNode;
pub use trajectory::EpisodeRing;
pub use trajectory::build_weighted_ring;
pub use trajectory::DualRing;
pub use trajectory::DualRingNode;
pub use trajectory::build_dual_ring;
pub use trajectory::build_dual_ring_with_attention;
pub use trajectory::ConservationMetrics;
pub use trajectory::ConservationViolation;
pub use trajectory::ConservationConfig;
pub use trajectory::ConservationTracker;
pub use trajectory::weighted_centroid;
pub use trajectory::weighted_covariance;
pub use trajectory::PathQuality;
pub use trajectory::PathQualityWeights;
pub use trajectory::PathQualityFactors;
pub use trajectory::ConversationPhase;Deprecated
pub use distance::l2_distance;
pub use distance::l2_distance_squared;
pub use distance::inner_product;
pub use distance::cosine_similarity;
pub use distance::cosine_distance;
pub use distance::norm;
pub use distance::norm_squared;
pub use distance::normalize;
pub use distance::normalize_in_place;
pub use distance::normalize_batch;
pub use distance::normalize_batch_flat;
pub use distance::compute_norms_batch;
pub use distance::find_unnormalized;
pub use distance::l2_distance_fast;
pub use distance::inner_product_fast;
pub use distance::cosine_similarity_fast;
pub use distance::cosine_distance_fast;
pub use distance::norm_fast;
pub use distance::normalize_in_place_fast;
pub use distance::normalize_batch_flat_fast;
pub use distance::compute_norms_batch_fast;
pub use distance::normalize_batch_parallel;
pub use distance::compute_distance;
pub use distance::compute_distance_for_heap;
pub use distance::trajectory_weighted_cosine;
pub use distance::trajectory_weighted_cosine_5d;
pub use distance::trajectory_weighted_l2;
pub use distance::trajectory_weighted_inner_product;
pub use distance::trajectory_weighted_distance;
pub use distance::TrajectoryDistanceConfig;
pub use api::RetrievalRequest;
pub use api::RetrievalResponse;
pub use api::PriorBundle as ApiPriorBundle;
pub use api::RankedCandidate;
pub use api::FilterExpression;
pub use api::FilterValue as ApiFilterValue;
pub use api::IngestRecord;
pub use api::MetadataValue as ApiMetadataValue;
pub use api::RetrievalEngine;
pub use api::Corpus;
pub use api::VectorSearcher;
pub use api::SearchHit;
pub use api::RAGBuilder;
pub use api::IndexType;

Modules§

api
RAG++ Public API Contracts
buffer
Write Buffer Module
cache
Caching Module
distance
Distance Computation Module
error
RAG++ Error Types
eval
Evaluation Module for RAG++
filter
Filter Engine
index
Index Module
observability
Observability Module
retrieval
Retrieval Module
stats
Outcome Statistics with Welford’s Online Algorithm
store
Record Storage Module
trajectory
Trajectory Memory Module
types
Core Data Types
wal
Write-Ahead Log (WAL)

Macros§

ragpp_event
Log structured event.