pub struct Dataset {
pub cases: Vec<Case>,
}Expand description
The cases of an experiment.
Fields§
§cases: Vec<Case>The cases, in order.
Implementations§
Source§impl Dataset
impl Dataset
Sourcepub fn new(cases: impl IntoIterator<Item = Case>) -> Self
pub fn new(cases: impl IntoIterator<Item = Case>) -> Self
A dataset of cases.
Sourcepub fn from_json(text: &str) -> Result<Self, DatasetError>
pub fn from_json(text: &str) -> Result<Self, DatasetError>
Parse a JSON array of cases.
A case id that repeats is logged as a warning; the experiment refuses
to run such a dataset (see ExperimentError::DuplicateCase).
For errors that name the element’s index, see Dataset::load_named.
Sourcepub fn from_jsonl(text: &str) -> Result<Self, DatasetError>
pub fn from_jsonl(text: &str) -> Result<Self, DatasetError>
Parse JSON Lines: one case per line, blank lines skipped. A bad line
is a DatasetError::Line naming its line number (from 1).
A repeated case id is logged as a warning, as in Dataset::from_json.
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Self, DatasetError>
pub fn load(path: impl AsRef<Path>) -> Result<Self, DatasetError>
Read a file: .json as a JSON array, .jsonl or .ndjson as JSON
Lines. Errors are the same as Dataset::load_named without the
path and index.
Sourcepub fn load_named(path: impl AsRef<Path>) -> Result<Self, DatasetError>
pub fn load_named(path: impl AsRef<Path>) -> Result<Self, DatasetError>
Read a file like Dataset::load, but with errors that say where
they are: a parse error is DatasetError::InFile, which names the
path and wraps the inner error. Inside it, a bad JSON Lines line is
Line (its line number, from 1) and a bad JSON array element is
DatasetError::Element (its index, from 0).
let dataset = rig_evals::Dataset::load_named("cases.jsonl")?;Trait Implementations§
Source§impl<'de> Deserialize<'de> for Dataset
impl<'de> Deserialize<'de> for Dataset
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl FromIterator<Case> for Dataset
impl FromIterator<Case> for Dataset
impl StructuralPartialEq for Dataset
Auto Trait Implementations§
impl Forget for Dataset
impl Freeze for Dataset
impl Move for Dataset
impl RefUnwindSafe for Dataset
impl Send for Dataset
impl Sync for Dataset
impl Unpin for Dataset
impl UnsafeUnpin for Dataset
impl UnwindSafe for Dataset
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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 more