JVMTextDocumentEmbedder

A specialization of TextDocumentEmbedder designed for embedding and processing text documents in JVM-based file systems. It leverages a JVMDocumentProvider to read content from Path objects and uses an Embedder for generating and comparing vector embeddings of the text content.

This class enables the transformation of text documents into vector representations and provides utilities for measuring the similarity or difference between the embeddings of different documents.

Parameters

embedder

The Embedder used for generating vector embeddings and comparing embeddings.

Constructors

Link copied to clipboard
constructor(embedder: Embedder)

Creates a JVMTextDocumentEmbedder with the specified embedder.

Functions

Link copied to clipboard
open override fun diff(embedding1: Vector, embedding2: Vector): Double

Calculates the difference between two embeddings using the underlying embedder. Lower values indicate more similarity between the embeddings.

Link copied to clipboard
open suspend override fun embed(document: Path): Vector

Converts the given document into its vector representation.

open suspend override fun embed(text: String): Vector

Embeds the given text into a vector representation.