Did the API related to fileData change?

Did the API change something? I noticed that the file upload API changed today and some fields are missing in the response. When I use the file uploaded today, I get an error, but I don’t get an error with the file uploaded yesterday. The only difference in the request is the document’s URI.

I provided fileData but got an error.
{
“error”: {
“code”: 400,
“message”: “Request contains an invalid argument.”,
“status”: “INVALID_ARGUMENT”
}
}
Request Uri:https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-002:streamGenerateContent?alt=sse&key={}
Request Body:
{
“safetySettings”: [
{
“threshold”: “BLOCK_ONLY_HIGH”,
“category”: “HARM_CATEGORY_HATE_SPEECH”
},
{
“threshold”: “BLOCK_ONLY_HIGH”,
“category”: “HARM_CATEGORY_SEXUALLY_EXPLICIT”
},
{
“threshold”: “BLOCK_ONLY_HIGH”,
“category”: “HARM_CATEGORY_DANGEROUS_CONTENT”
},
{
“threshold”: “BLOCK_ONLY_HIGH”,
“category”: “HARM_CATEGORY_HARASSMENT”
}
],
“contents”: [
{
“role”: “user”,
“parts”: [
{
“text”: “Extract the main points from the document.”
},
{
“fileData”: {
“fileUri”: “https://generativelanguage.googleapis.com/v1beta/files/rcdlp590f67v”,
“mimeType”: “application/pdf”
}
}
]
}
]
}

6 Likes

I get errors like

[{
  "error": {
    "code": 400,
    "message": "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",
    "status": "INVALID_ARGUMENT"
  }
}
]

while generating with files, or caching with files. It’s been three hours.

Maybe it is an issue from the similar problems of mine.

1 Like

When I remove the mimeType, I get the same error as you.

I have the same error, also looks like something just broke today. I can’t use the API with pictures anymore.

I noticed that the file upload API seems to have rolled back, and some of the fields that were removed have returned. So, the files uploaded now are usable again, but the files from a few hours ago are still not recognized.

3 Likes

GoogleGenerativeAIFetchError: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent: [400 Bad Request] Request contains an invalid argument