Skip to content

Latest commit

 

History

History
56 lines (37 loc) · 1.6 KB

Readme.md

File metadata and controls

56 lines (37 loc) · 1.6 KB

Knowledge Graph Builder

Python

Graph Creation

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]
Loading

Installation

First, install the dependenices

pip install -r requirements.txt

Configure Neo4J (Dozerdb)

Next, install Neo4j. I recommend doing this Dozerb as it offers enterprise features in the community edition. You can use this script 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

Usage

Once complete you can set your FILE_PATH in 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. Defaults to 2.

Question Answering

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
Loading

You can perform QA on your knowledge graph using the streamlit application at graph_qa_chatbot.py

streamlit run graph_qa_chatbot.py