Generate text embeddings for semantic search and RAG applications
const url = 'https://dashboard.quantcdn.io/api/v3/organizations/example/ai/embeddings';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"input":"The Australian government announced new climate policy","modelId":"amazon.titan-embed-text-v2:0","dimensions":1024,"normalize":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://dashboard.quantcdn.io/api/v3/organizations/example/ai/embeddings \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "input": "The Australian government announced new climate policy", "modelId": "amazon.titan-embed-text-v2:0", "dimensions": 1024, "normalize": true }'Generates vector embeddings for text content using embedding models. Used for semantic search, document similarity, and RAG applications. * * Features: * - Single text or batch processing (up to 100 texts) * - Configurable dimensions (256, 512, 1024, 8192 for Titan v2) * - Optional normalization to unit length * - Usage tracking for billing * * Use Cases: * - Semantic search across documents * - Similarity matching for content recommendations * - RAG (Retrieval-Augmented Generation) pipelines * - Clustering and classification * * Available Embedding Models: * - amazon.titan-embed-text-v2:0 (default, supports 256-8192 dimensions) * - amazon.titan-embed-text-v1:0 (1536 dimensions fixed)
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The organisation ID
Request Bodyrequired
Section titled “Request Bodyrequired”Embedding request with single or multiple texts
object
Embedding model to use
Output embedding dimensions. Titan v2 supports: 256, 512, 1024, 8192
Normalize embeddings to unit length (magnitude = 1.0)
Example
{ "input": "The Australian government announced new climate policy", "modelId": "amazon.titan-embed-text-v2:0", "dimensions": 1024, "normalize": true}Responses
Section titled “Responses”Embeddings generated successfully
object
Single embedding vector if input was a string
Array of embedding vectors if input was an array
Model used to generate embeddings
Dimensionality of each embedding vector
object
Number of tokens in input text(s)
Total tokens (same as inputTokens for embeddings)
Example
{ "embeddings": [ 0.0215, 0.0008, 0.0312, -0.0087, 0.0273 ], "model": "amazon.titan-embed-text-v2:0", "dimension": 1024, "usage": { "inputTokens": 8, "totalTokens": 8 }}Invalid request parameters
Access denied
Failed to generate embeddings
