openai-node
openai-node copied to clipboard
`openai.files.content` returns raw Response object
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
In the documentation, openai.files.content is described as returns content as string type.
However, it returns raw Response type.
import OpenAI from "openai";
const openai = new OpenAI();
async function main() {
const file = await openai.files.content("file-abc123");
console.log(file); // Expected to show a string (ref. https://platform.openai.com/docs/api-reference/files/retrieve-contents)
}
main();
Output:
To Reproduce
- Write the code above (copy&pasted from https://platform.openai.com/docs/api-reference/files/retrieve-contents)
- It shows
fileis a Response object
Code snippets
No response
OS
macOS
Node version
Node v18.17.0
Library version
openai v4.53.1
I'd like to work on this documentation issue. I'll clarify the return type for openai.files.content and add an example showing how to properly consume the Response object. ETA: 1-2 hours.