Skip to main content

IntoToolResult

Trait IntoToolResult 

pub trait IntoToolResult {
    // Required method
    fn into_tool_result(self) -> Result<ToolOutput, ToolError>;
}
Expand description

What a tool function returns, as the Tool::call result: any IntoToolOutput, or a Result of one with an error that is Into<ToolError>.

use adam_llm_agent::{IntoToolResult, ToolError, ToolOutput};

assert_eq!("ok".into_tool_result(), Ok(ToolOutput::text("ok")));
let failed: Result<String, ToolError> = Err(ToolError::Permanent("no".into()));
assert_eq!(failed.into_tool_result(), Err(ToolError::Permanent("no".into())));

Required Methods§

fn into_tool_result(self) -> Result<ToolOutput, ToolError>

The result handed to the agent loop.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl<T, E> IntoToolResult for Result<T, E>

Implementors§

§

impl<T> IntoToolResult for T
where T: IntoToolOutput,