Knowledge Graphs
Creating a knowledge graph and running graphrag using R2R.
Create a graph
Creating a graph on your documents.
The ID of the collection to create the graph for. If not provided, the graph will be created for the default collection.
The type of run to perform. Options are “estimate” or “run”. Estimate will return an estimate of the creation cost, and run will create the graph.
The settings for the graph creation process.
Enrich a graph
The ID of the collection to enrich the graph for. If not provided, the graph will be enriched for the default collection.
The type of run to perform. Options are “estimate” or “run”. Estimate will return an estimate of the enrichment cost, and run will create the enriched graph.
The settings for the graph enrichment process.
Get entities
The ID of the collection to get the entities from. If not provided, the entities will be retrieved from the default collection.
The offset for pagination.
The limit for pagination.
The list of entity IDs to filter by.
Get triples
The ID of the collection to get the triples from. If not provided, the triples will be retrieved from the default collection.
The offset for pagination. Defaults to 0.
The limit for pagination. Defaults to 100.
The list of entity names to filter by. Entities are in all caps. eg. [‘ARISTOTLE’, ‘PLATO’]
The list of triple IDs to filter by.
Get Communities
The ID of the collection to get the communities from. If not provided, the communities will be retrieved from the default collection.
The offset for pagination. Defaults to 0.
The limit for pagination. Defaults to 100.
The list of levels to filter by. As output of hierarchical clustering, each community is assigned a level.
The list of community numbers to filter by.
Delete Graph
Delete the graph for a collection using the delete_graph_for_collection
method.
The ID of the collection to delete the graph for.
Whether to cascade the deletion.
NOTE: Setting this flag to true will delete entities and triples for documents that are shared across multiple collections. Do not set this flag unless you are absolutely sure that you want to delete the entities and triples for all documents in the collection.
Get Tuned Prompt
The name of the prompt to tune. Valid values include “graphrag_entity_description”, “graphrag_triples_extraction_few_shot”, and “graphrag_community_reports”.
The ID of the collection to tune the prompt for. If not provided, the default collection will be used.
The offset for pagination of documents. Defaults to 0.
The limit for pagination of documents. Defaults to 100. Controls how many documents are used for tuning.
The offset for pagination of chunks within each document. Defaults to 0.
The limit for pagination of chunks within each document. Defaults to 100. Controls how many chunks per document are used for tuning.
The tuning process provides an LLM with chunks from each document in the collection. The relative sample size can therefore be controlled by adjusting the document and chunk limits.
Deduplicate Entities
The ID of the collection to deduplicate entities for.
The settings for the entity deduplication process.
Search and RAG
Please see the Search and RAG documentation for more information on how to perform search and RAG using Knowledge Graphs.
API Reference
Please see the API documentation for more information on the capabilities of the R2R Graph creation and enrichment API.