0%
AI/ML 2024

CodeSage AI - Review Assistant

Claude + GPT-4 + RAG

Developed AI-powered code review assistant leveraging Large Language Models (Claude 3.5, GPT-4) with RAG architecture for codebase-aware suggestions. System integrates GitHub webhooks for automated PR analysis, uses pgvector for semantic code search, implements streaming responses for real-time feedback. RAG pipeline retrieves relevant code context from vector embeddings enabling LLM to provide accurate, project-specific recommendations. Detects security vulnerabilities, code smells, complexity issues, suggests refactorings with generated diffs.

50+
PRs Analyzed
15 detected
Vulnerabilities
<2s
Response Time
85%
RAG Precision
10K+ indexed
Code Files
Claude + GPT-4
LLMs
01

The Challenge

Manual code reviews time-consuming and inconsistent. Static analysis tools generate noise without context understanding. Need intelligent assistant providing project-aware suggestions. LLMs without codebase context give generic advice. Security vulnerabilities and code smells hard to catch systematically.

02

The Solution

Built RAG-based code review assistant combining vector similarity search with LLM reasoning. Generated embeddings for codebase using sentence-transformers, stored in pgvector for semantic retrieval. Claude/GPT-4 API analyzes PRs with retrieved context. GitHub webhook integration triggers automated reviews. Streaming API responses for real-time feedback.

Technology Stack

Python 3.11+
FastAPI 0.109
Anthropic Claude 3.5 API
OpenAI GPT-4 Turbo
PostgreSQL 16 + pgvector
Redis 7.2
React 18
TypeScript 5.x
Docker 24.0
LangChain
sentence-transformers
GitHub Webhooks
Prometheus + Grafana
OpenTelemetry
03

Architecture

  • RAG (Retrieval-Augmented Generation) with pgvector
  • Vector embeddings via sentence-transformers
  • Multi-stage pipeline: embedding → retrieval → LLM reasoning
  • FastAPI async endpoints for webhook processing
  • Redis 7.2 caching for embeddings and LLM responses
  • PostgreSQL 16 + pgvector for semantic code search
  • GitHub webhook integration for automated PR triggers
  • Server-Sent Events for streaming responses
  • LangChain for prompt orchestration and chaining
  • Cost optimization via caching and batching
04

Key Features

01
RAG architecture with pgvector semantic code search
02
Claude 3.5 Sonnet + GPT-4 Turbo LLM integration
03
Real-time streaming responses via Server-Sent Events
04
GitHub webhook integration for automated PR analysis
05
Security vulnerability detection (SQL injection, XSS, auth issues)
06
Code smell detection (complexity, duplication, naming)
07
Automated refactoring suggestions with diff generation
08
Vector embeddings using sentence-transformers
09
Custom coding standards validation
10
Interactive dashboard built with React 18 + TypeScript
11
LangChain for LLM orchestration and prompt templating
12
Cost optimization via intelligent caching and batching
05

Results & Impact

  • RAG pipeline retrieves relevant code context with 85% precision
  • Detected 15+ security vulnerabilities in test PRs (SQL injection, XSS, insecure auth)
  • Automated analysis of 50+ PRs demonstrating production-ready architecture
  • Streaming responses provide sub-2s initial feedback
  • Vector similarity search identifies duplicate code patterns across 10K+ files
  • Generated refactoring suggestions with diff patches for 20+ code smells
  • pgvector semantic search outperforms keyword search 40% in relevance
  • GitHub webhook integration enables fully automated PR review workflow

Explore This Project