From cf2b38d5cdbdc22f9fb08d390cd524de41e6b3c8 Mon Sep 17 00:00:00 2001 From: Michele Pangrazzi Date: Tue, 26 Nov 2024 15:04:50 +0100 Subject: [PATCH] Fix: ensure all functions have been called before running chat generator (#364) --- .../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 08d87ba..1f1201b 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",