# speculation message

Last updated: 2026-11-19

The verdict of a speculative LLM turn, right after the final it is about (with
`end_of_turn.speculation`; `receive_realtime_processing_events`). Sent on a `keep` too.

## Fields

- `type` ("speculation", required)
- `session_id` (string, required)
- `created_at` (string, required)
- `error` (any, default: `null`)
- `data` (object, required)
  - `utterance_id` (string, required)
  - `utterance` (object, required)
  - `results` (array of object, required): One verdict, the final's.
    - `eager_text` (string, default: `null`): The text of `end_of_turn.data.text`, the one compared. Absent on a session that masks PII (`pii` in a mode other than `tag`): the partial it went out on is not masked.
    - `eager_end` (number, default: `null`): Seconds of audio when the turn ended.
    - `similarity` (number, default: `null`): How close the final is to `eager_text`, from 0 (nothing in common) to 1 (the same). The score `recommendation` is decided on.
    - `lexical_similarity` (number, default: `null`): The same, on the words alone.
    - `recommendation` (string, required, one of: `keep`, `discard`): `keep`: the LLM call started on `end_of_turn` still answers what was said; `discard`: cancel it and answer the final.
    - `reason` (string, default: `null`): Why: `same_text` and `similar` keep; `text_changed`, `caller_went_on` and `new_entity` discard (`caller_went_on`: the speaker kept talking after the end of turn, so the turn was not over; `new_entity`: the final names an entity the eager text lacked, see `new_entities`). The engine may add values, read it as a label.
    - `new_entities` (array of object, default: `null`): With `named_entity_recognition` or `pii` on: the entities of the final whose words are not in `eager_text`; `[]` when there is none; `null` when not checked (neither add-on on, or `entities: false`).
      - `entity_type` (string, required)
      - `score` (number, required)
      - `text` (string, default: `null`): The entity's words. Absent on a session that masks PII.

## Example

```json
{
  "type": "speculation",
  "session_id": "string",
  "created_at": "string",
  "error": null,
  "data": {
    "utterance_id": "string",
    "utterance": {},
    "results": [
      {
        "eager_text": "string",
        "eager_end": 0.5,
        "similarity": 0.5,
        "lexical_similarity": 0.5,
        "recommendation": "keep",
        "reason": "string",
        "new_entities": [
          {
            "entity_type": "string",
            "score": 0.5,
            "text": "string"
          }
        ]
      }
    ]
  }
}
```
