Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

RAG-Anything

> 编程语言
Open source

"RAG-Anything: All-in-One RAG Framework"

22.5K stars0 likes2 views
WebsiteGitHub

About

"RAG-Anything: All-in-One RAG Framework"

🚀 RAG-Anything: All-in-One RAG Framework



🎉 News

  • [2026.06]🎯📢 🎉 LightRAG enables multimodal RAG through native integration of RAG-Anything.
  • [2025.10]🎯📢 🚀 We have released the technical report of RAG-Anything. Access it now to explore our latest research findings.
  • [2025.08]🎯📢 🔍 RAG-Anything now features VLM-Enhanced Query mode! When documents include images, the system seamlessly integrates them into VLM for advanced multimodal analysis, combining visual and textual context for deeper insights.
  • [2025.07]🎯📢 RAG-Anything now features a context configuration module, enabling intelligent integration of relevant contextual information to enhance multimodal content processing.
  • [2025.07]🎯📢 🚀 RAG-Anything now supports multimodal query capabilities, enabling enhanced RAG with seamless processing of text, images, tables, and equations.
  • [2025.07]🎯📢 🎉 RAG-Anything has reached 1k🌟 stars on GitHub! Thank you for your incredible support and valuable contributions to the project.

🌟 System Overview

Next-Generation Multimodal Intelligence

🎯 Key Features


🏗️ Algorithm & Architecture

  </div>
  

  

    

  </div>
  

  

    

  </div>
  

  

    

  </div>
</div>

1. Document Parsing Stage

2. Multi-Modal Content Understanding & Processing

3. Multimodal Analysis Engine

4. Multimodal Knowledge Graph Index

5. Modality-Aware Retrieval


🚀 Quick Start

Initialize Your AI Journey

Installation

Option 1: Install from PyPI (Recommended)

bash
# Basic installation
pip install raganything

# With optional dependencies for extended format support:
pip install 'raganything[all]'              # All optional features
pip install 'raganything[image]'            # Image format conversion (BMP, TIFF, GIF, WebP)
pip install 'raganything[text]'             # Text file processing (TXT, MD)
pip install 'raganything[image,text]'       # Multiple features

Option 2: Install from Source

…

Optional Dependencies

  • [image] - Enables processing of BMP, TIFF, GIF, WebP image formats (requires Pillow)
  • [text] - Enables processing of TXT and MD files (requires ReportLab)
  • [all] - Includes all Python optional dependencies

⚠️ Office Document Processing Requirements:

  • Office documents (.doc, .docx, .ppt, .pptx, .xls, .xlsx) require LibreOffice installation
  • Download from LibreOffice official website
  • Windows: Download installer from official website
  • macOS: brew install --cask libreoffice
  • Ubuntu/Debian: sudo apt-get install libreoffice
  • CentOS/RHEL: sudo yum install libreoffice

Check MinerU installation:

bash
# Verify installation
mineru --version

# Check if properly configured
python -c "from raganything import RAGAnything; rag = RAGAnything(); print('✅ MinerU installed properly' if rag.check_parser_installation() else '❌ MinerU installation issue')"

Models are downloaded automatically on first use. For manual download, refer to MinerU Model Source Configuration.

Usage Examples

1. End-to-End Document Processing

…

2. Direct Multimodal Content Processing

…

3. Batch Processing

python
# Process multiple documents
await rag.process_folder_complete(
    folder_path="./documents",
    output_dir="./output",
    file_extensions=[".pdf", ".docx", ".pptx"],
    recursive=True,
    max_workers=4
)

4. Custom Modal Processors

python
from raganything.modalprocessors import GenericModalProcessor

class CustomModalProcessor(GenericModalProcessor):
    async def process_multimodal_content(self, modal_content, content_type, file_path, entity_name):
        # Your custom processing logic
        enhanced_description = await self.analyze_custom_content(modal_content)
        entity_info = self.create_custom_entity(enhanced_description, entity_name)
        return await self._create_entity_and_chunk(enhanced_description, entity_info, file_path)

