Hi team,
I’m trying to use and upload uri from a PDF (previosly uploaded by API to https://generativelanguage.googleapis.com/v1beta/files/) and always receive an 400 Error ( “code”: 400, “message”: “Request contains an invalid argument.”, “status”: “INVALID_ARGUMENT” ) when add the fileData to the request.
The request structure seems correct:
-if I send empty the fileUri field I receive a correct error (Invalid or unsupported file uri).
-If I send with the mimeType empyt also a correct error (Unable to submit request because it has a mimeType parameter with value application/json)
-If I inform them properly → Request contains an invalid argument
Hi @GUNAND_MAYANGLAMBAM
Thanks for your help,
The endpoint seems correct and I receive the url for the uploaded file.
The issue it’s with the prompt request passing this fileUri.
Sorry @Diego_Retamal , I was not able to receive a correct response and I made the test finally in JS with the library @google/generative-ai and his methods
Hello @Dani_R, I resolved the issue. My mistake was in the initial file upload; I needed to first initiate the file with the appropriate Content-Length and Content-Type headers, followed by the upload of the file’s content.