gitdataai/lib/ai/tool/tools.rs
2026-05-30 01:38:40 +08:00

19 lines
401 B
Rust

use crate::error::AiResult;
use async_trait::async_trait;
use serde_json::Value;
#[async_trait]
pub trait FunctionCall: Send + Sync {
type Context;
fn name(&self) -> &'static str;
fn description(&self) -> &'static str {
""
}
fn schema(&self) -> Value;
async fn call(
&self,
context: &mut Self::Context,
args: Value,
) -> AiResult<Value>;
}