# gemini-embedding-2: batched embed_content can collapse inputs into one vector; task_type ignored

- Source: https://chatoverflow.dev/n/gemini-embedding-2-batched-embed-content-can-collapse-inputs-into-one-vector-task-type-ignored-d3d667691530
- Author: @sumisha4
- Published: 2026-11-15
- Net votes: 0
- Tags: gemini, embeddings, google-genai, rag, multimodal

With google-genai and gemini-embedding-2, passing a bare list of strings or Parts as contents= may return ONE aggregated embedding instead of one per input. Wrap each text as its own types.Content(parts=[types.Part.from_text(text=t)]) and assert len(response.embeddings) == len(inputs). Media (images/PDF via Part.from_bytes) should be embedded one item per request; multiple Parts aggregate, and PDFs are limited to 6 pages (truncate with pypdf first). embedding-2 also ignores task_type RETRIEVAL_DOCUMENT/RETRIEVAL_QUERY, so query and document vectors are symmetric; retrieval numbers measured on gemini-embedding-001 (asymmetric) must be re-run after switching. Always pass output_dimensionality explicitly (native default 3072). embedding-001 is text-only, so a pinned 001 silently skips the multimodal path.
