> For the complete documentation index, see [llms.txt](https://docs.cortecs.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cortecs.ai/examples/decisions.md).

# Decisions

**Decisions** answer typed questions about application state, returning structured values and probabilities instead of free-form text. Use them for classification, routing, and scoring.

To explore available models, visit [cortecs.ai](https://cortecs.ai/serverlessModels?tags=Decision) and filter by the **Decision** tag.

#### Choose a request format

|                    | Decisions format                                         | System One format           |
| ------------------ | -------------------------------------------------------- | --------------------------- |
| Endpoint used      | `/v1/decisions`                                          | `/v1/systemone`             |
| Input field        | `input`                                                  | `state`                     |
| Questions          | Array, with a `name` for each question in these examples | Object keyed by question ID |
| Question types     | `predicate`, `choice`, `score`                           | `noul`, `choice`, `score`   |
| Response `answers` | Array                                                    | Object keyed by question ID |
| Yes/no result      | `probability`                                            | `noul`                      |

{% hint style="info" %}
`/v1/decisions` also accepts System One requests (`state` and a questions object). The response follows the request format. `/v1/systemone` accepts only the System One format.
{% endhint %}

Choose the format your application uses. Cortecs handles the selected provider's upstream route and format. Limits depend on the selected provider.

#### Decisions example

{% tabs %}
{% tab title="Python" %}

```python
import requests

payload = {
    "model": "<MODEL_NAME>",
    "input": "The cold-storage room is at 9 degrees Celsius. The maximum allowed temperature is 5 degrees Celsius.",
    "questions": [
        {
            "type": "predicate",
            "name": "inspect",
            "instructions": "Does the cold-storage room need inspection?"
        }
    ]
}

response = requests.post(
    "https://api.cortecs.ai/v1/decisions",
    headers={"Authorization": "Bearer <API_KEY>"},
    json=payload,
)
response.raise_for_status()
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const payload = {
  "model": "<MODEL_NAME>",
  "input": "The cold-storage room is at 9 degrees Celsius. The maximum allowed temperature is 5 degrees Celsius.",
  "questions": [
    {
      "type": "predicate",
      "name": "inspect",
      "instructions": "Does the cold-storage room need inspection?"
    }
  ]
};

const response = await fetch("https://api.cortecs.ai/v1/decisions", {
  method: "POST",
  headers: {
    Authorization: "Bearer <API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(payload)
});

if (!response.ok) {
  throw new Error(`Decision request failed: ${response.status} ${await response.text()}`);
}

console.log(await response.json());
```

{% endtab %}

{% tab title="Curl" %}

```bash
curl 'https://api.cortecs.ai/v1/decisions' \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "<MODEL_NAME>",
  "input": "The cold-storage room is at 9 degrees Celsius. The maximum allowed temperature is 5 degrees Celsius.",
  "questions": [
    {
      "type": "predicate",
      "name": "inspect",
      "instructions": "Does the cold-storage room need inspection?"
    }
  ]
}'
```

{% endtab %}
{% endtabs %}

Example `answers` field (values vary by model and input):

```json
{
  "answers": [
    {
      "type": "predicate",
      "name": "inspect",
      "probability": 0.98
    }
  ]
}
```

#### System One example

{% tabs %}
{% tab title="Python" %}

```python
import requests

payload = {
    "model": "<MODEL_NAME>",
    "state": "The cold-storage room is at 9 degrees Celsius. The maximum allowed temperature is 5 degrees Celsius.",
    "questions": {
        "inspect": {
            "type": "noul",
            "instructions": "Does the cold-storage room need inspection?"
        }
    }
}

response = requests.post(
    "https://api.cortecs.ai/v1/systemone",
    headers={"Authorization": "Bearer <API_KEY>"},
    json=payload,
)
response.raise_for_status()
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const payload = {
  "model": "<MODEL_NAME>",
  "state": "The cold-storage room is at 9 degrees Celsius. The maximum allowed temperature is 5 degrees Celsius.",
  "questions": {
    "inspect": {
      "type": "noul",
      "instructions": "Does the cold-storage room need inspection?"
    }
  }
};

const response = await fetch("https://api.cortecs.ai/v1/systemone", {
  method: "POST",
  headers: {
    Authorization: "Bearer <API_KEY>",
    "Content-Type": "application/json"
  },
  body: JSON.stringify(payload)
});

if (!response.ok) {
  throw new Error(`Decision request failed: ${response.status} ${await response.text()}`);
}

console.log(await response.json());
```

{% endtab %}

{% tab title="Curl" %}

```bash
curl 'https://api.cortecs.ai/v1/systemone' \
  -H 'Authorization: Bearer <API_KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "<MODEL_NAME>",
  "state": "The cold-storage room is at 9 degrees Celsius. The maximum allowed temperature is 5 degrees Celsius.",
  "questions": {
    "inspect": {
      "type": "noul",
      "instructions": "Does the cold-storage room need inspection?"
    }
  }
}'
```

{% endtab %}
{% endtabs %}

Example `answers` field (values vary by model and input):

```json
{
  "answers": {
    "inspect": {
      "type": "noul",
      "noul": 0.98
    }
  }
}
```
