google-gemini/cookbook

Pdf upload not working

rajivraghu opened this issue · 1 comments

Hello,
I am trying to upload a PDF and trying to get a summary of it.
Unsupported MIME type: application/pdf

sample_file = genai.upload_file(path="test.pdf",
                                display_name="Test")

model = genai.GenerativeModel(model_name="models/gemini-1.5-pro-latest")

response = model.generate_content(["Generate a summary of the document", sample_file])

print(response.text)

Hi @rajivraghu! Thanks for trying out the API! PDFs are not supported at this time: https://ai.google.dev/tutorials/prompting_with_media#supported_file_formats