microsoft / graphrag

A modular graph-based Retrieval-Augmented Generation (RAG) system
https://microsoft.github.io/graphrag/
MIT License
19.34k stars 1.91k forks source link

[Feature Request]: A doc to describe how to write good prompts(entity-extraction,community-report,summarize-description) for indexing? #1389

Open nikawang opened 1 week ago

nikawang commented 1 week ago

Do you need to file an issue?

Is your feature request related to a problem? Please describe.

I've tweaked the prompts generated by auto-tuning. But I found I can't use them to index after upgrade to graphrag 4.0/4.1 with error as below. I'm still not very clear how to write goods prompts to index in some special case. Do we have any docs to describe that? Thanks very much!

Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/site-packages/datashaper/workflow/workflow.py", line 415, in _execute_verb
    result = await result
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/workflows/v1/subflows/create_base_entity_graph.py", line 53, in create_base_entity_graph
    output = await create_base_entity_graph_flow(
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/flows/create_base_entity_graph.py", line 79, in create_base_entity_graph
    clustered = cluster_graph(
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/operations/cluster_graph.py", line 47, in cluster_graph
    communities = run_layout(strategy, input)
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/operations/cluster_graph.py", line 135, in run_layout
    clusters = run_leiden(graph, strategy)
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/operations/cluster_graph.py", line 158, in run_leiden
    node_id_to_community_map = _compute_leiden_communities(
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/operations/cluster_graph.py", line 193, in _compute_leiden_communities
    community_mapping = hierarchical_leiden(
  File "<@beartype(graspologic.partition.leiden.hierarchical_leiden) at 0x7f6d620edab0>", line 304, in hierarchical_leiden
  File "/opt/conda/lib/python3.10/site-packages/graspologic/partition/leiden.py", line 588, in hierarchical_leiden
    hierarchical_clusters_native = gn.hierarchical_leiden(
leiden.EmptyNetworkError: EmptyNetworkError
13:25:48,915 graphrag.callbacks.file_workflow_callbacks INFO Error executing verb "create_base_entity_graph" in create_base_entity_graph: EmptyNetworkError details=None
13:25:48,915 graphrag.index.run.run ERROR error running workflow create_base_entity_graph
Traceback (most recent call last):
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/run/run.py", line 274, in run_pipeline
    result = await _process_workflow(
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/run/workflow.py", line 105, in _process_workflow
    result = await workflow.run(context, callbacks)
  File "/opt/conda/lib/python3.10/site-packages/datashaper/workflow/workflow.py", line 369, in run
    timing = await self._execute_verb(node, context, callbacks)
  File "/opt/conda/lib/python3.10/site-packages/datashaper/workflow/workflow.py", line 415, in _execute_verb
    result = await result
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/workflows/v1/subflows/create_base_entity_graph.py", line 53, in create_base_entity_graph
    output = await create_base_entity_graph_flow(
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/flows/create_base_entity_graph.py", line 79, in create_base_entity_graph
    clustered = cluster_graph(
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/operations/cluster_graph.py", line 47, in cluster_graph
    communities = run_layout(strategy, input)
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/operations/cluster_graph.py", line 135, in run_layout
    clusters = run_leiden(graph, strategy)
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/operations/cluster_graph.py", line 158, in run_leiden
    node_id_to_community_map = _compute_leiden_communities(
  File "/opt/conda/lib/python3.10/site-packages/graphrag/index/operations/cluster_graph.py", line 193, in _compute_leiden_communities
    community_mapping = hierarchical_leiden(
  File "<@beartype(graspologic.partition.leiden.hierarchical_leiden) at 0x7f6d620edab0>", line 304, in hierarchical_leiden
  File "/opt/conda/lib/python3.10/site-packages/graspologic/partition/leiden.py", line 588, in hierarchical_leiden
    hierarchical_clusters_native = gn.hierarchical_leiden(
leiden.EmptyNetworkError: EmptyNetworkError
13:25:48,916 graphrag.callbacks.file_workflow_callbacks INFO Error running pipeline! details=None
13:25:48,925 graphrag.cli.index ERROR Errors occurred during the pipeline run, see logs for more details.

Describe the solution you'd like

No response

Additional context

No response