Package-level declarations

Types

Link copied to clipboard

Represents a generic storage system for documents, without the need for additional metadata or payloads. This interface provides basic document storage operations such as storing, retrieving, and deleting documents.

Link copied to clipboard

Defines a generic interface for document storage systems, supporting storing, retrieving, updating, and deleting documents. Each document can be associated with metadata or additional payload.

Link copied to clipboard
data class DocumentWithPayload<Document, Payload>(val document: Document, val payload: Payload)

Represents a document accompanied by its associated payload.

Link copied to clipboard
data class RankedDocument<Document>(val document: Document, val similarity: Double)

Represents a document ranked by its similarity score.

Link copied to clipboard

Represents a specialization of the DocumentStorage interface that handles ranking documents based on their relevance to a given query. The ranking process returns documents along with a similarity score, enabling the filtering and sorting of documents by relevance.

Functions

Link copied to clipboard
suspend fun <Document> RankedDocumentStorage<Document>.mostRelevantDocuments(query: String, count: Int = Int.MAX_VALUE, similarityThreshold: Double = 0.0): Iterable<Document>

Retrieves the most relevant documents matching the provided query, ranked by their similarity scores in descending order. Only documents with a similarity score greater than or equal to the specified similarity threshold are included, and the result set is limited to the specified count.