Skip to content

Release v7.2.0

Choose a tag to compare

@austin-denoble austin-denoble released this 10 Apr 19:19

Streaming file uploads for Assistant

uploadFile now accepts a Buffer, Blob, or Node.js ReadableStream directly, in addition to the existing local file path. This makes it possible to forward an incoming HTTP upload to the Assistant without writing the file to disk or buffering it in memory first.

// Existing path-based usage — unchanged
await assistant.uploadFile({ path: 'report.pdf' });

// New: upload from a Buffer (e.g. multer memory storage)
await assistant.uploadFile({
  file: req.file.buffer,
  fileName: req.file.originalname,
});

// New: upload from a ReadableStream (zero server-side buffering)
await assistant.uploadFile({
  file: req.file.stream,
  fileName: req.file.filename,
});

When a ReadableStream is provided, the file is streamed directly to Pinecone without ever being fully loaded into memory. This eliminates the out-of-memory pressure that previously made it necessary to limit concurrent upload requests on memory-constrained servers.

Note: ReadableStream inputs do not support automatic retries, since the stream is consumed after the first read. Buffer and Blob inputs continue to retry on server errors as before.

The path-based upload path also switches from a synchronous file read (fs.readFileSync) to an async one, so it no longer blocks the Node.js event loop while reading large files.

New type export

Uploadable (Buffer | Blob | NodeJS.ReadableStream) is now exported from the package for use in application-level type annotations.

What's Changed

  • docs(assistant): file management idempotency - file identifiers, upsert by @andrewyu47 in #381
  • Revert "docs(assistant): file management idempotency - file identifiers, upsert" by @andrewyu47 in #382
  • feat(assistant): support Buffer, Blob, and ReadableStream inputs for uploadFile by @austin-denoble in #383

New Contributors

Full Changelog: v7.1.0...v7.2.0