Skip to main content

ModelRouter

Trait ModelRouter 

Source
pub trait ModelRouter: Send + Sync {
    // Required method
    fn complete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        required: &'life1 [ModelCapability],
        request: ModelRequest,
        cancellation: CancellationToken,
        events: Arc<dyn ModelRoutingEventSink>,
    ) -> Pin<Box<dyn Future<Output = Result<RoutedModelTurn, ModelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Selects and invokes a model for one agent turn.

Implementations receive the agent’s requirements on every invocation. The runtime deliberately knows nothing about provider configuration or credentials.

Required Methods§

Source

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, required: &'life1 [ModelCapability], request: ModelRequest, cancellation: CancellationToken, events: Arc<dyn ModelRoutingEventSink>, ) -> Pin<Box<dyn Future<Output = Result<RoutedModelTurn, ModelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§