RAG-Anything Documentation

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

22,344 stars Python Python 1 file · ~13,034 tokens #multi-modal-rag#retrieval-augmented-generation
RAW Doc

File: README.md

🚀 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

Modern documents increasingly contain diverse multimodal content—text, images, tables, equations, charts, and multimedia—that traditional text-focused RAG systems cannot effectively process. RAG-Anything addresses this challenge as a comprehensive All-in-One Multimodal Document Processing RAG system built on LightRAG.

As a unified solution, RAG-Anything eliminates the need for multiple specialized tools. It provides seamless processing and querying across all content modalities within a single integrated framework. Unlike conventional RAG approaches that struggle with non-textual elements, our all-in-one system delivers comprehensive multimodal retrieval capabilities.

Users can query documents containing interleaved text, visual diagrams, structured tables, and mathematical formulations through one cohesive interface. This consolidated approach makes RAG-Anything particularly valuable for academic research, technical documentation, financial reports, and enterprise knowledge management where rich, mixed-content documents demand a unified processing framework.

🎯 Key Features

  • 🔄 End-to-End Multimodal Pipeline - Complete workflow from document ingestion and parsing to intelligent multimodal query answering
  • 📄 Universal Document Support - Seamless processing of PDFs, Office documents, images, and diverse file formats
  • 🧠 Specialized Content Analysis - Dedicated processors for images, tables, mathematical equations, and heterogeneous content types
  • 🔗 Multimodal Knowledge Graph - Automatic entity extraction and cross-modal relationship discovery for enhanced understanding
  • ⚡ Adaptive Processing Modes - Flexible MinerU-based parsing or direct multimodal content injection workflows
  • 📋 Direct Content List Insertion - Bypass document parsing by directly inserting pre-parsed content lists from external sources
  • 🎯 Hybrid Intelligent Retrieval - Advanced search capabilities spanning textual and multimodal content with contextual understanding

🏗️ Algorithm & Architecture

Core Algorithm

RAG-Anything implements an effective multi-stage multimodal pipeline that fundamentally extends traditional RAG architectures to seamlessly handle diverse content modalities through intelligent orchestration and cross-modal understanding.

text
Document Parsing
  
  →
  
    🧠
    Content Analysis
  
  →
  
    🔍
    Knowledge Graph
  
  →
  
    🎯
    Intelligent Retrieval

1. Document Parsing Stage

The system provides high-fidelity document extraction through adaptive content decomposition. It intelligently segments heterogeneous elements while preserving contextual relationships. Universal format compatibility is achieved via specialized optimized parsers.

Key Components:

  • ⚙️ MinerU Integration: Leverages MinerU for high-fidelity document structure extraction and semantic preservation across complex layouts.

  • 🧩 Adaptive Content Decomposition: Automatically segments documents into coherent text blocks, visual elements, structured tables, mathematical equations, and specialized content types while preserving contextual relationships.

  • 📁 Universal Format Support: Provides comprehensive handling of PDFs, Office documents (DOC/DOCX/PPT/PPTX/XLS/XLSX), images, and emerging formats through specialized parsers with format-specific optimization.

2. Multi-Modal Content Understanding & Processing

The system automatically categorizes and routes content through optimized channels. It uses concurrent pipelines for parallel text and multimodal processing. Document hierarchy and relationships are preserved during transformation.

Key Components:

  • 🎯 Autonomous Content Categorization and Routing: Automatically identify, categorize, and route different content types through optimized execution channels.

  • ⚡ Concurrent Multi-Pipeline Architecture: Implements concurrent execution of textual and multimodal content through dedicated processing pipelines. This approach maximizes throughput efficiency while preserving content integrity.

  • 🏗️ Document Hierarchy Extraction: Extracts and preserves original document hierarchy and inter-element relationships during content transformation.

3. Multimodal Analysis Engine

The system deploys modality-aware processing units for heterogeneous data modalities:

Specialized Analyzers:

  • 🔍 Visual Content Analyzer:

    • Integrate vision model for image analysis.
    • Generates context-aware descriptive captions based on visual semantics.
    • Extracts spatial relationships and hierarchical structures between visual elements.
  • 📊 Structured Data Interpreter:

    • Performs systematic interpretation of tabular and structured data formats.
    • Implements statistical pattern recognition algorithms for data trend analysis.
    • Identifies semantic relationships and dependencies across multiple tabular datasets.
  • 📐 Mathematical Expression Parser:

    • Parses complex mathematical expressions and formulas with high accuracy.
    • Provides native LaTeX format support for seamless integration with academic workflows.
    • Establishes conceptual mappings between mathematical equations and domain-specific knowledge bases.
  • 🔧 Extensible Modality Handler:

    • Provides configurable processing framework for custom and emerging content types.
    • Enables dynamic integration of new modality processors through plugin architecture.
    • Supports runtime configuration of processing pipelines for specialized use cases.

4. Multimodal Knowledge Graph Index

The multi-modal knowledge graph construction module transforms document content into structured semantic representations. It extracts multimodal entities, establishes cross-modal relationships, and preserves hierarchical organization. The system applies weighted relevance scoring for optimized knowledge retrieval.

Core Functions:

  • 🔍 Multi-Modal Entity Extraction: Transforms significant multimodal elements into structured knowledge graph entities. The process includes semantic annotations and metadata preservation.

  • 🔗 Cross-Modal Relationship Mapping: Establishes semantic connections and dependencies between textual entities and multimodal components. This is achieved through automated relationship inference algorithms.

  • 🏗️ Hierarchical Structure Preservation: Maintains original document organization through "belongs_to" relationship chains. These chains preserve logical content hierarchy and sectional dependencies.

  • ⚖️ Weighted Relationship Scoring: Assigns quantitative relevance scores to relationship types. Scoring is based on semantic proximity and contextual significance within the document structure.

