Over 30,000+ flights are delayed each year. Dealing with flight delays is not fun for either the airline customer service agents or the passengers.

"Is my flight delayed?" gives passengers proactive info to understand the status of their flight.

The dataset is a simulation of flights in the US. (details below)

Events are ingested and then read from Kafka. A stream processing engine processes those events and computes the following values:

  • Minimum delay time of airline at airport in the past hour
  • Average delay time of airline at airport in the past hour
  • Maximum delay time of airline at airport in the past hour

This information is computed for both the initial and connecting flight and is fed as a prompt to Claude2.

Claude2 uses the information in the prompt to determine whether or not the delay in the initial flight will affect the connecting flight. If so, Claude2 will recommend the next flight with the same airline and departure and arrival airports. A sample prompt is given below.

Simulated airlines, airports, and flight numbers.

airlines = {
    "United Airlines": "UA",
    "American Airlines": "AA",
    "Southwest Airlines": "SW",
    "Delta Air Lines": "DL"
}

airports = ["SFO", "ORD", "MKE", "LAX"]

# List of specific airplane numbers
airplane_numbers = [920, 360, 481, 720, 526, 755, 192, 214, 388, 823, 109]

Example prompt:

Human: You are a helpful AI assistant. Use the following pieces of context to answer the question at the end. If you don't know the answer, just say you don't know. DO NOT try to make up an answer. If the question is not related to the context, politely respond that you are tuned to only answer questions that are related to the context.

UA109 is expected to fly from SFO to ORD at 2023-07-30 01:00:38. UA109's flight time is 4 hours 25 minutes. UA109 is expected to arrive in ORD at 2023-07-30 05:25:39.

DL720 is expected to fly from ORD to MKE at 2023-07-30 05:57:22.

Minimum United Airlines flight delay at SFO in the past hour: 31 minutes Average United Airlines flight delay at SFO in the past hour: 1 hours 50 minutes Maximum United Airlines flight delay at SFO in the past hour: 2 hours 58 minutes

Estimate whether or not the flight UA109 will be delayed or not. If the flight is delayed, give advice on what the user should do about their connecting flight. See if they can reschedule to DL192 at 2023-07-30 15:43:33 instead.

Wish the user safe travels.

Assistant: Can I think step-by-step?

Human: Yes, please do.

Assistant:

Claude2 Response:

Okay, let's break this down:

UA109 is scheduled to depart SFO at 01:00:38 on 2023-07-30 and arrive ORD at 05:25:39. Flight time is 4 hours 25 minutes.

DL720 is scheduled to depart ORD at 05:57:22 on 2023-07-30.

Minimum UA delay at SFO in past hour is 31 minutes.

Average UA delay at SFO in past hour is 1 hour 50 minutes.

Maximum UA delay at SFO in past hour is 2 hours 58 minutes.

Based on the average delay, UA109 will likely be delayed by about 1 hour 50 minutes.

That would put the revised arrival time for UA109 at ORD around 07:15:39.

Since DL720 is scheduled to depart ORD at 05:57:22, there is a high chance UA109 will miss the connection to DL720.

I would advise looking into rebooking on DL192 at 15:43:33 instead of DL720 to ensure making the connection. I wish you safe travels! Let me know if you need any other help with rebooking your flights.

Built With

Share this project:

Updates