From 00f13b816d5939c4f16bd719a44c38b628c112de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ahlert?= Date: Thu, 9 Apr 2026 09:30:18 -0300 Subject: [PATCH 1/3] fix: update deprecated OpenAI models to gpt-4o-mini in examples Replaces gpt-3.5-turbo and gpt-4 references with gpt-4o-mini across 8 example files. Closes #521. --- examples/multi-modal-chatbot/application.py | 4 ++-- examples/other-examples/hamilton-multi-modal/dag.py | 2 +- examples/simple-chatbot-intro/application.py | 2 +- examples/streaming-fastapi/application.py | 2 +- examples/streaming-overview/application.py | 4 ++-- examples/streaming-overview/async_application.py | 4 ++-- examples/test-case-creation/application.py | 2 +- examples/tracing-and-spans/application.py | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/multi-modal-chatbot/application.py b/examples/multi-modal-chatbot/application.py index 63b495366..91148640b 100644 --- a/examples/multi-modal-chatbot/application.py +++ b/examples/multi-modal-chatbot/application.py @@ -72,7 +72,7 @@ def choose_mode(state: State) -> State: ) result = _get_openai_client().chat.completions.create( - model="gpt-4", + model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, @@ -100,7 +100,7 @@ def prompt_for_more(state: State) -> State: @action(reads=["prompt", "chat_history", "mode"], writes=["response"]) def chat_response( - state: State, prepend_prompt: str, display_type: str = "text", model: str = "gpt-3.5-turbo" + state: State, prepend_prompt: str, display_type: str = "text", model: str = "gpt-4o-mini" ) -> State: chat_history = copy.deepcopy(state["chat_history"]) chat_history[-1]["content"] = f"{prepend_prompt}: {chat_history[-1]['content']}" diff --git a/examples/other-examples/hamilton-multi-modal/dag.py b/examples/other-examples/hamilton-multi-modal/dag.py index df7b9d535..61d52d4b7 100644 --- a/examples/other-examples/hamilton-multi-modal/dag.py +++ b/examples/other-examples/hamilton-multi-modal/dag.py @@ -34,7 +34,7 @@ def client() -> openai.Client: def text_model() -> str: - return "gpt-3.5-turbo" + return "gpt-4o-mini" def image_model() -> str: diff --git a/examples/simple-chatbot-intro/application.py b/examples/simple-chatbot-intro/application.py index c96f95169..702de7acb 100644 --- a/examples/simple-chatbot-intro/application.py +++ b/examples/simple-chatbot-intro/application.py @@ -43,7 +43,7 @@ def ai_response(state: State) -> Tuple[dict, State]: client = openai.Client() # replace this with your favorite LLM client library content = ( client.chat.completions.create( - model="gpt-3.5-turbo", + model="gpt-4o-mini", messages=state["chat_history"], ) .choices[0] diff --git a/examples/streaming-fastapi/application.py b/examples/streaming-fastapi/application.py index d90a5e335..5685627e2 100644 --- a/examples/streaming-fastapi/application.py +++ b/examples/streaming-fastapi/application.py @@ -95,7 +95,7 @@ async def prompt_for_more(state: State) -> AsyncGenerator[Tuple[dict, Optional[S @streaming_action(reads=["prompt", "chat_history", "mode"], writes=["response"]) async def chat_response( - state: State, prepend_prompt: str, model: str = "gpt-3.5-turbo" + state: State, prepend_prompt: str, model: str = "gpt-4o-mini" ) -> AsyncGenerator[Tuple[dict, Optional[State]], None]: """Streaming action, as we don't have the result immediately. This makes it more interactive""" chat_history = copy.deepcopy(state["chat_history"]) diff --git a/examples/streaming-overview/application.py b/examples/streaming-overview/application.py index 34fe1b204..1c4587717 100644 --- a/examples/streaming-overview/application.py +++ b/examples/streaming-overview/application.py @@ -60,7 +60,7 @@ def choose_mode(state: State) -> Tuple[dict, State]: ) result = _get_openai_client().chat.completions.create( - model="gpt-4", + model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, @@ -89,7 +89,7 @@ def prompt_for_more(state: State) -> Tuple[dict, State]: @streaming_action(reads=["prompt", "chat_history", "mode"], writes=["response"]) def chat_response( - state: State, prepend_prompt: str, model: str = "gpt-3.5-turbo" + state: State, prepend_prompt: str, model: str = "gpt-4o-mini" ) -> Generator[Tuple[dict, Optional[State]], None, None]: """Streaming action, as we don't have the result immediately. This makes it more interactive""" chat_history = state["chat_history"].copy() diff --git a/examples/streaming-overview/async_application.py b/examples/streaming-overview/async_application.py index 111852332..1caa6d885 100644 --- a/examples/streaming-overview/async_application.py +++ b/examples/streaming-overview/async_application.py @@ -61,7 +61,7 @@ async def choose_mode(state: State) -> Tuple[dict, State]: ) result = await _get_openai_client().chat.completions.create( - model="gpt-4", + model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, @@ -90,7 +90,7 @@ def prompt_for_more(state: State) -> Tuple[dict, State]: @streaming_action(reads=["prompt", "chat_history", "mode"], writes=["response"]) async def chat_response( - state: State, prepend_prompt: str, model: str = "gpt-3.5-turbo" + state: State, prepend_prompt: str, model: str = "gpt-4o-mini" ) -> Tuple[dict, State]: """Streaming action, as we don't have the result immediately. This makes it more interactive""" chat_history = state["chat_history"].copy() diff --git a/examples/test-case-creation/application.py b/examples/test-case-creation/application.py index a10786d83..e582510ce 100644 --- a/examples/test-case-creation/application.py +++ b/examples/test-case-creation/application.py @@ -49,7 +49,7 @@ def choose_mode(state: State) -> Tuple[dict, State]: ) result = _get_openai_client().chat.completions.create( - model="gpt-4", + model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, diff --git a/examples/tracing-and-spans/application.py b/examples/tracing-and-spans/application.py index 1116bf71d..bc9f68555 100644 --- a/examples/tracing-and-spans/application.py +++ b/examples/tracing-and-spans/application.py @@ -69,7 +69,7 @@ def choose_mode(state: State, __tracer: TracerFactory) -> Tuple[dict, State]: client = _get_openai_client() with __tracer("query_openai") as tracer: result = client.chat.completions.create( - model="gpt-4", + model="gpt-4o-mini", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, @@ -107,7 +107,7 @@ def chat_response( state: State, prepend_prompt: str, __tracer: TracerFactory, - model: str = "gpt-3.5-turbo", + model: str = "gpt-4o-mini", ) -> Tuple[dict, State]: __tracer.log_attributes(model=model, prepend_prompt=prepend_prompt) with __tracer("process_chat_history"): From 72d72c40d290f39aa4d030e1c4dbed70b234394e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ahlert?= Date: Thu, 9 Apr 2026 09:48:00 -0300 Subject: [PATCH 2/3] fix: use gpt-4o for routing actions, gpt-4o-mini for generation choose_mode uses gpt-4o (replaces gpt-4) to preserve the intentional two-tier model design. chat_response uses gpt-4o-mini (replaces gpt-3.5-turbo). --- examples/multi-modal-chatbot/application.py | 2 +- examples/streaming-overview/application.py | 2 +- examples/streaming-overview/async_application.py | 2 +- examples/test-case-creation/application.py | 2 +- examples/tracing-and-spans/application.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/multi-modal-chatbot/application.py b/examples/multi-modal-chatbot/application.py index 91148640b..663d22d48 100644 --- a/examples/multi-modal-chatbot/application.py +++ b/examples/multi-modal-chatbot/application.py @@ -72,7 +72,7 @@ def choose_mode(state: State) -> State: ) result = _get_openai_client().chat.completions.create( - model="gpt-4o-mini", + model="gpt-4o", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, diff --git a/examples/streaming-overview/application.py b/examples/streaming-overview/application.py index 1c4587717..911ee5f7f 100644 --- a/examples/streaming-overview/application.py +++ b/examples/streaming-overview/application.py @@ -60,7 +60,7 @@ def choose_mode(state: State) -> Tuple[dict, State]: ) result = _get_openai_client().chat.completions.create( - model="gpt-4o-mini", + model="gpt-4o", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, diff --git a/examples/streaming-overview/async_application.py b/examples/streaming-overview/async_application.py index 1caa6d885..4ca8402a5 100644 --- a/examples/streaming-overview/async_application.py +++ b/examples/streaming-overview/async_application.py @@ -61,7 +61,7 @@ async def choose_mode(state: State) -> Tuple[dict, State]: ) result = await _get_openai_client().chat.completions.create( - model="gpt-4o-mini", + model="gpt-4o", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, diff --git a/examples/test-case-creation/application.py b/examples/test-case-creation/application.py index e582510ce..20a0a1a0f 100644 --- a/examples/test-case-creation/application.py +++ b/examples/test-case-creation/application.py @@ -49,7 +49,7 @@ def choose_mode(state: State) -> Tuple[dict, State]: ) result = _get_openai_client().chat.completions.create( - model="gpt-4o-mini", + model="gpt-4o", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, diff --git a/examples/tracing-and-spans/application.py b/examples/tracing-and-spans/application.py index bc9f68555..a07ce0934 100644 --- a/examples/tracing-and-spans/application.py +++ b/examples/tracing-and-spans/application.py @@ -69,7 +69,7 @@ def choose_mode(state: State, __tracer: TracerFactory) -> Tuple[dict, State]: client = _get_openai_client() with __tracer("query_openai") as tracer: result = client.chat.completions.create( - model="gpt-4o-mini", + model="gpt-4o", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": prompt}, From 1d63d4f8dd548b9ed54a8dd16b0a2ab27df0912d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ahlert?= Date: Thu, 9 Apr 2026 10:28:05 -0300 Subject: [PATCH 3/3] fix: update deprecated OpenAI models in example notebooks Replaces gpt-3.5-turbo with gpt-4o-mini and gpt-4-turbo-preview with gpt-4o in 5 example notebooks. Skips parallelism/notebook.ipynb which intentionally uses multiple models to demonstrate parallel execution. --- examples/conversational-rag/graph_db_example/notebook.ipynb | 4 ++-- examples/multi-modal-chatbot/burr_demo.ipynb | 2 +- examples/simple-chatbot-intro/notebook.ipynb | 2 +- examples/talks/data_for_ai_oct_2024.ipynb | 2 +- examples/tracing-and-spans/burr_otel_demo.ipynb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/conversational-rag/graph_db_example/notebook.ipynb b/examples/conversational-rag/graph_db_example/notebook.ipynb index 13758a357..7625cbe28 100644 --- a/examples/conversational-rag/graph_db_example/notebook.ipynb +++ b/examples/conversational-rag/graph_db_example/notebook.ipynb @@ -242,7 +242,7 @@ " messages = state[\"chat_history\"]\n", " # Call the function\n", " response = client.chat.completions.create(\n", - " model=\"gpt-4-turbo-preview\",\n", + " model=\"gpt-4o\",\n", " messages=messages,\n", " tools=[run_cypher_query_tool_description],\n", " tool_choice=\"auto\",\n", @@ -315,7 +315,7 @@ " \"\"\"AI step to generate the response given the current chat history.\"\"\"\n", " messages = state[\"chat_history\"]\n", " response = client.chat.completions.create(\n", - " model=\"gpt-4-turbo-preview\",\n", + " model=\"gpt-4o\",\n", " messages=messages,\n", " ) # get a new response from the model where it can see the function response\n", " response_message = response.choices[0].message\n", diff --git a/examples/multi-modal-chatbot/burr_demo.ipynb b/examples/multi-modal-chatbot/burr_demo.ipynb index 5f26a6f5f..ae22ce127 100644 --- a/examples/multi-modal-chatbot/burr_demo.ipynb +++ b/examples/multi-modal-chatbot/burr_demo.ipynb @@ -174,7 +174,7 @@ "\n", "@action(reads=[\"prompt\", \"chat_history\", \"mode\"], writes=[\"response\"])\n", "def chat_response(\n", - " state: State, prepend_prompt: str, model: str = \"gpt-3.5-turbo\"\n", + " state: State, prepend_prompt: str, model: str = \"gpt-4o-mini\"\n", ") -> State:\n", "\n", " chat_history = copy.deepcopy(state[\"chat_history\"])\n", diff --git a/examples/simple-chatbot-intro/notebook.ipynb b/examples/simple-chatbot-intro/notebook.ipynb index 93ba520a3..9e8c1bfc3 100644 --- a/examples/simple-chatbot-intro/notebook.ipynb +++ b/examples/simple-chatbot-intro/notebook.ipynb @@ -89,7 +89,7 @@ " but we wanted to keep it simple to demonstrate\"\"\"\n", " client = openai.Client() # replace with your favorite LLM client library\n", " content = client.chat.completions.create(\n", - " model=\"gpt-3.5-turbo\",\n", + " model=\"gpt-4o-mini\",\n", " messages=state[\"chat_history\"],\n", " ).choices[0].message.content\n", " chat_item = {\n", diff --git a/examples/talks/data_for_ai_oct_2024.ipynb b/examples/talks/data_for_ai_oct_2024.ipynb index 49eb22f6c..d135741cd 100644 --- a/examples/talks/data_for_ai_oct_2024.ipynb +++ b/examples/talks/data_for_ai_oct_2024.ipynb @@ -547,7 +547,7 @@ "\n", "@action(reads=[\"prompt\", \"chat_history\", \"mode\"], writes=[\"response\"])\n", "def chat_response(\n", - " state: State, prepend_prompt: str, model: str = \"gpt-3.5-turbo\"\n", + " state: State, prepend_prompt: str, model: str = \"gpt-4o-mini\"\n", ") -> State:\n", " \n", " chat_history = copy.deepcopy(state[\"chat_history\"])\n", diff --git a/examples/tracing-and-spans/burr_otel_demo.ipynb b/examples/tracing-and-spans/burr_otel_demo.ipynb index 918acb857..7d6b30f22 100644 --- a/examples/tracing-and-spans/burr_otel_demo.ipynb +++ b/examples/tracing-and-spans/burr_otel_demo.ipynb @@ -183,7 +183,7 @@ "\n", "@action(reads=[\"prompt\", \"chat_history\", \"mode\"], writes=[\"response\"])\n", "def chat_response(\n", - " state: State, prepend_prompt: str, model: str = \"gpt-3.5-turbo\"\n", + " state: State, prepend_prompt: str, model: str = \"gpt-4o-mini\"\n", ") -> State:\n", " \n", " chat_history = copy.deepcopy(state[\"chat_history\"])\n",