import { APIResource } from "../../core/resource.js"; import * as PredictionsAPI from "../predictions.js"; import { APIPromise } from "../../core/api-promise.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class Predictions extends APIResource { /** * Create a prediction for the deployment and inputs you provide. * * Example cURL request: * * ```console * curl -s -X POST -H 'Prefer: wait' \ * -d '{"input": {"prompt": "A photo of a bear riding a bicycle over the moon"}}' \ * -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ * -H 'Content-Type: application/json' \ * https://api.replicate.com/v1/deployments/acme/my-app-image-generator/predictions * ``` * * The request will wait up to 60 seconds for the model to run. If this time is * exceeded the prediction will be returned in a `"starting"` state and need to be * retrieved using the `predictions.get` endpiont. * * For a complete overview of the `deployments.predictions.create` API check out * our documentation on * [creating a prediction](https://replicate.com/docs/topics/predictions/create-a-prediction) * which covers a variety of use cases. */ create(params: PredictionCreateParams, options?: RequestOptions): APIPromise; } export interface PredictionCreateParams { /** * Path param: The name of the user or organization that owns the deployment. */ deployment_owner: string; /** * Path param: The name of the deployment. */ deployment_name: string; /** * Body param: The model's input as a JSON object. The input schema depends on what * model you are running. To see the available inputs, click the "API" tab on the * model you are running or [get the model version](#models.versions.get) and look * at its `openapi_schema` property. For example, * [stability-ai/sdxl](https://replicate.com/stability-ai/sdxl) takes `prompt` as * an input. * * Files should be passed as HTTP URLs or data URLs. * * Use an HTTP URL when: * * - you have a large file > 256kb * - you want to be able to use the file multiple times * - you want your prediction metadata to be associable with your input files * * Use a data URL when: * * - you have a small file <= 256kb * - you don't want to upload and host the file somewhere * - you don't need to use the file again (Replicate will not store it) */ input: unknown; /** * Body param: **This field is deprecated.** * * Request a URL to receive streaming output using * [server-sent events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). * * This field is no longer needed as the returned prediction will always have a * `stream` entry in its `url` property if the model supports streaming. */ stream?: boolean; /** * Body param: An HTTPS URL for receiving a webhook when the prediction has new * output. The webhook will be a POST request where the request body is the same as * the response body of the [get prediction](#predictions.get) operation. If there * are network problems, we will retry the webhook a few times, so make sure it can * be safely called more than once. Replicate will not follow redirects when * sending webhook requests to your service, so be sure to specify a URL that will * resolve without redirecting. */ webhook?: string; /** * Body param: By default, we will send requests to your webhook URL whenever there * are new outputs or the prediction has finished. You can change which events * trigger webhook requests by specifying `webhook_events_filter` in the prediction * request: * * - `start`: immediately on prediction start * - `output`: each time a prediction generates an output (note that predictions * can generate multiple outputs) * - `logs`: each time log output is generated by a prediction * - `completed`: when the prediction reaches a terminal state * (succeeded/canceled/failed) * * For example, if you only wanted requests to be sent at the start and end of the * prediction, you would provide: * * ```json * { * "input": { * "text": "Alice" * }, * "webhook": "https://example.com/my-webhook", * "webhook_events_filter": ["start", "completed"] * } * ``` * * Requests for event types `output` and `logs` will be sent at most once every * 500ms. If you request `start` and `completed` webhooks, then they'll always be * sent regardless of throttling. */ webhook_events_filter?: Array<'start' | 'output' | 'logs' | 'completed'>; /** * Header param: Leave the request open and wait for the model to finish generating * output. Set to `wait=n` where n is a number of seconds between 1 and 60. * * See https://replicate.com/docs/topics/predictions/create-a-prediction#sync-mode * for more information. */ Prefer?: string; } export declare namespace Predictions { export { type PredictionCreateParams as PredictionCreateParams }; } //# sourceMappingURL=predictions.d.ts.map