[GH-ISSUE #7679] Feature Request: Per-Knowledge-Base RAG Prompt Management #30368

Closed
opened 2026-04-25 04:35:32 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @Maralai on GitHub (Dec 7, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/7679

Feature Request

I'm requesting a feature to manage multiple RAG models/prompts and assign them at the knowledge base level. Currently, I find myself constantly editing the RAG prompt to optimize for different knowledge bases. This new feature would significantly improve the precision and efficiency of knowledge retrieval.

Problem:

Different knowledge bases require different prompting strategies to yield optimal results. Currently, users have to manually adjust the RAG prompt every time they switch between knowledge bases. Experimenting with the current system is time-consuming and prone to error. It also makes maintaining consistent results across different sessions challenging when switching contexts. For optimal dedicated knowledge retrieval, a separately maintained open-webui is often required.

Proposed Solution:

Implement a system for managing multiple RAG models/prompts and associating them with specific knowledge bases. This could involve:

  • Saving and Naming Prompts: Allow users to save different RAG prompts with descriptive names.
  • Knowledge Base Association: Provide an interface to link saved prompts to individual knowledge bases.
  • Prompt Selection: When querying a knowledge base, automatically use the assigned prompt. If no prompt is assigned, fall back to a default/global prompt.
  • Prompt Editing/Deletion: Allow users to edit or delete saved prompts as needed.
  • Optional: Prompt Variables: Allow for variables within prompts that can be dynamically populated based on the knowledge base or other context (e.g., {{knowledge_base_name}}). This could enable even more tailored prompting strategies.

Benefits:

  • Improved Accuracy: Tailored prompts will lead to more relevant and accurate knowledge retrieval.
  • Increased Efficiency: Eliminates the need to manually edit prompts for each knowledge base.
  • Better Consistency: Ensures consistent results across different sessions and users.
  • Enhanced Workflow: Simplifies the process of managing and applying different prompting strategies.

Example Use Case:

Let's say I have two knowledge bases: one for technical documentation and another for customer support interactions. The technical documentation requires a more precise, technical prompt, while the customer support knowledge base benefits from a more conversational and empathetic prompt. With this feature, I could create two separate prompts, "Technical Documentation Prompt" and "Customer Support Prompt," and assign them to the respective knowledge bases. This would streamline my workflow and improve the accuracy of responses from each knowledge base.

This feature would significantly improve the usability and effectiveness of RAG within open-webui. Thank you for considering this request.

Originally created by @Maralai on GitHub (Dec 7, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/7679 # Feature Request I'm requesting a feature to manage multiple RAG models/prompts and assign them at the knowledge base level. Currently, I find myself constantly editing the RAG prompt to optimize for different knowledge bases. This new feature would significantly improve the precision and efficiency of knowledge retrieval. **Problem:** Different knowledge bases require different prompting strategies to yield optimal results. Currently, users have to manually adjust the RAG prompt every time they switch between knowledge bases. Experimenting with the current system is time-consuming and prone to error. It also makes maintaining consistent results across different sessions challenging when switching contexts. For optimal dedicated knowledge retrieval, a separately maintained open-webui is often required. **Proposed Solution:** Implement a system for managing multiple RAG models/prompts and associating them with specific knowledge bases. This could involve: * **Saving and Naming Prompts:** Allow users to save different RAG prompts with descriptive names. * **Knowledge Base Association:** Provide an interface to link saved prompts to individual knowledge bases. * **Prompt Selection:** When querying a knowledge base, automatically use the assigned prompt. If no prompt is assigned, fall back to a default/global prompt. * **Prompt Editing/Deletion:** Allow users to edit or delete saved prompts as needed. * **Optional: Prompt Variables:** Allow for variables within prompts that can be dynamically populated based on the knowledge base or other context (e.g., `{{knowledge_base_name}}`). This could enable even more tailored prompting strategies. **Benefits:** * **Improved Accuracy:** Tailored prompts will lead to more relevant and accurate knowledge retrieval. * **Increased Efficiency:** Eliminates the need to manually edit prompts for each knowledge base. * **Better Consistency:** Ensures consistent results across different sessions and users. * **Enhanced Workflow:** Simplifies the process of managing and applying different prompting strategies. **Example Use Case:** Let's say I have two knowledge bases: one for technical documentation and another for customer support interactions. The technical documentation requires a more precise, technical prompt, while the customer support knowledge base benefits from a more conversational and empathetic prompt. With this feature, I could create two separate prompts, "Technical Documentation Prompt" and "Customer Support Prompt," and assign them to the respective knowledge bases. This would streamline my workflow and improve the accuracy of responses from each knowledge base. This feature would significantly improve the usability and effectiveness of RAG within open-webui. Thank you for considering this request.
Author
Owner

@Simon-Stone commented on GitHub (Dec 7, 2024):

I love this idea. Tailoring the context injection prompt to the knowledge base can drastically increase the quality and alignment of the generated answer.

<!-- gh-comment-id:2525192582 --> @Simon-Stone commented on GitHub (Dec 7, 2024): I love this idea. Tailoring the context injection prompt to the knowledge base can drastically increase the quality and alignment of the generated answer.
Author
Owner

@oatmealm commented on GitHub (Dec 7, 2024):

Currently I create custom models with one or more knowledge collections, so I can choose the model, parameters and system prompt per topic domain. Works quite well and possibly more useful than per knowledge base prompt, if you tend to break knowledge into distinct topics that might overlap.

<!-- gh-comment-id:2525330061 --> @oatmealm commented on GitHub (Dec 7, 2024): Currently I create custom models with one or more knowledge collections, so I can choose the model, parameters and system prompt per topic domain. Works quite well and possibly more useful than per knowledge base prompt, if you tend to break knowledge into distinct topics that might overlap.
Author
Owner

@Maralai commented on GitHub (Dec 8, 2024):

I also have similar setups; however, I have more success further customizing the RAG prompt on approaching serving the knowledge.

Take your understanding of system prompts and look over the default RAG prompt; now imagine the specificity of your model via the system prompt and its usage and how you can enhance the retrieval of the knowledge by modifying the prompt.

<!-- gh-comment-id:2525361855 --> @Maralai commented on GitHub (Dec 8, 2024): I also have similar setups; however, I have more success further customizing the RAG prompt on approaching serving the knowledge. Take your understanding of system prompts and look over the default RAG prompt; now imagine the specificity of your model via the system prompt and its usage and how you can enhance the retrieval of the knowledge by modifying the prompt.
Author
Owner

@oatmealm commented on GitHub (Dec 8, 2024):

Absolutely. It was just by way of a workaround.

<!-- gh-comment-id:2525549559 --> @oatmealm commented on GitHub (Dec 8, 2024): Absolutely. It was just by way of a workaround.
Author
Owner

@flefevre commented on GitHub (Dec 10, 2024):

Perhaps you need could be integrated in the future prompt management system https://github.com/open-webui/open-webui/issues/5962 ?

<!-- gh-comment-id:2533010823 --> @flefevre commented on GitHub (Dec 10, 2024): Perhaps you need could be integrated in the future prompt management system https://github.com/open-webui/open-webui/issues/5962 ?
Author
Owner

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

Given that default function calling is now considered legacy and that native function calling does not make use of a RAG prompt anymore, i think this can be considered solved/closed.

You can create a custom system prompt in a custom model and tell it HOW to query for the knowledge base - since the model itself will do the query creation when querying a knowledge base using native tool calling now

<!-- gh-comment-id:4254745757 --> @Classic298 commented on GitHub (Apr 15, 2026): Given that default function calling is now considered legacy and that native function calling does not make use of a RAG prompt anymore, i think this can be considered solved/closed. You can create a custom system prompt in a custom model and tell it HOW to query for the knowledge base - since the model itself will do the query creation when querying a knowledge base using native tool calling now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#30368