Convert Figma logo to code with AI

infiniflow logoragflow

RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on deep document understanding.

58,769
5,821
58,769
2,362

Top Related Projects

106,478

🦜🔗 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.

21,304

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:

  1. Install the library:

    pip install ragflow
    
  2. Import and initialize RagFlow:

    from ragflow import RagFlow
    rf = RagFlow()
    
  3. 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")
    
  4. 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

106,478

🦜🔗 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.

21,304

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 Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

README in English 简体中文版自述文件 繁體版中文自述文件 日本語のREADME 한국어 Bahasa Indonesia Português(Brasil)

follow on X(Twitter) Static Badge docker pull infiniflow/ragflow:v0.19.1 Latest Release license Ask DeepWiki

Document | Roadmap | Twitter | Discord | Demo

infiniflow%2Fragflow | Trendshift
📕 Table of Contents

💡 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

  1. 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
    
  2. Clone the repo:

    $ git clone https://github.com/infiniflow/ragflow.git
    
  3. 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 from v0.19.1-slim, update the RAGFLOW_IMAGE variable accordingly in docker/.env before using docker compose to start the server. For example: set RAGFLOW_IMAGE=infiniflow/ragflow:v0.19.1 for the full edition v0.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 tagImage 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
  1. 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.

  2. 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 port 80 can be omitted when using the default configurations.

  3. In service_conf.yaml.template, select the desired LLM factory in user_default_llm and update the API_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, and MINIO_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:

  1. 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.

  1. Set DOC_ENGINE in docker/.env to infinity.

  2. 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

  1. Install uv, or skip this step if it is already installed:

    pipx install uv pre-commit
    
  2. 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
    
  3. 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 to 127.0.0.1:

    127.0.0.1       es01 infinity mysql minio redis sandbox-executor-manager
    
  4. If you cannot access HuggingFace, set the HF_ENDPOINT environment variable to use a mirror site:

    export HF_ENDPOINT=https://hf-mirror.com
    
  5. 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
    
  6. Launch backend service:

    source .venv/bin/activate
    export PYTHONPATH=$(pwd)
    bash docker/launch_backend_service.sh
    
  7. Install frontend dependencies:

    cd web
    npm install
    
  8. Launch frontend service:

    npm run dev
    

    The following output confirms a successful launch of the system:

  9. 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.