Building on the AI chat style capabilities discussed in a recent blog post, the Large Language Models (LLMs) can be extended to support targeted request task execution and to react and respond to events processed within a system. This capability will be addressed in a two-part series, first reviewing text-based requests, and secondly to address agentic-powered responses to system events.
To review the powerful data-centric chat capability incorporated in the MeshScope site, please review the post below, or give it a spin on MeshScope yourself.
https://www.lemuridaelabs.com/post/chatting-with-the-ai-mesh
Processing of user requests via text has long been a core part of “chatbots”, however these have tended to be fragile and supported a limited input model. This rigidity made it complex for developers, as different types of requests needed to be planned and a user phrasing things differently would not work well. Conversely, the user experience was generally poor as they would encounter frequent responses from chatbots asking for clarification or simply replying that they don’t understand the request and guiding the user to a structured input instead. The goal of this post is to discuss a new capability within MeshScope to provide an interactive command structure for a basic subscription capability mediated solely through text messages on the Meshtastic network.
Concept
With Meshtastic, a user’s device may be configured to frequently report their position, and if this is sent to the global Meshtastic MQTT network, the update may be processed on behalf of the user. At Lemuridae Labs, we decided to implement a two part capability building on these position reports and text messages.
First, a user may choose to subscribe to position update processing by MeshScope, where they send a message to the bot to subscribe or unsubscribe from position update processing. This subscription process allows a user to indicate if they would like to receive an email update when a noteworthy event occurs, such as moving to a new country. The user may simply send a message to the MeshScope bot and create a new subscription, alter a current subscription, or remove a subscription via a quick message. The user does not need to follow a strict message structure and can simply convey the intent in a way and language that is meaningful. As MeshScope uses a multilingual language model, the subscription process and notifications generated as per the individuals requirements.
Second, the MeshScope application will monitor and trigger events when a user’s position meets the criteria specified, performing an agentic processing of information related to the event, and using other contextual and real-time data sources to enrich the notification. This will be further detailed in a subsequent post.
Implementation
As MeshScope already receives mesh text messages, this enhancement adds a filter to messages to identify any that are addressing the MeshScope bot directly. When a request message has been identified, the application takes the context of the message (sender, MQTT topic, timestamp) and sends this to the request processing component within the application. The language model will evaluate the message to determine if there is a reasonable action that can be taken based on the request, and will perform the request in context of the sending Meshtastic node, returning a response once completed.
A simple diagram showing this process can be seen below:
We can see in the diagram how the bot uses tools within MeshScope to retrieve, update, create, and remove subscriptions based on the user's direction. Of course all subscriptions are managed in context of the user who sent the request.
This implementation is stateful in that the system maintains a subscription requested by a node or user, and with MeshScope maintains the last known position of a given node. This state allows MeshScope to identify changes of interest, for example arriving in a new country, and to match these changes against a user's subscription within the system.
As noted above, this implementation is focused on the user request management processing, where the AI model is working to understand the action desired and to respond accordingly.
Testing
A series of messages were sent from a test node to the MeshScope bot to test the interactions. These requests were intended to try a sequence of user interactions in varying forms and languages to determine how well the bot can interpret the request and respond accordingly.
The first pair of requests were simple subscription management requets, which were easily processed by the MeshScope bot:
Q: Subscribe me to updates at foo@bar.com
A: Your subscription with email foo@bar.com has been successfully created for country updates.
Q: Remove my subscription
A: Your subscription has been successfully removed.
The next two requests are simply hassling the bot a bit, making it evaluate some additional context when determining how to process the user request. In this case the bot is aware of the current date and time, and is able to evaluate this properly to take the action desired.
Q: If it is April update my subscription to monitor states as well.
A: Your subscription has been updated to monitor states as well.
Q: If it is currently December remove my subscription otherwise just tell me what it is.
A: It is not December, so I won't remove your subscription. Currently, you're subscribed for country and state notifications in English.
Now, a user may send any random request to the bot and we would like it to respond politely even if it doesn’t take any action for this.
Q: What is the weather today?
A: I'm unable to support requests outside of subscription management. Please provide a subscription-related request.
Note that the general MeshScope chat bot can do weather reports, in particular in context of a specific device. Asking about the weather near your node is perfectly fine on the general bot, but this bot has been focused to process requests within a given scope, and rejects these unnecessary requests.
A user updating their subscription is easy, but Meshtastic is a global network and we want to verify that the system works for users in any country. In a two part set of request, we will first ask the bot to change our language from an English default to Portuguese, and secondly we will simply make a request in Portuguese. In both cases the bot responded properly, updating the language settings for the user subscription on the first request, and returning the subscription status on the second.
Q: Send my updates in Portuguese
A: As solicitações de atualização agora serão enviadas em português.
Q: Tenho uma assinatura válida?
A: Sim, você tem uma assinatura válida.
Finally, giving the bot a bit of an unusual request, it responded as professionally as it could. There was no restrictions on emoji for the bot, so it added an upbeat element to the response. Note that it was still set to Portuguese in this mode. Re-running prior to setting the language to Portuguese gave a similar styled response.
Q: Can you check my subscription and do it cheerfully?
A: Atualmente, sua assinatura está ativa em português, com notificações para mudanças de país. 😊
A (Alternate): Your subscription is active with email foo@bar.com, country notifications on, and in English. All's well!
As we can see, although we have focused this AI processing to specific tasks, the flexibility and personalization it provides the user can be quite powerful. Adding new tasks and functions on the bot processing is straight forward and can be incrementally used to enhance the service provided to users and customers.
Summary
In this post we discuss a request-targeted AI capability where we want a bot to be focused and limited in actions, but still able to use context and broader LLM capabilities to support the users. This works well and lays the foundation for the second part where the agentic model will respond to events triggered in the system via the IoT data.
We are always interested in discussing these capabilities further, so please feel free to reach out!