POST
/
job-results
/
Retrieving Results
curl --request POST \
  --url https://api.sutro.sh/job-results/ \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "job_id": "<string>",
  "include_inputs": true,
  "include_cumulative_logprobs": true
}'
{
  "results": {
    "inputs": [
      "What is the capital of France?",
      "Explain quantum computing in simple terms"
    ],
    "outputs": [
      "The capital of France is Paris.",
      "Quantum computing uses quantum mechanics principles to process information in ways that classical computers cannot..."
    ]
  },
  "message": "Results retrieved successfully for job batch_job_12345"
}
Retrieve the results of a batch inference job by its job_id.

Request Body

job_id
string
required
The job_id returned when you submitted the batch inference job
include_inputs
boolean
default:"false"
Whether to include the inputs in the results
include_cumulative_logprobs
boolean
default:"false"
Whether to include the cumulative logprobs in the results

Headers

Authorization
string
required
Your Sutro API key using Key authentication scheme.Format: Key YOUR_API_KEYExample: Authorization: Key sk_live_abc123...

Response

Returns the results of the batch inference job.
results
object
If include_inputs is True, the results will be a dictionary with inputs and outputs keys. If include_inputs is False, the results will be a dictionary with outputs key. Results are in the same order as the inputs.
message
string
Verbose message for the job’s results
{
  "results": {
    "inputs": [
      "What is the capital of France?",
      "Explain quantum computing in simple terms"
    ],
    "outputs": [
      "The capital of France is Paris.",
      "Quantum computing uses quantum mechanics principles to process information in ways that classical computers cannot..."
    ]
  },
  "message": "Results retrieved successfully for job batch_job_12345"
}

Code Examples

import requests

response = requests.post(
    'https://api.sutro.sh/job-results/',
    headers={
        'Authorization': 'Key YOUR_SUTRO_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'job_id': 'batch_job_12345',
        'include_inputs': True,
        'include_cumulative_logprobs': False
    }
)

result = response.json()
print(f"Message: {result['message']}")

if 'inputs' in result['results']:
    for i, (input_text, output_text) in enumerate(zip(result['results']['inputs'], result['results']['outputs'])):
        print(f"Input {i+1}: {input_text}")
        print(f"Output {i+1}: {output_text}")
        print("---")
else:
    for i, output_text in enumerate(result['results']['outputs']):
        print(f"Output {i+1}: {output_text}")

Notes

  • Results can only be retrieved for jobs that have completed successfully
  • The order of results matches the order of the original inputs
  • Including cumulative logprobs provides additional statistical information about the model’s confidence in its outputs