π§ Upload your study materials, let AI build a knowledge graph, then ask questions about everything you've learned.
- Upload anything: PDFs, text files, even screenshots - we'll extract the text automatically
- Builds a knowledge graph: The AI finds entities and relationships in your documents and connects them
- Smart search: Ask questions and get answers from across all your materials
- See the connections: Visualize how everything in your notes relates to each other
- Your stuff stays yours: Each user has their own private graph
# Start Neo4j (this is your graph database)
neo4j start
# Username and password are both "neo4j" by default
# Get an OpenRouter API key (they have a free tier)
# Go to https://openrouter.ai and sign up# Go to your project folder
cd student-rag
# Copy the example environment file
cp .env.example .env
# Open .env and add your keys:
OPENROUTER_API_KEY=your_api_key_here
NEO4J_URI=neo4j://127.0.0.1:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your_neo4j_password
# Install everything
pip install -r requirements.txtstreamlit run app.pyOpen your browser to http://localhost:8501 and you're good to go.
- Click on "π Upload Materials"
- Pick your PDFs, text files, or screenshots
- Hit "Process & Index"
- Wait a bit while it builds the knowledge graph
- Go to "π¬ Ask Questions About Your Materials"
- Type whatever you want to know
- Get answers pulled from everything you've uploaded
- Head to "πΈοΈ Knowledge Graph Visualization"
- Click "π¨ Visualize Graph"
- Play around with the interactive graph - you can see how everything connects
- Frontend: Streamlit (simple Python web UI)
- LLM: OpenRouter (free Llama models)
- Graph Database: Neo4j
- OCR: EasyOCR (for reading screenshots)
- Vector Search: Sentence Transformers
- Visualization: PyVis
- Agent: LangGraph (handles the workflow)
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Streamlit UI ββββββ LangGraph Agent ββββββ Neo4j Graph β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Upload files + β β AI extracts β β Stores in your β
β OCR if needed β β entities & links β β personal graph β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Breaks text β β Searches both β β Shows you the β
β into chunks β β vectors & graph β β visual network β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
binusbrain/
βββ app.py # Main app file
βββ requirements.txt # Python packages
βββ .env.example # Template for your settings
βββ config/
β βββ neo4j_config.py # Neo4j setup
β βββ llm_config.py # OpenRouter setup
βββ src/
βββ agent.py # LangGraph workflow
βββ upload_handler.py # Handles file uploads and OCR
βββ kg_extractor.py # Extracts entities and relationships
βββ neo4j_client.py # Talks to Neo4j
βββ query_engine.py # Searches and answers questions
βββ graph_viz.py # Makes the visualization
We're not using those huge Microsoft GraphRAG pipelines. Instead:
- Simple LLM extraction: LLM pulls out entities and relationships
- Straight to Neo4j: No complicated indexing pipelines
- Separate graphs per user: Your stuff doesn't mix with anyone else's
- Actually fast: Takes 5-30 seconds per document instead of several minutes
- Vector similarity: Finds relevant chunks using embeddings
- Graph context: Grabs related entities and their connections
- AI answers: Combines everything to give you complete answers
- Live network graph: Click and drag nodes around
- Smart sizing: Bigger nodes = more connections
- Color coded: Different colors for different entity types
- Stats: See how many nodes, edges, and entity types you have
OPENROUTER_API_KEY=your_api_key_here
NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your_neo4j_password- Download Neo4j Desktop (it's free)
- Create a new database - it'll give you default credentials
- Run
neo4j start - You can check it at
http://localhost:7474
- Go to https://openrouter.ai and make an account
- Add $10 in credits (or stick with free tier)
- Grab your API key from the "Keys" section
- We're using
meta-llama/llama-3.1-8b-instructwhich is free
# Test Neo4j
from config.neo4j_config import neo4j_config
print(neo4j_config.test_connection())
# Test LLM
from config.llm_config import llm_config
success, response = llm_config.test_connection()
print(f"LLM working: {success}")
# Test uploads
from src.upload_handler import upload_handler
text, type = upload_handler.process_upload(file_data, filename, user_id)- Different LLM: Edit
config/llm_config.py - Entity types: Change in
src/kg_extractor.py - UI look: Mess with the CSS in
app.py - Graph colors: Update
src/graph_viz.py
# Check if it's running
neo4j status
neo4j start # Start it up# Make sure your key is set
echo $OPENROUTER_API_KEY
# Check your credits on the OpenRouter dashboard# Reinstall everything
pip install -r requirements.txt --force-reinstall- EasyOCR downloads big models the first time you use it
- First OCR might take 30-60 seconds
- After that it's much faster
- Processing uploads: 5-30 seconds per document
- Answering questions: 2-10 seconds
- Loading visualization: Pretty much instant
- Storage: About 1KB per entity, 500 bytes per relationship
- Isolated users: Everyone gets their own graph namespace
- Local processing: Most of the work happens on your machine
- No permanent storage: We don't save your uploaded files
- Secure keys: API keys stay in your environment variables
Some ideas for later:
- Proper user login system
- Share graphs with classmates
- Proper Knowledge graph accuracy
- Better graph analytics
- Support more languages for OCR
- Real-time collaborative editing
If something's not working:
- Check the troubleshooting section above
- Make sure you installed everything
- Verify Neo4j and OpenRouter are configured right
- Look at the console logs - they usually tell you what's wrong
Made for students who want to actually understand and connect their study materials instead of just having a pile of PDFs they never look at again.