Course Introduction and Logistics

Introduction to the “Retrieval Augmented Generation for Production with LlamaIndex and LangChain” Course

Activeloop, Towards AI, and the Intel Disruptor Initiative are excited to collaborate to bring Gen AI 360: Foundational Model Certification Course for aspiring Generative AI professionals, executives, and enthusiasts of tomorrow.

Following the success of our "LangChain & Vector Databases In Production" and "Training and Fine-tuning LLMs for Production” courses, we're excited to welcome you to the third part of the series: “Retrieval Augmented Generation for Production with LlamaIndex and LangChain.”

In this course, you'll learn how to build on RAG techniques learned in the first Langchain and Vector DBs in Production course. Apart from a primer on novel LangChain RAG frameworks, you will learn advanced RAG techniques with LlamaIndex and how to build RAG agents and RAG evaluation systems. This course will guide you on the optimal methods and practices for getting RAG production-ready with plenty of applied industry project examples. Let's get started!

Why This Course?

The “Retrieval Augmented Generation for Production with LlamaIndex and LangChain” course provides the theoretical knowledge and practical skills necessary to build advanced RAG products.

Many human tasks across various industries can be assisted with AI by combining LLMs, prompting, RAG, and fine-tuning workflows.

We are huge fans of RAG because it helps with

1) reducing hallucinations by limiting the LLM to answer based on existing documentation,

2) helping with explainability, error checking, and copyright issues by clearly referencing its sources for each comment,

3) giving private/specific or more up-to-date data to the LLM,

4) and not relying on black box LLM training/fine tuning for what the models know and has memorized.

We touched upon basic RAG in our first Langchain and Vector DBs course, but building more advanced and reliable products requires more complex techniques and iterations of the model.

The 'Retrieval Augmented Generation for Production with LlamaIndex and LangChain' course aims to provide you with the theoretical knowledge and practical skills necessary to develop products and applications centered on RAG.

A fundamental pillar of our course is the focus on hands-on learning. Real-world application and experimentation are crucial for a deep understanding and effective use of RAG techniques.

In this course, you will move beyond basic RAG apps, develop these applications with more advanced techniques, build RAG agents, and evaluate the performance of RAG systems.

Who Should Take This Course?

Whether planning to build a chat with data application for your organization or just learning how to leverage Generative AI in various industries, this course is for you. The course addresses critical issues such as reducing hallucinations in AI outputs, enhancing explainability, addressing copyright concerns, and offering more tailored, up-to-date data inputs. We go beyond basic RAG applications, equipping you with the skills to create more complex, reliable products with tools like LangChain, LlamaIndex, and Deep Memory. Emphasizing hands-on learning, this course is a gateway to mastering advanced RAG techniques and applications in real-world scenarios. Please note that prior knowledge of coding and Python is a prerequisite.

What You Will Learn

You will start by learning the basic RAG tools, such as loading, indexing, storing, and querying in both Langchain and LlamaIndex. We’ll also demystify the two libraries to help you select the right one when working with RAG or other LLM applications. You will then move towards more advanced RAG techniques aimed at surfacing and using more relevant information from the dataset. We cover techniques such as Query expansion, Transformation reranking, recursive retrieval, optimization, and production tips and techniques with LlamaIndex. We also introduce how better embedding management through Activeloop’s Deep Memory can be used to improve accuracy. We then progress to the exciting stuff: learning how to build RAG agents in Langchain and Llamaindex, an introduction to OpenAI assistants and some other tools & models that can be used in RAG products. We conclude with a summary of RAG evaluation techniques in LlamaIndex together with an introduction to Langsmith in Langchain.

Is the Course Free?

Yes, the course is entirely free for everybody. However, running the project examples yourself will cost you some API and cloud credits.

Certification

By participating in this course and completing the quizzes at the end of each chapter, you will have the opportunity to earn a certification in using Deep Lake - a valuable addition to your professional credentials. This certification program, offered at no cost, forms part of the Deep Lake Foundational Model Certification Program in collaboration with Intel Disruptor Initiative and Towards AI.

AI Tutor

The AI Tutor Bot is designed to be a real-time, precise query-answering companion. The AI Tutor is the official course chatbot companion, so naturally, it knows everything from the course. Furthermore, it has access to thousands of technical articles, Wikipedia, technical documentation from Activeloop, HuggingFace, LangChain and OpenAI. This ensures each response is precise and up-to-date with the latest AI and coding insights. As you work through the courses, you can use the chatbot to assist you with learning with relevant resource recommendations and sourced responses.

