Skip to content

shirochan/langchain-academy

 
 

Repository files navigation

LangChain Academy

Introduction

Welcome to LangChain Academy! This is a growing set of modules focused on foundational concepts within the LangChain ecosystem. Module 0 is basic setup and Modules 1 - 4 focus on LangGraph, progressively adding more advanced themes. In each module folder, you'll see a set of notebooks. A LangChain Academy accompanies each notebook to guide you through the topic. Each module also has a studio subdirectory, with a set of relevant graphs that we will explore using the LangGraph API and Studio.

Setup

Clone repo

git clone https://github.com/shirochan/langchain-academy.git
$ cd langchain-academy

Setting up env variables

Briefly going over how to set up environment variables. Copy the .env.sample file as a .env file and fill in the required fields.

$ cp .env.sample .env

Set OpenAI API key

  • If you don't have an OpenAI API key, you can sign up here.
  • Set OPENAI_API_KEY in your .env file

Sign up and Set LangSmith API

  • Sign up for LangSmith here, find out more about LangSmith
  • and how to use it within your workflow here, and relevant library docs!
  • Set LANGCHAIN_API_KEY in your .env file

Set up Tavily API for web search

  • Tavily Search API is a search engine optimized for LLMs and RAG, aimed at efficient, quick, and persistent search results.

  • You can sign up for an API key here. It's easy to sign up and offers a very generous free tier. Some lessons (in Module 4) will use Tavily.

  • Set TAVILY_API_KEY in your .env file.

Set up Development enviroment

  • If you open the repository in VSCode, devcontainer will launch a docker environment.
  • Alternatively, you can use $ docker compose up -d to build a docker environment.

Set up LangGraph Studio

  • Currently, Studio only has macOS support and needs Docker Desktop running.
  • Download the latest .dmg file here
  • Install Docker desktop for Mac here

Running Studio

Graphs for LangGraph Studio are in the module-x/studio/ folders.

  • To use Studio, you will need to create a .env file with the relevant API keys
  • Run this from the command line to create these files for module 1 to 4, as an example:
$ for i in {1..4}; do
  cp module-$i/studio/.env.example module-$i/studio/.env
  echo "OPENAI_API_KEY=\"$OPENAI_API_KEY\"" > module-$i/studio/.env
done
$ echo "TAVILY_API_KEY=\"$TAVILY_API_KEY\"" >> module-4/studio/.env

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 97.6%
  • Python 2.4%