zrguo commited on
Commit
b71997b
Β·
2 Parent(s): b4d24bd e83bc35

Merge branch 'main' into rerank

Browse files
This view is limited to 50 files because it contains too many changes. Β  See raw diff
Files changed (50) hide show
  1. env.example +2 -2
  2. lightrag/api/config.py +3 -0
  3. lightrag/api/lightrag_server.py +3 -1
  4. lightrag/api/webui/assets/{_basePickBy-BSdLglB8.js β†’ _basePickBy-BVZSZRdU.js} +0 -0
  5. lightrag/api/webui/assets/{_baseUniq-UvGlUd6J.js β†’ _baseUniq-CoKY6BVy.js} +0 -0
  6. lightrag/api/webui/assets/{architectureDiagram-IEHRJDOE-BniHOq-e.js β†’ architectureDiagram-IEHRJDOE-vef8RqWB.js} +0 -0
  7. lightrag/api/webui/assets/{blockDiagram-JOT3LUYC-DIN2mi-0.js β†’ blockDiagram-JOT3LUYC-CbrB0eRz.js} +0 -0
  8. lightrag/api/webui/assets/{c4Diagram-VJAJSXHY-BJN20C_B.js β†’ c4Diagram-VJAJSXHY-1eEG1RbS.js} +0 -0
  9. lightrag/api/webui/assets/{chunk-4BMEZGHF-B1TxGISA.js β†’ chunk-4BMEZGHF-BqribV_z.js} +0 -0
  10. lightrag/api/webui/assets/{chunk-A2AXSNBT-9BBpDWtu.js β†’ chunk-A2AXSNBT-79sAOFxS.js} +0 -0
  11. lightrag/api/webui/assets/{chunk-AEK57VVT-CXtM_4Od.js β†’ chunk-AEK57VVT-C_8ebDHI.js} +0 -0
  12. lightrag/api/webui/assets/{chunk-D6G4REZN-CxUcE0YF.js β†’ chunk-D6G4REZN-DYSFhgH1.js} +0 -0
  13. lightrag/api/webui/assets/{chunk-RZ5BOZE2-Du3GUvfy.js β†’ chunk-RZ5BOZE2-PbmQbmec.js} +0 -0
  14. lightrag/api/webui/assets/{chunk-XZIHB7SX-HOIwmCiB.js β†’ chunk-XZIHB7SX-UCc0agNy.js} +0 -0
  15. lightrag/api/webui/assets/{classDiagram-GIVACNV2-f9sRw-GR.js β†’ classDiagram-GIVACNV2-CtQONuGk.js} +0 -0
  16. lightrag/api/webui/assets/{classDiagram-v2-COTLJTTW-f9sRw-GR.js β†’ classDiagram-v2-COTLJTTW-CtQONuGk.js} +0 -0
  17. lightrag/api/webui/assets/{clone-JfI4KmSh.js β†’ clone-UTZGcTvC.js} +0 -0
  18. lightrag/api/webui/assets/{dagre-OKDRZEBW-BfLyJCXh.js β†’ dagre-OKDRZEBW-B2QKcgt1.js} +0 -0
  19. lightrag/api/webui/assets/{diagram-SSKATNLV-BPBm_HA_.js β†’ diagram-SSKATNLV-C9gAoCDH.js} +0 -0
  20. lightrag/api/webui/assets/{diagram-VNBRO52H-B3H-hAHN.js β†’ diagram-VNBRO52H-YHo3tP1S.js} +0 -0
  21. lightrag/api/webui/assets/{erDiagram-Q7BY3M3F-B0M4Dgpb.js β†’ erDiagram-Q7BY3M3F-BZdHFlc9.js} +0 -0
  22. lightrag/api/webui/assets/{feature-documents-DYAipKCP.js β†’ feature-documents-CSExwz2a.js} +0 -0
  23. lightrag/api/webui/assets/{feature-graph-yCDRht5b.js β†’ feature-graph-D-mwOi0p.js} +0 -0
  24. lightrag/api/webui/assets/{feature-retrieval-DRE_iZah.js β†’ feature-retrieval-BhEQ7fz5.js} +0 -0
  25. lightrag/api/webui/assets/{flowDiagram-4HSFHLVR-0O9i7rCc.js β†’ flowDiagram-4HSFHLVR-Cyoqee_Z.js} +0 -0
  26. lightrag/api/webui/assets/{ganttDiagram-APWFNJXF-r6T2Qk9A.js β†’ ganttDiagram-APWFNJXF-8xxuNmi-.js} +0 -0
  27. lightrag/api/webui/assets/{gitGraphDiagram-7IBYFJ6S-Bu88rIEh.js β†’ gitGraphDiagram-7IBYFJ6S-C00chpNw.js} +0 -0
  28. lightrag/api/webui/assets/{graph-BA-Xpc80.js β†’ graph-gg_UPtwE.js} +0 -0
  29. lightrag/api/webui/assets/{index-BlAjHenV.js β†’ index-CZQXgxUO.js} +0 -0
  30. lightrag/api/webui/assets/{infoDiagram-PH2N3AL5-Ccvh5jh9.js β†’ infoDiagram-PH2N3AL5-DKUJQA1J.js} +0 -0
  31. lightrag/api/webui/assets/{journeyDiagram-U35MCT3I-Bjko5wAq.js β†’ journeyDiagram-U35MCT3I-C9ZzbUpH.js} +0 -0
  32. lightrag/api/webui/assets/{kanban-definition-NDS4AKOZ-CI4n-C9D.js β†’ kanban-definition-NDS4AKOZ-BMGhZtt7.js} +0 -0
  33. lightrag/api/webui/assets/{layout-DVOtj2IM.js β†’ layout-DgVd6nly.js} +0 -0
  34. lightrag/api/webui/assets/{mermaid-vendor-DnUYjsdS.js β†’ mermaid-vendor-BVBgFwCv.js} +0 -0
  35. lightrag/api/webui/assets/{mindmap-definition-ALO5MXBD-C4YiM3o9.js β†’ mindmap-definition-ALO5MXBD-Dy7fqjSb.js} +0 -0
  36. lightrag/api/webui/assets/{pieDiagram-IB7DONF6-Riizpkaf.js β†’ pieDiagram-IB7DONF6-DDY8pHxZ.js} +0 -0
  37. lightrag/api/webui/assets/{quadrantDiagram-7GDLP6J5-CzGAtLV_.js β†’ quadrantDiagram-7GDLP6J5-9aLJ3TJw.js} +0 -0
  38. lightrag/api/webui/assets/{radar-MK3ICKWK-CpuAiCbQ.js β†’ radar-MK3ICKWK-B0N6XiM2.js} +0 -0
  39. lightrag/api/webui/assets/{requirementDiagram-KVF5MWMF-CgGQX3wU.js β†’ requirementDiagram-KVF5MWMF-DqX-DNvM.js} +0 -0
  40. lightrag/api/webui/assets/{sankeyDiagram-QLVOVGJD-DqnzGw22.js β†’ sankeyDiagram-QLVOVGJD-BrbjIPio.js} +0 -0
  41. lightrag/api/webui/assets/{sequenceDiagram-X6HHIX6F-YUSWxee1.js β†’ sequenceDiagram-X6HHIX6F-wqcg8nnG.js} +0 -0
  42. lightrag/api/webui/assets/{stateDiagram-DGXRK772-DZnU_4RL.js β†’ stateDiagram-DGXRK772-CGL2vL66.js} +0 -0
  43. lightrag/api/webui/assets/{stateDiagram-v2-YXO3MK2T-ZS0tnvcs.js β†’ stateDiagram-v2-YXO3MK2T-DIpE_gWh.js} +0 -0
  44. lightrag/api/webui/assets/{timeline-definition-BDJGKUSR-Cl68_gMM.js β†’ timeline-definition-BDJGKUSR-CwuNSBuu.js} +0 -0
  45. lightrag/api/webui/assets/{xychartDiagram-VJFVF3MP-Bc_rddYS.js β†’ xychartDiagram-VJFVF3MP-B1xgKNPc.js} +0 -0
  46. lightrag/api/webui/index.html +0 -0
  47. lightrag/kg/mongo_impl.py +17 -12
  48. lightrag/kg/neo4j_impl.py +8 -4
  49. lightrag/kg/networkx_impl.py +8 -3
  50. lightrag/kg/postgres_impl.py +8 -5
