We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6dd5b21 commit 10ad9c2Copy full SHA for 10ad9c2
README.md
@@ -213,9 +213,23 @@ Returns `AsyncGenerator<ServerSentEvent>` which yields the events of running the
213
Example:
214
215
```js
216
-for await (const event of replicate.stream("meta/llama-2-70b-chat")) {
217
- process.stdout.write(`${event}`);
+const model = "meta/llama-2-70b-chat";
+const options = {
218
+ input: {
219
+ prompt: "Write a poem about machine learning in the style of Mary Oliver.",
220
+ },
221
+ // webhook: "https://smee.io/dMUlmOMkzeyRGjW" // optional
222
+};
223
+const output = [];
224
+
225
+for await (const event of replicate.stream(model, options)) {
226
+ console.debug({ event });
227
+ if (event?.event === "output") {
228
+ output.push(event.data);
229
+ }
230
}
231
232
+console.log(output.join("").trim());
233
```
234
235
### Server-sent events
0 commit comments