Skip to main content

Brain

Trait Brain 

Source
pub trait Brain: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn caps(&self) -> ModelCaps;
    fn complete<'life0, 'async_trait>(
        &'life0 self,
        req: BrainRequest,
    ) -> Pin<Box<dyn Future<Output = Result<BrainStream>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Uniform interface over every model vendor. Normalizes messages, streaming, and tool-calling so the rest of the system is vendor-agnostic.

Required Methods§

Source

fn id(&self) -> &str

Full provider:model identifier, e.g. “anthropic:claude-sonnet-4-6”

Source

fn caps(&self) -> ModelCaps

Model capabilities

Source

fn complete<'life0, 'async_trait>( &'life0 self, req: BrainRequest, ) -> Pin<Box<dyn Future<Output = Result<BrainStream>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stream a completion

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§