Lesson 2: Tools not getting executed

Hi,
I have implemented the notebook as it is from the Lesson 2.
The only difference in my Model, where I am using Azure OpenAI service inside my enterprise private network. I have tried with gpt35-turbo and gpt35-turbo-0125 model. with api_version = 2024-02-01.

no matter what I do, The tools are not getting executed at all. whether using Langgraph or langchain create_react_agent. I am not sure if there is any additional package I am supposed to install.

While executing the below cell,

messages = [HumanMessage(content="who are the Euro 2024 finalists")]

result = abot.graph.invoke({"messages": messages})

result

This is the response I am getting, using gpt-35-turbo-0125,

{'messages': [HumanMessage(content='who are the Euro 2024 finalists'),
 AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_US6V7dBLMqMN3LO0PaDQ7xk3', 'function': {'arguments': '// I need to use a search engine to look up the information\n// I will use Google search engine to find the information\n// I will search for "Euro 2024 finalists"\n// I will look for the most recent and reliable source of information\n\n// @ts-ignore\nconst searchResults = await google.search(\'Euro 2024 finalists\');\n\nsearchResults[0].description;', 'name': 'functions'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 82, 'prompt_tokens': 156, 'total_tokens': 238}, 'model_name': 'gpt-35-turbo', 'system_fingerprint': None, 'prompt_filter_results': [{'prompt_index': 0, 'content_filter_results': {'hate': {'filtered': False, 'severity': 'safe'}, 'self_harm': {'filtered': False, 'severity': 'safe'}, 'sexual': {'filtered': False, 'severity': 'safe'}, 'violence': {'filtered': False, 'severity': 'safe'}}}], 'finish_reason': 'tool_calls', 'logprobs': None, 'content_filter_results': {}}, id='run-3998fc0f-1e1c-4828-874a-9c57febf29fc-0', invalid_tool_calls=[{'name': 'functions', 'args': '// I need to use a search engine to look up the information\n// I will use Google search engine to find the information\n// I will search for "Euro 2024 finalists"\n// I will look for the most recent and reliable source of information\n\n// @ts-ignore\nconst searchResults = await google.search(\'Euro 2024 finalists\');\n\nsearchResults[0].description;', 'id': 'call_US6V7dBLMqMN3LO0PaDQ7xk3', 'error': 'Function functions arguments:\n\n// I need to use a search engine to look up the information\n// I will use Google search engine to find the information\n// I will search for "Euro 2024 finalists"\n// I will look for the most recent and reliable source of information\n\n// @ts-ignore\nconst searchResults = await google.search(\'Euro 2024 finalists\');\n\nsearchResults[0].description;\n\nare not valid JSON. Received JSONDecodeError Expecting value: line 1 column 1 (char 0)'}], usage_metadata={'input_tokens': 156, 'output_tokens': 82, 'total_tokens': 238})]}

And, This is the response using gpt-4o model,

{'messages': [HumanMessage(content='who are the Euro 2024 finalists'), AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_UlGZWLSw5EpKcaQzMBobXwDe', 'function': {'arguments': '{"query":"Euro 2024 finalists"}', 'name': 'tavily_search_results_json'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 152, 'total_tokens': 174}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_abc28019ad', 'prompt_filter_results': [{'prompt_index': 0, 'content_filter_results': {'hate': {'filtered': False, 'severity': 'safe'}, 'self_harm': {'filtered': False, 'severity': 'safe'}, 'sexual': {'filtered': False, 'severity': 'safe'}, 'violence': {'filtered': False, 'severity': 'safe'}}}], 'finish_reason': 'tool_calls', 'logprobs': None, 'content_filter_results': {}}, id='run-2faf5fd3-20c7-4eb0-accb-d6f3e6e4fb82-0', tool_calls=[{'name': 'tavily_search_results_json', 'args': {'query': 'Euro 2024 finalists'}, 'id': 'call_UlGZWLSw5EpKcaQzMBobXwDe'}], usage_metadata={'input_tokens': 152, 'output_tokens': 22, 'total_tokens': 174}), ToolMessage(content='[{\'url\': \'[https://www.uefa.com/euro2024/news/028f-1b4e4a9a6d42-253a2c18efdf-1000--euro-2024-final-meet-the-finalists/\](https://www.uefa.com/euro2024/news/028f-1b4e4a9a6d42-253a2c18efdf-1000--euro-2024-final-meet-the-finalists//)', \'content\': \'The UEFA EURO 2024 finalists are now confirmed, as 24 teams have been whittled down to the final two. We profile the teams going head to head to lift the Henri Delaunay Cup in Berlin on 14 July.\'}, {\'url\': \'[https://www.nytimes.com/athletic/live-blogs/england-spain-live-updates-euro-2024-final-score-result/T1jQng4KWoo4/\](https://www.nytimes.com/athletic/live-blogs/england-spain-live-updates-euro-2024-final-score-result/T1jQng4KWoo4//)', \'content\': "Euro 2020 final: England 1-1 Italy - Italy won 3-2 on penalties Both of those matches were played at Wembley — the old and then the new — so today\'s game will be England\'s first final ..."}, {\'url\': \'[https://www.uefa.com/euro2024/news/028f-1b46491ae6b9-cce0f0124c5c-1000--euro-2024-quarter-finals-meet-the-last-eight/\](https://www.uefa.com/euro2024/news/028f-1b46491ae6b9-cce0f0124c5c-1000--euro-2024-quarter-finals-meet-the-last-eight//)', \'content\': \'From 24 teams at the start to just eight, the UEFA EURO 2024 quarter-finalists are now confirmed. We profile the teams still in contention to lift the Henri Delaunay Cup in Berlin on 14 July.\'}, {\'url\': \'[https://www.uefa.com/euro2024/news/028f-1b597d73ac44-281bef77526d-1000--spain-vs-england-euro-2024-final-preview-where-to-watch-k/\](https://www.uefa.com/euro2024/news/028f-1b597d73ac44-281bef77526d-1000--spain-vs-england-euro-2024-final-preview-where-to-watch-k//)', \'content\': \'All you need to know about the UEFA EURO 2024 final between Spain and England. Article top media content. Article body. ... Live 14/07/2024 Meet the finalists\'}]', name='tavily_search_results_json', tool_call_id='call_UlGZWLSw5EpKcaQzMBobXwDe'), AIMessage(content='The finalists for UEFA EURO 2024 are Spain and England. They will compete for the Henri Delaunay Cup in Berlin on 14 July 2024.', response_metadata={'token_usage': {'completion_tokens': 34, 'prompt_tokens': 596, 'total_tokens': 630}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_abc28019ad', 'prompt_filter_results': [{'prompt_index': 0, 'content_filter_results': {'hate': {'filtered': False, 'severity': 'safe'}, 'self_harm': {'filtered': False, 'severity': 'safe'}, 'sexual': {'filtered': False, 'severity': 'safe'}, 'violence': {'filtered': False, 'severity': 'safe'}}}], 'finish_reason': 'stop', 'logprobs': None, 'content_filter_results': {'hate': {'filtered': False, 'severity': 'safe'}, 'self_harm': {'filtered': False, 'severity': 'safe'}, 'sexual': {'filtered': False, 'severity': 'safe'}, 'violence': {'filtered': False, 'severity': 'safe'}}}, id='run-765475c6-c618-420c-b10e-ec370ea89ee0-0', usage_metadata={'input_tokens': 596, 'output_tokens': 34, 'total_tokens': 630})]}

Please let me know what I am doing wrong as I am totally stuck with implementing any Agentic app.

Thank you for your help.