crewAI-tools icon indicating copy to clipboard operation
crewAI-tools copied to clipboard

feat: Add structured class

Open lgesuellip opened this issue 1 year ago • 4 comments

PR Description

Hey Team,

As part of the Pampa team, I’ve developed a class for Crewai to create a tool that wraps a given function. This class enables us to encapsulate any function, making it easily accessible to an agent.

What’s implemented in this PR:

  • The class with a method to create a tool from a given function, providing an abstraction to wrap any function easily.
  • Documentation, including usage instructions and an example.

Relevant Issues

I created an issue detailing the need for this functionality and how we’re utilizing it:
Issue #1585

Type

🆕 New Feature

Testing

  • Added unit tests to cover basic functionality.
  • Validated error handling and edge cases.
  • Tested integration with CrewAI.

Thank you, Team! Let me know if there’s any feedback.

lgesuellip avatar Nov 17 '24 16:11 lgesuellip

Hi @lgesuellip,

Thanks for the PR. Can you check if your implementation is the same as the one we added to the main repository or something that might be extended from it? 

https://github.com/crewAIInc/crewAI/pull/1654/files#diff-a7d8eca7c4001e114bc0d03bd90b59036a5f51dc3d991f05aa0096257f542513 src/crewai/tools/structured_tool.py

pythonbyte avatar Nov 27 '24 15:11 pythonbyte

Hi @pythonbyte, a pleasure. Wow, it looks almost identical! What timing—this was merged just yesterday. I'll test it using version 0.83.0 on our application.

Should we add my documentation? What do you think?

Thank you,

lgesuellip avatar Nov 27 '24 20:11 lgesuellip

Hey @lgesuellip !

Thank you for working on this! We've actually moved BaseTool and StructuredTool out of the crewai-tools repo and now they are in the crewai repo.

Here's a link to the StructuredTool code: https://github.com/crewAIInc/crewAI/blob/main/src/crewai/tools/structured_tool.py

I do really like your description of StructuredTools. If you bring over the doc changes to our tool documentation, I'd be happy to approve and merge them in!

https://github.com/crewAIInc/crewAI/blob/main/docs/concepts/tools.mdx

Please let me know if you have any questions!

bhancockio avatar Dec 05 '24 20:12 bhancockio

Hey Team,

I just created the PR to add the documentation,

https://github.com/crewAIInc/crewAI/pull/1713

Thanks,

lgesuellip avatar Dec 05 '24 20:12 lgesuellip