Evaluate a decision
POST/api/v2/Decisions
Each question asks for the probability that a condition is true (predicate), one of the supplied values (choice) or a rating against ordered levels (score). Answers come back in question order, and a question the model declines to answer gets a refusal answer. The model can be selected by model id or by model code + vendor. The input can be a plain string, or an ordered array of messages (with text and base64 image parts), function calls and function call outputs, such as an agent trace. Function calls are evidence only and are never executed.
Request
Query Parameters
Use this param to override the culture of the response. Options: - en (default) - es
- application/json
Body
required
The decision model, the input and the questions to answer about it.
- MOD1
- MOD2
Array [
- MOD1
- MOD2
Array [
]
- MOD1
- MOD2
Array [
]
]
Array [
Array [
]
Array [
]
]
input
object
required
oneOf
string
message (the default when absent), function_call or function_call_output.
A message's author: user, developer, system or assistant.
An assistant message's phase: commentary or final_answer.
content
object
oneOf
string
input_text, input_image, output_text or refusal.
A base64 data URL, such as data:image/png;base64,iVBORw0…. HTTP(S) URLs are not supported.
The image's detail level: low, high, auto or original.
The assistant's refusal message.
The id of a function call or function call output.
Links a function_call_output to its function_call.
A function call's namespace.
The called function's name.
The function call's arguments, usually a JSON object. Sent to the model as is, so it can be empty or invalid JSON.
output
object
oneOf
string
input_text, input_image, output_text or refusal.
A base64 data URL, such as data:image/png;base64,iVBORw0…. HTTP(S) URLs are not supported.
The image's detail level: low, high, auto or original.
The assistant's refusal message.
A function call or output's status: in_progress, completed or incomplete.
questions
object[]
required
Possible values: >= 1
The questions to answer about the input. Answers come back in the same order.
Possible values: non-empty, [predicate, choice, score]
The kind of answer: predicate (the probability that a condition is true), choice (one of choices) or score (a rating against levels). Case-insensitive.
Possible values: non-empty
Identifies the question's answer in the response. Unique within a request.
Possible values: non-empty
What the model evaluates about the input.
choices
object[]
nullable
The values a choice question can be answered with. At least two, each unique.
Possible values: non-empty
The value returned as the answer when this choice is picked. Unique within the question.
Optional guidance on when this value applies.
levels
object[]
nullable
The levels a score question rates against, ordered from lowest to highest. At least two.
Possible values: non-empty
The level's name, returned with its probability in the answer.
Optional guidance on what this level means.
Possible values: <= 256 characters
Optional user identifier for tracking and cost management purposes.
Possible values: <= 64 characters
The channel used in the execution.
The unique identifier of the AI model to use. Used instead of Vendor and ModelCode.
The model code to use. Used together with Vendor when AIModelId is not provided.
The vendor of the model to use. Used together with ModelCode when AIModelId is not provided.
Responses
- 200
- 400
- 401
- 403
- 404
- 429
- 500
- 502
Returns one answer per question, plus the execution instance id, usage and cost.
- text/plain
- application/json
- text/json
- Schema
- Example (from schema)
Schema
Array [
- DecisionExecutionAnswerPredicateAnswer
- DecisionExecutionAnswerChoiceAnswer
- DecisionExecutionAnswerScoreAnswer
- DecisionExecutionAnswerRefusalAnswer
Array [
]
Array [
]
]
The unique identifier of the decision instance.
answers
object[]
nullable
One answer per question, in question order.
oneOf
Possible values: [predicate]
Estimated probability, from 0 to 1, that the condition is true.
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
Possible values: [choice]
probabilities
object[]
nullable
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
Possible values: [score]
Probability-weighted average of the 0-based level indices, so it can fall between levels.
probabilities
object[]
nullable
The 0-based index of the level.
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
The model declined to answer this question. Other questions in the same request can still be answered.
Possible values: [refusal]
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
usage
object
cost
object
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"answers": [
{},
{},
{},
{}
],
"usage": {
"inputUnit": "string",
"input": 0,
"outputUnit": "string",
"output": 0
},
"cost": {
"amount": 0,
"currency": "string"
}
}
- Schema
- Example (from schema)
Schema
Array [
- DecisionExecutionAnswerPredicateAnswer
- DecisionExecutionAnswerChoiceAnswer
- DecisionExecutionAnswerScoreAnswer
- DecisionExecutionAnswerRefusalAnswer
Array [
]
Array [
]
]
The unique identifier of the decision instance.
answers
object[]
nullable
One answer per question, in question order.
oneOf
Possible values: [predicate]
Estimated probability, from 0 to 1, that the condition is true.
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
Possible values: [choice]
probabilities
object[]
nullable
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
Possible values: [score]
Probability-weighted average of the 0-based level indices, so it can fall between levels.
probabilities
object[]
nullable
The 0-based index of the level.
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
The model declined to answer this question. Other questions in the same request can still be answered.
Possible values: [refusal]
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
usage
object
cost
object
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"answers": [
{},
{},
{},
{}
],
"usage": {
"inputUnit": "string",
"input": 0,
"outputUnit": "string",
"output": 0
},
"cost": {
"amount": 0,
"currency": "string"
}
}
- Schema
- Example (from schema)
Schema
Array [
- DecisionExecutionAnswerPredicateAnswer
- DecisionExecutionAnswerChoiceAnswer
- DecisionExecutionAnswerScoreAnswer
- DecisionExecutionAnswerRefusalAnswer
Array [
]
Array [
]
]
The unique identifier of the decision instance.
answers
object[]
nullable
One answer per question, in question order.
oneOf
Possible values: [predicate]
Estimated probability, from 0 to 1, that the condition is true.
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
Possible values: [choice]
probabilities
object[]
nullable
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
Possible values: [score]
Probability-weighted average of the 0-based level indices, so it can fall between levels.
probabilities
object[]
nullable
The 0-based index of the level.
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
The model declined to answer this question. Other questions in the same request can still be answered.
Possible values: [refusal]
Possible values: [predicate, choice, score, refusal]
The answer type, matching the question type. refusal when the model declined to answer the question.
The name of the question this answers.
usage
object
cost
object
{
"instanceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"answers": [
{},
{},
{},
{}
],
"usage": {
"inputUnit": "string",
"input": 0,
"outputUnit": "string",
"output": 0
},
"cost": {
"amount": 0,
"currency": "string"
}
}
If the request validation fails, or the vendor rejects the request (aiservice_execution_failed).
- application/json
- Schema
- Example (from schema)
Schema
- MOD1
- MOD2
Array [
]
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
errors
object
nullable
Map of keys (an invalid request field or the rule that failed) to messages. Only present when the error has specific detail to report. Values are strings, except on input_validation_error, where each value is an array of messages for that field.
property name*
object
nullable
oneOf
string
string
{
"code": "string",
"message": "string",
"documentationUrl": "string",
"errors": {}
}
The user is unauthorized or the session expired
- application/json
- Schema
- Example (from schema)
Schema
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
{
"code": "string",
"message": "string",
"documentationUrl": "string"
}
The user does not have permission
- application/json
- Schema
- Example (from schema)
Schema
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
{
"code": "string",
"message": "string",
"documentationUrl": "string"
}
If the specified model is not found, or no decision model matches the model code and vendor.
- application/json
- Schema
- Example (from schema)
Schema
- MOD1
- MOD2
Array [
]
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
errors
object
nullable
Map of keys (an invalid request field or the rule that failed) to messages. Only present when the error has specific detail to report. Values are strings, except on input_validation_error, where each value is an array of messages for that field.
property name*
object
nullable
oneOf
string
string
{
"code": "string",
"message": "string",
"documentationUrl": "string",
"errors": {}
}
If the provider rate-limited the request.
There was an unexpected error
- application/json
- Schema
- Example (from schema)
Schema
Stable, machine-readable error code. Branch on this value, not on message.
Human-readable, localised summary of the error.
Link to the documentation section for this error code.
{
"code": "string",
"message": "string",
"documentationUrl": "string"
}
If the provider failed.