From 75270ec91066562191fa9ec34ca807847c6ffc86 Mon Sep 17 00:00:00 2001 From: Michele Pangrazzi Date: Tue, 26 Nov 2024 09:33:15 +0100 Subject: [PATCH] Fix: ensure all functions have been called before running chat generator --- .../40_Building_Chat_Application_with_Function_Calling.ipynb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tutorials/40_Building_Chat_Application_with_Function_Calling.ipynb b/tutorials/40_Building_Chat_Application_with_Function_Calling.ipynb index 08d87ba7..1f1201bd 100644 --- a/tutorials/40_Building_Chat_Application_with_Function_Calling.ipynb +++ b/tutorials/40_Building_Chat_Application_with_Function_Calling.ipynb @@ -1127,7 +1127,9 @@ "\n", " ## Append function response to the messages list using `ChatMessage.from_function`\n", " messages.append(ChatMessage.from_function(content=json.dumps(function_response), name=function_name))\n", - " response = chat_generator.run(messages=messages, generation_kwargs={\"tools\": tools})\n", + "\n", + " # After processing all function calls, call `chat_generator.run` once\n", + " response = chat_generator.run(messages=messages, generation_kwargs={\"tools\": tools})\n", "\n", " # Regular Conversation\n", " else:\n",