Pydantic Error : A non-annotated attribute was detected: `is_crew_class = True` | this is not from my code
Open
steelliberty
opened this issue 9 months ago
•
6 comments
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/Cellar/[email protected]/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/jackmullen/jmautogpt/news_agency_1/main.py", line 7, in
from crew import NewsSourceResearcher
File "/Users/jackmullen/jmautogpt/news_agency_1/crew.py", line 12, in
@CrewBase
^^^^^^^^
File "/Users/jackmullen/jmautogpt/news_agency_1/.venv/lib/python3.11/site-packages/crewai/project/crew_base.py", line 12, in CrewBase
class WrappedClass(cls):
File "/Users/jackmullen/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/jackmullen/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: is_crew_class = True. All model fields require a type annotation; if is_crew_class is not meant to be a field, you may be able to resolve this error by annotating it as a ClassVar or updating model_config['ignored_types'].
For further information visit https://errors.pydantic.dev/2.7/u/model-field-missing-annotation
The file that caused that error below:
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
I am sorry -- but it now has a new error -- I upgraded to 0.30.8 and tools 0.2.3
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/Cellar/[email protected]/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/jackmullen/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 343, in inspect_namespace
all_ignored_types = ignored_types + default_ignored_types()
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate list (not "tuple") to list
I am using poetry - and not in the case above -- but if run poetry install it will downgrade both crewai and the tools -- I am not in love with poetry - should i remove it ?
I am here now if you wanted to help me out -- strange thing is I have another crew setup with the same structure (config file of yamls and methods as shown in my crew.py, and I got it to work. I duplicated the structure and install all new requirements in the new environment and these issues appear, it would then have to be a result of the upgraded modules and their interactions. Another question that you could answer -- quickly -- I do not seem to be able to add tools using the Tasks yaml file
tools:
- WebSiteSearchTool()
- search_tool
These do not work.
after figuring out that i had a value for tools in pyproject.toml that prevented crewai .. I have a new error message:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/Cellar/[email protected]/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/jackmullen/jmautogpt/news_agency_1/main.py", line 7, in
from crew import NewsSourceResearcher
File "/Users/jackmullen/jmautogpt/news_agency_1/crew.py", line 12, in
@CrewBase
^^^^^^^^
File "/Users/jackmullen/jmautogpt/news_agency_1/.venv/lib/python3.11/site-packages/crewai/project/crew_base.py", line 13, in CrewBase
class WrappedClass(cls):
File "/Users/jackmullen/jmautogpt/news_agency_1/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 91, in new
config_wrapper = ConfigWrapper.for_model(bases, namespace, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/jackmullen/jmautogpt/news_agency_1/.venv/lib/python3.11/site-packages/pydantic/_internal/_config.py", line 128, in for_model
raise PydanticUserError('"Config" and "model_config" cannot be used together', code='config-both')
pydantic.errors.PydanticUserError: "Config" and "model_config" cannot be used together