#Agents SDK returning "400 input[*].content[1].file_data is invalid" when I try to send a PDF
1 messages · Page 1 of 1 (latest)
UPDATE:
So, for anyone going through this same problem, I found a "dirty" solution:
It seems that the agent sdk provided in NPM doesnt support documents being sent as a URL.
When you send a string in the "file" property, it assumes it's a base64 encoded file and send it to the api.
So, I manually edited the node module dist file to include this:
if (typeof entry.file === 'string') {
if (/http|https/.test(entry.file)) {
fileEntry.file_url = entry.file;
} else {
fileEntry.file_data = entry.file;
}
}
And it worked!
I checked in the official github repository and this seems to be already patched there:
Maybe the npm module is outdated? You could try to use the github version but I didn't do that because I was afraid that it could break something in my project