mistralrs_core/tools/
response.rs

1#[cfg_attr(feature = "pyo3_macros", pyo3::pyclass(eq, eq_int))]
2#[cfg_attr(feature = "pyo3_macros", pyo3(get_all))]
3#[derive(Clone, Debug, serde::Serialize, PartialEq)]
4#[serde(rename_all = "snake_case")]
5pub enum ToolCallType {
6    Function,
7}
8
9impl std::fmt::Display for ToolCallType {
10    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11        match self {
12            ToolCallType::Function => write!(f, "function"),
13        }
14    }
15}
16
17#[cfg_attr(feature = "pyo3_macros", pyo3::pyclass)]
18#[cfg_attr(feature = "pyo3_macros", pyo3(get_all))]
19#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
20pub struct CalledFunction {
21    pub name: String,
22    pub arguments: String,
23}
24
25#[cfg_attr(feature = "pyo3_macros", pyo3::pyclass)]
26#[cfg_attr(feature = "pyo3_macros", pyo3(get_all))]
27#[derive(Clone, Debug, serde::Serialize)]
28pub struct ToolCallResponse {
29    pub id: String,
30    #[serde(rename = "type")]
31    pub tp: ToolCallType,
32    pub function: CalledFunction,
33}