[PR #17197] [CLOSED] feat: show generated retrieval queries #47405

Closed
opened 2026-04-29 22:36:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/17197
Author: @diwakar-s-maurya
Created: 9/4/2025
Status: Closed

Base: devHead: patch-12


📝 Commits (1)

  • b593d82 show generated retrieval query

📊 Changes

5 files changed (+96 additions, -9 deletions)

View changed files

📝 backend/open_webui/utils/middleware.py (+21 -3)
📝 src/lib/components/chat/Chat.svelte (+9 -1)
📝 src/lib/components/chat/Messages/ResponseMessage.svelte (+22 -5)
src/lib/components/chat/Messages/ResponseMessage/QueryGenerationResults.svelte (+43 -0)
📝 src/lib/i18n/locales/en-US/translation.json (+1 -0)

📄 Description

Changelog Entry

Description

At present, when user asks a question against a knowledge collection and "Retrieval Query Generation" is on, QUERY_GENERATION_PROMPT_TEMPLATE is used to break down the question and then search in the collection. The user is unable to see what queries were made. This makes it difficult to understand why a source was fetched, cannot know what/how many queries the original question was broken into, cannot see impact of template change on queries easily. Showing the actual queries sent will help solve these.

This PR shows users what queries were actually sent to database for RAG too. It is solves the problems mentioned above.

Example:
If user asks "How much is OPD limit?", OPD can mean "Out Patient Department" or "Optical Power Density". Similarly, IPD can mean "In Patient Department" or "Inter Pupillary Distance".
I myself, have seen sub-query generation actually generate "Inter Pupillary Distance limit" when asked for "How much is IPD limit?" on a knowledge base having health related policies. I could see in citations that it fetched the right chunk, but since the sub-query was not related at all, model did not provide the answer.

Added

  • Show generated sub-queries for retrieval

Additional Information

I had tried to introduce same feature in https://github.com/open-webui/open-webui/pull/14175. It got closed because the UI was not good. This time the UI is better. The UI is aligned also with how list of websites get shown if "Web Search" is on.

Screenshots or Videos

https://github.com/user-attachments/assets/a8d9efbd-a56a-417d-a6de-f77619a18a85

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 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/17197 **Author:** [@diwakar-s-maurya](https://github.com/diwakar-s-maurya) **Created:** 9/4/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `patch-12` --- ### 📝 Commits (1) - [`b593d82`](https://github.com/open-webui/open-webui/commit/b593d827443356e531dac534dc8412c1980d975d) show generated retrieval query ### 📊 Changes **5 files changed** (+96 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/utils/middleware.py` (+21 -3) 📝 `src/lib/components/chat/Chat.svelte` (+9 -1) 📝 `src/lib/components/chat/Messages/ResponseMessage.svelte` (+22 -5) ➕ `src/lib/components/chat/Messages/ResponseMessage/QueryGenerationResults.svelte` (+43 -0) 📝 `src/lib/i18n/locales/en-US/translation.json` (+1 -0) </details> ### 📄 Description # Changelog Entry ### Description At present, when user asks a question against a knowledge collection and "Retrieval Query Generation" is on, QUERY_GENERATION_PROMPT_TEMPLATE is used to break down the question and then search in the collection. The user is unable to see what queries were made. This makes it difficult to understand why a source was fetched, cannot know what/how many queries the original question was broken into, cannot see impact of template change on queries easily. Showing the actual queries sent will help solve these. This PR shows users what queries were actually sent to database for RAG too. It is solves the problems mentioned above. Example: If user asks "How much is OPD limit?", OPD can mean "Out Patient Department" or "Optical Power Density". Similarly, IPD can mean "In Patient Department" or "Inter Pupillary Distance". I myself, have seen sub-query generation actually generate "Inter Pupillary Distance limit" when asked for "How much is IPD limit?" on a knowledge base having health related policies. I could see in citations that it fetched the right chunk, but since the sub-query was not related at all, model did not provide the answer. ### Added - Show generated sub-queries for retrieval --- ### Additional Information I had tried to introduce same feature in https://github.com/open-webui/open-webui/pull/14175. It got closed because the UI was not good. This time the UI is better. The UI is aligned also with how list of websites get shown if "Web Search" is on. ### Screenshots or Videos https://github.com/user-attachments/assets/a8d9efbd-a56a-417d-a6de-f77619a18a85 ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <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-29 22:36:49 -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#47405