Skip to content

Commit cb43eb4

Browse files
Bugfix for reasoning-function-call notebook (#1800)
1 parent 5d64d5d commit cb43eb4

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

examples/reasoning_function_calls.ipynb

+13-7
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,21 @@
317317
" arguments = json.loads(response_item.arguments)\n",
318318
" print(f\"Invoking tool: {response_item.name}({arguments})\")\n",
319319
" tool_output = target_tool(**arguments)\n",
320-
" intermediate_messages.append({\n",
321-
" \"type\": \"function_call_output\",\n",
322-
" \"call_id\": response_item.call_id,\n",
323-
" \"output\": tool_output\n",
324-
" })\n",
325320
" except Exception as e:\n",
326-
" tool_output = f\"Error executing function call: {function_call.name}: {e}\"\n",
321+
" msg = f\"Error executing function call: {response_item.name}: {e}\"\n",
322+
" tool_output = msg\n",
323+
" print(msg)\n",
327324
" else:\n",
328-
" print(f\"ERROR - No tool registered for function call: {function_call.name}\")\n",
325+
" msg = f\"ERROR - No tool registered for function call: {response_item.name}\"\n",
326+
" tool_output = msg\n",
327+
" print(msg)\n",
328+
" intermediate_messages.append({\n",
329+
" \"type\": \"function_call_output\",\n",
330+
" \"call_id\": response_item.call_id,\n",
331+
" \"output\": tool_output\n",
332+
" })\n",
333+
" elif response_item.type == 'reasoning':\n",
334+
" print(f'Reasoning step: {response_item.summary}')\n",
329335
" return intermediate_messages"
330336
]
331337
},

0 commit comments

Comments
 (0)