We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f8d139 commit caa218fCopy full SHA for caa218f
async-openai/src/tools.rs
@@ -124,8 +124,17 @@ impl ToolManager {
124
}
125
126
/// Adds a new tool to the manager.
127
- pub fn add_tool<T: Tool + 'static>(&mut self, tool: T) {
128
- self.tools.insert(T::name(), Arc::new(tool));
+ pub fn add_tool<T: ToolDyn + 'static>(&mut self, tool: T) {
+ self.tools
129
+ .insert(tool.definition().function.name, Arc::new(tool));
130
+ }
131
+
132
+ /// Adds a new tool with an Arc to the manager.
133
+ ///
134
+ /// Use this if you want to access this tool after being added to the manager.
135
+ pub fn add_tool_arc<T: ToolDyn + 'static>(&mut self, tool: Arc<T>) {
136
137
+ .insert(tool.definition().function.name, tool);
138
139
140
/// Removes a tool from the manager.
0 commit comments