Skip to content

InMemoryTraceSource

autogen.beta.eval.sources.trace_source.InMemoryTraceSource #

InMemoryTraceSource(traces)

A :class:TraceSource over already-built traces held in memory.

Used by the live produce-then-evaluate path: a producer captures spans, reconstructs each :class:Trace, and hands them here — no disk round-trip.

Source code in autogen/beta/eval/sources/trace_source.py
def __init__(self, traces: Sequence[tuple[TraceRef, Trace]]) -> None:
    self._refs: tuple[TraceRef, ...] = tuple(ref for ref, _ in traces)
    self._by_id: dict[str, Trace] = {ref.trace_id: trace for ref, trace in traces}

list async #

list()
Source code in autogen/beta/eval/sources/trace_source.py
async def list(self) -> AsyncIterator[TraceRef]:
    for ref in self._refs:
        yield ref

load async #

load(ref)
Source code in autogen/beta/eval/sources/trace_source.py
async def load(self, ref: TraceRef) -> Trace:
    return self._by_id[ref.trace_id]