Skip to content

fix: keep embedding string batches separate#2560

Open
he-yufeng wants to merge 1 commit into
googleapis:mainfrom
he-yufeng:fix/embed-content-string-batch
Open

fix: keep embedding string batches separate#2560
he-yufeng wants to merge 1 commit into
googleapis:mainfrom
he-yufeng:fix/embed-content-string-batch

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

Summary

  • keep pure list[str] inputs batched for Gemini embedding 2 on the Developer API path
  • preserve the existing multimodal behavior where mixed text/image parts are combined into one content item
  • cover both sync and async embed_content() argument handling

Fixes #2523.

Verification

$env:PYTHONPATH='.'; $env:GOOGLE_GENAI_REPLAYS_DIRECTORY="$env:TEMP\google-genai-replays"; python -m pytest google\genai\tests\models\test_embed_content.py -k "text_list_stays_batched or mixed_content_still_combines_parts" -q
python -m py_compile google\genai\models.py google\genai\tests\models\test_embed_content.py
python -m ruff check --select E9,F63,F7,F82 google\genai\models.py google\genai\tests\models\test_embed_content.py
git diff --check

I also checked the converted Developer API request shape directly: contents=["s1", "s2"] now produces two batchEmbedContents requests instead of one multi-part request.

@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this Jun 8, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:L Code changes between 40-100 lines label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L Code changes between 40-100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

embed_content with gemini-embedding-2* silently returns 1 embedding instead of N

2 participants