[GH-ISSUE #12204] feat: RAG Prompt for Knowledge #16505

Closed
opened 2026-04-19 22:24:36 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @etlweather on GitHub (Mar 31, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12204

Check Existing Issues

  • I have searched the existing issues and discussions.

Problem Description

Currently, there is a system-wide prompt for RAG with Knowledge. It would be of great use to be able to have a prompt per knowledge.

Desired Solution you'd like

A system-wide prompt

  • That can be overridden on a Knowledge basis.
  • Perhaps also at the Model level

Usage example:

Generally, I like the RAG prompt. "If there is nothing in the knowledge, say so." But I have a knowledge which isn't the absolute. And even if there is no knowledge, it does not need to say that it does not have the answer.

Alternatives Considered

No response

Additional Context

No response

Originally created by @etlweather on GitHub (Mar 31, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/12204 ### Check Existing Issues - [x] I have searched the existing issues and discussions. ### Problem Description Currently, there is a system-wide prompt for RAG with Knowledge. It would be of great use to be able to have a prompt per knowledge. ### Desired Solution you'd like A system-wide prompt - That can be overridden on a Knowledge basis. - Perhaps also at the Model level Usage example: Generally, I like the RAG prompt. "If there is nothing in the knowledge, say so." But I have a knowledge which isn't the absolute. And even if there is no knowledge, it does not need to say that it does not have the answer. ### Alternatives Considered _No response_ ### Additional Context _No response_
Author
Owner

@mahenning commented on GitHub (Mar 31, 2025):

Do you mean the "RAG_TEMPLATE" (link), the one you set in the admin document settings? If yes, I'm not sure it is that easy to set it per knowledge base. What if the model has multiple knowledge bases? As the template is used in the last step to generate an answer in the chat, it would be very convoluted (if not impossible) to use different templates for different knowledge bases and merge them into one coherent answer.

A per-model knowledge base RAG template would be possible in my opinion, like the model system prompt.

<!-- gh-comment-id:2766278799 --> @mahenning commented on GitHub (Mar 31, 2025): Do you mean the "RAG_TEMPLATE" ([link](https://docs.openwebui.com/getting-started/env-configuration#rag_template)), the one you set in the admin document settings? If yes, I'm not sure it is that easy to set it per knowledge base. What if the model has multiple knowledge bases? As the template is used in the last step to generate an answer in the chat, it would be very convoluted (if not impossible) to use different templates for different knowledge bases and merge them into one coherent answer. A per-model knowledge base RAG template would be possible in my opinion, like the model system prompt.
Author
Owner

@etlweather commented on GitHub (Mar 31, 2025):

Yes, I mean RAG_TEMPLATE and I agree, as part of the Model make a lot more sense than in the Knowledge for the reasons you said.

<!-- gh-comment-id:2767392504 --> @etlweather commented on GitHub (Mar 31, 2025): Yes, I mean RAG_TEMPLATE and I agree, as part of the Model make a lot more sense than in the Knowledge for the reasons you said.
Author
Owner

@mrudat commented on GitHub (Apr 28, 2025):

See also #7679, which appears to be a similar, but broader request.

<!-- gh-comment-id:2835428975 --> @mrudat commented on GitHub (Apr 28, 2025): See also #7679, which appears to be a similar, but broader request.
Author
Owner

@silentoplayz commented on GitHub (Dec 19, 2025):

Closing this as a duplicate of #7679.

Issue #7679 ("Per-Knowledge-Base RAG Prompt Management") covers the same requirement for overriding RAG prompts at the knowledge base level and contains a more detailed implementation proposal. Please follow the discussion there.

<!-- gh-comment-id:3673102268 --> @silentoplayz commented on GitHub (Dec 19, 2025): Closing this as a duplicate of #7679. Issue #7679 ("Per-Knowledge-Base RAG Prompt Management") covers the same requirement for overriding RAG prompts at the knowledge base level and contains a more detailed implementation proposal. Please follow the discussion there.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#16505