env.example CHANGED
@@ -98,7 +98,7 @@ EMBEDDING_BINDING_API_KEY=your_api_key
98
  # If the embedding service is deployed within the same Docker stack, use host.docker.internal instead of localhost
99
  EMBEDDING_BINDING_HOST=http://localhost:11434
100
  ### Num of chunks send to Embedding in single request
101
- # EMBEDDING_BATCH_NUM=32
102
  ### Max concurrency requests for Embedding
103
  # EMBEDDING_FUNC_MAX_ASYNC=16
104
  ### Maximum tokens sent to Embedding for each chunk (no longer in use?)
@@ -161,7 +161,7 @@ NEO4J_PASSWORD='your_password'
161
 
162
  ### MongoDB Configuration
163
  MONGO_URI=mongodb://root:root@localhost:27017/
164
- #MONGO_URI=mongodb+srv://root:rooot@cluster0.xxxx.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
165
  MONGO_DATABASE=LightRAG
166
  # MONGODB_WORKSPACE=forced_workspace_name
167
 
 
98
  # If the embedding service is deployed within the same Docker stack, use host.docker.internal instead of localhost
99
  EMBEDDING_BINDING_HOST=http://localhost:11434
100
  ### Num of chunks send to Embedding in single request
101
+ # EMBEDDING_BATCH_NUM=10
102
  ### Max concurrency requests for Embedding
103
  # EMBEDDING_FUNC_MAX_ASYNC=16
104
  ### Maximum tokens sent to Embedding for each chunk (no longer in use?)
 
161
 
162
  ### MongoDB Configuration
163
  MONGO_URI=mongodb://root:root@localhost:27017/
164
+ #MONGO_URI=mongodb+srv://xxxx
165
  MONGO_DATABASE=LightRAG
166
  # MONGODB_WORKSPACE=forced_workspace_name
167
 
