Home
FR
All projects
RAGCompleted

Marketing RAG Chatbot

An assistant that answers marketing strategy questions from a corpus of course material — and says so plainly when it doesn't know.

Master's PFA — iTeam University2025
  • RAG
  • LangChain
  • FAISS
  • Llama 3.3
  • HuggingFace
  • Gradio
RAG pipeline diagram: PDF, chunking, FAISS, prompt, Llama 3.3 and chat

Context

Marketing students and professionals spend a lot of time digging through courses, guides and strategy documents to answer specific questions — “how do you segment a market?”, “what is the marketing mix?”. The answers exist, but they’re scattered across many sources.

Problem

The goal was a tool that answers a marketing strategy question directly, with a response grounded in a reference corpus rather than generic text — and that admits its limits when the information isn’t in the documents.

Architecture

A four-stage RAG pipeline, built in Google Colab:

  • Ingestion: text is extracted from a folder of marketing course PDFs (PyMuPDF), flagging scanned PDFs with no text, then split into 600-character chunks (50 overlap).
  • Indexing: all-MiniLM-L6-v2 embeddings (sentence-transformers) and a FAISS index saved to Google Drive — reloaded on later runs instead of being rebuilt.
  • Retrieval: the 5 chunks closest to the question are retrieved.
  • Generation: a LangChain chain (create_retrieval_chain) passes them to Llama 3.3 70B Instruct through the HuggingFace Inference API, with a prompt that requires answering only from the context and saying so clearly otherwise.

The Gradio interface offers a question box, preloaded examples and a shareable public link.

Evolution

A first version used ChromaDB and a quantised Llama 2 7B running locally (llama.cpp). The final version moved to a persistent FAISS index and Llama 3.3 70B via HuggingFace: much better answers, without depending on the Colab machine’s memory.

Stack

Python, LangChain, PyMuPDF, sentence-transformers (all-MiniLM-L6-v2), FAISS, Llama 3.3 70B Instruct via HuggingFace Inference API, Gradio, Google Colab, Google Drive.

Next steps

  • Show the source chunks under each answer.
  • Automated evaluation with RAGAs (faithfulness, context precision), replacing manual checks.
  • A server-side vector store (ChromaDB or Supabase pgvector) for production use.