Skip to content

Commit c2e5811

Browse files
authored
Enable user to controle the use of FileOutput for streaming
1 parent 309738c commit c2e5811

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ declare module "replicate" {
173173
webhook?: string;
174174
webhook_events_filter?: WebhookEventType[];
175175
signal?: AbortSignal;
176+
useFileOutput?: boolean;
176177
}
177178
): AsyncGenerator<ServerSentEvent>;
178179

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ class Replicate {
315315
* @yields {ServerSentEvent} Each streamed event from the prediction
316316
*/
317317
async *stream(ref, options) {
318-
const { wait, signal, ...data } = options;
318+
const { wait, signal, useFileOutput = this.useFileOutput, ...data } = options;
319319

320320
const identifier = ModelVersionIdentifier.parse(ref);
321321

@@ -338,7 +338,10 @@ class Replicate {
338338
const stream = createReadableStream({
339339
url: prediction.urls.stream,
340340
fetch: this.fetch,
341-
...(signal ? { options: { signal } } : {}),
341+
options: {
342+
useFileOutput,
343+
...(signal ? { signal } : {}),
344+
},
342345
});
343346

344347
yield* streamAsyncIterator(stream);

0 commit comments

Comments
 (0)