---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/interfaces/RawGenerationObservation.md
description: >-
  One observation of a battery's raw model output for a single completed
  generation, fired the instant the full text is in hand — AFTER envelope-token
  stripping + reasoning/tool-call parsing, but BEFORE the parsed result is
  persisted. The whole point is to expose the gap between what the model
  literally emitted (`rawText`) and what the battery managed to extract
  (`cleanedText` / `toolCalls` / `reasoning`): when a small on-device model
  emits a tool call in a shape no parser matches, the call silently leaks into
  `cleanedText` as prose, and this is the ONLY seam where that is visible.
---

# Interface: RawGenerationObservation

Defined in: [src/batteries/llm/chat\_common/types.ts:346](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/types.ts#L346)

One observation of a battery's raw model output for a single completed generation, fired the instant
the full text is in hand — AFTER envelope-token stripping + reasoning/tool-call parsing, but BEFORE
the parsed result is persisted. The whole point is to expose the gap between what the model literally
emitted (`rawText`) and what the battery managed to extract (`cleanedText` / `toolCalls` /
`reasoning`): when a small on-device model emits a tool call in a shape no parser matches, the call
silently leaks into `cleanedText` as prose, and this is the ONLY seam where that is visible.

## Remarks

This is a pure observability tap — it returns `void`, never mutates the result, and never throws into
the generation path (the adapter swallows callback errors). It fires once per terminal generation
(one per non-streamed turn; one per stream at stream end), for BOTH the transformers.js and LiteRT-LM
on-device batteries, at the identical point in each. Use it for parser bring-up against a new model,
live debugging ("why did the agent abstain?"), or capturing ground-truth fixtures — exactly the job
that previously required patching a temporary hook into the adapter.

## Properties

| Property                                        | Type                                                                                       | Description                                                                                                                                                                                                                                                                | Defined in                                                                                                                                    |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|  `cleanedText` | `string`                                                                                   | The residual prose after reasoning + tool-call extraction — what becomes the assistant message `content`. If a tool call failed to parse, its source text is still here (the leak).                                                                                        | [src/batteries/llm/chat\_common/types.ts:357](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/types.ts#L357) |
|  `rawText`         | `string`                                                                                   | The model's complete decoded output for this generation, with non-semantic envelope/turn-boundary special tokens already stripped (the same text handed to the parsers) — i.e. what the parsers actually saw. This is the field to inspect when a tool call did not parse. | [src/batteries/llm/chat\_common/types.ts:352](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/types.ts#L352) |
|  `reasoning`     | readonly `string`\[]                                                                        | The reasoning/thinking traces the reasoning parser extracted (empty when none / not applicable).                                                                                                                                                                           | [src/batteries/llm/chat\_common/types.ts:359](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/types.ts#L359) |
|  `streamed`       | `boolean`                                                                                  | Whether this generation streamed its prose to the consumer (vs. a single batch decode).                                                                                                                                                                                    | [src/batteries/llm/chat\_common/types.ts:363](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/types.ts#L363) |
|  `streamId`       | `string`                                                                                   | The adapter's stream/message id for this generation, for correlating with other telemetry.                                                                                                                                                                                 | [src/batteries/llm/chat\_common/types.ts:365](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/types.ts#L365) |
|  `toolCalls`     | readonly [`ParsedToolCall`](../llm/transformers_js/helpers/interfaces/ParsedToolCall.md)\[] | The tool calls the tool-call parser extracted (empty when the model emitted none, or none parsed).                                                                                                                                                                         | [src/batteries/llm/chat\_common/types.ts:361](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/llm/chat_common/types.ts#L361) |
