Skip to main content

No project description provided

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

knowledge_graph_rag-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

knowledge_graph_rag-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file knowledge_graph_rag-0.1.0.tar.gz.

File metadata

  • Download URL: knowledge_graph_rag-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.9

File hashes

Hashes for knowledge_graph_rag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e7d0e9a91f9a2b32be6fd0c2cc763ccc65b64d9302df9ab40a5b49c30fd486b9
MD5 4c2a910a70275c1b7a92bdc2a25c1858
BLAKE2b-256 ec90f1edc8f824eebd0b1b9e5573c547e2982b2e9fe9fc1ee3a02a8cafecc36e

See more details on using hashes here.

File details

Details for the file knowledge_graph_rag-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for knowledge_graph_rag-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e36e648020d3a1d33039b342672af5426dc67521492400adc1c268105ab99cbf
MD5 52d67127689ffc2752b7519c8a5c5d33
BLAKE2b-256 247eebdf9f36353e181632dded270f2c2b17757e2a4135683a572c8792c27fde

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page