JVMTextFileDocumentEmbeddingStorage

A JVM-specific implementation of TextFileDocumentEmbeddingStorage tailored for text document embedding and storage within a file system. This class utilizes a JVMDocumentProvider to handle document reading and manages embeddings using a provided Embedder.

This storage solution is designed for efficient document querying and retrieval based on embeddings derived from textual content.

Parameters

embedder

The embedding implementation used to generate and compare vector embeddings.

root

The root directory where the document storage system is initialized.

Constructors

Link copied to clipboard
constructor(embedder: Embedder, root: Path)

Creates an instance of JVMTextFileDocumentEmbeddingStorage.

Functions

Link copied to clipboard
open override fun allDocuments(): Flow<Path>

Retrieves a flow of all documents stored in the system.

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

Deletes the document with the specified ID from the storage.

Link copied to clipboard
open suspend override fun getPayload(documentId: String)
Link copied to clipboard
open override fun rankDocuments(query: String): Flow<RankedDocument<Path>>

Ranks documents based on their similarity to a given query string.

Link copied to clipboard
open suspend override fun read(documentId: String): Path?

Reads a document by its unique identifier.

Link copied to clipboard
open suspend override fun readWithPayload(documentId: String): DocumentWithPayload<Path, Unit>?
Link copied to clipboard
open suspend fun store(document: Path): String

open suspend override fun store(document: Path, data: Unit): String

Stores the given document after embedding it into a vector representation.