Mime_type is not updated with genai.upload_file

model = genai.GenerativeModel("gemini-1.5-flash")
sample_pdf = genai.upload_file(media / "test.pdf", mime_type="application/pdf")
response = model.generate_content(["Give me a summary of this pdf file.", sample_pdf])

model.generate_content fails with error "Error generating content: 400 Unable to submit request because it has an empty mimeType parameter in fileData.

genai.File({
‘name’: ‘files/3cxjee8juvyk’,
‘display_name’: ‘test.pdf’,
‘mime_type’: ‘’,
‘sha256_hash’: ‘’,
‘size_bytes’: ‘0’,
‘state’: ‘ACTIVE’,
‘uri’: ‘https://generativelanguage.googleapis.com/v1beta/files/3cxjee8juvyk’,
‘create_time’: ‘2024-11-12T03:45:01.280895Z’,
‘expiration_time’: ‘2024-11-14T03:45:01.223650174Z’,
‘update_time’: ‘2024-11-12T03:45:01.280895Z’})

3 Likes

The problem seems to be fixed now.

1 Like

I was running into the same issue. It does seem to be fixed now.

Yeah, apologies for the delay, it is fixed!