← Open Source
pixegami

langchain-rag-tutorial

A simple Langchain RAG application.

TutorialsTool-specific tutorialsPython
Open on GitHub
Momentum
+1stars in 24 hours+0.1%
995
Stars
520
Forks
+2
This week
2
Contributors
Created 2023-11-13 · Updated 2026-10-16 · #5532 today
Top developers
williamagyapongpixegami
README

Langchain RAG Tutorial

Install dependencies

  1. Do the following before installing the dependencies found in requirements.txt file because of current challenges installing onnxruntime through pip install onnxruntime.

    • For MacOS users, a workaround is to first install onnxruntime dependency for chromadb using:
     conda install onnxruntime -c conda-forge
    

    See this thread for additonal help if needed.

    • For Windows users, follow the guide here to install the Microsoft C++ Build Tools. Be sure to follow through to the last step to set the enviroment variable path.
  2. Now run this command to install dependenies in the requirements.txt file.

pip install -r requirements.txt
  1. Install markdown depenendies with:
pip install "unstructured[md]"

Create database

Create the Chroma DB.

python create_database.py

Query the database

Query the Chroma DB.

python query_data.py "How does Alice meet the Mad Hatter?"

You'll also need to set up an OpenAI account (and set the OpenAI key in your environment variable) for this to work.

Here is a step-by-step tutorial video: RAG+Langchain Python Project: Easy AI/Chat For Your Docs.

Nearby in the ranking
Similar items