pub trait Classifier<S = ()>: Send + Sync {
// Required method
fn score<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut S,
request: &'life2 mut Request,
driver: &'life3 Driver,
) -> Pin<Box<dyn Future<Output = Result<(Classification, Option<Response>)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
}Expand description
Scores targets from the current request and the composition’s state.
Required Methods§
Sourcefn score<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut S,
request: &'life2 mut Request,
driver: &'life3 Driver,
) -> Pin<Box<dyn Future<Output = Result<(Classification, Option<Response>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn score<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 mut S,
request: &'life2 mut Request,
driver: &'life3 Driver,
) -> Pin<Box<dyn Future<Output = Result<(Classification, Option<Response>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Score the classifier’s targets given the current state and request.
driver lets a classifier inspect runtime models and offload model calls.
request is borrowed mutably so a classifier may rewrite it in place — inject a
system prompt, drop tools, compact history. The edit is not scoped to this call:
later classifiers in the cascade score the rewritten request, and it is the
rewritten request that is finally sent to the selected model. Most classifiers
only read it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".