Skip to content

AI assistant

miracle091 edited this page Nov 30, 2026 · 7 revisions

AI assistant

English · Italiano

The assistant answers travel questions with the downloaded guides, using an on-device model or an online service. This page is the overview; the details are in three pages:

  • Context search – how the guide sections are chosen, cities and countries, general guide, climate, distances, emergencies, alerts, forecasts, sources and search measurements.
  • Online engine – services, privacy of the data sent, filter for hidden instructions, errors and quotas, Automatic, streaming, list of online models, online photos.
  • Models and training – on-device models, download, on-device photos, native code, training, GPU, datasets, v11 and v12 models.

How it answers

The assistant does not "know" things by itself. It searches the country guide, the guides of its cities and the personal notes, with a full-text search in the database ordered by relevance. It puts up to 3 sections, plus a note if relevant, in the question to the model. Then it asks the model to answer only with those, in 3 sentences at most, saying clearly when the guide is not enough.

The path of a question, the same for both engines:

flowchart LR
    accTitle: Path of a question to the assistant
    accDescr: The question goes through the full-text search in the country guide, in the city guides and in the notes; up to three sections and one note enter the request to the model, on the device or online; the answer shows the sources used.
    q["Question"] --> search["Full-text search<br/>guides and notes"]
    search --> ctx["Up to 3 sections<br/>and one note"]
    ctx --> local["On-device model"]
    ctx --> online["Online service<br/>with the user's key"]
    local --> ans["Answer with sources"]
    online --> ans
Loading

The context is chosen by full-text search: no vectors, no server. The search rules and the measurements that justify them are in Context search.

Two engines

  • On device: a model downloaded to the device, which works offline. The models are Qwen in GGUF format, run by llama.cpp, one per RAM tier (see Models and training).
  • Online: a personal API key of the user. Questions go directly to the chosen service, never to a project server (see Online engine).
Online AI assistant: choice of the service, with the services grouped by what they do with the questions (here the group "Questions not kept") and the automatic model of each

Setup and the AI tab

Settings

The assistant is configured in More → Settings → AI assistant. There the user chooses the engine, the models to download or delete, or the service, API key and online model. Only the engines that the device can handle appear: below 3 GB of RAM only Online. Settings use the same logic as the chat (the same ViewModel): outside a region the configuration works, and the region matters only when a question is asked.

When the AI tab appears

The AI tab in the region page appears only when the assistant is usable (AiAvailability). It needs a saved API key, or at least one downloaded model among those visible for the device's RAM and the language of the guides. A model trained in Italian, with the guides in English, does not count.

Users who have configured nothing do not see an empty tab. The summary at first start says where to turn the assistant on, and the first time the tab is opened a hint explains the two engines. The state is recalculated at once when the key is saved or removed, when a model is downloaded or deleted and when the language changes. If the AI tab was open and the assistant is no longer available, the app goes back to the Guide tab.

Engine selector and menu

The AI tab keeps the engine selector and the ⋯ menu (More actions). The menu has the deletion of the model or of the key and "New conversation". In debug builds it also has speed measurement, model comparison and the model diagnostics (see Models and training, "Debug build tools").

Two intermediate cases have a dedicated card:

  • key saved, but "On device" engine without a model: the tab is there thanks to the key, so it offers "Use online" or "Remove key" (if it has expired);
  • a model other than the chosen one downloaded: it offers "Use " or "Download ".

Answer generated by an AI model

Under every answer, even while it arrives, a line says "Generated by an AI model", with the name of the model. Tapping the name opens the model page:

  • for the Official models, the author's page (Qwen) on Hugging Face, not the Unsloth repository from which the file is downloaded;
  • for the models trained on the guides, the pockettravel page on Hugging Face;
  • for the online models, the service's models page.

The empty screen of the assistant also says that the answers are generated by an AI model. Article 50 of the European regulation on artificial intelligence (AI Act) requires telling the people who use the app that they are talking to an AI system and marking the texts it generates.

Sources under the answer

Under the answer the sources take a single closed row: "Sources", with the number of the cited sources in parentheses. Tapping it opens the complete list, with the guide section and the address of the page. Always open, the list would often take more space than the answer.

