AI Answer Engine

Production AI-powered search processing 100+ URLs/hour

Timeline

Sep 2024 – Oct 2024

Role

Solo Developer

Next.jsGroq SDKCheerioPuppeteerVercel

98%

Accuracy

<2s

Response Time

100+

URLs/Hour

1,000+

Queries Handled

The Problem

Research is slow. Finding accurate answers across multiple sources requires opening dozens of tabs, reading through irrelevant content, and manually synthesizing information. I wanted to build a tool that could do this automatically with high accuracy.

The Insight

Most AI search tools fail because they either scrape poorly or synthesize poorly. The key is doing both well: aggressive content extraction with smart fallbacks, combined with AI that actually cites its sources.

The Solution

Architecture

The system works in three stages:

  • Query Analysis: Parse user's question to identify key entities and intent
  • Content Extraction: Scrape relevant URLs using Cheerio for static content, Puppeteer for JS-rendered pages
  • AI Synthesis: Generate accurate answers with source citations using Groq SDK

Key Technical Decisions

scraper.ts
async function scrapeWithFallback(url: string) {
  try {
    // Try fast path first (Cheerio)
    const response = await fetch(url);
    const html = await response.text();

    // Check if content is JavaScript-rendered
    if (isJSRendered(html)) {
      return await scrapeWithPuppeteer(url);
    }

    return parseWithCheerio(html);
  } catch (error) {
    // Graceful degradation
    console.log(`Fallback for ${url}`);
    return { success: false, error };
  }
}

Groq over OpenAI: Groq's inference speed (40% faster) was critical for keeping response times under 2 seconds. The accuracy tradeoff was minimal.

Results

The system processes 100+ URLs per hour with 98% accuracy on factual queries. Deployed on Vercel, it handles 1,000+ queries with consistent sub-2-second response times.

Reflections

The biggest challenge was handling unreliable external URLs—timeouts, rate limits, malformed HTML. Building robust error handling and fallback strategies was more complex than the core AI integration. In production, the edge cases are always harder than the happy path.