Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏎️ F1 Knowledge Agent

Built with Claude RAG Formula 1 Google Colab

Navigate F1 history with AI β€” grounded answers, zero hallucination, exportable data.

The F1 Knowledge Agent is a RAG (Retrieval-Augmented Generation) agent grounded in Formula 1 Teams & Constructors data. Unlike a live-search agent, it answers questions only from its pre-loaded knowledge base β€” making every answer reliable, citeable, and auditable.

Every response comes in two layers:

  • πŸ“– Plain English answer β€” sourced directly from documents, with citation
  • πŸ“Š Data Output table β€” structured data ready to copy into Excel, Python, or Tableau

Architecture

User Question β†’ search_documents tool β†’ Relevant passages β†’ Claude β†’ Answer + Data Table

The RAG Equation

Component Implementation
Brain Claude Sonnet 4 (Anthropic) β€” native tool use pattern
Knowledge Base 6 curated F1 documents loaded as Python dictionaries
Retrieval Keyword search with title weighting (2x) and stop-word filtering
Output Two-layer: plain English answer + exportable markdown table

How it differs from Compass

Compass (Live Search) F1 Knowledge Agent (RAG)
Data source Live web, Wikipedia, Google News Pre-loaded static knowledge base
Best for Current events, real-time data Historical facts, structured analytics
Reliability Depends on live sources Fully auditable β€” answers trace to docs
Architecture ReAct loop with 4 external APIs RAG retrieval with native tool use

Together, these two projects demonstrate both core AI agent architectures used in production systems.


Knowledge Base (6 Documents)

# Document Coverage
1 Ferrari Scuderia History Founded 1929, 16 titles, Schumacher era, current status
2 Red Bull Racing History Founded 2005, Vettel dynasty, Verstappen dominance, 2023 peak
3 Mercedes AMG Petronas History 8 consecutive titles, Hamilton era, post-2021 decline
4 McLaren Racing History Senna/Prost golden era, decline, 2024 comeback
5 Williams Racing History Frank Williams dynasty, financial struggles, Dorilton sale
6 Constructors Championship All-Time Data Full year-by-year table 1958–2024, all team totals

Document 6 is the analytics layer β€” structured as a clean table so the agent can produce exportable data outputs for further analysis in Python, Excel, or Tableau.


What the Agent Can Answer

Easy (direct facts):

  • "Which F1 team has the most Constructors Championships?"
  • "When was Red Bull Racing founded?"
  • "How many titles has Mercedes won?"

Medium (comparative):

  • "Compare Red Bull and Mercedes titles won after 2010."
  • "Which team won back-to-back Constructors titles most recently?"

Hard (analytical):

  • "Which team had the most dominant single season in F1 history?"
  • "What pattern do teams show after a dominant era ends?"

Gracefully declined (knowledge gaps):

  • "Who will win the 2026 title?" β†’ Agent refuses to speculate
  • "What was Ferrari's tire strategy in the 2022 Bahrain GP?" β†’ Agent flags the gap

RAG Failure Modes (Task 2)

The notebook deliberately stress-tests three core RAG failure scenarios every production system faces:

Failure Mode Test Key Lesson
Outdated data Inject 2019 standings alongside 2024 docs Keyword search has no date awareness
Contradicting documents Two sources give different Ferrari title counts Agent blends without flagging conflict
Knowledge gap Ask for race-level data not in any document Risk of hallucination when retrieval is partial

Each failure includes a written root-cause analysis and proposed fixes β€” the same evaluation framework used in real enterprise RAG deployments.


Quick Start

  1. Open F1_Knowledge_Agent.ipynb in Google Colab
  2. Get an Anthropic API key at console.anthropic.com
  3. Paste your key in Cell 2
  4. Runtime β†’ Run all

Sample Output

QUESTION: Which F1 team has the most Constructors Championships?
============================================================
  πŸ” Searching: 'most constructors championships F1 team'
     Found 3 relevant documents

πŸ“– ANSWER:
Ferrari holds the record for the most Constructors Championships in Formula 1
history with 16 titles, spanning from 1961 to their most recent in 2008.
Source: constructors_championship_alltime.md, ferrari_history.md

πŸ“Š DATA OUTPUT:
| Team      | Constructors Titles | First Title | Last Title | Active |
|-----------|--------------------:|-------------|------------|--------|
| Ferrari   | 16                  | 1961        | 2008       | Yes    |
| Williams  | 9                   | 1980        | 1997       | Yes    |
| McLaren   | 9                   | 1974        | 2024       | Yes    |
| Mercedes  | 8                   | 2014        | 2021       | Yes    |
| Red Bull  | 6                   | 2010        | 2023       | Yes    |

Tech Stack

  • LLM: Claude Sonnet 4 (Anthropic API, native tool use)
  • Retrieval: Keyword-based search with title weighting and stop-word filtering
  • Domain: F1 Teams and Constructors Championship (1958–2024)
  • Environment: Google Colab
  • Course: ISOM 260/900 β€” AI for Business, Suffolk University

Related Projects

Project Description
Compass Agent Live-search AI research agent using Wikipedia, web fetcher, calculator, and Google News
Sports Analytics Portfolio Predictive modeling and statistical analysis across multiple sports domains

Author

Benedict Daxell Santoso


🏎️ F1 Knowledge Agent β€” grounded answers, exportable data, zero hallucination.

About

🏎️ RAG-powered F1 Teams & Constructors knowledge agent built with Claude (Anthropic) β€” grounded answers + exportable analytics tables from a curated knowledge base

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages