Closed wzdacyl closed 1 week ago
Hey @wzdacyl!
The underlying issue is that your LLM () is trying to delegate work to Directory Info Extractor as shown in the Tool Input `"{"task": "...", "context": "...", "coworker": "Directory Info Extractor"}"
The issue is that this Directory Info Extractor coworker does not exist. The only coworker that exists is the directory document summarizer
A lot of the smaller models have trouble with tool delegation. For better results while these smaller models are improving, we definitely recommend working with the more powerful LLMs.
I hope that clears things up!
hello @bhancockio ,
Thanks for reply. But, i actually have the Agent in DailyAgentCrew like below.
from crewai import Agent, Crew, Process, Task, LLM
from crewai.project import CrewBase, agent, crew, task
from crewai_tools import DirectorySearchTool, DirectoryReadTool, FileReadTool, MDXSearchTool, BaseTool, tool
from pydantic import BaseModel, Field
from typing import List, Optional
class DocumentBasicInfo(BaseModel):
title: str = Field(..., description="The name of document")
path: str = Field(..., description="The path of document")
class DirectoryBasicInfo(BaseModel):
directory_files: List[DocumentBasicInfo] = Field(..., description="List of document basic info in directory")
class DocumentSummary(BaseModel):
summary: str = Field(..., description="The summary of document")
characters: str = Field(..., description="The characters of the document")
document_ouline: str = Field(..., description="the outline of the document")
class DirectorySummary(BaseModel):
directory_files: List[DocumentSummary] = Field(..., description="List of document summary in directory")
@CrewBase
class DailyAgentCrew():
model_type = "qwen2.5:32b-instruct"
llm_provider_uri = "http://127.0.0.1:11434"
@agent
def directory_summarizer(self) -> Agent:
return Agent(
config=self.agents_config['directory_summarizer'],
llm=LLM(model="ollama/" + self.model_type, base_url=self.llm_provider_uri),
allow_delegation=True,
verbose=True
)
@agent
def directory_info_extractor(self) -> Agent:
return Agent(
config=self.agents_config['directory_info_extractor'],
tools=[DirectoryReadTool(directory="/Users/mac/Documents/sourceCode/GPT/crewai_learn/daily_agent/src/summary_notes"),
],
llm=LLM(model="ollama/" + self.model_type, base_url=self.llm_provider_uri),
allow_delegation=False,
verbose=True
)
@agent
def document_summarizer(self) -> Agent:
return Agent(
config=self.agents_config['document_summarizer'],
tools=[FileReadTool()], # Example of custom tool, loaded on the beginning of file
llm=LLM(model="ollama/" + self.model_type, base_url=self.llm_provider_uri),
allow_delegation=False,
verbose=True
)
@task
def directory_doc_summarize_task(self) -> Task:
return Task(
config=self.tasks_config['directory_doc_summarize_task'],
output_json=DirectorySummary,
agent=self.directory_summarizer(),
output_file='DirectorySummary.json',
)
@task
def directory_basic_info_extract_task(self) -> Task:
return Task(
config=self.tasks_config['directory_basic_info_extract_task'],
output_json=DirectoryBasicInfo,
agent=self.directory_summarizer(),
output_file='DirectoryBasicInfo.json',
)
@task
def document_summarize_task(self) -> Task:
return Task(
config=self.tasks_config['document_summarize_task'],
output_json=DocumentSummary,
agent=self.document_summarizer(),
)
@crew
def crew(self) -> Crew:
"""Creates the DailyAgent crew"""
return Crew(
agents=[self.directory_info_extractor(), self.document_summarizer()],
tasks=[self.directory_basic_info_extract_task(), self.document_summarize_task()],
process=Process.hierarchical,
manager_agent=self.directory_summarizer(),
manager_llm=LLM(model="ollama/" + self.model_type, base_url=self.llm_provider_uri),
verbose=True,
)
...
and its agent.yaml
directory_info_extractor:
directory_summarizer:
role: >
Directory Document Summarizer
goal: >
Drive team member to summarize all the documents in the directory:{folder}
backstory: >
You are the leader of team.
Your team goals to ask team members to summarize all documentation in the directory:{folder}
You are a very good leader who can assign appropriate job to members.
You ask Directory Info Extractor to get document basic info which includes all title and path of each document.
Then you distrbute each of the document to Documentation Summarizer, asking document summarizer to do summary work.
Finally you gether all the summary and compose the final output.
You make sure all the files in the folder are summarized.
You make sure the quality of the summary for each of the folder.
directory_info_extractor:
role: >
Directory Info Extractor
goal: >
Extract the basic info of all the document in the directory:{folder}
backstory: >
Your goal is to extract the basic info of all the document in the directory:{folder}.
You should extract the name and the path of each document in directory.
document_summarizer:
role: >
Documentation Summarizer
goal: >
Generate the summary of a document
backstory: >
You works at a summarization team.
You are expert at summarizing a document.
You can make a summary to include the outline of a document no matter what kind of context it is.
Description
I'm trying to use Process.hierarchical to create a crew. But the manager agent is not able to find other coworker.
effort for the issue
I see some issue closed for the similar problem on #620 #602 and other issues around #300+. But it seems all of the issues are closed or fixed. But I still meet this issue. The issue happened on the crewai version of 0.67.1. I also tried 0.65.2. got the same issue.
I also tried to change my local llm from qwen2.5 to llama3.1 and gemma2. the same issue raise.
Is there anything wrong on my code? Please help
Steps to Reproduce
crewai run
Expected behavior
a coworker can be found by manager agent
Screenshots/Code snippets
my code
Operating System
macOS Sonoma
Python Version
3.11
crewAI Version
0.65.2
crewAI Tools Version
0.12.1
Virtual Environment
Venv
Evidence
Possible Solution
None
Additional context
Nothing