Samples
Generate an embedding
Create a vector embedding:Specify input type
Optimize embeddings for your use case:Store embeddings in a table
Generate and store embeddings for your data:Multilingual embeddings
Use multilingual models for non-English content:Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
model | TEXT | - | ✔ | The Cohere embedding model to use (e.g., embed-english-v3.0) |
input_text | TEXT | - | ✔ | Text to embed |
api_key | TEXT | NULL | ✖ | Cohere API key. If not provided, uses configured secret |
api_key_name | TEXT | NULL | ✖ | Name of the secret containing the API key |
input_type | TEXT | NULL | ✖ | Type of input: search_query, search_document, classification, clustering |
truncate_long_inputs | TEXT | NULL | ✖ | How to handle long inputs: START, END, NONE |
verbose | BOOLEAN | FALSE | ✖ | Enable verbose logging for debugging |
Returns
vector: A pgvector compatible vector containing the embedding.
Related functions
cohere_rerank(): rerank search results for better relevanceopenai_embed(): alternative with OpenAI models