The table below summarizes gateway support for this endpoint by provider.
Legend:
✅ Supported by Provider and Truefoundry
Provided by provider, but not by Truefoundry
Provider does not support this feature
Provider
String
List of String
OpenAI
✅
✅
Azure OpenAI
✅
✅
Anthropic
Bedrock
✅
✅
Vertex
✅
✅
Cohere
✅
✅
Gemini
Groq
SambaNova
Together-AI
✅
✅
xAI
DeepInfra
For every gateway endpoint and provider, see Supported APIs.An embedding is a sequence of numbers (a vector) that represents the semantic meaning of content such as natural language, code, or other structured data. They are widely used in Clustering, Semantic search and retrieval, Recommendation engines, Retrieval-Augmented Generation (RAG)
When using Cohere models via the embeddings API, you must include an additional field called input_type in the request. This field indicates the purpose of the embedding and must be one of the following:
search_query
search_document
classification
clustering
Example:
from openai import OpenAIBASE_URL = "{GATEWAY_BASE_URL}"API_KEY = "your-truefoundry-api-key"client = OpenAI( api_key=API_KEY, base_url=BASE_URL,)# Embed a search queryresponse = client.embeddings.create( model="cohere-main/embed-english-v3.0", input="Find similar documents about AI.", input_type="search_query")print(response.data[0].embedding)
Vertex AI and Gemini embedding models support task_type that optimizes embeddings for specific use cases. Specify the task type using the extra_body parameter.Available task types:RETRIEVAL_DOCUMENT, RETRIEVAL_QUERY, QUESTION_ANSWERING, FACT_VERIFICATION, SEMANTIC_SIMILARITY, CLASSIFICATION, CLUSTERING, CODE_RETRIEVAL_QUERYFor detailed information about task types and when to use them, see:
Note: Multimodal embeddings are only available for the Vertex AI multimodalembedding@001 model.
Vertex AI supports multimodal embeddings that can encode images and videos along with text. This enables applications to search across multiple modalities or find semantic similarity between text and visual content.
Generate embeddings from video segments with temporal control:
from openai import OpenAIBASE_URL = "{GATEWAY_BASE_URL}"API_KEY = "your-truefoundry-api-key"client = OpenAI( api_key=API_KEY, base_url=BASE_URL,)response = client.embeddings.create( model="vertex-ai-main/multimodalembedding@001", input=[ { "text": "A cooking tutorial showing pasta preparation", "video": { "base64": "AAAAGGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAA...", "start_offset": 0, # Start time in seconds "end_offset": 30, # End time in seconds "interval": 10, # Sample interval in seconds # "url": "gs://your-bucket/path/to/video.mp4" # Alternative: use GCS URL } } ])# Access text embeddingprint(response.data[0].embedding)# Access video embeddings (array of embeddings for each segment)print(response.data[0].video_embeddings)