Does text/plain refer only to .txt files, and not formats like .csv or .json?
If so, how do I go about it to maintain the structure of the object/data?
Does text/plain refer only to .txt files, and not formats like .csv or .json?
If so, how do I go about it to maintain the structure of the object/data?
Hi @JasonYeo , Thanks for reaching out!
Yes, the API typically rejects application/json or text/csv for file uploads.
To fix this, upload your file content but explicitly set the mime_type to “text/plain”. The structure is perfectly preserved because the model reads the raw text characters (commas, brackets, indentation) and automatically parses them as structured data.
Thank you!
Hi @Srikanta_K_N, Thanks for replying.
I do have couple of follow-up questions.
1 Does mime_type “text/plain“ allow me to work with other file types like .docx, .xlsx and .csv?
2 Does the model allow me to use both “text/plain” and “image/png” together?
3 Is there a workaround for file size exceeding 50 MB other than splitting the files in chunk?
4 Can I reference the mime_type for text/plain based on the one used for image?**
“inlineData”: {**
**"mimeType": "image/png",**
**"data": b64,**
**}**
Thanks you!
Hi @JasonYeo ,
text/plain for .docx or .xlsx files, since they’re compressed, the model will just see gibberish. It works fine for .csv because that’s just raw text, but for the rest, try to use the File API instead.inlineData for your text content, that’s usually reserved for binary media (like images). For your prompts or raw CSV data, just use the standard text field in your JSON object to keep things simple.Thank you!