Light Logo
Predictions

Create a prediction.

Create a prediction for the provided inputs against the specified model. By default this endpoint handles requests asynchronously by creating a prediction and returning the created prediction without waiting for a response from the model. This endpoint can be made to wait for a response by passing a optional Prefer header with the wait time. This endpoint will then wait upto the wait time specified for a response from the model. If it receives one it will return the response otherwise the pending prediction is returned which can be polled for updates using get prediction endpoint.

POST
/predictions
AuthorizationBearer <token>

In: header

Header Parameters

Validate-Input?Validate-Input

Enable early input validation against the model schema to catch invalid inputs before spinning up the hardware, adding slight latency, but avoiding unnecessary execution and cost.

Defaultfalse
Prefer?Prefer

Pass a wait time to tell the server how long to wait in seconds for a prediction response. e.g Prefer: wait=10 will wait for upto 10 seconds. Other preferences passed will be ignored which means Prefer: wait=10 and Prefer: respond-async, wait=10 are equivalent as the respond-async directive is ignored.

modelModel

The model to use. Models must be in the following format: model_owner/model_name or model_owner/model_name:version_number. If no version is specified, the prediction runs with the model's latest version otherwise it runs with the specified version.

inputInput

The input to pass to the model during prediction.

Empty Object

webhook?Webhook | null

Details about the webhook to post prediction updates to.

Response Body

curl -X POST "https://api.wrift.ai/v1/predictions" \  -H "Validate-Input: false" \  -H "Prefer: string" \  -H "Content-Type: application/json" \  -d '{    "model": "string",    "input": {}  }'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "model": {
    "owner": "string",
    "name": "string",
    "version_number": 0
  },
  "created_at": "2019-08-24T14:15:22Z",
  "status": "pending",
  "updated_at": "2019-08-24T14:15:22Z",
  "setup_time": "string",
  "execution_time": "string",
  "error": {
    "source": "internal",
    "message": "string",
    "detail": null
  },
  "input": null,
  "output": null
}
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "model": {
    "owner": "string",
    "name": "string",
    "version_number": 0
  },
  "created_at": "2019-08-24T14:15:22Z",
  "status": "pending",
  "updated_at": "2019-08-24T14:15:22Z",
  "setup_time": "string",
  "execution_time": "string",
  "error": {
    "source": "internal",
    "message": "string",
    "detail": null
  },
  "input": null,
  "output": null
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}