pub struct Scenario {
pub id: String,
pub turns: Vec<Turn>,
pub expected: String,
pub metadata: Value,
}Expand description
A single benchmark scenario loaded from a dataset file.
Each scenario represents one question/task that will be presented to the agent.
The id field is used to correlate agent responses with ground-truth answers and
to skip already-completed scenarios during a --resume run.
Construct via Scenario::single for single-turn scenarios (all built-in loaders),
or push Turns directly into Scenario::turns for multi-turn scenarios.
§Examples
use zeph_bench::Scenario;
let scenario = Scenario::single(
"gaia_t42",
"What is the boiling point of water in Celsius?",
"100",
serde_json::json!({"level": 1}),
);
assert_eq!(scenario.id, "gaia_t42");
assert_eq!(scenario.primary_prompt().unwrap(), "What is the boiling point of water in Celsius?");Fields§
§id: StringUnique identifier within the dataset (e.g. "frames_0", "s1_2").
turns: Vec<Turn>Ordered turns in this scenario. Non-empty by contract of Scenario::single.
Direct construction is allowed for multi-turn scenarios; callers must ensure
at least one Role::User turn is present before calling Scenario::primary_prompt.
expected: StringThe gold-standard answer used for scoring.
metadata: ValueDataset-specific extras such as difficulty level or reasoning_types.
Set to serde_json::Value::Null when the dataset has no extra metadata.
Implementations§
Source§impl Scenario
impl Scenario
Sourcepub fn single(
id: impl Into<String>,
prompt: impl Into<String>,
expected: impl Into<String>,
metadata: Value,
) -> Self
pub fn single( id: impl Into<String>, prompt: impl Into<String>, expected: impl Into<String>, metadata: Value, ) -> Self
Convenience constructor for single-turn scenarios.
Wraps prompt in a one-element Vec<Turn> with Role::User. All built-in
dataset loaders use this constructor.
§Examples
use zeph_bench::Scenario;
let s = Scenario::single("id1", "What year?", "2026", serde_json::Value::Null);
assert_eq!(s.primary_prompt().unwrap(), "What year?");Sourcepub fn primary_prompt(&self) -> Result<&str, BenchError>
pub fn primary_prompt(&self) -> Result<&str, BenchError>
Returns the content of the first Role::User turn.
§Errors
Returns BenchError::InvalidFormat when turns is empty or contains no
Role::User entry. Loaders must construct via Scenario::single or push
at least one user turn.
§Examples
use zeph_bench::Scenario;
let s = Scenario::single("id1", "hello", "world", serde_json::Value::Null);
assert_eq!(s.primary_prompt().unwrap(), "hello");Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scenario
impl RefUnwindSafe for Scenario
impl Send for Scenario
impl Sync for Scenario
impl Unpin for Scenario
impl UnsafeUnpin for Scenario
impl UnwindSafe for Scenario
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request