nemo_gym.rollouts.model_calls
nemo_gym.rollouts.model_calls
Read saved model exchanges, resolve ownership, and attach evidence to rollouts.
Module Contents
Functions
Data
API
Aggregate model-call metrics for one rollout id.
Wait until no claimed capture write for this rollout is outstanding.
A cancelled model call finishes its capture write detached (see the shield in
_CaptureMiddleware), so the row can land after the rollout record is snapshotted and be
missing from ng_model_call_capture while present on disk. Returns False on timeout, which
the merge turns into a model_call_capture_pending gap rather than a silent omission.
Remove stale per-rollout capture files for these records before dispatch.
Capture files are keyed by a deterministic rollout id (task-rollout-attempt), so without this a fresh run or a kill-shaped retry would append onto the previous attempt’s capture for the same id. The caller passes only rows about to be dispatched, after assigning any retry suffix.
Attach captured model-call observability data to a rollout record in place.
Keyed by the rollout id derived from the record’s task/rollout/attempt indices, so the attached
shape is identical for every agent harness. Adds
ng_model_call_capture = {rollout_id, metrics, calls} where calls are derived observability
records. Raw request and response payloads remain in the capture store and are omitted from the
attachment unless include_payloads is true. Capture/read/join failures are attached as
gaps. The harness output and reward are not modified.
Return the single run-wide capture directory when capture is enabled.
Return the run-wide observability_enabled flag directly, without going through capture dirs.
Read valid call records and count damaged records.
Read captured exchanges in durable append order.