Lesson 3 LangGraph components : Error with Multiple Tool Calls

Hi,

I try to run the code of this lesson whithin Visual Code Python, not Jupyter notebook.

The code attached to the Lesson 3 : LangGraph components works just fine when I prompt this :
messages = [HumanMessage(content=“What is the weather in SF?”)]

But throws an error when I prompt this :
messages = [HumanMessage(content=“What is the weather in SF and LA?”)]

Error message :
openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: “An assistant message with ‘tool_calls’ must be followed by tool messages responding to each ‘tool_call_id’. The following tool_call_ids did not have response messages: call_WJg9kzb1nGPu7xeZ1wcsJ5tu”, ‘type’: ‘invalid_request_error’, ‘param’: ‘messages’, ‘code’: None}}

Any insights or suggestions would be greatly appreciated. Thank you in advance for your help!

My only comment is that you could be using an incorrect version of one of the packages or libraries.

The courses are not updated every time a new version of a package is released.

Did you manage to solve it?