Skip to main content

Real-time Functions

confidence_scoring is still accepted for compatibility and has no effect. Use batch_run_function() instead for large tables; run_function() waits for one result and can be rate limited. Native sidecar Functions return an accepted run internally; the SDK polls and cancels on timeout without resubmitting inference. Hosted calls remain synchronous. See Run a Function for the walkthrough and the API reference for the full request and response contract, limits, and error codes.

FunctionRunResult

The return value is a dict of the response payload, with its fields also available as attributes.

Assets

Image and PDF input fields take a value built by sutro.Image or sutro.Asset. Both return plain dicts, so they can also be written out by hand or serialized with json.dumps().
Image accepts image/png, image/jpeg, and image/webp; Asset also accepts application/pdf. Anything else raises ValueError before the request is sent. Native Qwen3.5 and Gemma 4 vision Functions accept PDFs when the deployment advertises that support, in both real time and Batch. Native PDFs must be unencrypted and at most 32 MiB each; real-time images are limited to 5 MiB each. The server renders each PDF into page images with extracted text and page numbers. A row can contain at most eight images total, counting every PDF page and every separate image. Inputs exceeding this limit or the model’s context window are rejected rather than truncated. Inline base64 counts toward the 48 MiB request-body limit; use Asset.from_url() or Asset.from_name() for larger PDFs. Native Batch ingestion accepts images up to 20 MiB each through HTTPS URLs or raw image data URI strings. SDK inline image uploads and Harmonize dataset or Function collection images remain limited to 5 MiB each, including review reimports. Use Image.from_url() for larger Batch images. Encrypted PDFs and XFA forms are unsupported; export XFA forms to standard PDFs first. Documents exceeding preprocessing resource limits, including one million extracted characters per PDF, are rejected without truncation.

Errors

run_function() never retries. Every failure raises a requests.HTTPError subclass carrying the deployment’s detail, code, and request_id.

Command line

--input takes a JSON object, or @ followed by the path to a file holding one. The command prints the JSON response and exits non-zero with the deployment’s detail on failure.