issue: RAG template for documents is automatically added to prompt when a tool is enabled #4800

Closed
opened 2025-11-11 16:03:25 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @bgeneto on GitHub (Apr 10, 2025).

Originally assigned to: @tjbck on GitHub.

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.2

Ollama Version (if applicable)

No response

Operating System

Debian 12

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

The RAG template should not be automatically added to the system prompt when a tool is enabled or called.

Actual Behavior

The RAG template (for documents, with xml stuff) is automatically added to the system prompt when any tool is enabled, resulting in an irrelevant and potentially confusing prompt. This results in less-than-ideal tool performance.

Steps to Reproduce

  1. Enable any tool (e.g., calculator or weather) in the web UI.

  2. Observe the generated system prompt.

  3. Verify that the RAG template is automatically added to the prompt when the tool is called, resulting in instructions that have no significance, such as the one below:

Logs & Screenshots

Image

Additional Information

When a tool is enabled in the web UI, the RAG template is automatically added to the prompt. This is problematic specially when using a custom RAG template designed for document information extraction, which is not relevant when using tools like calculator or weather or many others. Example of an auto-included (pointless) prompt:

<context> <source id="1">(48.26)^3 = 112398.871976000</source> </context> 
<rules> 
 - Thoroughly analyze the context to find information relevant to the query. 
 - Provide the most relevant and comprehensive information from the context that answers the query. 
 - Include any examples, use cases, or practical applications mentioned in the context that relate to the query. 
 - If multiple pieces of information from the context are relevant, provide all of them in a structured manner. 
 - When appropriate, organize the response into sections such as Main Concept, Examples, Use Cases, and Additional Details. 
 - If the context contains step-by-step instructions or processes related to the query, present them clearly. 
 - Highlight any important definitions, key terms, or concepts found in the context that are crucial to understanding the answer. 
 - Answer directly and without using XML tags.
</rules>

If this is a intended "feature" and not a bug, then maybe we can add some option, to be parsed in the tool source, to not to include the rag prompt, similar to self.citation = False, maybe self.prompt = False (which defaults to True).

Originally created by @bgeneto on GitHub (Apr 10, 2025). Originally assigned to: @tjbck on GitHub. ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.2 ### Ollama Version (if applicable) _No response_ ### Operating System Debian 12 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior The RAG template should not be automatically added to the system prompt when a tool is enabled or called. ### Actual Behavior The RAG template (for documents, with xml stuff) is automatically added to the system prompt when any tool is enabled, resulting in an irrelevant and potentially confusing prompt. This results in less-than-ideal tool performance. ### Steps to Reproduce 1. Enable any tool (e.g., calculator or weather) in the web UI. 2. Observe the generated system prompt. 3. Verify that the RAG template is automatically added to the prompt when the tool is called, resulting in instructions that have no significance, such as the one below: ### Logs & Screenshots ![Image](https://github.com/user-attachments/assets/e72e817c-028f-42a2-a5f1-c68ed2d35fb4) ### Additional Information When a tool is enabled in the web UI, the RAG template is automatically added to the prompt. This is problematic specially when using a custom RAG template designed for document information extraction, which is not relevant when using tools like calculator or weather or many others. Example of an auto-included (pointless) prompt: ``` <context> <source id="1">(48.26)^3 = 112398.871976000</source> </context> <rules> - Thoroughly analyze the context to find information relevant to the query. - Provide the most relevant and comprehensive information from the context that answers the query. - Include any examples, use cases, or practical applications mentioned in the context that relate to the query. - If multiple pieces of information from the context are relevant, provide all of them in a structured manner. - When appropriate, organize the response into sections such as Main Concept, Examples, Use Cases, and Additional Details. - If the context contains step-by-step instructions or processes related to the query, present them clearly. - Highlight any important definitions, key terms, or concepts found in the context that are crucial to understanding the answer. - Answer directly and without using XML tags. </rules> ``` > If this is a intended "feature" and not a bug, then maybe we can add some option, to be parsed in the tool source, to not to include the rag prompt, similar to `self.citation = False`, maybe `self.prompt = False` (which defaults to True).
GiteaMirror added the bug label 2025-11-11 16:03:25 -06:00
Author
Owner

@bgeneto commented on GitHub (Apr 10, 2025):

Related to #12324

@bgeneto commented on GitHub (Apr 10, 2025): Related to #12324
Author
Owner

@tjbck commented on GitHub (Apr 13, 2025):

Addressed with 881d81d87f

@tjbck commented on GitHub (Apr 13, 2025): Addressed with 881d81d87fbd5d0affe7194744eae87fbecc4e4c
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#4800