Skip to content

fix(llm): stop putting format/stream inside Ollama options - #5561

Merged
MagMueller merged 2 commits into
browser-use:mainfrom
official-burak:fix/5017-ollama-options-json
Aug 27, 2026
Merged

MagMueller merged 2 commits into
browser-use:mainfrom
official-burak:fix/5017-ollama-options-json

Conversation

@official-burak

@official-burak official-burak commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #5017.

Test plan

  • uv run pytest tests/ci/models/test_llm_ollama.py -q failed on main, then passed after the change
  • CI tests / lint on this PR

Summary by cubic

Fixes #5017 by stopping format and stream from being passed inside Ollama ollama_options; they are top-level chat() parameters and caused structured output to break.

  • Moves think, logprobs, top_logprobs, and keep_alive to top-level chat() parameters as well.
  • Strips markdown JSON fences that Ollama vision models often wrap around responses before parsing.
  • Surfaces invalid JSON as a ModelProviderError instead of a raw validation error.
  • Adds unit tests covering option splitting, fence handling, and truncated JSON.

Written for commit ed5f467. Summary will update on new commits.

Review in cubic

@CLAassistant

CLAassistant commented Aug 27, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread browser_use/llm/ollama/chat.py Resolved
Comment thread browser_use/llm/ollama/chat.py Resolved
official-burak and others added 2 commits August 27, 2026 12:20
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.
@MagMueller
MagMueller force-pushed the fix/5017-ollama-options-json branch from f497aa3 to ed5f467 Compare August 27, 2026 19:27
@MagMueller
MagMueller merged commit d58591c into browser-use:main Aug 27, 2026
110 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Invalid Json error in browser-use while using ollama vision models, I have used upto 27B paramete models.

3 participants