5. Modality-Aware Retrieval

The hybrid retrieval system combines vector similarity search with graph traversal algorithms for comprehensive content retrieval. It implements modality-aware ranking mechanisms and maintains relational coherence between retrieved elements to ensure contextually integrated information delivery.

Retrieval Mechanisms:

  • 🔀 Vector-Graph Fusion: Integrates vector similarity search with graph traversal algorithms. This approach leverages both semantic embeddings and structural relationships for comprehensive content retrieval.

  • 📊 Modality-Aware Ranking: Implements adaptive scoring mechanisms that weight retrieval results based on content type relevance. The system adjusts rankings according to query-specific modality preferences.

  • 🔗 Relational Coherence Maintenance: Maintains semantic and structural relationships between retrieved elements. This ensures coherent information delivery and contextual integrity.


🚀 Quick Start

Initialize Your AI Journey

Installation

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

bash
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and setup the project with uv
git clone https://github.com/HKUDS/RAG-Anything.git
cd RAG-Anything

# Install the package and dependencies in a virtual environment
uv sync

# If you encounter network timeouts (especially for opencv packages):
# UV_HTTP_TIMEOUT=120 uv sync

# Run commands directly with uv (recommended approach)
uv run python examples/raganything_example.py --help

# Install with optional dependencies
uv sync --extra image --extra text  # Specific extras
uv sync --all-extras                 # All optional features

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

text
/* Detailed source-code truncated for AI context efficiency. */

2. Direct Multimodal Content Processing

text
/* Detailed source-code truncated for AI context efficiency. */

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:

python
# VLM enhanced query (automatically enabled when vision_model_func is provided)
vlm_result = await rag.aquery(
    "Analyze the charts and figures in the document",
    mode="hybrid"
    # vlm_enhanced=True is automatically set when vision_model_func is available
)

# Manually control VLM enhancement
vlm_enabled = await rag.aquery(
    "What do the images show in this document?",
    mode="hybrid",
    vlm_enhanced=True  # Force enable VLM enhancement
)

vlm_disabled = await rag.aquery(
    "What do the images show in this document?",
    mode="hybrid",
    vlm_enhanced=False  # Force disable VLM enhancement
)

# When documents contain images, VLM can see and analyze them directly
# The system will automatically:
# 1. Retrieve relevant context containing image paths
# 2. Load and encode images as base64
# 3. Send both text context and images to VLM for comprehensive analysis

Multimodal Queries - Enhanced queries with specific multimodal content analysis:

python
# Query with table data
table_result = await rag.aquery_with_multimodal(
    "Compare these performance metrics with the document content",
    multimodal_content=[{
        "type": "table",
        "table_data": """Method,Accuracy,Speed
                        RAGAnything,95.2%,120ms
                        Traditional,87.3%,180ms""",
        "table_caption": "Performance comparison"
    }],
    mode="hybrid"
)

# Query with equation content
equation_result = await rag.aquery_with_multimodal(
    "Explain this formula and its relevance to the document content",
    multimodal_content=[{
        "type": "equation",
        "latex": "P(d|q) = \\frac{P(q|d) \\cdot P(d)}{P(q)}",
        "equation_caption": "Document relevance probability"
    }],
    mode="hybrid"
)

6. Loading Existing LightRAG Instance

text
/* Detailed source-code truncated for AI context efficiency. */

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:

text
/* Detailed source-code truncated for AI context efficiency. */

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}

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

🛠️ 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:

bash
# End-to-end processing with parser selection
python examples/raganything_example.py path/to/document.pdf --api-key YOUR_API_KEY --parser mineru

# Direct modal processing
python examples/modalprocessors_example.py --api-key YOUR_API_KEY

# Office document parsing test (MinerU only)
python examples/office_document_test.py --file path/to/document.docx

# Image format parsing test (MinerU only)
python examples/image_format_test.py --file path/to/image.bmp

# Text format parsing test (MinerU only)
python examples/text_format_test.py --file path/to/document.md

# Check LibreOffice installation
python examples/office_document_test.py --check-libreoffice --file dummy

# Check PIL/Pillow installation
python examples/image_format_test.py --check-pillow --file dummy

# Check ReportLab installation
python examples/text_format_test.py --check-reportlab --file dummy

🔧 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

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 preservation
  • Native support for multiple Office formats

PaddleOCR Parser

  • OCR-focused parser for images and PDFs
  • Produces text blocks compatible with existing content_list processing
  • Supports optional Office/TXT/MD parsing by converting to PDF first

Install PaddleOCR parser extras:

bash
pip install -e ".[paddleocr]"
# or
uv sync --extra paddleocr

Note: PaddleOCR also requires paddlepaddle (CPU/GPU package varies by platform). Install it with the official guide: https://www.paddlepaddle.org.cn/install/quick

MinerU Configuration

bash
# MinerU 2.0 uses command-line parameters instead of config files
# Check available options:
mineru --help

# Common configurations:
mineru -p input.pdf -o output_dir -m auto    # Automatic parsing mode
mineru -p input.pdf -o output_dir -m ocr     # OCR-focused parsing
mineru -p input.pdf -o output_dir -b pipeline --device cuda  # GPU acceleration

You can also configure parsing through RAGAnything parameters:

python
# Basic parsing configuration with parser selection
await rag.process_document_complete(
    file_path="document.pdf",
    output_dir="./output/",
    parse_method="auto",          # or "ocr", "txt"
    parser="mineru"               # Optional: "mineru", "docling", or "paddleocr"
)

