Tokitai 过程宏 - 零配置 AI 工具暴露
使用示例
方案 1:单一宏,自动发现
use tool;
;
方案 2:带自定义属性
Tokitai 过程宏 - 零配置 AI 工具暴露
use tokitai_macros::tool;
pub struct Calculator;
#[tool]
impl Calculator {
/// 两个数相加
pub async fn add(&self, a: i32, b: i32) -> i32 {
a + b
}
}
#[tool]
impl Calculator {
#[tool(name = "add_numbers", desc = "将两个数字相加")]
pub async fn add(&self, a: i32, b: i32) -> i32 {
a + b
}
}