Commit Graph

312 Commits

Author SHA1 Message Date
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
laithrw d15f0a32c7 Merge branch 'main' into fix/3897-llm-response-parsing 2026-02-08 15:43:05 -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
Saurav Panda c011c529fc feat: add bu-2-0 pricing 2026-01-27 10:35:41 -08:00
Saurav Panda 6d54f521cf set default gemini thinking to auto 2026-01-26 12:44:51 -08:00
Saurav Panda bb3b1e8cf5 added minimal model for gemini 3 flash 2026-01-23 15:11:13 -08:00
Saurav Panda 041d03a93f feat: updated the thinking budget 2026-01-23 14:42:59 -08:00
Saurav Panda 5b06f4edd9 set default thinking to 0 for gemini-3 models 2026-01-23 13:44:29 -08:00
Saurav Panda f3aad3c145 Added browser use 2-0 support 2026-01-23 13:17:56 -08:00
Saurav Panda 37586c9e9f Added support for new browser use model 2026-01-23 12:39:10 -08: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
Saurav Panda 221d85744e fix: use correct MIME type for images in Google serializer 2025-12-21 09:45:09 -08:00
Saurav Panda eb2382c7c4 added gemini 3 flash preview model 2025-12-18 11:25:23 -08:00
mertunsall dc0db88215 kv caching for BU agents 2025-12-15 18:23:22 -08:00
mertunsall a58b9307ab BU OSS IS COMING 2025-12-15 14:04:18 -08:00
hacking-racoon 38703d5ad7 perf: lazy import for openai and reportlab to reduce startup latency
- agent/views.py: Move RateLimitError import inside format_error() function
  to avoid loading openai SDK (~800ms) at module level
- llm/messages.py: Replace openai.BaseModel with pydantic.BaseModel directly
  to remove unnecessary openai dependency
- filesystem/file_system.py: Move reportlab imports inside sync_to_disk_sync()
  to avoid ~40ms startup cost when PDF generation is not used
- utils.py: Convert OpenAIBadRequestError and GroqBadRequestError to lazy
  loaders to avoid loading SDKs at module level

This improves import time for users who don't use OpenAI provider,
especially when using Anthropic, Google, or other providers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 01:48:47 +09:00
Saurav Panda 49882fb086 added gemini-3-pro-preview to verified models 2025-12-09 13:38:34 -08:00
Saurav Panda d0e181216e feat: added fallback llm support 2025-12-03 18:53:29 +05:30
Mert Unsal 38b3bb2edd Merge branch 'main' into feature/mistral-support 2025-11-29 14:30:08 -08:00
AntonVishal 5c581c642e Add provider options to ChatVercel for enhanced model routing 2025-11-29 12:27:32 +05:30
MagellaX d58ae80b50 Handle Mistral timeout defaults and fix pixtral mapping 2025-11-28 13:41:36 +05:30
MagellaX 71a1f12037 Format LLM exports after ruff suggestions 2025-11-28 13:32:20 +05:30
MagellaX 93a2bddb9c Fix provider branch ordering in llm models 2025-11-28 13:27:23 +05:30
MagellaX 09a83c97a4 Fix Mistral pyright warnings and schema test 2025-11-28 13:21:19 +05:30
TR-3B 0b82aa7348 Merge branch 'main' into feature/mistral-support 2025-11-28 13:00:24 +05:30
MagellaX 5de9b99567 Add Mistral provider with schema optimizer and presets 2025-11-28 12:56:41 +05:30
Mert Unsal 4d87e49e1f Merge branch 'main' into mert/structured_output 2025-11-25 13:43:55 -08:00
mertunsall 1c9a87b98f Fix more 2025-11-25 13:33:28 -08:00
mertunsall ed7cfa4ab2 fix title problem in schema as well as enum problems 2025-11-25 13:02:39 -08:00
mertunsall 84be050ed7 exponential retries improved 2025-11-25 11:18:03 -08:00
Mert Unsal fd665e01cd Merge branch 'main' into add-vercel-ai-gateway 2025-11-24 11:24:28 -08:00
Pyry Takala 5a3d340ec4 fix: add type ignores for pyright in cache tests
Content blocks are dictionaries at runtime despite type annotations
indicating Pydantic models. Added type: ignore comments to allow
dictionary-style .get() access which works correctly at runtime.
2025-11-21 01:12:56 +00:00
Pyry Takala 3787380829 fix: apply cache_control only to last block in Anthropic messages
Previously, cache_control was applied to every content block and tool call
in a message, which could exceed Anthropic's limit of 4 cache breakpoints
per request. This fix ensures cache_control is only applied to the last
block in each message type:
- Last text block in UserMessage/AssistantMessage content
- Last tool_use block when AssistantMessage has tool calls
- Only the last overall block when AssistantMessage has both content and tools

This prevents exceeding the cache breakpoint limit while maintaining
correct caching behavior.
2025-11-21 01:04:12 +00:00
Saurav Panda 0263f05a7e Merge branch 'main' into fix/openai-reasoning-model-keyerror 2025-11-19 21:48:46 -08:00
Magnus Müller 1f6d606fac Linter 2025-11-15 10:11:55 -08:00
Magnus Müller 51ba3422c3 disable telemetry logs for chatbrowseruse 2025-11-15 10:11:08 -08:00
LarsenCundric d251105e64 Add http_client to Anthropic Chat 2025-11-12 17:58:38 -08:00
Yangong cc2e4d800c fix: fix link in llm's readme 2025-11-12 11:46:23 +00:00
Yangong 84549433c9 fix: fix link in llm's readme 2025-11-12 11:40:58 +00:00
kalil0321 ff1db95889 Merge branch 'main' into add-vercel-ai-gateway 2025-11-07 01:33:46 +01:00
mertunsall 67d2f12665 default to PNG everywhere 2025-11-06 14:51:52 -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
Matt Greathouse 38d102c90d Merge branch 'main' into fix-gemini-schema 2025-11-02 07:39:10 -05:00
Matt Greathouse 663299629d Merge branch 'main' into fix-gemini-schema 2025-11-01 19:23:49 -04:00
Alezander9 bf15d159da address cubic comments and clean up new example 2025-11-01 15:37:38 -07:00
Alezander9 f1b0473645 Merge remote-tracking branch 'upstream/main' into library-judge 2025-11-01 15:25:55 -07:00
Alezander9 4396b416da pass along a new param request_type when using ChatBrowserUse to flag special handling for judge 2025-11-01 15:25:24 -07:00