Skip to content

[apps] Improve search tool fallback.#14732

Merged
mzeng-openai merged 2 commits intomainfrom
dev/mzeng/search_tool_condition
Mar 16, 2026
Merged

[apps] Improve search tool fallback.#14732
mzeng-openai merged 2 commits intomainfrom
dev/mzeng/search_tool_condition

Conversation

@mzeng-openai
Copy link
Copy Markdown
Collaborator

  • Bypass tool search and stuff tool specs directly into model context when either a. Tool search is not available for the model or b. There are not that many tools to search for.

@mzeng-openai mzeng-openai requested review from apanasenko-oai, pakrym-oai and sayan-oai and removed request for apanasenko-oai March 15, 2026 05:08
let expose_app_tools_directly = !turn_context.tools_config.search_tool
|| app_tools
.as_ref()
.is_some_and(|tools| tools.len() < DIRECT_APP_TOOL_EXPOSURE_THRESHOLD);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if we want to use threshold as way to disable search tool, we need to move it to turn_context.tools_config.search_tool otherwise we will have situation when we have search tool and tools injected into context.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Tool search will not be enabled if app_tools is empty:

&& let Some(app_tools) = app_tools

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ah, I see, I would love this logic be much simpler since it hard to keep in mind all this invariants.

@mzeng-openai mzeng-openai marked this pull request as ready for review March 16, 2026 04:17
@mzeng-openai mzeng-openai merged commit d4af605 into main Mar 16, 2026
35 of 36 checks passed
@mzeng-openai mzeng-openai deleted the dev/mzeng/search_tool_condition branch March 16, 2026 04:41
@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants