Skip to main content

InferenceRequestTransform

Trait InferenceRequestTransform 

Source
pub trait InferenceRequestTransform: Send + Sync {
    // Required method
    fn transform(
        &self,
        messages: Vec<Message>,
        tool_descriptors: &[ToolDescriptor],
    ) -> InferenceTransformOutput;
}
Expand description

Trait for plugins that transform the inference request before it is sent to the LLM. The core loop calls all registered transforms in order, piping the output messages of one into the input of the next.

Implementing this trait is how plugins inject behaviors like context window truncation, message summarization, or content filtering — without the core loop needing domain-specific knowledge.

Required Methods§

Source

fn transform( &self, messages: Vec<Message>, tool_descriptors: &[ToolDescriptor], ) -> InferenceTransformOutput

Transform the message list. tool_descriptors are provided so transforms can account for tool token overhead.

Implementors§