Course Logistics

Here's everything you need to know about the course.

Course Hosting and Pace

This course is hosted by Activeloop. It is designed as a self-paced learning journey, allowing you to proceed at your own comfort. The online format provides flexibility to engage with the lessons whenever it best suits you.

At the end of each module, you can test your new knowledge with multiple-choice quizzes, which are mandatory to continue the course. You will receive your course certification after completing all the quizzes.

Community Support

Have questions about this course or specific lessons? Want to exchange ideas with fellow learners? We encourage active interaction in the dedicated forum in the Towards AI’s Learn AI Together Discord Community, a vibrant community of over 55,000 AI experts and enthusiasts. Our community has a dedicated channel for this course where you can ask questions and share insights.

For queries specifically related to Deep Lake, please join the Deep Lake Slack community, where experts and users will be ready to assist.

Required Platforms, Tools, and Cloud Tokens

The course involves practical projects and exercises that require various tools and platforms. These will be thoroughly guided in the individual lessons. However, the main platforms that you will use throughout the course are:

  • Activeloop’s Deep Lake
  • Open AI
  • LlamaIndex
  • Langchain
  • Langchain’s Langsmith

What is Activeloop?

Activeloop is a tech company dedicated to building data infrastructure optimized for deep-learning applications. It offers a platform that seamlessly connects unstructured data types, like audio, video, and images, to machine learning models. Their main product, Deep Lake, ensures data streaming, scalable machine learning pipelines, and dataset version control. Such infrastructures are particularly beneficial when dealing with the demands of training and fine-tuning models for production.

What is Deep Lake?

Deep Lake is an open-source data lake designed for deep learning applications. It retains essential features of traditional data lakes, including SQL queries, ACID transactions, and dataset visualization. It specializes in storing complex data in tensor form, efficiently streaming data to deep learning frameworks. Built to be serverless on a columnar storage format, it also offers native version control and in-browser data visualization, complementing the needs of LLM training and deployment processes.

How to set up a Deep Lake account?

To set up a Deep Lake account, navigate to the app’s registration page and sign up. Follow the on-screen instructions and add the required details. Once you've verified your email and established a secure password, your account will be active and ready for use.

Activeloop Credits - Free Extended Trial for Deep Lake Growth Plan for a Month

As a part of the course, all course takers can redeem a free extended trial of one month for the Activeloop Growth plan by redeeming GENAI360 promo code at checkout. To redeem the plan, please create a Deep Lake Account, and in the following screen on account creation please watch the following video.

How to get the Deep Lake API token?

  1. After logging in, you should see your homepage. You should now see a “Create API token” button at the top of your homepage. Click on it, and you’ll get redirected to the “API tokens” page. This is where you can generate, manage, and revoke your API keys for accessing Deep Lake.
  2. Click on the "Create API token" button. You should see a popup asking for a token name and an expiration date. By default, the token expiration date is one year. Once you’ve set the token name and its expiration date, click the “Create API token” button.
  3. You should now see a green banner saying that the token has been successfully generated, along with your new API token, on the “API tokens” page. To copy your token to your clipboard, click the square icon on its right.

Coding Environment and Packages

Before starting this course, you need to ensure that you have the appropriate coding environment ready. Please make sure to use a Python version equal to or later than 3.8.1. You can set up your environment by choosing one of the following options:

  1. Having a code editor installed on your computer. A popular coding environment is Visual Studio Code.
  2. Using Python virtual environments to manage Python libraries.
  3. Alternatively, you could use Google Colab notebooks.

You will need the following packages to successfully execute the sample codes provided in each lesson. They can be installed using the pip package manager.

deeplake==3.9.11
llama-index==0.10.50
langchain==0.2.6
langchain_community==0.2.6
openai==1.35.7
cohere==5.5.8
wikipedia==1.4.0
pdf2image==1.17.0
html2text==2024.2.26
ragas==0.1.9
tiktoken==0.7.0
transformers==4.42.3
torch==2.3.1
numpy==2.0.0
deepspeed==0.14.4
trl==0.9.4
peft==0.11.1
wandb==0.17.3
bitsandbytes==0.43.1
accelerate==0.31.0
tqdm==4.66.4
neural-compressor===2.6
onnx===1.16.1
pandas==2.2.2
scipy==1.14.0

