Skip to main content

ToolCallNormalizer

Trait ToolCallNormalizer 

Source
pub trait ToolCallNormalizer: Send + Sync {
    // Required methods
    fn normalize(&self, raw: &str) -> Result<Vec<ToolInvocation>, KernelError>;
    fn is_applicable(&self, raw: &str) -> bool;
}
Expand description

Normalizes raw LLM text output into structured ToolInvocations.

Implement this trait to support additional model families that emit tool intent as in-band text markers. The trait is object-safe so normalizers can be stored as Arc<dyn ToolCallNormalizer> alongside other kernel objects.

§Contract

  • normalize returns an empty Vec when raw contains no markers this normalizer recognises. An empty result is never an error.
  • is_applicable must return true whenever normalize would return a non-empty Vec. It is a cheap guard to short-circuit expensive parsing in pipelines.

Required Methods§

Source

fn normalize(&self, raw: &str) -> Result<Vec<ToolInvocation>, KernelError>

Parse raw text into zero or more tool invocations.

Source

fn is_applicable(&self, raw: &str) -> bool

Quick scan: does raw contain markers this normalizer handles?

Implementors§