5. Query Options

RAG-Anything provides three types of query methods:

Pure Text Queries - Direct knowledge base search using LightRAG:

python
# Different query modes for text queries
text_result_hybrid = await rag.aquery("Your question", mode="hybrid")
text_result_local = await rag.aquery("Your question", mode="local")
text_result_global = await rag.aquery("Your question", mode="global")
text_result_naive = await rag.aquery("Your question", mode="naive")

# Synchronous version
sync_text_result = rag.query("Your question", mode="hybrid")

VLM Enhanced Queries - Automatically analyze images in retrieved context using VLM:

…

Multimodal Queries - Enhanced queries with specific multimodal content analysis:

…

6. Loading Existing LightRAG Instance

…

7. Direct Content List Insertion

For scenarios where you already have a pre-parsed content list (e.g., from external parsers or previous processing), you can directly insert it into RAGAnything without document parsing:

…

Content List Format:

The content_list should follow the standard format with each item being a dictionary containing:

  • Text content: {"type": "text", "text": "content text", "page_idx": 0}
  • Image content: {"type": "image", "img_path": "/absolute/path/to/image.jpg", "image_caption": ["caption"], "image_footnote": ["note"], "page_idx": 1}
  • Table content: {"type": "table", "table_body": "markdown table", "table_caption": ["caption"], "table_footnote": ["note"], "page_idx": 2}
  • Equation content: {"type": "equation", "latex": "LaTeX formula", "text": "description", "page_idx": 3}
  • Generic content: {"type": "custom_type", "content": "any content", "page_idx": 4}
  • Audio content: {"type": "audio", "audio_path": "/absolute/path/to/talk.wav", "audio_caption": ["caption"], "page_idx": 5} — transcribed locally with faster-whisper (timestamped segments); long recordings are windowed into ordered chunks
  • Video content: {"type": "video", "video_path": "/absolute/path/to/demo.mp4", "video_caption": ["caption"], "page_idx": 6} — SceneDetect scene boundaries + keyframe VLM description + audio-track transcription, merged by timestamp

Important Notes:

  • img_path: Must be an absolute path to the image file (e.g., /home/user/images/chart.jpg or C:\Users\user\images\chart.jpg)
  • page_idx: Represents the page number where the content appears in the original document (0-based indexing)
  • Content ordering: Items are processed in the order they appear in the list

This method is particularly useful when:

  • You have content from external parsers (non-MinerU/Docling)
  • You want to process programmatically generated content
  • You need to insert content from multiple sources into a single knowledge base
  • You have cached parsing results that you want to reuse

8. Re-processing Multimodal Content After a Storage Backend Change

By default, process_document_complete and insert_content_list skip multimodal (image/table/equation) processing for a document that is already marked as fully processed, to avoid redundant LLM calls. If you switch to a new graph/vector storage backend (e.g. migrating from the default file-based storage to Neo4j), the new backend will not yet contain the multimodal entities/relations that were written to the old one — see #154.

Pass force_multimodal_reprocess=True to explicitly re-run multimodal processing and re-populate the current storage backend for an already-processed document:

python
# Re-run multimodal processing so the current storage backend has the
# image/table/equation entities and relations (default is False, i.e. no change
# to existing behavior for documents that have not switched backends)
await rag.process_document_complete(
    file_path="path/to/your/document.pdf",
    doc_id="doc-already-processed-id",
    force_multimodal_reprocess=True,
)

# Same flag is available for direct content list insertion
await rag.insert_content_list(
    content_list=content_list,
    doc_id="doc-already-processed-id",
    force_multimodal_reprocess=True,
)

This flag only affects multimodal content; it is opt-in and defaults to False, so existing behavior is unchanged unless you explicitly set it.


🛠️ Examples

Practical Implementation Demos

