Skip to main content

Module vector_store

Module vector_store 

Source
Expand description

Vector Memory System

Semantic vector storage for code search and memory. Local-first design - no external server required.

Uses brute-force cosine similarity search, which is efficient for collections up to ~100k vectors. For larger collections, consider integrating an HNSW library like hnsw_rs or instant-distance.

Features:

  • Code chunking strategies (functions, structs, modules)
  • Embedding generation interface (pluggable backends)
  • Similarity search with filters
  • Collection management (project, session, global)
  • Persistence to disk

Structs§

BoundedVectorStore
A capacity-limited wrapper around VectorStore that evicts the oldest items (FIFO order) when the total number of chunks exceeds max_items.
ChunkMetadata
Metadata for a code chunk
CodeChunk
A chunk of code with its embedding
CodeChunker
Code chunker for splitting code into meaningful pieces
CollectionStats
Statistics for a collection
MockEmbeddingProvider
Mock embedding provider for testing
SearchFilter
Filter for search queries
SearchResult
Search result with similarity score
TfIdfEmbeddingProvider
Simple TF-IDF based embedding provider (no external dependencies)
VectorCollection
Vector collection
VectorIndex
Vector index using simple brute-force search
VectorStore
Main vector store
VectorStoreStats
Statistics for vector store

Enums§

ChunkType
Chunk types for code organization
CollectionScope
Collection scope for organizing chunks
EmbeddingBackend
Enum dispatch for embedding providers.
IndexHealth
Health status of a vector index

Constants§

DEFAULT_MAX_ITEMS
Default maximum number of items across all collections in a bounded store.
EMBEDDING_DIM
Embedding dimension (common for small models)
MAX_CHUNKS
Maximum chunks per collection
MAX_VOCABULARY_SIZE
Maximum vocabulary size for TF-IDF provider before eviction occurs

Traits§

EmbeddingProvider
Trait for embedding generation.