Skip to content

Releases: replicate/replicate-javascript

1.1.0-0 Pre-release

12 May 18:25
Compare
Choose a tag to compare
1.1.0-0 Pre-release Pre-release
Pre-release

Cutting a dev(pre) release that includes removal of node:crypto in favor of webcrypto package, ahead of a proper release.

Caution

Breaking Changes: this removes support for Node 18 when using the validateWebhook method. To continue to use the latest package version with Node 18, you'll need to shim or polyfill the node:crypto library, or use the experimental --experimental-global-webcrypto CLI flag.

  • Update interface for replicate.models.versions.list() (#349) 5ccf9f3
  • Add support for AbortSignal to all API methods (#339) ac5caba
  • Document the validateWebhook interface on Node 18 37aa363
  • Fix validateWebhook interfaces and update tests 2d42001
  • Remove usage of webcrypto from node:crypto in Node 18 01c4e09
  • Correct documentaiton for wait mode (#337) 720f786
  • Fix typo on README (#334) 0b7c8eb
  • Remove mention of returning data URLs from sync API (#330) 5a98ca7
  • Update README.md (#329) 6a338aa
  • Document the FileOutput and wait parameters (#326) d031695
  • Update README.md to fix examples using FileOutput (#324) 8b75b39
  • Update deployments.createPrediction to use wait ec31f40

v1.0.0...v1.1.0-0

v1.0.1

16 Oct 14:28
Compare
Choose a tag to compare
  • Fix typo in the deployments.createPrediction() arguments. It now correctly uses wait instead of block ec31f40

v1.0.0...v1.0.1

Enable FileObject and blocking mode by default

09 Oct 22:15
Compare
Choose a tag to compare

Warning

Breaking changes

This 1.0.0 latest release of replicate contains breaking changes. The replicate.run() method will now return FileObjects rather than URL strings by default for models that output files.

The FileObject implements a ReadableStream to make it easier to work with files and ensures that Replicate can deliver file data to the client in the most efficient manner possible. This means that implementations that make an additional fetch() call to retrieve the output file are no longer needed.

For example:

const [output] = await replicate.run("black-forest-labs/flux-schnell", { 
  input: { prompt: "astronaut riding a rocket like a horse" }
});

// To access the file URL:
console.log(output.url()); //=> "http://example.com"

// To write the file to disk:
fs.writeFile("my-image.png", output);

// To stream the file back to a browser:
return new Response(output);

// To read the file in chunks:
for await (const chunk of output) {
  console.log(chunk); // UInt8Array
}

Note

By default the new run API utilizes the new sync mode of
the prediction.create API. This means that it will hold the connection open to the server until the prediction has
completed or the request exceeds a timeout, at which point it will fallback to polling.

A further optimization in this mode is that the server may opt-in to returning data-uris inlined into the prediction payload
rather than remote URLs. In this instance output.url() will contain a data-uri.

If a URL is required we recommend passing the wait: { mode: "poll" } argument to replicate.run().

In case of breakage, in most instances, updating existing applications to call output.url() should fix issues.

To revert to previous behaviour you can opt out of FileOutput by passing useFileOutput: false to the Replicate constructor.

const replicate = new Replicate({ useFileOutput: false });

Docs

  • document wait option for *.prediction.create() methods (#319) abe1029

v0.34.1...v1.0.0

v1.0.0-beta.1

04 Oct 23:29
Compare
Choose a tag to compare
v1.0.0-beta.1 Pre-release
Pre-release

The latest release of replicate contains breaking changes. The replicate.run() method will now return FileObjects rather than URLs by default for models that output files.

The FileObject implements a ReadableStream to make it easier to work with files and ensures that Replicate can deliver file data to the client in the most efficient manner possible.

For example:

const [output] = await replicate.run("black-forest-labs/flux-schnell", { 
  input: { prompt: "astronaut riding a rocket like a horse" }
});

// To access the file URL:
console.log(output.file()); //=> "http://example.com"

// To write the file to disk:
fs.writeFile("my-image.png", output);

// To stream the file back to a browser:
return new Response(output);

// To read the file in chunks:
for await (const chunk of output) {
  console.log(chunk); // UInt8Array
}

In case of breakage, in most instances, updating existing applications to call output.url() should fix issues.

To revert to previous behaviour you can opt out of FileOutput by passing useFileOutput: false to the Replicate constructor.

const replicate = new Replicate({ useFileOutput: false });

Change log

  • BREAKING Enable FileObject and blocking mode by default f00f51d

v0.34.1...v1.0.0-beta.1

v0.34.1

01 Oct 23:48
a7dfbfd
Compare
Choose a tag to compare

What's Changed

  • docs: create predictions for official models by @zeke in #312
  • Bug fixes for the wait option in replicate.run by @aron in #315

Full Changelog: v0.34.0...v0.34.1

v0.34.0

25 Sep 18:36
4cba156
Compare
Choose a tag to compare

What's Changed

  • Deprecate stream parameter for predictions.create by @mattt in #291
  • Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows by @dependabot in #302
  • document typescript usage by @zeke in #310
  • Extend support for useFileOutput to stream by @mattt in #309
  • Add wait parameter to prediction creation methods by @mattt in #308

Full Changelog: v0.33.0...v0.34.0

v0.33.0

16 Sep 07:31
eb9adfd
Compare
Choose a tag to compare

What's Changed

  • Introduce experimental FileOutput interface for models that output File and Path types by @aron in #305

Full Changelog: v0.32.1...v0.33.0

v0.32.1

29 Aug 13:03
e7a1aac
Compare
Choose a tag to compare

What's Changed

  • Fix validateWebhook backwards incompatibility with older Node.js by @jakedahn in #298
  • Handle Fetch Headers and subscriptable JS object separately by @mattt in #300

New Contributors

Full Changelog: v0.32.0...v0.32.1

v0.32.0

25 Jul 19:21
ac75077
Compare
Choose a tag to compare

What's Changed

  • Pin to Node 22.4 in CI workflow by @mattt in #293
  • Revert "Pin to Node 22.4 in CI workflow" by @mattt in #294
  • Add support for models.search endpoint by @mattt in #292

Full Changelog: v0.31.1...v0.32.0

v0.31.1

05 Jul 18:16
4c04a57
Compare
Choose a tag to compare

What's Changed

  • Re-raise 4xx responses from server when uploading files by @aron in #284
  • Document alternate interface to validateWebhook() by @aron in #285
  • Document 100MiB file upload limit by @mattt in #287
  • Add integration test for Deno by @mattt in #281
  • Fix Deno integration test by @mattt in #282
  • Document supported platforms by @mattt in #280
  • Run integration tests with replicate/canary model by @mattt in #283

Full Changelog: v0.31.0...v0.31.1