{"name":"RAG-Anything: The All-in-One Multimodal RAG Framework","description":"RAG-Anything is a comprehensive, all-in-one Retrieval-Augmented Generation (RAG) framework designed to process and query diverse multimodal content. It seamlessly handles text, images, tables, and equations within a single integrated system, eliminating the need for multiple specialized tools. Built on LightRAG, this framework offers advanced multimodal retrieval capabilities for complex documents.","github":"https://github.com/HKUDS/RAG-Anything","url":"https://osrepos.com/repo/hkuds-rag-anything","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/hkuds-rag-anything","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/hkuds-rag-anything.md","json":"https://osrepos.com/repo/hkuds-rag-anything.json","topics":["multi-modal-rag","retrieval-augmented-generation","Python","AI","LLM","Document Processing","Knowledge Graph"],"keywords":["multi-modal-rag","retrieval-augmented-generation","Python","AI","LLM","Document Processing","Knowledge Graph"],"stars":null,"summary":"RAG-Anything is a comprehensive, all-in-one Retrieval-Augmented Generation (RAG) framework designed to process and query diverse multimodal content. It seamlessly handles text, images, tables, and equations within a single integrated system, eliminating the need for multiple specialized tools. Built on LightRAG, this framework offers advanced multimodal retrieval capabilities for complex documents.","content":"## Introduction\n\nRAG-Anything is an innovative, all-in-one Multimodal Document Processing RAG system developed by HKUDS. It addresses the limitations of traditional text-focused RAG systems by providing seamless processing and querying across various content modalities, including text, images, tables, equations, and multimedia. Built upon the LightRAG framework, RAG-Anything offers a unified solution for handling complex documents, making it invaluable for academic research, technical documentation, and enterprise knowledge management.\n\n## Installation\n\nGetting started with RAG-Anything is straightforward. You can install it via PyPI or from the source.\n\n### Option 1: Install from PyPI (Recommended)\n\nbash\n# Basic installation\npip install raganything\n\n# With optional dependencies for extended format support\npip install 'raganything[all]' # All optional features\n\n\n### Option 2: Install from Source\n\nFirst, install `uv` if you haven't already:\nbash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n\nThen, clone the repository and install dependencies:\nbash\ngit clone https://github.com/HKUDS/RAG-Anything.git\ncd RAG-Anything\nuv sync\n\n\n### Optional Dependencies\n\n*   **Office Document Processing**: For `.doc`, `.docx`, `.ppt`, `.pptx`, `.xls`, `.xlsx` files, **LibreOffice** must be installed separately. Refer to the [official LibreOffice website](https://www.libreoffice.org/download/download/){:target=\"_blank\"} for downloads.\n    *   macOS: `brew install --cask libreoffice`\n    *   Ubuntu/Debian: `sudo apt-get install libreoffice`\n*   **Extended Image Formats** (`.bmp`, `.tiff`, `.gif`, `.webp`): Install with `pip install 'raganything[image]'`.\n*   **Text Files** (`.txt`, `.md`): Install with `pip install 'raganything[text]'`.\n\nYou can verify your MinerU installation, which is used for document parsing, by running:\nbash\npython -c \"from raganything import RAGAnything; rag = RAGAnything(); print('? MinerU installed properly' if rag.check_parser_installation() else '? MinerU installation issue')\"\n\n\n## Examples\n\nRAG-Anything provides flexible ways to process and query your documents. Here are a few key examples.\n\n### 1. End-to-End Document Processing\n\nThis example demonstrates how to process a document and then query its content, including multimodal elements.\n\npython\nimport asyncio\nfrom raganything import RAGAnything, RAGAnythingConfig\nfrom lightrag.llm.openai import openai_complete_if_cache, openai_embed\nfrom lightrag.utils import EmbeddingFunc\n\nasync def main():\n    api_key = \"your-api-key\"\n    config = RAGAnythingConfig(\n        working_dir=\"./rag_storage\",\n        parser=\"mineru\",\n        enable_image_processing=True,\n        enable_table_processing=True,\n        enable_equation_processing=True,\n    )\n\n    llm_model_func = lambda prompt, system_prompt=None, history_messages=[], **kwargs: openai_complete_if_cache(\n        \"gpt-4o-mini\", prompt, system_prompt=system_prompt, history_messages=history_messages, api_key=api_key, **kwargs\n    )\n    vision_model_func = lambda prompt, system_prompt=None, history_messages=[], image_data=None, messages=None, **kwargs: openai_complete_if_cache(\n        \"gpt-4o\", \"\", system_prompt=None, history_messages=[], messages=messages if messages else ([{\"role\": \"system\", \"content\": system_prompt}] if system_prompt else []) + [{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": prompt}, {\"type\": \"image_url\", \"image_url\": {\"url\": f\"data:image/jpeg;base64,{image_data}\"}}]}], api_key=api_key, **kwargs\n    ) if image_data else llm_model_func(prompt, system_prompt, history_messages, **kwargs)\n    embedding_func = EmbeddingFunc(\n        embedding_dim=3072, max_token_size=8192, func=lambda texts: openai_embed(texts, model=\"text-embedding-3-large\", api_key=api_key)\n    )\n\n    rag = RAGAnything(\n        config=config, llm_model_func=llm_model_func, vision_model_func=vision_model_func, embedding_func=embedding_func\n    )\n\n    await rag.process_document_complete(\n        file_path=\"path/to/your/document.pdf\", output_dir=\"./output\", parse_method=\"auto\"\n    )\n\n    text_result = await rag.aquery(\"What are the main findings shown in the figures and tables?\", mode=\"hybrid\")\n    print(\"Text query result:\", text_result)\n\n    multimodal_result = await rag.aquery_with_multimodal(\n        \"Explain this formula and its relevance to the document content\",\n        multimodal_content=[{\"type\": \"equation\", \"latex\": \"P(d|q) = \\\\frac{P(q|d) \\\\cdot P(d)}{P(q)}\", \"equation_caption\": \"Document relevance probability\"}],\n        mode=\"hybrid\"\n    )\n    print(\"Multimodal query result:\", multimodal_result)\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n\n\n### 2. Direct Content List Insertion\n\nIf you have pre-parsed content, you can directly insert it into RAG-Anything without document parsing. This is useful for external parsers or programmatically generated content.\n\npython\nimport asyncio\nfrom raganything import RAGAnything, RAGAnythingConfig\nfrom lightrag.llm.openai import openai_complete_if_cache, openai_embed\nfrom lightrag.utils import EmbeddingFunc\n\nasync def insert_content_list_example():\n    api_key = \"your-api-key\"\n    config = RAGAnythingConfig(\n        working_dir=\"./rag_storage\",\n        enable_image_processing=True,\n        enable_table_processing=True,\n        enable_equation_processing=True,\n    )\n\n    llm_model_func = lambda prompt, system_prompt=None, history_messages=[], **kwargs: openai_complete_if_cache(\n        \"gpt-4o-mini\", prompt, system_prompt=system_prompt, history_messages=history_messages, api_key=api_key, **kwargs\n    )\n    vision_model_func = lambda prompt, system_prompt=None, history_messages=[], image_data=None, messages=None, **kwargs: openai_complete_if_cache(\n        \"gpt-4o\", \"\", system_prompt=None, history_messages=[], messages=messages if messages else ([{\"role\": \"system\", \"content\": system_prompt}] if system_prompt else []) + [{\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": prompt}, {\"type\": \"image_url\", \"image_url\": {\"url\": f\"data:image/jpeg;base64,{image_data}\"}}]}], api_key=api_key, **kwargs\n    ) if image_data else llm_model_func(prompt, system_prompt, history_messages, **kwargs)\n    embedding_func = EmbeddingFunc(\n        embedding_dim=3072, max_token_size=8192, func=lambda texts: openai_embed(texts, model=\"text-embedding-3-large\", api_key=api_key)\n    )\n\n    rag = RAGAnything(\n        config=config, llm_model_func=llm_model_func, vision_model_func=vision_model_func, embedding_func=embedding_func\n    )\n\n    content_list = [\n        {\"type\": \"text\", \"text\": \"This is the introduction section of our research paper.\", \"page_idx\": 0},\n        {\"type\": \"image\", \"img_path\": \"/absolute/path/to/figure1.jpg\", \"image_caption\": [\"Figure 1: System Architecture\"], \"page_idx\": 1},\n        {\"type\": \"table\", \"table_body\": \"| Method | Accuracy | F1-Score |\\n|--------|----------|----------|\\n| Ours | 95.2% | 0.94 |\", \"table_caption\": [\"Table 1: Performance Comparison\"], \"page_idx\": 2},\n        {\"type\": \"equation\", \"latex\": \"P(d|q) = \\\\frac{P(q|d) \\\\cdot P(d)}{P(q)}\", \"text\": \"Document relevance probability formula\", \"page_idx\": 3},\n    ]\n\n    await rag.insert_content_list(\n        content_list=content_list, file_path=\"research_paper.pdf\", display_stats=True\n    )\n\n    result = await rag.aquery(\n        \"What are the key findings and performance metrics mentioned in the research?\",\n        mode=\"hybrid\"\n    )\n    print(\"Query result:\", result)\n\nif __name__ == \"__main__\":\n    asyncio.run(insert_content_list_example())\n\n\n## Why Use RAG-Anything?\n\nRAG-Anything stands out as a powerful solution for multimodal RAG due to its comprehensive features:\n\n*   **End-to-End Multimodal Pipeline**: It provides a complete workflow from document ingestion and parsing to intelligent multimodal query answering.\n*   **Universal Document Support**: Seamlessly processes PDFs, Office documents, images, and diverse file formats.\n*   **Specialized Content Analysis**: Features dedicated processors for images, tables, mathematical equations, and heterogeneous content types.\n*   **Multimodal Knowledge Graph**: Automatically extracts entities and discovers cross-modal relationships for enhanced understanding.\n*   **Hybrid Intelligent Retrieval**: Offers advanced search capabilities spanning textual and multimodal content with contextual understanding.\n*   **Unified Framework**: Eliminates the need for multiple specialized tools, providing a single, cohesive interface for querying documents with mixed content.\n\n## Links\n\nExplore RAG-Anything further through these official resources:\n\n*   **GitHub Repository**: [https://github.com/HKUDS/RAG-Anything](https://github.com/HKUDS/RAG-Anything){:target=\"_blank\"}\n*   **arXiv Paper**: [https://arxiv.org/abs/2510.12323](https://arxiv.org/abs/2510.12323){:target=\"_blank\"}\n*   **Based on LightRAG**: [https://github.com/HKUDS/LightRAG](https://github.com/HKUDS/LightRAG){:target=\"_blank\"}\n*   **Related Project, VideoRAG**: [https://github.com/HKUDS/VideoRAG](https://github.com/HKUDS/VideoRAG){:target=\"_blank\"}\n*   **Related Project, MiniRAG**: [https://github.com/HKUDS/MiniRAG](https://github.com/HKUDS/MiniRAG){:target=\"_blank\"}","metrics":{"detailViews":12,"githubClicks":9},"dates":{"published":null,"modified":"2026-01-31T08:01:55.000Z"}}