Skip to content

rkalagara/langchain-tutorial

Repository files navigation

🤖 LangChain Tutorial Project

A well-organized collection of LangChain examples with proper deployment configuration.

📁 Project Structure

langchain-tutorial/
├── 📚 docs/                    # Documentation
│   ├── README.md              # Detailed project documentation
│   └── DEPLOYMENT.md          # Firebase deployment guide
│
├── 🐍 src/                     # Source code
│   ├── chat_model_basic.py    # Basic LangChain example
│   └── chat_mode_conversation.py # Streamlit chatbot
│
├── 🚀 deployment/              # Deployment configuration
│   ├── Dockerfile             # Container configuration
│   ├── .dockerignore          # Docker ignore rules
│   ├── firebase.json          # Firebase hosting config
│   └── requirements.txt       # Python dependencies
│
├── 📜 scripts/                 # Automation scripts
│   └── deploy.sh              # Automated deployment script
│
├── 🌐 public/                  # Static web assets
│   └── index.html             # Loading page
│
├── ⚙️ config/                  # Configuration files
│   └── .env.example           # Environment variables template
│
└── .env                       # Environment variables (create this)

🚀 Quick Start

1. Environment Setup

# Copy environment template
cp config/.env.example .env

# Edit .env with your API keys
nano .env

2. Install Dependencies

# Activate conda environment
conda activate your-env-name

# Install packages
pip install -r deployment/requirements.txt

3. Run Locally

# Basic example
python src/chat_model_basic.py

# Streamlit chatbot
streamlit run src/chat_mode_conversation.py

4. Deploy to Firebase

# Run automated deployment
./scripts/deploy.sh

📖 Documentation

🛠️ Development

Running Examples

Basic Chat Model:

cd src/
python chat_model_basic.py

Interactive Chatbot:

streamlit run src/chat_mode_conversation.py

Local Testing

Docker Build:

docker build -f deployment/Dockerfile -t langchain-chatbot .
docker run -p 8080:8080 --env-file .env langchain-chatbot

Firebase Emulator:

firebase emulators:start --only hosting

🔧 Configuration

Environment Variables

Create a .env file in the project root:

# Required
OPENAI_API_KEY=your_openai_api_key_here

# Optional (for LangSmith tracing)
LANGCHAIN_API_KEY=your_langchain_api_key_here
LANGCHAIN_TRACING_V2=true

Firebase Configuration

Your Firebase project: chatbotbasic-b9085

📊 Project Features

Examples Included:

  • 🔗 Basic LangChain Integration - Simple OpenAI API usage
  • 💬 Interactive Streamlit Chatbot - Full conversation interface
  • 🧠 Memory Management - Conversation context preservation
  • ⚙️ Configurable Models - Multiple GPT model support

🚀 Deployment Ready:

  • 🐳 Docker Containerization - Production-ready containers
  • ☁️ Google Cloud Run - Scalable serverless deployment
  • 🌐 Firebase Hosting - Global CDN and SSL
  • 🔐 Secure Configuration - Environment variable management

🛠️ Developer Experience:

  • 📁 Organized Structure - Clean separation of concerns
  • 📚 Comprehensive Docs - Step-by-step guides
  • 🤖 Automated Scripts - One-command deployment
  • 🔧 Local Development - Easy testing and debugging

🌐 Live Demo

After deployment, your chatbot will be available at:

  • Production: https://chatbotbasic-b9085.firebaseapp.com

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add your example with proper documentation
  4. Update the README if needed
  5. Submit a pull request

📄 License

This project is for educational purposes. Please ensure you comply with OpenAI's usage policies.


Built with ❤️ using LangChain, OpenAI, and Streamlit

🚀 Happy coding!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors