Default Configuration Mode (using YAML/JSON)
The default configuration mode may be configured by using a settings.yml or settings.json file in the data project root. If a .env file is present along with this config file, then it will be loaded, and the environment variables defined therein will be available for token replacements in your configuration document using ${ENV_VAR} syntax. We initialize with YML by default in graphrag init but you may use the equivalent JSON form if preferred.
Many of these config values have defaults. Rather than replicate them here, please refer to the constants in the code directly.
For example:
Config Sections
Language Model Setup
models
This is a dict of model configurations. The dict key is used to reference this configuration elsewhere when a model instance is desired. In this way, you can specify as many different models as you need, and reference them differentially in the workflow steps.
For example:
models:
default_chat_model:
api_key: ${GRAPHRAG_API_KEY}
type: openai_chat
model: gpt-4o
model_supports_json: true
default_embedding_model:
api_key: ${GRAPHRAG_API_KEY}
type: openai_embedding
model: text-embedding-ada-002
Fields
api_keystr - The OpenAI API key to use.auth_typeapi_key|azure_managed_identity - Indicate how you want to authenticate requests.typechat|embedding|openai_chat|azure_openai_chat|openai_embedding|azure_openai_embedding|mock_chat|mock_embeddings - The type of LLM to use.model_providerstr|None - The model provider to use, e.g., openai, azure, anthropic, etc. Required whentype == chat|embedding. Whentype == chat|embedding, LiteLLM is used under the hood which has support for calling 100+ models. View LiteLLm basic usage for details on how models are called (Themodel_provideris the portion prior to/while themodelis the portion following the/). View Language Model Selection for more details and examples on using LiteLLM.modelstr - The model name.encoding_modelstr - The text encoding model to use. Default is to use the encoding model aligned with the language model (i.e., it is retrieved from tiktoken if unset).api_basestr - The API base url to use.api_versionstr - The API version.deployment_namestr - The deployment name to use (Azure).organizationstr - The client organization.proxystr - The proxy URL to use.audiencestr - (Azure OpenAI only) The URI of the target Azure resource/service for which a managed identity token is requested. Used ifapi_keyis not defined. Default=https://cognitiveservices.azure.com/.defaultmodel_supports_jsonbool - Whether the model supports JSON-mode output.request_timeoutfloat - The per-request timeout.tokens_per_minuteint - Set a leaky-bucket throttle on tokens-per-minute.requests_per_minuteint - Set a leaky-bucket throttle on requests-per-minute.retry_strategystr - Retry strategy to use, "native" is the default and uses the strategy built into the OpenAI SDK. Other allowable values include "exponential_backoff", "random_wait", and "incremental_wait".max_retriesint - The maximum number of retries to use.max_retry_waitfloat - The maximum backoff time.concurrent_requestsint The number of open requests to allow at once.async_modeasyncio|threaded The async mode to use. Eitherasyncioorthreaded.responseslist[str] - If this model type is mock, this is a list of response strings to return.nint - The number of completions to generate.max_tokensint - The maximum number of output tokens. Not valid for o-series models.temperaturefloat - The temperature to use. Not valid for o-series models.top_pfloat - The top-p value to use. Not valid for o-series models.frequency_penaltyfloat - Frequency penalty for token generation. Not valid for o-series models.presence_penaltyfloat - Frequency penalty for token generation. Not valid for o-series models.max_completion_tokensint - Max number of tokens to consume for chat completion. Must be large enough to include an unknown amount for "reasoning" by the model. o-series models only.reasoning_effortlow|medium|high - Amount of "thought" for the model to expend reasoning about a response. o-series models only.
Input Files and Chunking
input
Our pipeline can ingest .csv, .txt, or .json data from an input location. See the inputs page for more details and examples.
Fields
storageStorageConfigtypefile|blob|cosmosdb - The storage type to use. Default=filebase_dirstr - The base directory to write output artifacts to, relative to the root.connection_stringstr - (blob/cosmosdb only) The Azure Storage connection string.container_namestr - (blob/cosmosdb only) The Azure Storage container name.storage_account_blob_urlstr - (blob only) The storage account blob URL to use.cosmosdb_account_blob_urlstr - (cosmosdb only) The CosmosDB account blob URL to use.file_typetext|csv|json - The type of input data to load. Default istextencodingstr - The encoding of the input file. Default isutf-8file_patternstr - A regex to match input files. Default is.*\.csv$,.*\.txt$, or.*\.json$depending on the specifiedfile_type, but you can customize it if needed.file_filterdict - Key/value pairs to filter. Default is None.text_columnstr - (CSV/JSON only) The text column name. If unset we expect a column namedtext.title_columnstr - (CSV/JSON only) The title column name, filename will be used if unset.metadatalist[str] - (CSV/JSON only) The additional document attributes fields to keep.
chunks
These settings configure how we parse documents into text chunks. This is necessary because very large documents may not fit into a single context window, and graph extraction accuracy can be modulated. Also note the metadata setting in the input document config, which will replicate document metadata into each chunk.
Fields
sizeint - The max chunk size in tokens.overlapint - The chunk overlap in tokens.group_by_columnslist[str] - Group documents by these fields before chunking.strategystr[tokens|sentences] - How to chunk the text.encoding_modelstr - The text encoding model to use for splitting on token boundaries.prepend_metadatabool - Determines if metadata values should be added at the beginning of each chunk. Default=False.chunk_size_includes_metadatabool - Specifies whether the chunk size calculation should include metadata tokens. Default=False.
Outputs and Storage
output
This section controls the storage mechanism used by the pipeline used for exporting output tables.
Fields
typefile|memory|blob|cosmosdb - The storage type to use. Default=filebase_dirstr - The base directory to write output artifacts to, relative to the root.connection_stringstr - (blob/cosmosdb only) The Azure Storage connection string.container_namestr - (blob/cosmosdb only) The Azure Storage container name.storage_account_blob_urlstr - (blob only) The storage account blob URL to use.cosmosdb_account_blob_urlstr - (cosmosdb only) The CosmosDB account blob URL to use.
update_index_output
The section defines a secondary storage location for running incremental indexing, to preserve your original outputs.
Fields
typefile|memory|blob|cosmosdb - The storage type to use. Default=filebase_dirstr - The base directory to write output artifacts to, relative to the root.connection_stringstr - (blob/cosmosdb only) The Azure Storage connection string.container_namestr - (blob/cosmosdb only) The Azure Storage container name.storage_account_blob_urlstr - (blob only) The storage account blob URL to use.cosmosdb_account_blob_urlstr - (cosmosdb only) The CosmosDB account blob URL to use.
cache
This section controls the cache mechanism used by the pipeline. This is used to cache LLM invocation results for faster performance when re-running the indexing process.
Fields
typefile|memory|blob|cosmosdb - The storage type to use. Default=filebase_dirstr - The base directory to write output artifacts to, relative to the root.connection_stringstr - (blob/cosmosdb only) The Azure Storage connection string.container_namestr - (blob/cosmosdb only) The Azure Storage container name.storage_account_blob_urlstr - (blob only) The storage account blob URL to use.cosmosdb_account_blob_urlstr - (cosmosdb only) The CosmosDB account blob URL to use.
reporting
This section controls the reporting mechanism used by the pipeline, for common events and error messages. The default is to write reports to a file in the output directory. However, you can also choose to write reports to an Azure Blob Storage container.
Fields
typefile|blob - The reporting type to use. Default=filebase_dirstr - The base directory to write reports to, relative to the root.connection_stringstr - (blob only) The Azure Storage connection string.container_namestr - (blob only) The Azure Storage container name.storage_account_blob_urlstr - The storage account blob URL to use.
vector_store
Where to put all vectors for the system. Configured for lancedb by default. This is a dict, with the key used to identify individual store parameters (e.g., for text embedding).
Fields
typelancedb|azure_ai_search|cosmosdb - Type of vector store. Default=lancedbdb_uristr (only for lancedb) - The database uri. Default=storage.base_dir/lancedburlstr (only for AI Search) - AI Search endpointapi_keystr (optional - only for AI Search) - The AI Search api key to use.audiencestr (only for AI Search) - Audience for managed identity token if managed identity authentication is used.container_namestr - The name of a vector container. This stores all indexes (tables) for a given dataset ingest. Default=defaultdatabase_namestr - (cosmosdb only) Name of the database.overwritebool (only used at index creation time) - Overwrite collection if it exist. Default=True
Workflow Configurations
These settings control each individual workflow as they execute.
workflows
list[str] - This is a list of workflow names to run, in order. GraphRAG has built-in pipelines to configure this, but you can run exactly and only what you want by specifying the list here. Useful if you have done part of the processing yourself.
embed_text
By default, the GraphRAG indexer will only export embeddings required for our query methods. However, the model has embeddings defined for all plaintext fields, and these can be customized by setting the target and names fields.
Supported embeddings names are:
text_unit.textdocument.textentity.titleentity.descriptionrelationship.descriptioncommunity.titlecommunity.summarycommunity.full_content
Fields
model_idstr - Name of the model definition to use for text embedding.vector_store_idstr - Name of vector store definition to write to.batch_sizeint - The maximum batch size to use.batch_max_tokensint - The maximum batch # of tokens.nameslist[str] - List of the embeddings names to run (must be in supported list).
extract_graph
Tune the language model-based graph extraction process.
Fields
model_idstr - Name of the model definition to use for API calls.promptstr - The prompt file to use.entity_typeslist[str] - The entity types to identify.max_gleaningsint - The maximum number of gleaning cycles to use.
summarize_descriptions
Fields
model_idstr - Name of the model definition to use for API calls.promptstr - The prompt file to use.max_lengthint - The maximum number of output tokens per summarization.max_input_lengthint - The maximum number of tokens to collect for summarization (this will limit how many descriptions you send to be summarized for a given entity or relationship).
extract_graph_nlp
Defines settings for NLP-based graph extraction methods.
Fields
normalize_edge_weightsbool - Whether to normalize the edge weights during graph construction. Default=True.text_analyzerdict - Parameters for the NLP model.- extractor_type regex_english|syntactic_parser|cfg - Default=
regex_english. - model_name str - Name of NLP model (for SpaCy-based models)
- max_word_length int - Longest word to allow. Default=
15. - word_delimiter str - Delimiter to split words. Default ' '.
- include_named_entities bool - Whether to include named entities in noun phrases. Default=
True. - exclude_nouns list[str] | None - List of nouns to exclude. If
None, we use an internal stopword list. - exclude_entity_tags list[str] - List of entity tags to ignore.
- exclude_pos_tags list[str] - List of part-of-speech tags to ignore.
- noun_phrase_tags list[str] - List of noun phrase tags to ignore.
- noun_phrase_grammars dict[str, str] - Noun phrase grammars for the model (cfg-only).
prune_graph
Parameters for manual graph pruning. This can be used to optimize the modularity of your graph clusters, by removing overly-connected or rare nodes.
Fields
- min_node_freq int - The minimum node frequency to allow.
- max_node_freq_std float | None - The maximum standard deviation of node frequency to allow.
- min_node_degree int - The minimum node degree to allow.
- max_node_degree_std float | None - The maximum standard deviation of node degree to allow.
- min_edge_weight_pct float - The minimum edge weight percentile to allow.
- remove_ego_nodes bool - Remove ego nodes.
- lcc_only bool - Only use largest connected component.
cluster_graph
These are the settings used for Leiden hierarchical clustering of the graph to create communities.
Fields
max_cluster_sizeint - The maximum cluster size to export.use_lccbool - Whether to only use the largest connected component.seedint - A randomization seed to provide if consistent run-to-run results are desired. We do provide a default in order to guarantee clustering stability.
extract_claims
Fields
enabledbool - Whether to enable claim extraction. Off by default, because claim prompts really need user tuning.model_idstr - Name of the model definition to use for API calls.promptstr - The prompt file to use.descriptionstr - Describes the types of claims we want to extract.max_gleaningsint - The maximum number of gleaning cycles to use.
community_reports
Fields
model_idstr - Name of the model definition to use for API calls.promptstr - The prompt file to use.max_lengthint - The maximum number of output tokens per report.max_input_lengthint - The maximum number of input tokens to use when generating reports.
embed_graph
We use node2vec to embed the graph. This is primarily used for visualization, so it is not turned on by default.
Fields
enabledbool - Whether to enable graph embeddings.dimensionsint - Number of vector dimensions to produce.num_walksint - The node2vec number of walks.walk_lengthint - The node2vec walk length.window_sizeint - The node2vec window size.iterationsint - The node2vec number of iterations.random_seedint - The node2vec random seed.strategydict - Fully override the embed graph strategy.
umap
Indicates whether we should run UMAP dimensionality reduction. This is used to provide an x/y coordinate to each graph node, suitable for visualization. If this is not enabled, nodes will receive a 0/0 x/y coordinate. If this is enabled, you must enable graph embedding as well.
Fields
enabledbool - Whether to enable UMAP layouts.
snapshots
Fields
embeddingsbool - Export embeddings snapshots to parquet.graphmlbool - Export graph snapshots to GraphML.
Query
local_search
Fields
chat_model_idstr - Name of the model definition to use for Chat Completion calls.embedding_model_idstr - Name of the model definition to use for Embedding calls.promptstr - The prompt file to use.text_unit_propfloat - The text unit proportion.community_propfloat - The community proportion.conversation_history_max_turnsint - The conversation history maximum turns.top_k_entitiesint - The top k mapped entities.top_k_relationshipsint - The top k mapped relations.max_context_tokensint - The maximum tokens to use building the request context.
global_search
Fields
chat_model_idstr - Name of the model definition to use for Chat Completion calls.map_promptstr - The mapper prompt file to use.reduce_promptstr - The reducer prompt file to use.knowledge_promptstr - The knowledge prompt file to use.map_promptstr | None - The global search mapper prompt to use.reduce_promptstr | None - The global search reducer to use.knowledge_promptstr | None - The global search general prompt to use.max_context_tokensint - The maximum context size to create, in tokens.data_max_tokensint - The maximum tokens to use constructing the final response from the reduces responses.map_max_lengthint - The maximum length to request for map responses, in words.reduce_max_lengthint - The maximum length to request for reduce responses, in words.dynamic_search_thresholdint - Rating threshold in include a community report.dynamic_search_keep_parentbool - Keep parent community if any of the child communities are relevant.dynamic_search_num_repeatsint - Number of times to rate the same community report.dynamic_search_use_summarybool - Use community summary instead of full_context.dynamic_search_max_levelint - The maximum level of community hierarchy to consider if none of the processed communities are relevant.
drift_search
Fields
chat_model_idstr - Name of the model definition to use for Chat Completion calls.embedding_model_idstr - Name of the model definition to use for Embedding calls.promptstr - The prompt file to use.reduce_promptstr - The reducer prompt file to use.data_max_tokensint - The data llm maximum tokens.reduce_max_tokensint - The maximum tokens for the reduce phase. Only use if a non-o-series model.reduce_max_completion_tokensint - The maximum tokens for the reduce phase. Only use for o-series models.concurrencyint - The number of concurrent requests.drift_k_followupsint - The number of top global results to retrieve.primer_foldsint - The number of folds for search priming.primer_llm_max_tokensint - The maximum number of tokens for the LLM in primer.n_depthint - The number of drift search steps to take.local_search_text_unit_propfloat - The proportion of search dedicated to text units.local_search_community_propfloat - The proportion of search dedicated to community properties.local_search_top_k_mapped_entitiesint - The number of top K entities to map during local search.local_search_top_k_relationshipsint - The number of top K relationships to map during local search.local_search_max_data_tokensint - The maximum context size in tokens for local search.local_search_temperaturefloat - The temperature to use for token generation in local search.local_search_top_pfloat - The top-p value to use for token generation in local search.local_search_nint - The number of completions to generate in local search.local_search_llm_max_gen_tokensint - The maximum number of generated tokens for the LLM in local search. Only use if a non-o-series model.local_search_llm_max_gen_completion_tokensint - The maximum number of generated tokens for the LLM in local search. Only use for o-series models.
basic_search
Fields
chat_model_idstr - Name of the model definition to use for Chat Completion calls.embedding_model_idstr - Name of the model definition to use for Embedding calls.promptstr - The prompt file to use.kint | None - Number of text units to retrieve from the vector store for context building.