joaomdmoura / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
17.11k stars 2.32k forks source link

Please reduce the length of message error. #701

Open iamyihwa opened 1 month ago

iamyihwa commented 1 month ago

Hello, I am following the code from the course Multi AI Agent systems with crewAI.

When I kick of the crew by doing

inputs = {
    "lead_name": "DeepLearningAI",
    "industry": "Online Learning Platform",
    "key_decision_maker": "Andrew Ng",
    "position": "CEO",
    "milestone": "product launch"
}

result = crew.kickoff(inputs=inputs)

I am getting an error that says

Error code: 400 - {'error': {'message': "This model's maximum context length is 4096 tokens. However, your messages resulted in 4777 tokens. Please reduce the length of the messages.", 'type': 'invalid_request_error', 'param': 'messages', 'code': 'context_length_exceeded'}}

I wonder if it is related with another error that I encountered and had to set memory = False.

If not, I wonder how to set the message length in crewai, in order to solve this issue.

I am using GPT3.5 turbo..

gadgethome commented 1 month ago

Can you try gpt-4o and see if you get the same error? thanks

Latest version. crewai 0.30.11 crewai-tools 0.2.6