lightrag/api/config.py CHANGED
@@ -244,6 +244,9 @@ def parse_args() -> argparse.Namespace:
244
  # Get MAX_PARALLEL_INSERT from environment
245
  args.max_parallel_insert = get_env_value("MAX_PARALLEL_INSERT", 2, int)
246
 
 
 
 
247
  # Handle openai-ollama special case
248
  if args.llm_binding == "openai-ollama":
249
  args.llm_binding = "openai"
 
244
  # Get MAX_PARALLEL_INSERT from environment
245
  args.max_parallel_insert = get_env_value("MAX_PARALLEL_INSERT", 2, int)
246
 
247
+ # Get MAX_GRAPH_NODES from environment
248
+ args.max_graph_nodes = get_env_value("MAX_GRAPH_NODES", 1000, int)
249
+
250
  # Handle openai-ollama special case
251
  if args.llm_binding == "openai-ollama":
252
  args.llm_binding = "openai"
lightrag/api/lightrag_server.py CHANGED
@@ -326,6 +326,7 @@ def create_app(args):
326
  enable_llm_cache=args.enable_llm_cache,
327
  auto_manage_storages_states=False,
328
  max_parallel_insert=args.max_parallel_insert,
 
329
  addon_params={"language": args.summary_language},
330
  )
331
  else: # azure_openai
@@ -353,6 +354,7 @@ def create_app(args):
353
  enable_llm_cache=args.enable_llm_cache,
354
  auto_manage_storages_states=False,
355
  max_parallel_insert=args.max_parallel_insert,
 
356
  addon_params={"language": args.summary_language},
357
  )
358
 
@@ -475,7 +477,7 @@ def create_app(args):
475
  "enable_llm_cache_for_extract": args.enable_llm_cache_for_extract,
476
  "enable_llm_cache": args.enable_llm_cache,
477
  "workspace": args.workspace,
478
- "max_graph_nodes": os.getenv("MAX_GRAPH_NODES"),
479
  },
480
  "auth_mode": auth_mode,
481
  "pipeline_busy": pipeline_status.get("busy", False),
 
326
  enable_llm_cache=args.enable_llm_cache,
327
  auto_manage_storages_states=False,
328
  max_parallel_insert=args.max_parallel_insert,
329
+ max_graph_nodes=args.max_graph_nodes,
330
  addon_params={"language": args.summary_language},
331
  )
332
  else: # azure_openai
 
354
  enable_llm_cache=args.enable_llm_cache,
355
  auto_manage_storages_states=False,
356
  max_parallel_insert=args.max_parallel_insert,
357
+ max_graph_nodes=args.max_graph_nodes,
358
  addon_params={"language": args.summary_language},
359
  )
360
 
 
477
  "enable_llm_cache_for_extract": args.enable_llm_cache_for_extract,
478
  "enable_llm_cache": args.enable_llm_cache,
479
  "workspace": args.workspace,
480
+ "max_graph_nodes": args.max_graph_nodes,
481
  },
482
  "auth_mode": auth_mode,
483
  "pipeline_busy": pipeline_status.get("busy", False),
lightrag/api/webui/assets/{_basePickBy-BSdLglB8.js β†’ _basePickBy-BVZSZRdU.js} RENAMED
Binary files a/lightrag/api/webui/assets/_basePickBy-BSdLglB8.js and b/lightrag/api/webui/assets/_basePickBy-BVZSZRdU.js differ
 
lightrag/api/webui/assets/{_baseUniq-UvGlUd6J.js β†’ _baseUniq-CoKY6BVy.js} RENAMED
Binary files a/lightrag/api/webui/assets/_baseUniq-UvGlUd6J.js and b/lightrag/api/webui/assets/_baseUniq-CoKY6BVy.js differ
 
lightrag/api/webui/assets/{architectureDiagram-IEHRJDOE-BniHOq-e.js β†’ architectureDiagram-IEHRJDOE-vef8RqWB.js} RENAMED
Binary files a/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-BniHOq-e.js and b/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-vef8RqWB.js differ
 
lightrag/api/webui/assets/{blockDiagram-JOT3LUYC-DIN2mi-0.js β†’ blockDiagram-JOT3LUYC-CbrB0eRz.js} RENAMED
Binary files a/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-DIN2mi-0.js and b/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-CbrB0eRz.js differ
 
lightrag/api/webui/assets/{c4Diagram-VJAJSXHY-BJN20C_B.js β†’ c4Diagram-VJAJSXHY-1eEG1RbS.js} RENAMED
Binary files a/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-BJN20C_B.js and b/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-1eEG1RbS.js differ
 
lightrag/api/webui/assets/{chunk-4BMEZGHF-B1TxGISA.js β†’ chunk-4BMEZGHF-BqribV_z.js} RENAMED
Binary files a/lightrag/api/webui/assets/chunk-4BMEZGHF-B1TxGISA.js and b/lightrag/api/webui/assets/chunk-4BMEZGHF-BqribV_z.js differ
 
lightrag/api/webui/assets/{chunk-A2AXSNBT-9BBpDWtu.js β†’ chunk-A2AXSNBT-79sAOFxS.js} RENAMED
Binary files a/lightrag/api/webui/assets/chunk-A2AXSNBT-9BBpDWtu.js and b/lightrag/api/webui/assets/chunk-A2AXSNBT-79sAOFxS.js differ
 
