Skip to main content

Knowledge Graph RAG

Automatically create knowledge graphs + document networks to boost performance on RAG

1. Install Knowledge Graph RAG:

pip install knowledge_graph_rag

2. Create a Knowledge Graph or a Document Graph:

# Creating KG on medical documents
documents = ["Cardiovascular disease ...",
             "Emerging therapeutic interventions ...",
             "The epidemiological burden ...
             "Cardiovascular disease also ...",
             "Advanced imaging techniques, ...",
             "Role of novel biomarkers ..."
]
knowledge_graph = KnowledgeGraph(documents)
knowledge_graph.create()
knowledge_graph.plot()

Knowledge graph

documents_graph = DocumentsGraph(documents=documents)
documents_graph.plot()

Documents graph

3. Search knowledge graph entities or find interconnected documents, to augment your LLM context:

knowledge_graph.search_document(user_query)
>> Entity: cardiovascular disease
  -> antihypertensive agents (Relationship: involves treatment with)
  -> statins (Relationship: used to modulate dyslipidemia)
  -> antiplatelet therapy (Relationship: utilized to mitigate thrombosis risk)
  -> biomarkers (Relationship: detection and prognostication of acute coronary syndromes and heart failure)
  -> high-sensitivity troponins (Relationship: detection of acute coronary syndromes and heart failure)
  -> natriuretic peptides (Relationship: prognostication of acute coronary syndromes and heart failure)
documents_containing_connected_terminology = documents_graph.find_connected_documents(vectordb_search_result)
documents_containing_connected_terminology
>> [{'document': 'emerging therapeutic intervention ...'},
 {'document': 'management cardiovascular ...'},
 {'document': 'role novel biomarkers ...'}]

Star History

Star History Chart

Metadata

Release files for knowledge-graph-rag 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for knowledge-graph-rag 0.1.1
File Size Uploaded Provenance Actions
knowledge_graph_rag-0.1.1.tar.gz 7.5 kB Without provenance Details for knowledge_graph_rag-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for knowledge-graph-rag 0.1.1
File Interpreter ABI Platform Actions
knowledge_graph_rag-0.1.1-py3-none-any.whl Python 3 none any Details for knowledge_graph_rag-0.1.1-py3-none-any.whl

Total release size: 16.8 kB

Release files / knowledge_graph_rag-0.1.1.tar.gz

Download URL knowledge_graph_rag-0.1.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
502dcc89179c9304f1c1659b5c06f6c07eead6f60eef61ab29a16a05cd55be5f
BLAKE2b-256 checksum
How to use checksums
4011b1bc5063556465136477f3eb7a0e269be77c80acc45c58fa7971342e3582
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / knowledge_graph_rag-0.1.1-py3-none-any.whl

Download URL knowledge_graph_rag-0.1.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9d3c36114a4c291d8c7c8a1cf614333786e5a936d40eba2c9815a025fa86cdd
BLAKE2b-256 checksum
How to use checksums
e367e3c2a50d5e319fe0542c46d8ac7d8158b960542ebe0404a73b6e7a5948ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for knowledge-graph-rag 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page