Building an Enterprise Knowledge Base and Customer Service Bot with open-webui

Secondary development on top of open-webui lowers the barrier to entry for AI applications. To deploy an enterprise-grade application, there is no longer any substantive obstacle at the technical level. This article walks you through creating an enterprise-level customer service AI application.

Prerequisites:

ollama is installed (version 0.5.0 or later recommended). You can refer to the earlier article

Can ordinary people deploy the DeepSeek-R1 model locally?

1. Install open-webui

Option 1: Install with python (recommended)

First make sure python and pip are installed. You can use python --version to check that the version is 3.11 or above.

Then install with the general command:

pip install open-webui

If you're on a Mac, pay special attention to the Python environment; it's recommended to use

pip3 install open-webui

Or handle the python-related commands through symlinks, then use the general command.

ln -s /usr/bin/python3 /usr/local/bin/python
ln -s /usr/bin/pip3 /usr/local/bin/pip

Start the service

open-webui serve

Verify access: open http://localhost:8080 in your browser and you should see the WebUI interface.

Follow the prompts to register an administrator account.

Option 2: Install with docker (Docker 20.10+ recommended)

Make sure Docker Engine and Docker Compose are installed, then install the docker image from the command line.

Because the CPU version and the Nvidia GPU version differ slightly, please refer to open webui's github instructions for installation.

The docker port is different, so once installation is complete, the address to visit in the browser is http://localhost:3000.

Then follow the prompts to register an administrator account.

Since everyone's network environment is different, you may run into different problems and will need to troubleshoot them yourself.

For detailed documentation see: https://github.com/open-webui/open-webui.

2. Get an embedding model

