BI
bit-whacker/graphrag-genomics
Local models support for Microsoft's graphrag using ollama (llama3, mistral, gemma2 phi3)- LLM & Embedding extraction
๐ # GraphRAG-genomics
GraphRAG-Omics is an extension of Microsoft's GraphRAG library and TheAiSingularity/graphrag-local-ollama library that enables users to convert unstructured documents into knowledge graphs and interact with them using natural language queries.
This is just an expremental repository where the prompts were tailored for genomics and clinical documents.
๐ Main Highlights
- ๐ Document Indexing: Convert raw
.txtdocuments into.parquetfiles - this uses graphrag library. - ๐ง Knowledge Graph Generation: Transform indexed documents into a structured knowledge graph stored in a Neo4j server.
- ๐ฌ Natural Language Querying: Interact with your knowledge graph through an intuitive Streamlit web interface โ ask questions, get insights.
๐๏ธ Project Structure
graphrag-omics/
โ
โโโ graphrag_workflow.bat # Command-line script to index documents
โโโ app.py # Streamlit app for graph creation and querying
โโโ input/ # Directory to place raw .txt documents
โโโ proj_<project_name>/ # Generated output for each project
Components
-
Command-Line Indexing Script
- Takes input
.txtdocuments - Outputs
.parquetfiles into a project-specific folder
- Takes input
-
Streamlit Web App
- Indexing Tab: Load
.parquetfiles and generate a knowledge graph in Neo4j - Query Tab: Use natural language to query your knowledge graph (GraphRAG interface)
- Indexing Tab: Load
๐งช How to Run
Prerequisits
- install all necessary required libraries
- install neo4j-desktop
- install the graphrag, by executing the following command inside the root directory of the project.
pip install -e .Step 1: Index Your Documents
- Place your
.txtdocuments inside theinput/folder (located in the root of the project). - Run the following command:
bash graphrag_workflow.bat proj_<project_name>๐ The project name must start with
proj_
โ Example: For a project named "med", use:
bash graphrag_workflow.bat proj_medThis will create a folder proj_med/ and generate the .parquet files inside it.
Step 2: Generate the Knowledge Graph & Query
- Start the Streamlit app:
streamlit run app.py- Navigate to your browser where the app opens automatically.
- Use the following tabs inside the app:
- Indexing: Select a project (e.g.,
proj_med) and generate the knowledge graph in Neo4j. - Query: Ask questions using natural language โ powered by the generated knowledge graph (GraphRAG style).
- Indexing: Select a project (e.g.,
๐ Notes
- Only
.txtdocuments are currently supported. - Ensure that the Neo4j server is running before using the Indexing or Query functionality in the app.
๐งฌ Use Cases
- Genomics research papers
- Clinical documents & patient summaries
- Biomedical literature mining
- Interactive Q&A from specialized unstructured data