Skip to content

feat(core): add Gemini Embedding 2 support#366

Merged
zc277584121 merged 1 commit into
zilliztech:masterfrom
Showiix:feat/gemini-embedding-2-support
May 5, 2026
Merged

feat(core): add Gemini Embedding 2 support#366
zc277584121 merged 1 commit into
zilliztech:masterfrom
Showiix:feat/gemini-embedding-2-support

Conversation

@Showiix
Copy link
Copy Markdown
Contributor

@Showiix Showiix commented May 1, 2026

Summary

  • add gemini-embedding-2 metadata while keeping gemini-embedding-001 as the Gemini default
  • handle gemini-embedding-2 batch requests by embedding each input separately, preserving one vector per input for indexing
  • keep the existing batched request behavior for gemini-embedding-001
  • add Gemini provider regression tests and update docs to mention gemini-embedding-2

Tests

  • pnpm --filter @zilliz/claude-context-core test
  • pnpm --filter @zilliz/claude-context-core typecheck
  • pnpm --filter @zilliz/claude-context-core build

Fixes #365

@zc277584121
Copy link
Copy Markdown
Collaborator

zc277584121 commented May 2, 2026

Thanks for adding this. The model support itself is useful, but I think the batch behavior needs one change before we merge this.

I tested the current Google GenAI SDK with a real Gemini API key, and gemini-embedding-2 accepts array input through models.embedContent and returns one embedding per input:

gemini-embedding-2 single ok embeddings=1 dim=768
gemini-embedding-2 array ok embeddings=2 dims=768,768

Because of that, we should not mark gemini-embedding-2 as supportsBatchEmbedding: false or force it to embed each chunk one by one. That would make large codebase indexing much slower by increasing the number of API calls.

Could you update this PR to keep the existing batched request path for gemini-embedding-2, and limit the change to adding the model metadata, docs, and regression tests? The response-count validation and empty-batch handling are good additions and can stay.

@Showiix Showiix force-pushed the feat/gemini-embedding-2-support branch from 0421116 to 621e95c Compare May 2, 2026 14:51
@Showiix
Copy link
Copy Markdown
Contributor Author

Showiix commented May 2, 2026

Thanks, updated the PR.

@zc277584121 zc277584121 merged commit c93138b into zilliztech:master May 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gemini Embedding 2

2 participants