The simplest open-source Perplexity AI implementation in just 200 lines of Python. Combines Google search with LLM responses, featuring real-time streaming, source citations, and VS Code markdown preview integration.
## Overview nanoPerplexityAI demonstrates how a Perplexity-like search+AI system works in minimal code. It implements the full pipeline: query understanding, web search, content extraction, and cited response generation in approximately 200 lines of Python. ## How It Works 1. Accept user input 2. LLM determines if search is needed and reformulates queries for Google 3. Google search retrieves relevant web pages 4. BeautifulSoup extracts page content 5. Content combined with system instructions and user query 6. LLM generates response with citations 7. Output streamed to markdown file ## Features - Google search integration with webpage content retrieval - Real-time LLM response generation with markdown output - VS Code preview for live response visualization - Source citation in generated answers - Stream-based completion - Save/quit conversation controls ## Tech Stack Python, googlesearch-python, requests, BeautifulSoup4, lxml, OpenAI API ## Installation ```bash pip install googlesearch-python requests beautifulsoup4 lxml backoff openai export OPENAI_API_KEY=your_key python nanoPerplexityAI.py ``` Educational project ideal for understanding AI search architecture.
Reads and summarizes scientific papers in plain language
Monitors supply chain disruptions and logistics developments globally
Analyzes job market conditions, salary trends, and skill demand
Monitors clinical trials for specific conditions or treatments
Monitors content for outdated information and suggests updates
Collects cybersecurity threat intelligence from open sources