VectorStorageBackend

Low-level storage interface for documents and their pre-computed vector embeddings.

Implementations handle only persistence — no embedding logic. The embedding step is handled by ai.koog.rag.vector.storage.EmbeddingStorage which composes an embedder with a VectorStorageBackend.

Type Parameters

Document

The type of the document being stored.

Inheritors

Functions

Link copied to clipboard
abstract fun allDocuments(): Flow<Document>

Retrieves a flow of all documents.

Link copied to clipboard

Retrieves a flow of all documents with their vector embeddings.

Link copied to clipboard
abstract suspend fun delete(documentId: String): Boolean

Deletes the document with the specified ID.

Link copied to clipboard
abstract suspend fun read(documentId: String): Document?

Reads a document by its unique identifier.

Link copied to clipboard
abstract suspend fun readWithPayload(documentId: String): DocumentWithPayload<Document, Vector>?

Reads a document along with its vector embedding by document ID.

Link copied to clipboard
abstract suspend fun store(document: Document, vector: Vector): String

Stores a document along with its pre-computed vector embedding.

abstract suspend fun store(id: String, document: Document, vector: Vector): Boolean

Updates a document along with its pre-computed vector embedding under the specified ID. Only updates if a document with the given ID already exists.