✅ Project completed as an MVP. The pipeline demonstrates end-to-end GenAI data plumbing: ingestion, processing, vector storage, retrieval, reranking, and summarization. Future work may improve evaluation speed and model experimentation.
This project aims to build an end-to-end GenAI powered pipeline using Reddit data.
- Extract: Collect raw Reddit data from the API.
- Clean: Preprocess text (normalize, remove noise, structure metadata).
- Vectorize: Generate TF-IDF features and sentence embeddings for text.
- Store & Index: Load vectors + metadata into a vector database.
- Retrieve: Implement semantic search across Reddit posts using embeddings.
- Rerank & Search: Re-rank retrieval results with a cross-encoder and return most relevant docs.
- Generate: Feed top-ranked results into a GenAI model (LLaMA) for contextual Q&A
- Deploy: Wrap the pipeline in a streamlit app.
- Evaluate and Optimize: Experiment with batching, efficient storage and larger models.
- Input: None
- Process: Use praw library to get top 100 posts of subreddits
- Output: Create data files to location '/data/raw'
- Input: Multiple raw Reddit CSVs from '/data/raw'
- Process: Combines all files, cleans text (lowercasing, remove URLs/punctutation), adds features (text length, posting day)
- Output: Single processed dataset in'/data/processed/reddit_posts_cleaned.csv'
- Implemented 'vectorize.py' to transform cleaned reddit posts into numerica representations:
- TF-IDF vectors for sparse, interpretable features.
- Sentence embeddings for dense, semantic features.
- Both outputs are saved as Parquet files
- Metadata columns are retained to allow future analysis and joinin with vectorized features.
- Added
index.pyto store embeddings + metadata in pinecone. - Created
reddit-genaiindex (cosine similarity, 384 dim). - Uploaded vectors and verified in Pinecone dashboard.
- Once the embeddings are indexed in Pinecone, run queries against them
retrive.pyscript, converts the query results into a structured dataframe
- Rerank the results that are retrived using cross-encoder
rerank.pyscript builds a rerank class that ranks them using cross encoder, improving precision for recall.search.py-> integrates retriever + reranker into full pipeline
- The reranked docs are used by the Ollama mistral model, run locally to generate responses for the query.
- Uses only the retireved docs to prevent hallucination.
A Streamlit-based app to explore the pipeline end-to-end.
streamlist run app.pyThis project now runs as a scheduled pipeline using Github Actions.
- Trigger: Everyday at 9 AM UTC (configurable via cron)
- Steps:
- Fecth new Reddit posts (
extract.py) - Clean text (
transform.py) - Vectorize (TF-IDF + Embeddigs) (
vectorize.py) - Upsert into Pinecone index (
index.py)
- Fecth new Reddit posts (
- Artifacts: Cleaned and vectorized files are uploaded to each workflow run
- Pincecone: New embeddings are automatically indexed
Store these in your Github repo under Settings --> Secrets --> Actions:
CLIENT_IDCLIENT_SECRETPINECONE_API_KEY
You can still run the pipeline manually:
python src/extract.py
python src/transform.py
python src/vectorize.py
python src/index.py⏭️ Next Project --> QueryGen
