issue: v0.6.33 RAG Retrieval Pull All Files for Collection Ignoring top_k #6635

Closed
opened 2025-11-11 17:01:54 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @jamesottera on GitHub (Oct 9, 2025).

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.33

Ollama Version (if applicable)

0.12.3

Operating System

Ubuntu

Browser (if applicable)

Safari Latest

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 provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

During RAG Retrieval, top_k should be limiting the number of files used as source.

Actual Behavior

After update to 0.6.33, RAG Retrieval is no longer using top_k to rerank / filter possible files to use for context in RAG retrieval. Previously, if you set top_k to 5, it would grab up to 5 files in a collection as sources.

Now, it is taking ALL files in the collection. This is a major issue with collections that have a large number of files.

In my case, my collection has 695 markdown files. This is leading to HUGE context bloat (cost) and cases where the context exceed the maximum for the model. This also leads to incorrect answers as it is looking too widely and running out of context limits.

Steps to Reproduce

  1. Start with a clean Ubuntu install
  2. Build Open-WebUI with docker image.
  3. Go to admin settings -> documents and set up ollama and nomic-embed-text for embedding (though the type of embedding doesn't seem to matter) and set the top_k to a small value like 5.
  4. Create a Knowledge collection
  5. Add files
  6. Create a custom model and attach the collection.
  7. Query against the model.
  8. Notice it pulls ALL files in the collection in as source and not just the top_k

Logs & Screenshots

Logs can be provided. I tried pasting but it said it was over the character limits. The log I would show is just showing that:

open_webui.retrieval.utils:get_doc:142 - query_doc:result [[

Is a massive blob referencing 695 files.

Additional Information

No response

Originally created by @jamesottera on GitHub (Oct 9, 2025). ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.33 ### Ollama Version (if applicable) 0.12.3 ### Operating System Ubuntu ### Browser (if applicable) Safari Latest ### 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 **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior During RAG Retrieval, top_k should be limiting the number of files used as source. ### Actual Behavior After update to 0.6.33, RAG Retrieval is no longer using top_k to rerank / filter possible files to use for context in RAG retrieval. Previously, if you set top_k to 5, it would grab up to 5 files in a collection as sources. Now, it is taking ALL files in the collection. This is a major issue with collections that have a large number of files. In my case, my collection has 695 markdown files. This is leading to HUGE context bloat (cost) and cases where the context exceed the maximum for the model. This also leads to incorrect answers as it is looking too widely and running out of context limits. ### Steps to Reproduce 1. Start with a clean Ubuntu install 2. Build Open-WebUI with docker image. 3. Go to admin settings -> documents and set up ollama and nomic-embed-text for embedding (though the type of embedding doesn't seem to matter) and set the top_k to a small value like 5. 3. Create a Knowledge collection 4. Add files 5. Create a custom model and attach the collection. 6. Query against the model. 7. Notice it pulls ALL files in the collection in as source and not just the top_k ### Logs & Screenshots Logs can be provided. I tried pasting but it said it was over the character limits. The log I would show is just showing that: open_webui.retrieval.utils:get_doc:142 - query_doc:result [[ Is a massive blob referencing 695 files. ### Additional Information _No response_
GiteaMirror added the bug label 2025-11-11 17:01:54 -06:00
Author
Owner

@silentoplayz commented on GitHub (Oct 9, 2025):

Related - https://github.com/open-webui/open-webui/issues/18133

@silentoplayz commented on GitHub (Oct 9, 2025): Related - https://github.com/open-webui/open-webui/issues/18133
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#6635