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
normalizereturns an emptyVecwhenrawcontains no markers this normalizer recognises. An empty result is never an error.is_applicablemust returntruewhenevernormalizewould return a non-emptyVec. It is a cheap guard to short-circuit expensive parsing in pipelines.
Required Methods§
Sourcefn normalize(&self, raw: &str) -> Result<Vec<ToolInvocation>, KernelError>
fn normalize(&self, raw: &str) -> Result<Vec<ToolInvocation>, KernelError>
Parse raw text into zero or more tool invocations.
Sourcefn is_applicable(&self, raw: &str) -> bool
fn is_applicable(&self, raw: &str) -> bool
Quick scan: does raw contain markers this normalizer handles?