Conversations and history

The previous turns of the open conversation stay visible above the last one. "New conversation" in the ⋯ menu (More actions) starts a new one. A follow-up question is merged with the previous one, because the catalog models answer one turn at a time (see Context search, "Follow-up question"). The state of the conversation (region, city, destination, last question) is derived from the turns and restored on resume.

Only with the "On device" engine is each conversation saved in the history, in the conversations and conversation_turns tables (the encryption is in Privacy and security). With the "Online" engine nothing is saved.

The icon in the assistant header opens the history and always asks for the fingerprint or face. The list shows title (the first question), region and date. Tapping a conversation brings the turns back on the screen, and the next question continues it, even after the app restarts, in the region of the conversation. If the region is no longer installed the conversation opens read-only: a notice in place of the question field says so and offers "New conversation".

At the top of the list, "Search the conversations" finds the conversations that contain all the words typed, each one as the start of a word ("ski win" finds "Where can I ski in winter?"), ignoring accents and capitals. The words must be in the same text: one answer, the title or one question; sources are not searched. Conversations found in an answer come first, then those found in the title or a question; within each group, those with more words found first, then the most recent. Each conversation appears once, with a line saying where the words are ("In the answer", "In the title", "In the question") and a piece of the text of about 40 characters on each side with the words highlighted; tapping it reopens it as from the list. With no conversation found, "No results" appears; if the search fails (conversations that cannot be read), "Search failed" appears, with a prompt to try again.

Each conversation is deleted from its ⋮ menu (More actions). The whole history is deleted from More → Settings → AI assistant ("History: N conversations", "Delete the history"), with confirmation and without an unlock. Conversations unused for 30 days, counted from the last turn, are deleted at app start.

Without strong biometrics configured nothing is saved, and the history explains it. If the biometrics change (fingerprint added or removed) the history is no longer readable and can only be deleted.

Measurements on the emulator (ConversationHistoryDeviceTest): about 10 KB for a conversation of 6 turns, about 0.5 s to open a list of 500 conversations. With the search, on the same 500 conversations all found: about 1 s for the first search after unlocking, which decrypts the turns, and about 50 ms for later searches, which read again only the conversations that changed.

Suggested questions

Under the last finished answer up to three questions to tap appear, one for each topic that the guide of the place has and the answer did not cite: how to get around, where to stay, where to eat, what to see, culture and etiquette, safety. An example is "Florence: where can I eat?". The place is the first city named, otherwise the country.

The questions come from fixed templates in strings.xml (suggestedQuestions in SuggestedQuestionTopic.kt), without generating tokens, so they apply to both engines. They do not appear with a selected text or for the question just asked. A tapped question is sent like a typed one. The topics are saved in the history turn (optional field of the encrypted JSON, no migration) and come back on resume. Conversations saved before this field do not have them.

Dictated question

The microphone in the field ("Dictate the question") uses on-device voice recognition (SpeechRecognizer.createOnDeviceSpeechRecognizer in VoiceInput.kt), from Android 12, with both engines. The microphone appears only if isOnDeviceRecognitionAvailable is true. The recognized text is added to the field and sent by hand.

The RECORD_AUDIO permission is requested at the first tap. If it is denied with "Don't ask again", "Settings" appears next to the message under the field and opens the app page. If the language pack is missing, from Android 13 the phone offers the download in its own window.

The accessibility choices of the dictated question are in Accessibility and voice.

Question length

The question has 300 characters at most (MAX_QUESTION_CHARS), typed, pasted or dictated. The rest is cut without splitting an emoji. From 250 characters the count appears under the field ("280/300"). In the v11 dataset the questions have a median of 39 characters and at most 165. The limit leaves room for long questions and keeps the prompt within the 4096-token context of the on-device model.

Reading aloud

"Listen" under every answer reads it with the device's system voice (ReadAloud, implemented by SystemReadAloud with TextToSpeech, in the core:speech module), in the language of the guides, with both engines. One answer at a time: "Stop", a new question, the microphone or leaving the screen interrupt it.

