f1_predict_pit_strategy
Predict the recommended pit-stop strategy for an F1 driver using race session data and current lap. Returns pit lap numbers and tyre compound choices.
Instructions
Predict the optimal pit-stop strategy for a driver in an F1 race session.
Args: session_key: OpenF1 session identifier for a recorded race. driver_number: Driver's race number (e.g. 1 for Verstappen). current_lap: Current lap to project from (default 1 = full race ahead). total_laps: Total race laps. If omitted, inferred from the highest observed lap_number in the fetched laps (correct for Monaco 78 / Spa 44), falling back to 57 when no laps are available. An explicit value always wins.
Returns: data.stop_laps: recommended pit laps. data.compound_sequence: tyre compounds for each stint. data.expected_finish_position: currently always None (not modelled). data.confidence: 0.0-1.0 model confidence. meta.total_laps: race length used (explicit arg, else inferred from laps). meta.estimated: true.
Example: f1_predict_pit_strategy(session_key=9158, driver_number=1) f1_predict_pit_strategy(session_key=9158, driver_number=16, current_lap=20, total_laps=78)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| total_laps | No | Total race laps. If omitted, inferred from the highest observed lap_number in the fetched laps (correct for Monaco 78 / Spa 44), falling back to 57 when no laps are available. An explicit value always wins. | |
| current_lap | No | Current lap to project from (default 1 = full race ahead). | |
| session_key | Yes | OpenF1 session identifier for a recorded race. | |
| driver_number | Yes | Driver's race number (e.g. 1 for Verstappen). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | ||
| meta | No | ||
| error | No |