First of all, thanks @Bhavik_Shah, because of your tip I could successfully run it here and see what was the problem.
I noticed these differences between gpt-4o and other LLMs regarding the “Tool Input”
In my tool example:
class ChatHistoryToolInput(BaseModel):
"""Input schema for ChatHistoryTool."""
user: str = Field(..., description="User ID to fetch chat history for.")
GPT-4o
## Tool Input:
"{\"user\": \"USER_a1s2d3f4\"}"
Other LLMs
# Tool Input:
"{\"user\": {\"description\": \"User ID to fetch chat history for.\", \"type\": \"str\"}}"
The same problem was happening for agents with allow_delegation=True and with process=Process.hierarchical because it uses tools to delegate (DelegateWorkTool and AskQuestionTool).
With that said, instead of using manager_llm I just created mine here and looks to be working as expected:
def manager_agent(self) -> Agent:
return Agent(
role="Crew Manager",
goal="""
Manage the team to complete the task in the best way possible.
""",
backstory="""
You are a seasoned manager with a knack for getting the best out of your team.\nYou are also known for your ability to delegate work to the right people, and to ask the right questions to get the best out of your team.\nEven though you don't perform tasks by yourself, you have a lot of experience in the field, which allows you to properly evaluate the work of your team members.
Additional rules for Tools:
-----------------
1. Regarding the Action Input (the input to the action, just a simple python dictionary, enclosed
in curly braces, using \" to wrap keys and values.)
For example for the following schema:
```
class ExampleToolInput(BaseModel):
task: str = Field(..., description="The task to delegate")
context: str = Field(..., description="The context for the task")
coworker: str = Field(..., description="The role/name of the coworker to delegate to")
```
Then the input should be a JSON object with the user ID:
- task: The task to delegate
- context: The context for the task
- coworker: The role/name of the coworker to delegate to
""",
)
@crew
def crew(self) -> Crew:
"""Creates the CustomerService crew"""
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.hierarchical,
verbose=True,
manager_agent=self.manager_agent(),
)
I tested using:
- MODEL=ollama/openhermes
- MODEL=ollama/llama3.2
- MODEL=gpt-4o-mini
@rokbenko Giving the right direction, I got the expected result even with smaller LLMs.