[PR #21383] [CLOSED] fix: respect WEB_SEARCH_RESULT_COUNT in native search_web tool #41690

Closed
opened 2026-04-25 13:52:15 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/21383
Author: @goncaloalves
Created: 2/13/2026
Status: Closed

Base: mainHead: fix-web-search-result-count


📝 Commits (1)

  • 7b4fa58 fix: respect WEB_SEARCH_RESULT_COUNT in native search_web tool

📊 Changes

1 file changed (+0 additions, -5 deletions)

View changed files

📝 backend/open_webui/tools/builtin.py (+0 -5)

📄 Description

Summary

Fixes #21371

The built-in search_web tool was ignoring the admin WEB_SEARCH_RESULT_COUNT setting because it had a hardcoded count=5 default and then re-truncated results.

Root Cause

async def search_web(
    query: str,
    count: int = 5,  # ← hardcoded default, ignores admin setting
    ...
) -> str:
    ...
    results = results[:count]  # ← re-truncates to 5

The backend _search_web() function correctly uses WEB_SEARCH_RESULT_COUNT from admin settings, but search_web() in builtin.py was silently discarding extra results.

Fix

  • Removed the count parameter from search_web() function signature
  • Removed the secondary results[:count] truncation
  • The backend already respects the admin setting, so no additional limiting is needed

Testing

  • Syntax validation via ast.parse() - OK
  • No other code references the count parameter

Impact

  • Users who set WEB_SEARCH_RESULT_COUNT=10 will now get 10 results instead of 5
  • No breaking changes - the tool still returns JSON search results
  • Only affects Native Function Calling mode (built-in tools)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/21383 **Author:** [@goncaloalves](https://github.com/goncaloalves) **Created:** 2/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-web-search-result-count` --- ### 📝 Commits (1) - [`7b4fa58`](https://github.com/open-webui/open-webui/commit/7b4fa5843ffc4ceb595fbf0ad1df7726c063cb40) fix: respect WEB_SEARCH_RESULT_COUNT in native search_web tool ### 📊 Changes **1 file changed** (+0 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/tools/builtin.py` (+0 -5) </details> ### 📄 Description ## Summary Fixes #21371 The built-in `search_web` tool was ignoring the admin `WEB_SEARCH_RESULT_COUNT` setting because it had a hardcoded `count=5` default and then re-truncated results. ## Root Cause ```python async def search_web( query: str, count: int = 5, # ← hardcoded default, ignores admin setting ... ) -> str: ... results = results[:count] # ← re-truncates to 5 ``` The backend `_search_web()` function correctly uses `WEB_SEARCH_RESULT_COUNT` from admin settings, but `search_web()` in `builtin.py` was silently discarding extra results. ## Fix - Removed the `count` parameter from `search_web()` function signature - Removed the secondary `results[:count]` truncation - The backend already respects the admin setting, so no additional limiting is needed ## Testing - [x] Syntax validation via `ast.parse()` - OK - [x] No other code references the `count` parameter ## Impact - Users who set `WEB_SEARCH_RESULT_COUNT=10` will now get 10 results instead of 5 - No breaking changes - the tool still returns JSON search results - Only affects Native Function Calling mode (built-in tools) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 13:52:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#41690