lightrag/api/webui/assets/{chunk-AEK57VVT-CXtM_4Od.js β†’ chunk-AEK57VVT-C_8ebDHI.js} RENAMED
Binary files a/lightrag/api/webui/assets/chunk-AEK57VVT-CXtM_4Od.js and b/lightrag/api/webui/assets/chunk-AEK57VVT-C_8ebDHI.js differ
 
lightrag/api/webui/assets/{chunk-D6G4REZN-CxUcE0YF.js β†’ chunk-D6G4REZN-DYSFhgH1.js} RENAMED
Binary files a/lightrag/api/webui/assets/chunk-D6G4REZN-CxUcE0YF.js and b/lightrag/api/webui/assets/chunk-D6G4REZN-DYSFhgH1.js differ
 
lightrag/api/webui/assets/{chunk-RZ5BOZE2-Du3GUvfy.js β†’ chunk-RZ5BOZE2-PbmQbmec.js} RENAMED
Binary files a/lightrag/api/webui/assets/chunk-RZ5BOZE2-Du3GUvfy.js and b/lightrag/api/webui/assets/chunk-RZ5BOZE2-PbmQbmec.js differ
 
lightrag/api/webui/assets/{chunk-XZIHB7SX-HOIwmCiB.js β†’ chunk-XZIHB7SX-UCc0agNy.js} RENAMED
Binary files a/lightrag/api/webui/assets/chunk-XZIHB7SX-HOIwmCiB.js and b/lightrag/api/webui/assets/chunk-XZIHB7SX-UCc0agNy.js differ
 
lightrag/api/webui/assets/{classDiagram-GIVACNV2-f9sRw-GR.js β†’ classDiagram-GIVACNV2-CtQONuGk.js} RENAMED
Binary files a/lightrag/api/webui/assets/classDiagram-GIVACNV2-f9sRw-GR.js and b/lightrag/api/webui/assets/classDiagram-GIVACNV2-CtQONuGk.js differ
 
lightrag/api/webui/assets/{classDiagram-v2-COTLJTTW-f9sRw-GR.js β†’ classDiagram-v2-COTLJTTW-CtQONuGk.js} RENAMED
Binary files a/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-f9sRw-GR.js and b/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-CtQONuGk.js differ
 
lightrag/api/webui/assets/{clone-JfI4KmSh.js β†’ clone-UTZGcTvC.js} RENAMED
Binary files a/lightrag/api/webui/assets/clone-JfI4KmSh.js and b/lightrag/api/webui/assets/clone-UTZGcTvC.js differ
 
lightrag/api/webui/assets/{dagre-OKDRZEBW-BfLyJCXh.js β†’ dagre-OKDRZEBW-B2QKcgt1.js} RENAMED
Binary files a/lightrag/api/webui/assets/dagre-OKDRZEBW-BfLyJCXh.js and b/lightrag/api/webui/assets/dagre-OKDRZEBW-B2QKcgt1.js differ
 
lightrag/api/webui/assets/{diagram-SSKATNLV-BPBm_HA_.js β†’ diagram-SSKATNLV-C9gAoCDH.js} RENAMED
Binary files a/lightrag/api/webui/assets/diagram-SSKATNLV-BPBm_HA_.js and b/lightrag/api/webui/assets/diagram-SSKATNLV-C9gAoCDH.js differ
 
lightrag/api/webui/assets/{diagram-VNBRO52H-B3H-hAHN.js β†’ diagram-VNBRO52H-YHo3tP1S.js} RENAMED
Binary files a/lightrag/api/webui/assets/diagram-VNBRO52H-B3H-hAHN.js and b/lightrag/api/webui/assets/diagram-VNBRO52H-YHo3tP1S.js differ
 
lightrag/api/webui/assets/{erDiagram-Q7BY3M3F-B0M4Dgpb.js β†’ erDiagram-Q7BY3M3F-BZdHFlc9.js} RENAMED
Binary files a/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-B0M4Dgpb.js and b/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-BZdHFlc9.js differ
 
lightrag/api/webui/assets/{feature-documents-DYAipKCP.js β†’ feature-documents-CSExwz2a.js} RENAMED
Binary files a/lightrag/api/webui/assets/feature-documents-DYAipKCP.js and b/lightrag/api/webui/assets/feature-documents-CSExwz2a.js differ
 
lightrag/api/webui/assets/{feature-graph-yCDRht5b.js β†’ feature-graph-D-mwOi0p.js} RENAMED
Binary files a/lightrag/api/webui/assets/feature-graph-yCDRht5b.js and b/lightrag/api/webui/assets/feature-graph-D-mwOi0p.js differ
 
lightrag/api/webui/assets/{feature-retrieval-DRE_iZah.js β†’ feature-retrieval-BhEQ7fz5.js} RENAMED
Binary files a/lightrag/api/webui/assets/feature-retrieval-DRE_iZah.js and b/lightrag/api/webui/assets/feature-retrieval-BhEQ7fz5.js differ
 
