Open barun-saha opened 2 weeks ago
Hi @barun-saha
I ran the same code on my local setup, and it worked fine. However, when I run it on Kaggle, I encounter the same error as you. This issue may be due to network instability on Kaggle's end. If possible, try running the code on a stable network or on a local setup.
Thanks
Hi Manoj,
Thanks for your inputs.
I tried running the code in a Colab notebook, using the synchronous send_message
method (send_message_async
leads to error on Colab, but that's a different issue.) Surprisingly, the code ran without any error! I tried out sending several chat messages and got responses back (with no error).
I was curious, so went back to Kaggle and used send_message
. Unfortunately, I got the same error there with the synchronous call as well.
Therefore, I agree with your observation that this might be more of an environment-specific issue.
@barun-saha
I encountered the same error even with send_message. Kaggle handles fewer tokens well, but in your case, the 290K tokens are causing issues.
Thanks
Marking this issue as stale since it has been open for 14 days with no activity. This issue will be closed if no further activity occurs.
Description of the bug:
I'm trying out Gemini 1.5 Flash (002) API and its long context. I prompt the LLM with the contents of a few (10) large PDF files. In the first interaction, I ask it to list the titles of the documents (to verify that the file contents are available and the model can read them). This appears to work fine: the titles are listed and the total token count is reported to be about 290K.
Next, in the same chat session, I ask it to summarize the documents, as indicated in the code below:
However, this invocation almost always results in the following error:
I have tried to run it by disabling streaming, but it still throws the same error. Rewinding the chat session and trying it again causes the same error.
How can I address this error and continue the chat?
Actual vs expected behavior:
The expected behavior is to receive the complete response from the model without any run-time exception.
Any other information you'd like to share?
Just to clarify, the code works on rare occasions. Also, I'm running the code on Kaggle (
!pip install google-generativeai==0.8.3 grpcio-status
).