Skip to main content

Module vector_store

Module vector_store 

Source
Expand description

Vector-store insertion and similarity-search interfaces. VectorStoreIndex implementations also implement Tool when their filter is deserializable and uses JSON values.

use rig_core::vector_store::in_memory_store::InMemoryVectorStore;

let store = InMemoryVectorStore::<String>::from_documents([]);
assert!(store.is_empty());

Re-exports§

pub use request::VectorSearchRequest;

Modules§

in_memory_store
In-memory vector storage with cosine scoring. A search scores every document by default; InMemoryVectorStore::builder opts into scoring only approximate candidates (IndexStrategy::LSH) on large stores.
lsh
Random-projection hashing for approximate vector-search candidates.
request
Vector-search requests and composable metadata filters.

Structs§

VectorSearchIdResult
One document ID returned by VectorStoreIndex::top_n_ids.
VectorSearchResult
One document returned by VectorStoreIndex::top_n.

Enums§

IndexStrategy
How the in-memory vector store picks the documents a search scores.
VectorStoreError
Errors from vector store operations.

Traits§

InsertDocuments
Trait for inserting documents and embeddings into a vector store.
VectorStoreIndex
Trait for querying a vector store by similarity.

Functions§

flatten_embedded
Serializes each document to JSON once, then applies f to every (document, embedding) pair, flattening the results into a single vector.