lightrag/api/webui/assets/{flowDiagram-4HSFHLVR-0O9i7rCc.js β†’ flowDiagram-4HSFHLVR-Cyoqee_Z.js} RENAMED
Binary files a/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-0O9i7rCc.js and b/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-Cyoqee_Z.js differ
 
lightrag/api/webui/assets/{ganttDiagram-APWFNJXF-r6T2Qk9A.js β†’ ganttDiagram-APWFNJXF-8xxuNmi-.js} RENAMED
Binary files a/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-r6T2Qk9A.js and b/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-8xxuNmi-.js differ
 
lightrag/api/webui/assets/{gitGraphDiagram-7IBYFJ6S-Bu88rIEh.js β†’ gitGraphDiagram-7IBYFJ6S-C00chpNw.js} RENAMED
Binary files a/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-Bu88rIEh.js and b/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-C00chpNw.js differ
 
lightrag/api/webui/assets/{graph-BA-Xpc80.js β†’ graph-gg_UPtwE.js} RENAMED
Binary files a/lightrag/api/webui/assets/graph-BA-Xpc80.js and b/lightrag/api/webui/assets/graph-gg_UPtwE.js differ
 
lightrag/api/webui/assets/{index-BlAjHenV.js β†’ index-CZQXgxUO.js} RENAMED
Binary files a/lightrag/api/webui/assets/index-BlAjHenV.js and b/lightrag/api/webui/assets/index-CZQXgxUO.js differ
 
lightrag/api/webui/assets/{infoDiagram-PH2N3AL5-Ccvh5jh9.js β†’ infoDiagram-PH2N3AL5-DKUJQA1J.js} RENAMED
Binary files a/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-Ccvh5jh9.js and b/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-DKUJQA1J.js differ
 
lightrag/api/webui/assets/{journeyDiagram-U35MCT3I-Bjko5wAq.js β†’ journeyDiagram-U35MCT3I-C9ZzbUpH.js} RENAMED
Binary files a/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-Bjko5wAq.js and b/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-C9ZzbUpH.js differ
 
lightrag/api/webui/assets/{kanban-definition-NDS4AKOZ-CI4n-C9D.js β†’ kanban-definition-NDS4AKOZ-BMGhZtt7.js} RENAMED
Binary files a/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-CI4n-C9D.js and b/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-BMGhZtt7.js differ
 
lightrag/api/webui/assets/{layout-DVOtj2IM.js β†’ layout-DgVd6nly.js} RENAMED
Binary files a/lightrag/api/webui/assets/layout-DVOtj2IM.js and b/lightrag/api/webui/assets/layout-DgVd6nly.js differ
 
lightrag/api/webui/assets/{mermaid-vendor-DnUYjsdS.js β†’ mermaid-vendor-BVBgFwCv.js} RENAMED
Binary files a/lightrag/api/webui/assets/mermaid-vendor-DnUYjsdS.js and b/lightrag/api/webui/assets/mermaid-vendor-BVBgFwCv.js differ
 
lightrag/api/webui/assets/{mindmap-definition-ALO5MXBD-C4YiM3o9.js β†’ mindmap-definition-ALO5MXBD-Dy7fqjSb.js} RENAMED
Binary files a/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-C4YiM3o9.js and b/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-Dy7fqjSb.js differ
 
lightrag/api/webui/assets/{pieDiagram-IB7DONF6-Riizpkaf.js β†’ pieDiagram-IB7DONF6-DDY8pHxZ.js} RENAMED
Binary files a/lightrag/api/webui/assets/pieDiagram-IB7DONF6-Riizpkaf.js and b/lightrag/api/webui/assets/pieDiagram-IB7DONF6-DDY8pHxZ.js differ
 
lightrag/api/webui/assets/{quadrantDiagram-7GDLP6J5-CzGAtLV_.js β†’ quadrantDiagram-7GDLP6J5-9aLJ3TJw.js} RENAMED
Binary files a/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-CzGAtLV_.js and b/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-9aLJ3TJw.js differ
 
lightrag/api/webui/assets/{radar-MK3ICKWK-CpuAiCbQ.js β†’ radar-MK3ICKWK-B0N6XiM2.js} RENAMED
Binary files a/lightrag/api/webui/assets/radar-MK3ICKWK-CpuAiCbQ.js and b/lightrag/api/webui/assets/radar-MK3ICKWK-B0N6XiM2.js differ
 
lightrag/api/webui/assets/{requirementDiagram-KVF5MWMF-CgGQX3wU.js β†’ requirementDiagram-KVF5MWMF-DqX-DNvM.js} RENAMED
Binary files a/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-CgGQX3wU.js and b/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-DqX-DNvM.js differ
 
lightrag/api/webui/assets/{sankeyDiagram-QLVOVGJD-DqnzGw22.js β†’ sankeyDiagram-QLVOVGJD-BrbjIPio.js} RENAMED
Binary files a/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-DqnzGw22.js and b/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-BrbjIPio.js differ
 
lightrag/api/webui/assets/{sequenceDiagram-X6HHIX6F-YUSWxee1.js β†’ sequenceDiagram-X6HHIX6F-wqcg8nnG.js} RENAMED
Binary files a/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-YUSWxee1.js and b/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-wqcg8nnG.js differ
 
