19 lines
401 B
Rust
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>;
|
|
}
|