Skip to content

openai.files.content returns raw Response object #958

Open
@itta611

Description

@itta611

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • 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:
Screenshot 2024-07-27 at 17 47 19

To Reproduce

  1. Write the code above (copy&pasted from https://platform.openai.com/docs/api-reference/files/retrieve-contents)
  2. It shows file is a Response object

Code snippets

No response

OS

macOS

Node version

Node v18.17.0

Library version

openai v4.53.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions