io library

File persistence for InMemoryVectorStore, for the Dart VM and Flutter.

This library re-exports all of package:rag_kit/rag_kit.dart and adds InMemoryVectorStoreFiles. It depends on dart:io and therefore does not work on the web; web applications should import package:rag_kit/rag_kit.dart and persist the result of InMemoryVectorStore.toBytes themselves, for example in IndexedDB.

Classes

Chunk
A piece of a source text with its exact position in that source.
Chunker
Splits a source text into Chunks.
Document
A text passage stored in a vector store together with its embedding.
InMemoryVectorStore
A VectorStore that keeps everything in memory.
Retriever
Wires a Chunker, an Embedder, and a VectorStore into a retrieval pipeline: add texts once, then retrieve the passages most relevant to a query.
ScoredChunk
A search result: a stored document and its similarity to the query.
VectorStore
Stores embedded documents and finds the ones most similar to a query vector.

Extensions

InMemoryVectorStoreFiles on InMemoryVectorStore
Saves and loads an InMemoryVectorStore as a file in the rag_kit binary format described at InMemoryVectorStore.toBytes.

Typedefs

Embedder = Future<List<List<double>>> Function(List<String> texts)
Embeds a batch of texts into vectors.