Skip to main content

to_tool_definition

Function to_tool_definition 

Source
pub fn to_tool_definition(tool: &dyn BaseTool) -> ToolDefinition
Expand description

Converts BaseTool to ToolDefinition (for function calling).

§Arguments

  • tool - Tool implementing BaseTool trait.

§Returns

ToolDefinition for bind_tools().

§Example

use langchainrust::{Calculator, BaseTool, to_tool_definition};
use std::sync::Arc;

let calculator = Calculator::new();
let tool_def = to_tool_definition(&calculator);