pub struct Transcript {Show 14 fields
pub final_response: String,
pub iterations: usize,
pub tool_calls_count: usize,
pub usage: Usage,
pub timing: Timing,
pub tool_calls: Vec<String>,
pub files: BTreeMap<String, String>,
pub trajectory: Option<Trajectory>,
pub events: Vec<Value>,
pub metrics: BTreeMap<String, f64>,
pub output: Vec<Part>,
pub metadata: Metadata,
pub error: Option<String>,
pub error_kind: ErrorKind,
}Expand description
Normalized result of running a Subject on one
Sample.
Every subject — in-process, CLI, or a custom integration — produces this same shape, so scorers and reporting never depend on a subject’s internals.
Subjects that can produce a structured record of what the agent did set
trajectory — the primary structured trajectory
contract (ATIF; see crate::trajectory). Provide trajectory and the
rest is derived: the flat fields (final_response, tool_calls,
iterations, usage) are its projections, filled automatically by the
framework wherever a transcript is produced or received (see
Transcript::project_trajectory) — a trajectory-only transcript works
with every existing scorer, no extra calls required. events is optional
and fully independent of trajectory: providing one, the other, both, or
neither are all valid, with no consistency obligation on the producer.
Fields§
§final_response: StringThe subject’s final response text.
iterations: usizeReasoning iterations / turns taken.
tool_calls_count: usizeNumber of tool calls made.
usage: UsageToken / cost usage.
timing: TimingWall-clock timing (duration, time-to-first-token).
tool_calls: Vec<String>Best-effort list of tool names invoked, in order.
files: BTreeMap<String, String>Files present in the subject’s workspace after the run (path → contents).
trajectory: Option<Trajectory>Structured ATIF trajectory of the run (steps with tool calls,
arguments, observations, per-step metrics) — the primary structured
trajectory contract. Optional: subjects that can produce it do;
text-only subjects omit it. When present, final_response,
tool_calls, iterations, and usage are projections of it, derived
automatically (trajectory::Trajectory::project_into, applied by the
framework on produce/receive) — a producer sets this field alone and
owes nothing else, events included. See crate::trajectory.
events: Vec<Value>Advanced / secondary: raw, producer-shaped debug events (e.g. the
everruns Event JSONL transcript). No cross-subject shape — scorers
and consumers must prefer trajectory for
anything it models (tool calls, arguments, observations, metrics);
events is only for debugging and data the trajectory doesn’t carry.
Optional and independent of trajectory (either, both, or neither).
metrics: BTreeMap<String, f64>Extensible numeric metrics a subject measured that the core doesn’t model as a typed field (recall@k, energy_joules, p95 latency, …).
Design: Usage/Timing stay typed because shared budget scorers depend
on their exact shape; everything else is an open vocabulary keyed by
name so a subject can report a new metric key and grade it with
metric_within/metric_at_least without a new protocol version (the
metrics map itself is a versioned, additive part of the wire). Use this
(not metadata) for anything you want to compare numerically — values
stay f64, surface in the JSON/HTML reports, and feed generic scorers.
output: Vec<Part>Multimodal output — the response as an ordered list of typed Parts
(text, image, audio, file, structured JSON) for subjects whose result
isn’t plain text. final_response stays the canonical text projection
(a text-only scorer keeps working); output carries the modalities text
can’t. Empty for the common text-only case.
metadata: MetadataFree-form metadata: observability links, run ids, etc.
error: Option<String>Set when the subject failed to complete the run.
error_kind: ErrorKindClassifies error: a Subject failure (the model
under test got it wrong — scored as a failure) vs. an
Infra failure (budget, rate limit, provider outage,
timeout — not the model’s fault). Defaulted/omitted for the common subject
case; meaningless when error is None.
Implementations§
Source§impl Transcript
impl Transcript
Sourcepub fn tool_invocations(&self) -> Vec<ToolInvocation<'_>>
pub fn tool_invocations(&self) -> Vec<ToolInvocation<'_>>
Structured tool invocations, ATIF-first: from trajectory when
present (names + arguments + observation content joined on
source_call_id), else synthesized name-only from the legacy
tool_calls list. Scorers use this — never events, whose
producer-shaped walking stays quarantined in the adapters.
Source§impl Transcript
impl Transcript
Sourcepub fn response(text: impl Into<String>) -> Self
pub fn response(text: impl Into<String>) -> Self
A transcript whose only content is a final response. Convenience for simple subjects and tests.
Sourcepub fn failed(error: impl Into<String>) -> Self
pub fn failed(error: impl Into<String>) -> Self
A failed transcript carrying an error message, attributed to the subject
under test (ErrorKind::Subject) — a real, scoreable failure. For an
infrastructure failure that should not be scored against the model, use
Transcript::infra_error.
Sourcepub fn infra_error(error: impl Into<String>) -> Self
pub fn infra_error(error: impl Into<String>) -> Self
A transcript that failed for an infrastructure reason (ErrorKind::Infra):
budget/quota, rate limit, provider outage, network/timeout — not the
model’s fault. Scoring short-circuits to N/A so the case is excluded
from pass/fail, and the host retries it.
Sourcepub fn from_trajectory(trajectory: Trajectory) -> Self
pub fn from_trajectory(trajectory: Trajectory) -> Self
A transcript built from a structured ATIF Trajectory alone — the
zero-burden path for trajectory-producing subjects. The flat fields
(final_response, tool_calls, iterations, usage) are projected
from the trajectory automatically; there is nothing else to call, and
events is not required (it is independent of the trajectory).
Sourcepub fn project_trajectory(&mut self)
pub fn project_trajectory(&mut self)
Fill any flat fields still at their defaults from
trajectory (no-op without one). Fields a
producer set explicitly are never overwritten — see
trajectory::Trajectory::project_into. The framework calls this at
every point a transcript is produced or received (subject execution,
score params, execute results), so a study that serializes
{"trajectory": …} and nothing else scores correctly end-to-end.
Sourcepub fn errored_infra(&self) -> bool
pub fn errored_infra(&self) -> bool
True when this run hit an infrastructure error (see ErrorKind::Infra).
Sourcepub fn tools_used(&self) -> Vec<String>
pub fn tools_used(&self) -> Vec<String>
Distinct tool names invoked, in first-seen order. tool_calls keeps every
invocation (with repeats); this collapses to the unique set used.
Sourcepub fn with_duration_ms(self, ms: u64) -> Self
pub fn with_duration_ms(self, ms: u64) -> Self
Record wall-clock duration. Returns self for builder-style use in
subjects and tests.
Sourcepub fn with_metric(self, name: impl Into<String>, value: f64) -> Self
pub fn with_metric(self, name: impl Into<String>, value: f64) -> Self
Record a custom numeric metric. Returns self for builder-style use:
Transcript::response(text).with_metric("recall@5", 0.8).
Non-finite values (NaN/±inf) are dropped rather than stored: JSON
can’t represent them, so storing one would break report serialization.
The metric stays unreported, and a budget over it fails accordingly.
Sourcepub fn record_metric(&mut self, name: impl Into<String>, value: f64)
pub fn record_metric(&mut self, name: impl Into<String>, value: f64)
Record a custom numeric metric in place (for subjects that build the
transcript mutably). Non-finite values are dropped — see with_metric.
Sourcepub fn with_output(self, parts: impl IntoIterator<Item = Part>) -> Self
pub fn with_output(self, parts: impl IntoIterator<Item = Part>) -> Self
Attach multimodal output parts, keeping final_response as the canonical
text projection. Builder-style: Transcript::response(text).with_output(parts).
See Transcript::output.
Sourcepub fn output_modalities(&self) -> Vec<&'static str>
pub fn output_modalities(&self) -> Vec<&'static str>
The distinct output modalities present (text, image, …), in first-seen
order. Empty when no multimodal output was recorded.
See Transcript::output.
Trait Implementations§
Source§impl Clone for Transcript
impl Clone for Transcript
Source§fn clone(&self) -> Transcript
fn clone(&self) -> Transcript
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more