AI Assistant

A technical showcase of advanced AI implementation, combining Google Gemini's conversational capabilities with adaptive multi-stage RAG (Retrieval-Augmented Generation) that intelligently determines when more context is needed for comprehensive, accurate answers. Features include calendar management, email verification, and relevance-scored document retrieval.

Technical Architecture

Core Technology

  • Google Gemini 2.5 Pro & Flash - Advanced AI model for natural language understanding
  • Next.js 15 - React framework with App Router and Server Components
  • TypeScript - Type-safe implementation
  • Redis - Session management and OTP storage

Key Integrations

  • RAG Backend (Python) - FastAPI + LangChain + ChromaDB for semantic search
  • Google Calendar API - Real-time availability and meeting scheduling
  • Nodemailer - Email verification with OTP
  • MDX Blog System - Dynamic blog content access
  • Slack API - Error notifications and monitoring

Advanced Capabilities

Function Calling & Tool Use

The AI assistant uses Google Gemini's function calling capability to execute real-world actions:

Meeting Scheduling

  • • Timezone resolution from city names
  • • Email verification with OTP
  • • Real-time availability checking
  • • Google Calendar integration
  • • Meeting cancellation

Adaptive RAG Knowledge Base

  • • Adaptive multi-stage retrieval
  • • Confidence assessment (high/medium/low)
  • • Relevance scoring & ranking
  • • Smart document selection (k=3-10)
  • • Vector embeddings (Gemini)
  • • ChromaDB vector store
  • • Source attribution with scores

Blog Content Access

  • • List all blog posts with filtering
  • • Fetch specific articles by slug
  • • Category and tag-based search
  • • File existence validation
  • • Dynamic content delivery

Intelligent Session Management

Persistent conversation context with secure state management:

  • LocalStorage Integration: Chat history persists across browser sessions
  • Redis-based OTP: Secure email verification with 15-minute activity-based expiration
  • Session Tracking: Unique session IDs for each conversation
  • Context Preservation: User information maintained throughout interaction

Security & Validation

Multiple layers of security ensure safe and reliable operation:

  • Email Verification: OTP-based verification before calendar access
  • Rate Limiting: One active session per email address
  • Input Validation: TypeScript interfaces and runtime checks
  • Error Handling: Comprehensive error tracking with Slack notifications

Adaptive Multi-Stage Retrieval System

Advanced RAG implementation that intelligently determines when more context is needed:

  • Confidence Assessment: Each retrieval is evaluated as high/medium/low confidence based on relevance scores
  • Multi-Stage Retrieval: AI automatically makes follow-up searches when initial results have low confidence
  • Smart Document Selection: Uses k=3-5 for specific questions, k=7-10 for comprehensive topics
  • Relevance Scoring: Every source includes similarity score and rank for transparency
  • Comprehensive Synthesis: Combines information from multiple retrieval passes for thorough answers

Example: For a comprehensive question like "Tell me about Samuel's leadership philosophy," the AI retrieves 7-10 documents, assesses confidence, and may make a second retrieval with a different query angle to ensure a complete answer covering all aspects.

Enhanced User Experience

Thoughtful design decisions for optimal interaction:

  • Markdown Support: Rich formatting with links, lists, and emphasis
  • Expandable Interface: Compact and full-screen modes
  • Loading States: Visual feedback during processing
  • Natural Language: City-based timezone input (e.g., "New York" → America/New_York)

Implementation Highlights

150KB

Optimized system context for efficient token usage

RAG

Retrieval-Augmented Generation for accurate answers

13+

Function declarations for AI tool use (incl. RAG)

Experience It Yourself

Click the chat button in the bottom right to interact with the AI assistant. Try asking comprehensive questions about my experience, philosophy, or technical expertise— the AI uses advanced adaptive RAG retrieval to automatically gather multiple relevant sources and synthesize thorough, well-rounded answers.

Read Blog Posts

Technical Stack

Frontend

  • • React 19 with TypeScript
  • • Next.js 15 App Router
  • • Tailwind CSS for styling
  • • React Markdown for rich text
  • • LocalStorage for persistence

Backend (Next.js)

  • • Next.js API Routes
  • • Google Gemini AI SDK
  • • Redis for session management
  • • Nodemailer for emails
  • • Google Calendar API

RAG Backend (Python)

  • • FastAPI server
  • • Adaptive retrieval with confidence scoring
  • • LangChain document processing
  • • ChromaDB vector store with relevance scores
  • • Google Gemini embeddings
  • • Auto-watch for content updates

Content Management

  • • MDX for blog posts
  • • Gray-matter for frontmatter
  • • next-mdx-remote for rendering
  • • Rehype-highlight for syntax
  • • File-based content system

DevOps & Monitoring

  • • PM2 for process management
  • • Nginx reverse proxy
  • • Slack error notifications
  • • Git-based deployment
  • • Environment-based config