Skip to main content

ContextTransformer

Trait ContextTransformer 

Source
pub trait ContextTransformer: Send + Sync {
    // Required method
    fn transform<'a>(
        &'a self,
        context: &'a Context,
        model: &'a Model,
    ) -> Pin<Box<dyn Future<Output = Context> + Send + 'a>>;
}
Expand description

Context transformer — applied before provider stream call.

Used by snapcompact inline imaging to replace large tool results with PNG frames, reducing token usage on vision-capable models.

Required Methods§

Source

fn transform<'a>( &'a self, context: &'a Context, model: &'a Model, ) -> Pin<Box<dyn Future<Output = Context> + Send + 'a>>

Transform the context before sending to the provider.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§