Skip to content

Decide one case

POST
/v1/models/{model}/decide
curl --request POST \
--url https://api.pensievelabs.co/v1/models/grade-audit/decide \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "input": { "task": "rust-2291", "grade": "pass", "log": "Grader: PASS · 14 of 14 tests passed. Test change: expected page size 20 → 21" }, "key": "rust-2291" }'

Sends one case to the model’s live version (or the version you pin) and returns one of its answers. When routed is fallback, the answer is still returned, but your code, or the SDK’s capture, should answer instead. A model with no live version answers only with version pinned; otherwise the call is refused with conflict.

model
required
string

The model’s slug, such as grade-audit, or its mdl_ id.

Example

grade-audit
Idempotency-Key
string
<= 255 characters

Any unique string. Sending it again within 24 hours returns the first response.

Media typeapplication/json
object
input
required
One of:
object
key
additional properties
any
key

Your own reference for the case, to send outcomes by.

string
<= 255 characters
version

Pin a version instead of the live one.

string
metadata
object
<= 20 properties
key
additional properties
string

Example

{
"input": {
"task": "rust-2291",
"grade": "pass",
"log": "Grader: PASS · 14 of 14 tests passed. Test change: expected page size 20 → 21"
},
"key": "rust-2291"
}

The decision.

Media typeapplication/json
object
id
required

The call id; send outcomes and corrections with it.

string
object
required
Allowed value: decision
model
required
string
version
required
string
answer
required

One of the model’s answer values.

string
label
required
string
confidence
required
number
<= 1
scores
required

The probability of each answer value.

object
key
additional properties
number
reason
required

A short reason, when the model gives one.

string | null
routed
required

fallback when your code should answer instead: routing is observe, the confidence is under the threshold, or the split sent the call to your code.

string
Allowed values: model fallback
key
required
string | null
latency_ms
required
integer
created_at
required
string format: date-time

Example

{
"id": "cl_8f21c0d4",
"object": "decision",
"model": "grade-audit",
"version": "v7",
"answer": "false_pass",
"label": "False pass",
"routed": "model"
}

Something went wrong; error.type says what.

Media typeapplication/json
object
error
required
object
type
required
string
Allowed values: invalid_request authentication permission not_found conflict rate_limit not_available server
message
required
string
param

The request field the error is about.

string | null
request_id
required
string

Example

{
"error": {
"type": "invalid_request"
}
}