Seismic Reporter is a Retrieval-Augmented Generation (RAG) application that answers questions about recent earthquake activity using raw USGS data.
It is designed as a practical AI project and demonstrates end-to-end skills in:
- real-world data ingestion from public APIs
- embedding and vector retrieval
- LLM integration using Groq API
- interactive UI development with Streamlit
- local testing and containerized execution
- Fetches raw earthquake data from the USGS feed.
- Converts raw records into normalized text documents.
- Builds embeddings with sentence-transformers.
- Stores vectors in FAISS for similarity search.
- Retrieves relevant context for a user query.
- Sends grounded context to Groq for final answer generation.
- Displays answers and source snippets in a responsive chat UI.
- Python 3.10+
- Streamlit
- sentence-transformers
- FAISS (faiss-cpu)
- Groq Chat Completions API
- pytest
- Docker + Docker Compose
app/
streamlit_app.py # Streamlit UI
src/
ingest.py # USGS data ingestion + document conversion
rag.py # Embeddings, retrieval, Groq generation
data/
usgs_docs.jsonl # Raw-to-processed docs
faiss_index # Vector index file
faiss_index.meta.json # Source metadata for retrieval hits
tests/
test_basic.py # Basic ingestion test
Windows PowerShell:
python -m venv venv
.\venv\Scripts\Activate.ps1macOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install --upgrade pip
pip install -r requirements.txtWindows PowerShell:
copy .env.example .envmacOS/Linux:
cp .env.example .envAt minimum, configure:
GROQ_API_KEY=your-groq-api-key
GROQ_MODEL=llama-3.1-8b-instant
ENABLE_MLFLOW=falsepython -c "from src.ingest import run_ingest; run_ingest(1)"
python -c "from src import ingest as ig, rag as r; geo=ig.fetch_usgs_past_days(1); docs=ig.to_documents(geo); r.build_index(docs)"This step fetches the most recent USGS earthquake feed, converts it into documents, and builds the FAISS index. The main ingestion metrics you should expect are:
doc_count: number of earthquake documents produced from the feedindex_build_seconds: time spent embedding and writing the FAISS indexquery_seconds: time spent retrieving context and generating an answer
Before running the app, make sure these are in place:
- Python 3.10+ with the project virtual environment activated
- Dependencies installed from
requirements.txt GROQ_API_KEYset in.envor Streamlit secretsGROQ_MODELset to a valid Groq chat model name- Optional:
ENABLE_MLFLOW=falseunless you have a running MLflow server - Run the ingest and index commands at least once so the FAISS store exists
streamlit run app/streamlit_app.pypytest -qdocker compose up --buildServices:
- Streamlit: http://localhost:8501
- MLflow: http://localhost:5000
Windows note:
If you get an error mentioning //./pipe/dockerDesktopLinuxEngine, Docker Desktop is not running. Start Docker Desktop first, then run compose again.
| Variable | Required | Default | Purpose |
|---|---|---|---|
GROQ_API_KEY |
Yes | - | Groq API authentication key |
GROQ_MODEL |
No | llama-3.1-8b-instant |
Groq model name |
FAISS_INDEX_PATH |
No | ./data/faiss_index |
Local FAISS index path |
RAG_RETRIEVAL_K |
No | 3 |
Number of retrieved chunks |
RAG_MAX_TOKENS |
No | 180 |
Max answer tokens |
ENABLE_MLFLOW |
No | false |
Enables MLflow logging when true |
MLFLOW_TRACKING_URI |
No | http://localhost:5000 |
Tracking server URI |
AUTHOR_NAME |
No | Anami James A |
Footer author name in UI |
- Cause: MLflow tracking connection delays.
- Fix: keep
ENABLE_MLFLOW=falseunless tracking server is running.
- Cause: wrong key value or placeholder key still in
.env. - Fix: update
GROQ_API_KEYand restart Streamlit.
- Cause: query before ingest/index step.
- Fix: run ingestion + index commands in Quick start step 5.