This repository is designed to help you get started with the latest version of LangChain.
Many tutorials and courses available online still use deprecated methods that no longer work with the new langchain and langchain_openai packages.
These notebooks bridge that gap by allowing you to compare the old way vs the new way side by side.
- 📘 Beginner-friendly Jupyter notebooks (
.ipynb) to get started with LangChain. - 🆕 Examples using the latest LangChain APIs (
RunnableSequence,RunnableMap, etc.). - 🧩 Deprecated examples included for comparison.
Each notebook shows both:
# ✅ New way
result = llm.invoke("Tell me a joke about programming.")
# ❌ Older way (Deprecated)
result = llm("Tell me a joke about programming.")git clone https://github.com/shaharyar-sajid/langchain_starter_codes.git
cd langchain_starter_codesIt’s recommended to use a clean environment for LangChain projects:
# Using venv
python -m venv venv
source venv/bin/activate # On macOS/Linux
venv\Scripts\activate # On WindowsA requirements.txt file has been provided. Install everything with:
pip install -r requirements.txtLangChain automatically picks up your OpenAI key from the environment.
- Create a .env file in the root of the project
- Add your OpenAI API key inside:
OPENAI_API_KEY=sk-your-openai-key-hereLangChain will automatically load this key using dotenv.
Some parts of the jupyter notebooks code scripts have been taken from Stephen Griders course named ChatGPT and LangChain: The Complete Developer's Masterclass