[GH-ISSUE #12830] issue: BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL leads to exceeding context window limit #16726

Closed
opened 2026-04-19 22:35:31 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @harrywang on GitHub (Apr 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12830

Check Existing Issues

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

Installation Method

Git Clone

Open WebUI Version

0.6.4

Ollama Version (if applicable)

No response

Operating System

Ubuntu 22.04

Browser (if applicable)

No response

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

When enable BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL, all search results are combined and attached as the context for the chat. It should be truncated or better managed to make sure it does not exceed the chosen model's context length.

Actual Behavior

It leads to the following error.
Image

Steps to Reproduce

Enable web search and BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL, set a large search result count, say, 5, should reproduce the error.

Logs & Screenshots

See above.

Additional Information

No response

Originally created by @harrywang on GitHub (Apr 14, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/12830 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version 0.6.4 ### Ollama Version (if applicable) _No response_ ### Operating System Ubuntu 22.04 ### Browser (if applicable) _No response_ ### 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 When enable BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL, all search results are combined and attached as the context for the chat. It should be truncated or better managed to make sure it does not exceed the chosen model's context length. ### Actual Behavior It leads to the following error. <img width="1816" alt="Image" src="https://github.com/user-attachments/assets/ac4a7a43-4d9f-40b4-88f4-76b85fc6858e" /> ### Steps to Reproduce Enable web search and BYPASS_WEB_SEARCH_EMBEDDING_AND_RETRIEVAL, set a large search result count, say, 5, should reproduce the error. ### Logs & Screenshots See above. ### Additional Information _No response_
GiteaMirror added the bug label 2026-04-19 22:35:31 -05:00
Author
Owner

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

Intended behaviour. Use a model with a larger context length.

<!-- gh-comment-id:2800473703 --> @tjbck commented on GitHub (Apr 14, 2025): Intended behaviour. Use a model with a larger context length.
Author
Owner

@Anaphylaxis commented on GitHub (Apr 14, 2025):

Use a model with a larger context length.

I mean, he's using 128k, the only ones with larger are basically Gemini. The real answer would be to lower the search results from 5, a solution would be the ability to dynamically alter the sources -- checkboxes to enable/disable and ability to edit (truncate manually for example) -- would not only fix this "issue" but completely revamp the web search feature.

<!-- gh-comment-id:2801876309 --> @Anaphylaxis commented on GitHub (Apr 14, 2025): > Use a model with a larger context length. I mean, he's using 128k, the only ones with larger are basically Gemini. The real answer would be to lower the search results from 5, a solution would be the ability to dynamically alter the sources -- checkboxes to enable/disable and ability to edit (truncate manually for example) -- would not only fix this "issue" but completely revamp the web search feature.
Author
Owner

@harrywang commented on GitHub (Apr 14, 2025):

Use a model with a larger context length.

I mean, he's using 128k, the only ones with larger are basically Gemini. The real answer would be to lower the search results from 5, a solution would be the ability to dynamically alter the sources -- checkboxes to enable/disable and ability to edit (truncate manually for example) -- would not only fix this "issue" but completely revamp the web search feature.

@Anaphylaxis thanks, I changed the search results to 2 which will end up with 6 urls (3 queries are auto generated). We may add a function to summarize or truncate the search results.

<!-- gh-comment-id:2801918974 --> @harrywang commented on GitHub (Apr 14, 2025): > > Use a model with a larger context length. > > I mean, he's using 128k, the only ones with larger are basically Gemini. The real answer would be to lower the search results from 5, a solution would be the ability to dynamically alter the sources -- checkboxes to enable/disable and ability to edit (truncate manually for example) -- would not only fix this "issue" but completely revamp the web search feature. @Anaphylaxis thanks, I changed the search results to 2 which will end up with 6 urls (3 queries are auto generated). We may add a function to summarize or truncate the search results.
Author
Owner

@Anaphylaxis commented on GitHub (Apr 14, 2025):

@Anaphylaxis thanks, I changed the search results to 2 which will end up with 6 urls (3 queries are auto generated).

3 queries generated is due to the web search query, if u want to customize it you can change the query under admin settings -> interface -> Query Generation Prompt

<!-- gh-comment-id:2801927933 --> @Anaphylaxis commented on GitHub (Apr 14, 2025): > [@Anaphylaxis](https://github.com/Anaphylaxis) thanks, I changed the search results to 2 which will end up with 6 urls (3 queries are auto generated). 3 queries generated is due to the web search query, if u want to customize it you can change the query under admin settings -> interface -> Query Generation Prompt
Author
Owner

@harrywang commented on GitHub (Apr 14, 2025):

@Anaphylaxis thanks, I changed the search results to 2 which will end up with 6 urls (3 queries are auto generated).

3 queries generated is due to the web search query, if u want to customize it you can change the query under admin settings -> interface -> Query Generation Prompt

Yes. I think the default 3 queries is good.

<!-- gh-comment-id:2801977505 --> @harrywang commented on GitHub (Apr 14, 2025): > > [@Anaphylaxis](https://github.com/Anaphylaxis) thanks, I changed the search results to 2 which will end up with 6 urls (3 queries are auto generated). > > 3 queries generated is due to the web search query, if u want to customize it you can change the query under admin settings -> interface -> Query Generation Prompt Yes. I think the default 3 queries is good.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#16726