The Online voices for Listen option (Settings) is off at first. When it is off, the app chooses only voices installed on the device, so the reading works without a connection and the text stays on the phone (VoiceSelection). Each voice is tried first with a syllable, from the best, and the first one that speaks is used, because a voice reported as installed may fail to open. When it is on, the speech engine chooses the voice; if the voice is online, it receives the text of the answer.

speechChunks removes the signs that the voice would pronounce (asterisks, heading hashes, list dashes, Markdown links). It puts a period at the end of lines that do not have one, so that the voice pauses between the items of a list. It splits the text between sentences within the engine's limit (getMaxSpeechInputLength).

The manifest of core:speech declares TTS_SERVICE in <queries>: from Android 11, without the declaration, the app does not see the engine. If no installed voice exists for the language, the text under the button says where to add one. If there is only an online voice, it says how to install one or turn the option on. If the speech engine stops halfway, the reading ends with an error.

The same speech synthesis serves the Navigator's voice guidance: see Accessibility and voice.

Ask the assistant from other apps

ProcessTextActivity receives ACTION_PROCESS_TEXT ("Ask the assistant" item in the selection menu) and ACTION_SEND with text/plain (Share). It opens a ModalBottomSheet (SelectedTextSheet) above the starting app, with:

  • the editable text, 1000 characters at most (MAX_SELECTED_TEXT_CHARS);
  • three ready questions ("What does it mean?", "Translate", "Explain"), which send the complete question;
  • the question field.

The sheet uses the chosen engine and the last region opened (RecentRegionStore). Without a ready engine the sheet says so, and "Open Settings" opens MainActivity on Settings.

The selected text is not the question. On the device it becomes the only context (contextWithSelectedText), without guide sections: with the sections the 0.8B answered from the guide, and "Translate" on "pour" became a flight. Online the text goes in the user message before the question, not in the system one, because it comes from another app. The system message has the guide of the last region, without location, vaccinations and note (personalSections). The quotation marks «» in the text are removed.

No request is sent without a tap. Follow-ups are off, questions and answers do not enter the history (onAnswered(save = false)), and "portami a …" stays a question. "Listen" is there and stops on leaving the sheet.

"/model": choosing the model from the conversation

/model (or /modello) in the question field does not go to the model: the app recognizes it (parseModelCommand). Alone, it answers with the model in use and a button for each other choice: Automatic, the other proposed models of the service except those whose daily quota has run out, the on-device model if it is downloaded.

With a name the command chooses the model: /model automatico (also auto, automatic), /model dispositivo (also device, telefono, phone) or the name of a proposed model, ignoring case (matchModelChoice). An unknown name answers with the choices. After the daily quota runs out, /model with a name works like the button: it asks again the question left unanswered.

Without other choices (on-device engine, no API key) the message says that the other models are chosen in More, Settings, AI assistant: /model does not switch from one on-device model to another. Switching from the Online engine to the on-device one, or the reverse, closes the open conversation, as from the settings.

Typing / shows the command menu above the field (commandSuggestions). First it shows the commands that start with what was typed, that is /model. After /model it shows the choices whose name contains the typed text, to pick with a tap.

"Take me to…": navigation from the assistant

Navigation commands

A question that starts with a navigation command does not go to the model: "portami al Colosseo a piedi", "indicazioni per Via Roma 12", "come arrivo all'aeroporto in macchina", "take me to the station by bike", "how do I get to the Louvre". Fixed rules on the device recognize it (parseNavigationRequest). The rules remove the command, the travel mode and the prepositions and articles in front of the destination.

The Navigator opens with the requested travel mode and the destination search already filled in. The user picks the result and presses Start, which acts as confirmation. The command applies with both engines and without a model. With the Online engine the request does not go to the service: destination and location do not leave the device.

Words removed from the destination

The rules also remove the visit verbs ("vedere", "visitare", "see", "visit") and the time of day at the end ("domani mattina", "stasera", "tomorrow morning", "tonight"), only if written in lowercase. With a capital letter they are part of the name ("Bar Stasera", "See Hotel"). The Navigator searches at once for the short destination and meanwhile checks whether the one with the time of day is the name of a place. If it is, and the search has not been changed, it uses that one: "portami al bar stasera" finds Bar Stasera.

