InMemoryVectorStore class

A simple, local, list-backed Vector Store.

Automatically generates embeddings using the provided AIProvider and performs brute-force cosine similarity searches in runtime memory. Suitable for small-scale RAG on device without external dependencies.

Implemented types

Constructors

InMemoryVectorStore({required AIEmbeddingProvider embedder})

Properties

documents List<AIDocument>
Returns all currently stored documents.
no setter
embedder AIEmbeddingProvider
The provider used to generate text embeddings.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addDocuments(List<AIDocument> docs) Future<void>
Adds documents to the store. Implementation should compute embeddings if the document doesn't have them yet.
override
clear() Future<void>
Deletes all documents in this store.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
similaritySearch(String query, {int limit = 4}) Future<List<AIDocument>>
Searches for the most similar documents to the given query.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited