pub struct CostScorer { /* private fields */ }Expand description
Scores agent execution against a cost budget.
Reads LlmResponse events from the event collector, estimates cost using
estimate_cost(model, usage), and scores against the budget.
Unknown models contribute $0 (documented, not penalized).
Important: The collector accumulates events across cases. When using
EvalRunner::run with multiple cases, attach the same collector via
EvalRunner::with_event_collector so per-case events are isolated.
When calling EvalRunner::score_result manually, call clear_events
yourself between cases.
Implementations§
Source§impl CostScorer
impl CostScorer
Sourcepub fn new(collector: EventCollector, max_cost_usd: f64) -> Self
pub fn new(collector: EventCollector, max_cost_usd: f64) -> Self
Create a cost scorer with a default max cost budget.
The case’s max_cost_usd overrides this default when set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CostScorer
impl RefUnwindSafe for CostScorer
impl Send for CostScorer
impl Sync for CostScorer
impl Unpin for CostScorer
impl UnsafeUnpin for CostScorer
impl UnwindSafe for CostScorer
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
Mutably borrows from an owned value. Read more