Samples
Generate a single embedding
Create a vector embedding:Specify input type for queries
Optimize embeddings for search queries:Specify input type for documents
Optimize embeddings for documents:Generate embeddings for multiple texts
Process multiple texts in one API call:Store embeddings in a table
Generate and store embeddings for your data:Use domain-specific models
Use specialized models for your domain:Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
model | TEXT | - | ✔ | Voyage AI model (e.g., voyage-3, voyage-code-3) |
input_text | TEXT | - | ✔ | Single text input to embed (use this OR input_texts) |
input_texts | TEXT[] | - | ✔ | Array of text inputs to embed in a batch |
input_type | TEXT | NULL | ✖ | Type of input: query for search queries, document for documents to search |
api_key | TEXT | NULL | ✖ | Voyage AI API key. If not provided, uses configured secret |
api_key_name | TEXT | NULL | ✖ | Name of the secret containing the API key |
verbose | BOOLEAN | FALSE | ✖ | Enable verbose logging for debugging |
Returns
For single text input:vector: A pgvector compatible vector containing the embedding
TABLE(index INT, embedding vector): A table with an index and embedding for each input text
Related functions
cohere_embed(): alternative with Cohere modelsopenai_embed(): alternative with OpenAI models