|
1 | 1 | # GraphRAG
|
2 | 2 | An implementation of GraphRAG using graphrag-sdk, falkordb, langchain, ...
|
3 | 3 |
|
| 4 | +## Project Overview |
| 5 | +This project is a robust service for managing, generating, and interacting with Knowledge Graphs (KG) using the **GraphRAG-SDK**, **FalkorDB**, and **LangChain**. The service provides a flexible and scalable platform for handling different file types, creating ontologies, generating KGs, extending them, and interacting with them via chat. |
4 | 6 |
|
5 |
| -## Running Manually |
| 7 | +Key features of this project include: |
| 8 | +- **GraphRAG-SDK**: Used for managing the creation and processing of Knowledge Graphs. |
| 9 | +- **FalkorDB**: Stores and evolves the generated KGs in a highly efficient and scalable manner. |
| 10 | +- **LangChain**: Powers the conversational chat interface, enabling interactions with the knowledge stored in the KG. |
| 11 | +- **FastAPI**: The service is built as a FastAPI application to provide a fast and efficient API layer for interacting with the system. |
| 12 | +- **Dockerized with Docker Compose**: The entire service is containerized for easy deployment, with CI/CD pipelines via GitHub Actions for continuous integration and delivery. |
6 | 13 |
|
7 |
| -- DB: |
8 |
| -```shell |
9 |
| -docker pull falkordb/falkordb:edge |
10 |
| -docker run -p 6379:6379 -p 3000:3000 -it --rm -v ./knowledgebase:/knowledgebase falkordb/falkordb:edge |
11 |
| -``` |
| 14 | +## Features |
| 15 | +- **Ontology Creation**: Define and create an ontology to structure the data for the KG. |
| 16 | +- **Knowledge Graph Generation**: Generate a KG based on a provided ontology and various data sources (PDF, Word, PowerPoint). |
| 17 | +- **KG Extension**: Add new data and extend the existing KG. |
| 18 | +- **Chat Interface**: Interact with the generated KG via a conversational chat powered by LangChain. |
| 19 | +- **File Upload**: Upload files for future processing and integration. |
| 20 | + |
| 21 | +## How to Run the Service |
12 | 22 |
|
13 |
| -- FASTAPI |
14 |
| -```shell |
15 |
| -fastapi run app.py |
16 |
| -``` |
17 |
| - |
| 23 | +### Prerequisites |
| 24 | +- Python 3.11 |
| 25 | +- Docker and Docker Compose installed |
| 26 | +- FastAPI and other Python dependencies |
| 27 | + |
| 28 | +### Setup Instructions |
| 29 | + |
| 30 | +1. **Clone the repository**: |
| 31 | + ```bash |
| 32 | + git clone https://github.com/fatemenajafi135/GraphRAG.git |
| 33 | + cd GraphRAG |
| 34 | + ``` |
| 35 | + |
| 36 | +2. Build and run the Docker containers: The project uses Docker Compose to set up the necessary services. |
| 37 | + ```shell |
| 38 | + docker-compose up --build |
| 39 | + ``` |
| 40 | + This will: |
| 41 | + |
| 42 | +- Build the FastAPI service container. |
| 43 | +- Set up the FalkorDB container for storing the Knowledge Graph. |
| 44 | +- Ensure that the CI/CD pipeline for GitHub Actions is ready for automatic deployment. |
| 45 | + |
| 46 | +3. Access the FastAPI documentation: Once the services are running, you can access the FastAPI documentation at: |
| 47 | + ```shell |
| 48 | + http://localhost:8000/docs |
| 49 | + ``` |
| 50 | + |
| 51 | +4. CI/CD Pipeline (GitHub Actions): The repository is integrated with GitHub Actions for CI/CD automation. It automatically builds, tests, and deploys containers upon any changes to the codebase. All relevant configuration files for GitHub Actions can be found in the `.github/workflows/` directory. |
| 52 | + |
| 53 | +5. Available APIs |
| 54 | +The service exposes the following APIs for interacting with the Knowledge Graph: |
| 55 | + |
| 56 | +- POST /ontology/create: Create a new ontology based on a provided sources. |
| 57 | +- POST /kg/create: Generate a new Knowledge Graph based on the defined ontology. |
| 58 | +- PUT /kg/extend: Extend an existing Knowledge Graph by adding new data. |
| 59 | +- POST /kg/upload-files: upload files for future processing and integration. (URL, PDF, Word, PowerPoint). |
| 60 | +- POST /chat: Chat interface to interact with the Knowledge Graph via LangChain. |
| 61 | + |
| 62 | +## Technologies Used AND WHY |
| 63 | + |
| 64 | +- **GraphRAG-SDK**: |
| 65 | + - Framework for generating and managing Knowledge Graphs. |
| 66 | + - Chosen for its ability to efficiently manage the process of generating and processing complex Knowledge Graphs. |
| 67 | +- **FalkorDB**: |
| 68 | + - A scalable, production-grade graph database to store the Knowledge Graph. |
| 69 | + - Ideal for storing graph-based data, providing fast querying and scalability. |
| 70 | +- **LangChain**: |
| 71 | + - Conversational AI chain for querying and interacting with the Knowledge Graph. |
| 72 | + - A powerful tool for building conversational AI chains, perfect for creating chat interfaces with knowledge graphs. |
| 73 | +- **FastAPI**: |
| 74 | + - A modern web framework for creating APIs. |
| 75 | + - Known for its high performance and easy integration with modern Python-based APIs. |
| 76 | +- **Docker & Docker Compose**: |
| 77 | + - Containerization and orchestration for the entire service. |
| 78 | + - Ensures consistency in deployment across environments and simplifies managing dependencies. |
| 79 | +- **GitHub Actions**: |
| 80 | + - CI/CD for automated testing and deployment. |
0 commit comments