Bugfix for reasoning-function-call notebook (#1800)

This commit is contained in:
Tom Pakeman 2025-04-30 09:08:02 +01:00 committed by GitHub
parent 5d64d5d9e9
commit cb43eb40e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -317,15 +317,21 @@
" arguments = json.loads(response_item.arguments)\n", " arguments = json.loads(response_item.arguments)\n",
" print(f\"Invoking tool: {response_item.name}({arguments})\")\n", " print(f\"Invoking tool: {response_item.name}({arguments})\")\n",
" tool_output = target_tool(**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", " 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", " 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" " return intermediate_messages"
] ]
}, },