mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
* Exploring output being passed to tool selector to see if we can better format data * WIP. Adding JSON repair functionality * Almost done implementing JSON repair. Testing fixes vs current base case. * More action cleanup with additional tests * WIP. Trying to figure out what is going on with tool descriptions * Update tool description generation * WIP. Trying to find out what is causing the tools to duplicate * Replacing tools properly instead of duplicating them accidentally * Fixing issues for MR * Update dependencies for JSON_REPAIR * More cleaning up pull request * preppering for call * Fix type-checking issues --------- Co-authored-by: João Moura <joaomdmoura@gmail.com>
26 lines
865 B
Python
26 lines
865 B
Python
from langchain.tools import StructuredTool
|
|
|
|
from crewai.agents.agent_builder.utilities.base_agent_tool import BaseAgentTools
|
|
|
|
|
|
class AgentTools(BaseAgentTools):
|
|
"""Default tools around agent delegation"""
|
|
|
|
def tools(self):
|
|
coworkers = ", ".join([f"{agent.role}" for agent in self.agents])
|
|
tools = [
|
|
StructuredTool.from_function(
|
|
func=self.delegate_work,
|
|
name="Delegate work to coworker",
|
|
description=self.i18n.tools("delegate_work").format(
|
|
coworkers=coworkers
|
|
),
|
|
),
|
|
StructuredTool.from_function(
|
|
func=self.ask_question,
|
|
name="Ask question to coworker",
|
|
description=self.i18n.tools("ask_question").format(coworkers=coworkers),
|
|
),
|
|
]
|
|
return tools
|