[GH-ISSUE #13190] issue: Unexpected query generation when attaching documents #32366

Closed
opened 2026-04-25 06:16:26 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @YorhaL on GitHub (Apr 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/13190

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.5

Ollama Version (if applicable)

No response

Operating System

macOS 15

Browser (if applicable)

Chrome

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

Unexpected search queries are not generated

Actual Behavior

An API call to generate search queries was unexpectedly made even when "Web Search" was disabled and "Bypass Embedding and Retrieval" was enabled

Steps to Reproduce

  1. Enable Settings -> Documents -> Bypass Embedding and Retrieval
  2. Enable Settings -> WebSearch -> Bypass Embedding and Retrieval
  3. New chat, use # to load a web page, Web Search was not enabled
  4. After sending a question and observing the API calls, it was found that search queries were unexpectedly generated. Furthermore, this unexpected search query generation occurs with every subsequent question asked in the conversation

Logs & Screenshots

Image Image

Additional Information

No response

Originally created by @YorhaL on GitHub (Apr 24, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/13190 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.5 ### Ollama Version (if applicable) _No response_ ### Operating System macOS 15 ### Browser (if applicable) Chrome ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior Unexpected search queries are not generated ### Actual Behavior An API call to generate search queries was unexpectedly made even when "Web Search" was disabled and "Bypass Embedding and Retrieval" was enabled ### Steps to Reproduce 1. Enable `Settings -> Documents -> Bypass Embedding and Retrieval` 2. Enable `Settings -> WebSearch -> Bypass Embedding and Retrieval` 3. New chat, use # to load a web page, Web Search was not enabled 4. After sending a question and observing the API calls, it was found that search queries were unexpectedly generated. Furthermore, this unexpected search query generation occurs with every subsequent question asked in the conversation ### Logs & Screenshots <img width="833" alt="Image" src="https://github.com/user-attachments/assets/be4eaa49-a829-417d-9e5b-e4f2203548ea" /> <img width="1147" alt="Image" src="https://github.com/user-attachments/assets/5b2fed36-b5cb-4d3a-b9fb-98240df2c438" /> ### Additional Information _No response_
GiteaMirror added the bug label 2026-04-25 06:16:26 -05:00
Author
Owner

@tth37 commented on GitHub (Apr 24, 2025):

I've identified and reproduced the issue: whenever files are attached to the request -- whether they are web search results, uploaded documents, or other types -- the generate_queries handler is consistently triggered.

However, in your case, since BYPASS_EMBEDDING_AND_RETRIEVAL is enabled, the queries are ignored during further processing in get_sources_from_files. As a result, the generate_queries process becomes unnecessary and can be safely bypassed.

0b5514f376/backend/open_webui/utils/middleware.py (L575-L639)

A potential solution is to introduce an if-else condition before invoking generate_queries.

<!-- gh-comment-id:2826670867 --> @tth37 commented on GitHub (Apr 24, 2025): I've identified and reproduced the issue: whenever files are attached to the request -- whether they are web search results, uploaded documents, or other types -- the `generate_queries` handler is consistently triggered. However, in your case, since `BYPASS_EMBEDDING_AND_RETRIEVAL` is enabled, the queries are ignored during further processing in `get_sources_from_files`. As a result, the `generate_queries` process becomes unnecessary and can be safely bypassed. https://github.com/open-webui/open-webui/blob/0b5514f376a04bc521139dd53d3e43ab1d321621/backend/open_webui/utils/middleware.py#L575-L639 A potential solution is to introduce an `if-else` condition before invoking `generate_queries`.
Author
Owner

@tjbck commented on GitHub (Apr 28, 2025):

This is a lot trickier than just adding if-else conditions, the user may include multiple files alongside web search and have Bypass Embedding and Retrieval enabled for one and not for the other. You should disable query generation instead from the Admin Settings > Interface.

<!-- gh-comment-id:2835164449 --> @tjbck commented on GitHub (Apr 28, 2025): This is a lot trickier than just adding `if-else` conditions, the user may include multiple files alongside web search and have `Bypass Embedding and Retrieval` enabled for one and not for the other. You should disable query generation instead from the Admin Settings > Interface.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#32366