lightrag/api/webui/assets/{stateDiagram-DGXRK772-DZnU_4RL.js β†’ stateDiagram-DGXRK772-CGL2vL66.js} RENAMED
Binary files a/lightrag/api/webui/assets/stateDiagram-DGXRK772-DZnU_4RL.js and b/lightrag/api/webui/assets/stateDiagram-DGXRK772-CGL2vL66.js differ
 
lightrag/api/webui/assets/{stateDiagram-v2-YXO3MK2T-ZS0tnvcs.js β†’ stateDiagram-v2-YXO3MK2T-DIpE_gWh.js} RENAMED
Binary files a/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-ZS0tnvcs.js and b/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-DIpE_gWh.js differ
 
lightrag/api/webui/assets/{timeline-definition-BDJGKUSR-Cl68_gMM.js β†’ timeline-definition-BDJGKUSR-CwuNSBuu.js} RENAMED
Binary files a/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-Cl68_gMM.js and b/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CwuNSBuu.js differ
 
lightrag/api/webui/assets/{xychartDiagram-VJFVF3MP-Bc_rddYS.js β†’ xychartDiagram-VJFVF3MP-B1xgKNPc.js} RENAMED
Binary files a/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-Bc_rddYS.js and b/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-B1xgKNPc.js differ
 
lightrag/api/webui/index.html CHANGED
Binary files a/lightrag/api/webui/index.html and b/lightrag/api/webui/index.html differ
 
lightrag/kg/mongo_impl.py CHANGED
@@ -34,8 +34,6 @@ from pymongo.errors import PyMongoError # type: ignore
34
  config = configparser.ConfigParser()
35
  config.read("config.ini", "utf-8")
36
 
37
- # Get maximum number of graph nodes from environment variable, default is 1000
38
- MAX_GRAPH_NODES = int(os.getenv("MAX_GRAPH_NODES", 1000))
39
  GRAPH_BFS_MODE = os.getenv("MONGO_GRAPH_BFS_MODE", "bidirectional")
40
 
41
 
@@ -883,7 +881,7 @@ class MongoGraphStorage(BaseGraphStorage):
883
  )
884
 
885
  async def get_knowledge_graph_all_by_degree(
886
- self, max_depth: int = 3, max_nodes: int = MAX_GRAPH_NODES
887
  ) -> KnowledgeGraph:
888
  """
889
  It's possible that the node with one or multiple relationships is retrieved,
@@ -961,9 +959,9 @@ class MongoGraphStorage(BaseGraphStorage):
961
  node_labels: list[str],
962
  seen_nodes: set[str],
963
  result: KnowledgeGraph,
964
- depth: int = 0,
965
- max_depth: int = 3,
966
- max_nodes: int = MAX_GRAPH_NODES,
967
  ) -> KnowledgeGraph:
968
  if depth > max_depth or len(result.nodes) > max_nodes:
969
  return result
@@ -1006,9 +1004,9 @@ class MongoGraphStorage(BaseGraphStorage):
1006
  async def get_knowledge_subgraph_bidirectional_bfs(
1007
  self,
1008
  node_label: str,
1009
- depth=0,
1010
- max_depth: int = 3,
1011
- max_nodes: int = MAX_GRAPH_NODES,
1012
  ) -> KnowledgeGraph:
1013
  seen_nodes = set()
1014
  seen_edges = set()
@@ -1038,7 +1036,7 @@ class MongoGraphStorage(BaseGraphStorage):
1038
  return result
1039
 
1040
  async def get_knowledge_subgraph_in_out_bound_bfs(
1041
- self, node_label: str, max_depth: int = 3, max_nodes: int = MAX_GRAPH_NODES
1042
  ) -> KnowledgeGraph:
1043
  seen_nodes = set()
1044
  seen_edges = set()
@@ -1152,7 +1150,7 @@ class MongoGraphStorage(BaseGraphStorage):
1152
  self,
1153
  node_label: str,
1154
  max_depth: int = 3,
1155
- max_nodes: int = MAX_GRAPH_NODES,
1156
  ) -> KnowledgeGraph:
1157
  """
1158
  Retrieve a connected subgraph of nodes where the label includes the specified `node_label`.
@@ -1160,7 +1158,7 @@ class MongoGraphStorage(BaseGraphStorage):
1160
  Args:
1161
  node_label: Label of the starting node, * means all nodes
1162
  max_depth: Maximum depth of the subgraph, Defaults to 3
1163
- max_nodes: Maxiumu nodes to return, Defaults to 1000
1164
 
1165
  Returns:
1166
  KnowledgeGraph object containing nodes and edges, with an is_truncated flag
@@ -1184,6 +1182,13 @@ class MongoGraphStorage(BaseGraphStorage):
1184
  C β†’ B
1185
  C β†’ D
1186
  """
 
 
 
 
 
 
 
1187
  result = KnowledgeGraph()
1188
  start = time.perf_counter()
1189
 
 
34
  config = configparser.ConfigParser()
35
  config.read("config.ini", "utf-8")
36
 
 
 
37
  GRAPH_BFS_MODE = os.getenv("MONGO_GRAPH_BFS_MODE", "bidirectional")
38
 
39
 
 
881
  )
882
 
883
  async def get_knowledge_graph_all_by_degree(
884
+ self, max_depth: int, max_nodes: int
885
  ) -> KnowledgeGraph:
886
  """
