Skip to main content

Inference

Run predictions on deployed models.

All methods are accessed via client.inference.

predict()

GET/v1/inference/predict/{version_id}

Predicts the target column for a batch of records. Accepts inline JSON records (list of row dicts) so it works from remote callers such as the hosted MCP server — no file paths. Uses the platform's inference proxy route, which requires an existing deployment for the model version (deploy the version first via deployments).

Parameters

recordslistRequired
Rows to score, as JSON records with the model's feature columns (post-preprocessing signature).
model_idstrRequired
The model id (kept for signature compatibility; the route is addressed by version_id).
version_idstrRequired
The version id.
thresholdfloatdefault: 0.5
The threshold for classification models.

Returns

dict: The prediction results.

Example

1result = client.inference.predict(
2 records=[],
3 model_id="model_abc123",
4 version_id="version_xyz789",
5 threshold=0.5
6)

score_dataset()

Score every row of a platform dataset and return the ranked top-N plus a distribution summary — "who are my highest-risk customers" on a real book. Rows go from object storage straight to the inference server (the deployment's linked preprocessor is applied there, so pass the RAW dataset the model was trained from), in 1,000-row batches, using a short-lived deploy key minted for the call. Nothing is persisted.

Parameters

dataset_idstrRequired
Platform dataset to score (raw / pre-preprocessing columns).
version_idstrRequired
Model version; it must have a deployment (deployments_deploy + deployments_activate_deployment).
thresholdfloatdefault: 0.5
Classification cut-off for `prediction` and the positive counts. Ignored for regression.
top_nintdefault: 50
Rows to return (max 500).
ascendingbooldefault: False
False (default) returns the highest scores first; True the lowest (e.g. safest customers, cheapest quotes).

Returns

dict — Dict with n_rows, model_type, summary (quantiles, positive_rate, deciles by descending score — decile 1 is the top 10%) and top: ranked rows carrying their source columns plus proba/prediction (classification) or prediction (regression). Max 50,000 rows per call; score a filtered dataset beyond that.

Example

1result = client.inference.score_dataset(
2 dataset_id="ds_abc123",
3 version_id="version_xyz789",
4 threshold=0.5,
5 top_n=1,
6 ascending=True
7)

predict_file()

Predicts the target column of a local CSV file.

Parameters

filenamestrRequired
The name of the file.
model_idstrRequired
The model id (kept for signature compatibility; the route is addressed by version_id).
version_idstrRequired
The version id.
thresholdfloatdefault: 0.5
The threshold for classification models.
delimiterstrdefault: ','
The delimiter of the file.

Returns

dict: The prediction results.

Example

1result = client.inference.predict_file(
2 filename="./data.csv",
3 model_id="model_abc123",
4 version_id="version_xyz789",
5 threshold=0.5,
6 delimiter=","
7)

stream_predictions()

Stream predictions for large datasets by processing in batches.

Parameters

filenamestrRequired
Path to CSV file to stream
model_idstrRequired
ID of the model
version_idstrRequired
ID of the model version
thresholdfloatdefault: 0.5
Classification threshold
delimiterstrdefault: ','
CSV delimiter
batch_sizeintdefault: 1000
Size of each batch to process

Example

1result = client.inference.stream_predictions(
2 filename="./data.csv",
3 model_id="model_abc123",
4 version_id="version_xyz789",
5 threshold=0.5,
6 delimiter=",",
7 batch_size=1000
8)