groq / groq-api-cookbook

436 stars 96 forks source link

ValidationError: crewai-mixture-of-agents/Mixture-of-Agents-Crew-AI-Groq.ipynb #29

Open jacobweiss2305 opened 1 month ago

jacobweiss2305 commented 1 month ago

Hi team,

I am getting this error:

ValidationError                           Traceback (most recent call last)
Cell In[7], [line 1](vscode-notebook-cell:?execution_count=7&line=1)
----> [1](vscode-notebook-cell:?execution_count=7&line=1) crew = Crew(
      [2](vscode-notebook-cell:?execution_count=7&line=2)     agents=[mlb_researcher, mlb_statistician, mlb_writer_llama, mlb_writer_gemma, mlb_writer_mixtral, mlb_editor],
      [3](vscode-notebook-cell:?execution_count=7&line=3)     tasks=[
      [4](vscode-notebook-cell:?execution_count=7&line=4)         collect_game_info, 
      [5](vscode-notebook-cell:?execution_count=7&line=5)         retrieve_batting_stats, retrieve_pitching_stats,
      [6](vscode-notebook-cell:?execution_count=7&line=6)         write_game_recap_llama, write_game_recap_gemma, write_game_recap_mixtral,
      [7](vscode-notebook-cell:?execution_count=7&line=7)         edit_game_recap
      [8](vscode-notebook-cell:?execution_count=7&line=8)         ],
      [9](vscode-notebook-cell:?execution_count=7&line=9)     verbose=False
     [10](vscode-notebook-cell:?execution_count=7&line=10) )

File c:\Users\jawei\lab\groq-api-cookbook\venv\Lib\site-packages\pydantic\main.py:193, in BaseModel.__init__(self, **data)
    [191](file:///C:/Users/jawei/lab/groq-api-cookbook/venv/Lib/site-packages/pydantic/main.py:191) # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    [192](file:///C:/Users/jawei/lab/groq-api-cookbook/venv/Lib/site-packages/pydantic/main.py:192) __tracebackhide__ = True
--> [193](file:///C:/Users/jawei/lab/groq-api-cookbook/venv/Lib/site-packages/pydantic/main.py:193) self.__pydantic_validator__.validate_python(data, self_instance=self)

ValidationError: 1 validation error for Crew
  Value error, Task '
    Write a game recap article using the provided game information and stats.
    Key instructions:
    - Include things like final score, top performers and winning/losing pitcher.
    - Use ONLY the provided data and DO NOT make up any information, such as specific innings when events occurred, that isn't explicitly from the provided input.
    - Do not print the box score
    ' is asynchronous and cannot include other sequential asynchronous tasks in its context. [type=value_error, input_value={'agents': [Agent(role=ML...cle)], 'verbose': False}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.8/v/value_error

On this cell:

crew = Crew(
    agents=[mlb_researcher, mlb_statistician, mlb_writer_llama, mlb_writer_gemma, mlb_writer_mixtral, mlb_editor],
    tasks=[
        collect_game_info, 
        retrieve_batting_stats, retrieve_pitching_stats,
        write_game_recap_llama, write_game_recap_gemma, write_game_recap_mixtral,
        edit_game_recap
        ],
    verbose=False
)
dloman118 commented 1 month ago

Hi @jacobweiss2305, thanks for calling out this issue. I am getting the same error as you when upgrading to the latest version of CrewAI. It seems like the fix is to remove the async_execution = True from the Tasks, and there is another issue where the date parameter in the crew.kickoff line must be changed to str(default_date). I will get a fix out for this notebook for those!

hozen-groq commented 1 month ago

Amazing! Thank you, Jacob and Dan! Just merged the PR for this fix. Also, @jacobweiss2305, do you have X? Would love to give you another shoutout for your cookbook - I already had, but I'd love to credit your X account in the tweet!

jacobweiss2305 commented 1 month ago

@hozen-groq https://x.com/phidatahq