887
  It's possible that the node with one or multiple relationships is retrieved,
 
959
  node_labels: list[str],
960
  seen_nodes: set[str],
961
  result: KnowledgeGraph,
962
+ depth: int,
963
+ max_depth: int,
964
+ max_nodes: int,
965
  ) -> KnowledgeGraph:
966
  if depth > max_depth or len(result.nodes) > max_nodes:
967
  return result
 
1004
  async def get_knowledge_subgraph_bidirectional_bfs(
1005
  self,
1006
  node_label: str,
1007
+ depth: int,
1008
+ max_depth: int,
1009
+ max_nodes: int,
1010
  ) -> KnowledgeGraph:
1011
  seen_nodes = set()
1012
  seen_edges = set()
 
1036
  return result
1037
 
1038
  async def get_knowledge_subgraph_in_out_bound_bfs(
1039
+ self, node_label: str, max_depth: int, max_nodes: int
1040
  ) -> KnowledgeGraph:
1041
  seen_nodes = set()
1042
  seen_edges = set()
 
1150
  self,
1151
  node_label: str,
1152
  max_depth: int = 3,
1153
+ max_nodes: int = None,
1154
  ) -> KnowledgeGraph:
1155
  """
1156
  Retrieve a connected subgraph of nodes where the label includes the specified `node_label`.
 
1158
  Args:
1159
  node_label: Label of the starting node, * means all nodes
1160
  max_depth: Maximum depth of the subgraph, Defaults to 3
1161
+ max_nodes: Maximum nodes to return, Defaults to global_config max_graph_nodes
1162
 
1163
  Returns:
1164
  KnowledgeGraph object containing nodes and edges, with an is_truncated flag
 
1182
  C β†’ B
1183
  C β†’ D
1184
  """
1185
+ # Use global_config max_graph_nodes as default if max_nodes is None
1186
+ if max_nodes is None:
1187
+ max_nodes = self.global_config.get("max_graph_nodes", 1000)
1188
+ else:
1189
+ # Limit max_nodes to not exceed global_config max_graph_nodes
1190
+ max_nodes = min(max_nodes, self.global_config.get("max_graph_nodes", 1000))
1191
+
1192
  result = KnowledgeGraph()
1193
  start = time.perf_counter()
1194
 
lightrag/kg/neo4j_impl.py CHANGED
@@ -36,9 +36,6 @@ from dotenv import load_dotenv
36
  # the OS environment variables take precedence over the .env file
37
  load_dotenv(dotenv_path=".env", override=False)
38
 
39
- # Get maximum number of graph nodes from environment variable, default is 1000
40
- MAX_GRAPH_NODES = int(os.getenv("MAX_GRAPH_NODES", 1000))
41
-
42
  config = configparser.ConfigParser()
43
  config.read("config.ini", "utf-8")
44
 
@@ -902,7 +899,7 @@ class Neo4JStorage(BaseGraphStorage):
902
  self,
903
  node_label: str,
904
  max_depth: int = 3,
905
- max_nodes: int = MAX_GRAPH_NODES,
906
  ) -> KnowledgeGraph:
907
  """
908
  Retrieve a connected subgraph of nodes where the label includes the specified `node_label`.
@@ -916,6 +913,13 @@ class Neo4JStorage(BaseGraphStorage):
916
  KnowledgeGraph object containing nodes and edges, with an is_truncated flag
917
  indicating whether the graph was truncated due to max_nodes limit
918
  """
 
 
 
 
 
 
 
919
  workspace_label = self._get_workspace_label()
920
  result = KnowledgeGraph()
921
  seen_nodes = set()
 
36
  # the OS environment variables take precedence over the .env file
37
  load_dotenv(dotenv_path=".env", override=False)
38
 
 
 
 
39
  config = configparser.ConfigParser()
40
  config.read("config.ini", "utf-8")
41
 
 
899
  self,
900
  node_label: str,
901
  max_depth: int = 3,
902
+ max_nodes: int = None,
903
  ) -> KnowledgeGraph:
904
  """
905
  Retrieve a connected subgraph of nodes where the label includes the specified `node_label`.
 
913
  KnowledgeGraph object containing nodes and edges, with an is_truncated flag
914
  indicating whether the graph was truncated due to max_nodes limit
915
  """
916
+ # Get max_nodes from global_config if not provided
917
+ if max_nodes is None:
918
+ max_nodes = self.global_config.get("max_graph_nodes", 1000)
919
+ else:
920
+ # Limit max_nodes to not exceed global_config max_graph_nodes
921
+ max_nodes = min(max_nodes, self.global_config.get("max_graph_nodes", 1000))
922
+
923
  workspace_label = self._get_workspace_label()
924
  result = KnowledgeGraph()
925
  seen_nodes = set()
lightrag/kg/networkx_impl.py CHANGED
@@ -26,8 +26,6 @@ from dotenv import load_dotenv
26
  # the OS environment variables take precedence over the .env file
