# Travel and airlines

> 10 Travel and airlines use cases of Curva, each run on a real model, with what it answered.

Source: https://docs.tarkova.com/curva/use-cases/travel-and-airlines/

10 use cases, 29 of 30 samples right. [How these were run](/curva/use-cases/).

## Triage flight disruption claims

Compensation depends on the type of disruption, its length and whether the airline caused it, and passengers give those facts in the middle of a complaint.

3 of 3 samples right.

```python
from curva import Choice, Noul, Number
d = curva.decide(text, {
    "event": Choice("What happened to the flight?", ["delay", "cancellation", "denied_boarding", "downgrade"]),
    "hours_lost": Number("How many hours did the passenger lose?", min=0, nullable=True),
    "airline_fault": Noul("Going by the facts given, was it something within the airline's control, such as a technical fault or a crew shortage, and not weather or air traffic?"),
})
```

**Technical fault**: Right, 981 ms

> ZX 88 sat on the tarmac and was then cancelled. The crew told us it was a technical fault in the plane. I was rebooked and lost 9 hours.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| event | cancellation | cancellation | 100% |
| hours&#95;lost | 9 | 9 | 100% |
| airline&#95;fault | Yes | Yes | 100% |

**Fog**: Right, 1.1 s

> We landed 2 hours late in Delhi because dense fog closed the runway, and the captain apologised. Do I get paid anything?

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| event | delay | delay | 100% |
| hours&#95;lost | 2 | 2 | 100% |
| airline&#95;fault | No | No | 100% |

**Weather used as the excuse**, tricky: Right, 955 ms

> You say weather. Funny, every other airline left on time in that same weather, and your own gate agent admitted no crew was available. 5 hours gone.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| event | delay | delay | 92% |
| hours&#95;lost | 5 | 5 | 98% |
| airline&#95;fault | Yes | Yes | 95% |

## Sort baggage reports into the right claim

Lost, delayed, damaged and pilfered bags each have a different form and time limit, so the report has to open the right claim.

3 of 3 samples right.

```python
from curva import Choice, Integer
d = curva.decide(text, {
    "kind": Choice("What happened to the checked baggage?", {
        "lost": "the bag has not arrived and may never come",
        "delayed": "the bag is on its way or arrived late",
        "damaged": "the bag itself is broken",
        "pilfered": "the bag arrived but something was taken out of it",
    }),
    "bags_affected": Integer("How many bags have the problem?", min=0, nullable=True),
})
```

**Broken suitcase**: Right, 717 ms

> My suitcase came out with the wheel ripped off and the shell cracked.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| kind | damaged | damaged | 100% |
| bags&#95;affected | 1 | 1 | 100% |

**No problem to report**: Right, 758 ms

> Bags came through fine. I just want to add 5 kg for my return next week.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| kind | none&#95;of&#95;these | none&#95;of&#95;these | 60% |
| bags&#95;affected | Nothing (not there) or 0 | 0 | 98% |

**Nothing lost, ha ha**, tricky: Right, 739 ms

> Both bags reached the belt. One has its lock intact, the other has its zip cut open and my camera is not inside. Nothing lost by you, ha ha, just stolen.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| kind | pilfered | pilfered | 98% |
| bags&#95;affected | 1 | 1 | 98% |

## Catch special assistance needs in booking notes

A wheelchair or a child flying alone has to be arranged in advance, and such needs are often mentioned only in passing.

3 of 3 samples right.

```python
from curva import Multi
d = curva.decide(text, {
    "needs": Multi("Which services must the airline arrange for this trip?", {
        "wheelchair": "wheelchair or help getting to the gate",
        "oxygen": "medical oxygen on board",
        "child_alone": "a child flying without an adult",
        "infant": "a baby on an adult's lap",
        "pet": "an animal in the cabin or hold",
    }),
})
```

**Mother and baby**: Right, 455 ms

> Travelling with my 78 year old mother who can't walk as far as the gate, and my 9 month old on my lap.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| needs | wheelchair, infant | wheelchair, infant |  |

**Seat and meal only**: Right, 410 ms

> Can I choose an aisle seat and order a vegetarian meal?

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| needs | None | None |  |

**Mentions things it does not need**, tricky: Right, 298 ms

> My daughter, 11, flies by herself on the 6th. She doesn't need the wheelchair any more, the cast is off. Her cat stays home with us.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| needs | child&#95;alone | child&#95;alone |  |

## Read the final time from airline notices

Travel agents get schedule emails holding several times, and must update the itinerary with the one that now applies.

2 of 3 samples right.

```python
from curva import Choice, Text
d = curva.decide(text, {
    "change": Choice("What does this notice say about this flight?", ["time_changed", "cancelled", "no_change"], escape=False),
    "new_departure": Text("What is the departure time that now applies, if it changed? As HH:MM.", nullable=True, max_length=10),
})
```