The examples/ directory contains comprehensive usage examples:

  • raganything_example.py: End-to-end document processing with MinerU
  • modalprocessors_example.py: Direct multimodal content processing
  • office_document_test.py: Office document parsing test with MinerU (no API key required)
  • image_format_test.py: Image format parsing test with MinerU (no API key required)
  • text_format_test.py: Text format parsing test with MinerU (no API key required)

Run examples:

…

🔧 Configuration

System Optimization Parameters

Environment Variables

Create a .env file (refer to .env.example):

bash
OPENAI_API_KEY=your_openai_api_key
OPENAI_BASE_URL=your_base_url  # Optional
OUTPUT_DIR=./output             # Default output directory for parsed documents
PARSER=mineru                   # Parser selection: mineru, docling, or paddleocr
PARSE_METHOD=auto              # Parse method: auto, ocr, or txt

Note: For backward compatibility, legacy environment variable names are still supported:

  • MINERU_PARSE_METHOD is deprecated, please use PARSE_METHOD

Note: API keys are only required for full RAG processing with LLM integration. The parsing test files (office_document_test.py and image_format_test.py) only test parser functionality and do not require API keys.

Troubleshooting and multimodal checklist

  • See docs/multimodal_rag_failure_modes.md for a short checklist of common pipeline issues (OCR, tables, retrieval bias, debugging tips). Related: #207, #213.

Public media URLs (CDN / object storage)

When ingestion runs on a server but your UI or another service needs HTTPS (or S3-style) links to figures, set:

bash
# Base URL for assets (no trailing slash required)
RAGANYTHING_PUBLIC_ASSET_BASE_URL=https://my-bucket.s3.us-east-1.amazonaws.com/prefix
# Filesystem root that should be stripped from absolute paths under that tree
RAGANYTHING_PUBLIC_ASSET_STRIP_PREFIX=/var/rag/output

After parsing, each non-empty img_path, table_img_path, or equation_img_path may gain a sibling field *_public_url while the original path stays on disk for local processing. See #272.

Scope today: this mapping runs in the MinerU parser path only. Other parsers (e.g. Docling) keep working but will not produce *_public_url fields until the helper is wired into their content_list post-processing as well. If only one of the two env vars is set, RAG-Anything logs a warning and skips URL attachment.

Parser Configuration

RAGAnything now supports multiple parsers, each with specific advantages:

MinerU Parser

  • Supports PDF, images, Office documents, and more formats
  • Powerful OCR and table extraction capabilities
  • GPU acceleration support

Docling Parser

  • Optimized for Office documents and HTML files
  • Better document structure preservat

Issues· 111 open

View all issuesOpen on GitHub
  • #374

    Security contact needed — SECURITY.md points to private vulnerability reporting, but it's not enabled

    Updated Sep 29, 2026
  • #372

    [Feature Request]: Chunk-level document updates (add / delete / modify chunks)

    Updated Sep 23, 2026
  • #330

    [Bug]: separate_content() concatenates text blocks before chunking, so page_idx never reaches text chunks

    Updated Sep 15, 2026
  • #256

    [Question]:ERROR:Failed to initialize LightRAG instance

    questionUpdated Sep 8, 2026
  • #149

    [Question]:检索时支持返回图片吗

    questionUpdated Aug 28, 2026
  • #348

    This [Bug]:Image-heavy pages take 100s+ to ingest — ~24 LLM calls per image block

    bugUpdated Aug 28, 2026
  • #304

    [Bug]:TypeError: 'PageChars' while processing xlsx file (excel)

    bugUpdated Aug 13, 2026
  • #73

    [Question]: TypeError: DocProcessingStatus.__init__() got an unexpected keyword argument 'multimodal_processed'

    questionUpdated Aug 12, 2026
  • #332

    [Bug]: multimodal chunks are appended after the doc_status record is written and never added to chunks_list

    Updated Aug 11, 2026
  • #136

    [Question]:我使用中文数据构建了RAG,但是为什么检索出来的内容是英文的?

    questionUpdated May 20, 2026

> Tags

Pythonmulti-modal-ragretrieval-augmented-generation

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言