smolagents_rs/tools/
base.rs1use serde::{de::DeserializeOwned, Deserialize, Serialize};
2use schemars::JsonSchema;
3
4use super::tool_traits::{Parameters, Tool};
5use anyhow::Result;
6
7#[derive(Deserialize, JsonSchema)]
8#[schemars(title = "BaseParams")]
9pub struct BaseParams {
10 #[schemars(description = "The name of the tool")]
11 _name: String,
12}
13
14impl<P: DeserializeOwned + JsonSchema> Parameters for P where P: JsonSchema {}
15
16#[derive(Debug, Serialize, Default, Clone)]
17pub struct BaseTool {
18 pub name: &'static str,
19 pub description: &'static str,
20}
21
22impl Tool for BaseTool {
23 type Params = serde_json::Value;
24 fn name(&self) -> &'static str {
25 self.name
26 }
27
28 fn description(&self) -> &'static str {
29 self.description
30 }
31 fn forward(&self, _arguments: serde_json::Value) -> Result<String> {
32 Ok("Not implemented".to_string())
33 }
34}