# Advanced parsing configuration with special parameters
await rag.process_document_complete(
    file_path="document.pdf",
    output_dir="./output/",
    parse_method="auto",          # Parsing method: "auto", "ocr", "txt"
    parser="mineru",              # Parser selection: "mineru", "docling", or "paddleocr"

    # MinerU special parameters - all supported kwargs:
    lang="ch",                   # Document language for OCR optimization (e.g., "ch", "en", "ja")
    device="cuda:0",             # Inference device: "cpu", "cuda", "cuda:0", "npu", "mps"
    start_page=0,                # Starting page number (0-based, for PDF)
    end_page=10,                 # Ending page number (0-based, for PDF)
    formula=True,                # Enable formula parsing
    table=True,                  # Enable table parsing
    backend="pipeline",          # Parsing backend: pipeline|hybrid-auto-engine|hybrid-http-client|vlm-auto-engine|vlm-http-client.
    source="huggingface",        # Model source: "huggingface", "modelscope", "local"
    # vlm_url="http://127.0.0.1:3000" # Service address when using backend=vlm-http-client

    # Standard RAGAnything parameters
    display_stats=True,          # Display content statistics
    split_by_character=None,     # Optional character to split text by
    doc_id=None                  # Optional document ID
)

Note: MinerU 2.0 no longer uses the magic-pdf.json configuration file. All settings are now passed as command-line parameters or function arguments. RAG-Anything supports multiple document parsers, including MinerU, Docling, and PaddleOCR.

Processing Requirements

Different content types require specific optional dependencies:

  • Office Documents (.doc, .docx, .ppt, .pptx, .xls, .xlsx): Install LibreOffice
  • Extended Image Formats (.bmp, .tiff, .gif, .webp): Install with pip install raganything[image]
  • Text Files (.txt, .md): Install with pip install raganything[text]
  • PaddleOCR Parser (parser="paddleocr"): Install with pip install raganything[paddleocr], then install paddlepaddle for your platform

📋 Quick Install: Use pip install raganything[all] to enable all format support (Python dependencies only - LibreOffice still needs separate installation)


🧪 Supported Content Types

Document Formats

  • PDFs - Research papers, reports, presentations
  • Office Documents - DOC, DOCX, PPT, PPTX, XLS, XLSX
  • Images - JPG, PNG, BMP, TIFF, GIF, WebP
  • Text Files - TXT, MD

Multimodal Elements

  • Images - Photographs, diagrams, charts, screenshots
  • Tables - Data tables, comparison charts, statistical summaries
  • Equations - Mathematical formulas in LaTeX format
  • Generic Content - Custom content types via extensible processors

For installation of format-specific dependencies, see the Configuration section.


📖 Citation

Academic Reference

If you find RAG-Anything useful in your research, please cite our paper:

