AI Tourist Guide
Ask any smolLM about parks in New York City, and you'll likely get a good answer. Ask the same thing about your current location, or ask about something more specific, and the chances are your smolLM starts confabulating widely. Retrieval Augmented Generation helps reduce the hallucinations.
How the Tourist Guide Works
Getting the current location, prompting the user to specify a topic or subject of interest, this Shortcut fetches information from WikiVoyage to improve the chances of a good response.
- Get current location fetches just that, allowing the user to change the response if needed.
- Next, the subject of interest is prompted for with Ask for.
- When run on macOS, Get contents of together with Make rich text from and Get text from is used to query WikiVoyage.
- When run on iPadOS or iOS, Get article from together with Get Body from and Get text from is used for the same.
- The response is cleaned up by ugly regular expressions.
- The cleaned up response is added to the prompt, 12288 characters for macOS and 6144 for iPadOS and iOS.
- The system prompt defines the query as What:, Where: and Background: encapsulated with equal signs, the latter being the cleaned and shortened WikiVoyage response.
- The Shortcut ends with Start a new chat with Private LLM.
Customizing (Prompt Engineering)
Depending on how much memory your device has, and which LLM you are using, it's possible to tweak the number of characters fed into the prompt. I partly wrote this to break things, but the current settings work for most combinations of devices and LLMs. If you're using one of the 32k token LLMs on a device that can handle it, you could just remove the Match action that restricts the WikiVoyage content to 12288/6144.
Key Features
- Allows the user to quickly ask Private LLM about local information, as well as for any location of choice.
- Uses RAG to improve the response with WikiVoyage content.
- Simple formatting to help smolLMs parse the prompt better.
Use Cases
- Getting information about your location.
- Getting information for an upcoming trip to any location.
- Breaking things with too large prompts.
Benefits
- Hopefully gives you actual real information, instead of lies.
- https://blogs.nvidia.com/blog/what-is-retrieval-augmented-generation/
- Retrieval-Augmented Generation for AI-Generated Content: A Survey
Getting started with the Tourist Guide
Start the Shortcut, accept or change the Where:, supply a topic or subject of interest for What:, wait for the response... done! On iPadOS and iOS, it's possible to ask follow-up questions as well.
Important Note: This reduces, not removes, hallucinations.