ragflow
RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding.
Top Related Projects
🦜🔗 Build context-aware reasoning applications
Integrate cutting-edge LLM technology quickly and easily into your apps
LlamaIndex is the leading framework for building LLM-powered agents over your data.
AI orchestration framework to build customizable, production-ready LLM applications. Connect components (models, vector DBs, file converters) to pipelines or agents that can interact with your data. With advanced retrieval methods, it's best suited for building RAG, question answering, semantic search or conversational agent chatbots.
⚡ Langchain apps in production using Jina & FastAPI
Quick Overview
RagFlow is an open-source framework for building Retrieval-Augmented Generation (RAG) applications. It provides a user-friendly interface for creating, managing, and deploying RAG pipelines, making it easier for developers to integrate advanced AI capabilities into their applications.
Pros
- Intuitive visual interface for designing RAG workflows
- Supports integration with various language models and vector databases
- Offers customizable components for data processing and retrieval
- Provides easy deployment options for scalable RAG applications
Cons
- Limited documentation and examples for advanced use cases
- May require additional setup for certain integrations
- Learning curve for users new to RAG concepts
- Potential performance bottlenecks with large-scale datasets
Code Examples
# Initialize RagFlow
from ragflow import RagFlow
rf = RagFlow()
# Create a simple RAG pipeline
pipeline = rf.create_pipeline()
pipeline.add_data_source("documents.csv")
pipeline.add_embedding_model("sentence-transformers/all-MiniLM-L6-v2")
pipeline.add_vector_store("faiss")
pipeline.add_llm("gpt-3.5-turbo")
# Execute the pipeline
result = pipeline.run("What is the capital of France?")
print(result)
# Custom retriever component
from ragflow.components import BaseRetriever
class MyCustomRetriever(BaseRetriever):
def retrieve(self, query, k=3):
# Custom retrieval logic
return [doc1, doc2, doc3]
pipeline.add_custom_retriever(MyCustomRetriever())
# Deploy RAG application
from ragflow.deploy import DeploymentManager
deployer = DeploymentManager()
deployer.package_application(pipeline)
deployer.deploy_to_cloud("aws")
Getting Started
To get started with RagFlow:
-
Install the library:
pip install ragflow
-
Import and initialize RagFlow:
from ragflow import RagFlow rf = RagFlow()
-
Create a basic pipeline:
pipeline = rf.create_pipeline() pipeline.add_data_source("your_data.csv") pipeline.add_embedding_model("sentence-transformers/all-MiniLM-L6-v2") pipeline.add_vector_store("faiss") pipeline.add_llm("gpt-3.5-turbo")
-
Run the pipeline:
result = pipeline.run("Your question here") print(result)
For more advanced usage and customization options, refer to the official documentation.
Competitor Comparisons
🦜🔗 Build context-aware reasoning applications
Pros of LangChain
- Extensive ecosystem with a wide range of integrations and tools
- Well-documented with comprehensive guides and examples
- Large and active community support
Cons of LangChain
- Can be complex for beginners due to its extensive feature set
- May have performance overhead for simpler use cases
- Requires more setup and configuration for basic tasks
Code Comparison
LangChain:
from langchain import OpenAI, LLMChain, PromptTemplate
llm = OpenAI(temperature=0.9)
prompt = PromptTemplate(input_variables=["product"], template="What is a good name for a company that makes {product}?")
chain = LLMChain(llm=llm, prompt=prompt)
print(chain.run("colorful socks"))
RagFlow:
from ragflow import RAGFlow
rag = RAGFlow()
rag.add_document("document.txt")
result = rag.query("What is the main topic of the document?")
print(result)
The code examples show that LangChain offers more flexibility in chain creation and prompt engineering, while RagFlow provides a simpler API for RAG-specific tasks. LangChain's example demonstrates its versatility, whereas RagFlow's code highlights its focus on RAG workflows with a more straightforward interface.
Integrate cutting-edge LLM technology quickly and easily into your apps
Pros of Semantic Kernel
- More mature project with extensive documentation and examples
- Supports multiple programming languages (C#, Python, Java)
- Integrates with various AI services and models beyond OpenAI
Cons of Semantic Kernel
- Steeper learning curve due to its comprehensive feature set
- Requires more setup and configuration for basic use cases
- Heavier resource footprint compared to lighter alternatives
Code Comparison
Semantic Kernel (C#):
var kernel = Kernel.Builder.Build();
var result = await kernel.RunAsync("What is the capital of France?", new OpenAITextCompletionService("API_KEY"));
Console.WriteLine(result);
RAGFlow (Python):
from ragflow import RAGFlow
rag = RAGFlow()
result = rag.query("What is the capital of France?")
print(result)
Key Differences
- Semantic Kernel offers a more flexible and extensible architecture, allowing for complex AI-powered applications
- RAGFlow focuses specifically on Retrieval-Augmented Generation, providing a simpler interface for RAG-based tasks
- Semantic Kernel has broader language support, while RAGFlow is primarily Python-based
- RAGFlow may be easier to set up and use for straightforward RAG implementations
- Semantic Kernel provides more advanced features for AI orchestration and integration with various services
LlamaIndex is the leading framework for building LLM-powered agents over your data.
Pros of LlamaIndex
- More mature project with a larger community and extensive documentation
- Supports a wider range of data sources and indexing methods
- Offers more advanced features like query planning and multi-modal capabilities
Cons of LlamaIndex
- Can be more complex to set up and configure for simple use cases
- May have higher computational requirements for large-scale applications
- Less focus on visual workflow design compared to RAGFlow
Code Comparison
LlamaIndex:
from llama_index import GPTSimpleVectorIndex, Document
documents = [Document(text="sample text")]
index = GPTSimpleVectorIndex.from_documents(documents)
response = index.query("What is the content?")
RAGFlow:
from ragflow import RAGFlow
rag = RAGFlow()
rag.add_document("sample text")
response = rag.query("What is the content?")
Both projects aim to simplify the process of building RAG applications, but LlamaIndex offers more flexibility and features at the cost of increased complexity, while RAGFlow focuses on ease of use and visual workflow design. The choice between them depends on the specific requirements of your project and your familiarity with RAG concepts.
AI orchestration framework to build customizable, production-ready LLM applications. Connect components (models, vector DBs, file converters) to pipelines or agents that can interact with your data. With advanced retrieval methods, it's best suited for building RAG, question answering, semantic search or conversational agent chatbots.
Pros of Haystack
- More mature and established project with a larger community and ecosystem
- Extensive documentation and tutorials for easier onboarding
- Wider range of supported integrations and pre-built components
Cons of Haystack
- Steeper learning curve due to more complex architecture
- Potentially slower performance for certain use cases
- Heavier resource requirements for deployment and operation
Code Comparison
Haystack:
from haystack import Pipeline
from haystack.nodes import EmbeddingRetriever, Ranker
pipeline = Pipeline()
pipeline.add_node(component=EmbeddingRetriever(document_store=document_store), name="Retriever", inputs=["Query"])
pipeline.add_node(component=Ranker(), name="Ranker", inputs=["Retriever"])
RagFlow:
from ragflow import RAGFlow
rag_flow = RAGFlow()
rag_flow.add_retriever("embedding_retriever")
rag_flow.add_ranker("default_ranker")
Both frameworks allow for the creation of pipelines for retrieval and ranking, but Haystack's approach is more verbose and explicit, while RagFlow offers a more streamlined API. Haystack provides more granular control over component configuration, whereas RagFlow aims for simplicity and ease of use.
⚡ Langchain apps in production using Jina & FastAPI
Pros of langchain-serve
- Built on top of the popular LangChain framework, providing a familiar ecosystem for developers
- Offers seamless integration with Jina AI's ecosystem, including neural search capabilities
- Provides a serverless deployment option, simplifying scalability and management
Cons of langchain-serve
- More focused on serving LangChain applications, potentially limiting flexibility for other use cases
- May have a steeper learning curve for developers not familiar with the Jina AI ecosystem
Code Comparison
langchain-serve:
from langchain_serve import serving
@serving
def my_chain():
# LangChain code here
return result
RAGFlow:
from ragflow import RAGFlow
flow = RAGFlow()
flow.add_node("retriever", RetrievalQA)
flow.add_node("generator", LLMChain)
Key Differences
- RAGFlow focuses specifically on Retrieval-Augmented Generation workflows, while langchain-serve is more general-purpose for LangChain applications
- RAGFlow provides a visual flow builder, making it easier for non-technical users to design and implement RAG systems
- langchain-serve offers tighter integration with Jina AI's ecosystem, while RAGFlow is more independent and flexible
Both projects aim to simplify the deployment and management of AI-powered applications, but they cater to slightly different use cases and developer preferences.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Document | Roadmap | Twitter | Discord | Demo
ð Table of Contents
- ð¡ What is RAGFlow?
- ð® Demo
- ð Latest Updates
- ð Key Features
- ð System Architecture
- ð¬ Get Started
- ð§ Configurations
- ð§ Build a docker image without embedding models
- ð§ Build a docker image including embedding models
- ð¨ Launch service from source for development
- ð Documentation
- ð Roadmap
- ð Community
- ð Contributing
ð¡ What is RAGFlow?
RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding. It offers a streamlined RAG workflow for businesses of any scale, combining LLM (Large Language Models) to provide truthful question-answering capabilities, backed by well-founded citations from various complex formatted data.
ð® Demo
Try our demo at https://demo.ragflow.io.
ð¥ Latest Updates
- 2025-05-23 Adds a Python/JavaScript code executor component to Agent.
- 2025-05-05 Supports cross-language query.
- 2025-03-19 Supports using a multi-modal model to make sense of images within PDF or DOCX files.
- 2025-02-28 Combined with Internet search (Tavily), supports reasoning like Deep Research for any LLMs.
- 2024-12-18 Upgrades Document Layout Analysis model in DeepDoc.
- 2024-08-22 Support text to SQL statements through RAG.
ð Stay Tuned
âï¸ Star our repository to stay up-to-date with exciting new features and improvements! Get instant notifications for new releases! ð
ð Key Features
ð "Quality in, quality out"
- Deep document understanding-based knowledge extraction from unstructured data with complicated formats.
- Finds "needle in a data haystack" of literally unlimited tokens.
ð± Template-based chunking
- Intelligent and explainable.
- Plenty of template options to choose from.
ð± Grounded citations with reduced hallucinations
- Visualization of text chunking to allow human intervention.
- Quick view of the key references and traceable citations to support grounded answers.
ð Compatibility with heterogeneous data sources
- Supports Word, slides, excel, txt, images, scanned copies, structured data, web pages, and more.
ð Automated and effortless RAG workflow
- Streamlined RAG orchestration catered to both personal and large businesses.
- Configurable LLMs as well as embedding models.
- Multiple recall paired with fused re-ranking.
- Intuitive APIs for seamless integration with business.
ð System Architecture
ð¬ Get Started
ð Prerequisites
- CPU >= 4 cores
- RAM >= 16 GB
- Disk >= 50 GB
- Docker >= 24.0.0 & Docker Compose >= v2.26.1
- gVisor: Required only if you intend to use the code executor (sandbox) feature of RAGFlow.
[!TIP] If you have not installed Docker on your local machine (Windows, Mac, or Linux), see Install Docker Engine.
ð Start up the server
-
Ensure
vm.max_map_count
>= 262144:To check the value of
vm.max_map_count
:$ sysctl vm.max_map_count
Reset
vm.max_map_count
to a value at least 262144 if it is not.# In this case, we set it to 262144: $ sudo sysctl -w vm.max_map_count=262144
This change will be reset after a system reboot. To ensure your change remains permanent, add or update the
vm.max_map_count
value in /etc/sysctl.conf accordingly:vm.max_map_count=262144
-
Clone the repo:
$ git clone https://github.com/infiniflow/ragflow.git
-
Start up the server using the pre-built Docker images:
[!CAUTION] All Docker images are built for x86 platforms. We don't currently offer Docker images for ARM64. If you are on an ARM64 platform, follow this guide to build a Docker image compatible with your system.
The command below downloads the
v0.19.1-slim
edition of the RAGFlow Docker image. See the following table for descriptions of different RAGFlow editions. To download a RAGFlow edition different fromv0.19.1-slim
, update theRAGFLOW_IMAGE
variable accordingly in docker/.env before usingdocker compose
to start the server. For example: setRAGFLOW_IMAGE=infiniflow/ragflow:v0.19.1
for the full editionv0.19.1
.
$ cd ragflow/docker
# Use CPU for embedding and DeepDoc tasks:
$ docker compose -f docker-compose.yml up -d
# To use GPU to accelerate embedding and DeepDoc tasks:
# docker compose -f docker-compose-gpu.yml up -d
RAGFlow image tag | Image size (GB) | Has embedding models? | Stable? |
---|---|---|---|
v0.19.1 | ≈9 | :heavy_check_mark: | Stable release |
v0.19.1-slim | ≈2 | â | Stable release |
nightly | ≈9 | :heavy_check_mark: | Unstable nightly build |
nightly-slim | ≈2 | â | Unstable nightly build |
-
Check the server status after having the server up and running:
$ docker logs -f ragflow-server
The following output confirms a successful launch of the system:
____ ___ ______ ______ __ / __ \ / | / ____// ____// /____ _ __ / /_/ // /| | / / __ / /_ / // __ \| | /| / / / _, _// ___ |/ /_/ // __/ / // /_/ /| |/ |/ / /_/ |_|/_/ |_|\____//_/ /_/ \____/ |__/|__/ * Running on all addresses (0.0.0.0)
If you skip this confirmation step and directly log in to RAGFlow, your browser may prompt a
network anormal
error because, at that moment, your RAGFlow may not be fully initialized. -
In your web browser, enter the IP address of your server and log in to RAGFlow.
With the default settings, you only need to enter
http://IP_OF_YOUR_MACHINE
(sans port number) as the default HTTP serving port80
can be omitted when using the default configurations. -
In service_conf.yaml.template, select the desired LLM factory in
user_default_llm
and update theAPI_KEY
field with the corresponding API key.See llm_api_key_setup for more information.
The show is on!
ð§ Configurations
When it comes to system configurations, you will need to manage the following files:
- .env: Keeps the fundamental setups for the system, such as
SVR_HTTP_PORT
,MYSQL_PASSWORD
, andMINIO_PASSWORD
. - service_conf.yaml.template: Configures the back-end services. The environment variables in this file will be automatically populated when the Docker container starts. Any environment variables set within the Docker container will be available for use, allowing you to customize service behavior based on the deployment environment.
- docker-compose.yml: The system relies on docker-compose.yml to start up.
The ./docker/README file provides a detailed description of the environment settings and service configurations which can be used as
${ENV_VARS}
in the service_conf.yaml.template file.
To update the default HTTP serving port (80), go to docker-compose.yml and change 80:80
to <YOUR_SERVING_PORT>:80
.
Updates to the above configurations require a reboot of all containers to take effect:
$ docker compose -f docker-compose.yml up -d
Switch doc engine from Elasticsearch to Infinity
RAGFlow uses Elasticsearch by default for storing full text and vectors. To switch to Infinity, follow these steps:
-
Stop all running containers:
$ docker compose -f docker/docker-compose.yml down -v
[!WARNING]
-v
will delete the docker container volumes, and the existing data will be cleared.
-
Set
DOC_ENGINE
in docker/.env toinfinity
. -
Start the containers:
$ docker compose -f docker-compose.yml up -d
[!WARNING] Switching to Infinity on a Linux/arm64 machine is not yet officially supported.
ð§ Build a Docker image without embedding models
This image is approximately 2 GB in size and relies on external LLM and embedding services.
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
docker build --platform linux/amd64 --build-arg LIGHTEN=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim .
ð§ Build a Docker image including embedding models
This image is approximately 9 GB in size. As it includes embedding models, it relies on external LLM services only.
git clone https://github.com/infiniflow/ragflow.git
cd ragflow/
docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly .
ð¨ Launch service from source for development
-
Install uv, or skip this step if it is already installed:
pipx install uv pre-commit
-
Clone the source code and install Python dependencies:
git clone https://github.com/infiniflow/ragflow.git cd ragflow/ uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules uv run download_deps.py pre-commit install
-
Launch the dependent services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose:
docker compose -f docker/docker-compose-base.yml up -d
Add the following line to
/etc/hosts
to resolve all hosts specified in docker/.env to127.0.0.1
:127.0.0.1 es01 infinity mysql minio redis sandbox-executor-manager
-
If you cannot access HuggingFace, set the
HF_ENDPOINT
environment variable to use a mirror site:export HF_ENDPOINT=https://hf-mirror.com
-
If your operating system does not have jemalloc, please install it as follows:
# ubuntu sudo apt-get install libjemalloc-dev # centos sudo yum install jemalloc
-
Launch backend service:
source .venv/bin/activate export PYTHONPATH=$(pwd) bash docker/launch_backend_service.sh
-
Install frontend dependencies:
cd web npm install
-
Launch frontend service:
npm run dev
The following output confirms a successful launch of the system:
-
Stop RAGFlow front-end and back-end service after development is complete:
pkill -f "ragflow_server.py|task_executor.py"
ð Documentation
ð Roadmap
See the RAGFlow Roadmap 2025
ð Community
ð Contributing
RAGFlow flourishes via open-source collaboration. In this spirit, we embrace diverse contributions from the community. If you would like to be a part, review our Contribution Guidelines first.
Top Related Projects
🦜🔗 Build context-aware reasoning applications
Integrate cutting-edge LLM technology quickly and easily into your apps
LlamaIndex is the leading framework for building LLM-powered agents over your data.
AI orchestration framework to build customizable, production-ready LLM applications. Connect components (models, vector DBs, file converters) to pipelines or agents that can interact with your data. With advanced retrieval methods, it's best suited for building RAG, question answering, semantic search or conversational agent chatbots.
⚡ Langchain apps in production using Jina & FastAPI
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot