Chase Xu
993a4c1f5b
fix: remove double-counting of reasoning_tokens in OpenAI usage
...
OpenAI's completion_tokens already includes reasoning_tokens as a subset,
so adding them again was incorrectly inflating token counts by ~2x for
all reasoning models (o1, o3, o4-mini, etc.).
This aligns with other OpenAI-compatible providers (OpenRouter, Vercel,
Cerebras, Groq) which use completion_tokens directly.
Note: This is different from Google Gemini where thinking_tokens ARE
reported separately and need to be added.
Fixes #4065
2026-02-10 05:32:13 -06:00
Laith Weinberger
1629799dd3
fix(openai): structured output call shouldn't depend on schema injection
...
Fix indentation so structured-output request executes even when add_schema_to_system_prompt is false; add regression tests for choices=null in both structured and non-structured paths.
2026-02-08 16:03:21 -05:00
Laith Weinberger
62d19f0c9a
fix(openai): handle proxy responses with missing/null choices; undo test change
...
Avoid indexing response.choices[0] when proxies return choices=null/empty; raise a clear ModelProviderError (with base_url hint) and use the validated first choice for content/finish_reason
2026-02-08 15:37:59 -05:00
sudhanshu112233shukla
4c81648d68
fix(llm): handle missing choices in openai proxy response
2026-01-16 20:21:53 +00:00
Saurav Panda
29c9f1a416
feat: add support for openai responses model
2025-12-22 22:16:56 -08:00
mertunsall
dc0db88215
kv caching for BU agents
2025-12-15 18:23:22 -08:00
Saurav Panda
0263f05a7e
Merge branch 'main' into fix/openai-reasoning-model-keyerror
2025-11-19 21:48:46 -08:00
Magnus Müller
3cf6e1046b
include kimi-2
2025-11-06 13:49:20 -08:00
karamvirsingh1998
4330164f95
fix: prevent KeyError crash in OpenAI reasoning models
...
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
2025-11-06 12:04:25 +05:30
mertunsall
61779863bc
option to not force structured output
2025-11-01 14:20:26 -07:00
Krishna Rathore
687f166a29
Updated openai logging
2025-11-01 22:33:35 +05:30
Magnus Müller
9caa248316
Merge code7 branch changes
2025-10-21 18:55:54 -07:00
Magnus Müller
df80c01cce
Refactor reasoning_models initialization in ChatOpenAI class
...
Changed the initialization of reasoning_models to use a default factory with field(), enhancing clarity and maintainability of the code.
2025-09-07 22:26:16 -07:00
Magnus Müller
9e5ab89b67
Refine reasoning_models check in ChatOpenAI class
...
Updated the condition for checking reasoning_models to ensure it only evaluates if reasoning_models is not empty, improving code robustness.
2025-09-07 22:16:13 -07:00
Magnus Müller
2b0045feff
make reasoning_models a parameter
2025-09-07 22:15:13 -07:00
Magnus Müller
e169412be3
increase-frequency-penalty
2025-08-31 19:01:50 -07:00
Magnus Müller
37c177e840
reduce frequency_penalty
2025-08-31 14:19:39 -07:00
Magnus Müller
6522d2a4f1
Update comment
2025-08-19 18:10:52 -07:00
Magnus Müller
43e927b0a8
temperature: float | None = 0.2
...
frequency_penalty: float | None = 0.3
2025-08-19 17:50:28 -07:00
Magnus Müller
8f370ec6a8
Increase frequency_penalty and reset timeouts
2025-08-19 17:33:29 -07:00
Magnus Müller
d583540491
max tokens openai to 4k
2025-08-19 11:12:03 -07:00
Magnus Müller
be402700b5
fix-llm-timeout-errors
2025-08-19 09:58:55 -07:00
Magnus Müller
bc32e2efaf
Merge branch 'main' into hot-fix/reasoning-models
2025-08-09 12:43:06 -07:00
Magnus Müller
e65492b3f0
More robust check
2025-08-09 12:33:43 -07:00
Mert Unsal
d197fbe7e4
Update browser_use/llm/openai/chat.py
...
we can also remove this so that it uses default
2025-08-09 20:25:39 +01:00
Magnus Müller
4bc22fb84e
Remove frequency_penalty parameter from model_params in ChatOpenAI class to streamline configuration
2025-08-09 12:12:37 -07:00
Magnus Müller
74050c8843
Update temperature and frequency_penalty parameters in ChatOpenAI class for improved model performance
2025-08-09 11:59:33 -07:00
Magnus Müller
4430288516
Set frequency_penalty to 0.05
2025-08-09 11:39:26 -07:00
Mert Unsal
270dd9dc5a
Merge branch 'main' into mert/custom_model
2025-08-08 10:33:49 +01:00
Gregor Žunič
7f0490b359
fixed pre-commit format
2025-08-07 14:51:05 -07:00
Cursor Agent
e6706902a2
Update ReasoningModels with new GPT-5 model variants
...
Co-authored-by: mailmertunsal <mailmertunsal@gmail.com >
2025-08-07 21:39:42 +00:00
mertunsall
b72ced8736
format
2025-08-07 22:17:16 +01:00
AylinAkkus
89322f9008
Merge branch 'main' into mert/custom_model
2025-08-07 20:57:19 +00:00
AylinAkkus
c5ece47301
stabilize
2025-08-07 20:56:17 +00:00
AylinAkkus
e523544eec
remove some stuff
2025-08-07 20:47:23 +00:00
Mert Unsal
a7aea8f7a5
Merge branch 'main' into mert/no_freq_penalty
2025-08-07 21:21:54 +01:00
mertunsall
759c33142a
by default freq penalty should be None since gpt-5 doesnt allow it
2025-08-07 21:21:31 +01:00
mertunsall
bc99294d0a
bump openai and fix new types for tool calling
2025-08-07 19:53:05 +01:00
mertunsall
2ce156d69e
Merge branch 'main' into mert/custom_model
2025-08-04 20:31:38 +01:00
Sophia Willows
212be3248b
Support specifying OpenAI service_tier param
2025-07-30 07:50:33 +12:00
Matic Zavadlal
63cb5613a5
commit
2025-07-22 18:50:17 +02:00
Mert Unsal
a5bc83f766
Revert "add init to make things library"
2025-07-20 23:57:53 +02:00
Mert Unsal
b0486a7e23
Merge branch 'main' into mert/fix_lazy_imports
2025-07-20 23:56:34 +02:00
mertunsall
f901a6931f
add init to make things library
2025-07-20 23:55:25 +02:00
Magnus Müller
d695a56923
fix temperature for reasoning models
2025-07-20 23:53:00 +02:00
Magnus Müller
d9e6348a67
Include frequency_penalty 0.05
2025-07-20 23:11:23 +02:00
Magnus Müller
5b13195f56
Increase default temperature to 0.2 to avoid infinite generation
2025-07-20 16:24:41 +02:00
mertunsall
f993349588
first attempt at our own models
2025-07-20 15:55:04 +02:00
Magnus Müller
6285bfeca0
Enable max tokens for openai and top_p
2025-07-19 19:36:49 +02:00
Tom Mahler
4525153d24
refactor reasoning_effort_dict to model_params for a more appropriate name
2025-07-17 10:58:09 +03:00