Skip to main content

Quick Install

The fastest way to get started:
pip install langchat
LangChat requires Python 3.8 or higher.

Installation Methods

For production use, specify a version:
pip install langchat==0.0.2

From Source

Clone the repository and install:
git clone https://github.com/neurobrains/langchat.git
cd langchat
pip install -e .

Development Installation

For development with all dependencies:
git clone https://github.com/neurobrains/langchat.git
cd langchat
pip install -e ".[dev]"
This includes:
  • pytest for testing
  • pytest-asyncio for async tests

System Requirements

Python Version

  • Minimum: Python 3.8
  • Recommended: Python 3.10+

Operating System

LangChat works on:
  • ✅ Linux
  • ✅ macOS
  • ✅ Windows

Memory

  • Minimum: 2GB RAM
  • Recommended: 4GB+ RAM (for reranker models)
The Flashrank reranker downloads models (~50MB) on first use. Make sure you have sufficient disk space.

Verify Installation

Test your installation:
import langchat
print(langchat.__version__)  # Should print: 0.0.2
Or check if components are importable:
from langchat import LangChat, LangChatConfig, LangChatEngine
print("✅ Installation successful!")

Environment Setup

Required Environment Variables

Create a .env file:
# OpenAI Configuration
OPENAI_API_KEYS=sk-...  # Can be comma-separated for multiple keys
OPENAI_MODEL=gpt-4o-mini
OPENAI_TEMPERATURE=1.0
OPENAI_EMBEDDING_MODEL=text-embedding-3-large

# Pinecone Configuration
PINECONE_API_KEY=pcsk-...
PINECONE_INDEX_NAME=your-index-name

# Supabase Configuration
SUPABASE_URL=https://xxxxx.supabase.co
SUPABASE_KEY=eyJhbGc...

# Optional: Server Configuration
SERVER_PORT=8000

Load Environment Variables

Using python-dotenv:
pip install python-dotenv
from dotenv import load_dotenv
load_dotenv()

from langchat.config import LangChatConfig
config = LangChatConfig.from_env()

Docker Installation

LangChat auto-generates a Dockerfile when running as an API server. You can also create your own:

Using Auto-Generated Dockerfile

from langchat.api.app import create_app
from langchat.config import LangChatConfig

config = LangChatConfig.from_env()
app = create_app(
    config=config,
    auto_generate_docker=True  # Creates Dockerfile automatically
)

Manual Dockerfile

FROM python:3.10-slim

WORKDIR /app

# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application
COPY . .

# Expose port
EXPOSE 8000

# Run server
CMD ["uvicorn", "langchat.api.app:app", "--host", "0.0.0.0", "--port", "8000"]
Always use a virtual environment:
# Create virtual environment
python -m venv venv

# Activate (Linux/macOS)
source venv/bin/activate

# Activate (Windows)
venv\Scripts\activate

# Install LangChat
pip install langchat

Troubleshooting

Issue: pip install fails

Solutions:
  • Upgrade pip: pip install --upgrade pip
  • Use Python 3.8+
  • Check your internet connection

Issue: Import errors

Solutions:
  • Verify Python version: python --version
  • Reinstall: pip uninstall langchat && pip install langchat
  • Check virtual environment is activated

Issue: Reranker model download fails

Solutions:
  • Check internet connection
  • Verify disk space
  • Check write permissions in project directory

Issue: Dependencies conflict

Solutions:
  • Use a fresh virtual environment
  • Check version compatibility
  • Review requirements.txt for conflicts

Next Steps

Now that LangChat is installed:
  1. Getting Started - Build your first chatbot
  2. Configuration - Configure LangChat
  3. Examples - See examples

Ready to start building? Check out our Getting Started Guide!