Skip to main content

abu_base/chat/
tool.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone)]
4pub struct ToolDefinition {
5    pub name: String,
6    pub description: String,
7    /// "type": "object",
8    /// "properties": {
9    ///     "content": {
10    ///         "type": "string",
11    ///         "description": "The text to echo"
12    ///     }
13    /// },
14    /// "required": ["content"],
15    pub schema: serde_json::Value,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct ToolCall {
20	pub id: String,
21	pub name: String,
22    pub arguments: String,
23}
24
25
26impl ToolDefinition {
27    pub fn new(name: impl Into<String>, description: impl Into<String>, schema: serde_json::Value) -> Self {
28        Self {
29            name: name.into(),
30            description: description.into(),
31            schema
32        }
33    }
34}