Skip to content

fix: Google embedMany loses per-value content alignment when batching more than 100 inputs - #21143

Open
ai-sdk-factory[bot] wants to merge 3 commits into
mainfrom
bugfix-21095-20260918083806297632
Open

ai-sdk-factory[bot] wants to merge 3 commits into
mainfrom
bugfix-21095-20260918083806297632

Conversation

@ai-sdk-factory

Copy link
Copy Markdown
Contributor

Background

Google embedMany rejected 101 inputs with matching per-value content before sending a request instead of batching all embeddings.

Root Cause

embedMany split values at the provider's 100-item limit but reused the complete providerOptions for every chunk. Google therefore compared 101 content entries with the first 100-value batch.

Summary

Added an embedding-model capability for transforming provider options per batch. Google now validates the complete content array and slices it using each batch's original index range, including null entries.

Testing

Added coverage for per-batch option transformation, Google content slicing, index alignment, and capability preservation through wrapped embedding models. Added patch changesets for ai, google, and provider-utils.

End-to-end Validation

  • replay_original_reproduction (pnpm -C examples/ai-functions exec tsx src/reproduction/google-embed-many-content-batching.ts) completed successfully without the bug signal.
  • Live pnpm -C examples/ai-functions exec tsx -e "<101-value Google embedMany call>" returned 101 embeddings across two provider responses.

Related Issues

Fixes #21095

Closes #21096

ai-sdk-factory and others added 3 commits September 18, 2026 14:00
Co-authored-by: brennanbutler01 <64561607+brennanbutler01@users.noreply.github.com>
Co-authored-by: brennanbutler01 <64561607+brennanbutler01@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google embedMany fails above 100 values when per-value content is provided

1 participant