Skip to content

AI agent system combining RAG with knowledge graphs for analyzing big tech companies

Notifications You must be signed in to change notification settings

DavidMelamed/agentic-rag-knowledge-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Agentic RAG with Knowledge Graph πŸ€–

A powerful AI agent system that combines traditional RAG (Retrieval-Augmented Generation) with knowledge graph capabilities to analyze and provide insights about big tech companies and their AI initiatives.

πŸš€ Features

  • Hybrid Search: Combines vector similarity search with knowledge graph traversal
  • Temporal Knowledge: Tracks how information changes over time
  • Multi-LLM Support: Works with OpenAI, Ollama, Anthropic, Google Gemini, and more
  • Streaming API: Real-time responses with Server-Sent Events
  • Production Ready: Comprehensive testing, error handling, and monitoring

πŸ› οΈ Tech Stack

  • AI Framework: Pydantic AI
  • Knowledge Graph: Neo4j + Graphiti
  • Vector Database: PostgreSQL + pgvector
  • API: FastAPI
  • LLM: Configurable (OpenAI, Ollama, etc.)

πŸ“‹ Prerequisites

  • Docker and Docker Compose
  • 8GB+ RAM
  • 20GB free disk space

πŸš€ Quick Start

1. Clone and Navigate

git clone https://github.com/DavidMelamed/agentic-rag-knowledge-graph.git
cd agentic-rag-knowledge-graph

2. Configure Environment

cp .env.example .env
# Edit .env with your configuration

3. Deploy with Docker

# Linux/Mac
./deploy.sh

# Windows PowerShell
.\deploy-windows.ps1

# Windows Command Prompt
deploy-windows.bat

4. Add Documents

# Create documents directory
mkdir -p documents

# Copy your markdown files or use samples
cp -r big_tech_docs/* documents/

5. Run Ingestion

docker exec agentic-rag-app python -m ingestion.ingest

6. Start Using

# CLI Interface
docker exec -it agentic-rag-app python cli.py

# API (http://localhost:8058)
curl http://localhost:8058/health

πŸ”§ Configuration

The system supports multiple LLM providers:

OpenAI

LLM_PROVIDER=openai
LLM_API_KEY=sk-your-key
LLM_CHOICE=gpt-4-mini

Ollama (Local)

LLM_PROVIDER=ollama
LLM_BASE_URL=http://ollama:11434/v1
LLM_CHOICE=qwen2.5:14b-instruct

Anthropic (via OpenRouter)

LLM_PROVIDER=openrouter
LLM_API_KEY=your-openrouter-key
LLM_CHOICE=anthropic/claude-3-5-sonnet

πŸ“š Documentation

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   FastAPI   │────▢│  Pydantic   │────▢│     LLM     β”‚
β”‚   Server    β”‚     β”‚   AI Agent  β”‚     β”‚  Provider   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β–Ό                       β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚ PostgreSQL  β”‚         β”‚    Neo4j    β”‚
        β”‚  pgvector   β”‚         β”‚   Graphiti  β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š Example Queries

  • Semantic: "What AI research is Google working on?"
  • Relational: "How are Microsoft and OpenAI connected?"
  • Temporal: "Show me the timeline of Meta's AI announcements"
  • Complex: "Compare AI strategies of FAANG companies"

πŸ› οΈ Development

Local Development

# Install dependencies
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Run locally
python run-local.py

Testing

pytest
pytest --cov=agent --cov=ingestion

πŸ› Troubleshooting

Docker Issues

  • Ensure Docker Desktop is running
  • Linux/WSL: Add user to docker group: sudo usermod -aG docker $USER

Port Conflicts

  • Modify ports in docker-compose.yml

Memory Issues

  • Increase Docker memory allocation (8GB+ recommended)

πŸ“„ License

This project is based on the ottomator-agents repository.

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

🌟 Acknowledgments

  • Original project by coleam00
  • Built with Pydantic AI, FastAPI, PostgreSQL, and Neo4j

About

AI agent system combining RAG with knowledge graphs for analyzing big tech companies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •