-
Notifications
You must be signed in to change notification settings - Fork 560
feat: implement Tool for Agent #704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement Tool for Agent #704
Conversation
|
|
||
| async fn definition(&self, _prompt: String) -> ToolDefinition { | ||
| ToolDefinition { | ||
| name: <Self as Tool>::name(self), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is distinguish between the Agent::name method and the Tool::name trait method. The Tool::name trait method implementation here returns a valid Tool name.
This is important because the Agent::name method could return an invalid Tool name - either an invalid one set by the user, or, if not set, the default name "Unnamed Agent" (which is invalid due to the whitespace).
|
@joshua-mo-143 I have tested this locally by modifying the Would you like me to add/amend an example to demonstrate this? |
Yeah that would be great actually |
joshua-mo-143
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One change required but that's basically it
rig-core/src/agent/tool.rs
Outdated
| }; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| #[derive(Debug, Clone, Serialize, Deserialize)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use schemars::JsonSchema (the derive macro) here - it's much easier to convert into a JSON schema rather than using fragile JSON
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Done.
joshua-mo-143
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry missed something last review - final change and then we'll merge!
joshua-mo-143
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
Nice, i wasn't able to finish my branch for this. glad it got in there! |
Closes #696.
ToolforAgent, so that anAgentcan be added as a Tool to be used by another Agent.agent_with_agent_toolto demonstrate an Agent using another Agent as a Tool.