CLI Reference
This page documents the command-line interface of the graphrag library.
graphrag
GraphRAG: A graph-based retrieval-augmented generation (RAG) system.
Usage:
Options:
--install-completion Install completion for the current shell.
--show-completion Show completion for the current shell, to copy it or
customize the installation.
index
Build a knowledge graph index.
Usage:
Options:
-r, --root DIRECTORY The project root directory. [default:
/home/runner/work/graphrag/graphrag]
-m, --method [standard|fast|standard-update|fast-update]
The indexing method to use. [default:
standard]
-v, --verbose Run the indexing pipeline with verbose
logging
--dry-run Run the indexing pipeline without executing
any steps to inspect and validate the
configuration.
--cache / --no-cache Use LLM cache. [default: cache]
--skip-validation Skip any preflight validation. Useful when
running no LLM steps.
init
Generate a default configuration file.
Usage:
Options:
-r, --root DIRECTORY The project root directory. [default:
/home/runner/work/graphrag/graphrag]
-m, --model TEXT [default: gpt-4.1]
-e, --embedding TEXT [default: text-embedding-3-large]
-f, --force Force initialization even if the project already
exists.
prompt-tune
Generate custom graphrag prompts with your own data (i.e. auto templating).
Usage:
Options:
-r, --root DIRECTORY The project root directory. [default:
/home/runner/work/graphrag/graphrag]
-v, --verbose Run the prompt tuning pipeline with verbose
logging.
--domain TEXT The domain your input data is related to.
For example 'space science', 'microbiology',
'environmental news'. If not defined, a
domain will be inferred from the input data.
--selection-method [all|random|top|auto]
The text chunk selection method. [default:
random]
--n-subset-max INTEGER The number of text chunks to embed when
--selection-method=auto. [default: 300]
--k INTEGER The maximum number of documents to select
from each centroid when --selection-
method=auto. [default: 15]
--limit INTEGER The number of documents to load when
--selection-method={random,top}. [default:
15]
--max-tokens INTEGER The max token count for prompt generation.
[default: 2000]
--min-examples-required INTEGER
The minimum number of examples to
generate/include in the entity extraction
prompt. [default: 2]
--chunk-size INTEGER The size of each example text chunk.
Overrides chunking.size in the configuration
file. [default: 1200]
--overlap INTEGER The overlap size for chunking documents.
Overrides chunking.overlap in the
configuration file. [default: 100]
--language TEXT The primary language used for inputs and
outputs in graphrag prompts.
--discover-entity-types / --no-discover-entity-types
Discover and extract unspecified entity
types. [default: discover-entity-types]
-o, --output PATH The directory to save prompts to, relative
to the project root directory. [default:
prompts]
query
Query a knowledge graph index.
Usage:
Options:
QUERY The query to execute. [required]
-r, --root DIRECTORY The project root directory. [default:
/home/runner/work/graphrag/graphrag]
-m, --method [local|global|drift|basic]
The query algorithm to use. [default:
global]
-v, --verbose Run the query with verbose logging.
-d, --data PATH Index output directory (contains the parquet
files).
--community-level INTEGER Leiden hierarchy level from which to load
community reports. Higher values represent
smaller communities. [default: 2]
--dynamic-community-selection / --no-dynamic-selection
Use global search with dynamic community
selection. [default: no-dynamic-selection]
--response-type TEXT Free-form description of the desired
response format (e.g. 'Single Sentence',
'List of 3-7 Points', etc.). [default:
Multiple Paragraphs]
--streaming / --no-streaming Print the response in a streaming manner.
[default: no-streaming]
update
Update an existing knowledge graph index.
Applies a default output configuration (if not provided by config), saving the new index to the local file system in the update_output folder.
Usage:
Options:
-r, --root DIRECTORY The project root directory. [default:
/home/runner/work/graphrag/graphrag]
-m, --method [standard|fast|standard-update|fast-update]
The indexing method to use. [default:
standard]
-v, --verbose Run the indexing pipeline with verbose
logging.
--cache / --no-cache Use LLM cache. [default: cache]
--skip-validation Skip any preflight validation. Useful when
running no LLM steps.