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”
}
}
]
}
]
}