From 10a4c23c83b2101b049e3d94458310a9511eb18e Mon Sep 17 00:00:00 2001 From: sigoden Date: Tue, 9 Jul 2024 09:36:50 +0800 Subject: feat: agent can reuse tools (#690) --- src/config/agent.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/config/agent.rs') diff --git a/src/config/agent.rs b/src/config/agent.rs index a6257ca..82f887c 100644 --- a/src/config/agent.rs +++ b/src/config/agent.rs @@ -148,12 +148,7 @@ impl RoleLike for Agent { } fn use_tools(&self) -> Option { - let common_tools = &self.definition.common_tools; - if common_tools.is_empty() { - None - } else { - Some(common_tools.join(",")) - } + self.config.use_tools.clone() } fn set_model(&mut self, model: &Model) { @@ -169,7 +164,9 @@ impl RoleLike for Agent { self.config.top_p = value; } - fn set_use_tools(&mut self, _value: Option) {} + fn set_use_tools(&mut self, value: Option) { + self.config.use_tools = value; + } } #[derive(Debug, Clone, Default, Deserialize, Serialize)] @@ -182,6 +179,8 @@ pub struct AgentConfig { #[serde(skip_serializing_if = "Option::is_none")] pub top_p: Option, #[serde(skip_serializing_if = "Option::is_none")] + use_tools: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub dangerously_functions_filter: Option, } @@ -206,8 +205,6 @@ pub struct AgentDefinition { pub conversation_starters: Vec, #[serde(default)] pub documents: Vec, - #[serde(default)] - pub common_tools: Vec, } impl AgentDefinition { -- cgit v1.2.3