File tree 1 file changed +16
-2
lines changed
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -213,9 +213,23 @@ Returns `AsyncGenerator<ServerSentEvent>` which yields the events of running the
213
213
Example:
214
214
215
215
``` js
216
- for await (const event of replicate .stream (" meta/llama-2-70b-chat" )) {
217
- process .stdout .write (` ${ event } ` );
216
+ const model = " meta/llama-2-70b-chat" ;
217
+ 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
+ }
218
230
}
231
+
232
+ console .log (output .join (" " ).trim ());
219
233
```
220
234
221
235
### Server-sent events
You can’t perform that action at this time.
0 commit comments