Skip to navigation

nemo_gym.models.token_capture.replay

View as Markdown

Source-content facts for source-history capture decisions.

This module records what the gateway received and exposed. It does not decide whether to splice tokens, compact a context, or create a training segment.

Module Contents

Functions

NameDescription
_digest-
_normalize_arguments-
_plain-
render_options_digestIdentify the effective gateway options that can shape a rendered prompt.
replay_contextHash ordered source items without discarding exposed reasoning content.
same_replay_sourceCompare source facts; render compatibility remains the worker’s decision.
summarize_replaySummarize a complete source history or a prefix of the current request.

API

nemo_gym.models.token_capture.replay._digest(
value: typing.Any
) -> str
nemo_gym.models.token_capture.replay._normalize_arguments(
value: dict
) -> None
nemo_gym.models.token_capture.replay._plain(
value: typing.Any
) -> typing.Any
nemo_gym.models.token_capture.replay.render_options_digest(
payload: dict[str, typing.Any]
) -> str

Identify the effective gateway options that can shape a rendered prompt.

nemo_gym.models.token_capture.replay.replay_context(
items: list[dict],
render_digest: str | None = None

Hash ordered source items without discarding exposed reasoning content.

Only documented non-prompt response metadata is ignored. Unknown item kinds fail instead of collapsing to a fingerprint that could restore edited text. Media URLs/data are hashed here, never copied into the capture manifest.

nemo_gym.models.token_capture.replay.same_replay_source(
allow_empty_tool_content: bool = False
) -> bool

Compare source facts; render compatibility remains the worker’s decision.

nemo_gym.models.token_capture.replay.summarize_replay(
item_count: int | None = None

Summarize a complete source history or a prefix of the current request.

Roles and item order are authenticated along with the normalized content. Reject an unavailable prefix rather than silently hashing a shorter slice.