pub trait Predictor: Send + Sync {
// Required method
fn predict<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, EvalError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn report_token_usage<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<TokenUsage>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Predictor trait (the object under evaluation: LLMChain / Agent, etc.)
Required Methods§
Provided Methods§
Sourcefn report_token_usage<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<TokenUsage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn report_token_usage<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Option<TokenUsage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Reports the token usage of the most recent predict call, if the
predictor meters it (E1). Defaults to None — evaluators with no token metering keep
the report’s cost ledger at zero (zero behavior change).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".