Skip to main content

Decision

Trait Decision 

Source
pub trait Decision: Send + Sync {
    // Required methods
    fn selected_model(&self) -> &str;
    fn reasoning(&self) -> Option<&str>;
    fn as_any(&self) -> &dyn Any;

    // Provided methods
    fn routing_tier(&self) -> Option<&str> { ... }
    fn is_routed_call(&self) -> bool { ... }
}
Expand description

A decision/trace object produced by an algorithm.

Carried as a trait object (not a generic parameter) so a stream consumer can inspect any algorithm’s decision through this common interface without knowing the concrete type. as_any is the escape hatch for a consumer that does know the algo and wants to downcast to the concrete decision.

Required Methods§

Source

fn selected_model(&self) -> &str

The model this decision selected (e.g. the routed target’s name).

Source

fn reasoning(&self) -> Option<&str>

A human-readable explanation of the decision, for logs and traces.

Source

fn as_any(&self) -> &dyn Any

Downcast handle: a consumer that knows the algorithm can recover the concrete decision type via as_any().downcast_ref::<ConcreteDecision>().

Provided Methods§

Source

fn routing_tier(&self) -> Option<&str>

Stable routing tier for the selected model, when the algorithm provides one.

Source

fn is_routed_call(&self) -> bool

Whether this is the final call selected to serve the request.

Implementors§