AI-powered semantic and hybrid retrieval system for Formula 1 race intelligence using real F1 race data, vector embeddings, and metadata-aware search.
Built using:
- FastAPI
- Ollama
- ChromaDB
- FastF1
- Local Embedding Models
- Vector Search
This project demonstrates:
- embeddings
- vector databases
- semantic search
- metadata filtering
- hybrid retrieval
- retrieval pipelines
- AI backend architecture
- Local embedding generation using Ollama
- Persistent vector storage using ChromaDB
- Semantic similarity search
- Metadata-based filtering
- Hybrid retrieval architecture
- Automated FastF1 race ingestion pipeline
- Real F1 race results from 2020+
- Structured + semantic retrieval
- FastAPI backend APIs
- Swagger API documentation
- F1-themed retrieval dataset
- AI-powered natural language question answering
- analytics pipelines
- Query routing and orchestration
| Component | Technology |
|---|---|
| Backend API | FastAPI |
| Embedding Model | all-minilm (Ollama) |
| Vector Database | ChromaDB |
| Local Model Runtime | Ollama |
| F1 Data Source | FastF1 |
| Data Processing | Pandas |
| Language | Python 3.12 |
f1-ai-assistant/
│
├── app/
│ ├── main.py
│ │
│ ├── routes/
│ │ └── search_routes.py
│ │
│ ├── services/
│ │ ├── embedding_service.py
│ │ ├── chroma_service.py
│ │ └── search_service.py
│ │
│ ├── ingestion/
│ │ └── race_ingestor.py
│ │
│ ├── data/
│ │ └── sample_races.py
│ │
│ └── db/
│ └── chroma_db/
│
├── venv/
├── requirements.txt
└── README.md
git clone <your-repo-url>
cd f1-ai-assistantRecommended:
- Python 3.12+
Check version:
python3 --versionpython3.12 -m venv venvActivate:
source venv/bin/activatepip install -r requirements.txtOR manually:
pip install fastapi uvicorn chromadb ollama pydantic
pip install celery redisOfficial website:
OR using Homebrew:
brew install ollamaollama serveKeep this terminal running.
ollama pull all-minilm
ollama pull llama3.2Start FastAPI server:
uvicorn app.main:app --reloadApplication runs at:
http://127.0.0.1:8000
Start Redis
brew services start redisStart Celery server:
celery -A app.tasks worker --loglevel=info
# celery -A app.celery_app.celery worker \
# --pool=solo \
# --loglevel=infoFastAPI automatically generates API docs:
http://127.0.0.1:8000/docs
Generates embeddings and stores F1 race data into ChromaDB.
Example:
/search?query=Ferrari strategy mistakes
Returns semantically similar race documents.
Returns all stored documents from ChromaDB.
Natural language Formula 1 question-answering API.
This endpoint:
- classifies the query
- routes between retrieval and analytics pipelines
- performs semantic search using embeddings
- applies metadata filtering
- generates human-readable AI responses
- Race documents are converted into embeddings
- Embeddings are stored in ChromaDB
- User query is converted into embedding
- ChromaDB performs nearest-neighbor vector search
- Most semantically similar documents are returned
Input:
Ferrari strategy mistakes
Possible Result:
Ferrari lost Monaco GP due to poor pit strategy and tire timing.
Even though exact keywords differ.
- Add metadata filtering
- Add RAG workflow
- Add local LLM responses
- Add race ingestion pipeline
- Add frontend UI
- Add hybrid search
- Add reranking
- Embeddings
- Vector Databases
- Semantic Search
- Similarity Search
- Retrieval Systems
- RAG Foundations
- AI Backend Architecture
- Query routing
- Semantic retrieval
- Hybrid AI pipelines
- Metadata filtering
- LLM-powered query parsing
- Analytics orchestration
- Natural language response generation
- Vector similarity search
- ChromaDB is configured with persistent local storage
- Embeddings are generated locally using Ollama
- No paid API usage required
- Optimized for Apple Silicon Macs
- FastAPI: https://fastapi.tiangolo.com
- Ollama: https://ollama.com
- ChromaDB: https://www.trychroma.com
MIT