Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Commit 0c02a7b

Browse files
authored
Merge pull request #97 from Not-Diamond/ENG-2299_deprecate-openai-o1-preview-and-openai-o1-mini
ENG-2299: Deprecate OpenAI o1 preview and OpenAI o1 mini
2 parents 0b86af2 + d96c08e commit 0c02a7b

9 files changed

Lines changed: 2 additions & 733 deletions

notdiamond/llms/client.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
MissingLLMConfigs,
3333
)
3434
from notdiamond.llms.config import LLMConfig
35-
from notdiamond.llms.providers import is_o1_model
3635
from notdiamond.llms.request import (
3736
amodel_select,
3837
create_preference_id,
@@ -43,7 +42,6 @@
4342
from notdiamond.prompts import (
4443
_curly_escape,
4544
inject_system_prompt,
46-
o1_system_prompt_translate,
4745
)
4846
from notdiamond.types import NDApiKeyValidator
4947

@@ -907,13 +905,11 @@ def invoke(
907905
messages, best_llm.system_prompt
908906
)
909907

910-
messages = o1_system_prompt_translate(messages, best_llm)
911-
912908
self.call_callbacks("on_model_select", best_llm, best_llm.model)
913909

914910
llm = self._llm_from_config(best_llm, callbacks=self.callbacks)
915911

916-
if self.tools and not is_o1_model(best_llm):
912+
if self.tools:
917913
llm = llm.bind_tools(self.tools)
918914

919915
if response_model is not None:
@@ -1110,13 +1106,11 @@ async def ainvoke(
11101106
messages, best_llm.system_prompt
11111107
)
11121108

1113-
messages = o1_system_prompt_translate(messages, best_llm)
1114-
11151109
self.call_callbacks("on_model_select", best_llm, best_llm.model)
11161110

11171111
llm = self._llm_from_config(best_llm, callbacks=self.callbacks)
11181112

1119-
if self.tools and not is_o1_model(best_llm):
1113+
if self.tools:
11201114
llm = llm.bind_tools(self.tools)
11211115

11221116
if response_model is not None:
@@ -1549,9 +1543,6 @@ def _llm_from_config(
15491543
"ChatOpenAI",
15501544
provider.provider,
15511545
)
1552-
if is_o1_model(provider):
1553-
passed_kwargs["temperature"] = 1.0
1554-
15551546
return ChatOpenAI(
15561547
openai_api_key=provider.api_key,
15571548
model_name=provider.model,

notdiamond/llms/providers.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ class NDLLMProviders(Enum):
2929
GPT_4_1_MINI_2025_04_14 (NDLLMProvider): refers to 'gpt-4.1-mini-2025-04-14' model by OpenAI
3030
GPT_4_1_NANO (NDLLMProvider): refers to 'gpt-4.1-nano' model by OpenAI
3131
GPT_4_1_NANO_2025_04_14 (NDLLMProvider): refers to 'gpt-4.1-nano-2025-04-14' model by OpenAI
32-
O1_PREVIEW (NDLLMProvider): refers to 'o1-preview' model by OpenAI
33-
O1_PREVIEW_2024_09_12 (NDLLMProvider): refers to 'o1-preview-2024-09-12' model by OpenAI
34-
O1_MINI (NDLLMProvider): refers to 'o1-mini' model by OpenAI
35-
O1_MINI_2024_09_12 (NDLLMProvider): refers to 'o1-mini-2024-09-12' model by OpenAI
3632
3733
CLAUDE_2_1 (NDLLMProvider): refers to 'claude-2.1' model by Anthropic
3834
CLAUDE_3_OPUS_20240229 (NDLLMProvider): refers to 'claude-3-opus-20240229' model by Anthropic
@@ -117,10 +113,6 @@ class NDLLMProviders(Enum):
117113
GPT_4_1_MINI_2025_04_14 = ("openai", "gpt-4.1-mini-2025-04-14")
118114
GPT_4_1_NANO = ("openai", "gpt-4.1-nano")
119115
GPT_4_1_NANO_2025_04_14 = ("openai", "gpt-4.1-nano-2025-04-14")
120-
O1_PREVIEW = ("openai", "o1-preview")
121-
O1_PREVIEW_2024_09_12 = ("openai", "o1-preview-2024-09-12")
122-
O1_MINI = ("openai", "o1-mini")
123-
O1_MINI_2024_09_12 = ("openai", "o1-mini-2024-09-12")
124116
CHATGPT_4o_LATEST = ("openai", "chatgpt-4o-latest")
125117

126118
CLAUDE_2_1 = ("anthropic", "claude-2.1")
@@ -223,10 +215,3 @@ def __new__(cls, provider, model):
223215
return LLMConfig(provider=provider, model=model)
224216

225217

226-
def is_o1_model(llm: LLMConfig):
227-
return llm in (
228-
NDLLMProviders.O1_PREVIEW,
229-
NDLLMProviders.O1_PREVIEW_2024_09_12,
230-
NDLLMProviders.O1_MINI,
231-
NDLLMProviders.O1_MINI_2024_09_12,
232-
)

notdiamond/prompts.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
import re
33
from typing import Dict, List
44

5-
from notdiamond.llms.config import LLMConfig
6-
from notdiamond.llms.providers import is_o1_model
7-
85
LOGGER = logging.getLogger(__name__)
96
LOGGER.setLevel(logging.INFO)
107

@@ -37,17 +34,3 @@ def _curly_escape(text: str) -> str:
3734
return re.sub(r"(?<!{){([a-zA-Z])}(?!})", r"{{\1}}", text)
3835

3936

40-
def o1_system_prompt_translate(
41-
messages: List[Dict[str, str]], llm: LLMConfig
42-
) -> List[Dict[str, str]]:
43-
if is_o1_model(llm):
44-
translated_messages = []
45-
for msg in messages:
46-
if msg["role"] == "system":
47-
translated_messages.append(
48-
{"role": "user", "content": msg["content"]}
49-
)
50-
else:
51-
translated_messages.append(msg)
52-
return translated_messages
53-
return messages

notdiamond/settings.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
"gpt-4.1-mini-2025-04-14",
4646
"gpt-4.1-nano",
4747
"gpt-4.1-nano-2025-04-14",
48-
"o1-preview",
49-
"o1-preview-2024-09-12",
50-
"o1-mini",
51-
"o1-mini-2024-09-12",
5248
"chatgpt-4o-latest",
5349
],
5450
"api_key": OPENAI_API_KEY,
@@ -89,10 +85,6 @@
8985
"gpt-4-turbo-preview",
9086
"gpt-4-0125-preview",
9187
"gpt-4-1106-preview",
92-
"o1-preview",
93-
"o1-preview-2024-09-12",
94-
"o1-mini",
95-
"o1-mini-2024-09-12",
9688
"chatgpt-4o-latest",
9789
"gpt-4.1",
9890
"gpt-4.1-2025-04-14",
@@ -112,10 +104,6 @@
112104
"gpt-4o-mini-2024-07-18": "openai/gpt-4o-mini-2024-07-18",
113105
"gpt-4-turbo-preview": "openai/gpt-4-turbo-preview",
114106
"gpt-4-1106-preview": "openai/gpt-4-1106-preview",
115-
"o1-preview": "openai/o1-preview",
116-
"o1-preview-2024-09-12": "openai/o1-preview-2024-09-12",
117-
"o1-mini": "openai/o1-mini",
118-
"o1-mini-2024-09-12": "openai/o1-mini-2024-09-12",
119107
"chatgpt-4o-latest": "openai/chatgpt-4o-latest",
120108
"gpt-4.1": "openai/gpt-4.1",
121109
"gpt-4.1-2025-04-14": "openai/gpt-4.1-2025-04-14",
@@ -139,10 +127,6 @@
139127
"gpt-4-turbo-preview": {"input": 10.0, "output": 30.0},
140128
"gpt-4-0125-preview": {"input": 10.0, "output": 30.0},
141129
"gpt-4-1106-preview": {"input": 10.0, "output": 30.0},
142-
"o1-preview": {"input": 15.0, "output": 60.0},
143-
"o1-preview-2024-09-12": {"input": 15.0, "output": 60.0},
144-
"o1-mini": {"input": 3.0, "output": 12.0},
145-
"o1-mini-2024-09-12": {"input": 3.0, "output": 12.0},
146130
"chatgpt-4o-latest": {"input": 5.0, "output": 15.0},
147131
"gpt-4.1": {"input": 2.0, "output": 8.0},
148132
"gpt-4.1-mini": {"input": 0.5, "output": 1.6},

tests/test_llm_calls/cassettes/test_openai_o1/test_o1_with_system_prompt[provider0].yaml

Lines changed: 0 additions & 162 deletions
This file was deleted.

0 commit comments

Comments
 (0)