mirror of
https://github.com/james-m-jordan/openai-cookbook.git
synced 2025-05-09 19:32:38 +00:00
Bugfix for reasoning-function-call notebook (#1800)
This commit is contained in:
parent
5d64d5d9e9
commit
cb43eb40e2
@ -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"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user