RAG Pipelines

Google Colab notebooks that retrieve, ground, and answer from your own documents.

Description

A set of RAG pipelines I built in Google Colab. Each card is a notebook you can open, with a short note on what that pipeline does.


Technologies
  • Python
  • LlamaIndex
  • OpenAI
  • Hugging Face
  • Gemini
  • Gradio
  • BM25
  • Llamaindex
  • PyMuPDF
  • LangChain
  • OpenSource Model
Comparing-embedding-models

We compared three embedding models, MiniLM-L6-v2, BGE-small-en, and E5-small-v2. We generated statistical representations of their responses, ranked the model that gave the top response, and recorded each model's retrieval time.

Build a Simple Chatbot with LlamaIndex

We used Gemini to generate responses from user input, then tested our chatbot by asking it different questions.

Query Processing & Retrieval Optimization

Implemented an industry-standard RAG optimization, including query expansion and rewriting with an integrated hybrid retriever (keyword + vector search) and additional ranking for accurate results. Every result is presented in a table to meet company standards.

Route Queries With Large Contact PDF

I demonstrated how to effectively use a RAG pipeline with a large document. We employed an LLM to classify document types and boundaries. By using key-concept metadata, the LLM can remember the document and execute an efficient RAG pipeline. Group pages into logical documents, chunk them, and assign metadata to each logical document. Then predict query routing and retrieve results with a metadata filter.

Routing_PDF_Queries_Using_Metadata

I used the LLM and a simple base rule to classify each PDF page, assign a type, and retrieve matching files. Then I created a temporary index from a matching document and queried it for the specific answers you need.

RAG_Pipeline_For_Document_Retriveval

Integrated PDFs with LlamaIndex, then implemented an LLM-based query expansion and a complete end-to-end pipeline. I demonstrated the steps for extracting the best data from a large document using BM25 retrival for keyword matching.

RAG_Configurations_and_Log_Output_Differences

This RAG configuration uses a retriever with top-k on the specified document vector database, applies a similarity threshold, combines these settings to log the difference, and then runs the RAG.

Rag_Pipeline_on_contract_document

The RAG pipeline: Extracts text from the document with PyMUdf. Generates embeddings. Performs query expansion and writes the result. Implements HybridRetriever, a hybrid of keyword and vector search. Initializes the large language model (LLM) and embedding models. Executes a rerank call to retrieve the top-k results. This creates a practical live RAG pipeline for most use cases.

OCR_on_mortage_image

Performed OCR on a PDF to obtain the text's bounding box. Extracted the bounding box and used CVT color tools to determine the exact box and the text's location. Executed the OCR action.


Copyright@2025AdebanjoStephen