Skip to main content

Overview

The Embeddings module provides base classes and interfaces for generating vector embeddings from text. Embeddings are used to convert text into numerical vectors for semantic search and retrieval.

BaseEmbedding

Abstract base class that all embedding implementations extend.

Properties

number
default:10
Number of texts to embed in a single batch
EmbeddingInfo
Metadata about the embedding model

Methods

method
Get embedding for a single text string
method
Get embeddings for multiple texts (batch processing)
method
Get embeddings for texts with batching and progress tracking
method
Get embedding for a query (supports multi-modal content)
method
Calculate similarity between two embedding vectors

Usage Examples

Basic Embedding

Batch Embedding with Progress

Embedding Nodes

The BaseEmbedding class extends TransformComponent and can embed nodes directly:

Similarity Calculation

Similarity Types

Token Truncation

Embeddings automatically truncate text that exceeds the model’s token limit: