Skip to main content

Transcript

Struct Transcript 

Source
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: String

The subject’s final response text.

§iterations: usize

Reasoning iterations / turns taken.

§tool_calls_count: usize

Number of tool calls made.

§usage: Usage

Token / cost usage.

§timing: Timing

Wall-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: Metadata

Free-form metadata: observability links, run ids, etc.

§error: Option<String>

Set when the subject failed to complete the run.

§error_kind: ErrorKind

Classifies 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

Source

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

Source

pub fn response(text: impl Into<String>) -> Self

A transcript whose only content is a final response. Convenience for simple subjects and tests.

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub fn succeeded(&self) -> bool

True when no error was recorded.

Source

pub fn errored_infra(&self) -> bool

True when this run hit an infrastructure error (see ErrorKind::Infra).

Source

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.

Source

pub fn with_duration_ms(self, ms: u64) -> Self

Record wall-clock duration. Returns self for builder-style use in subjects and tests.

Source

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.

Source

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.

Source

pub fn metric(&self, name: &str) -> Option<f64>

Look up a custom numeric metric by name.

Source

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.

Source

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

Source§

fn clone(&self) -> Transcript

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Transcript

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Transcript

Source§

fn default() -> Transcript

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Transcript

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Transcript

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.