bibtex
@misc{guo2025raganythingallinoneragframework,
      title={RAG-Anything: All-in-One RAG Framework},
      author={Zirui Guo and Xubin Ren and Lingrui Xu and Jiahao Zhang and Chao Huang},
      year={2025},
      eprint={2510.12323},
      archivePrefix={arXiv},
      primaryClass={cs.AI},
      url={https://arxiv.org/abs/2510.12323},
}

Ecosystem & Extensions

text
**LightRAG**
      <sub>Simple and Fast RAG</sub>
    </a>
  
  
    <a href="https://github.com/HKUDS/VideoRAG">
      
        🎥
      
      **VideoRAG**
      <sub>Extreme Long-Context Video RAG</sub>
    </a>
  
  
    <a href="https://github.com/HKUDS/MiniRAG">
      
        ✨
      
      **MiniRAG**
      <sub>Extremely Simple RAG</sub>
    </a>

🤝 Contribution

Join the Innovation


text
<a href="https://github.com/HKUDS/RAG-Anything" style="text-decoration: none;">
  
</a>
<a href="https://github.com/HKUDS/RAG-Anything/issues" style="text-decoration: none;">
  
</a>
<a href="https://github.com/HKUDS/RAG-Anything/discussions" style="text-decoration: none;">
  
</a>




Building the Future of Multimodal AI

File: docs/context_aware_processing.md

Context-Aware Multimodal Processing in RAGAnything

This document describes the context-aware multimodal processing feature in RAGAnything, which provides surrounding content information to LLMs when analyzing images, tables, equations, and other multimodal content for enhanced accuracy and relevance.

Overview

The context-aware feature enables RAGAnything to automatically extract and provide surrounding text content as context when processing multimodal content. This leads to more accurate and contextually relevant analysis by giving AI models additional information about where the content appears in the document structure.

Key Benefits

  • Enhanced Accuracy: Context helps AI understand the purpose and meaning of multimodal content
  • Semantic Coherence: Generated descriptions align with document context and terminology
  • Automated Integration: Context extraction is automatically enabled during document processing
  • Flexible Configuration: Multiple extraction modes and filtering options

Key Features

1. Configuration Support

  • Integrated Configuration: Complete context options in RAGAnythingConfig
  • Environment Variables: Configure all context parameters via environment variables
  • Dynamic Updates: Runtime configuration updates supported
  • Content Format Control: Configurable content source format detection

2. Automated Integration

  • Auto-Initialization: Modal processors automatically receive tokenizer and context configuration
  • Content Source Setup: Document processing automatically sets content sources for context extraction
  • Position Information: Automatic position info (page_idx, index) passed to processors
  • Batch Processing: Context-aware batch processing for efficient document handling

3. Advanced Token Management

  • Accurate Token Counting: Uses LightRAG's tokenizer for precise token calculation
  • Smart Boundary Preservation: Truncates at sentence/paragraph boundaries
  • Backward Compatibility: Fallback to character truncation when tokenizer unavailable

4. Universal Context Extraction

  • Multiple Formats: Support for MinerU, plain text, custom formats
  • Flexible Modes: Page-based and chunk-based context extraction
  • Content Filtering: Configurable content type filtering
  • Header Support: Optional inclusion of document headers and structure

Configuration

RAGAnythingConfig Parameters

python
# Context Extraction Configuration
context_window: int = 1                    # Context window size (pages/chunks)
context_mode: str = "page"                 # Context mode ("page" or "chunk")
max_context_tokens: int = 2000             # Maximum context tokens
include_headers: bool = True               # Include document headers
include_captions: bool = True              # Include image/table captions
context_filter_content_types: List[str] = ["text"]  # Content types to include
content_format: str = "minerU"             # Default content format for context extraction

Environment Variables

bash
# Context extraction settings
CONTEXT_WINDOW=2
CONTEXT_MODE=page
MAX_CONTEXT_TOKENS=3000
INCLUDE_HEADERS=true
INCLUDE_CAPTIONS=true
CONTEXT_FILTER_CONTENT_TYPES=text,image
CONTENT_FORMAT=minerU

Usage Guide

1. Basic Configuration

python
from raganything import RAGAnything, RAGAnythingConfig

# Create configuration with context settings
config = RAGAnythingConfig(
    context_window=2,
    context_mode="page",
    max_context_tokens=3000,
    include_headers=True,
    include_captions=True,
    context_filter_content_types=["text", "image"],
    content_format="minerU"
)

# Create RAGAnything instance
rag_anything = RAGAnything(
    config=config,
    llm_model_func=your_llm_function,
    embedding_func=your_embedding_function
)

2. Automatic Document Processing

python
# Context is automatically enabled during document processing
await rag_anything.process_document_complete("document.pdf")

3. Manual Content Source Configuration

python
# Set content source for specific content lists
rag_anything.set_content_source_for_context(content_list, "minerU")

# Update context configuration at runtime
rag_anything.update_context_config(
    context_window=1,
    max_context_tokens=1500,
    include_captions=False
)

4. Direct Modal Processor Usage

python
from raganything.modalprocessors import (
    ContextExtractor,
    ContextConfig,
    ImageModalProcessor
)

# Configure context extraction
config = ContextConfig(
    context_window=1,
    context_mode="page",
    max_context_tokens=2000,
    include_headers=True,
    include_captions=True,
    filter_content_types=["text"]
)

# Initialize context extractor
context_extractor = ContextExtractor(config)

# Initialize modal processor with context support
processor = ImageModalProcessor(lightrag, caption_func, context_extractor)

# Set content source
processor.set_content_source(content_list, "minerU")

# Process with context
item_info = {
    "page_idx": 2,
    "index": 5,
    "type": "image"
}

result = await processor.process_multimodal_content(
    modal_content=image_data,
    content_type="image",
    file_path="document.pdf",
    entity_name="Architecture Diagram",
    item_info=item_info
)

Context Modes

Page-Based Context (`context_mode="page"`)

  • Extracts context based on page boundaries
  • Uses page_idx field from content items
  • Suitable for document-structured content
  • Example: Include text from 2 pages before and after current image

Chunk-Based Context (`context_mode="chunk"`)

  • Extracts context based on content item positions
  • Uses sequential position in content list
  • Suitable for fine-grained control
  • Example: Include 5 content items before and after current table

Processing Workflow

1. Document Parsing

text
Document Input → MinerU Parsing → content_list Generation

2. Context Setup

text
content_list → Set as Context Source → All Modal Processors Gain Context Capability

3. Multimodal Processing

text
Multimodal Content → Extract Surrounding Context → Enhanced LLM Analysis → More Accurate Results

Content Source Formats

MinerU Format

json
[
    {
        "type": "text",
        "text": "Document content here...",
        "text_level": 1,
        "page_idx": 0
    },
    {
        "type": "image",
        "img_path": "images/figure1.jpg",
        "image_caption": ["Figure 1: Architecture"],
        "image_footnote": [],
        "page_idx": 1
    }
]

Custom Text Chunks

python
text_chunks = [
    "First chunk of text content...",
    "Second chunk of text content...",
    "Third chunk of text content..."
]

Plain Text

python
full_document = "Complete document text with all content..."

Configuration Examples

High-Precision Context

For focused analysis with minimal context:

python
config = RAGAnythingConfig(
    context_window=1,
    context_mode="page",
    max_context_tokens=1000,
    include_headers=True,
    include_captions=False,
    context_filter_content_types=["text"]
)

Comprehensive Context

For broad analysis with rich context:

python
config = RAGAnythingConfig(
    context_window=2,
    context_mode="page",
    max_context_tokens=3000,
    include_headers=True,
    include_captions=True,
    context_filter_content_types=["text", "image", "table"]
)

Chunk-Based Analysis

For fine-grained sequential context:

python
config = RAGAnythingConfig(
    context_window=5,
    context_mode="chunk",
    max_context_tokens=2000,
    include_headers=False,
    include_captions=False,
    context_filter_content_types=["text"]
)

Performance Optimization

1. Accurate Token Control

  • Uses real tokenizer for precise token counting
  • Avoids exceeding LLM token limits
  • Provides consistent performance

2. Smart Truncation

  • Truncates at sentence boundaries
  • Maintains semantic integrity
  • Adds truncation indicators

3. Caching Optimization

  • Context extraction results can be reused
  • Reduces redundant computation overhead

Advanced Features

Context Truncation

The system automatically truncates context to fit within token limits:

  • Uses actual tokenizer for accurate token counting
  • Attempts to end at sentence boundaries (periods)
  • Falls back to line boundaries if needed
  • Adds "..." indicator for truncated content

Header Formatting

When include_headers=True, headers are formatted with markdown-style prefixes:

text
# Level 1 Header
## Level 2 Header
### Level 3 Header

Caption Integration

When include_captions=True, image and table captions are included as:

text
[Image: Figure 1 caption text]
[Table: Table 1 caption text]

Integration with RAGAnything

The context-aware feature is seamlessly integrated into RAGAnything's workflow:

  1. Automatic Setup: Context extractors are automatically created and configured
  2. Content Source Management: Document processing automatically sets content sources
  3. Processor Integration: All modal processors receive context capabilities
  4. Configuration Consistency: Single configuration system for all context settings

Error Handling

The system includes robust error handling:

  • Gracefully handles missing or invalid content sources
  • Returns empty context for unsupported formats
  • Logs warnings for configuration issues
  • Continues processing even if context extraction fails

Compatibility

  • Backward Compatible: Existing code works without modification
  • Optional Feature: Context can be selectively enabled/disabled
  • Flexible Configuration: Supports multiple configuration combinations

Best Practices

  1. Token Limits: Ensure max_context_tokens doesn't exceed LLM context limits
  2. Performance Impact: Larger context windows increase processing time
  3. Content Quality: Context quality directly affects analysis accuracy
  4. Window Size: Match window size to content structure (documents vs articles)
  5. Content Filtering: Use context_filter_content_types to reduce noise

Troubleshooting

Common Issues

Context Not Extracted

  • Check if set_content_source_for_context() was called
  • Verify item_info contains required fields (page_idx, index)
  • Confirm content source format is correct

Context Too Long/Short

  • Adjust max_context_tokens setting
  • Modify context_window size
  • Check context_filter_content_types configuration

Irrelevant Context

  • Refine context_filter_content_types to exclude noise
  • Reduce context_window size
  • Set include_captions=False if captions are not helpful

Configuration Issues

  • Verify environment variables are set correctly
  • Check RAGAnythingConfig parameter names
  • Ensure content_format matches your data source

Examples

Check out these example files for complete usage demonstrations:

  • Configuration Examples: See how to set up different context configurations
  • Integration Examples: Learn how to integrate context-aware processing into your workflow
  • Custom Processors: Examples of creating custom modal processors with context support

API Reference

For detailed API documentation, see the docstrings in:

  • raganything/modalprocessors.py - Context extraction and modal processors
  • raganything/config.py - Configuration options
  • raganything/raganything.py - Main RAGAnything class integration

File: README_zh.md

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



🎉 新闻

  • [2026.06]🎯📢 🎉 LightRAG 通过原生集成 RAG-Anything 实现多模态 RAG。
  • [2025.10]🎯📢 🚀 我们已发布 [RAG-Anything] 的技术报告(http://arxiv.org/abs/2510.12323),立即访问以了解我们的最新研究成果。
  • [2025.08.12]🎯📢 🔍 RAGAnything 现在支持 VLM增强查询 模式!当文档包含图片时,系统可以自动将图片与文本上下文一起直接传递给VLM进行综合多模态分析。
  • [2025.07.05]🎯📢 RAGAnything 新增上下文配置模块,支持为多模态内容处理添加相关上下文信息。
  • [2025.07.04]🎯📢 RAGAnything 现在支持多模态内容查询,实现了集成文本、图像、表格和公式处理的增强检索生成功能。
  • [2025.07.03]🎯📢 RAGAnything 在GitHub上达到了1K星标🌟!感谢您的支持和贡献。

🌟 系统概述

下一代多模态智能

RAG-Anything是一个综合性多模态文档处理RAG系统。该系统能够无缝处理和查询包含文本、图像、表格、公式等多模态内容的复杂文档,提供完整的检索增强(RAG)生成解决方案。

🎯 核心特性

  • 🔄 端到端多模态处理流水线 - 提供从文档解析到多模态查询响应的完整处理链路,确保系统的一体化运行
  • 📄 多格式文档支持 - 支持PDF、Office文档(DOC/DOCX/PPT/PPTX/XLS/XLSX)、图像等主流文档格式的统一处理和解析
  • 🧠 多模态内容分析引擎 - 针对图像、表格、公式和通用文本内容部署专门的处理器,确保各类内容的精准解析
  • 🔗 基于知识图谱索引 - 实现自动化实体提取和关系构建,建立跨模态的语义连接网络
  • ⚡ 灵活的处理架构 - 支持基于MinerU的智能解析模式和直接多模态内容插入模式,满足不同应用场景需求
  • 📋 直接内容列表插入 - 跳过文档解析,直接插入来自外部源的预解析内容列表,支持多种数据来源整合
  • 🎯 跨模态检索机制 - 实现跨文本和多模态内容的智能检索,提供精准的信息定位和匹配能力

🏗️ 算法原理与架构

核心算法

RAG-Anything 采用灵活的分层架构设计,实现多阶段多模态处理流水线,将传统RAG系统扩展为支持异构内容类型的综合处理平台。

text
文档解析
  
  →
  
    🧠
    内容分析
  
  →
  
    🔍
    知识图谱
  
  →
  
    🎯
    智能检索

1. 文档解析阶段

该系统构建了高精度文档解析平台,通过结构化提取引擎实现多模态元素的完整识别与提取。系统采用自适应内容分解机制,智能分离文档中的文本、图像、表格、公式等异构内容,并保持其语义关联性。同时支持PDF、Office文档、图像等主流格式的统一处理,提供标准化的多模态内容输出。

核心组件:

  • ⚙️ 结构化提取引擎:集成 MinerU 文档解析框架,实现精确的文档结构识别与内容提取,确保多模态元素的完整性和准确性。

  • 🧩 自适应内容分解机制:建立智能内容分离系统,自动识别并提取文档中的文本块、图像、表格、公式等异构元素,保持元素间的语义关联关系。

  • 📁 多格式兼容处理:部署专业化解析器矩阵,支持PDF、Office文档系列(DOC/DOCX/PPT/PPTX/XLS/XLSX)、图像等主流格式的统一处理与标准化输出。

2. 多模态内容理解与处理

该多模态内容处理系统通过自主分类路由机制实现异构内容的智能识别与优化分发。系统采用并发多流水线架构,确保文本和多模态内容的高效并行处理,在最大化吞吐量的同时保持内容完整性,并能完整提取和保持原始文档的层次结构与元素关联关系。

核心组件:

  • 🎯 自主内容分类与路由:自动识别、分类并将不同内容类型路由至优化的执行通道。

  • ⚡ 并发多流水线架构:通过专用处理流水线实现文本和多模态内容的并发执行。这种方法在保持内容完整性的同时最大化吞吐效率。

  • 🏗️ 文档层次结构提取:在内容转换过程中提取并保持原始文档的层次结构和元素间关系。

3. 多模态分析引擎

系统部署了面向异构数据模态的模态感知处理单元:

专用分析器:

  • 🔍 视觉内容分析器:

    • 集成视觉模型进行图像分析和内容识别
    • 基于视觉语义生成上下文感知的描述性标题
    • 提取视觉元素间的空间关系和层次结构
  • 📊 结构化数据解释器:

    • 对表格和结构化数据格式进行系统性解释
    • 实现数据趋势分析的统计模式识别算法
    • 识别多个表格数据集间的语义关系和依赖性
  • 📐 数学表达式解析器:

    • 高精度解析复杂数学表达式和公式
    • 提供原生LaTeX格式支持以实现与学术工作流的无缝集成
    • 建立数学方程与领域特定知识库间的概念映射
  • 🔧 可扩展模态处理器:

    • 为自定义和新兴内容类型提供可配置的处理框架
    • 通过插件架构实现新模态处理器的动态集成
    • 支持专用场景下处理流水线的运行时配置

4. 多模态知识图谱索引

多模态知识图谱构建模块将文档内容转换为结构化语义表示。系统提取多模态实体,建立跨模态关系,并保持层次化组织结构。通过加权相关性评分实现优化的知识检索。

核心功能:

  • 🔍 多模态实体提取:将重要的多模态元素转换为结构化知识图谱实体。该过程包括语义标注和元数据保存。

  • 🔗 跨模态关系映射:在文本实体和多模态组件之间建立语义连接和依赖关系。通过自动化关系推理算法实现这一功能。

  • 🏗️ 层次结构保持:通过"归属于"关系链维护原始文档组织结构。这些关系链保持逻辑内容层次和章节依赖关系。

  • ⚖️ 加权关系评分:为关系类型分配定量相关性分数。评分基于语义邻近性和文档结构内的上下文重要性。

5. 模态感知检索

混合检索系统结合向量相似性搜索与图遍历算法,实现全面的内容检索。系统实现模态感知排序机制,并维护检索元素间的关系一致性,确保上下文集成的信息传递。

检索机制:

  • 🔀 向量-图谱融合:集成向量相似性搜索与图遍历算法。该方法同时利用语义嵌入和结构关系实现全面的内容检索。

  • 📊 模态感知排序:实现基于内容类型相关性的自适应评分机制。系统根据查询特定的模态偏好调整排序结果。

  • 🔗 关系一致性维护:维护检索元素间的语义和结构关系。确保信息传递的连贯性和上下文完整性。


🚀 快速开始

启动您的AI之旅

安装

选项1:从PyPI安装(推荐)

bash
# 基础安装
pip install raganything

# 安装包含扩展格式支持的可选依赖:
pip install 'raganything[all]'              # 所有可选功能
pip install 'raganything[image]'            # 图像格式转换 (BMP, TIFF, GIF, WebP)
pip install 'raganything[text]'             # 文本文件处理 (TXT, MD)
pip install 'raganything[image,text]'       # 多个功能组合

选项2:从源码安装

bash
git clone https://github.com/HKUDS/RAG-Anything.git
cd RAG-Anything
pip install -e .

# 安装可选依赖
pip install -e '.[all]'

可选依赖

  • [image] - 启用BMP、TIFF、GIF、WebP图像格式处理(需要Pillow)
  • [text] - 启用TXT和MD文件处理(需要ReportLab)
  • [all] - 包含所有Python可选依赖

⚠️ Office文档处理配置要求:

  • Office文档 (.doc, .docx, .ppt, .pptx, .xls, .xlsx) 需要安装 LibreOffice
  • 从LibreOffice官网下载安装
  • Windows:从官网下载安装包
  • macOS:brew install --cask libreoffice
  • Ubuntu/Debian:sudo apt-get install libreoffice
  • CentOS/RHEL:sudo yum install libreoffice

检查MinerU安装:

bash
# 验证安装
mineru --version

# 检查是否正确配置
python -c "from raganything import RAGAnything; rag = RAGAnything(); print('✅ MinerU安装正常' if rag.check_parser_installation() else '❌ MinerU安装有问题')"

模型在首次使用时自动下载。手动下载参考MinerU模型源配置:

使用示例

1. 端到端文档处理

text
/* Detailed source-code truncated for AI context efficiency. */

2. 直接多模态内容处理

text
/* Detailed source-code truncated for AI context efficiency. */

3. 批量处理

python
# 处理多个文档
await rag.process_folder_complete(
    folder_path="./documents",
    output_dir="./output",
    file_extensions=[".pdf", ".docx", ".pptx"],
    recursive=True,
    max_workers=4
)

4. 自定义模态处理器

python
from raganything.modalprocessors import GenericModalProcessor

class CustomModalProcessor(GenericModalProcessor):
    async def process_multimodal_content(self, modal_content, content_type, file_path, entity_name):
        # 你的自定义处理逻辑
        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. 查询选项

RAG-Anything 提供三种类型的查询方法:

纯文本查询 - 使用LightRAG直接进行知识库搜索:

python
# 文本查询的不同模式
text_result_hybrid = await rag.aquery("你的问题", mode="hybrid")
text_result_local = await rag.aquery("你的问题", mode="local")
text_result_global = await rag.aquery("你的问题", mode="global")
text_result_naive = await rag.aquery("你的问题", mode="naive")

# 同步版本
sync_text_result = rag.query("你的问题", mode="hybrid")

VLM增强查询 - 使用VLM自动分析检索上下文中的图像:

python
# VLM增强查询(当提供vision_model_func时自动启用)
vlm_result = await rag.aquery(
    "分析文档中的图表和数据",
    mode="hybrid"
    # vlm_enhanced=True 当vision_model_func可用时自动设置
)

# 手动控制VLM增强
vlm_enabled = await rag.aquery(
    "这个文档中的图片显示了什么内容?",
    mode="hybrid",
    vlm_enhanced=True  # 强制启用VLM增强
)

vlm_disabled = await rag.aquery(
    "这个文档中的图片显示了什么内容?",
    mode="hybrid",
    vlm_enhanced=False  # 强制禁用VLM增强
)

# 当文档包含图片时,VLM可以直接查看和分析图片
# 系统将自动:
# 1. 检索包含图片路径的相关上下文
# 2. 加载图片并编码为base64格式
# 3. 将文本上下文和图片一起发送给VLM进行综合分析

多模态查询 - 包含特定多模态内容分析的增强查询:

python
# 包含表格数据的查询
table_result = await rag.aquery_with_multimodal(
    "比较这些性能指标与文档内容",
    multimodal_content=[{
        "type": "table",
        "table_data": """方法,准确率,速度
                        LightRAG,95.2%,120ms
                        传统方法,87.3%,180ms""",
        "table_caption": "性能对比"
    }],
    mode="hybrid"
)

# 包含公式内容的查询
equation_result = await rag.aquery_with_multimodal(
    "解释这个公式及其与文档内容的相关性",
    multimodal_content=[{
        "type": "equation",
        "latex": "P(d|q) = \\frac{P(q|d) \\cdot P(d)}{P(q)}",
        "equation_caption": "文档相关性概率"
    }],
    mode="hybrid"
)

6. 加载已存在的LightRAG实例

text
/* Detailed source-code truncated for AI context efficiency. */

7. 直接插入内容列表

当您已经有预解析的内容列表(例如,来自外部解析器或之前的处理结果)时,可以直接插入到 RAGAnything 中而无需文档解析:

text
/* Detailed source-code truncated for AI context efficiency. */

内容列表格式:

content_list 应遵循标准格式,每个项目都是包含以下内容的字典:

  • 文本内容: {"type": "text", "text": "内容文本", "page_idx": 0}
  • 图像内容: {"type": "image", "img_path": "/absolute/path/to/image.jpg", "image_caption": ["标题"], "image_footnote": ["注释"], "page_idx": 1}
  • 表格内容: {"type": "table", "table_body": "markdown表格", "table_caption": ["标题"], "table_footnote": ["注释"], "page_idx": 2}
  • 公式内容: {"type": "equation", "latex": "LaTeX公式", "text": "描述", "page_idx": 3}
  • 通用内容: {"type": "custom_type", "content": "任何内容", "page_idx": 4}

重要说明:

  • img_path: 必须是图像文件的绝对路径(例如:/home/user/images/chart.jpg 或 C:\Users\user\images\chart.jpg)
  • page_idx: 表示内容在原始文档中出现的页码(从0开始的索引)
  • 内容顺序: 项目按照在列表中出现的顺序进行处理

此方法在以下情况下特别有用:

  • 您有来自外部解析器的内容(非MinerU/Docling)
  • 您想要处理程序化生成的内容
  • 您需要将来自多个源的内容插入到单个知识库中
  • 您有想要重用的缓存解析结果

🛠️ 示例

实际应用演示

examples/ 目录包含完整的使用示例:

  • raganything_example.py:基于MinerU的端到端文档处理
  • modalprocessors_example.py:直接多模态内容处理
  • office_document_test.py:Office文档解析测试(无需API密钥)
  • image_format_test.py:图像格式解析测试(无需API密钥)
  • text_format_test.py:文本格式解析测试(无需API密钥)

运行示例:

bash
# 端到端处理(包含解析器选择)
python examples/raganything_example.py path/to/document.pdf --api-key YOUR_API_KEY --parser mineru

# 直接模态处理
python examples/modalprocessors_example.py --api-key YOUR_API_KEY

# Office文档解析测试(仅MinerU功能)
python examples/office_document_test.py --file path/to/document.docx

# 图像格式解析测试(仅MinerU功能)
python examples/image_format_test.py --file path/to/image.bmp

# 文本格式解析测试(仅MinerU功能)
python examples/text_format_test.py --file path/to/document.md

# 检查LibreOffice安装
python examples/office_document_test.py --check-libreoffice --file dummy

# 检查PIL/Pillow安装
python examples/image_format_test.py --check-pillow --file dummy

# 检查ReportLab安装
python examples/text_format_test.py --check-reportlab --file dummy

注意:API密钥仅在完整RAG处理和LLM集成时需要。解析测试文件(office_document_test.py、image_format_test.py 和 text_format_test.py)仅测试MinerU功能,无需API密钥。


🔧 配置

系统优化参数

环境变量

创建 .env 文件(参考 .env.example):

bash
OPENAI_API_KEY=your_openai_api_key
OPENAI_BASE_URL=your_base_url  # 可选
OUTPUT_DIR=./output             # 解析文档的默认输出目录
PARSER=mineru                   # 解析器选择:mineru 或 docling
PARSE_METHOD=auto              # 解析方法:auto, ocr 或 txt

注意: 为了向后兼容,旧的环境变量名称仍然有效:

  • MINERU_PARSE_METHOD 已弃用,请使用 PARSE_METHOD

解析器配置

RAGAnything 现在支持多种解析器,每种解析器都有其特定的优势:

MinerU 解析器

  • 支持PDF、图像、Office文档等多种格式
  • 强大的OCR和表格提取能力
  • 支持GPU加速

Docling 解析器

  • 专门优化Office文档和HTML文件的解析
  • 更好的文档结构保持
  • 原生支持多种Office格式

MinerU配置

bash
# MinerU 2.0使用命令行参数而不是配置文件
# 查看可用选项:
mineru --help

# 常用配置:
mineru -p input.pdf -o output_dir -m auto    # 自动解析模式
mineru -p input.pdf -o output_dir -m ocr     # OCR重点解析
mineru -p input.pdf -o output_dir -b pipeline --device cuda  # GPU加速

你也可以通过RAGAnything参数配置解析:

python
# 基础解析配置和解析器选择
await rag.process_document_complete(
    file_path="document.pdf",
    output_dir="./output/",
    parse_method="auto",          # 或 "ocr", "txt"
    parser="mineru"               # 可选:"mineru" 或 "docling"
)

# 高级解析配置(包含特殊参数)
await rag.process_document_complete(
    file_path="document.pdf",
    output_dir="./output/",
    parse_method="auto",          # 解析方法:"auto", "ocr", "txt"
    parser="mineru",              # 解析器选择:"mineru" 或 "docling"

    # MinerU特殊参数 - 支持的所有kwargs:
    lang="ch",                   # 文档语言优化(如:"ch", "en", "ja")
    device="cuda:0",             # 推理设备:"cpu", "cuda", "cuda:0", "npu", "mps"
    start_page=0,                # 起始页码(0为基准,适用于PDF)
    end_page=10,                 # 结束页码(0为基准,适用于PDF)
    formula=True,                # 启用公式解析
    table=True,                  # 启用表格解析
    backend="pipeline",          # 解析后端:pipeline|hybrid-auto-engine|hybrid-http-client|vlm-auto-engine|vlm-http-client
    source="huggingface",        # 模型源:"huggingface", "modelscope", "local"
    # vlm_url="http://127.0.0.1:3000" # 当backend=vlm-http-client时,需指定服务地址

    # RAGAnything标准参数
    display_stats=True,          # 显示内容统计信息
    split_by_character=None,     # 可选的文本分割字符
    doc_id=None                  # 可选的文档ID
)

注意:MinerU 2.0不再使用 magic-pdf.json 配置文件。所有设置现在通过命令行参数或函数参数传递。RAG-Anything现在支持多种文档解析器 - 你可以根据需要在MinerU和Docling之间选择。

处理要求

不同内容类型需要特定的可选依赖:

  • Office文档 (.doc, .docx, .ppt, .pptx, .xls, .xlsx): 安装并配置 LibreOffice
  • 扩展图像格式 (.bmp, .tiff, .gif, .webp): 使用 pip install raganything[image] 安装
  • 文本文件 (.txt, .md): 使用 pip install raganything[text] 安装

📋 快速安装: 使用 pip install raganything[all] 启用所有格式支持(仅Python依赖 - LibreOffice仍需单独安装)


🧪 支持的内容类型

文档格式

  • PDF - 研究论文、报告、演示文稿
  • Office文档 - DOC、DOCX、PPT、PPTX、XLS、XLSX
  • 图像 - JPG、PNG、BMP、TIFF、GIF、WebP
  • 文本文件 - TXT、MD

多模态元素

  • 图像 - 照片、图表、示意图、截图
  • 表格 - 数据表、对比图、统计摘要
  • 公式 - LaTeX格式的数学公式
  • 通用内容 - 通过可扩展处理器支持的自定义内容类型

格式特定依赖的安装说明请参见配置部分。


📖 引用

学术参考

bibtex
@misc{guo2025raganythingallinoneragframework,
      title={RAG-Anything: All-in-One RAG Framework},
      author={Zirui Guo and Xubin Ren and Lingrui Xu and Jiahao Zhang and Chao Huang},
      year={2025},
      eprint={2510.12323},
      archivePrefix={arXiv},
      primaryClass={cs.AI},
      url={https://arxiv.org/abs/2510.12323},
}

🔗 相关项目

生态系统与扩展

text
**LightRAG**
      <sub>简单快速的RAG系统</sub>
    </a>
  
  
    <a href="https://github.com/HKUDS/VideoRAG">
      
        🎥
      
      **VideoRAG**
      <sub>超长上下文视频RAG系统</sub>
    </a>
  
  
    <a href="https://github.com/HKUDS/MiniRAG">
      
        ✨
      
      **MiniRAG**
      <sub>极简RAG系统</sub>
    </a>

🤝 贡献者

加入创新


text
<a href="https://github.com/HKUDS/RAG-Anything" style="text-decoration: none;">
  
</a>
<a href="https://github.com/HKUDS/RAG-Anything/issues" style="text-decoration: none;">
  
</a>
<a href="https://github.com/HKUDS/RAG-Anything/discussions" style="text-decoration: none;">
  
</a>




构建多模态AI的未来