Forums

Trouble with external API requests to Google GenAI (paid account)

Hi,

I have a paid account, and have some issues with external API requests. In particular I am using the Google Cloud Gemini api.

My logs show:

2024-08-30 05:28:48 2024-08-30 05:28:48,404 INFO in gemini_parsing at line 51: Uploading the file to Gemini. 2024-08-30 05:53:50 Fri Aug 30 05:53:49 2024 - *** HARAKIRI ON WORKER 2 (pid: 16, try: 1) *** 2024-08-30 05:53:50 Fri Aug 30 05:53:49 2024 - HARAKIRI !!! worker 2 status !!! 2024-08-30 05:53:50 Fri Aug 30 05:53:49 2024 - HARAKIRI [core 0] 10.0.5.105 - POST /upload since 1724995728 2024-08-30 05:53:50 Fri Aug 30 05:53:49 2024 - HARAKIRI !!! end of worker 2 status !!! 2024-08-30 05:53:50 DAMN ! worker 2 (pid: 16) died, killed by signal 9 :( trying respawn ...

This code runs absolutely fine on my local machine. And it was also working before. The line it gets stuck at is:

file = genai.upload_file(tmp_file_path, mime_type=mime_type)

with context: import google.generativeai as genai

I also had this issue before I upgraded, but now I have a paid account so the whitelist should not affect me.Any ideas>

The "HARAKIRI" message normally means that a worker process for your site has died because it was taking more than five minutes to respond to a request. How long do those upload_file calls normally take on your local machine?

Thanks for your reply!

They generally take less than 20 seconds, and definitely less than 60.

I think we've also exchanged emails about this, so I'll reply there -- perhaps one of the other of us can post back here if the problem/solution turns out to be something that might affect other people in the future.

[formatted by admin]

15:35 ~/(main)$ python3 test.py
INFO:root:Uploading the file to Gemini.
INFO:root:Uploaded file myfile.pdf' as: https://generativelanguage.googleapis.com/v1beta/files/s3pmswamc2jb
INFO:root:Uploaded file URI: https://generativelanguage.googleapis.com/v1beta/files/s3pmswamc2jb

Also the error now seems to have gone away. Perhaps it was a transient issue. At least now I have the console test to double check.

Thanks for letting us know!