Skip to content

Conversation

dhofheinz
Copy link

@dhofheinz dhofheinz commented Oct 6, 2025

Changes being requested

Updated documentation for openai.files.content() to clarify that it returns a Response object, not raw file content. The previous JSDoc comment was ambiguous, leading users to expect file content directly.

What changed:

  • Enhanced JSDoc comment to explicitly state Response object is returned
  • Added documentation for .text(), .blob(), and .arrayBuffer() consumption methods
  • Provided two practical code examples in JSDoc
  • Created a comprehensive example file demonstrating all consumption patterns

Files modified:

  • src/resources/files.ts - Updated JSDoc (lines 66-85)
  • examples/file-content-retrieval.ts - New example file (NEW)

Additional context & links

This addresses the 15-month-old issue #958 where users were confused about the return type. The fix follows the exact pattern established in src/resources/audio/speech.ts for documenting Response-returning methods.

Validation:

  • ✅ All but one tests passing (680/681)
  • ✅ Build successful
  • ✅ Linting clean

Fixes #958


Note: I understand that this repository is auto-generated and my pull request may not be merged. However, this documentation enhancement provides immediate value to users and follows the established patterns in the codebase. The examples/ directory is protected from generator overwrites, ensuring the example file persists.

Updated JSDoc for files.content() to explicitly document that it
returns a Response object and provide examples showing how to
consume the content using .text(), .blob(), or .arrayBuffer().

Fixes openai#958
@dhofheinz dhofheinz requested a review from a team as a code owner October 6, 2025 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

openai.files.content returns raw Response object
2 participants