Skip to main content
GeminiEmbedder defaults to gemini-embedding-001, 1536 dimensions, and the RETRIEVAL_QUERY task type.
gemini_embedder.py
GeminiEmbedder currently applies one configured task_type to every call. A single instance used by a vector database therefore applies the same task type to document insertion and query search. gemini-embedding-001 distinguishes RETRIEVAL_DOCUMENT from RETRIEVAL_QUERY.
Google requires manual L2 normalization for gemini-embedding-001 vectors shorter than 3072 dimensions. The example normalizes Agno’s 1536-dimensional default. GeminiEmbedder returns the provider values unchanged.

Run the Example

1

Set up your virtual environment

2

Export the API key

3

Install dependencies

4

Run the example

Developer Resources