-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClientError 429 RESOURCE_EXHAUSTED on first use of gemini-2.0-flash-exp
with Google Search tool after 2-day idle period
#17
Comments
thank you for posting this - cause it does not look at all like any of the actual code examples google gives in their documentation for how to use grounding search - and for me this actually worked - after 3 hours now of banging my head against their out of date docs - i was about to give up and came here to the issues tab and found your code which finally got me grounding results. it looks nothing like what they show in documentation. |
Hey, thanks for chiming in! I'm glad my code example (even though it's highlighting an error for me) was helpful for you. It's definitely concerning that the official docs aren't reflecting the correct way to implement the search tool. Hopefully, this issue will help get that addressed. I appreciate you sharing your experience - it really validates that there's something not quite right on the Google side. |
after having a lot of head banging with the docs, to the point went in the entire actual downloaded packages code base to figure out whats going on and what i actually need to implement to fix issue since i gotten that docs are wrong. i got to so many times exhausted usage and was confused alot, it seems it might be their side issue since i can use it on ai studio from google import genai
from google.genai.types import Tool, GenerateContentConfig, GoogleSearch
model_id = "gemini-2.0-flash-exp"
client = genai.Client(api_key="YOUR_API_KEY", http_options={'api_version': 'v1alpha'},)
search_tool = {'google_search': {}}
response = client.models.generate_content(
model=model_id,
contents="time in india",
config= GenerateContentConfig(
tools=[search_tool],
)
)
print(response.text) |
I tried so many things, but it's still not working. Have you gotten it to work? from google import genai
from google.genai.types import (
GenerateContentConfig,
Tool,
GoogleSearch,
GoogleSearchRetrieval,
)
client = genai.Client(
api_key="YOUR_API_KEY",
http_options={"api_version": "v1alpha"},
)
mytools = [
Tool(
google_search=GoogleSearch(),
google_search_retrieval=GoogleSearchRetrieval(),
),
]
response = client.models.generate_content(
model="gemini-2.0-flash-exp",
contents="time now in UK",
config=GenerateContentConfig(
tools=mytools,
),
)
print(response.text) |
ai studio is still working with search grounding, i tried even with cURL and getting the same error 429. I'm not sure what to do at this point since if it's not even working with a simple POST request. |
Hi, I just tried @YoussefElsafi code and it works for me without issue. Does folks here still observe 429 when trying the gemini-2.0-flash-exp with Google Search tool? Think 429 should be related to quota issue. Is the API KEY shared with anyone? Thanks, |
I am encountering a
ClientError: 429 RESOURCE_EXHAUSTED
error when attempting to use thegemini-2.0-flash-exp
model with the Google Search tool. This error occurs immediately upon sending the first message in a chat session, even after a period of approximately 48 hours of inactivity, indicating that this is not a result of exceeding typical usage quotas.Environment Details:
Expected Behavior:
The
gemini-2.0-flash-exp
model should be able to generate responses using the Google Search tool without raising aRESOURCE_EXHAUSTED
error, especially when the API has not been used for an extended period.Actual Behavior:
A
ClientError: 429 RESOURCE_EXHAUSTED
error is raised immediately after sending the first message to the model.Steps to Reproduce:
API_KEY
to a valid Google AI API key.Error Output:
Additional Information:
v1alpha
API version.gemini-2.0-flash-exp
model is specified.GenerateContentConfig
.gemini-2.0-flash-exp
model being in an experimental stage and possibly having stricter quota limitations, unexpected quota reset behavior, or issues with tool integration?RESOURCE_EXHAUSTED
error specifically when using tools withgemini-2.0-flash-exp
, even on the first request after a period of inactivity?Request:
Please investigate this issue and provide guidance on how to resolve the
RESOURCE_EXHAUSTED
error when using thegemini-2.0-flash-exp
model with the Google Search tool, particularly in light of the fact that this is occurring on the very first request after an extended idle period.The text was updated successfully, but these errors were encountered: