Knowledge Graph Builder
Description
This project builds and queries knowledge graphs from Wikipedia articles using the LangChain library and OpenAI's language models, storing data in a Neo4j database.
Features
- Knowledge Graph Construction: Build graphs from Wikipedia articles.
- Graph-Based Querying: Utilize graphs to answer queries with a Graph Cypher QA Chain.
- Environment Flexibility: Manages dependencies and environment variables through
.envfiles.
Prerequisites
- Python 3.8+
- pip and virtualenv (optional)
- Access to a Neo4j database
- OpenAI API key
- Extra change
Installation
- Clone the repository:
git clone git@hf.co:Master-Thesis-Prakhar/GraphRAG cd GraphRAG - Set up a Python virtual environment (optional):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` - Install the required packages:
pip install -r requirements.txt - Set up your environment variables:
- Copy the
.env.exampleto.env:cp .env.example .env - Edit the
.envfile to include your specific configurations such asOPENAI_API_KEY,NEO4J_URL,NEO4J_USERNAME, andNEO4J_PASSWORD.
- Copy the
Usage
Create Graph
python3 kg_builder/src/graph_creation.pyRun the main script:
python main.py
Contributing
Contributions are welcome! To contribute:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request