bhancockio / langchain-crash-course

418 stars 329 forks source link

LangChain Crash Course

Welcome to the LangChain Crash Course repository! This repo contains all the code examples you'll need to follow along with the LangChain Master Class for Beginners video. By the end of this course, you'll know how to use LangChain to create your own AI agents, build RAG chatbots, and automate tasks with AI.

Course Outline

  1. Setup Environment
  2. Chat Models
  3. Prompt Templates
  4. Chains
  5. RAG (Retrieval-Augmented Generation)
  6. Agents & Tools

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    <!-- TODO: UPDATE TO MY  -->
    git clone https://github.com/bhancockio/langchain-crash-course
    cd langchain-crash-course
  2. Install dependencies using Poetry:

    poetry install --no-root
  3. Set up your environment variables:

    • Rename the .env.example file to .env and update the variables inside with your own values. Example:
    mv .env.example .env
  4. Activate the Poetry shell to run the examples:

    poetry shell
  5. Run the code examples:

    python 1_chat_models/1_chat_model_basic.py

Repository Structure

Here's a breakdown of the folders and what you'll find in each:

1. Chat Models

Learn how to interact with models like ChatGPT, Claude, and Gemini.

2. Prompt Templates

Understand the basics of prompt templates and how to use them effectively.

3. Chains

Learn how to create chains using Chat Models and Prompts to automate tasks.

4. RAG (Retrieval-Augmented Generation)

Explore the technologies like documents, embeddings, and vector stores that enable RAG queries.

5. Agents & Tools

Learn about agents, how they work, and how to build custom tools to enhance their capabilities.

How to Use This Repository

  1. Watch the Video: Start by watching the LangChain Master Class for Beginners video on YouTube at 2X speed for a high-level overview.

  2. Run the Code Examples: Follow along with the code examples provided in this repository. Each section in the video corresponds to a folder in this repo.

  3. Join the Community: If you get stuck or want to connect with other AI developers, join the FREE Skool community here.

Comprehensive Documentation

Each script in this repository contains detailed comments explaining the purpose and functionality of the code. This will help you understand the flow and logic behind each example.

FAQ

Q: What is LangChain?
A: LangChain is a framework designed to simplify the process of building applications that utilize language models.

Q: How do I set up my environment?
A: Follow the instructions in the "Getting Started" section above. Ensure you have Python 3.10 or 3.11 installed, install Poetry, clone the repository, install dependencies, rename the .env.example file to .env, and activate the Poetry shell.

Q: I am getting an error when running the examples. What should I do?
A: Ensure all dependencies are installed correctly and your environment variables are set up properly. If the issue persists, seek help in the Skool community or open an issue on GitHub.

Q: Can I contribute to this repository?
A: Yes! Contributions are welcome. Please open an issue or submit a pull request with your changes.

Q: Where can I find more information about LangChain?
A: Check out the official LangChain documentation and join the Skool community for additional resources and support.

Support

If you encounter any issues or have questions, feel free to open an issue on GitHub or ask for help in the Skool community.

License

This project is licensed under the MIT License.