mirror of
https://github.com/langchain-ai/learning-langchain.git
synced 2026-07-01 16:06:32 -04:00
956cc046a7eaa00af855d167e76597d767ebf5e3
Learning LangChain Code Examples
This repository contains code examples (in python and javascript) from each chapter of the book "Learning LangChain".
To run the examples, you can clone the repository and run the examples in your preferred language.
For python examples:
If you haven't installed python on your system, install it first as per the instructions here.
- Create a virtual environment:
This command creates a directory named .venv containing the virtual environment.
python -m venv .venv
- Activate the virtual environment:
- MacOs/Linux:
source .venv/bin/activate
- Windows:
.venv\Scripts\activate
After activation, your terminal prompt should prefix with (venv), indicating that the virtual environment is active.
- Install the dependencies in the
pyproject.tomlfile:
pip install -e .
- Verify the installation:
pip list
- Run an example to see the output:
python ch2/py/a-text-loader.py
For javascript examples:
If you haven't installed node on your system, install it first as per the instructions here.
- Install the dependencies in the
package.jsonfile:
npm install
- Run the example to see the output:
node ch2/js/a-text-loader.js
Description
Languages
Python
50.5%
JavaScript
40.8%
TypeScript
8.7%