Agentic RAG Embedding Gemma
This Streamlit app demonstrates an agentic Retrieval-Augmented Generation (RAG) Agent using Google's EmbeddingGemma for embeddings and Llama 3.2 as th…
- Llama
- local
RAG and Knowledge ·Intermediate
A Streamlit application demonstrating how Knowledge Graph-based Retrieval-Augmented Generation (RAG) provides multi-hop reasoning with fully verifiable source attribution.
License Apache-2.0 · content curated and maintained by Doutor AI.
A Streamlit application demonstrating how Knowledge Graph-based Retrieval-Augmented Generation (RAG) provides multi-hop reasoning with fully verifiable source attribution.
Traditional vector-based RAG finds similar text chunks, but struggles with:
Knowledge Graph RAG solves these by:
| Feature | Description |
|---|---|
| 🔗 Multi-hop Reasoning | Traverse entity relationships to answer complex questions |
| 📚 Verifiable Citations | Every claim includes source document and text |
| 🧠 Reasoning Trace | See exactly how the answer was derived |
| 🏠 Fully Local | Uses Ollama for LLM, Neo4j for graph storage |
# Install from https://ollama.ai
ollama pull llama3.2
# Using Docker
docker run -d \
--name neo4j \
-p 7474:7474 -p 7687:7687 \
-e NEO4J_AUTH=neo4j/password \
neo4j:latest
# Clone and navigate
cd knowledge_graph_rag_citations
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run knowledge_graph_rag.py
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Document │ ──► │ LLM Extraction │ ──► │ Knowledge Graph │
│ (Text/PDF) │ │ (Entities+Rels) │ │ (Neo4j) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
The LLM extracts:
┌─────────┐ ┌─────────────┐ ┌─────────────┐ ┌───────────┐
│ Query │ ──► │ Find Start │ ──► │ Traverse │ ──► │ Context │
│ │ │ Entities │ │ Relations │ │ + Sources│
└─────────┘ └─────────────┘ └─────────────┘ └───────────┘
┌─────────────┐ ┌─────────────┐ ┌──────────────────┐
│ Context │ ──► │ Generate │ ──► │ Answer with │
│ + Sources │ │ Answer │ │ [1][2] Citations│
└─────────────┘ └─────────────┘ └──────────────────┘
│
▼
┌──────────────────┐
│ Citation Details │
│ • Source Doc │
│ • Source Text │
│ • Reasoning Path │
└──────────────────┘
Paste or select a sample document. The system extracts entities and relationships:
Document: "GraphRAG was developed by Microsoft Research.
Darren Edge led the project..."
Extracted:
├── Entity: GraphRAG (TECHNOLOGY)
├── Entity: Microsoft Research (ORGANIZATION)
├── Entity: Darren Edge (PERSON)
└── Relationship: Darren Edge --[WORKS_FOR]--> Microsoft Research
Question: "Who developed GraphRAG and what organization are they from?"
Answer: GraphRAG was developed by researchers at Microsoft Research [1],
with Darren Edge leading the project [2].
Citations:
[1] Source: AI Research Paper
Text: "GraphRAG is a technique developed by Microsoft Research..."
[2] Source: AI Research Paper
Text: "...introduced by researchers including Darren Edge..."
| Setting | Default | Description |
|---|---|---|
| Neo4j URI | bolt://localhost:7687 | Neo4j connection string |
| Neo4j User | neo4j | Database username |
| Neo4j Password | - | Database password |
| LLM Model | llama3.2 | Ollama model for extraction/generation |
knowledge_graph_rag_citations/
├── knowledge_graph_rag.py # Main Streamlit application
├── requirements.txt # Python dependencies
└── README.md # This file
KnowledgeGraphManager: Neo4j interface for graph operationsextract_entities_with_llm(): LLM-based entity/relationship extractiongenerate_answer_with_citations(): Multi-hop RAG with provenance trackingThis example is inspired by VeritasGraph, an enterprise-grade framework for:
MIT License
This Streamlit app demonstrates an agentic Retrieval-Augmented Generation (RAG) Agent using Google's EmbeddingGemma for embeddings and Llama 3.2 as th…
An agentic RAG application built with the Agno framework, featuring GPT-5 and LanceDB for efficient knowledge retrieval and question answering.
Architecture Flow <img width="465" alt="Screenshot 2025-05-04 at 3 45 58 PM" src="" /
Need a tailor-made solution?
Not sure where to start with AI in your business? Get a free assessment and a tailored plan - no commitment.
Doutor AI gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further.