Large REST responses
Some deployments generate a lot of data and it can be more performant to store that data in S3 instead of processing it through the API. In these cases, use the links
response format. The links
response format temporarily stores the results of your inference request in S3 and returns a link to the results in the REST response.
- modelbit.get_inference
- requests
- curl
Set the response_format: "links"
parameter of get_inference
:
import modelbit
modelbit.get_inference(..., response_format: "links")
Add "response_format": "links"
as a sibling to the data
payload:
import json, requests
requests.post("https://...",
data=json.dumps({
"data": ...,
"response_format": "links"
}).json()
Add "response_format": "links"
as a sibling to the data
payload:
curl -s -XPOST "https://..." -d '{"data": ..., "response_format": "links"}'
Responses will contain a link to the results:
{ "data": "https://.../abc123.json?..." }
The response URLs are signed and expire after 1 hour.