Documentation/Embedding

Embedding

Experimental1 credit

Embedding - generates dense vector embeddings with Matryoshka dimension support. Choose your embedding dimension (256, 512, 768, or 1024) to balance between quality and performance.

Production Recommendation

This is a direct endpoint for development and testing. For production workloads, use the Data Intelligence Pipeline -- it provides structured Data Packages with quality metrics, is async by default, and is covered by Enterprise SLAs.

Overview

The Embedding service generates dense vector embeddings with Matryoshka dimension support. Choose your embedding dimension (256, 512, 768, or 1024) to balance between quality and performance.

Key features:

  • Matryoshka embeddings - flexible dimensions (256-1024)
  • Automatic base64 decoding in SDK (returns float arrays)
  • High-throughput batch processing
  • Optimized for semantic search and retrieval

API Reference

POSThttps://api.latence.ai/api/v1/embedding/embed
Generate dense vector embeddings for text

Request Parameters

ParameterTypeRequiredDefaultDescription
textstringInput text (1-100,000 chars)
dimensionintegerEmbedding dimension: 256, 512, 768, or 1024
encoding_formatstringOutput format: float or base64

Response Fields

FieldTypeDescription

Response Example

200 OKJSON
{
  "embeddings": [[0.123, -0.456, 0.789, ...]],
  "dimension": 512,
  "shape": [1, 512],
  "encoding_format": "float",
  "success": true,
  "usage": { "credits": 0.1 }
}

Code Examples

from latence import Latence

client = Latence(api_key="YOUR_API_KEY")

# Generate embeddings with Matryoshka dimension support
result = client.experimental.embedding.embed(
    text="Artificial intelligence is transforming how we process information.",
    dimension=512  # Choose from 256, 512, 768, 1024
)

print(result.embeddings)  # Float array
print(result.shape)       # [1, 512]

Explore Tutorials & Notebooks

Deep-dive examples and interactive notebooks in our GitHub repository

View on GitHub

Looking for production-grade processing?

The Data Intelligence Pipeline chains services automatically and returns structured Data Packages.