Skip to content

Conversation

@karamvirsingh1998
Copy link
Contributor

@karamvirsingh1998 karamvirsingh1998 commented Nov 6, 2025

Fix KeyError that occurs when using OpenAI reasoning models (o1, o3, etc.) with temperature=None or frequency_penalty=None.

The code was using 'del' to remove keys that may not exist in model_params dictionary. Changed to use .pop() with default value for safe key removal.

Fixes crash scenario:

  • ChatOpenAI(model='o1-mini', temperature=None) -> KeyError

Changes:

  • Replace 'del model_params[key]' with 'model_params.pop(key, None)'

Summary by cubic

Prevent KeyError crashes when using OpenAI reasoning models by safely removing temperature and frequency_penalty from model_params with .pop(). Calls like ChatOpenAI(model='o1-mini', temperature=None) no longer crash.

Written for commit 0263f05. Summary will update automatically on new commits.

Fix KeyError that occurs when using OpenAI reasoning models (o1, o3, etc.)
with temperature=None or frequency_penalty=None.

The code was using 'del' to remove keys that may not exist in model_params
dictionary. Changed to use .pop() with default value for safe key removal.

Fixes crash scenario:
- ChatOpenAI(model='o1-mini', temperature=None) -> KeyError

Changes:
- Replace 'del model_params[key]' with 'model_params.pop(key, None)'
- Ensures parameters are safely removed even if not present in dict
@CLAassistant
Copy link

CLAassistant commented Nov 6, 2025

CLA assistant check
All committers have signed the CLA.

@karamvirsingh1998
Copy link
Contributor Author

@MagMueller @gregpr07 PLease review and merge

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@sauravpanda sauravpanda merged commit ffda72e into browser-use:main Nov 20, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants