Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blacksmithop/llm-graph-builder
Build Neo4J Knowledge Graphs from Excel files
https://github.com/blacksmithop/llm-graph-builder
knowledge-graph llm neo4j python
Last synced: 2 months ago
JSON representation
Build Neo4J Knowledge Graphs from Excel files
- Host: GitHub
- URL: https://github.com/blacksmithop/llm-graph-builder
- Owner: blacksmithop
- Created: 2024-07-03T09:19:31.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-17T06:40:11.000Z (5 months ago)
- Last Synced: 2024-10-10T09:20:13.817Z (2 months ago)
- Topics: knowledge-graph, llm, neo4j, python
- Language: Python
- Homepage:
- Size: 2.66 MB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Knowledge Graph Builder
![Python](https://skillicons.dev/icons?i=python,docker)
## Graph Creation
```mermaid
flowchart TD
A[File Upload] --> B[Identify File Type]
B --> C[Create Documents]
C --> D[Extract Entity from Document]
D --> E[Get Entity Relationships]
E --> F[Create Vector Index]
```### Installation
First, install the dependenices
```bash
pip install -r requirements.txt
```### Configure Neo4J (Dozerdb)
Next, install Neo4j. I recommend doing this [Dozerb](https://dozerdb.org/) as it offers enterprise features in the community edition. You can use this [script](./install_dozerdb.sh) to get a docker container running.
### Configure LLM, Embeddings
You can use Azure OpenAI, Ollama or your custom provider. You just need to define your LLM and Embeddings model in [llm_core.py](./utils/common/llm_core.py)
### Usage
Once complete you can set your `FILE_PATH` in [knowledge_graph_creator.py](./knowledge_graph_creator.py) and run the python script. It should you populate you Neo4J database.
The Builder supports different modes of operation when creating the nodes. This can be toggled by changing `prompt_version` in [Neo4JKnowledgeGraph](/utils/custom/knowledge_graph.py#L40). Defaults to `2`.
## Question Answering
```mermaid
graph TD
A[Query] --> B[Construct Cypher from Schema]
B --> C[Retrieve related Nodes]
C --> D{Can Answer Question}
D -->|Yes| E[Response]
D -->|No| F[Process result]
F --> E
```You can perform QA on your knowledge graph using the streamlit application at [graph_qa_chatbot.py](./graph_qa_chatbot.py)
```bash
streamlit run graph_qa_chatbot.py
```