Daethyra / Build-RAGAI

Interactive notes (Jupyter Notebooks) for building AI-powered applications
Other
26 stars 3 forks source link
ai artificial-intelligence artificial-intelligence-projects components framework huggingface jupyter-notebooks langchain langserve langsmith large-language-models machine-learning natural-language-processing openai prompt-examples prompt-template python rag retrieval-augmented-generation transformers

Build-RAGAI

Description

This project seeks to teach you how to build Python applications with generative AI functionality by using the LangChain and Transformers libraries.

While there is a section for OpenAI, most of the code that previously existed there has been repurposed and integrated with either the LangChain or Transformers libraries. This project includes code snippets, packages examples, and jupyter notebooks that you can augment, copy, or learn from respectively.

If you're new to building AI-powered applications, I suggest you start by playing with and executing the code in the LangChain notebooks. Seeing the code in action, editing it yourself, and creatively brainstorming new ideas is the best way to learn.

Table of Contents

Below you'll find links to, and descriptions of, sections of this project for easy navigation.

This README:

LangChain:

OpenAI:

Transformers:


Getting Started

Installation

Local Code Execution and Testing

This project is developed using PDM. You can install PDM using pip:

Start by navigating to the root directory of this project, then run:

pip install -U pdm

Then you'll need to install the dependencies using PDM:

pdm install

This command will create a virtual environment in .venv and install the dependencies in that environment. If you're on macOS or Linux, you can run source .venv/bin/activate to activate the environment. Otherwise, you can run the command .venv/Scripts/activate or .venv/Scripts/activate.ps1 to activate the environment.

By using a virtual environment we avoid cross contaminating our global Python environment.

Once our virtual environment is set up we need to select it as our kernel for the Jupyter Notebook. If you're in VSCode, you can do this at the top right of the notebook. If you're using a different IDE, you'll need to look for setup help online.

When selecting the kernel, ensure you choose the one that's located inside of the .venv directory, and not the global Python environment.


Test Your First Notebook

If you're totally new to building AI powered applications with access to external data, specifically retrieval augmented generation, check out the RAG Basics notebook. It's the most straightforward notebook, and its concepts are built upon in every other 'RAG' notebook.

Google Colab

Click the badge below to open the RAG Basics notebook in Colab.

Open 'rag_basics.ipynb' In Colab


LICENSE