From 899faf1da9291cb1cfed8911274a26eb3009e8df Mon Sep 17 00:00:00 2001 From: Jordan Ellis Date: Fri, 15 Aug 2025 18:26:29 -0400 Subject: [PATCH 1/2] Updated 'How to call functions with chat models' cookbook to use GPT-5. Also fixed a minor typo --- ...ow_to_call_functions_with_chat_models.ipynb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/How_to_call_functions_with_chat_models.ipynb b/examples/How_to_call_functions_with_chat_models.ipynb index 45102bddcd..71cc3f3d42 100644 --- a/examples/How_to_call_functions_with_chat_models.ipynb +++ b/examples/How_to_call_functions_with_chat_models.ipynb @@ -51,7 +51,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "dab872c5", "metadata": { "ExecuteTime": { @@ -66,7 +66,7 @@ "from tenacity import retry, wait_random_exponential, stop_after_attempt\n", "from termcolor import colored \n", "\n", - "GPT_MODEL = \"gpt-4o\"\n", + "GPT_MODEL = \"gpt-5\"\n", "client = OpenAI()" ] }, @@ -515,7 +515,7 @@ "source": [ "### Parallel Function Calling\n", "\n", - "Newer models such as gpt-4o or gpt-3.5-turbo can call multiple functions in one turn." + "Newer models such as gpt-5, gpt-4o or gpt-3.5-turbo can call multiple functions in one turn." ] }, { @@ -758,7 +758,7 @@ "source": [ "##### Steps to invoke a function call using Chat Completions API: \n", "\n", - "**Step 1**: Prompt the model with content that may result in model selecting a tool to use. The description of the tools such as a function names and signature is defined in the 'Tools' list and passed to the model in API call. If selected, the function name and parameters are included in the response.
\n", + "**Step 1**: Prompt the model with content that may result in model selecting a tool to use. The description of the tools such as a function name and signature is defined in the 'Tools' list and passed to the model in API call. If selected, the function name and parameters are included in the response.
\n", " \n", "**Step 2**: Check programmatically if model wanted to call a function. If true, proceed to step 3.
\n", "**Step 3**: Extract the function name and parameters from response, call the function with parameters. Append the result to messages.
\n", @@ -767,7 +767,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "e8b7cb9cdc7a7616", "metadata": { "ExecuteTime": { @@ -792,9 +792,9 @@ "}]\n", "\n", "response = client.chat.completions.create(\n", - " model='gpt-4o', \n", + " model=GPT_MODEL, \n", " messages=messages, \n", - " tools= tools, \n", + " tools=tools, \n", " tool_choice=\"auto\"\n", ")\n", "\n", @@ -807,7 +807,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "351c39def3417776", "metadata": { "ExecuteTime": { @@ -847,7 +847,7 @@ " # Step 4: Invoke the chat completions API with the function response appended to the messages list\n", " # Note that messages with role 'tool' must be a response to a preceding message with 'tool_calls'\n", " model_response_with_function_call = client.chat.completions.create(\n", - " model=\"gpt-4o\",\n", + " model=GPT_MODEL,\n", " messages=messages,\n", " ) # get a new response from the model where it can see the function response\n", " print(model_response_with_function_call.choices[0].message.content)\n", From ef770e47c77df9634226c4cea70ca9db1eaabdc0 Mon Sep 17 00:00:00 2001 From: Jordan Ellis Date: Wed, 20 Aug 2025 18:28:57 -0400 Subject: [PATCH 2/2] Updated 'How to call functions with chat models' cookbook to use GPT-5. Also fixed a minor typo --- examples/How_to_call_functions_with_chat_models.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/How_to_call_functions_with_chat_models.ipynb b/examples/How_to_call_functions_with_chat_models.ipynb index 71cc3f3d42..5732d5bffb 100644 --- a/examples/How_to_call_functions_with_chat_models.ipynb +++ b/examples/How_to_call_functions_with_chat_models.ipynb @@ -515,7 +515,7 @@ "source": [ "### Parallel Function Calling\n", "\n", - "Newer models such as gpt-5, gpt-4o or gpt-3.5-turbo can call multiple functions in one turn." + "Newer models such as gpt-5, gpt-4.1 or gpt-4o can call multiple functions in one turn." ] }, {