From cb43eb40e2881bee3bc2d44385b4612797048639 Mon Sep 17 00:00:00 2001 From: Tom Pakeman Date: Wed, 30 Apr 2025 09:08:02 +0100 Subject: [PATCH] Bugfix for reasoning-function-call notebook (#1800) --- examples/reasoning_function_calls.ipynb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/reasoning_function_calls.ipynb b/examples/reasoning_function_calls.ipynb index 2c26478..127de07 100644 --- a/examples/reasoning_function_calls.ipynb +++ b/examples/reasoning_function_calls.ipynb @@ -317,15 +317,21 @@ " arguments = json.loads(response_item.arguments)\n", " print(f\"Invoking tool: {response_item.name}({arguments})\")\n", " tool_output = target_tool(**arguments)\n", - " intermediate_messages.append({\n", - " \"type\": \"function_call_output\",\n", - " \"call_id\": response_item.call_id,\n", - " \"output\": tool_output\n", - " })\n", " except Exception as e:\n", - " tool_output = f\"Error executing function call: {function_call.name}: {e}\"\n", + " msg = f\"Error executing function call: {response_item.name}: {e}\"\n", + " tool_output = msg\n", + " print(msg)\n", " else:\n", - " print(f\"ERROR - No tool registered for function call: {function_call.name}\")\n", + " msg = f\"ERROR - No tool registered for function call: {response_item.name}\"\n", + " tool_output = msg\n", + " print(msg)\n", + " intermediate_messages.append({\n", + " \"type\": \"function_call_output\",\n", + " \"call_id\": response_item.call_id,\n", + " \"output\": tool_output\n", + " })\n", + " elif response_item.type == 'reasoning':\n", + " print(f'Reasoning step: {response_item.summary}')\n", " return intermediate_messages" ] },