Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Gemeni file uploads broken due mime type

jay3jp
New Member

Last week i wrote a script that I was very happy with using Gemini, it analyzes audio files for certain things I am looking for.

The issue is suddenly Gemini stopped working due to the file upload in the python sdk being broken.

 

def upload_to_gemini(path, mime_type=None):
    """Uploads the given file to Gemini."""
    file = genai.upload_file(path, mime_type=mime_type)
    print(f"[UPLOAD] File uploaded as: {file.uri}")
    return file

 

My File uploader is very simple but when i use it like so

 

audio_file = upload_to_gemini(temp_path, "audio/wav")

the file does not have an associated mime type and will return something along these lines.

AUDIO FILE: genai.File({
'name': 'files/np2dnjqys7su',
'display_name': 'tmp9eujoozw.wav',
'mime_type': '',
'sha256_hash': '',
'size_bytes': '0',
'state': 'ACTIVE',})

the mime type is blank so it leads to this error
google.api_core.exceptions.InvalidArgument: 400 Unable to submit request because it has an empty mimeType parameter in fileData. Add a value to the parameter and try again. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini


this problem was not happening until today and I did not see anything on any of the google status pages relating to this.

 

0 0 54
0 REPLIES 0