pub struct LfmNormalizer;Expand description
Normalizer for LiquidAI LFM models (e.g. LFM2.5-1.2B-Thinking) served
through mlx_lm.server or similar OpenAI-compatible shims that emit tool
intent as in-band text rather than the structured tool_calls field.
Recognised format:
<|tool_call_start|>[get_weather(city='Berlin')]<|tool_call_end|>Multiple calls per block ([fn1(a=1), fn2(b=2)]) and multiple blocks per
message are both handled.
§Example
use rig_compose::normalizer::{LfmNormalizer, ToolCallNormalizer};
use serde_json::json;
let raw = "<|tool_call_start|>[add(x=3, y=4)]<|tool_call_end|>";
let calls = LfmNormalizer.normalize(raw).unwrap();
assert_eq!(calls[0].name, "add");
assert_eq!(calls[0].args, json!({"x": 3, "y": 4}));Trait Implementations§
Source§impl Clone for LfmNormalizer
impl Clone for LfmNormalizer
Source§fn clone(&self) -> LfmNormalizer
fn clone(&self) -> LfmNormalizer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LfmNormalizer
impl Debug for LfmNormalizer
Source§impl Default for LfmNormalizer
impl Default for LfmNormalizer
Source§fn default() -> LfmNormalizer
fn default() -> LfmNormalizer
Returns the “default value” for a type. Read more
Source§impl ToolCallNormalizer for LfmNormalizer
impl ToolCallNormalizer for LfmNormalizer
Source§fn is_applicable(&self, raw: &str) -> bool
fn is_applicable(&self, raw: &str) -> bool
Quick scan: does
raw contain markers this normalizer handles?Source§fn 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.Auto Trait Implementations§
impl Freeze for LfmNormalizer
impl RefUnwindSafe for LfmNormalizer
impl Send for LfmNormalizer
impl Sync for LfmNormalizer
impl Unpin for LfmNormalizer
impl UnsafeUnpin for LfmNormalizer
impl UnwindSafe for LfmNormalizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more