Ollama treats those as top-level chat() parameters. Forwarding them in ollama_options broke structured JSON from vision models, which is the failure in #5017.
0.13.8 shipped bu-2-0-mini-preview as the ChatBrowserUse default, which
means Agent(task=...) with no llm - and every bare ChatBrowserUse() -
silently moved onto a preview model on upgrade, with no code change on
the caller's side.
Two problems with that. A preview id can change behaviour or be renamed,
so it is the wrong thing to reach by omission. And per-token price is the
wrong yardstick for an agent: total cost is tokens-per-step times steps,
and steps is a function of model quality, so a cheaper-per-token model
that needs more steps to finish can cost more and take longer. We do not
yet have a per-task benchmark number for mini to say which way that goes.
bu-2-0-mini-preview stays a first-class option: still accepted, still
priced, still what the examples demonstrate. It is just opted into by
name now rather than landed on by default. Revisit once the benchmark
number exists.
The shortcut test called get_llm_by_name directly, which bypasses the
module __getattr__ and __all__ that the shortcut actually goes through -
so dropping the name from __all__ would not have failed anything.
bu-1-0 is redirected to bu-2-0 at the gateway, so requests naming it are
served and billed as bu-2-0. The pricing table still carried the retired
bu-1-0 rates, which under-reported cost by 3x on input and 3x on cached
reads for anyone still passing that id.
Aliases it to the bu-2-0 entry rather than duplicating the numbers, same
as bu-latest, so the three cannot drift apart.
Adds bu-2-0-mini-preview as an accepted model id and makes it the
constructor default, so a bare ChatBrowserUse() now routes there.
bu-2-0 is unchanged: still accepted, still documented as the premium
option, and bu-latest still resolves to it. Keeping 'latest' on the
stable line means existing callers pinned to that alias do not silently
move onto a preview model; only the bare-constructor default moves.
Pricing is registered alongside the model so cost tracking does not
silently report $0 for what is now the default. This model has no cache
discount, so cached reads bill at the input rate.
Examples, README and the model reference are updated to the new default.
The model reference also claimed bu-latest resolved to bu-1-0, which has
not been true since bu-2-0 shipped; corrected here.
The structured-output guards raise ModelProviderError with status_code=500,
but ainvoke's final `except Exception` re-wrapped them with the default 502
and a stringified message. Let our own ModelProviderError through unchanged so
the status code and message reported to callers stay accurate. This also fixes
the pre-existing 'No content in response' guard on the JSON-schema path.
_invoke_structured_output branches to _invoke_with_tool_calling for models in
ToolCallingModels, which sends tool_choice='required'. Groq then returns the
payload in tool_calls[0].function.arguments and leaves message.content empty,
but the content guard ran for both branches, so structured output raised
ModelProviderError('No content in response') for every tool-calling model.
Parse the payload from the tool call on that branch, mirroring the deepseek
provider, and keep the content guard on the JSON-schema branch. An empty
tool_calls list now reports a provider error rather than reading content that
is never populated.
Fixes#4945
ainvoke() unconditionally indexes response.content[0] to extract the reply
text. Bedrock can legitimately return an empty content list for certain
stop-reason edge cases (e.g. the turn ends before any content block is
produced) -- when that happens, this raises IndexError, which the
surrounding try/except then re-raises as an opaque ModelProviderError,
crashing the caller instead of returning empty text.
The sibling direct-Anthropic implementation (browser_use/llm/anthropic/
chat.py's _extract_content_blocks) already guards this exact case with
`elif response.content: ... else: completion = ''` -- strong evidence this
is a real, previously-encountered scenario for the underlying Claude
message API, just missing from the Bedrock-transport variant of the same
contract.
Fix: mirror the sibling's guard -- only index into response.content when
it's non-empty, otherwise fall back to an empty string.
Added tests/ci/models/test_chat_anthropic_bedrock_empty_content.py, which
constructs a real anthropic.types.Message with content=[] (no mocking of
the SDK's own types, only the network-boundary client per this repo's
"mock only the LLM" testing convention) and confirms ainvoke() returns an
empty completion instead of raising. Confirmed red -> green: reverting only
the source change reproduces `ModelProviderError: list index out of range`;
reapplying passes.
ruff check / ruff format / pyright: clean.
xref: open PR #5053 also touches this file, but a different function
entirely (_get_usage's total_tokens calculation, ~line 152) -- no overlap
with this change (ainvoke's content extraction, ~line 187).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Gemini 3+ models may throw errors if a default value is set for
parameters like temperature, top-p, etc.
The 3-series models use 1.0 as the default temperature, so this
should be a backwards-compatible change.
Anthropic retired Claude Sonnet 4 (claude-sonnet-4-0 /
claude-sonnet-4-20250514) on 2026-06-15. The live-API model test in
tests/ci/models/test_llm_anthropic.py pinned that alias, so every CI run
now gets a 404 not_found_error and the agent never completes the task,
failing the models/test_llm_anthropic job on all branches.
Bump the test to the current GA Sonnet (claude-sonnet-4-6).
Drop the bu-3 and bu-3-max model ids everywhere they were surfaced:
- ChatBrowserUse no longer lists them as valid bu-* aliases (provider-prefixed
ids like openai/gpt-5.5 are still accepted by the gateway).
- Remove their custom pricing entries and the README pricing blocks.
- Update docstrings, README quickstart, and the beta_agent example to use
openai/gpt-5.5 as the default, with bu-2-0 shown as a commented alternative.
- Drop the tests that asserted bu-3/bu-3-max acceptance and pricing.
ChatBrowserUse now accepts provider-prefixed model ids (anthropic/*,
openai/*, google/*) alongside the bu-* aliases and browser-use/* models,
so a single BROWSER_USE_API_KEY can reach them. bu-* aliases and the
bu-latest -> bu-2-0 normalization are unchanged; bare ids are rejected
with guidance toward the provider/model form.
Also matches provider-prefixed Claude Sonnet ids in the Agent
llm_screenshot_size auto-config, so the screenshot optimization isn't
lost when Claude is reached via ChatBrowserUse.
Adds an example, a README FAQ entry, and tests.
ENG-5060
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.
- 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