Closed steelliberty closed 3 weeks ago
Hi @steelliberty
Thanks for opening this Issue, but after some tests on your code, some problems were identified.
The version of your code working is like this
from crewai_tools import WebsiteSearchTool
from langchain_community.tools import DuckDuckGoSearchRun # Initialize the tool
from langchain_groq import ChatGroq
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
search_tool = DuckDuckGoSearchRun()
website_tool = WebsiteSearchTool()
@CrewBase
class <YouCrewName>:
def __init__(self) -> None:
# add other models here
self.groq_llm = ChatGroq(temperature=0, model="llama3-8b-8192")
self.agents_config = "config/agents.yaml"
self.tasks_config = "config/tasks.yaml"
@agent
def source_manager(self) -> Agent:
return Agent(
config=self.agents_config["source_manager"],
llm=self.groq_llm,
)
@task
def source_manager_task(self) -> Task:
return Task(
config=self.tasks_config["source_manager_task"],
agent=self.source_manager(),
tools=[search_tool, website_tool],
)
@crew
def crew(self) -> Crew:
return Crew(
agents=self.agents, tasks=self.tasks, process=Process.sequential, verbose=2
)
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
Traceback (most recent call last): File "", line 1, in
File "/usr/local/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Users/jm/jmautogpt/news_agency_1/main.py", line 7, in
from crew import NewsSourceResearcher
File "/Users/jm/jmautogpt/news_agency_1/crew.py", line 12, in
@CrewBase
^^^^^^^^
File "/Users/jm/jmautogpt/news_agency_1/.venv/lib/python3.11/site-packages/crewai/project/crew_base.py", line 13, in CrewBase
class WrappedClass(cls):
File "/Users/jm/jmautogpt/news_agency_1/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 93, in new
private_attributes = inspect_namespace(
^^^^^^^^^^^^^^^^^^
File "/Users/jm/jmautogpt/news_agency_1/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 406, in inspect_namespace
raise PydanticUserError(
pydantic.errors.PydanticUserError: A non-annotated attribute was detected:
base_directory = PosixPath('/Users/jm/jmautogpt/news_agency_1')
. All model fields require a type annotation; ifbase_directory
is not meant to be a field, you may be able to resolve this error by annotating it as aClassVar
or updatingmodel_config['ignored_types']
.-- the Code causing the error above is here:
import os from crewai import Agent, Crew, Process, Task from crewai.project import CrewBase, agent, crew, task from crewai_tools import WebsiteSearchTool from langchain_community.tools import DuckDuckGoSearchRun# Initialize the tool search_tool = DuckDuckGoSearchRun() from langchain_groq import ChatGroq import sqlite3
@CrewBase class NewsSourceResearcher(Agent):