Gemini Format
Gemini Format - Embeddings
- Compatible with all Gemini native format embedding APIs
- Converts text into high-dimensional vector representations
- Supports multiple task types: retrieval, classification, clustering, semantic similarity, etc.
- Supports custom output dimensionality (dimensionality reduction)
POST
Authorizations
All endpoints require Bearer Token authentication
Add the following to your request headers:
Authorization: Bearer YOUR_API_KEY
Path Parameters
Embedding model name, e.g. gemini-embedding-2-preview
Example:
"gemini-embedding-2-preview"
Body
application/json
The content to embed
Embedding task type, which affects the optimization direction of the embedding vector. Note: gemini-embedding-2-preview does not support this field; that model uses a prompt prefix approach to specify task types (e.g. task: search result | query: {content})
Available options:
RETRIEVAL_QUERY, RETRIEVAL_DOCUMENT, SEMANTIC_SIMILARITY, CLASSIFICATION, CLUSTERING, QUESTION_ANSWERING, FACT_VERIFICATION, CODE_RETRIEVAL_QUERY Document title, only effective when taskType is RETRIEVAL_DOCUMENT
Output vector dimensionality, used for dimensionality reduction. Default 3072
Response
Embedding response
Embedding result