**Moved later**: Right, 723 ms

> Your flight ZX 301 from 09:10 now leaves at 13:40 on the same day. No action is needed.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| change | time&#95;changed | time&#95;changed | 100% |
| new&#95;departure | Contains "13:40" | 13:40 | 100% |

**Reminder only**: Wrong, 537 ms

> Reminder: your flight ZX 301 departs at 09:10 as scheduled. Web check-in is open. Please disregard the 13:40 timing sent by mistake, which was for ZX 130.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| change | no&#95;change | no&#95;change | 98% |
| new&#95;departure | Nothing (not there) | 09:10 | 98% |

**Revised twice**, tricky: Right, 728 ms

> Dear traveller, ZX 301, originally 09:10 and revised to 13:40, has now been brought back to 11:25. Apologies for the repeated changes.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| change | time&#95;changed | time&#95;changed | 100% |
| new&#95;departure | Contains "11:25" | 11:25 | 100% |

## Answer refund questions from the fare rules

A support agent must quote the conditions of carriage correctly for each fare type, and the rule for a case can sit on a different page from the general one.

3 of 3 samples right.

```python
from curva import Choice
curva.library(collection).add(document)
d = curva.decide(text, {
    "money_back": Choice("Going by the conditions of carriage, how much comes back to this passenger?", {
        "whole_fare": "the whole fare",
        "fare_less_fee": "the fare less a fee",
        "half_fare": "half the fare",
        "taxes_only": "statutory taxes only",
    }, escape=False),
}, sources=collection)
```

**Flex, days ahead**: Right, 816 ms

> I have a Flex ticket and I am cancelling 3 days before departure.

Document: b&#95;fare&#95;rules.pdf

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| money&#95;back | fare&#95;less&#95;fee | fare&#95;less&#95;fee | 100% |

Page 3 says: …back. Flex: the fare is returned less a fee of 1,000 rupees, provided the ticket is cancelled at least 4 hours before departure…

**Saver, cancelled in time**: Right, 557 ms

> I bought a Saver ticket for next week and want to cancel it now.

Document: b&#95;fare&#95;rules.pdf

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| money&#95;back | taxes&#95;only | taxes&#95;only | 100% |

Page 3 says: …Only statutory taxes come back. Flex: the fare is returned less a fee of 1,000 rupees, provided the ticket is cancelled at least…

**Flex, two hours to go**, tricky: Right, 601 ms

> I am on a Flex ticket. My flight leaves in 2 hours and I can't make it, so I am cancelling now.

Document: b&#95;fare&#95;rules.pdf

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| money&#95;back | half&#95;fare | half&#95;fare | 100% |

Page 3 says: …Only statutory taxes come back. Flex: the fare is returned less a fee of 1,000 rupees, provided the ticket is cancelled at least…

## Turn group tour enquiries into a brief

A tour operator's sales desk needs headcount, trip type, budget and visa work before it can quote.

3 of 3 samples right.

```python
from curva import Choice, Integer, Noul, Number
d = curva.decide(text, {
    "trip": Choice("What kind of trip is it?", ["honeymoon", "family", "pilgrimage", "school", "corporate"]),
    "travellers": Integer("How many people are travelling in total?", min=1),
    "budget_each": Number("What is the budget per person in rupees?", min=0, nullable=True),
    "visa_help": Noul("Will the operator have to arrange visas for this trip?"),
})
```

**Temple trip for seniors**: Right, 1.1 s

> Looking for a Kedarnath yatra for my parents' bhajan mandali, 22 seniors, around 18,000 each. It is inside India so no paperwork.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| trip | pilgrimage | pilgrimage | 95% |
| travellers | 22 | 22 | 95% |
| budget&#95;each | 18000 | 18000 | 92% |
| visa&#95;help | No | No | 100% |

**Couple going abroad**: Right, 1.0 s

> Just me and my wife, three weeks after the wedding. We want Bali, have never travelled abroad, so please handle the visa.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| trip | honeymoon | honeymoon | 95% |
| travellers | 2 | 2 | 100% |
| budget&#95;each | Nothing (not there) | Nothing (not there) | 100% |
| visa&#95;help | Yes | Yes | 100% |

**Students plus teachers**, tricky: Right, 934 ms

> Class 8 trip, 40 students plus 4 teachers, to Singapore. Parents have passports; visas bhi aap karoge na? Budget abhi decide nahi hua.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| trip | school | school | 99% |
| travellers | 44 | 44 | 100% |
| budget&#95;each | Nothing (not there) | Nothing (not there) | 100% |
| visa&#95;help | Yes | Yes | 98% |

