English | 简体中文 | Help
RAG Has Never Been So Easy
minRAG is a RAG system built from scratch, pursuing extreme simplicity and power, with no more than 10,000 lines of code. It supports AI platforms such as OpenAI, Gitee AI, Baidu Qianfan, Tencent Cloud LKE, Alibaba Cloud BaiLian, and ByteDance Volcano Engine. No installation is required; just double-click to start.
It uses FTS5 for BM25 full-text search and Vec for vector retrieval. It implements components such as MarkdownConverter, DocumentSplitter, OpenAIDocumentEmbedder, SQLiteVecDocumentStore, OpenAITextEmbedder, VecEmbeddingRetriever, FtsKeywordRetriever, DocumentChunkReranker, PromptBuilder, OpenAIChatMemory, OpenAIChatGenerator, ChatMessageLogStore, Pipeline, etc., supporting pipeline setup and extension.
reranker does not have a unified standard, the base_url in the component parameters must be filled in with the complete path.
OpenAI
minRAG implements the standard specifications of OpenAI, and all platforms compatible with OpenAI can be used.
Gitee AI (Default)
The default AI platform is Gitee AI. Gitee AI offers 100 free calls per day.
- On the registration or settings page, fill in
base_url for the AI platform as https://ai.gitee.com/v1.
- On the registration or settings page, fill in
api_key with a free or paid token.
OpenAITextEmbedder defaults to using the Qwen3-Embedding-8B model.
DocumentChunkReranker defaults to using the Qwen3-Reranker-8B model.
OpenAIChatGenerator is recommended to use the DeepSeek-V4-Pro model.
Tencent Cloud LKE Knowledge Engine
- On the registration or settings page, fill in
base_url for the AI platform as SecretId, or configure it in the component parameters as {"SecretId":"xxx"}.
- On the registration or settings page, fill in
api_key as SecretKey, or configure it in the component parameters as {"SecretKey":"xxx"}.
LKETextEmbedder and LKEDocumentEmbedder default to using the lke-text-embedding-v2 model.
LKEDocumentChunkReranker defaults to using the lke-reranker-base model.
OpenAIChatGenerator connects using the OpenAI SDK method. The component parameter configuration is {"base_url":"https://api.lkeap.cloud.tencent.com/v1","api_key":"xxx","model":"DeepSeek-V4-Pro"}.
- Remember to modify the components in the pipeline.
Baidu QianFan
- On the registration or settings page, fill in
base_url for the AI platform as https://qianfan.baidubce.com/v2.
- On the registration or settings page, fill in
api_key with a permanently valid API Key.
OpenAITextEmbedder and OpenAIDocumentEmbedder default to using the qwen3-embedding-8b model.
QianFanDocumentChunkReranker defaults to using the qwen3-reranker-8b model.
OpenAIChatGenerator is recommended to use the DeepSeek-V4-Pro model.
- Remember to modify the components in the pipeline.
Alibaba Cloud BaiLian
- On the registration or settings page, fill in
base_url for the AI platform as https://dashscope.aliyuncs.com/compatible-mode/v1.
- On the registration or settings page, fill in
api_key with the applied API KEY.
OpenAITextEmbedder and OpenAIDocumentEmbedder default to using the text-embedding-v3 model, with 1024 dimensions.
- The component parameter configuration for
BaiLianDocumentChunkReranker is {"base_url":"https://dashscope.aliyuncs.com/api/v1/services/rerank/text-rerank/text-rerank","model":"qwen3-rerank","top_n":5,"score":0.1}.
OpenAIChatGenerator is recommended to use the DeepSeek-V4-Pro model.
- Remember to modify the components in the pipeline.
ByteDance Volcano Engine
- On the registration or settings page, fill in
base_url for the AI platform as https://ark.cn-beijing.volces.com/api/v3.
- On the registration or settings page, fill in
api_key with the applied API KEY.
OpenAITextEmbedder and OpenAIDocumentEmbedder are recommended to use the doubao-embedding model, compatible with 1024 dimensions.
- Volcano Engine does not currently have a Reranker model, so it is recommended to use Reranker models from other platforms or remove it.
OpenAIChatGenerator is recommended to use the DeepSeek-V4-Pro model.
- Remember to modify the components in the pipeline.
UI Preview
Markitdown Integration (Default)
Use https://gitee.com/minrag/markitdown to parse documents, The compiled dist/markitdown from python build.py should be placed in the minragdatadir directory. Example configuration for the MarkdownConverter component:
{
"model":"Qwen3-VL-30B-A3B-Instruct",
"prompt":"Accurately extract the content of the image and directly describe the image without any irrelevant guidance or similar information.",
"markitdown":"minragdatadir/markitdown/markitdown",
"markdownDir":"minragdatadir/upload/markitdown/markdown",
"imageFileDir":"minragdatadir/upload/markitdown/image",
"imageURLPrefix":"/upload/markitdown/image"
}
Description:
model:Image analysis model
prompt:Understand the prompts for images in the document
markitdown:markitdown command
markdownDir:Generated Markdown File Directory
imageFileDir:Directory for storing images
imageURLPrefix:images URL prefix
Tika Integration
By default, minRAG only supports text formats like Markdown and plain text. To parse document content, you can use the TikaConverter component to call the tika service. Example configuration for TikaConverter:
{
"tikaURL": "http://localhost:9998/tika",
"defaultHeaders": {
"Content-Type": "application/octet-stream"
}
}
Start the tika service with this command:
## Apache Tika 3.x requires JDK 11 or later
java -jar tika-server-standard-3.1.0.jar --host=0.0.0.0 --port=9998
## To disable logging
#nohup java -jar tika-server-standard-3.1.0.jar --host=0.0.0.0 --port=9998 >/dev/null 2>&1 &
Alternatively, download tika-windows and use start.bat to launch Tika.
Note: Modify the parameters in your indexPipeline workflow by replacing the original MarkdownConverter with TikaConverter:
{
"id": "indexPipeline",
"downStream": [
{
"id": "TikaConverter",
"downStream": [{"id": "DocumentSplitter"}]
},
{
"id": "DocumentSplitter",
"downStream": [{"id": "OpenAIDocumentEmbedder"}]
},
{
"id": "OpenAIDocumentEmbedder",
"downStream": [{"id": "SQLiteVecDocumentStore"}]
},
{
"id": "SQLiteVecDocumentStore"
}
]
}
Agentic AI
Index Component Configuration:
{
"id": "indexPipeline",
"downStream": [
{
"id": "MarkdownConverter",
"downStream": [{"id": "MarkdownIndex"}]
},
{
"id": "MarkdownIndex",
"downStream": [{"id": "SQLiteVecDocumentStore"}]
},
{
"id": "SQLiteVecDocumentStore"
}
]
}
default Component Configuration:
{
"id": "default",
"downStream": [
{
"id": "MarkdownRetriever",
"downStream": [{"id": "FtsKeywordRetriever"}]
},
{
"id": "FtsKeywordRetriever",
"downStream": [{"id": "PromptBuilder"}]
},
{
"id": "PromptBuilder",
"downStream": [{"id": "OpenAIChatMemory"}]
},
{
"id": "OpenAIChatMemory",
"downStream": [{"id": "OpenAIChatGenerator"}]
},
{
"id": "OpenAIChatGenerator",
"downStream": [{"id": "ChatMessageLogStore"}]
},
{
"id": "ChatMessageLogStore"
}
]
}
Development Environment
minRAG uses https://github.com/wangfenjin/simple as the FTS5 full-text search extension. The compiled libsimple file is placed in the minragdatadir/extensions directory. If minRAG fails to start and reports an error connecting to the database, please check if the libsimple file is correct. If you need to recompile libsimple, please refer to https://github.com/wangfenjin/simple.
The default port is 738, and the backend management address is http://127.0.0.1:738/admin/login.
First, unzip minragdatadir/dict.zip.
Run go run --tags "fts5" ..
Package: go build --tags "fts5" -ldflags "-w -s".
The development environment requires CGO compilation configuration. Set set CGO_ENABLED=1, download mingw64 and cmake, and configure the bin to the environment variables. Note to rename mingw64/bin/mingw32-make.exe to make.exe.
Modify vscode’s launch.json to add ,"buildFlags": "--tags=fts5" for debugging fts5.
Test needs to be done manually: go test -v -count=1 -timeout 30s --tags "fts5" -run ^TestVecQuery$ gitee.com/minrag/minrag.
Package: go build --tags "fts5" -ldflags "-w -s".
When recompiling simple, it is recommended to use the precompiled version from https://github.com/wangfenjin/simple.
Note to modify the Windows compilation script, remove the libgcc_s_seh-1.dll and libstdc++-6.dll dependencies for mingw64 compilation, and turn off BUILD_TEST_EXAMPLE as there are conflicts.
rmdir /q /s build
mkdir build && cd build
cmake .. -G "Unix Makefiles" -DBUILD_TEST_EXAMPLE=OFF -DCMAKE_INSTALL_PREFIX=release -DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_EXE_LINKER_FLAGS="-Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic"
make && make install
Backend Management Supports English
The minRAG backend management currently supports both Chinese and English, with the capability to extend to other languages. Language files are located in minragdatadir/locales. By default, the system uses Chinese (zh-CN) upon initial installation. If English is preferred, you can modify the "locale":"zh-CN" to "locale":"en-US" in the minragdatadir/install_config.json file before installation. Alternatively, after successful installation, you can change the Language setting to English in the Settings and restart the system to apply the changes.
Table Structure
ID defaults to timestamp (23 digits) + random number (9 digits), globally unique.
Table creation statement minragdatadir/minrag.sql
Configuration (Table Name: config)
Reads minragdatadir/install_config.json during installation.
| columnName |
Type |
Description |
Remarks |
| id |
string |
Primary Key |
minrag_config |
| base_path |
string |
Base Path |
Default / |
| jwt_secret |
string |
JWT Secret Key |
Randomly generated |
| jwt_token_key |
string |
JWT Key |
Default jwttoken |
| server_port |
string |
IP:Port |
Default :738 |
| timeout |
int |
JWT Timeout in seconds |
Default 7200 |
| max_request_body_size |
int |
Maximum Request Body Size |
Default 20M |
| locale |
string |
Language Pack |
Default zh-CN,en-US |
| proxy |
string |
HTTP Proxy Address |
|
| ai_base_url |
string |
AI base_url |
|
| ai_api_key |
string |
AI api_key |
|
| llm_model |
string |
default LLM Model |
|
| create_time |
string |
Creation Time |
2006-01-02 15:04:05 |
| update_time |
string |
Update Time |
2006-01-02 15:04:05 |
| create_user |
string |
Creator |
Initialized as system |
| sortno |
int |
Sort Order |
Descending |
| status |
int |
Status |
Disabled(0), Enabled(1) |
Userinfo (Table Name: userinfo)
| columnName |
Type |
Description |
Remarks |
| id |
string |
Primary Key |
minrag_admin |
| account |
string |
Login Name |
Default admin |
| passWord |
string |
Password |
- |
| user_name |
string |
Description |
- |
| create_time |
string |
Creation Time |
2006-01-02 15:04:05 |
| update_time |
string |
Update Time |
2006-01-02 15:04:05 |
| create_user |
string |
Creator |
Initialized as system |
| sortno |
int |
Sort Order |
Descending |
| status |
int |
Status |
Disabled(0), Enabled(1) |
| columnName |
Type |
Description |
Remarks |
| id |
string |
Primary Key |
minrag_site |
| title |
string |
Site Name |
- |
| keyword |
string |
Keywords |
- |
| description |
string |
Site Description |
- |
| theme |
string |
Default Theme |
Default is default |
| theme_pc |
string |
PC Theme |
Fetched from cookie first, if not, from Header, then written to cookie, default is default |
| theme_wap |
string |
Mobile Theme |
Fetched from cookie first, if not, from Header, then written to cookie, default is default |
| theme_wx |
string |
WeChat Theme |
Fetched from cookie first, if not, from Header, then written to cookie, default is default |
| logo |
string |
Logo |
- |
| favicon |
string |
Favicon |
- |
| create_time |
string |
Creation Time |
2006-01-02 15:04:05 |
| update_time |
string |
Update Time |
2006-01-02 15:04:05 |
| create_user |
string |
Creator |
Initialized as system |
| sortno |
int |
Sort Order |
Descending |
| status |
int |
Status |
Disabled(0), Enabled(1) |
Knowledge Base (Table Name: knowledge_base)
| columnName |
Type |
Description |
Remarks |
| id |
string |
Primary Key |
URL path, separated by /, e.g., /web/ |
| name |
string |
Knowledge Base Name |
- |
| pid |
string |
Parent Knowledge Base ID |
Parent Knowledge Base ID |
| knowledge_base_type |
int |
Knowledge Base Type |
- |
| create_time |
string |
Creation Time |
2006-01-02 15:04:05 |
| update_time |
string |
Update Time |
2006-01-02 15:04:05 |
| create_user |
string |
Creator |
Initialized as system |
| sortno |
int |
Sort Order |
Descending |
| status |
int |
Status |
Disabled(0), Enabled(1) |
Document (Table Name: document)
| columnName |
Type |
Description |
Tokenized |
Remarks |
| id |
string |
Primary Key |
No |
URL path, separated by /, e.g., /web/nginx-use-hsts |
| name |
string |
Document Name |
No |
- |
| knowledge_base_id |
string |
Knowledge Base ID |
No |
- |
| knowledge_base_name |
string |
Knowledge Base Name |
No |
- |
| toc |
string |
Table of Contents |
No |
- |
| summary |
string |
Summary |
No |
- |
| markdown |
string |
Markdown Content |
No |
- |
| file_path |
string |
File Path |
No |
- |
| file_size |
int |
File Size |
No |
- |
| file_ext |
string |
File Extension |
No |
- |
| create_time |
string |
Creation Time |
- |
2006-01-02 15:04:05 |
| update_time |
string |
Update Time |
- |
2006-01-02 15:04:05 |
| create_user |
string |
Creator |
- |
Initialized as system |
| sortno |
int |
Sort Order |
- |
Descending |
| status |
int |
Status |
- |
Disabled(0), Enabled(1), Processing(2), Failed(3) |
Document Chunk (Table Name: document_chunk)
| columnName |
Type |
Description |
Tokenized |
Remarks |
| id |
string |
Primary Key |
No |
- |
| document_id |
string |
Document ID |
No |
- |
| knowledge_base_id |
string |
Knowledge Base ID |
No |
- |
| knowledge_base_name |
string |
Knowledge Base Name |
No |
- |
| title |
string |
title |
- |
- |
| parent_id |
string |
parent_id |
- |
- |
| pre_id |
string |
pre node ID |
- |
- |
| next_id |
string |
next_id |
- |
- |
| level |
int |
title level |
- |
- |
| markdown |
string |
Markdown Content |
Yes |
Using jieba tokenizer |
| create_time |
string |
Creation Time |
- |
2006-01-02 15:04:05 |
| update_time |
string |
Update Time |
- |
2006-01-02 15:04:05 |
| create_user |
string |
Creator |
- |
Initialized as system |
| sortno |
int |
Sort Order |
- |
Descending |
| status |
int |
Status |
- |
Disabled(0), Enabled(1), Processing(2), Failed(3) |
Component (Table Name: component)
| columnName |
Type |
Description |
Tokenized |
Remarks |
| id |
string |
Primary Key |
No |
- |
| component_type |
string |
Component Type |
No |
- |
| parameter |
string |
Component Parameters |
No |
- |
| create_time |
string |
Creation Time |
- |
2006-01-02 15:04:05 |
| update_time |
string |
Update Time |
- |
2006-01-02 15:04:05 |
| create_user |
string |
Creator |
- |
Initialized as system |
| sortno |
int |
Sort Order |
- |
Descending |
| status |
int |
Status |
- |
Disabled(0), Enabled(1) |
Agent (Table Name: agent)
| columnName |
Type |
Description |
Tokenized |
Remarks |
| id |
string |
Primary Key |
No |
- |
| name |
string |
Agent Name |
No |
- |
| knowledge_base_id |
string |
Knowledge Base ID |
No |
- |
| pipeline_id |
string |
Pipeline ID |
No |
- |
| default_reply |
string |
Default Reply |
No |
- |
| agent_type |
int |
Agent Type |
No |
- |
| agent_prompt |
string |
Agent Prompt |
No |
- |
| avatar |
string |
Agent Avatar |
No |
- |
| welcome |
string |
Welcome Message |
No |
- |
| tools |
string |
Functions to Call |
No |
- |
| memory_length |
int |
Context Memory Length |
No |
- |
| create_time |
string |
Creation Time |
- |
2006-01-02 15:04:05 |
| update_time |
string |
Update Time |
- |
2006-01-02 15:04:05 |
| create_user |
string |
Creator |
- |
Initialized as system |
| sortno |
int |
Sort Order |
- |
Descending |
| status |
int |
Status |
- |
Disabled(0), Enabled(1) |
Conversation (Table Name: conversation)
| Column Name |
Type |
Description |
Tokenized |
Remarks |
| id |
string |
Primary Key |
No |
- |
| name |
string |
Chat Room Name |
No |
- |
| agent_id |
string |
Agent ID |
No |
- |
| pipeline_id |
string |
Pipeline ID |
No |
- |
| knowledge_base_id |
string |
Knowledge Base ID |
No |
- |
| user_id |
string |
User ID |
No |
- |
| create_time |
string |
Creation Time |
No |
2006-01-02 15:04:05 |
Message Log (Table Name: message_log)
| Column Name |
Type |
Description |
Tokenized |
Remarks |
| id |
string |
Primary Key |
No |
- |
| agent_id |
string |
Agent ID |
No |
- |
| conversation_id |
string |
Chat Room ID |
No |
- |
| pipeline_id |
string |
Pipeline ID |
No |
- |
| knowledge_base_id |
string |
Knowledge Base ID |
No |
- |
| user_message |
string |
User’s Message |
No |
- |
| ai_message |
string |
AI’s Response |
No |
- |
| user_id |
string |
User ID |
No |
- |
| create_time |
string |
Creation Time |
No |
2006-01-02 15:04:05 |
Copyright and Software Copyright Description
- The software copyright registration number of this minRAG is 2025SR0616004
- The software copyright of this minRAG is owned by us, and secondary software copyright applications are prohibited. Infringement will be prosecuted
- The copyright of programs developed by developers using minRAG belongs to the developers
- Please retain the copyright without any other restrictions. That is to say, you must include the original license agreement statement in your distribution, whether you distribute it in binary or source code form
- The open-source version is released under the AGPL-3.0 open-source license and is provided for free use, but it is not allowed to release and sell modified and derivative code as closed-source commercial software!
评论