While we strongly recommend installing the latest versions of these packages, please note that the codes have been tested with the versions specified in parentheses. Moreover, specific lessons may require the installation of additional packages, which will be explicitly mentioned. The following code will demonstrate how to install a package using pip.

pip install deeplake
# Or: (to install an specific version)
# pip install deeplake==3.9.11
💡
If you encounter any issues while installing the packages, don't hesitate to reach out to us via Activeloop's Slack channel or the live chat on the website. We are here to assist you.

Google Colab

Google Colaboratory, popularly known as Google Colab, is a free cloud-based Jupyter notebook environment. Data scientists and engineers widely use it to train machine learning and deep learning models using CPUs, GPUs, and TPUs. Google Colab comes with an array of features, such as:

  • Free access to GPUs and TPUs for accelerated model training.
  • A web-based interface for a service running on a virtual machine, eliminating the need for local software installation.
  • Seamless integration with Google Drive and GitHub.

To use Google Colab, all you need is a Google account. You can run terminal commands directly in notebook cells by appending an exclamation mark (!) before the command. Every notebook created in Google Colab gets stored in your Google Drive for easy access.

A convenient way of using API keys in Colab involves:

  1. Saving them in a file named .env on your Google Drive. Here’s how the file should be formatted to save the Activeloop token and the OpenAI API key.
ACTIVELOOP_TOKEN=your_activeloop_token
OPENAI_API_KEY=your_openai_key
  1. Mounting your Google Drive on your Colab instance.
  2. Loading them as environment variables using the dotenv library, like in the following code.
from dotenv import load_dotenv

load_dotenv('/content/drive/MyDrive/path/to/.env')

Creating Python Virtual Environments

Python virtual environments offer an excellent solution for managing Python libraries and avoiding package conflicts. They create isolated environments for installing packages, ensuring that your packages and their dependencies are contained within that environment. This setup provides clean and isolated environments for your Python projects.

Begin by executing the python command in your terminal to confirm that the Python version is either equal to or greater than 3.8.1. Then follow these steps to create a virtual environment:

  1. Create a virtual environment using the command python -m venv my_venv_name.
  2. Activate the virtual environment by executing source my_venv_name/bin/activate.
  3. Install the required libraries and run the code snippets from the lessons within the virtual environment.

Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries.

📝 Legal Note on Availability of Credits & Applicable Terms 📝

Availability of Credits:

  • Validity: Credits acquired upon completion of the GenAI360 Foundational Model Certification Course must be redeemed within [12] months of the course completion date, after which they will become void.
  • Usage: Credits are applicable for use across select programs, courses, workshops, or other specified opportunities offered by Activeloop and/or other partners and cannot be transferred to external platforms or exchanged for cash or other forms of payment.

Terms & Conditions:

  1. Eligibility: Credits are available only to qualifying participants who have successfully completed the GenAI360 Foundational Model Certification Course and have adhered to all course and evaluation criteria.
  2. Redemption: Credits can only be redeemed by the individual participant to whom they were issued and are non-transferable to other individuals or entities.
  3. Modification: Activeloop reserves the right to modify the availability, applicability, or value of credits without prior notice. Participants will be notified of any such changes via registered email.
  4. Verification: All participant details and attached documents will undergo a verification process. Any discrepancies or fraudulent information may result in the forfeiture of credits and possible exclusion from future programs.
  5. Data Protection: Participant data will be handled with utmost confidentiality and will only be used for the purpose of credit redemption in compliance with applicable data protection regulations.
  6. Limitation: The credits are not stackable and cannot be combined with other ongoing offers or discounts unless explicitly mentioned.
  7. Discrepancies: In case of any discrepancies or issues related to credit redemption, decisions made by Activeloop will be considered final.
  8. Communication: Participants agree to receive communications regarding the credit redemption process and other relevant information from GenAI360.
  9. Governing Law: The credit redemption process and associated terms are governed by the applicable laws in the jurisdiction of Activeloop’s registered location.

By redeeming the credits, participants acknowledge and agree to adhere to the aforementioned terms and conditions. Any violation of the same may result in appropriate actions as deemed suitable by Activeloop.