Prerequisites
Before you begin, make sure you have:- Python 3.8+ installed
- OpenAI API Key(s) - Get one at platform.openai.com
- Pinecone Account - Sign up at pinecone.io
- Supabase Project - Create one at supabase.com
Quick Start (5 Minutes)
Step 1: Install LangChat
Install LangChat using pip:Step 2: Configure Your Environment
Create a.env file or set environment variables:
Step 3: Write Your First Chatbot
Create a filemain.py:
Step 4: Run It!
Using LangChat as an API Server
LangChat can also run as a FastAPI server with an auto-generated frontend interface.Create API Server
Createserver.py:
Run the Server
- Frontend Interface: Visit
http://localhost:8000/frontend - API Endpoint: POST to
http://localhost:8000/chat - Health Check: GET
http://localhost:8000/health
Configuration Options
LangChat supports configuration in multiple ways:1. Environment Variables (Recommended)
2. Direct Configuration
3. Hybrid Approach
Configuration Guide
Learn about all configuration options
Custom Prompts
Customize your chatbot’s behavior
What Happens Under the Hood?
When you initialize LangChat, it automatically:- Initializes Adapters: Sets up OpenAI, Pinecone, Supabase, and Flashrank
- Creates Database Tables: Sets up chat history, metrics, and feedback tables
- Downloads Reranker Models: Automatically downloads Flashrank reranker models
- Sets Up Sessions: Prepares user session management
Next Steps
Now that you have LangChat running, explore these topics:- Configuration Guide - Customize LangChat for your needs
- Custom Prompts - Make your chatbot unique
- API Reference - Learn about all available methods
- Examples - See more complex use cases
Common Issues
Issue: “Supabase URL and key must be provided”
Solution: Make sure you’ve setSUPABASE_URL and SUPABASE_KEY environment variables.
Issue: “Pinecone index name must be provided”
Solution: Create a Pinecone index first, then setPINECONE_INDEX_NAME.
Issue: “OpenAI API keys must be provided”
Solution: SetOPENAI_API_KEYS or OPENAI_API_KEY environment variable.
Issue: Reranker model download fails
Solution: The reranker model is downloaded automatically torerank_models/. Make sure you have write permissions.
Need Help?
- Check our Troubleshooting Guide
- Open an issue on GitHub
- Review the API Reference
Ready to build something amazing? Let’s continue with Configuration!