Prakhar Bhandari
commited on
Commit
·
f4cb83e
1
Parent(s):
fd975a4
Added readme, example .env and removed ipynb
Browse files- .env.example +6 -0
- .gitignore +2 -1
- kg_builder/README.md +53 -0
.env.example
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copy this file to .env and replace placeholder values with your actual settings.
|
| 2 |
+
|
| 3 |
+
OPENAI_API_KEY=
|
| 4 |
+
NEO4J_URL=
|
| 5 |
+
NEO4J_USERNAME=
|
| 6 |
+
NEO4J_PASSWORD=
|
.gitignore
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
graphrag/
|
| 2 |
-
.env
|
|
|
|
|
|
| 1 |
graphrag/
|
| 2 |
+
.env
|
| 3 |
+
.ipynb
|
kg_builder/README.md
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Knowledge Graph Builder
|
| 2 |
+
|
| 3 |
+
## Description
|
| 4 |
+
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.
|
| 5 |
+
|
| 6 |
+
## Features
|
| 7 |
+
- **Knowledge Graph Construction**: Build graphs from Wikipedia articles.
|
| 8 |
+
- **Graph-Based Querying**: Utilize graphs to answer queries with a Graph Cypher QA Chain.
|
| 9 |
+
- **Environment Flexibility**: Manages dependencies and environment variables through `.env` files.
|
| 10 |
+
|
| 11 |
+
## Prerequisites
|
| 12 |
+
- Python 3.8+
|
| 13 |
+
- pip and virtualenv (optional)
|
| 14 |
+
- Access to a Neo4j database
|
| 15 |
+
- OpenAI API key
|
| 16 |
+
|
| 17 |
+
## Installation
|
| 18 |
+
1. **Clone the repository**:
|
| 19 |
+
```bash
|
| 20 |
+
git clone https://yourrepository.git
|
| 21 |
+
cd your_project_directory
|
| 22 |
+
```
|
| 23 |
+
2. **Set up a Python virtual environment (optional):**
|
| 24 |
+
```bash
|
| 25 |
+
python -m venv venv
|
| 26 |
+
source venv/bin/activate # On Windows use `venv\Scripts\activate`
|
| 27 |
+
```
|
| 28 |
+
3. **Install the required packages:**
|
| 29 |
+
```bash
|
| 30 |
+
pip install -r requirements.txt
|
| 31 |
+
```
|
| 32 |
+
4. **Set up your environment variables:**
|
| 33 |
+
- Copy the `.env.example` to `.env`:
|
| 34 |
+
```bash
|
| 35 |
+
cp .env.example .env
|
| 36 |
+
```
|
| 37 |
+
- Edit the `.env` file to include your specific configurations such as `OPENAI_API_KEY`, `NEO4J_URL`, `NEO4J_USERNAME`, and `NEO4J_PASSWORD`.
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
|
| 41 |
+
1. **Run the main script:**
|
| 42 |
+
```bash
|
| 43 |
+
python main.py
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## Contributing
|
| 47 |
+
|
| 48 |
+
Contributions are welcome! To contribute:
|
| 49 |
+
1. Fork the Project
|
| 50 |
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
| 51 |
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
| 52 |
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
| 53 |
+
5. Open a Pull Request
|