Skip to main content

TurnGenerator

Trait TurnGenerator 

Source
pub trait TurnGenerator: Send + Sync {
    // Required method
    fn generate<'life0, 'async_trait>(
        &'life0 self,
        req: GenerateRequest,
    ) -> Pin<Box<dyn Future<Output = Result<InferenceResult, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn generate_coder<'life0, 'async_trait>(
        &'life0 self,
        req: GenerateRequest,
    ) -> Pin<Box<dyn Future<Output = Result<InferenceResult, TurnGenerationError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn context_window(&self, _model: &str) -> usize { ... }
}

Required Methods§

Source

fn generate<'life0, 'async_trait>( &'life0 self, req: GenerateRequest, ) -> Pin<Box<dyn Future<Output = Result<InferenceResult, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn generate_coder<'life0, 'async_trait>( &'life0 self, req: GenerateRequest, ) -> Pin<Box<dyn Future<Output = Result<InferenceResult, TurnGenerationError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Coder-specific generation keeps routing exhaustion typed so an unattended caller can classify configuration failures without parsing error prose. Other consumers retain the original string seam.

Source

fn context_window(&self, _model: &str) -> usize

The context window (in tokens) of the model this generator drives, or 0 when unknown. Multi-turn drivers use it to bound their running message history before it overflows the window. Defaults to 0 so test doubles need not implement it (the loop then skips compaction).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl TurnGenerator for InferenceEngine

Source§

fn generate<'life0, 'async_trait>( &'life0 self, req: GenerateRequest, ) -> Pin<Box<dyn Future<Output = Result<InferenceResult, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn generate_coder<'life0, 'async_trait>( &'life0 self, req: GenerateRequest, ) -> Pin<Box<dyn Future<Output = Result<InferenceResult, TurnGenerationError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn context_window(&self, model: &str) -> usize

Implementors§