27
  load_dotenv(dotenv_path=".env", override=False)
28
 
29
- MAX_GRAPH_NODES = int(os.getenv("MAX_GRAPH_NODES", 1000))
30
-
31
 
32
  @final
33
  @dataclass
@@ -218,7 +216,7 @@ class NetworkXStorage(BaseGraphStorage):
218
  self,
219
  node_label: str,
220
  max_depth: int = 3,
221
- max_nodes: int = MAX_GRAPH_NODES,
222
  ) -> KnowledgeGraph:
223
  """
224
  Retrieve a connected subgraph of nodes where the label includes the specified `node_label`.
@@ -232,6 +230,13 @@ class NetworkXStorage(BaseGraphStorage):
232
  KnowledgeGraph object containing nodes and edges, with an is_truncated flag
233
  indicating whether the graph was truncated due to max_nodes limit
234
  """
 
 
 
 
 
 
 
235
  graph = await self._get_graph()
236
 
237
  result = KnowledgeGraph()
 
26
  # the OS environment variables take precedence over the .env file
27
  load_dotenv(dotenv_path=".env", override=False)
28
 
 
 
29
 
30
  @final
31
  @dataclass
 
216
  self,
217
  node_label: str,
218
  max_depth: int = 3,
219
+ max_nodes: int = None,
220
  ) -> KnowledgeGraph:
221
  """
222
  Retrieve a connected subgraph of nodes where the label includes the specified `node_label`.
 
230
  KnowledgeGraph object containing nodes and edges, with an is_truncated flag
231
  indicating whether the graph was truncated due to max_nodes limit
232
  """
233
+ # Get max_nodes from global_config if not provided
234
+ if max_nodes is None:
235
+ max_nodes = self.global_config.get("max_graph_nodes", 1000)
236
+ else:
237
+ # Limit max_nodes to not exceed global_config max_graph_nodes
238
+ max_nodes = min(max_nodes, self.global_config.get("max_graph_nodes", 1000))
239
+
240
  graph = await self._get_graph()
241
 
242
  result = KnowledgeGraph()
lightrag/kg/postgres_impl.py CHANGED
@@ -45,9 +45,6 @@ from dotenv import load_dotenv
45
  # the OS environment variables take precedence over the .env file
46
  load_dotenv(dotenv_path=".env", override=False)
47
 
48
- # Get maximum number of graph nodes from environment variable, default is 1000
49
- MAX_GRAPH_NODES = int(os.getenv("MAX_GRAPH_NODES", 1000))
50
-
51
 
52
  class PostgreSQLDB:
53
  def __init__(self, config: dict[str, Any], **kwargs: Any):
@@ -2819,7 +2816,7 @@ class PGGraphStorage(BaseGraphStorage):
2819
  self,
2820
  node_label: str,
2821
  max_depth: int = 3,
2822
- max_nodes: int = MAX_GRAPH_NODES,
2823
  ) -> KnowledgeGraph:
2824
  """
2825
  Retrieve a connected subgraph of nodes where the label includes the specified `node_label`.
@@ -2827,12 +2824,18 @@ class PGGraphStorage(BaseGraphStorage):
2827
  Args:
2828
  node_label: Label of the starting node, * means all nodes
2829
  max_depth: Maximum depth of the subgraph, Defaults to 3
2830
- max_nodes: Maxiumu nodes to return, Defaults to 1000
2831
 
2832
  Returns:
2833
  KnowledgeGraph object containing nodes and edges, with an is_truncated flag
2834
  indicating whether the graph was truncated due to max_nodes limit
2835
  """
 
 
 
 
 
 
2836
  kg = KnowledgeGraph()
2837
 
2838
  # Handle wildcard query - get all nodes
 
45
  # the OS environment variables take precedence over the .env file
46
  load_dotenv(dotenv_path=".env", override=False)
47
 
 
 
 
48
 
49
  class PostgreSQLDB:
50
  def __init__(self, config: dict[str, Any], **kwargs: Any):
 
2816
  self,
2817
  node_label: str,
2818
  max_depth: int = 3,
2819
+ max_nodes: int = None,
2820
  ) -> KnowledgeGraph:
2821
  """
2822
  Retrieve a connected subgraph of nodes where the label includes the specified `node_label`.
 
2824
  Args:
2825
  node_label: Label of the starting node, * means all nodes
2826
  max_depth: Maximum depth of the subgraph, Defaults to 3
2827
+ max_nodes: Maximum nodes to return, Defaults to global_config max_graph_nodes
2828
 
2829
  Returns:
2830
  KnowledgeGraph object containing nodes and edges, with an is_truncated flag
2831
  indicating whether the graph was truncated due to max_nodes limit
2832
  """
2833
+ # Use global_config max_graph_nodes as default if max_nodes is None
2834
+ if max_nodes is None:
2835
+ max_nodes = self.global_config.get("max_graph_nodes", 1000)
2836
+ else:
2837
+ # Limit max_nodes to not exceed global_config max_graph_nodes
2838
+ max_nodes = min(max_nodes, self.global_config.get("max_graph_nodes", 1000))
2839
  kg = KnowledgeGraph()
2840
 
2841
  # Handle wildcard query - get all nodes