Skip to content

philfung/perplexed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Perplexed

Open-source app inspired by the amazing web search product, Perplexity.

Live Demo

Screenshot 2024-05-08 at 1 23 35 PM Screenshot 2024-05-08 at 1 24 33 PM

Implementation

Given a user query, the app conducts a web search, downloads the top N resulting web pages, then analyzes those pages with an LLM.

Screenshot 2024-11-16 at 10 06 03 AM

The LLM can be any smaller, consumer-grade with at least 5k context window (assuming each web page ~1k tokens).

Deployment Instructions

A. Python Server

  1. cd backend
    copy config.json.sample config.json
    
  2. In config.json, fill in GOOGLE_SEARCH_API_KEY and GOOGLE_SEARCH_ENGINE_ID credentials from Google Custom Search API.

  3. Fill in GROQ_API_KEY credentials from Groq.

  4. Setup virtual environment, packages, and deploy the server

    virtualenv venv
    . venv/bin/activate
    pip install -r requirements.txt
    python app.py
    

    This is fine for dev testing.

    In production, in addition, you probably want to use gunicorn (1, 2) and nginx (1) in conjunction with your python server (1) (utility scripts linked).

B. React Frontend

  1. cd frontend
    
  2. Update API_URL in constants.js to point to your server
  3. npm install
    npm run build
    
  4. In dev testing, to start the server:
    npm run start
    
    In production, to start the server:
    npm i -g npm@latest
    rm -rf node_modules
    rm -rf package-lock.json
    npm cache clean --force
    npm i --no-optional --omit=optional
    npm run build
    npm install -g serve
    server -s build