vtcode_core/gemini/function_calling/
mod.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct FunctionCall {
6    pub name: String,
7    pub args: Value,
8    #[serde(default)]
9    pub id: Option<String>,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct FunctionResponse {
14    pub name: String,
15    pub response: Value,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct FunctionCallingConfig {
20    pub mode: String,
21    #[serde(
22        skip_serializing_if = "Option::is_none",
23        rename = "allowedFunctionNames"
24    )]
25    pub allowed_function_names: Option<Vec<String>>,
26}
27
28impl FunctionCallingConfig {
29    pub fn auto() -> Self {
30        Self {
31            mode: "AUTO".to_string(),
32            allowed_function_names: None,
33        }
34    }
35
36    pub fn none() -> Self {
37        Self {
38            mode: "NONE".to_string(),
39            allowed_function_names: None,
40        }
41    }
42
43    pub fn any() -> Self {
44        Self {
45            mode: "ANY".to_string(),
46            allowed_function_names: None,
47        }
48    }
49}