Skip to content

Commit 2b0045f

Browse files
committed
make reasoning_models a parameter
1 parent 655d8ff commit 2b0045f

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

browser_use/llm/openai/chat.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,6 @@
2020

2121
T = TypeVar('T', bound=BaseModel)
2222

23-
ReasoningModels: list[ChatModel | str] = [
24-
'o4-mini',
25-
'o3',
26-
'o3-mini',
27-
'o1',
28-
'o1-pro',
29-
'o3-pro',
30-
'gpt-5',
31-
'gpt-5-mini',
32-
'gpt-5-nano',
33-
]
34-
3523

3624
@dataclass
3725
class ChatOpenAI(BaseChatModel):
@@ -67,6 +55,17 @@ class ChatOpenAI(BaseChatModel):
6755
http_client: httpx.AsyncClient | None = None
6856
_strict_response_validation: bool = False
6957
max_completion_tokens: int | None = 4096
58+
reasoning_models: list[ChatModel | str] | None = [
59+
'o4-mini',
60+
'o3',
61+
'o3-mini',
62+
'o1',
63+
'o1-pro',
64+
'o3-pro',
65+
'gpt-5',
66+
'gpt-5-mini',
67+
'gpt-5-nano',
68+
]
7069

7170
# Static
7271
@property
@@ -180,7 +179,7 @@ async def ainvoke(
180179
if self.service_tier is not None:
181180
model_params['service_tier'] = self.service_tier
182181

183-
if any(str(m).lower() in str(self.model).lower() for m in ReasoningModels):
182+
if any(str(m).lower() in str(self.model).lower() for m in self.reasoning_models):
184183
model_params['reasoning_effort'] = self.reasoning_effort
185184
del model_params['temperature']
186185
del model_params['frequency_penalty']

0 commit comments

Comments
 (0)