An AI-powered Formula 1 chatbot that provides real-time race information, predictions, and insights using advanced RAG (Retrieval-Augmented Generation) architecture.
Try it now: https://chatformula1.com
Note: First load may take 30 seconds as the free tier wakes up.
- New to the project? β Start with Setup Guide
- Want to deploy? β Follow Deployment Guide
- Want to contribute? β Read Contributing Guide
- Need help? β Check Troubleshooting
- All documentation β See Documentation Index
ChatFormula1 is an intelligent chatbot that can:
- Answer questions about current F1 standings and race results
- Provide historical F1 statistics and records
- Generate race predictions based on data analysis
- Search for latest F1 news and updates
- Explain technical F1 concepts and regulations
- Maintain context across conversations
Example Questions:
- "Who won the 2023 F1 World Championship?"
- "What are the current driver standings?"
- "Predict the outcome of the next race"
- "Explain DRS in Formula 1"
- LangChain - Framework for building LLM applications
- LangGraph - Library for building stateful, multi-actor applications with LLMs
- OpenAI GPT - Large language model for generating responses
- OpenAI Embeddings - Text vectorization for semantic search
- Pinecone - Vector database for semantic search and retrieval
- Tavily API - Real-time web search API for current information
- Python 3.11+ - Core programming language
- FastAPI - Modern web framework for building APIs
- Pydantic - Data validation using Python type hints
- Poetry - Dependency management and packaging
- Streamlit - Framework for building interactive web applications
- Structlog - Structured logging library
- Prometheus - Monitoring and alerting toolkit
- Grafana - Analytics and monitoring platform
User Input
β
Streamlit UI
β
LangGraph Agent
βββ Query Analysis
βββ Routing (Vector Search / Web Search)
βββ Context Ranking
βββ LLM Generation
β
Response with Citations
Key Components:
- RAG Pipeline: Combines vector search with LLM generation for accurate, grounded responses
- Multi-Source Integration: Retrieves from both historical data (Pinecone) and real-time web (Tavily)
- Intelligent Routing: Automatically determines the best data source for each query
- Rate Limiting: Built-in protection to stay within free tier limits
- Python 3.11 or higher
- Poetry - Python dependency manager
- API Keys (all have free tiers):
-
Clone the repository
git clone https://github.com/YOUR_USERNAME/chatformula1.git cd chatformula1 -
Install dependencies
poetry install
-
Set up environment variables
cp .env.example .env # Edit .env and add your API keys -
Run the application
# Option 1: Streamlit UI (recommended for testing) poetry run streamlit run src/ui/app.py # Option 2: FastAPI backend poetry run uvicorn src.api.main:app --reload
-
Access the application
- Streamlit UI: http://localhost:8501
- FastAPI docs: http://localhost:8000/docs
# Build and run with Docker Compose
docker-compose up --build
# Access at:
# - UI: http://localhost:8501
# - API: http://localhost:8000- Setup Guide - Complete local development setup with troubleshooting
- Deployment Guide - Deploy to Render for free in 15 minutes
- Contributing Guide - Guidelines for contributing to the project
- Architecture Overview - System design and component architecture
- API Reference - REST API endpoints and usage
- Security Guide - Security best practices and implementation
- Observability - Monitoring, logging, and alerting setup
- Troubleshooting - Common issues and solutions
Deploy automatically on every commit prefixed with deploy::
# One-time setup (5 minutes)
./scripts/setup_github_actions.sh
# Deploy with a single commit
git commit -m "deploy: Add new feature"
git push origin mainWhat happens: Code quality checks β Tests β Build β Deploy to Render β Health checks
π Guide: GitHub Actions Quick Start | Full Documentation
chatformula1/
βββ src/ # Source code
β βββ agent/ # LangGraph agent implementation
β βββ api/ # FastAPI endpoints
β βββ config/ # Configuration management
β βββ ingestion/ # Data ingestion pipeline
β βββ prompts/ # LLM prompt templates
β βββ search/ # Tavily search integration
β βββ tools/ # LangChain tools
β βββ ui/ # Streamlit interface
β βββ utils/ # Utility functions
β βββ vector_store/ # Pinecone integration
βββ tests/ # Test suite
βββ scripts/ # Deployment and utility scripts
βββ docs/ # Documentation
β βββ README.md # Documentation index
β βββ SETUP.md # Local setup guide
β βββ DEPLOYMENT.md # Deployment guide
β βββ CONTRIBUTING.md # Contribution guidelines
β βββ ARCHITECTURE.md # System architecture
β βββ API.md # API reference
β βββ ... # Additional technical docs
βββ pyproject.toml # Poetry dependencies
βββ Dockerfile # Docker configuration
βββ README.md # This file (start here!)
- API keys stored as environment variables (never committed)
- Input validation and sanitization
- Rate limiting: 3 requests/minute, 100 requests/day per user
- HTTPS encryption (automatic on Render)
- No storage of personally identifiable information (PII)
The application is designed to run entirely on free tiers:
| Service | Free Tier | Usage Strategy |
|---|---|---|
| Render | 750 hrs/month | Auto-sleep after 15min inactivity |
| OpenAI | $5 credit | Rate limited to 3 RPM, 200 RPD |
| Pinecone | 100K vectors | Efficient text chunking |
| Tavily | 1000/month | Limited to 30 searches/day |
Contributions are welcome! Please see docs/CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub: Current Projects π§ π§
- LinkedIn: Say Hi! π€
- Email: prateek@chatformula1.com
Built with β€οΈ for Formula 1 fans and AI enthusiasts