MCPcopy
hub / github.com/microsoft/agent-lightning / make_reward_span

Function make_reward_span

tests/algorithm/test_apo.py:113–133  ·  view source on GitHub ↗
(rollout_id: str, attempt_id: str, reward: float, sequence_id: int)

Source from the content-addressed store, hash-verified

111
112
113def make_reward_span(rollout_id: str, attempt_id: str, reward: float, sequence_id: int) -> Span:
114 hex_id = f"{sequence_id:032x}"
115 span_hex = f"{sequence_id:016x}"
116 return Span(
117 rollout_id=rollout_id,
118 attempt_id=attempt_id,
119 sequence_id=sequence_id,
120 trace_id=hex_id,
121 span_id=span_hex,
122 parent_id=None,
123 name=AGL_ANNOTATION,
124 status=TraceStatus(status_code="OK"),
125 attributes={"reward": reward},
126 events=[],
127 links=[],
128 start_time=None,
129 end_time=None,
130 context=SpanContext(trace_id=hex_id, span_id=span_hex, is_remote=False, trace_state={}),
131 parent=None,
132 resource=SpanResource(attributes={}, schema_url=""),
133 )
134
135
136def test_batch_iter_over_dataset_returns_full_dataset(monkeypatch: pytest.MonkeyPatch) -> None:

Calls 3

SpanClass · 0.90
TraceStatusClass · 0.90
SpanContextClass · 0.90

Tested by

no test coverage detected