ai_lib/types/
function_call.rs

1use serde::{Deserialize, Serialize};
2
3/// Tool / Function definition used for Function Calling
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct Tool {
6    pub name: String,
7    pub description: Option<String>,
8    /// JSON Schema for parameters — stored as raw JSON string or object
9    pub parameters: Option<serde_json::Value>,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
13#[serde(untagged)]
14pub enum FunctionCallPolicy {
15    Auto(String), // e.g. "auto" or explicit name
16    None,
17}
18
19#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct FunctionCall {
21    pub name: String,
22    pub arguments: Option<serde_json::Value>,
23}