pub struct OutputFormatter { /* private fields */ }Expand description
Middleware that truncates tool output to a maximum character length.
Long tool outputs can consume excessive tokens in the context window. This middleware truncates text content items that exceed the limit.
Implementations§
Trait Implementations§
Source§impl ToolMiddleware for OutputFormatter
impl ToolMiddleware for OutputFormatter
Source§fn process<'a>(
&'a self,
call: &'a ToolCall,
ctx: &'a ToolContext,
next: Next<'a>,
) -> WasmBoxedFuture<'a, Result<ToolOutput, ToolError>>
fn process<'a>( &'a self, call: &'a ToolCall, ctx: &'a ToolContext, next: Next<'a>, ) -> WasmBoxedFuture<'a, Result<ToolOutput, ToolError>>
Process a tool call, optionally delegating to the next middleware/tool.
Auto Trait Implementations§
impl Freeze for OutputFormatter
impl RefUnwindSafe for OutputFormatter
impl Send for OutputFormatter
impl Sync for OutputFormatter
impl Unpin for OutputFormatter
impl UnsafeUnpin for OutputFormatter
impl UnwindSafe for OutputFormatter
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