ResultFormatter

Trait ResultFormatter 

Source
pub trait ResultFormatter:
    Send
    + Sync
    + 'static {
    // Required methods
    fn format_running(&self, call: &FunctionCall) -> Value;
    fn format_result(
        &self,
        call: &FunctionCall,
        result: Result<Value, ToolError>,
    ) -> Value;
    fn format_cancelled(&self, call_id: &str) -> Value;
}
Expand description

Formats tool responses for background execution lifecycle.

Implementations control the shape of JSON values sent back to the model at each stage of a background tool’s lifecycle: when the tool starts running, when it completes (or fails), and when it is cancelled.

Required Methods§

Source

fn format_running(&self, call: &FunctionCall) -> Value

Format the immediate acknowledgment sent when a background tool starts.

Source

fn format_result( &self, call: &FunctionCall, result: Result<Value, ToolError>, ) -> Value

Format the final result after tool completes or fails.

Source

fn format_cancelled(&self, call_id: &str) -> Value

Format a cancellation response.

Implementors§