Astro Buddy is a quasar-specific question-answering web app that leverages Retrieval-Augmented Generation (RAG) powered by recent arXiv publications and OpenAI embeddings. Users can enter an OpenAI API key and pose astronomy-related questions directly through the app's frontend.
- Scrapes and downloads the 100 most recent arXiv PDFs about quasars
- Embeds paper content using OpenAI's embedding model
- Stores vector embeddings in a Render-hosted PostgreSQL database with pgvector extension
- Serves responses via FastAPI backend with LangChain + PGVector retrieval
- Responsive frontend deployed via Vercel, built with Next.js and Material UI
- Frontend: Vercel (Next.js)
- Backend: Render (FastAPI)
- Database: Render PostgreSQL with pgvector
- Clone the repo:
git clone https://github.com/dangause/astro-buddy.git
cd astro-buddy- Set up environment variables:
Create a
.env.configfile at the root:
OPENAI_API_KEY=sk-...
POSTGRES_DB_HOST=your-db-host
POSTGRES_DB_PORT=5432
POSTGRES_DB_USER=your-user
POSTGRES_DB_PASSWORD=your-password
POSTGRES_DB_DBNAME=your-db
PGVECTOR_COLLECTION_NAME=arxiv_quasars- Build services with Docker Compose:
docker-compose up --build- Access Services:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- Data Ingestion API: http://localhost:8001
- pgAdmin: http://localhost:8887
Send a POST request to:
http://localhost:8001/ingest-arxiv
This pulls the most recent 100 quasar-related papers from arXiv, embeds the text content, and stores it in the PostgreSQL database.
Use the web frontend to input a question and your OpenAI API key. Alternatively, you can query the backend directly:
curl -X POST https://astro-buddy.onrender.com/chat-rag \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-..." \
-d '{"userInput": "What is a quasar?"}'Developed by Dan Gause as part of an astronomy + AI portfolio.
MIT