$ show SteveHedden/kg_llm
This repository is a tutorial and research exploration of Graph RAG (Retrieval-Augmented Generation) combining vector databases (Weaviate) and knowledge graphs (RDF/SPARQL). It contains Jupyter notebooks that demonstrate building knowledge graphs from PubMed articles, World Bank documents, and Netflix movies, comparing vector search and structured query performance for retrieval-augmented generation. A Streamlit app provides an interactive demo for medical article search with MeSH term refinement and LLM summarization. The code is primarily educational, with reusable query modules for Weaviate, RDF, and Databricks, but lacks dependency pinning and has hardcoded credentials, limiting reproducibility. The repository is hybrid, with both application (Streamlit app) and data research (notebooks, datasets) elements, but the dominant character is data research as the core value lies in the experimental notebooks and data pipelines.
The LLM identified 3 files worth highlighting for reuse:
Provides a reusable Weaviate client initialization with cloud authentication and OpenAI headers, plus functions for vector search on articles and MeSH terms. Isolated from internal modules, depends only on weaviate and os libraries. Can be extracted and adapted for any Weaviate-based vector search application.
Contains functions for downloading RDF files from Databricks, executing SPARQL queries against a local RDF graph, and expanding MeSH terms via the MeSH SPARQL endpoint. Includes a utility to convert MeSH terms to URIs. Demonstrates a clean pattern for integrating external SPARQL endpoints with local RDF processing. Reusable for any project needing MeSH hierarchy exploration or RDF-based filtering.
A thin wrapper for executing SQL queries against Databricks using the Databricks SQL connector. Handles connection setup and query execution with parameterized SQL. While Databricks-specific, the pattern of abstracting database queries into a separate module is reusable for any SQL-based data source.