Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

fix: update deprecated OpenAI models to gpt-4o-mini in examples

André Ahlertc86901dee25a
diff --git a/examples/multi-modal-chatbot/application.py b/examples/multi-modal-chatbot/application.py
index 63b49536..91148640 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 df7b9d53..61d52d4b 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 c96f9516..702de7ac 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 d90a5e33..5685627e 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 34fe1b20..1c458771 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 11185233..1caa6d88 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 a10786d8..e582510c 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 1116bf71..bc9f6855 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"):