Interface RetrievedVectorDocument

Represents a single document retrieved from a query, including its similarity score.

RetrievedVectorDocument

interface RetrievedVectorDocument {
    id: string;
    embedding: number[];
    metadata?: Record<string, MetadataValue>;
    textContent?: string;
    similarityScore: number;
}

Hierarchy (view full)

Properties

id: string

A unique identifier for the document.

embedding: number[]

The vector embedding of the document's content.

metadata?: Record<string, MetadataValue>

A flexible key-value store for document metadata. Values can be scalars or arrays of scalars. Used for filtering and providing context.

textContent?: string

Optional: The raw text content of the document. Some use cases might store this alongside the embedding, while others might fetch it from a primary store using the ID.

similarityScore: number

The similarity score of this document with respect to the query vector. The meaning of this score depends on the similarity metric used by the vector store (e.g., cosine similarity, Euclidean distance).