Commit Graph

334 Commits

Author SHA1 Message Date
Magnus Müller 1474c60da1 Merge remote-tracking branch 'upstream/main' into magnus/browser-use-rust-core-integration
# Conflicts:
#	browser_use/__init__.py
#	browser_use/agent/service.py
#	browser_use/browser/watchdogs/downloads_watchdog.py
#	browser_use/code_use/utils.py
#	browser_use/llm/models.py
#	browser_use/tokens/service.py
#	browser_use/utils.py
2026-06-04 16:14:57 +00:00
Magnus Müller 9c9fa4d722 Resolve Anthropic default LLM names 2026-06-03 17:00:36 +00:00
MagMueller 22939a2580 Revert "feat(llm/google): forward cached_content into generate_content (#4889)"
This reverts commit 5a745a8502, reversing
changes made to 640360e9b7.
2026-05-23 12:03:38 -07:00
Saurav Panda df063f9068 feat(llm/google): forward cached_content into generate_content
Adds a cached_content field on ChatGoogle (and a per-call kwarg on
ainvoke) that gets threaded into the GenerateContentConfigDict before
each generate_content call. This lets callers point Gemini at an
explicit CachedContent resource (e.g. "cachedContents/abc123") instead
of relying on implicit caching, which is constrained by the ~5-minute
TTL window.

Token accounting already pulls cached_content_token_count from
response.usage_metadata into ChatInvokeUsage.prompt_cached_tokens, so
the savings show up in usage stats without further work.

Cache creation itself (client.caches.create) is left to the caller —
this PR only adds the forwarding hook so explicit caching becomes
opt-in usable. A follow-up can wire agent-side cache lifecycle if
useful.
2026-05-22 17:54:04 -07:00
Saurav Panda 5ef0d9dbac feat(llm/google): add gemini-3.1-pro-preview to verified models
Routes through the existing Gemini 3 Pro thinking branch by extending
is_gemini_3_pro to match 'gemini-3.1-pro' alongside 'gemini-3-pro'.
2026-05-22 11:48:10 -07:00
Saurav Panda 9e8dfdd18f fix(llm/google): route gemini-3.1-flash through gemini-3 flash thinking branch 2026-05-22 10:50:35 -07:00
Saurav Panda 5c54ef4197 chore(llm): rename flash-lite recommendation to gemini-3.1-flash-lite 2026-05-22 10:49:12 -07:00
Saurav Panda b00c41b66b chore(llm): recommend gemini-3-flash-preview in examples and tests
- add gemini-3-flash-preview-lite to VerifiedGeminiModels and token mappings
- list both gemini-3-flash-preview[-lite] alongside existing -latest aliases in CLOUD.md and api-v2.md SupportedLLMs
- swap example code and recommendations (examples/, AGENTS.md, quickstart.md, bug report placeholder) to gemini-3-flash-preview / -lite
- update Google CI test + evaluate_tasks judge LLM to gemini-3-flash-preview / -lite
2026-05-22 10:47:58 -07:00
Mark McDonald 115199d2ba fix: handle types.HttpOptionsDict better, add more tests 2026-05-22 14:30:40 +08:00
Mark McDonald 2eb3e3cded feat: add client header to GoogleChat
Added header per integration
[guidelines](https://ai.google.dev/gemini-api/docs/partner-integration).
2026-05-22 14:20:24 +08:00
Saurav Panda 02daa7d80d chore(llm): default ChatBrowserUse to bu-2-0
Make bu-2-0 the default model and point bu-latest at it (was bu-1-0).
Pricing alias for bu-latest now tracks bu-2-0 too.
2026-05-20 12:05:04 -07:00
Will-hxw c4f712b90b fix(schema): remove unreachable 'type' from validation fields list
The 'type' key is already handled by an earlier elif branch
(elif key == 'type'), making its presence in the later elif key in [...]
block dead code. Remove it to eliminate confusion.

Fixes #4703
2026-04-23 21:59:48 +08:00
Alezander9 76569995fd Improve OSS-to-cloud conversion: UTM tracking, better error messages, and cloud nudges
- Add UTM params to all cloud-bound links across README, CLI, and error messages
- Rewrite README Open Source vs Cloud section: position cloud browsers as
  recommended pairing for OSS users, remove separate Use Both section
- Rewrite error messages for use_cloud=True and ChatBrowserUse() to clearly
  state what is wrong and what to do next
- Add missing URLs: invalid API key now links to key page, insufficient
  credits now links to billing page
- Add cloud browser nudge on captcha detection (logger.warning)
- Add cloud browser nudge on local browser launch failure
2026-04-08 22:05:50 -07:00
Laith Weinberger 69c7df060f use just raise to preserve traceback in anthropic fallback 2026-03-25 19:16:50 -04:00
Laith Weinberger 8e8ab73575 fix anthropic action field double-serialization 2026-03-25 19:12:56 -04:00
Laith Weinberger d897ffbd4c fix bedrock structured output w SchemaOptimizer to flatten schema 2026-03-25 15:48:12 -04:00
Mark McDonald c657ba72c3 Merge branch 'main' into fix-gemini-3-temperature 2026-03-25 11:57:43 +08:00
Magnus Müller d4b9e30188 Remove litellm from dependencies (supply chain attack CVE)
litellm versions 1.82.7 and 1.82.8 were backdoored on March 24, 2026
by TeamPCP via a compromised Trivy CI/CD pipeline. browser-use 0.12.3
shipped litellm>=1.82.2 (unpinned) as a core dependency, exposing
~6,900 users to the backdoored versions during the 4-hour window.

This commit:
- Removes litellm entirely from pyproject.toml (core and optional)
- Keeps ChatLiteLLM wrapper intact with a docstring noting
  `pip install litellm` is required separately
- litellm is already lazy-imported inside methods, so users who
  don't use ChatLiteLLM are never affected

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:29:44 -07:00
Mark McDonald 90783e69b4 fix: set default temperature to 1.0 for gemini-3 models 2026-03-23 14:13:08 +08:00
STJ 90cb6e8b7d add litellm 2026-03-16 13:30:29 -07:00
Laith Weinberger c9efcb1404 fix vercel gateway: correct extra_body paths, model list, and reasoning_models 2026-03-12 22:22:22 -04:00
AntonVishal 54d9173324 Enhance ChatVercel model support and update API key handling 2026-03-04 15:43:36 +05:30
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