This repository was archived by the owner on Apr 30, 2026. It is now read-only.
feat: GeminiEmbedding rate-limit handling#2237
Merged
marcusschiesser merged 3 commits intoDec 2, 2025
Merged
Conversation
…e limit, add example/test
🦋 Changeset detectedLatest commit: 8ad2add The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@llamaindex/autotool
@llamaindex/community
@llamaindex/core
@llamaindex/env
@llamaindex/experimental
llamaindex
@llamaindex/node-parser
@llamaindex/readers
@llamaindex/tools
@llamaindex/wasm-tools
@llamaindex/workflow
@llamaindex/anthropic
@llamaindex/assemblyai
@llamaindex/aws
@llamaindex/clip
@llamaindex/cohere
@llamaindex/deepinfra
@llamaindex/deepseek
@llamaindex/discord
@llamaindex/excel
@llamaindex/fireworks
@llamaindex/google
@llamaindex/groq
@llamaindex/huggingface
@llamaindex/jinaai
@llamaindex/mistral
@llamaindex/mixedbread
@llamaindex/notion
@llamaindex/ollama
@llamaindex/openai
@llamaindex/ovhcloud
@llamaindex/perplexity
@llamaindex/portkey-ai
@llamaindex/replicate
@llamaindex/together
@llamaindex/vercel
@llamaindex/vllm
@llamaindex/voyage-ai
@llamaindex/xai
@llamaindex/astra
@llamaindex/azure
@llamaindex/chroma
@llamaindex/elastic-search
@llamaindex/firestore
@llamaindex/milvus
@llamaindex/mongodb
@llamaindex/pinecone
@llamaindex/postgres
@llamaindex/qdrant
@llamaindex/supabase
@llamaindex/upstash
@llamaindex/weaviate
commit: |
Contributor
|
This PR should not include the postgres change |
8cf9b48 to
6345e76
Compare
Contributor
Author
Aw crap, how'd I do that. I've re-pushed a version of this branch that doesn't include the Postgres change. |
marcusschiesser
approved these changes
Dec 2, 2025
Contributor
|
Thanks @jeremybmerrill |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Google Gemini has rate-limits on embeddings -- 3000 vectors per minute. Right now, if we're generating embeddings via LlamaIndex (e.g. with
VectorStoreIndex.initor similar methods), if we hit the rate limits, it just errors out, with no ability to wait or restart.This proposed addition would wait 5s and retry, up to 20 times any embed call that fails with a rate limit error. That up-to-100s wait gets you out of the per-minute limit -- so that the requests-per-minute limit is seamlessly handled by applications using LlamaIndex.
I've added an example file that fails with the existing main branch of llamaindexts, but succeeds with this patch. You can run it with
ts-node examples/models/gemini/embedding_ratelimits.ts. (I didn't really know how write a proper jest test for this, without actually hitting the Gemini API and without faking the way that the Google AI library throws errors. Rather than tightly couple the test to the current behavior of the Google AI library, I wrote an example that does hit the Gemini API.)