LangChain Models is a hands-on, practical repository created by Arish Islam to help developers explore and master the core model abstractions used in modern Generative AI applications with LangChain.
This project focuses on three fundamental pillars of GenAI:
- 🤖 LLMs: Large Language Models for text generation and completion.
- 💬 Chat Models: Message-based conversational AI and agents.
- 🔢 Embedding Models: Converting text into vector representations for semantic understanding.
- How to work with core LLMs using LangChain abstractions.
- The difference between text-based LLMs and structured Chat Models.
- How conversational messages and histories are handled.
- How Embedding Models map text to vector spaces.
- The foundational concepts behind Semantic Search, Vector Databases, and RAG (Retrieval-Augmented Generation).
langchain-models/
│
├── 📁 1.LLMs/ # LLM generation and completion examples
├── 📁 2.ChatModels/ # Chat models, prompts, and message handling
├── 📁 3.EmbeddingModels/ # Text embeddings and vector representations
│
├── 📄 requirements.txt # Project dependencies
├── 📄 test.py # Quick test/experimentation script
└── 📄 README.md # Project documentation
---
## 🧠 Core Concepts
### 🤖 1. LLMs
Large Language Models generate text based on an input prompt. Ideal for text completion, summarization, and content generation.
```text
Prompt ──> [ LLM ] ──> Generated Response
Chat Models handle multi-turn conversations using structured messages (SystemMessage, HumanMessage, AIMessage). Ideal for chatbots and AI agents.
System/Human Messages ──> [ Chat Model ] ──> AI Response
Embedding Models convert text into numerical vectors to capture semantic meaning, forming the foundation of vector search and RAG systems.
Text ──> [ Embedding Model ] ──> Vector Representation ──> Semantic Search
- Python 3.10+ installed on your system.
- Git for cloning the repository.
- An active API key from your preferred model provider (e.g., OpenAI).
git clone [https://github.com/arish096/langchain-models.git](https://github.com/arish096/langchain-models.git)
cd langchain-models
Windows:
python -m venv .venv
.venv\Scripts\activate
macOS / Linux:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Create a .env file in the root directory of your project and configure your API keys securely:
OPENAI_API_KEY=your_api_key_here
⚠️ Security Warning: Never commit your.envfile or API credentials to GitHub. Make sure.envand.venv/are included in your.gitignore.
Navigate to any directory or run the test script to see the components in action:
python test.py
Or run individual component files:
python <example-file>.py
LLMs ➔ Chat Models ➔ Embedding Models ➔ Vector Databases ➔ Retrieval ➔ RAG ➔ Agents & Tools ➔ Production AI Apps
Once you are comfortable with these core models, you can expand them into real-world applications:
- 🤖 AI Chatbot with memory
- 📚 PDF QA System using local documents
- 🔎 Semantic Search Engine with vector stores
- 🧠 RAG (Retrieval-Augmented Generation) application
- 🛠️ Tool-Using AI Agent
Contributions, feature additions, and bug fixes are always welcome!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git origin feature/AmazingFeature) - Open a Pull Request
Arish Islam
- Developer • AI/ML Enthusiast • LangChain Learner
- GitHub: @arish096
Made with ❤️ by Arish Islam
If you found this repository helpful, please consider giving it a ⭐ on GitHub!