mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 19:38:46 -05:00
[PR #17197] [CLOSED] feat: show generated retrieval queries #24357
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 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:
dev← Head:patch-12📝 Commits (1)
b593d82show 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
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.