openai-node
openai-node copied to clipboard
400 Missing required parameter: 'messages[1].content[0].file.file_id'
Confirm this is a Node library issue and not an underlying OpenAI API issue
- [x] This is an issue with the Node library
Describe the bug
The correct name of the property in order to send Base64-encoded files via the completions API is filename not file_name as described in the documentation.
From OpenAI's tutorial you can see the property name is incorrect. See print below.
It can be seen in the print below, taken from the Playground, that the frontend is sending filename instead.
The problem with fixing the property name in our own codebase is that Typescript considers it an error. See print below.
The solution is to either fix the name of the type declaration.
To Reproduce
Simply call the completions API trying to send Base64-encoded files. Follow the documentation here and you'll reproduce the error.
Code snippets
OS
macOS
Node version
20.0.0
Library version
4.87.3
To anyone looking for a quick solution to this, just rename the property from file_name to filename and add a // @ts-ignore or // @ts-expect-error above the type property.
Thanks for the report - fix incoming in the next point release
I believe it has been fixed already
I am trying really hard to find a good issue to fix as I have been offproject for a week, but damn, it is either a user misuse or an old problem already fixed!