Go to the Ollama website (https://ollama.com/), open the models page, and select the "Embedding" type in the filter.

Just pick a popular embedding model and download it.

Here I chose the larger bge-m3, and the test results were quite satisfying. It performs better at semantic understanding, multilingual support and long-text handling.

Installation is as simple as for large models: pull it with a command.

ollama pull bge-m3

3. Configure open-webui:

After starting the open-webui service, log in to the system with the administrator account.

Once logged in, find and click the "Admin Panel" entry in the top-right corner of the interface.

Then find the "Settings" option in the navigation menu, and select the "Documents" setting item, which manages document processing and embedding.

Find the "Embeddings" configuration section and select the "Ollama" option. Next, in the vector model input box, enter the name of the model you just downloaded, "bge-m3", exactly.

Note here that the model name must match exactly, including case and hyphens. It's best to copy and paste straight from the download name to avoid typing errors.

Since my knowledge base is fairly small, I chose the default size for the text splitter and haven't yet tested its effect on results.

After finishing these settings, don't forget to click the "Save" button at the bottom of the page to make the configuration take effect.

Test whether the embedding model works

Start a new chat and run a simple document upload test in the chat box.

If there are no errors and the console output is normal, you can confirm that the embedding function is working.

4. Prepare the knowledge base and upload it

Preparing the materials

Before you start uploading a knowledge base, first make sure your knowledge base content is already organized as needed.

The knowledge base can contain all kinds of documents, such as product descriptions, frequently asked questions (FAQ), technical manuals or industry reports.

For the best results, save files as plain text (.txt/.md), because this format has the best compatibility and the system processes it more efficiently. If the original file is Word (.docx), PDF or another format, you can first convert it to plain text with a tool and check whether the content is complete.

Uploading the materials

Next, go to the "Knowledge" page under "Workspace" and click the "+" button to add a knowledge base.

On the page, give your knowledge base a clear, easy-to-recognize name for easier management later. Click "Create Knowledge" to go to the upload page.

Click the "+" button and choose the knowledge base file/folder you prepared to upload.

Once the upload is complete, the system automatically starts processing the file contents. Wait patiently for a moment, and you can start using the knowledge base for Q&A or retrieval. If you need to update the knowledge base later, just repeat the steps above to add or replace files.

If a file is large (for example, over 10K), it's better to split it manually into several smaller files before uploading. The benefits are:

  1. Higher system processing efficiency — large files can take longer to parse, and splitting speeds up upload and indexing.

  2. More accurate answers — the system can pinpoint key information in small files more precisely, avoiding the confusion caused by an oversized file.

For example, if you have a 20-page product manual, you can split it into 5 files by chapter, about 4 pages each. After upload, the system analyzes and indexes them one by one, ensuring that later Q&A can quickly match the relevant content.

5. Configure the workspace

First, go to the system interface and click "Workspace".

Click the "New Model" button and the system will bring up the model creation wizard.

On the model type selection screen, choose "Base Model" from the list as your starting point.

Then, in the "System Prompt" input box, enter guidance text relevant to your business scenario.

For example, if your model is used for product recommendations, you can enter "Please recommend suitable products based on user needs, and briefly explain why." These prompts directly affect the model's output style and content direction.

In the screenshot above, I restricted this "HR bot" to answering only HR content.

The last step is binding the knowledge base. In the knowledge base item, click the "Select Knowledge" button and choose the knowledge base you created from the dropdown menu.

Other configuration options (such as model parameters and response length) can be left at their default values for now.

After completing these steps, click "Save" to finish the basic workspace configuration.

  1. Try it out

Go back to the home page, start a new chat, select the "HR bot" you just created at the top, and ask a question covered by the knowledge base materials.

The result shows it answers entirely from the knowledge base content. Success!

7. Further thoughts

The large language model knowledge base built on open-webui actually has a very broad range of applications and plenty of room for imagination.

Take the customer service scenario: by connecting an enterprise knowledge base, you can quickly build a 24/7 online intelligent customer service system that not only automatically answers 90% of common questions but also keeps improving answer quality through conversation records.

Going a step further, combined with user profile data, it can also deliver personalized service recommendations — for example, in e-commerce scenarios, recommending related products based on a user's order history.

Beyond customer service, such a knowledge base has great potential in education and training, medical consultation, legal advisory and other professional fields. In healthcare, for instance, you could build an intelligent consultation assistant that contains the latest diagnostic and treatment guidelines and a drug database; in the legal field, you could develop a legal consultation bot that quickly retrieves case precedents and statutes. These applications not only improve service efficiency but also significantly reduce labor costs.

From a technical implementation standpoint, secondary development on top of open-webui really does lower the barrier to enterprise-grade applications. With simple API integration, developers can quickly embed the capabilities of a large language model into existing systems. Add to that the maturity of today's cloud computing platforms, and deploying an enterprise-grade application no longer faces any substantive technical obstacle.

FAQ

Question 1: Why not use AnythingLLM?

Although AnythingLLM's form is closer to a traditional desktop application and may be more intuitive to use, its Chinese interface support is fairly mediocre, so the experience is not friendly enough for Chinese users.

In addition, if you want to deploy and use it inside an enterprise, a website-based form like open-webui is more suitable, because it makes team collaboration and cross-platform access easier.

Another key advantage is that open-webui is open source, which means enterprises can flexibly modify the front-end interface or features according to their own needs — adjusting the layout, optimizing the interaction logic, or even integrating internal enterprise systems.

Question 2: Why not use nomic, the top-ranked embedding model on ollama?

The reasons for not using nomic are as follows:

  1. First, nomic's model is relatively small, only 274MB, which limits its capability. By comparison, other embedding models of the same type are usually in the GB range and can store more semantic information.

  2. Second, nomic's last update was a year ago, so it may lack the latest optimizations or training data.

  3. Also, comparisons online show that nomic does not support multiple languages, which is a serious flaw for users who need to handle several languages. Models like bge-m3 usually take multilingual support into account in their design and can respond more flexibly to scenarios in different languages.

After trying nomic, its performance was indeed disappointing: when I entered queries, the relevance of the returned results was not high. Multiple tests gave the same result. So in the end I didn't use nomic.

Question 3: Causes of and fixes for the 400 # Embedding dimension error after switching embedding models.

When you switch embedding models, you may encounter an HTTP 400 error, Embedding dimension xxx does not match collection dimensionality xxx.

This is usually because different models have inconsistent embedding dimensions. For example, the original model may produce 384-dimensional vectors while the new model produces 768-dimensional ones, so the system cannot stay directly compatible with the old data.

Fixing this requires thoroughly clearing the existing knowledge base data, completely rebuilding the index, and re-uploading the documents.

This is because the vector database relies on a consistent dimension structure to retrieve information, and a dimension mismatch causes retrieval to fail. It's advisable to back up your data before switching models and to make sure all documents are reprocessed to avoid this kind of problem.

Question 4: Why are my knowledge base answers inaccurate? Optimization tips and practical experience.

The accuracy of a knowledge base depends heavily on how the documents are organized.

If you merge everything into one large file (as I initially did, combining the original text of 69 questions into a single file), the system may struggle to locate and extract the relevant information precisely, resulting in vague or wrong answers.

Later, I split those 69 questions into separate files, each containing the content of a single question. This adjustment markedly improved answer accuracy, because the system can identify the specific document to answer from more clearly.

Before splitting:

After splitting:

As you can see, after splitting, the model can directly associate a question with its corresponding file, reducing interference from irrelevant information. So I recommend splitting knowledge base documents by topic or by question to optimize retrieval performance.