dwillowtree / diana

Save toil in security operations with: Detection & Intelligence Analysis for New Alerts (D.I.A.N.A. )
https://dianast.streamlit.app/
MIT License
157 stars 17 forks source link

CrewAI pydantic validation issue #25

Open priamai opened 3 weeks ago

priamai commented 3 weeks ago

Found this issue, I am not a CrewAI expert but seems to be related to Pydantic. I debugged until Line 83:

image

Starting threat research for query: Most common TTP used by attackers in AWS targeting Turkish companies in the e-commerce industry.
Traceback (most recent call last):
  File "/snap/pycharm-community/414/plugins/python-ce/helpers/pydev/pydevd.py", line 1570, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/snap/pycharm-community/414/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "threat_research.py", line 99, in <module>
    result = perform_threat_research(query)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "threat_research.py", line 83, in perform_threat_research
    crew = Crew(
           ^^^^^
  File "/home/robomotic/DevOps/github/diana/.venv/lib/python3.11/site-packages/pydantic/main.py", line 212, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew
verbose
  Input should be a valid boolean, unable to interpret input [type=bool_parsing, input_value=2, input_type=int]
    For further information visit https://errors.pydantic.dev/2.9/v/bool_parsing
priamai commented 3 weeks ago

Quick fix on that line 83, they changed the method to be a boolean:


    # Create the crew
    crew = Crew(
        agents=[researcher, analyst],
        tasks=[research_task, analysis_task],
        process=Process.sequential,
        verbose=True  # Increased verbosity for more detailed output
    )