Skip to main content
The embeddings() method converts text into high-dimensional vectors that capture semantic meaning, enabling similarity search, clustering, and RAG (Retrieval-Augmented Generation).

Basic Embeddings

Multiple Inputs

Generate embeddings for multiple texts at once:
Batch multiple texts together for better performance and lower costs.

Custom Dimensions

Control the embedding vector size:

Dimension Trade-offs

Higher dimensions capture more nuance but require more storage and slower search. Start with 1024 for most use cases.

Encoding Format

Choose output format:

Format Options

Parameters

Request Parameters

Response

Use Cases

Find similar documents:

RAG (Retrieval-Augmented Generation)

Combine embeddings with chat for context-aware responses:

Clustering

Group similar texts:

Duplicate Detection

Find duplicate or near-duplicate content:

Recommendation System

Recommend similar items:

Best Practices

1. Batch Inputs for Efficiency

2. Normalize Text First

3. Cache Embeddings

4. Choose Appropriate Dimensions

5. Always Handle Errors

Advanced Usage

Vector Database Integration

Store embeddings in a vector database:

Override Model

Use a specific embedding model:

Custom Metadata

Track embedding generation:

Next Steps

Chat

Use embeddings with RAG

OCR

Extract text to embed

Gates & Routing

How Verlon routes embedding requests

Cost Tracking

Monitor embedding costs