Everything you need to know to build your own RAG application
4,155
stars
62
commits
Jupyter Notebook
primary language
Aug 3, 2026
updated
This repository contains a comprehensive exploration of Retrieval-Augmented Generation (RAG) for various applications. Each notebook provides a detailed, hands-on guide to setting up and experimenting with RAG from an introductory level to advanced implementations, including multi-querying and custom RAG builds.

If you want to jump straight into it, check out the file full_basic_rag.ipynb -> this file will give you a boilerplate starter code of a fully customizable RAG chatbot.
Make sure to run your files in a virtual environment (checkout section Get Started)
The following notebooks can be found under the directory notebooks/.
This introductory notebook provides an overview of RAG architecture and its foundational setup. The notebook walks through:
Building on the basics, this notebook introduces multi-querying techniques in the RAG pipeline, exploring:
This notebook delves deeper into customizing a RAG pipeline. It covers:
Continuing from the previous customization, this notebook explores:
This final notebook brings together the RAG system components, with a focus on scalability and optimization:
Ensure Python 3.11.11 (preferred) is installed on your system. Follow the platform-specific instructions below to install it if not already installed.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python@3.11
python3.11 --version
sudo apt update
sudo apt install python3.11 python3.11-venv
python3.11 --version
python --version
git clone https://github.com/bRAGAI/bRAG-langchain.git
cd bRAG-langchain
Use Python 3.11.11 to create a virtual environment:
python3.11 -m venv venv
Activate the virtual environment:
source venv/bin/activate
venv\Scripts\activate
If the virtual environment defaults to a different Python version (e.g., Python 3.13):
python --version
python3.11
python command uses Python 3.11 by creating a symbolic link:
ln -sf $(which python3.11) $(dirname $(which python))/python
python --version
Install the required packages:
pip install -r requirements.txt
Begin with [1]_rag_setup_overview.ipynb to get familiar with the setup process. Proceed sequentially through the other notebooks:
[1]_rag_setup_overview.ipynb[2]_rag_with_multi_query.ipynb[3]_rag_routing_and_query_construction.ipynb[4]_rag_indexing_and_advanced_retrieval.ipynb[5]_rag_retrieval_and_reranking.ipynbDuplicate the .env.example file in the root directory and rename it to .env.
Add the following keys (replace with your actual values):
# LLM Model - Get key at https://platform.openai.com/api-keys
OPENAI_API_KEY="your-api-key"
# LangSmith - Get key at https://smith.langchain.com
LANGCHAIN_TRACING_V2=true
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
LANGCHAIN_API_KEY="your-api-key"
LANGCHAIN_PROJECT="your-project-name"
# Pinecone Vector Database - Get key at https://app.pinecone.io
PINECONE_INDEX_NAME="your-project-index"
PINECONE_API_HOST="your-host-url"
PINECONE_API_KEY="your-api-key"
# Cohere - Get key at https://dashboard.cohere.com/api-keys
COHERE_API_KEY=your-api-key
You're now ready to use the project!
After setting up the environment and running the notebooks in sequence, you can:
Experiment with Retrieval-Augmented Generation:
Use the foundational setup in [1]_rag_setup_overview.ipynb to understand the basics of RAG.
Implement Multi-Querying:
Learn how to improve response relevance by introducing multi-querying techniques in [2]_rag_with_multi_query.ipynb.
Do you have questions or want to collaborate? Please open an issue or email Taha Ababou at taha@bragai.dev
If this project helps you, consider buying me a coffee ☕. Your support helps me keep contributing to the open-source community!
The notebooks and visual diagrams were inspired by Lance Martin's LangChain Tutorial.
61 commits
1 commits
Jupyter Notebook
100.0%
Everything you need to know to build your own RAG application
4,155
stars
62
commits
Jupyter Notebook
primary language
Aug 3, 2026
updated
This repository contains a comprehensive exploration of Retrieval-Augmented Generation (RAG) for various applications. Each notebook provides a detailed, hands-on guide to setting up and experimenting with RAG from an introductory level to advanced implementations, including multi-querying and custom RAG builds.

If you want to jump straight into it, check out the file full_basic_rag.ipynb -> this file will give you a boilerplate starter code of a fully customizable RAG chatbot.
Make sure to run your files in a virtual environment (checkout section Get Started)
The following notebooks can be found under the directory notebooks/.
This introductory notebook provides an overview of RAG architecture and its foundational setup. The notebook walks through:
Building on the basics, this notebook introduces multi-querying techniques in the RAG pipeline, exploring:
This notebook delves deeper into customizing a RAG pipeline. It covers:
Continuing from the previous customization, this notebook explores:
This final notebook brings together the RAG system components, with a focus on scalability and optimization:
Ensure Python 3.11.11 (preferred) is installed on your system. Follow the platform-specific instructions below to install it if not already installed.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python@3.11
python3.11 --version
sudo apt update
sudo apt install python3.11 python3.11-venv
python3.11 --version
python --version
git clone https://github.com/bRAGAI/bRAG-langchain.git
cd bRAG-langchain
Use Python 3.11.11 to create a virtual environment:
python3.11 -m venv venv
Activate the virtual environment:
source venv/bin/activate
venv\Scripts\activate
If the virtual environment defaults to a different Python version (e.g., Python 3.13):
python --version
python3.11
python command uses Python 3.11 by creating a symbolic link:
ln -sf $(which python3.11) $(dirname $(which python))/python
python --version
Install the required packages:
pip install -r requirements.txt
Begin with [1]_rag_setup_overview.ipynb to get familiar with the setup process. Proceed sequentially through the other notebooks:
[1]_rag_setup_overview.ipynb[2]_rag_with_multi_query.ipynb[3]_rag_routing_and_query_construction.ipynb[4]_rag_indexing_and_advanced_retrieval.ipynb[5]_rag_retrieval_and_reranking.ipynbDuplicate the .env.example file in the root directory and rename it to .env.
Add the following keys (replace with your actual values):
# LLM Model - Get key at https://platform.openai.com/api-keys
OPENAI_API_KEY="your-api-key"
# LangSmith - Get key at https://smith.langchain.com
LANGCHAIN_TRACING_V2=true
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
LANGCHAIN_API_KEY="your-api-key"
LANGCHAIN_PROJECT="your-project-name"
# Pinecone Vector Database - Get key at https://app.pinecone.io
PINECONE_INDEX_NAME="your-project-index"
PINECONE_API_HOST="your-host-url"
PINECONE_API_KEY="your-api-key"
# Cohere - Get key at https://dashboard.cohere.com/api-keys
COHERE_API_KEY=your-api-key
You're now ready to use the project!
After setting up the environment and running the notebooks in sequence, you can:
Experiment with Retrieval-Augmented Generation:
Use the foundational setup in [1]_rag_setup_overview.ipynb to understand the basics of RAG.
Implement Multi-Querying:
Learn how to improve response relevance by introducing multi-querying techniques in [2]_rag_with_multi_query.ipynb.
Do you have questions or want to collaborate? Please open an issue or email Taha Ababou at taha@bragai.dev
If this project helps you, consider buying me a coffee ☕. Your support helps me keep contributing to the open-source community!
The notebooks and visual diagrams were inspired by Lance Martin's LangChain Tutorial.
61 commits
1 commits
Jupyter Notebook
100.0%