The movement verbs ("arrivare", "raggiungere", "reach", "get to") are removed like the visit ones: "Indicazioni per arrivare a Roma" searches for Roma. The rules also recognize "camminando", "con la bici", "con la macchina", "vado a piedi", "I'm walking", "indicazioni stradali" and "subito".

Phrases that stay questions

"Come arrivare a…" and "come si arriva" stay questions for the guide (the "Get in" section of Wikivoyage), not commands.

A condition after the destination also makes the phrase a question: "se", "quando", "perché", "mentre", "if", "when", "because" or "while" in lowercase. This way "Come arrivo in centro se parcheggio al P1" goes to the assistant, instead of making the Navigator search for the place "centro se parcheggio al P1".

The same goes for a starting point in the phrase: "da", "dal", "dalla", "dall'" and the other forms, or "from", in lowercase. "Come arrivo da Barcellona?" and "Come vado dall'aeroporto al centro?" go to the assistant, which answers from the guide's "Getting there" section. With a capital letter "Da" stays in the name ("portami Da Mario").

"Percorso", "naviga", "indicazioni", "route", "directions" and "navigate" are also common words. They count as a command only if, once the travel mode is removed, a destination preposition follows ("percorso a piedi per il Colosseo", "route to Termini"). This way "Percorso consigliato di 3 giorni a Roma?" or "Indicazioni sui vaccini?" stay questions.

After "per", "for" or "to", a verb from a closed list ("ottenere", "prenotare", "get a visa") and a duration ("per 3 giorni", "for 3 days") are not a destination. The list is closed because the infinitive ending is also in place names ("Torre del Greco", "Sestriere").

Grammar tried and rejected

The on-device model was also tried with a GBNF grammar to clean up the destination. GBNF is the grammar format of llama.cpp that forces the model to write only valid text, here JSON (setGrammar in the native code). On 34 test phrases in Italian and English (NavigationGrammarDeviceTest) the model did not do better than the rules alone: 32 out of 34 with the 0.8B model, 31 with the 2B, 32 with the rules. For this reason the assistant uses only the rules. The grammar remains available in the native code.

App in English

With the app in English, instructions to the model, fallback text and citations are in English, and the context comes from the English guides. The catalog knows in which language each model answers (language). In English the list shows only the models with English support: the Official ones and the three English Trained on the guides models (0.8B, 2B and 4B, v12 dataset, on the English guides and on the travel advice of the Government of Canada and the FCDO).

With the app in English the default of each tier is the English trained model, which refuses questions the guide does not answer much more often than the Official model. Users who already downloaded an Official model keep it until they choose the other. The SHA-256 hashes of the English trained models are in the catalog bundled in the APK and in app-status.json (see Publishing).

A model trained in Italian, chosen earlier, does not apply with the app in English. The app uses an already downloaded model suited to the language, otherwise the default of the tier (selectedModelId). The file stays on the device and is deleted from Storage.

The Italian prompt stays identical, character by character, to the one used for training, and a test checks it.

Licenses

The trained weights are CC BY-SA 4.0, because they can repeat sentences from Wikivoyage and Wikipedia. The list of the pages used (ATTRIBUTION.tsv) is published next to each model. The texts of Viaggiare Sicuri (Farnesina) are excluded from the public weights, because their license is not verified.

Known limitations

  • The quality depends on the sections chosen for the context: sometimes the search picks the wrong one and the answer is incomplete.
  • The assistant answers in the language of the app, not in that of the question. With the app in Italian it answers in Italian even to questions in English. The models trained in Italian answer in Italian even with the app in English, and for this reason in English the list does not show them.
  • After a language change, if none of the downloaded models answers in the new language and there is one trained in the other, a sheet (ModelLanguageNoticeHost in app) offers the model trained in the new language. It is of the same size if the device's RAM shows it in the list, otherwise it is the default (LlmModelCatalog.defaultFor). The sheet downloads nothing by itself: "Download" chooses the model and starts the download like the model list. An answer, "Download" or "Not now", applies to that language until the next change.

Clone this wiki locally