mirror of
https://github.com/browser-use/browser-use.git
synced 2026-09-14 19:59:47 +08:00
df063f9068
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.