Chatbot that calls RAGFlow in Open WebUI - suitable for building personal and enterprise-level knowledge question and answer assistants

Written by
Iris Vance
Updated on:July-01st-2025
Recommendation

The combination of Open WebUI and RAGFlow creates an efficient knowledge question and answer assistant.
Core content:
1. Introduction to Open WebUI and RAGFlow and their advantages
2. Integrating the two through Pipeline to improve the accuracy of question and answer
3. RAGFlow's multi-format support and advanced search function

Yang Fangxian
Founder of 53AI/Most Valuable Expert of Tencent Cloud (TVP)

 

As we all know, Open WebUI is a good large model front-end interface. Alibaba's Qwen interface is developed based on it (blind guess). In fact, after using Open WebUI for a long time, I found that by integrating RAGFlow, an excellent RAG (retrieval enhancement generation) framework, the accuracy of document retrieval and question answering can be significantly improved. This article will introduce Open WebUI and RAGFlow in detail, and show how to connect the two through Pipeline to achieve efficient RAG retrieval results.

Why add RAGFlow to Open WebUI?

Open WebUI is a super beautiful AI front-end interface, which is very easy to use. I have used it for a while and feel that it is like a simplified version of ChatGPT. RAGFlow is a tool specifically for document retrieval, which can find the information you want from PDF, Word and even web pages. Putting them together, you can enjoy the beautiful operation of Open WebUI while using RAGFlow to quickly find the key content in the document, and the accuracy of question and answer will increase. Whether you want to deal with complex documents or make the chat more interesting, this solution is worth a try.

First look at the effect:

With reference content! Or stream generated!

1. Introduction to Open WebUI

Open WebUI is an open source, self-hosted AI interaction platform known for its user-friendly interface and powerful functions. Its design is inspired by ChatGPT, the interface is intuitive and easy to operate, and it supports offline operation, which is very suitable for users who want to deploy large models locally. The scalability of Open WebUI is a highlight, and it can seamlessly integrate multiple large language model (LLM) runners, such as Ollama and OpenAI compatible APIs.

Key Features:

  • •  Multi-model support : Supports multiple LLMs, and users can choose different models to interact according to their needs.
  • •  Intuitive interface : The interface design is simple and beautiful, the operation is smooth, and the user experience is excellent.
  • •  Offline operation : supports self-hosting, no need to rely on cloud services, and data security is more guaranteed.
  • •  Extensibility : Through the Pipelines framework, users can easily add custom functions.

The installation of Open WebUI is also very simple. It can also be installed directly using pip, which is also convenient for secondary development.

Usually it can be quickly deployed through Docker or Kubernetes. For example, you can start it with the following command:

docker run -d -p 3000:8080 --name open-webui openwebui/open-webui:main

An example page looks like this:

2. Introduction to RAGFlow

RAGFlow is an open source RAG (Retrieval-Augmented Generation) engine that focuses on deep document understanding and efficient question-answer generation. It can process data in a variety of complex formats, including Word, PDF, and web pages, and improves retrieval accuracy through a series of advanced features. RAGFlow is designed to provide users with a simplified RAG workflow and achieve accurate question-answering capabilities in combination with LLM.

Key Features:

  • •  Multi-format support : compatible with multiple document types such as Word, PDF, web pages, etc.
  • •  Template-based segmentation : Divide documents into blocks through templates for easy retrieval and management.
  • •  Knowledge graph : Use knowledge graph to enhance document understanding capabilities.
  • •  Keyword extraction : Automatically extract key information to improve retrieval efficiency.
  • •  Visual traceability : Provides visualization tools to help users trace the source of answers.
  • •  Flexible deployment : supports Docker deployment and is compatible with multiple LLM and embedded models.

The deployment of RAGFlow is also simple. Take Docker as an example:

docker run -d -p 5000:5000 infiniflow/ragflow:latest

An example page looks like this:


3. Connect Open WebUI and RAGFlow through Pipeline

To integrate the powerful search capabilities of RAGFlow into Open WebUI, we need to use the Pipelines feature of Open WebUI. Pipelines is a plug-in framework that allows users to extend the functionality of Open WebUI without modifying the core code. Through a custom Pipeline script, we can let Open WebUI call RAGFlow for search and provide the results as context to LLM to generate more accurate answers.

3.1 Configuration Prerequisites

Before you begin, make sure the following conditions are met:

  • • Open WebUI is installed and running.
  • • RAGFlow is installed and running.
  • • Docker environment is available (for running Pipelines).

3.2 Install Pipelines

Pipelines can be deployed via Docker. Run the following command to start the Pipelines server:

`docker run -d -p 9099:9099 --add-host=host.docker.internal:host-gateway -v pipelines:/app/pipelines --name pipelines --restart always ghcr.io/open-webui/pipelines:main`

This command runs the Pipelines container on port 9099 and mounts a local directory for storing Pipeline scripts.

3.3 Configure Open WebUI to connect to Pipelines

  1. 1. Open WebUI and go to  Admin Panel > Settings > Connections .  
  2. 2. Click  +  Add New Connection.
  3. 3. Set the API URL to http://localhost:9099 (or http://host.docker.internal:9099 if running Open WebUI in Docker).
  4. 4. Set the API key to 0p3n-w3bu!.
  5. 5. After saving, the API Base URL will show a connection with the "Pipelines" icon, indicating that the configuration is successful.

The following interface:


3.4 Upload the Pipelines script and configure parameters

Open Pipelines and upload the written py file, and configure four parameters to use it:


3.5 Use in chat

After the configuration is complete, select the model that uses RAGFlow Pipeline in the chat interface of Open WebUI. When uploading a document or entering a query, Open WebUI will call RAGFlow through Pipeline to retrieve relevant content and pass the results to LLM to generate answers. The actual test is similar to using RAGFlow directly, and the speed is very fast.


Our actual question content has a high recall, and the actual knowledge base content is:

How to implement in-order traversal of a binary tree?
‍```python
class Node :
    def __init__ ( self, value ):
        self .left =  None
        self .right =  None
        self .value = value

def inorder_traversal ( root ):
    res = []
    def helper ( node ):
        if  node:
            helper(node.left)
            res.append(node.value)
            helper(node.right)
    helper(root)
    return  res

# Build the test tree
root = Node( 1 )
root.left = Node( 2 )
root.right = Node( 3 )
root.left.right = Node( 4 )
print (inorder_traversal(root))   # [2,4,1,3]
‍```

As you can see, the actual recall effect is amazing!


4. Conclusion

By integrating RAGFlow into Open WebUI through Pipeline, users can take full advantage of RAGFlow's powerful search capabilities in an attractive and easy-to-use interface. This combination not only improves the accuracy of questions and answers, but also provides developers with flexible customization space. Whether you want to handle complex documents or improve the chat experience, this solution is worth a try. Connecting RAGFlow to Open WebUI is a boon for lazy people and efficiency enthusiasts. The interface is beautiful, the search is powerful, and the operation is simple. You will know how good it is after trying it once.

My python script is below. If you need it, just copy the content, save it as a py file and upload it.

 

from  typing  import ListUnion , Generator, Iterator,  Optional 
from  pydantic  import  BaseModel
import  requests
import  json

class Pipeline : 
    class Valves ( BaseModel ): 
        API_KEY:  str
        AGENT_ID:  str
        HOST:  str
        PORT:  str