> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reilabs.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Predict state values

> Evaluate one or more state inputs with the installed value model or a candidate, and bind evaluation to the expected model identity when required.

Predict values for 1 to 256 inputs using the installed Adapt-1 value model or its candidate. Set `model_source` explicitly when comparing models and supply the expected model hash for a bound evaluation. See [prediction contracts](https://docs.reilabs.org/docs/neuroadapt/value-api.md#predict) for representation and counterpart-field notes.

The request tables below describe schema version 5. A default marked "Not declared" is absent from that schema; it does not mean `null`. Check `/version` at the API host root and confirm compatibility with your deployment.

## Path, headers, and query

Send the hosted API key as `Authorization: Bearer <ADAPT1_API_KEY>`. The authenticated identity determines ownership; follow [HTTP and contracts](https://docs.reilabs.org/docs/neuroadapt/request-contracts.md) for the session placeholder.

| Parameter | Location | Required | Type | Constraints |
| - | - | - | - | - |
| `domain_id` | path | Yes | `string` | No further constraint declared |
| `X-Neuroadapt-Session-Id` | header | No | `string` or `null` | No further constraint declared |

`X-Neuroadapt-Session-Id` is a compatibility header in schema version 5. It does not replace the hosted bearer identity.

## JSON body contract

Content type: `application/json`. The HTTP request body is required. The following table describes its fields; linked schema names lead to the complete nested definitions on this page. When an array type also permits `null`, that alternative applies to the entire field, not to individual array items.

## Request body

Schema: `ValuePredictRequest`.

Fields outside this object's declared properties are rejected by the schema.

| Field | Required | Type | Declared default | Constraints |
| - | - | - | - | - |
| `complementary_total` | No | `number` | `1` | No further constraint declared |
| `counterparts` | No | array of [ValueInput](#valueinput) or `null` | Not declared | 1 to 256 items |
| `expected_model_sha256` | No | `string` or `null` | Not declared | No further constraint declared |
| `inputs` | Yes | array of [ValueInput](#valueinput) | Not declared | 1 to 256 items |
| `model_source` | No | `string` | `installed` | Values: `installed`, `candidate` |
| `session_id` | Yes | `string` | Not declared | At least 1 character |

## ValueInput

Schema: `ValueInput`.

Fields outside this object's declared properties are rejected by the schema.

| Field | Required | Type | Declared default | Constraints |
| - | - | - | - | - |
| `conditions` | No | map of `number` values | Not declared | At most 16 properties |
| `context` | No | map of `number` values | Not declared | At most 16 properties |
| `include_moments` | No | `boolean` | `false` | No further constraint declared |
| `include_positions` | No | `boolean` | `true` | No further constraint declared |
| `objects` | No | array of object or `null` | Not declared | At most 512 items |
| `policy_features` | No | map of `number` values | Not declared | At most 4096 properties |
| `relations` | No | array of object | Not declared | At most 4096 items |

## Select the model you intend to evaluate

Read `value/state` after the relevant fit has completed, then bind the model explicitly:

| Model | `model_source` | Value for `expected_model_sha256` |
| - | - | - |
| Installed evaluator | `installed` | `model.model_sha256` from state |
| Staged candidate | `candidate` | `candidate.model_sha256` from state |

Use the same encoded inputs when comparing the two models. If a model changes, preserve the response and reconcile state before repeating the comparison. Do not replace the expected hash and reuse an earlier model's results as if they belonged to the replacement.

## Responses

| HTTP status | Schema-defined contract |
| - | - |
| 200 | Successful JSON response. The schema does not type its properties. |
| 422 | Request validation error; the schema references `HTTPValidationError`. |

The validation error shape has an optional `detail` array. Each validation entry requires `loc` (an array of strings or integers), `msg` (string), and `type` (string); it can also include `ctx` (object) and `input` (any JSON value). Operational refusals can have their own error details.

## Read the prediction response

This shortened response example shows the fields used to read predictions and verify model identity. Prediction values are rounded, model and dataset hashes are placeholders, and Domain/session fields and the run-specific model version are omitted. Confirm the response shape for your deployment before using it.

```json Prediction response fields theme={null}
{
  "predictions": [0.5273, 0.5252],
  "evaluator": {
    "source": "value_model",
    "model_type": "object_value",
    "model_sha256": "<model-sha256>",
    "dataset_sha256": "<dataset-sha256>",
    "frozen": true,
    "learning_updates": false
  }
}
```

Read `predictions` as a numeric array in input order. Keep your ordered input identifiers locally. Before consuming the array, check the model identity and require one finite numeric prediction for every submitted input. A missing or malformed result must not become a default score.

```python Validate a prediction batch theme={null}
import math


def checked_predictions(response, input_count, expected_model_sha256):
    if not isinstance(expected_model_sha256, str) or len(expected_model_sha256) != 64:
        raise ValueError("Read the expected model SHA-256 from value/state first")
    if not isinstance(response, dict) or not isinstance(response.get("evaluator"), dict):
        raise ValueError("Prediction response is missing its evaluator")
    evaluator = response["evaluator"]
    if evaluator.get("model_sha256") != expected_model_sha256:
        raise ValueError("Prediction came from an unexpected model")
    predictions = response.get("predictions")
    if not isinstance(predictions, list) or len(predictions) != input_count:
        raise ValueError("Prediction count does not match the input batch")
    if any(type(value) not in (int, float) or not math.isfinite(value)
           for value in predictions):
        raise ValueError("Predictions must be finite numbers")
    return predictions
```

The example's `frozen: true` describes the evaluator state shown; it is not a prerequisite for every prediction request. Inspect `frozen` and `learning_updates` when checking an evaluation boundary. Use `evaluator.model_sha256` to identify the function's artifact, then compare values on fixed inputs to determine whether its behavior changed.

For a new deployment, retain a response from a small known input batch and verify the shape and input/result alignment before relying on batch parsing. The [Python workflow client](https://docs.reilabs.org/docs/neuroadapt/value-client-workflow.md) shows request construction, job polling, and prediction checks together.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.