Saltar al contenido principal

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

    culture string

    Use this param to override the culture of the response. Options: - en (default) - es

Body

required

The decision model, the input and the questions to answer about it.

    input

    object

    required

    oneOf

    string

    questions

    object[]

    required

    Possible values: >= 1

    The questions to answer about the input. Answers come back in the same order.

  • Array [

  • type stringrequired

    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.

    name stringrequired

    Possible values: non-empty

    Identifies the question's answer in the response. Unique within a request.

    instructions stringrequired

    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.

  • Array [

  • value stringrequired

    Possible values: non-empty

    The value returned as the answer when this choice is picked. Unique within the question.

    description stringnullable

    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.

  • Array [

  • label stringrequired

    Possible values: non-empty

    The level's name, returned with its probability in the answer.

    description stringnullable

    Optional guidance on what this level means.

  • ]

  • ]

  • userIdentifier stringnullable

    Possible values: <= 256 characters

    Optional user identifier for tracking and cost management purposes.

    channel stringnullable

    Possible values: <= 64 characters

    The channel used in the execution.

    aiModelId uuidnullable

    The unique identifier of the AI model to use. Used instead of Vendor and ModelCode.

    modelCode stringnullable

    The model code to use. Used together with Vendor when AIModelId is not provided.

    vendor stringnullable

    The vendor of the model to use. Used together with ModelCode when AIModelId is not provided.

Responses​

Returns one answer per question, plus the execution instance id, usage and cost.

Schema

    instanceId uuid

    The unique identifier of the decision instance.

    answers

    object[]

    nullable

    One answer per question, in question order.

  • Array [

  • oneOf

    type string

    Possible values: [predicate]

    probability double

    Estimated probability, from 0 to 1, that the condition is true.

    type stringrequired

    Possible values: [predicate, choice, score, refusal]

    The answer type, matching the question type. refusal when the model declined to answer the question.

    name stringnullable

    The name of the question this answers.

  • ]

  • usage

    object

    inputUnit stringnullable
    input int32nullable
    outputUnit stringnullable
    output int32nullable

    cost

    object

    amount double
    currency stringnullable
Loading...