This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

GraphRAG

Explore the GraphRAG implementation This section details how to reproduce GraphRAG results.

    Index of GraphRAG

    To ensure experimental consistency and command availability, please follow these instructions to install GraphRAG:

    conda create -n graphrag python=3.9
    conda activate graphrag
    pip install graphrag==1.2.0
    
    graphrag init --root path/to/main_folder
    

    This will create two files in the main_folder directory:

    • .env: Contains environment variables for the GraphRAG pipeline

      • Defines GRAPHRAG_API_KEY=<API_KEY> for OpenAI/Azure OpenAI authentication
      • Replace with your own API key
      • Delete file if using alternate authentication (e.g. managed identity)
    • settings.yaml: Contains configurable pipeline settings

      • Modify to customize pipeline behavior

    More details about GraphRAG configuration and usage can be found in the official documentation.

    Then index by running

    graphrag index --root path/to/main_folder
    

    Answer and Evaluation

    First, prepare your test questions according to the benchmark format. You’ll need to create a test set parquet file containing questions and their corresponding answer keys. Once ready, you can run the evaluation with:

    python -m /eval/eval_graph -f path/to/main_folder -q path/to/question_parquet