Commit Graph

78 Commits

Author SHA1 Message Date
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
Mark McDonald 90783e69b4 fix: set default temperature to 1.0 for gemini-3 models 2026-03-23 14:13:08 +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 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
Saurav Panda 49882fb086 added gemini-3-pro-preview to verified models 2025-12-09 13:38:34 -08:00
Mert Unsal 4d87e49e1f Merge branch 'main' into mert/structured_output 2025-11-25 13:43:55 -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
Magnus Müller af649d357a Retry 503 errors 2025-10-29 23:04:58 -07:00
Magnus Müller b27d7fe9d2 Retry 503 errors 2025-10-29 23:02:06 -07:00
Magnus Müller 9715c4e764 Linter 2025-10-29 17:14:45 -07:00
Magnus Müller 577c1ff148 Retry google on 403 error. 2025-10-29 16:51:32 -07:00
Magnus Müller 9caa248316 Merge code7 branch changes 2025-10-21 18:55:54 -07:00
Magnus Müller 98995449c2 reduce max_output_tokens gemini 2025-10-14 14:31:57 -07:00
Magnus Müller 3aaafa7bf8 Remove required from prompt 2025-10-05 20:30:36 -07:00
Magnus Müller a3a811e3be Remove create_gemini_optimized_schema 2025-10-05 19:03:10 -07:00
Magnus Müller 968414b982 Compress gemini schema 2025-10-05 12:48:25 -07:00
Magnus Müller a8e6af254e Switch all to jpeg 2025-10-03 21:32:47 -07:00
Magnus Müller 781f948bb8 change gemini 2.5 flash to gemini latest 2025-09-26 15:54:19 -07:00
Magnus Müller 6c7b5cd622 fix-gemini-thinking-budget-for-latest-lite-version 2025-09-26 12:09:03 -07:00
Magnus Müller 6d77cc6bb9 fix-gemini-thinking-budget-for-latest-version 2025-09-26 11:53:58 -07:00
Magnus Müller db27b32b04 fix gemini client 2025-09-26 09:50:01 -07:00
Magnus Müller cf0ad68b4c Merge branch 'speed-ups3' of https://github.com/browser-use/browser-use into speed-ups3 2025-09-22 18:37:59 -07:00
Magnus Müller 343b766b09 Comment 2025-09-22 18:37:57 -07:00
Magnus Müller c8e00e4511 Update browser_use/llm/google/chat.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-09-22 18:35:26 -07:00
Magnus Müller 5d749793ec Refactor model timeout logic and enhance ModelProviderError initialization 2025-09-22 16:02:03 -07:00
Magnus Müller d5ba9008b7 Update thinking_budget default value to 0 for flash and flash-lite models 2025-09-22 14:50:24 -07:00
Magnus Müller aa56461dbc Update thinking_budget default value to -1 for specific model 2025-09-20 07:23:17 -07:00
Magnus Müller 545dc86295 Include thinking_budget 0 2025-09-19 23:40:32 -07:00
Magnus Müller 13a83b7321 Include thinking_budget 600 2025-09-19 23:22:56 -07:00
Magnus Müller 382bbd45fc Include thinking_budget -1 2025-09-19 23:14:28 -07:00
Magnus Müller 653fa4206f Automaticlly set reasoning budget to 0 for 2.5 flash, because we do it with thinking for memory 2025-09-19 22:21:37 -07:00
Magnus Müller fbcde93cad Force no thinking 2025-09-19 19:40:33 -07:00
Magnus Müller af1fe232f1 Forse thinking -1 2025-09-19 19:39:18 -07:00
Magnus Müller 7e2d4de32c Timing 2025-09-19 19:36:53 -07:00
Magnus Müller 0aa3163693 Include response in parsing 2025-09-19 19:21:48 -07:00
Magnus Müller b72dea7972 Improve error logging in ChatGoogle class by including response details in the error message when no response is received from the model. 2025-09-19 19:15:44 -07:00
Magnus Müller 819aa77838 Update thinking_budget handling in ChatGoogle class to use dynamic value 2025-09-19 19:14:21 -07:00