Rejseplanen Transit Bot + Jev
A personal Telegram bot that plans trips on Danish public transport, built on n8n and the Rejseplanen REST API. One step now picks the stop you meant: Jev, TypeSafe's System One model, chooses from the real search results and says how sure it is. Same bot, same data, and three wrong trips fixed.
The problem
You type a stop name, Rejseplanen's search returns a ranked list, and the bot took the first result. Usually that is right. But Danish stop names repeat: "Banegården" (Danish for "the station") exists in many towns, and there is a Nørreport in both Copenhagen and Aarhus. For someone in Odense, the first result for Banegården was Ribe, about 100 km away. The bot planned that trip without a warning.
What I changed
- One step in n8n — the same search results now go to Jev. Jev does not write text. It answers one question: which of these options did the person mean, or none of them, with a probability for each.
- Code does the parts that need no AI — up to 12 candidate stops, each labelled with its town and distance from the start. Duplicates are merged, and a name typed exactly right is taken directly without asking Jev.
- Clear rules on top — 70% sure or more: plan the trip. Less: ask "which one?" with the two best options, each showing its town. "None of these" at 30% or more: say the stop was not found instead of guessing.
- A safe fallback — if Jev fails or takes longer than 5 seconds, the bot uses the first search result as before and says so in the reply.
- Minimal data out — only stop names, towns and distances go to TypeSafe. Never coordinates, and never who is asking.
Three tests, recorded
- "Banegården" from Hjallese St. — without Jev: Ribe, 6 h 8 min with 3 changes. With Jev: Odense Banegård, 85% sure (result #4 of 12), 23 min by bus.
- "Nørreport" from Aarhus H — without Jev: Copenhagen, 4 h 23 min away. With Jev: 63% Aarhus, 12% Copenhagen, below the 70% bar, so it asked. One tap later: 11 min by light rail.
- "Aalborg Station" — without Jev: Skalborg, a suburb station. With Jev: 66% "none of these", so it replied that no such stop exists. The real name is Aalborg St.
Each Jev call took about 0.3 seconds. One detail worth noting: a "nearest stop" rule would have picked the street address Banegårdspladsen (4.7 km) over the station itself (4.9 km). Jev picked the station.
Why it matters beyond buses
This is the step many LLM apps skip. Let a language model understand the question, let a real search find the real options, and let something like Jev choose between them with a real confidence score. It cannot pick a stop that is not on the list, and when it is unsure it asks.
Honest limits: these are three recorded tests, not a benchmark, and no language model ran in this demo. It shows Jev's step on its own. The bot is personal and answers only me, so there is no public demo link.