meshrag 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meshrag-1.0.0/LICENSE +21 -0
- meshrag-1.0.0/MANIFEST.in +4 -0
- meshrag-1.0.0/NOTICE +12 -0
- meshrag-1.0.0/PKG-INFO +385 -0
- meshrag-1.0.0/README.md +266 -0
- meshrag-1.0.0/lightrag/__init__.py +7 -0
- meshrag-1.0.0/lightrag/api/__init__.py +1 -0
- meshrag-1.0.0/lightrag/api/auth.py +109 -0
- meshrag-1.0.0/lightrag/api/config.py +589 -0
- meshrag-1.0.0/lightrag/api/external_kb_client.py +268 -0
- meshrag-1.0.0/lightrag/api/gunicorn_config.py +162 -0
- meshrag-1.0.0/lightrag/api/lightrag_server.py +1691 -0
- meshrag-1.0.0/lightrag/api/llm_factory.py +307 -0
- meshrag-1.0.0/lightrag/api/rag_manager.py +2017 -0
- meshrag-1.0.0/lightrag/api/registry.py +209 -0
- meshrag-1.0.0/lightrag/api/routers/__init__.py +12 -0
- meshrag-1.0.0/lightrag/api/routers/document_routes.py +4433 -0
- meshrag-1.0.0/lightrag/api/routers/graph_routes.py +737 -0
- meshrag-1.0.0/lightrag/api/routers/ollama_api.py +778 -0
- meshrag-1.0.0/lightrag/api/routers/query_routes.py +1645 -0
- meshrag-1.0.0/lightrag/api/routers/registry_routes.py +250 -0
- meshrag-1.0.0/lightrag/api/run_with_gunicorn.py +282 -0
- meshrag-1.0.0/lightrag/api/static/swagger-ui/favicon-32x32.png +0 -0
- meshrag-1.0.0/lightrag/api/static/swagger-ui/swagger-ui-bundle.js +2 -0
- meshrag-1.0.0/lightrag/api/static/swagger-ui/swagger-ui.css +3 -0
- meshrag-1.0.0/lightrag/api/utils_api.py +438 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- meshrag-1.0.0/lightrag/api/webui/assets/arc-DYhJXBOL.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/architectureDiagram-VXUJARFQ-D9NMPF4e.js +36 -0
- meshrag-1.0.0/lightrag/api/webui/assets/blockDiagram-VD42YOAC-CxEq2npg.js +122 -0
- meshrag-1.0.0/lightrag/api/webui/assets/c4Diagram-YG6GDRKO-Lf93PvOJ.js +10 -0
- meshrag-1.0.0/lightrag/api/webui/assets/channel-BXtDqxR_.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/chunk-4BX2VUAB-CqSR1aut.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/chunk-55IACEB6-BTQ9UTO6.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/chunk-B4BG7PRW-Cn5DVGI2.js +165 -0
- meshrag-1.0.0/lightrag/api/webui/assets/chunk-DI55MBZ5-DxhGfynN.js +220 -0
- meshrag-1.0.0/lightrag/api/webui/assets/chunk-FMBD7UC4-Dn-ygM4b.js +15 -0
- meshrag-1.0.0/lightrag/api/webui/assets/chunk-QN33PNHL-DTW-5i10.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/chunk-QZHKN3VN-Du90MEcU.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/chunk-TZMSLE5B-COJpgEFo.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/classDiagram-2ON5EDUG-Bj029qmo.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/classDiagram-v2-WZHVMYZB-Bj029qmo.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/clone-hXTrbV6b.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/cose-bilkent-S5V4N54A-ztzrGaGR.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/cytoscape.esm-5J0xJHOV.js +321 -0
- meshrag-1.0.0/lightrag/api/webui/assets/dagre-6UL2VRFP-BixxvexV.js +4 -0
- meshrag-1.0.0/lightrag/api/webui/assets/defaultLocale-C4B-KCzX.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/diagram-PSM6KHXK-DdMjU-2l.js +24 -0
- meshrag-1.0.0/lightrag/api/webui/assets/diagram-QEK2KX5R--bW-kATO.js +43 -0
- meshrag-1.0.0/lightrag/api/webui/assets/diagram-S2PKOQOG-Dp_demLf.js +24 -0
- meshrag-1.0.0/lightrag/api/webui/assets/erDiagram-Q2GNP2WA-plX8IRia.js +60 -0
- meshrag-1.0.0/lightrag/api/webui/assets/flowDiagram-NV44I4VS-DtISCBNJ.js +162 -0
- meshrag-1.0.0/lightrag/api/webui/assets/ganttDiagram-JELNMOA3-DkI0SmS_.js +267 -0
- meshrag-1.0.0/lightrag/api/webui/assets/gitGraphDiagram-V2S2FVAM-CO-hc35z.js +65 -0
- meshrag-1.0.0/lightrag/api/webui/assets/graph-CPCuV3C_.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/index-C0Ra6R2k.js +3 -0
- meshrag-1.0.0/lightrag/api/webui/assets/index-YTWDz8XI.css +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/index-eBABlMd0.js +1764 -0
- meshrag-1.0.0/lightrag/api/webui/assets/infoDiagram-HS3SLOUP-xCmix8cZ.js +2 -0
- meshrag-1.0.0/lightrag/api/webui/assets/init-Gi6I4Gst.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/journeyDiagram-XKPGCS4Q-4ZzY1szP.js +139 -0
- meshrag-1.0.0/lightrag/api/webui/assets/kanban-definition-3W4ZIXB7-Df4v75SF.js +89 -0
- meshrag-1.0.0/lightrag/api/webui/assets/layout-DAeEobxq.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/linear-DHPlqM1b.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/mindmap-definition-VGOIOE7T-DfHrkp2z.js +68 -0
- meshrag-1.0.0/lightrag/api/webui/assets/ordinal-BENe2yWM.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/pieDiagram-ADFJNKIX-1k4st0T2.js +30 -0
- meshrag-1.0.0/lightrag/api/webui/assets/quadrantDiagram-AYHSOK5B-DURAK8QM.js +7 -0
- meshrag-1.0.0/lightrag/api/webui/assets/requirementDiagram-UZGBJVZJ-RZlInJog.js +64 -0
- meshrag-1.0.0/lightrag/api/webui/assets/sankeyDiagram-TZEHDZUN-CNaxQjSF.js +10 -0
- meshrag-1.0.0/lightrag/api/webui/assets/sequenceDiagram-WL72ISMW-CaFAQyUz.js +145 -0
- meshrag-1.0.0/lightrag/api/webui/assets/stateDiagram-FKZM4ZOC-B4FRWTvg.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/stateDiagram-v2-4FDKWEC3-C_f0XKLw.js +1 -0
- meshrag-1.0.0/lightrag/api/webui/assets/timeline-definition-IT6M3QCI-CJZgOy-y.js +61 -0
- meshrag-1.0.0/lightrag/api/webui/assets/treemap-GDKQZRPO-CsQaPTHq.js +160 -0
- meshrag-1.0.0/lightrag/api/webui/assets/xychartDiagram-PRI3JC2R-CfA_lR1M.js +7 -0
- meshrag-1.0.0/lightrag/api/webui/index.html +17 -0
- meshrag-1.0.0/lightrag/api/webui/logo.png +0 -0
- meshrag-1.0.0/lightrag/api/webui/meshrag-favicon.png +0 -0
- meshrag-1.0.0/lightrag/base.py +920 -0
- meshrag-1.0.0/lightrag/constants.py +113 -0
- meshrag-1.0.0/lightrag/evaluation/__init__.py +25 -0
- meshrag-1.0.0/lightrag/evaluation/eval_rag_quality.py +1016 -0
- meshrag-1.0.0/lightrag/exceptions.py +155 -0
- meshrag-1.0.0/lightrag/kg/__init__.py +140 -0
- meshrag-1.0.0/lightrag/kg/deprecated/chroma_impl.py +343 -0
- meshrag-1.0.0/lightrag/kg/faiss_impl.py +583 -0
- meshrag-1.0.0/lightrag/kg/json_doc_status_impl.py +426 -0
- meshrag-1.0.0/lightrag/kg/json_kv_impl.py +302 -0
- meshrag-1.0.0/lightrag/kg/memgraph_impl.py +1146 -0
- meshrag-1.0.0/lightrag/kg/milvus_impl.py +1934 -0
- meshrag-1.0.0/lightrag/kg/mongo_impl.py +2519 -0
- meshrag-1.0.0/lightrag/kg/nano_vector_db_impl.py +428 -0
- meshrag-1.0.0/lightrag/kg/neo4j_impl.py +1898 -0
- meshrag-1.0.0/lightrag/kg/networkx_impl.py +570 -0
- meshrag-1.0.0/lightrag/kg/postgres_impl.py +6166 -0
- meshrag-1.0.0/lightrag/kg/qdrant_impl.py +1049 -0
- meshrag-1.0.0/lightrag/kg/redis_impl.py +1165 -0
- meshrag-1.0.0/lightrag/kg/shared_storage.py +1721 -0
- meshrag-1.0.0/lightrag/lightrag.py +4603 -0
- meshrag-1.0.0/lightrag/llm/__init__.py +0 -0
- meshrag-1.0.0/lightrag/llm/anthropic.py +335 -0
- meshrag-1.0.0/lightrag/llm/azure_openai.py +22 -0
- meshrag-1.0.0/lightrag/llm/bedrock.py +485 -0
- meshrag-1.0.0/lightrag/llm/binding_options.py +745 -0
- meshrag-1.0.0/lightrag/llm/deprecated/siliconcloud.py +69 -0
- meshrag-1.0.0/lightrag/llm/gemini.py +610 -0
- meshrag-1.0.0/lightrag/llm/hf.py +177 -0
- meshrag-1.0.0/lightrag/llm/jina.py +157 -0
- meshrag-1.0.0/lightrag/llm/llama_index_impl.py +208 -0
- meshrag-1.0.0/lightrag/llm/lmdeploy.py +154 -0
- meshrag-1.0.0/lightrag/llm/lollms.py +177 -0
- meshrag-1.0.0/lightrag/llm/nvidia_openai.py +68 -0
- meshrag-1.0.0/lightrag/llm/ollama.py +243 -0
- meshrag-1.0.0/lightrag/llm/openai.py +1096 -0
- meshrag-1.0.0/lightrag/llm/zhipu.py +219 -0
- meshrag-1.0.0/lightrag/namespace.py +28 -0
- meshrag-1.0.0/lightrag/operate.py +5226 -0
- meshrag-1.0.0/lightrag/prompt.py +605 -0
- meshrag-1.0.0/lightrag/rerank.py +587 -0
- meshrag-1.0.0/lightrag/tools/__init__.py +0 -0
- meshrag-1.0.0/lightrag/tools/check_initialization.py +179 -0
- meshrag-1.0.0/lightrag/tools/clean_llm_query_cache.py +1144 -0
- meshrag-1.0.0/lightrag/tools/download_cache.py +200 -0
- meshrag-1.0.0/lightrag/tools/lightrag_visualizer/__init__.py +0 -0
- meshrag-1.0.0/lightrag/tools/lightrag_visualizer/graph_visualizer.py +1221 -0
- meshrag-1.0.0/lightrag/tools/migrate_llm_cache.py +1472 -0
- meshrag-1.0.0/lightrag/tools/prepare_qdrant_legacy_data.py +720 -0
- meshrag-1.0.0/lightrag/types.py +29 -0
- meshrag-1.0.0/lightrag/utils.py +3460 -0
- meshrag-1.0.0/lightrag/utils_graph.py +1760 -0
- meshrag-1.0.0/lightrag_webui/node_modules/flatted/python/flatted.py +149 -0
- meshrag-1.0.0/lightrag_webui/node_modules/katex/src/fonts/generate_fonts.py +58 -0
- meshrag-1.0.0/lightrag_webui/node_modules/katex/src/metrics/extract_tfms.py +114 -0
- meshrag-1.0.0/lightrag_webui/node_modules/katex/src/metrics/extract_ttfs.py +122 -0
- meshrag-1.0.0/lightrag_webui/node_modules/katex/src/metrics/format_json.py +28 -0
- meshrag-1.0.0/lightrag_webui/node_modules/katex/src/metrics/parse_tfm.py +211 -0
- meshrag-1.0.0/lightrag_webui/node_modules/micromark-extension-math/node_modules/katex/src/fonts/generate_fonts.py +58 -0
- meshrag-1.0.0/lightrag_webui/node_modules/micromark-extension-math/node_modules/katex/src/metrics/extract_tfms.py +114 -0
- meshrag-1.0.0/lightrag_webui/node_modules/micromark-extension-math/node_modules/katex/src/metrics/extract_ttfs.py +122 -0
- meshrag-1.0.0/lightrag_webui/node_modules/micromark-extension-math/node_modules/katex/src/metrics/format_json.py +28 -0
- meshrag-1.0.0/lightrag_webui/node_modules/micromark-extension-math/node_modules/katex/src/metrics/parse_tfm.py +211 -0
- meshrag-1.0.0/lightrag_webui/node_modules/rehype-katex/node_modules/katex/src/fonts/generate_fonts.py +58 -0
- meshrag-1.0.0/lightrag_webui/node_modules/rehype-katex/node_modules/katex/src/metrics/extract_tfms.py +114 -0
- meshrag-1.0.0/lightrag_webui/node_modules/rehype-katex/node_modules/katex/src/metrics/extract_ttfs.py +122 -0
- meshrag-1.0.0/lightrag_webui/node_modules/rehype-katex/node_modules/katex/src/metrics/format_json.py +28 -0
- meshrag-1.0.0/lightrag_webui/node_modules/rehype-katex/node_modules/katex/src/metrics/parse_tfm.py +211 -0
- meshrag-1.0.0/meshrag.egg-info/PKG-INFO +385 -0
- meshrag-1.0.0/meshrag.egg-info/SOURCES.txt +266 -0
- meshrag-1.0.0/meshrag.egg-info/dependency_links.txt +1 -0
- meshrag-1.0.0/meshrag.egg-info/entry_points.txt +5 -0
- meshrag-1.0.0/meshrag.egg-info/requires.txt +108 -0
- meshrag-1.0.0/meshrag.egg-info/top_level.txt +2 -0
- meshrag-1.0.0/pyproject.toml +188 -0
- meshrag-1.0.0/setup.cfg +4 -0
- meshrag-1.0.0/setup.py +6 -0
- meshrag-1.0.0/tests/test_aquery_data_endpoint.py +781 -0
- meshrag-1.0.0/tests/test_base_models.py +412 -0
- meshrag-1.0.0/tests/test_batch_embeddings.py +223 -0
- meshrag-1.0.0/tests/test_chunking.py +1066 -0
- meshrag-1.0.0/tests/test_description_api_validation.py +148 -0
- meshrag-1.0.0/tests/test_dimension_mismatch.py +377 -0
- meshrag-1.0.0/tests/test_doc_status_chunk_preservation.py +330 -0
- meshrag-1.0.0/tests/test_document_routes.py +662 -0
- meshrag-1.0.0/tests/test_drop_storages.py +125 -0
- meshrag-1.0.0/tests/test_external_kb_client.py +526 -0
- meshrag-1.0.0/tests/test_extract_entities.py +129 -0
- meshrag-1.0.0/tests/test_failed_doc_reparse.py +368 -0
- meshrag-1.0.0/tests/test_faiss_meta_inconsistency.py +163 -0
- meshrag-1.0.0/tests/test_graph_routes.py +346 -0
- meshrag-1.0.0/tests/test_graph_storage.py +1311 -0
- meshrag-1.0.0/tests/test_interactive_setup_outputs.py +5423 -0
- meshrag-1.0.0/tests/test_knowledge_base_api.py +192 -0
- meshrag-1.0.0/tests/test_lightrag_aquery.py +368 -0
- meshrag-1.0.0/tests/test_lightrag_ollama_chat.py +876 -0
- meshrag-1.0.0/tests/test_live_e2e_api.py +518 -0
- meshrag-1.0.0/tests/test_llm_factory.py +355 -0
- meshrag-1.0.0/tests/test_milvus_index_config.py +411 -0
- meshrag-1.0.0/tests/test_milvus_index_creation.py +262 -0
- meshrag-1.0.0/tests/test_milvus_kwargs_bridge.py +296 -0
- meshrag-1.0.0/tests/test_neo4j_fulltext_index.py +314 -0
- meshrag-1.0.0/tests/test_no_model_suffix_safety.py +220 -0
- meshrag-1.0.0/tests/test_ollama_api_unit.py +318 -0
- meshrag-1.0.0/tests/test_openai_default_headers.py +131 -0
- meshrag-1.0.0/tests/test_operate_functions.py +358 -0
- meshrag-1.0.0/tests/test_overlap_validation.py +113 -0
- meshrag-1.0.0/tests/test_overwrite_content_duplicate.py +170 -0
- meshrag-1.0.0/tests/test_pipeline_deletion_resume.py +955 -0
- meshrag-1.0.0/tests/test_postgres_circuit_breaker.py +377 -0
- meshrag-1.0.0/tests/test_postgres_index_name.py +210 -0
- meshrag-1.0.0/tests/test_postgres_migration.py +856 -0
- meshrag-1.0.0/tests/test_postgres_pool_acquire_timeout.py +253 -0
- meshrag-1.0.0/tests/test_postgres_pool_keepalive.py +270 -0
- meshrag-1.0.0/tests/test_postgres_retry_integration.py +350 -0
- meshrag-1.0.0/tests/test_qdrant_migration.py +562 -0
- meshrag-1.0.0/tests/test_qdrant_upsert_batching.py +90 -0
- meshrag-1.0.0/tests/test_query_routes.py +792 -0
- meshrag-1.0.0/tests/test_rag_manager.py +1718 -0
- meshrag-1.0.0/tests/test_rerank_chunking.py +564 -0
- meshrag-1.0.0/tests/test_rerank_progress.py +120 -0
- meshrag-1.0.0/tests/test_rerank_timeout.py +124 -0
- meshrag-1.0.0/tests/test_server_app_api.py +1256 -0
- meshrag-1.0.0/tests/test_server_auth_api.py +257 -0
- meshrag-1.0.0/tests/test_storage_implementations.py +350 -0
- meshrag-1.0.0/tests/test_token_auto_renewal.py +401 -0
- meshrag-1.0.0/tests/test_unified_lock_safety.py +122 -0
- meshrag-1.0.0/tests/test_utils_functions.py +398 -0
- meshrag-1.0.0/tests/test_workspace_isolation.py +1182 -0
- meshrag-1.0.0/tests/test_workspace_migration_isolation.py +288 -0
- meshrag-1.0.0/tests/test_write_json_optimization.py +389 -0
meshrag-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 LightRAG Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
meshrag-1.0.0/NOTICE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
MeshRAG
|
|
2
|
+
Copyright 2026 MeshRAG Team
|
|
3
|
+
|
|
4
|
+
This project is based on LightRAG (https://github.com/HKUDS/LightRAG),
|
|
5
|
+
Copyright 2025 LightRAG Team, licensed under the MIT License.
|
|
6
|
+
|
|
7
|
+
Modifications and additional features — including multi-knowledge-base
|
|
8
|
+
federated query, external knowledge base integration, document management
|
|
9
|
+
APIs, and the deletion/parsing concurrency pipeline — are
|
|
10
|
+
Copyright 2026 MeshRAG Team, also licensed under the MIT License.
|
|
11
|
+
|
|
12
|
+
The original MIT License text is preserved in the LICENSE file.
|
meshrag-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: meshrag
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: MeshRAG: Multi-Knowledge-Base Graph RAG, based on LightRAG
|
|
5
|
+
Author: MeshRAG Team
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/tuxin-labs/meshrag
|
|
8
|
+
Project-URL: Documentation, https://github.com/tuxin-labs/meshrag
|
|
9
|
+
Project-URL: Repository, https://github.com/tuxin-labs/meshrag
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/tuxin-labs/meshrag/issues
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
License-File: NOTICE
|
|
21
|
+
Requires-Dist: aiohttp
|
|
22
|
+
Requires-Dist: configparser
|
|
23
|
+
Requires-Dist: google-api-core<3.0.0,>=2.0.0
|
|
24
|
+
Requires-Dist: google-genai<2.0.0,>=1.0.0
|
|
25
|
+
Requires-Dist: json_repair
|
|
26
|
+
Requires-Dist: nano-vectordb
|
|
27
|
+
Requires-Dist: networkx
|
|
28
|
+
Requires-Dist: numpy<3.0.0,>=1.24.0
|
|
29
|
+
Requires-Dist: packaging
|
|
30
|
+
Requires-Dist: pandas<2.4.0,>=2.0.0
|
|
31
|
+
Requires-Dist: pipmaster
|
|
32
|
+
Requires-Dist: pydantic
|
|
33
|
+
Requires-Dist: pypinyin
|
|
34
|
+
Requires-Dist: python-dotenv
|
|
35
|
+
Requires-Dist: setuptools
|
|
36
|
+
Requires-Dist: tenacity
|
|
37
|
+
Requires-Dist: tiktoken
|
|
38
|
+
Requires-Dist: xlsxwriter>=3.1.0
|
|
39
|
+
Provides-Extra: pytest
|
|
40
|
+
Requires-Dist: pytest>=8.4.2; extra == "pytest"
|
|
41
|
+
Requires-Dist: pytest-asyncio>=1.2.0; extra == "pytest"
|
|
42
|
+
Requires-Dist: pre-commit; extra == "pytest"
|
|
43
|
+
Requires-Dist: ruff; extra == "pytest"
|
|
44
|
+
Provides-Extra: api
|
|
45
|
+
Requires-Dist: aiohttp; extra == "api"
|
|
46
|
+
Requires-Dist: configparser; extra == "api"
|
|
47
|
+
Requires-Dist: json_repair; extra == "api"
|
|
48
|
+
Requires-Dist: nano-vectordb; extra == "api"
|
|
49
|
+
Requires-Dist: networkx; extra == "api"
|
|
50
|
+
Requires-Dist: numpy<3.0.0,>=1.24.0; extra == "api"
|
|
51
|
+
Requires-Dist: openai<3.0.0,>=2.0.0; extra == "api"
|
|
52
|
+
Requires-Dist: pandas<2.4.0,>=2.0.0; extra == "api"
|
|
53
|
+
Requires-Dist: pipmaster; extra == "api"
|
|
54
|
+
Requires-Dist: pydantic; extra == "api"
|
|
55
|
+
Requires-Dist: pypinyin; extra == "api"
|
|
56
|
+
Requires-Dist: python-dotenv; extra == "api"
|
|
57
|
+
Requires-Dist: setuptools; extra == "api"
|
|
58
|
+
Requires-Dist: tenacity; extra == "api"
|
|
59
|
+
Requires-Dist: tiktoken; extra == "api"
|
|
60
|
+
Requires-Dist: xlsxwriter>=3.1.0; extra == "api"
|
|
61
|
+
Requires-Dist: google-api-core<3.0.0,>=2.0.0; extra == "api"
|
|
62
|
+
Requires-Dist: google-genai<2.0.0,>=1.0.0; extra == "api"
|
|
63
|
+
Requires-Dist: aiofiles; extra == "api"
|
|
64
|
+
Requires-Dist: ascii_colors; extra == "api"
|
|
65
|
+
Requires-Dist: distro; extra == "api"
|
|
66
|
+
Requires-Dist: fastapi; extra == "api"
|
|
67
|
+
Requires-Dist: httpcore; extra == "api"
|
|
68
|
+
Requires-Dist: httpx>=0.28.1; extra == "api"
|
|
69
|
+
Requires-Dist: jiter; extra == "api"
|
|
70
|
+
Requires-Dist: bcrypt>=4.0.0; extra == "api"
|
|
71
|
+
Requires-Dist: psutil; extra == "api"
|
|
72
|
+
Requires-Dist: PyJWT<3.0.0,>=2.8.0; extra == "api"
|
|
73
|
+
Requires-Dist: python-jose[cryptography]; extra == "api"
|
|
74
|
+
Requires-Dist: python-multipart; extra == "api"
|
|
75
|
+
Requires-Dist: pytz; extra == "api"
|
|
76
|
+
Requires-Dist: uvicorn; extra == "api"
|
|
77
|
+
Requires-Dist: gunicorn; extra == "api"
|
|
78
|
+
Requires-Dist: openpyxl<4.0.0,>=3.0.0; extra == "api"
|
|
79
|
+
Requires-Dist: pycryptodome<4.0.0,>=3.0.0; extra == "api"
|
|
80
|
+
Requires-Dist: pypdf>=6.1.0; extra == "api"
|
|
81
|
+
Requires-Dist: python-docx<2.0.0,>=0.8.11; extra == "api"
|
|
82
|
+
Requires-Dist: python-pptx<2.0.0,>=0.6.21; extra == "api"
|
|
83
|
+
Provides-Extra: docling
|
|
84
|
+
Requires-Dist: docling<3.0.0,>=2.0.0; sys_platform != "darwin" and extra == "docling"
|
|
85
|
+
Provides-Extra: offline-storage
|
|
86
|
+
Requires-Dist: redis<8.0.0,>=5.0.0; extra == "offline-storage"
|
|
87
|
+
Requires-Dist: neo4j<7.0.0,>=5.0.0; extra == "offline-storage"
|
|
88
|
+
Requires-Dist: pymilvus<3.0.0,>=2.6.15; extra == "offline-storage"
|
|
89
|
+
Requires-Dist: pymongo<5.0.0,>=4.0.0; extra == "offline-storage"
|
|
90
|
+
Requires-Dist: asyncpg<1.0.0,>=0.31.0; extra == "offline-storage"
|
|
91
|
+
Requires-Dist: pgvector<1.0.0,>=0.4.2; extra == "offline-storage"
|
|
92
|
+
Requires-Dist: qdrant-client<2.0.0,>=1.11.0; extra == "offline-storage"
|
|
93
|
+
Provides-Extra: offline-llm
|
|
94
|
+
Requires-Dist: openai<3.0.0,>=2.0.0; extra == "offline-llm"
|
|
95
|
+
Requires-Dist: anthropic<1.0.0,>=0.18.0; extra == "offline-llm"
|
|
96
|
+
Requires-Dist: ollama<1.0.0,>=0.1.0; extra == "offline-llm"
|
|
97
|
+
Requires-Dist: zhipuai<3.0.0,>=2.0.0; extra == "offline-llm"
|
|
98
|
+
Requires-Dist: aioboto3<16.0.0,>=12.0.0; extra == "offline-llm"
|
|
99
|
+
Requires-Dist: voyageai<1.0.0,>=0.2.0; extra == "offline-llm"
|
|
100
|
+
Requires-Dist: llama-index<1.0.0,>=0.14.0; extra == "offline-llm"
|
|
101
|
+
Requires-Dist: llama-index-llms-openai>=0.6.12; extra == "offline-llm"
|
|
102
|
+
Requires-Dist: google-api-core<3.0.0,>=2.0.0; extra == "offline-llm"
|
|
103
|
+
Requires-Dist: google-genai<2.0.0,>=1.0.0; extra == "offline-llm"
|
|
104
|
+
Provides-Extra: offline
|
|
105
|
+
Requires-Dist: meshrag[api,offline-llm,offline-storage]; extra == "offline"
|
|
106
|
+
Provides-Extra: test
|
|
107
|
+
Requires-Dist: meshrag[api]; extra == "test"
|
|
108
|
+
Requires-Dist: pytest>=8.4.2; extra == "test"
|
|
109
|
+
Requires-Dist: pytest-asyncio>=1.2.0; extra == "test"
|
|
110
|
+
Requires-Dist: pre-commit; extra == "test"
|
|
111
|
+
Requires-Dist: ruff; extra == "test"
|
|
112
|
+
Provides-Extra: evaluation
|
|
113
|
+
Requires-Dist: meshrag[api]; extra == "evaluation"
|
|
114
|
+
Requires-Dist: ragas>=0.3.7; extra == "evaluation"
|
|
115
|
+
Requires-Dist: datasets>=4.3.0; extra == "evaluation"
|
|
116
|
+
Provides-Extra: observability
|
|
117
|
+
Requires-Dist: langfuse>=3.8.1; extra == "observability"
|
|
118
|
+
Dynamic: license-file
|
|
119
|
+
|
|
120
|
+
<div align="center">
|
|
121
|
+
|
|
122
|
+
# MeshRAG
|
|
123
|
+
|
|
124
|
+
**Multi-Knowledge-Base Graph RAG engine, based on [LightRAG](https://github.com/HKUDS/LightRAG)**
|
|
125
|
+
|
|
126
|
+
[中文文档](README-zh.md) · [License](#license) · Python 3.10+
|
|
127
|
+
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
> [!NOTE]
|
|
131
|
+
> MeshRAG is a fork of [HKUDS/LightRAG](https://github.com/HKUDS/LightRAG) (v1.4.11, upstream state as of 2026-03-08), redistributed under the MIT License with gratitude to the upstream team.
|
|
132
|
+
> The Python module is still `import lightrag` for ecosystem compatibility; the distribution is `pip install meshrag`.
|
|
133
|
+
> Inherited upstream documentation is preserved in [docs/LightRAG-upstream-usage.md](docs/LightRAG-upstream-usage.md).
|
|
134
|
+
|
|
135
|
+
## Why MeshRAG
|
|
136
|
+
|
|
137
|
+
MeshRAG keeps the LightRAG graph-RAG engine (entity/relation extraction, multi-mode graph retrieval, pluggable storage) and adds what production multi-team deployments need:
|
|
138
|
+
|
|
139
|
+
### 🔀 Multi-knowledge-base federated query
|
|
140
|
+
|
|
141
|
+
One API call retrieves from **multiple local knowledge bases together with
|
|
142
|
+
registered external knowledge bases** (`external_kbs`):
|
|
143
|
+
|
|
144
|
+
1. All sources are queried in parallel: each local KB returns chunks + knowledge
|
|
145
|
+
graph context; `retrieval`-type external services return chunks, while
|
|
146
|
+
`rag`-type external services return ready-made answers
|
|
147
|
+
2. Chunks from every source land in one pool for global deduplication and budget control
|
|
148
|
+
3. Cross-source chunk reranking (with optional reranker)
|
|
149
|
+
4. Reference/citation rebuilding so answers cite the right KB or external service
|
|
150
|
+
5. LLM answer generation with the merged context — a single `rag`-type external
|
|
151
|
+
answer is passed through as-is, several are synthesized by the LLM
|
|
152
|
+
|
|
153
|
+
One failing external service never fails the whole query — its error is reported
|
|
154
|
+
in `metadata.external_kb_errors` while the remaining sources answer normally.
|
|
155
|
+
|
|
156
|
+
### 🌐 External knowledge base integration
|
|
157
|
+
|
|
158
|
+
Federate **external retrieval/RAG APIs** into the same query flow via `external_kbs`:
|
|
159
|
+
|
|
160
|
+
- `retrieval` type: the external API returns similar text chunks; MeshRAG's LLM generates the answer
|
|
161
|
+
- `rag` type: the external API is a full RAG service and returns a final answer
|
|
162
|
+
|
|
163
|
+
Registry endpoints under `/external_kbs` manage connection profiles with a
|
|
164
|
+
built-in connectivity test per entry; queries can pass inline configs via
|
|
165
|
+
`external_kbs` or reference registered profiles by id via `external_kb_ids`;
|
|
166
|
+
and `POST /ext/retrieval` ships a mock `retrieval`-type service (backed by your
|
|
167
|
+
own KBs) for integration testing.
|
|
168
|
+
|
|
169
|
+
### 🗂️ Knowledge-base lifecycle APIs
|
|
170
|
+
|
|
171
|
+
Create, list, and delete knowledge bases at runtime — query them alone or federated:
|
|
172
|
+
|
|
173
|
+
- `GET /knowledge_bases` — list knowledge bases
|
|
174
|
+
- `GET /knowledge_bases/stats` — per-KB document and entity counts in one call
|
|
175
|
+
- `POST /knowledge_bases` / `DELETE /knowledge_bases/{kb_id}` — provision or remove a KB
|
|
176
|
+
- `POST /query/data` — retrieval-only variant of `/query`: returns the entities,
|
|
177
|
+
relationships, chunks, and references that were hit, without LLM generation
|
|
178
|
+
|
|
179
|
+
### 📄 Document management APIs
|
|
180
|
+
|
|
181
|
+
Upload/status pipeline plus direct text ingestion without files
|
|
182
|
+
(`POST /documents/text`, batch via `/documents/texts`), and fast
|
|
183
|
+
single-document lookup by file path —
|
|
184
|
+
`GET /documents/by_file_path?kb_id=...&file_path=...` — avoiding expensive
|
|
185
|
+
pagination when the document set is large.
|
|
186
|
+
|
|
187
|
+
### 🔒 Deletion/parsing concurrency pipeline
|
|
188
|
+
|
|
189
|
+
Cooperative cancellation and deletion semantics with crash recovery:
|
|
190
|
+
deletion requests take priority over in-flight processing, interrupted
|
|
191
|
+
documents resume instead of being reset, and transient failures do not get
|
|
192
|
+
misreported as permanent failures.
|
|
193
|
+
|
|
194
|
+
### 🖥️ Management WebUI
|
|
195
|
+
|
|
196
|
+
The bundled React UI (`lightrag_webui`) mirrors the API for day-to-day operation:
|
|
197
|
+
|
|
198
|
+

|
|
199
|
+
|
|
200
|
+
- **Documents** — upload files or paste text, watch the parsing pipeline, rescan/retry
|
|
201
|
+
- **Knowledge Graph** — browse and edit entities and relations (create, edit, merge)
|
|
202
|
+
- **Retrieval** — chat-style playground with a per-query mode/parameter panel, KB
|
|
203
|
+
selectors, streaming answers with citations, and a retrieval dry-run inspector
|
|
204
|
+
that shows the raw hits (entities/relations/chunks) behind an answer
|
|
205
|
+
- **Models** — register LLM profiles server-side and pick one per query;
|
|
206
|
+
API keys never reach the browser
|
|
207
|
+
- **External KBs** — manage and test federation targets
|
|
208
|
+
- Localized UI in 11 languages
|
|
209
|
+
|
|
210
|
+
### 🧬 Everything inherited from LightRAG
|
|
211
|
+
|
|
212
|
+
- Graph-based knowledge representation with local / global / hybrid / naive / mix / bypass query modes
|
|
213
|
+
- Pluggable storage backends (JSON, Redis, PostgreSQL, MongoDB, Milvus, Qdrant, Neo4j, Memgraph, Faiss, NetworkX)
|
|
214
|
+
- WebUI, Ollama-compatible API, streaming responses
|
|
215
|
+
- Workspace isolation for multi-tenant deployment
|
|
216
|
+
|
|
217
|
+
## Quick Start
|
|
218
|
+
|
|
219
|
+
### Install
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
pip install meshrag # core
|
|
223
|
+
pip install "meshrag[api]" # with API server support
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### A simple program
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
import os
|
|
230
|
+
import asyncio
|
|
231
|
+
from lightrag import LightRAG, QueryParam
|
|
232
|
+
from lightrag.llm.openai import gpt_4o_mini_complete, openai_embed
|
|
233
|
+
from lightrag.utils import setup_logger
|
|
234
|
+
|
|
235
|
+
setup_logger("lightrag", level="INFO")
|
|
236
|
+
|
|
237
|
+
WORKING_DIR = "./rag_storage"
|
|
238
|
+
if not os.path.exists(WORKING_DIR):
|
|
239
|
+
os.mkdir(WORKING_DIR)
|
|
240
|
+
|
|
241
|
+
async def initialize_rag():
|
|
242
|
+
rag = LightRAG(
|
|
243
|
+
working_dir=WORKING_DIR,
|
|
244
|
+
embedding_func=openai_embed,
|
|
245
|
+
llm_model_func=gpt_4o_mini_complete,
|
|
246
|
+
)
|
|
247
|
+
# IMPORTANT: Both initialization calls are required!
|
|
248
|
+
await rag.initialize_storages() # Initialize storage backends
|
|
249
|
+
return rag
|
|
250
|
+
|
|
251
|
+
async def main():
|
|
252
|
+
rag = await initialize_rag()
|
|
253
|
+
await rag.ainsert("Your text")
|
|
254
|
+
result = await rag.aquery(
|
|
255
|
+
"Your question", param=QueryParam(mode="hybrid")
|
|
256
|
+
)
|
|
257
|
+
print(result)
|
|
258
|
+
await rag.finalize_storages() # REQUIRED for cleanup
|
|
259
|
+
|
|
260
|
+
asyncio.run(main())
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### ⚠️ Important: Initialization Requirements
|
|
264
|
+
|
|
265
|
+
**MeshRAG requires explicit initialization before use.** You must call
|
|
266
|
+
`await rag.initialize_storages()` after creating a `LightRAG` instance, and
|
|
267
|
+
`await rag.finalize_storages()` for cleanup — otherwise you will encounter
|
|
268
|
+
errors such as `AttributeError: __aenter__`.
|
|
269
|
+
|
|
270
|
+
### API server
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
cp env.example .env # or run `make env-base` for the interactive wizard
|
|
274
|
+
meshrag-server # production
|
|
275
|
+
meshrag-gunicorn # multi-worker
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Docker:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
docker compose up -d # uses ghcr.io/tuxin-labs/meshrag
|
|
282
|
+
docker build -t meshrag . # full image (frontend + backend)
|
|
283
|
+
docker build -f Dockerfile.lite . # lite image (API + offline storage only)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Multi-KB query example
|
|
287
|
+
|
|
288
|
+
`POST /query` accepts `kb_ids` (local KBs) and `external_kbs` in the same request:
|
|
289
|
+
|
|
290
|
+
```json
|
|
291
|
+
{
|
|
292
|
+
"query": "Which contracts mention data-residency requirements?",
|
|
293
|
+
"mode": "mix",
|
|
294
|
+
"kb_ids": ["contracts-2025", "policies"],
|
|
295
|
+
"external_kbs": [
|
|
296
|
+
{
|
|
297
|
+
"type": "retrieval",
|
|
298
|
+
"url": "https://kb.example.com/api/search",
|
|
299
|
+
"api_key": "sk-...",
|
|
300
|
+
"top_k": 5
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Results from all sources are deduplicated, reranked, and cited in one answer.
|
|
307
|
+
See the field descriptions in `lightrag/api/routers/query_routes.py` for the
|
|
308
|
+
full contract of each external KB type.
|
|
309
|
+
|
|
310
|
+
## Query Modes
|
|
311
|
+
|
|
312
|
+
| Mode | Description |
|
|
313
|
+
|---|---|
|
|
314
|
+
| `local` | Context-dependent retrieval focused on specific entities |
|
|
315
|
+
| `global` | Community/summary-based broad knowledge retrieval |
|
|
316
|
+
| `hybrid` | Combines local and global |
|
|
317
|
+
| `naive` | Direct vector search without graph |
|
|
318
|
+
| `mix` | Integrates KG and vector retrieval (recommended with a reranker) |
|
|
319
|
+
| `bypass` | Skip retrieval; send conversation history and the question straight to the LLM |
|
|
320
|
+
|
|
321
|
+
## Storage Backends
|
|
322
|
+
|
|
323
|
+
| Layer | Backends |
|
|
324
|
+
|---|---|
|
|
325
|
+
| KV (LLM cache, chunks, doc info) | JSON (default), Redis, PostgreSQL, MongoDB |
|
|
326
|
+
| Vector (embeddings) | NanoVectorDB (default), Faiss, Milvus, Qdrant, PostgreSQL, MongoDB |
|
|
327
|
+
| Graph (entity-relation) | NetworkX (default), Neo4j, PostgreSQL+AGE, MongoDB, Memgraph |
|
|
328
|
+
| Doc status | JSON (default), Redis, PostgreSQL, MongoDB |
|
|
329
|
+
|
|
330
|
+
Configure via environment variables — see [env.example](env.example) for the
|
|
331
|
+
full annotated list, including `LIGHTRAG_SSL_VERIFY` for deployments with
|
|
332
|
+
self-signed TLS certificates.
|
|
333
|
+
|
|
334
|
+
## Documentation
|
|
335
|
+
|
|
336
|
+
- [docs/LightRAG-upstream-usage.md](docs/LightRAG-upstream-usage.md) — inherited engine documentation (configuration, storage setup, API details)
|
|
337
|
+
- [docs/external_kb_usage.md](docs/external_kb_usage.md) — external knowledge base integration guide (Chinese)
|
|
338
|
+
- [CHANGELOG.md](CHANGELOG.md) — release notes
|
|
339
|
+
- [docs/OfflineDeployment.md](docs/OfflineDeployment.md) — air-gapped deployment
|
|
340
|
+
- [docs/DockerDeployment.md](docs/DockerDeployment.md) — Docker deployment
|
|
341
|
+
- [docs/FrontendBuildGuide.md](docs/FrontendBuildGuide.md) — WebUI build
|
|
342
|
+
- [docs/InteractiveSetup.md](docs/InteractiveSetup.md) — interactive `.env` wizard
|
|
343
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — development and PR guidelines
|
|
344
|
+
|
|
345
|
+
## Development
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
# Backend
|
|
349
|
+
uv sync # core package
|
|
350
|
+
uv sync --extra api # API server support
|
|
351
|
+
uv sync --extra test # testing dependencies
|
|
352
|
+
|
|
353
|
+
uv run ruff check . # lint
|
|
354
|
+
uv run pytest tests/ # offline suite (pass --run-integration for live services)
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Interactive configuration wizard (writes `.env`, assembles `docker-compose.final.yml`):
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
make env-base # LLM, embedding, reranker (run first)
|
|
361
|
+
make env-storage # storage backends (optional)
|
|
362
|
+
make env-server # port / security / SSL (optional)
|
|
363
|
+
make env-validate # validate an existing .env
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
WebUI (React 19 + TypeScript; Bun is mandatory):
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
cd lightrag_webui
|
|
370
|
+
bun install
|
|
371
|
+
bun run dev # dev server with hot reload
|
|
372
|
+
bun run build # production bundle → lightrag/api/webui
|
|
373
|
+
bun test
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
## License
|
|
377
|
+
|
|
378
|
+
MeshRAG is licensed under the [MIT License](LICENSE).
|
|
379
|
+
Copyright 2026 MeshRAG Team; original LightRAG code Copyright 2025 LightRAG Team.
|
|
380
|
+
See [NOTICE](NOTICE) for details.
|
|
381
|
+
|
|
382
|
+
## Acknowledgements
|
|
383
|
+
|
|
384
|
+
- [LightRAG (HKUDS)](https://github.com/HKUDS/LightRAG) — the engine this project is built on. If MeshRAG is useful to you, please also star the upstream project.
|
|
385
|
+
- LightRAG paper: [arXiv:2410.05779](https://arxiv.org/abs/2410.05779)
|
meshrag-1.0.0/README.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# MeshRAG
|
|
4
|
+
|
|
5
|
+
**Multi-Knowledge-Base Graph RAG engine, based on [LightRAG](https://github.com/HKUDS/LightRAG)**
|
|
6
|
+
|
|
7
|
+
[中文文档](README-zh.md) · [License](#license) · Python 3.10+
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
> [!NOTE]
|
|
12
|
+
> MeshRAG is a fork of [HKUDS/LightRAG](https://github.com/HKUDS/LightRAG) (v1.4.11, upstream state as of 2026-03-08), redistributed under the MIT License with gratitude to the upstream team.
|
|
13
|
+
> The Python module is still `import lightrag` for ecosystem compatibility; the distribution is `pip install meshrag`.
|
|
14
|
+
> Inherited upstream documentation is preserved in [docs/LightRAG-upstream-usage.md](docs/LightRAG-upstream-usage.md).
|
|
15
|
+
|
|
16
|
+
## Why MeshRAG
|
|
17
|
+
|
|
18
|
+
MeshRAG keeps the LightRAG graph-RAG engine (entity/relation extraction, multi-mode graph retrieval, pluggable storage) and adds what production multi-team deployments need:
|
|
19
|
+
|
|
20
|
+
### 🔀 Multi-knowledge-base federated query
|
|
21
|
+
|
|
22
|
+
One API call retrieves from **multiple local knowledge bases together with
|
|
23
|
+
registered external knowledge bases** (`external_kbs`):
|
|
24
|
+
|
|
25
|
+
1. All sources are queried in parallel: each local KB returns chunks + knowledge
|
|
26
|
+
graph context; `retrieval`-type external services return chunks, while
|
|
27
|
+
`rag`-type external services return ready-made answers
|
|
28
|
+
2. Chunks from every source land in one pool for global deduplication and budget control
|
|
29
|
+
3. Cross-source chunk reranking (with optional reranker)
|
|
30
|
+
4. Reference/citation rebuilding so answers cite the right KB or external service
|
|
31
|
+
5. LLM answer generation with the merged context — a single `rag`-type external
|
|
32
|
+
answer is passed through as-is, several are synthesized by the LLM
|
|
33
|
+
|
|
34
|
+
One failing external service never fails the whole query — its error is reported
|
|
35
|
+
in `metadata.external_kb_errors` while the remaining sources answer normally.
|
|
36
|
+
|
|
37
|
+
### 🌐 External knowledge base integration
|
|
38
|
+
|
|
39
|
+
Federate **external retrieval/RAG APIs** into the same query flow via `external_kbs`:
|
|
40
|
+
|
|
41
|
+
- `retrieval` type: the external API returns similar text chunks; MeshRAG's LLM generates the answer
|
|
42
|
+
- `rag` type: the external API is a full RAG service and returns a final answer
|
|
43
|
+
|
|
44
|
+
Registry endpoints under `/external_kbs` manage connection profiles with a
|
|
45
|
+
built-in connectivity test per entry; queries can pass inline configs via
|
|
46
|
+
`external_kbs` or reference registered profiles by id via `external_kb_ids`;
|
|
47
|
+
and `POST /ext/retrieval` ships a mock `retrieval`-type service (backed by your
|
|
48
|
+
own KBs) for integration testing.
|
|
49
|
+
|
|
50
|
+
### 🗂️ Knowledge-base lifecycle APIs
|
|
51
|
+
|
|
52
|
+
Create, list, and delete knowledge bases at runtime — query them alone or federated:
|
|
53
|
+
|
|
54
|
+
- `GET /knowledge_bases` — list knowledge bases
|
|
55
|
+
- `GET /knowledge_bases/stats` — per-KB document and entity counts in one call
|
|
56
|
+
- `POST /knowledge_bases` / `DELETE /knowledge_bases/{kb_id}` — provision or remove a KB
|
|
57
|
+
- `POST /query/data` — retrieval-only variant of `/query`: returns the entities,
|
|
58
|
+
relationships, chunks, and references that were hit, without LLM generation
|
|
59
|
+
|
|
60
|
+
### 📄 Document management APIs
|
|
61
|
+
|
|
62
|
+
Upload/status pipeline plus direct text ingestion without files
|
|
63
|
+
(`POST /documents/text`, batch via `/documents/texts`), and fast
|
|
64
|
+
single-document lookup by file path —
|
|
65
|
+
`GET /documents/by_file_path?kb_id=...&file_path=...` — avoiding expensive
|
|
66
|
+
pagination when the document set is large.
|
|
67
|
+
|
|
68
|
+
### 🔒 Deletion/parsing concurrency pipeline
|
|
69
|
+
|
|
70
|
+
Cooperative cancellation and deletion semantics with crash recovery:
|
|
71
|
+
deletion requests take priority over in-flight processing, interrupted
|
|
72
|
+
documents resume instead of being reset, and transient failures do not get
|
|
73
|
+
misreported as permanent failures.
|
|
74
|
+
|
|
75
|
+
### 🖥️ Management WebUI
|
|
76
|
+
|
|
77
|
+
The bundled React UI (`lightrag_webui`) mirrors the API for day-to-day operation:
|
|
78
|
+
|
|
79
|
+

|
|
80
|
+
|
|
81
|
+
- **Documents** — upload files or paste text, watch the parsing pipeline, rescan/retry
|
|
82
|
+
- **Knowledge Graph** — browse and edit entities and relations (create, edit, merge)
|
|
83
|
+
- **Retrieval** — chat-style playground with a per-query mode/parameter panel, KB
|
|
84
|
+
selectors, streaming answers with citations, and a retrieval dry-run inspector
|
|
85
|
+
that shows the raw hits (entities/relations/chunks) behind an answer
|
|
86
|
+
- **Models** — register LLM profiles server-side and pick one per query;
|
|
87
|
+
API keys never reach the browser
|
|
88
|
+
- **External KBs** — manage and test federation targets
|
|
89
|
+
- Localized UI in 11 languages
|
|
90
|
+
|
|
91
|
+
### 🧬 Everything inherited from LightRAG
|
|
92
|
+
|
|
93
|
+
- Graph-based knowledge representation with local / global / hybrid / naive / mix / bypass query modes
|
|
94
|
+
- Pluggable storage backends (JSON, Redis, PostgreSQL, MongoDB, Milvus, Qdrant, Neo4j, Memgraph, Faiss, NetworkX)
|
|
95
|
+
- WebUI, Ollama-compatible API, streaming responses
|
|
96
|
+
- Workspace isolation for multi-tenant deployment
|
|
97
|
+
|
|
98
|
+
## Quick Start
|
|
99
|
+
|
|
100
|
+
### Install
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install meshrag # core
|
|
104
|
+
pip install "meshrag[api]" # with API server support
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### A simple program
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import os
|
|
111
|
+
import asyncio
|
|
112
|
+
from lightrag import LightRAG, QueryParam
|
|
113
|
+
from lightrag.llm.openai import gpt_4o_mini_complete, openai_embed
|
|
114
|
+
from lightrag.utils import setup_logger
|
|
115
|
+
|
|
116
|
+
setup_logger("lightrag", level="INFO")
|
|
117
|
+
|
|
118
|
+
WORKING_DIR = "./rag_storage"
|
|
119
|
+
if not os.path.exists(WORKING_DIR):
|
|
120
|
+
os.mkdir(WORKING_DIR)
|
|
121
|
+
|
|
122
|
+
async def initialize_rag():
|
|
123
|
+
rag = LightRAG(
|
|
124
|
+
working_dir=WORKING_DIR,
|
|
125
|
+
embedding_func=openai_embed,
|
|
126
|
+
llm_model_func=gpt_4o_mini_complete,
|
|
127
|
+
)
|
|
128
|
+
# IMPORTANT: Both initialization calls are required!
|
|
129
|
+
await rag.initialize_storages() # Initialize storage backends
|
|
130
|
+
return rag
|
|
131
|
+
|
|
132
|
+
async def main():
|
|
133
|
+
rag = await initialize_rag()
|
|
134
|
+
await rag.ainsert("Your text")
|
|
135
|
+
result = await rag.aquery(
|
|
136
|
+
"Your question", param=QueryParam(mode="hybrid")
|
|
137
|
+
)
|
|
138
|
+
print(result)
|
|
139
|
+
await rag.finalize_storages() # REQUIRED for cleanup
|
|
140
|
+
|
|
141
|
+
asyncio.run(main())
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### ⚠️ Important: Initialization Requirements
|
|
145
|
+
|
|
146
|
+
**MeshRAG requires explicit initialization before use.** You must call
|
|
147
|
+
`await rag.initialize_storages()` after creating a `LightRAG` instance, and
|
|
148
|
+
`await rag.finalize_storages()` for cleanup — otherwise you will encounter
|
|
149
|
+
errors such as `AttributeError: __aenter__`.
|
|
150
|
+
|
|
151
|
+
### API server
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
cp env.example .env # or run `make env-base` for the interactive wizard
|
|
155
|
+
meshrag-server # production
|
|
156
|
+
meshrag-gunicorn # multi-worker
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Docker:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
docker compose up -d # uses ghcr.io/tuxin-labs/meshrag
|
|
163
|
+
docker build -t meshrag . # full image (frontend + backend)
|
|
164
|
+
docker build -f Dockerfile.lite . # lite image (API + offline storage only)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Multi-KB query example
|
|
168
|
+
|
|
169
|
+
`POST /query` accepts `kb_ids` (local KBs) and `external_kbs` in the same request:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"query": "Which contracts mention data-residency requirements?",
|
|
174
|
+
"mode": "mix",
|
|
175
|
+
"kb_ids": ["contracts-2025", "policies"],
|
|
176
|
+
"external_kbs": [
|
|
177
|
+
{
|
|
178
|
+
"type": "retrieval",
|
|
179
|
+
"url": "https://kb.example.com/api/search",
|
|
180
|
+
"api_key": "sk-...",
|
|
181
|
+
"top_k": 5
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Results from all sources are deduplicated, reranked, and cited in one answer.
|
|
188
|
+
See the field descriptions in `lightrag/api/routers/query_routes.py` for the
|
|
189
|
+
full contract of each external KB type.
|
|
190
|
+
|
|
191
|
+
## Query Modes
|
|
192
|
+
|
|
193
|
+
| Mode | Description |
|
|
194
|
+
|---|---|
|
|
195
|
+
| `local` | Context-dependent retrieval focused on specific entities |
|
|
196
|
+
| `global` | Community/summary-based broad knowledge retrieval |
|
|
197
|
+
| `hybrid` | Combines local and global |
|
|
198
|
+
| `naive` | Direct vector search without graph |
|
|
199
|
+
| `mix` | Integrates KG and vector retrieval (recommended with a reranker) |
|
|
200
|
+
| `bypass` | Skip retrieval; send conversation history and the question straight to the LLM |
|
|
201
|
+
|
|
202
|
+
## Storage Backends
|
|
203
|
+
|
|
204
|
+
| Layer | Backends |
|
|
205
|
+
|---|---|
|
|
206
|
+
| KV (LLM cache, chunks, doc info) | JSON (default), Redis, PostgreSQL, MongoDB |
|
|
207
|
+
| Vector (embeddings) | NanoVectorDB (default), Faiss, Milvus, Qdrant, PostgreSQL, MongoDB |
|
|
208
|
+
| Graph (entity-relation) | NetworkX (default), Neo4j, PostgreSQL+AGE, MongoDB, Memgraph |
|
|
209
|
+
| Doc status | JSON (default), Redis, PostgreSQL, MongoDB |
|
|
210
|
+
|
|
211
|
+
Configure via environment variables — see [env.example](env.example) for the
|
|
212
|
+
full annotated list, including `LIGHTRAG_SSL_VERIFY` for deployments with
|
|
213
|
+
self-signed TLS certificates.
|
|
214
|
+
|
|
215
|
+
## Documentation
|
|
216
|
+
|
|
217
|
+
- [docs/LightRAG-upstream-usage.md](docs/LightRAG-upstream-usage.md) — inherited engine documentation (configuration, storage setup, API details)
|
|
218
|
+
- [docs/external_kb_usage.md](docs/external_kb_usage.md) — external knowledge base integration guide (Chinese)
|
|
219
|
+
- [CHANGELOG.md](CHANGELOG.md) — release notes
|
|
220
|
+
- [docs/OfflineDeployment.md](docs/OfflineDeployment.md) — air-gapped deployment
|
|
221
|
+
- [docs/DockerDeployment.md](docs/DockerDeployment.md) — Docker deployment
|
|
222
|
+
- [docs/FrontendBuildGuide.md](docs/FrontendBuildGuide.md) — WebUI build
|
|
223
|
+
- [docs/InteractiveSetup.md](docs/InteractiveSetup.md) — interactive `.env` wizard
|
|
224
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — development and PR guidelines
|
|
225
|
+
|
|
226
|
+
## Development
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Backend
|
|
230
|
+
uv sync # core package
|
|
231
|
+
uv sync --extra api # API server support
|
|
232
|
+
uv sync --extra test # testing dependencies
|
|
233
|
+
|
|
234
|
+
uv run ruff check . # lint
|
|
235
|
+
uv run pytest tests/ # offline suite (pass --run-integration for live services)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Interactive configuration wizard (writes `.env`, assembles `docker-compose.final.yml`):
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
make env-base # LLM, embedding, reranker (run first)
|
|
242
|
+
make env-storage # storage backends (optional)
|
|
243
|
+
make env-server # port / security / SSL (optional)
|
|
244
|
+
make env-validate # validate an existing .env
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
WebUI (React 19 + TypeScript; Bun is mandatory):
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
cd lightrag_webui
|
|
251
|
+
bun install
|
|
252
|
+
bun run dev # dev server with hot reload
|
|
253
|
+
bun run build # production bundle → lightrag/api/webui
|
|
254
|
+
bun test
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
|
|
259
|
+
MeshRAG is licensed under the [MIT License](LICENSE).
|
|
260
|
+
Copyright 2026 MeshRAG Team; original LightRAG code Copyright 2025 LightRAG Team.
|
|
261
|
+
See [NOTICE](NOTICE) for details.
|
|
262
|
+
|
|
263
|
+
## Acknowledgements
|
|
264
|
+
|
|
265
|
+
- [LightRAG (HKUDS)](https://github.com/HKUDS/LightRAG) — the engine this project is built on. If MeshRAG is useful to you, please also star the upstream project.
|
|
266
|
+
- LightRAG paper: [arXiv:2410.05779](https://arxiv.org/abs/2410.05779)
|