Get your LLM Chatbot Framework up and running in 5 minutes!
- Python 3.9 or higher
- pip (Python package manager)
- (Optional) Docker and Docker Compose
# Clone the repository (if not already done)
cd LLM-Chatbot-Framework
# Create virtual environment
python -m venv venv
# Activate virtual environment
source venv/bin/activate # On Linux/Mac
# OR
venv\Scripts\activate # On Windows
# Install dependencies
pip install -r requirements.txt# Copy example environment file
cp .env.example .env
# Edit .env and add your API keys (optional for getting started)
# You can start without API keys and add them laterFor testing without LLM providers, the app will still work for authentication and conversation management.
# Start the server
uvicorn app.main:app --reloadThe API will be available at: http://localhost:8000
Open your browser and visit:
- Interactive API Docs: http://localhost:8000/docs
- Alternative Docs: http://localhost:8000/redoc
- Health Check: http://localhost:8000/health
cp .env.example .env
# Edit .env with your settings# Build and start all services
docker-compose up -d
# View logs
docker-compose logs -f appThe API will be available at: http://localhost:8000
docker-compose down- Go to http://localhost:8000/docs
- Click on "POST /api/v1/auth/register"
- Click "Try it out"
- Fill in the request body:
{ "email": "test@example.com", "username": "testuser", "password": "testpass123" } - Click "Execute"
# 1. Register a user
curl -X POST http://localhost:8000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","username":"testuser","password":"testpass123"}'
# 2. Login
curl -X POST http://localhost:8000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"testuser","password":"testpass123"}'
# Copy the access_token from the response
# 3. Send a chat message (replace YOUR_TOKEN with the access token)
curl -X POST http://localhost:8000/api/v1/chat/message \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"message":"Hello!"}'# Run the example client
python examples/simple_client.pyTo enable actual AI responses, add your API keys to the .env file:
OPENAI_API_KEY=sk-your-openai-api-key-here
DEFAULT_LLM_PROVIDER=openai
DEFAULT_MODEL=gpt-4Get your API key from: https://platform.openai.com/api-keys
ANTHROPIC_API_KEY=sk-ant-your-anthropic-api-key-here
DEFAULT_LLM_PROVIDER=anthropic
DEFAULT_MODEL=claude-3-5-sonnet-20241022Get your API key from: https://console.anthropic.com/
- Install Ollama: https://ollama.ai/
- Pull a model:
ollama pull llama2 - Configure in
.env:
DEFAULT_LLM_PROVIDER=ollama
DEFAULT_MODEL=llama2
OLLAMA_BASE_URL=http://localhost:11434After adding API keys, restart the application.
Using the Makefile:
make help # Show available commands
make run # Run development server
make test # Run tests
make format # Format code
make docker-up # Start Docker containers
make docker-down # Stop Docker containersLLM-Chatbot-Framework/
├── app/ # Application code
│ ├── api/ # API endpoints
│ ├── core/ # Core configuration
│ ├── models/ # Database models
│ ├── schemas/ # Request/response schemas
│ ├── services/ # Business logic
│ └── main.py # Application entry point
├── tests/ # Test suite
├── examples/ # Example clients
├── docs/ # Documentation
└── .env # Configuration (create from .env.example)
- Read the Full Documentation: Check out README.md for detailed features
- Explore the API: Visit http://localhost:8000/docs for interactive documentation
- Run the Tests: Execute
pytestto run the test suite - Deploy to Production: See DEPLOYMENT.md for deployment guides
- View Examples: Check EXAMPLES.md for more usage examples
If port 8000 is already in use:
# Use a different port
uvicorn app.main:app --port 8001 --reloadIf using SQLite and getting database locked errors:
# Remove the database file and restart
rm chatbot.db
uvicorn app.main:app --reloadMake sure you're in the virtual environment:
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows- Verify the API key is correct in
.env - Restart the application after adding API keys
- Check the logs for specific error messages
- Documentation: See README.md, EXAMPLES.md, DEPLOYMENT.md
- Issues: Open an issue on GitHub
- Contributing: See CONTRIBUTING.md
You now have a fully functional chatbot API running! Start building your chatbot applications.
Happy coding!