Skip to content

Jakee4488/Graphrag-flaskapp

Repository files navigation

Graph RAG Flask Application

A Retrieval-Augmented Generation (RAG) application using Knowledge Graphs (KùzuDB), Vector Search (FAISS), and Local LLMs (Ollama/DeepSeek).

Features

  • Hybrid Retrieval: Combines vector similarity search with knowledge graph traversal.
  • Local Processing: Uses local LLMs via Ollama for privacy and cost efficiency.
  • Graph Visualization: Interactive graph view using Cytoscape.js.
  • Document Support: PDF, DOCX, TXT, MD.

Prerequisites

1. Install Ollama

Download and install Ollama from ollama.com.

2. Pull the Model

This project uses deepseek-r1:8b by default. Run the following command in your terminal:

ollama pull deepseek-r1:8b

Start the Ollama server:

ollama serve

(Note: On some systems, the desktop app runs the server automatically)

3. Python Environment

Ensure you have Python 3.9+ installed.

Installation

  1. Clone or navigate to the project directory:

    cd graphrag-flask
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
    # Windows
    venv\Scripts\activate
    # Mac/Linux
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt

Configuration

The application uses a config.py file which loads environment variables. You can create a .env file to override defaults:

OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=deepseek-r1:8b
KUZU_DB_PATH=./kuzu_db
CHUNK_SIZE=500

Running the Application

  1. Start the Flask server:

    python app.py
  2. Open your browser and navigate to: http://localhost:5000

Usage

  1. Upload: Use the sidebar to upload a document.
  2. Process: Click "Process" to extract entities and build the graph.
  3. Chat: Ask questions about your documents in the chat window.

About

Implementation of a GraphRAG system using a Flask application with the Ollama API and locally built models, leveraging graph-based structures for advanced query retrieval.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors