replicate/replicate-javascript (replicate)
### [`v1.0.1`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v1.0.1)
[Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v1.0.0...v1.0.1)
- Fix typo in the `deployments.createPrediction()` arguments. It now correctly uses `wait` instead of `block` [`ec31f40`](https://redirect.github.com/replicate/replicate-javascript/commit/ec31f40)
### [`v1.0.0`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v1.0.0): Enable FileObject and blocking mode by default
[Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v0.34.1...v1.0.0)
> \[!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:
```ts
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](https://replicate.com/docs/topics/predictions/create-a-prediction) 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.
```js
const replicate = new Replicate({ useFileOutput: false });
```
#### Docs
- document `wait` option for \*.prediction.create() methods ([#319](https://redirect.github.com/replicate/replicate-javascript/issues/319)) [`abe1029`](https://redirect.github.com/replicate/replicate-javascript/commit/abe1029)
### [`v0.34.1`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v0.34.1)
[Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v0.34.0...v0.34.1)
#### What's Changed
- docs: create predictions for official models by [@zeke](https://redirect.github.com/zeke) in [https://github.com/replicate/replicate-javascript/pull/312](https://redirect.github.com/replicate/replicate-javascript/pull/312)
- Bug fixes for the `wait` option in `replicate.run` by [@aron](https://redirect.github.com/aron) in [https://github.com/replicate/replicate-javascript/pull/315](https://redirect.github.com/replicate/replicate-javascript/pull/315)
**Full Changelog**: https://github.com/replicate/replicate-javascript/compare/v0.34.0...v0.34.1
### [`v0.34.0`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v0.34.0)
[Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v0.33.0...v0.34.0)
#### What's Changed
- Deprecate `stream` parameter for `predictions.create` by [@mattt](https://redirect.github.com/mattt) in [https://github.com/replicate/replicate-javascript/pull/291](https://redirect.github.com/replicate/replicate-javascript/pull/291)
- Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows by [@dependabot](https://redirect.github.com/dependabot) in [https://github.com/replicate/replicate-javascript/pull/302](https://redirect.github.com/replicate/replicate-javascript/pull/302)
- document typescript usage by [@zeke](https://redirect.github.com/zeke) in [https://github.com/replicate/replicate-javascript/pull/310](https://redirect.github.com/replicate/replicate-javascript/pull/310)
- Extend support for `useFileOutput` to `stream` by [@mattt](https://redirect.github.com/mattt) in [https://github.com/replicate/replicate-javascript/pull/309](https://redirect.github.com/replicate/replicate-javascript/pull/309)
- Add `wait` parameter to prediction creation methods by [@mattt](https://redirect.github.com/mattt) in [https://github.com/replicate/replicate-javascript/pull/308](https://redirect.github.com/replicate/replicate-javascript/pull/308)
**Full Changelog**: https://github.com/replicate/replicate-javascript/compare/v0.33.0...v0.34.0
### [`v0.33.0`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v0.33.0)
[Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v0.32.1...v0.33.0)
#### What's Changed
- Introduce experimental FileOutput interface for models that output File and Path types by [@aron](https://redirect.github.com/aron) in [https://github.com/replicate/replicate-javascript/pull/305](https://redirect.github.com/replicate/replicate-javascript/pull/305)
**Full Changelog**: https://github.com/replicate/replicate-javascript/compare/v0.32.1...v0.33.0
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
^0.32.0
->^1.0.0
Release Notes
replicate/replicate-javascript (replicate)
### [`v1.0.1`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v1.0.1) [Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v1.0.0...v1.0.1) - Fix typo in the `deployments.createPrediction()` arguments. It now correctly uses `wait` instead of `block` [`ec31f40`](https://redirect.github.com/replicate/replicate-javascript/commit/ec31f40) ### [`v1.0.0`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v1.0.0): Enable FileObject and blocking mode by default [Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v0.34.1...v1.0.0) > \[!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: ```ts 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](https://replicate.com/docs/topics/predictions/create-a-prediction) 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. ```js const replicate = new Replicate({ useFileOutput: false }); ``` #### Docs - document `wait` option for \*.prediction.create() methods ([#319](https://redirect.github.com/replicate/replicate-javascript/issues/319)) [`abe1029`](https://redirect.github.com/replicate/replicate-javascript/commit/abe1029) ### [`v0.34.1`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v0.34.1) [Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v0.34.0...v0.34.1) #### What's Changed - docs: create predictions for official models by [@zeke](https://redirect.github.com/zeke) in [https://github.com/replicate/replicate-javascript/pull/312](https://redirect.github.com/replicate/replicate-javascript/pull/312) - Bug fixes for the `wait` option in `replicate.run` by [@aron](https://redirect.github.com/aron) in [https://github.com/replicate/replicate-javascript/pull/315](https://redirect.github.com/replicate/replicate-javascript/pull/315) **Full Changelog**: https://github.com/replicate/replicate-javascript/compare/v0.34.0...v0.34.1 ### [`v0.34.0`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v0.34.0) [Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v0.33.0...v0.34.0) #### What's Changed - Deprecate `stream` parameter for `predictions.create` by [@mattt](https://redirect.github.com/mattt) in [https://github.com/replicate/replicate-javascript/pull/291](https://redirect.github.com/replicate/replicate-javascript/pull/291) - Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows by [@dependabot](https://redirect.github.com/dependabot) in [https://github.com/replicate/replicate-javascript/pull/302](https://redirect.github.com/replicate/replicate-javascript/pull/302) - document typescript usage by [@zeke](https://redirect.github.com/zeke) in [https://github.com/replicate/replicate-javascript/pull/310](https://redirect.github.com/replicate/replicate-javascript/pull/310) - Extend support for `useFileOutput` to `stream` by [@mattt](https://redirect.github.com/mattt) in [https://github.com/replicate/replicate-javascript/pull/309](https://redirect.github.com/replicate/replicate-javascript/pull/309) - Add `wait` parameter to prediction creation methods by [@mattt](https://redirect.github.com/mattt) in [https://github.com/replicate/replicate-javascript/pull/308](https://redirect.github.com/replicate/replicate-javascript/pull/308) **Full Changelog**: https://github.com/replicate/replicate-javascript/compare/v0.33.0...v0.34.0 ### [`v0.33.0`](https://redirect.github.com/replicate/replicate-javascript/releases/tag/v0.33.0) [Compare Source](https://redirect.github.com/replicate/replicate-javascript/compare/v0.32.1...v0.33.0) #### What's Changed - Introduce experimental FileOutput interface for models that output File and Path types by [@aron](https://redirect.github.com/aron) in [https://github.com/replicate/replicate-javascript/pull/305](https://redirect.github.com/replicate/replicate-javascript/pull/305) **Full Changelog**: https://github.com/replicate/replicate-javascript/compare/v0.32.1...v0.33.0Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.