You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {string} ref - Required. The model version identifier in the format "owner/name" or "owner/name:version"
120
+
* @param {`${string}/${string}` | `${string}/${string}:${string}`} ref - Required. The model version identifier in the format "owner/name" or "owner/name:version"
94
121
* @param {object} options
95
122
* @param {object} options.input - Required. An object with the model inputs
96
123
* @param {object} [options.wait] - Options for waiting for the prediction to finish
97
124
* @param {number} [options.wait.interval] - Polling interval in milliseconds. Defaults to 500
98
125
* @param {string} [options.webhook] - An HTTPS URL for receiving a webhook when the prediction has new output
99
-
* @param {string[]} [options.webhook_events_filter] - You can change which events trigger webhook requests by specifying webhook events (`start`|`output`|`logs`|`completed`)
126
+
* @param {WebhookEventType[]} [options.webhook_events_filter] - You can change which events trigger webhook requests by specifying webhook events (`start`|`output`|`logs`|`completed`)
100
127
* @param {AbortSignal} [options.signal] - AbortSignal to cancel the prediction
101
128
* @param {Function} [progress] - Callback function that receives the prediction object as it's updated. The function is called when the prediction is created, each time its updated while polling for completion, and when it's completed.
102
129
* @throws {Error} If the reference is invalid
103
130
* @throws {Error} If the prediction failed
104
-
* @returns {Promise<object>} - Resolves with the output of running the model
131
+
* @returns {Promise<Prediction>} - Resolves with the output of running the model
105
132
*/
106
133
asyncrun(ref,options,progress){
107
134
const{ wait, ...data}=options;
@@ -237,7 +264,7 @@ class Replicate {
237
264
/**
238
265
* Stream a model and wait for its output.
239
266
*
240
-
* @param {string} identifier - Required. The model version identifier in the format "{owner}/{name}:{version}"
267
+
* @param {string} ref - Required. The model version identifier in the format "{owner}/{name}:{version}"
241
268
* @param {object} options
242
269
* @param {object} options.input - Required. An object with the model inputs
243
270
* @param {string} [options.webhook] - An HTTPS URL for receiving a webhook when the prediction has new output
@@ -285,8 +312,10 @@ class Replicate {
285
312
* for await (const page of replicate.paginate(replicate.predictions.list) {
286
313
* console.log(page);
287
314
* }
288
-
* @param {Function} endpoint - Function that returns a promise for the next page of results
289
-
* @yields {object[]} Each page of results
315
+
* @template T
316
+
* @param {() => Promise<Page<T>>} endpoint - Function that returns a promise for the next page of results
317
+
* @yields {T[]} Each page of results
318
+
* @returns {AsyncGenerator<T[], void, unknown>}
290
319
*/
291
320
async*paginate(endpoint){
292
321
constresponse=awaitendpoint();
@@ -312,7 +341,7 @@ class Replicate {
312
341
* @param {Function} [stop] - Async callback function that is called after each polling attempt. Receives the prediction object as an argument. Return false to cancel polling.
313
342
* @throws {Error} If the prediction doesn't complete within the maximum number of attempts
314
343
* @throws {Error} If the prediction failed
315
-
* @returns {Promise<object>} Resolves with the completed prediction object
344
+
* @returns {Promise<Prediction>} Resolves with the completed prediction object
0 commit comments