[GH-ISSUE #3556] Add switch to disable RAG on attachments. #116617

Closed
opened 2026-05-20 18:22:57 -05:00 by GiteaMirror · 14 comments
Owner

Originally created by @nickovs on GitHub (Jun 30, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/3556

Currently if you drop even a single document onto Open WebUI and ask a question about that document, it appears that RAG is always used. It would be helpful to be able to switch this off.

Currently, for each attachment the document text is extracted, the text is chunked, embeddings computed and indexed, an index lookup is performed and then some of the chunks are passed to the LLM. While this is an OK solution for retrieval tasks, it abjectly fails for summarisation tasks.

For LLMs with small context windows summarisation is hard, but many LLMs now support very large context windows; GPT-4o has a 128K context windows and Anthropic Claude 3 support 200K tokens or about 400 pages of text. To make best use of these longer-context models it would be helpful to be able to pass the entire extracted text of all attachments into the LLM. Having a switch to bypass the RAG steps would achieve this.

Originally created by @nickovs on GitHub (Jun 30, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/3556 Currently if you drop even a single document onto Open WebUI and ask a question about that document, it appears that RAG is always used. It would be helpful to be able to switch this off. Currently, for each attachment the document text is extracted, the text is chunked, embeddings computed and indexed, an index lookup is performed and then some of the chunks are passed to the LLM. While this is an OK solution for retrieval tasks, it abjectly fails for summarisation tasks. For LLMs with small context windows summarisation is hard, but many LLMs now support very large context windows; GPT-4o has a 128K context windows and Anthropic Claude 3 support 200K tokens or about 400 pages of text. To make best use of these longer-context models it would be helpful to be able to pass the entire extracted text of all attachments into the LLM. Having a switch to bypass the RAG steps would achieve this.
Author
Owner

@tjbck commented on GitHub (Jul 1, 2024):

This behaviour has been changed since 0.3.6

<!-- gh-comment-id:2198841545 --> @tjbck commented on GitHub (Jul 1, 2024): This behaviour has been changed since 0.3.6
Author
Owner

@nickovs commented on GitHub (Jul 1, 2024):

Can you describe the new behaviour? I am using 0.3.7 (commit 7bc88eb0) and when I attach a multi-page document only a subset of 5 pages are being passed as context, not in the order of the original document. If I change the "Top K" parameter to 10 then I get 10 pages passed in, again not in the order of the original document. Clearly there is something still preventing more than the "top k" hits from being used and the re-ordering suggests that they are coming from some sort of lookup result.

<!-- gh-comment-id:2198854154 --> @nickovs commented on GitHub (Jul 1, 2024): Can you describe the new behaviour? I am using 0.3.7 (commit 7bc88eb0) and when I attach a multi-page document only a subset of 5 pages are being passed as context, not in the order of the original document. If I change the "Top K" parameter to 10 then I get 10 pages passed in, again not in the order of the original document. Clearly there is something still preventing more than the "top k" hits from being used and the re-ordering suggests that they are coming from some sort of lookup result.
Author
Owner

@hkosm commented on GitHub (Aug 4, 2024):

+1 A toggle to completely disable RAG would be great. E.g. also when using an external RAG system and relying on the files object in custom tools.

<!-- gh-comment-id:2267865763 --> @hkosm commented on GitHub (Aug 4, 2024): +1 A toggle to completely disable RAG would be great. E.g. also when using an external RAG system and relying on the __files__ object in custom tools.
Author
Owner

@buger commented on GitHub (Aug 16, 2024):

Can confirm, much needed! In the long term, smth like Claude projects will be amazing, and I'm pretty sure it just puts the whole content of files to the context.

<!-- gh-comment-id:2294171764 --> @buger commented on GitHub (Aug 16, 2024): Can confirm, much needed! In the long term, smth like Claude projects will be amazing, and I'm pretty sure it just puts the whole content of files to the context.
Author
Owner

@NeverOccurs commented on GitHub (Sep 10, 2024):

Try this:
https://github.com/NeverOccurs/full_doc_pipe
Use it as a filter function in Open-Webui. It allows uploading a file and push it fully into system prompt. Then you can direct ask the LLM to summarize it or whatever. It doesn't support changing file midway through the chat though.
Still optimizing it but for now I think it is enough for my use case. I'm trying to incorporating it with Claude's prompt caching to minimize cost.

<!-- gh-comment-id:2339666964 --> @NeverOccurs commented on GitHub (Sep 10, 2024): Try this: https://github.com/NeverOccurs/full_doc_pipe Use it as a filter function in Open-Webui. It allows uploading a file and push it fully into system prompt. Then you can direct ask the LLM to summarize it or whatever. It doesn't support changing file midway through the chat though. Still optimizing it but for now I think it is enough for my use case. I'm trying to incorporating it with Claude's prompt caching to minimize cost.
Author
Owner

@juancarlosm commented on GitHub (Nov 21, 2024):

Definitely necessary, at least to deactivate the RAG process by model, for example, to send the file to an agent like open-interpreter, or to user an OpenAI assistant that handles the file directly, it doesn't need the RAG stuff.

<!-- gh-comment-id:2491446008 --> @juancarlosm commented on GitHub (Nov 21, 2024): Definitely necessary, at least to deactivate the RAG process by model, for example, to send the file to an agent like open-interpreter, or to user an OpenAI assistant that handles the file directly, it doesn't need the RAG stuff.
Author
Owner

@antirez commented on GitHub (Feb 3, 2025):

This behaviour has been changed since 0.3.6

I don't understand. Here with a one liner the problem is dismissed. People continue to tell that it's really needed (with large context LLMs otherwise OpenWebUI is useless) and no reply is added to clarify. So what's the matter here?

<!-- gh-comment-id:2630508762 --> @antirez commented on GitHub (Feb 3, 2025): > This behaviour has been changed since 0.3.6 I don't understand. Here with a one liner the problem is dismissed. People continue to tell that it's really needed (with large context LLMs otherwise OpenWebUI is useless) and no reply is added to clarify. So what's the matter here?
Author
Owner

@leboomer-0x42 commented on GitHub (Mar 20, 2025):

This behaviour has been changed since 0.3.6

I don't understand. Here with a one liner the problem is dismissed. People continue to tell that it's really needed (with large context LLMs otherwise OpenWebUI is useless) and no reply is added to clarify. So what's the matter here?

hello all, for those that missed it (like me before digging prior to "put my self on the list" )
here lies the solution : https://github.com/open-webui/open-webui/issues/7209
magic word to look for in admin pan : BYPASS_EMBEDDING_AND_RETRIEVAL
because a pic is often better than a non native explanation :

Image

<!-- gh-comment-id:2740610069 --> @leboomer-0x42 commented on GitHub (Mar 20, 2025): > > This behaviour has been changed since 0.3.6 > > I don't understand. Here with a one liner the problem is dismissed. People continue to tell that it's really needed (with large context LLMs otherwise OpenWebUI is useless) and no reply is added to clarify. So what's the matter here? hello all, for those that missed it (like me before digging prior to "put my self on the list" ) here lies the solution : https://github.com/open-webui/open-webui/issues/7209 magic word to look for in admin pan : BYPASS_EMBEDDING_AND_RETRIEVAL because a pic is often better than a non native explanation : ![Image](https://github.com/user-attachments/assets/ad755a11-3317-4dce-a2a8-bf47eca98c0b)
Author
Owner

@maurizioaiello commented on GitHub (May 1, 2025):

This is not a solution. https://github.com/open-webui/open-webui/issues/7209
explain how to fix it on a system wide setting, which means per all the models and per all the chat. The useful thing would be to leave RAG always on, and a toggle for deactivating RAG ONLY for that chat in that moment.

<!-- gh-comment-id:2844987280 --> @maurizioaiello commented on GitHub (May 1, 2025): This is not a solution. https://github.com/open-webui/open-webui/issues/7209 explain how to fix it on a system wide setting, which means per all the models and per all the chat. The useful thing would be to leave RAG always on, and a toggle for deactivating RAG ONLY for that chat in that moment.
Author
Owner

@Buco7854 commented on GitHub (Jun 4, 2025):

What would be nice is leave the ability to disable it with like a filter function. It seems like it used to be possible but was removed (why?). The main usecase would be for code execution where you typically does not need to embed a spreadsheet for example.

<!-- gh-comment-id:2940774141 --> @Buco7854 commented on GitHub (Jun 4, 2025): What would be nice is leave the ability to disable it with like a filter function. It seems like it used to be possible but was removed (why?). The main usecase would be for code execution where you typically does not need to embed a spreadsheet for example.
Author
Owner

@ConstantinEilebrecht commented on GitHub (Jun 5, 2025):

A toggle per model would be great to have full flexibility if you connect other system like n8n etc. for complex workflow. In these cases you don't need to start the RAG process within owui.

<!-- gh-comment-id:2943193531 --> @ConstantinEilebrecht commented on GitHub (Jun 5, 2025): A toggle per model would be great to have full flexibility if you connect other system like n8n etc. for complex workflow. In these cases you don't need to start the RAG process within owui.
Author
Owner

@Buco7854 commented on GitHub (Jun 5, 2025):

I do not find the toggle to be really flexible depending on what you need to do. But just giving the ability to handle file upload in a filter function would be enough. People that just want a toggle could just do it based on a UserValve and people that need something a bit more advance could also do it. Looking at the code base it seems embeding the file would be as simple as calling a function.

<!-- gh-comment-id:2943665177 --> @Buco7854 commented on GitHub (Jun 5, 2025): I do not find the toggle to be really flexible depending on what you need to do. But just giving the ability to handle file upload in a filter function would be enough. People that just want a toggle could just do it based on a UserValve and people that need something a bit more advance could also do it. Looking at the code base it seems embeding the file would be as simple as calling a function.
Author
Owner

@dotmobo commented on GitHub (Apr 30, 2026):

+1

I added a model (GLM OCR) as a chat model and I want to be able to pass both images and PDFs to it.

Images are working correctly. However, for PDFs, the GLM OCR model does not receive the actual file because the system uses Apache Tika for content extraction and a RAG process.

I want to keep the RAG and Apache Tika workflow for all other models, but disable it specifically for the GLM OCR model.

<!-- gh-comment-id:4351974200 --> @dotmobo commented on GitHub (Apr 30, 2026): +1 I added a model (GLM OCR) as a chat model and I want to be able to pass both images and PDFs to it. Images are working correctly. However, for PDFs, the GLM OCR model does not receive the actual file because the system uses Apache Tika for content extraction and a RAG process. I want to keep the RAG and Apache Tika workflow for all other models, but disable it specifically for the GLM OCR model.
Author
Owner

@Classic298 commented on GitHub (Apr 30, 2026):

@dotmobo would a file_handle filter do that job for you?

<!-- gh-comment-id:4353119547 --> @Classic298 commented on GitHub (Apr 30, 2026): @dotmobo would a file_handle filter do that job for you?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#116617