fix: remove redundant type field from web_search tool schema#1116
Open
octo-patch wants to merge 1 commit intoItzCrazyKns:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1010
Problem
The
web_searchaction schema included a redundanttype: z.literal('web_search')field. When this schema is serialised to JSON Schema (viaz.toJSONSchema), the resulting object requires the LLM to include{"type": "web_search", "queries": [...]}in its tool call arguments — even though the function name already identifies which tool is being called.Some Ollama-hosted models that support tool use (e.g. LFM2) do not include this superfluous
typefield in their generated tool call arguments. When Ollama validates the arguments against the schema, the call fails silently. The researcher loop then sees zero tool calls after the first iteration, breaks immediately, and the writer generates a response with no search context. This explains the symptoms reported in #1010:The same underlying schema issue was also identified for Groq providers (#980).
Solution
Remove the
type: z.literal('web_search')field fromactionSchema. Theexecutehandler never readsinput.type— it only accessesinput.queries— so this is a safe, non-breaking change. The resulting schema is simpler and compatible with a wider range of models.Testing
npx tsc --noEmit)web_searchtool calls and receive proper search resultsSummary by cubic
Remove the redundant type field from the
web_searchaction schema to stop tool-call validation failures with some models. This restores researcher tool calls so brainstorming completes and sources/citations appear.type: z.literal('web_search')fromactionSchema; schema now only requiresqueries.Written for commit e6ee0e6. Summary will update on new commits.