Skip to content

feat: provide Modelfile to fix Ollama Web Search structured parsing with Gemma 4 (Fixes #372)#402

Open
Paramveersingh-S wants to merge 2 commits into
google-gemma:mainfrom
Paramveersingh-S:feat/ollama-web-search-fix
Open

feat: provide Modelfile to fix Ollama Web Search structured parsing with Gemma 4 (Fixes #372)#402
Paramveersingh-S wants to merge 2 commits into
google-gemma:mainfrom
Paramveersingh-S:feat/ollama-web-search-fix

Conversation

@Paramveersingh-S

Copy link
Copy Markdown

Description

This PR addresses Issue #372 where Gemma 4 fails to see or recognize web search tool results when running via Ollama.

Gemma 4 relies on a strict formatting structure (<|tool_call|> and <|tool_response|>). When Ollama's default templates omit or strip these tokens during a web search callback, the context is dropped by the model.

Key Changes

  • Added a dedicated apps/Ollama_Gemma4_WebSearch/Modelfile that injects the required structured tags directly into the template.
  • Added a README.md guide for users to build this fixed model (ollama create gemma4-search-fixed -f Modelfile) so they can successfully execute web searches via OpenWebUI/Ollama.

Fixes #372.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gemma 4 breaks when trying to search with Ollama Web Search tool

1 participant