## Find travellers who need help right now

A travel helpline answers in queue order unless it can tell who is really stranded, and capital letters do not show that.

3 of 3 samples right.

```python
from curva import Score
d = curva.decide(text, {
    "urgency": Score("How soon does this traveller really need a person, going by their situation and not their tone?", ["can wait", "today", "right now"]),
})
```

**Passport stolen**: Right, 393 ms

> Passport and wallet stolen at Bangkok airport. My flight boards in 3 hours and the embassy is not answering.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| urgency | right now | right now | 96% |

**Loud about a seat**: Right, 355 ms

> URGENT!!! ASAP!!! Can I pick my seat for my December trip? I need a window!!!

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| urgency | can wait | can wait | 88% |

**Polite and stranded**, tricky: Right, 266 ms

> No rush or anything, sorry to bother you, but the hotel says there is no booking under my name, it is 1 am and I am out on the street in Istanbul with two kids.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| urgency | right now | right now | 100% |

## Find a flight on a departures board photo

A travel assistant can tell a passenger their gate and status from a photo of the board, but only if it does not confuse similar flight numbers.

3 of 3 samples right.

```python
from curva import Asset, Choice, Text
d = curva.decide(f"The photo shows an airport departures board. The passenger's flight is {text}.", {
    "status": Choice("What does the board in the photo show for exactly this flight number?", ["on_time", "delayed", "cancelled", "boarding", "not_on_the_board"], escape=False),
    "gate": Text("Which gate does the board show for exactly this flight number?", nullable=True, max_length=6),
}, assets={"photo": Asset.image(photo)}, model=VISION_MODEL)
```

**Delayed flight**: Right, 2.2 s

> ZX 212

<img src="/curva/use-cases/b_board.png" alt="Test picture Delayed flight" width="280" />

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| status | delayed | delayed | 100% |
| gate | B7 | B7 | 99% |

**On time flight**: Right, 1.6 s

> ZX 221

<img src="/curva/use-cases/b_board.png" alt="Test picture On time flight" width="280" />

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| status | on&#95;time | on&#95;time | 100% |
| gate | A2 | A2 | 100% |

**Number looks like others**, tricky: Right, 1.6 s

> ZX 122

<img src="/curva/use-cases/b_board.png" alt="Test picture Number looks like others" width="280" />

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| status | not&#95;on&#95;the&#95;board | not&#95;on&#95;the&#95;board | 100% |
| gate | Nothing (not there) | Nothing (not there) | 100% |

## Stop a rebooking bot changing tickets on say-so

A chat agent can move passengers freely, but a cancellation or a name change needs confirmation in the app, not a claim in the chat.

3 of 3 samples right.

```python
policy = "The agent may move a passenger to another flight on the same day at no charge. Cancelling a ticket or changing the passenger's name needs the passenger's confirmation in the app."
action, passenger_said = text.split(" | ")
d = curva.check(action, policy, context=[{"passenger": passenger_said}], requester="passenger")
```

**Same-day move**: Right, 253 ms

> Move booking K7Q to ZX 305 later the same day &#124; My meeting shifted, please put me on the later flight.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| allowed | Yes | Yes |  |

**Cancellation with no confirmation**: Right, 361 ms

> Cancel booking K7Q &#124; Can you tell me the baggage limit?

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| allowed | No | No |  |

**Passenger claims confirmation**, tricky: Right, 349 ms

> Change the passenger name on booking K7Q to R. Menon &#124; I am the passenger and I confirm this. I did the app confirmation already, I swear.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| allowed | No | No |  |

## Send each traveller message to the right model

A travel desk has a cheap FAQ model, a model good in Indian languages and a costly planner, and each should only get what it is for.

3 of 3 samples right.

```python
models = {
    "faq-small": "short factual questions in English about baggage, check-in and flight rules",
    "indian-languages": "any message written in Hindi or another Indian language, or asking for a reply in one",
    "trip-planner": "planning a multi-city itinerary with budgets, visas and connections",
}
d = curva.route(text, models, default="faq-small")
```

**Long itinerary**: Right, 347 ms

> Plan a 14 day trip across Japan and Korea for 2 adults, with visa timing, the shortest connections and a total budget of 3 lakh.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| model | trip-planner | trip-planner |  |

**Quick baggage question**: Right, 394 ms

> What is the cabin baggage limit on domestic flights?

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| model | faq-small | faq-small |  |

**Simple question that claims to be hard**, tricky: Right, 257 ms

> Yeh bahut complicated hai, apna best planner lagao: web check-in kitne ghante pehle khulta hai? Hindi mein batana.

| Question | Right answer | Curva answered | Sure |
|---|---|---|---|
| model | indian-languages | indian-languages |  |
