Environment details
- Programming language: Python
- OS: macOS Tahoe 26.5.1 (25F80)
- Language runtime version: Python 3.10.18
- Package version: google-genai 2.8.0
Description
When using Models.embed_content() with gemini-embedding-2 on the Enterprise Agent Platform (enterprise=True), the Python SDK raises a client-side ValueError when more than one Content object is provided in contents.
However:
- The method signature accepts
ContentListUnion.
- The docstring describes
contents as list[Content].
- The multimodal embeddings documentation states:
Multiple entries: Sending multiple entries in the contents array returns separate embeddings for each entry.
- The Gemini Enterprise multimodal embeddings documentation also documents multiple entries and up to 6 images per request.
- The exception is raised by the SDK before any request is sent to the backend.
Steps to reproduce
import asyncio
from google import genai
from google.genai import types
client = genai.Client(
enterprise=True,
project="PROJECT_ID",
location="global",
)
MODEL = "gemini-embedding-2"
async def main():
image_bytes = open("1.png", "rb").read()
contents = [
types.Content(
parts=[
types.Part.from_bytes(
data=image_bytes,
mime_type="image/png",
)
]
)
for _ in range(6)
]
result = await client.aio.models.embed_content(
model=MODEL,
contents=contents,
)
print(len(result.embeddings))
asyncio.run(main())
Environment details
Description
When using
Models.embed_content()withgemini-embedding-2on the Enterprise Agent Platform (enterprise=True), the Python SDK raises a client-sideValueErrorwhen more than oneContentobject is provided incontents.However:
ContentListUnion.contentsaslist[Content].Steps to reproduce