Skip to content

fix(openaimodel): refuse non-function Tool fields genai adds - #1983

Merged
wolo-lab merged 8 commits into
google:mainfrom
mangeshraut712:tip-1982-function-tool-only
Nov 5, 2026
Merged

wolo-lab merged 8 commits into
google:mainfrom
mangeshraut712:tip-1982-function-tool-only

Conversation

@mangeshraut712

Copy link
Copy Markdown
Contributor

Summary

EnsureFunctionToolOnly refused non-function tools via a fixed denylist of eight genai.Tool fields. genai v1.75.0 also has FileSearch, ParallelAISearch, MCPServers, and ExaAISearch. When one of those was set beside FunctionDeclarations, the converters sent the functions and dropped the other tool with no error.

Invert the check with rejectUnsupportedFields so only FunctionDeclarations is accepted. New genai fields are refused the same way.

Fixes #1982

Test plan

  • go test ./model/openaimodel/internal/shared/ -count=1
  • Cases for FileSearch / ParallelAISearch / MCPServers / ExaAISearch alone and beside FunctionDeclarations

EnsureFunctionToolOnly used a fixed denylist that missed FileSearch,
ParallelAISearch, MCPServers and ExaAISearch, so those tools were dropped
silently when FunctionDeclarations was also set. Invert the check with
rejectUnsupportedFields so only FunctionDeclarations is accepted.

Fixes google#1982
@mangeshraut712

Copy link
Copy Markdown
Contributor Author

CI is green on this one. Ready for review/merge when you have a chance — thanks.

@indurireddy-TF

Copy link
Copy Markdown
Contributor

Hi @mangeshraut712 Thanks for the fix! The allowlist-based validation addresses the issue by preventing unsupported tool fields from being silently dropped. The changes look good to me.
image
image

@baptmont Could you please take a look at these changes?

@wolo-lab wolo-lab 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.

lgtm

@wolo-lab
wolo-lab merged commit 275e190 into google:main Nov 5, 2026
14 checks passed
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.

model/openaimodel: FileSearch, ParallelAISearch, MCPServers and ExaAISearch tools are dropped silently instead of refused

3 participants