Developer ‘Tiqs & Tricks
December 2023
Generative AI & Collaborations
Here’s a simple use case that monitors pressure sensors to detect possible chemical leaks. When any tank shows a pressure drop below a certain level, an alert comes up on the dashboard, and the AI offers advice on how to proceed. The human and the AI can continue to interact, while the system continues to monitor tank pressure, sending another alert if the pressure returns to safe levels.
![](https://community.vantiq.com/wp-content/uploads/2023/12/Picture1.png)
In a typical trial run, here was a conversation that took place between the system, generative AI and human:
System: Tank D pressure is dropping.
AI: Tank D dropping could indicate a drop in pressure, which may lead to a leak. Workers should be instructed to wear Level B protective gear to visually confirm the leak.
Human: Tank leakage confirmed. What do I do now?
AI: Immediately instruct workers to wear Level B protective gear and take necessary precautions to contain and clean up the leaked sulfuric acid. Report the tank leakage to the appropriate agencies as required by the specific laws and regulations mentioned in the context.
Human: Which agencies should I contact?
AI: The agencies that should be contacted are: 1. The Local Emergency Response Agency (9-1-1 or local Fire Department) 2. The Local Unified Program Agency (UPA), if different from the local fire department 3. The California Governor’s Office of Emergency Services, California State Warning Center 4. The California Highway Patrol (if spills occur on highways in the State of California) 5. The federal Emergency Planning and Community Right-to-Know Act hotline.
Human: What chemical is in the tank?
AI: The chemical in the tank is sulfuric acid (H2SO4).
Notice that throughout the conversation, the AI is aware of the following:
- The situation at hand
- The entire conversational context
- Chemical spill policy for the State of California
- Specifics on sulfuric acid chemical behavior
- Health risks associated with sulfuric acid spills
In this month’s ‘Tiq’s & Tricks, we’re going to focus on how to achieve the first two bullet points through the use of a Collaboration.
Just what is a Collaboration in Vantiq? So glad you asked. Let’s define our terms first:
Situation: Something that requires a Vantiq application to interact with an outside entity
Role: Parts played in the Situation. These are:
- Entities – the object(s) that are the subject of the situation
- Collaborators – the actor(s) who will coordinate to resolve the situation
Conversation: Context-kept, unique conversation within a collaboration, between AI and a Collaborator
Now let’s fill in the blanks for our particular use case:
Situation: Dropping pressure in a chemical tank. The Vantiq system needs outside entities to verify and fix related issues.
Entity: The tank
Collaborators: The Vantiq system, the AI, the human at the dashboard. Of these, only the human needs to be counted; the other two collaborators are already assumed, being Vantiq-based
To identify the Entity and Collaborators in the Service, click on the Service Properties button at the top right of the App pane:
![](https://community.vantiq.com/wp-content/uploads/2023/12/Picture3.png)
![](https://community.vantiq.com/wp-content/uploads/2023/12/Picture4-1024x433.png)
Collaborator Roles and Named Conversations just want something to call them by, like “tech” and “issue” respectively. Entities are defined by the event types associated with them. In our case, we’ll use the Sensor event associated with the tank.
Our application starts off normally enough, taking in sensor information, splitting the events to correspond to their separate tanks, sending the readings to the dashboard. We employ a Threshold to detect both conditions of interest to us: Does a tank’s pressure drop to below 85, or does it rise from below 85 to above 85?
![](https://community.vantiq.com/wp-content/uploads/2023/12/Picture5.png)
If the pressure’s dropping, it’s time to get the Collaboration (and the AI) involved, so we send it to a new Service event handler called “ConvoInput.”
Within Service Event Handlers (aka Apps), there are several Collaboration Activity Patterns. We’re using three of them in our ConvoInput App:
![](https://community.vantiq.com/wp-content/uploads/2023/12/Picture6.png)
![](https://community.vantiq.com/wp-content/uploads/2023/12/Picture7.png)
The tasks called “ContinueCollaboration, CollabCompleter and StartCollaboration” are all from the EstablishCollaboration pattern. When the system first detects a
pressure drop, it sends a message to ConvoInput, which starts a new Collaboration, and engages the generative AI (GiveAdvice), sending that output to the dashboard. The Collaboration is now open and active. When the human types in a question, “ContinueCollabora.on” knows not to start a new Collaboration, based on the common entity role, in this case, the leaking tank:
![](https://community.vantiq.com/wp-content/uploads/2023/12/Picture8.png)
The task “CollabCompleter” does the same thing, making sure the Collaboration is the correct one, before the “CloseCollabora.on” task, based on the CollaborationStatus pattern, marks the status of the Collabora.on as “complete,” closing it.
So, when are we going to cover conversation memory management for the AI? Well, we just did. That’s the beauty of Collaborations. By giving the conversation a name, the Collaboration kept it in order, in state and accessible to the AI, without any extra work for the developer.
Are there ways to manage conversations without Collaborations? Oh, yes, and that will be the subject of an upcoming blog, too. Until next year, enjoy building situationally aware, contextually relevant and automated application systems in Vantiq, especially with the ease and convenience that Collaborations provide.
Happy Holidays!
Attachments:
You must be
logged in to view attached files.
Developer ‘Tiqs & Tricks
December 2023
Generative AI & Collaborations
Here’s a simple use case that monitors pressure sensors to detect possible chemical leaks. When any tank shows a pressure drop below a certain level, an alert comes up on the dashboard, and the AI offers advice on how to proceed. The human and the AI can continue to interact, while the system continues to monitor tank pressure, sending another alert if the pressure returns to safe levels.
In a typical trial run, here was a conversation that took place between the system, generative AI and human:
System: Tank D pressure is dropping.
AI: Tank D dropping could indicate a drop in pressure, which may lead to a leak. Workers should be instructed to wear Level B protective gear to visually confirm the leak.
Human: Tank leakage confirmed. What do I do now?
AI: Immediately instruct workers to wear Level B protective gear and take necessary precautions to contain and clean up the leaked sulfuric acid. Report the tank leakage to the appropriate agencies as required by the specific laws and regulations mentioned in the context.
Human: Which agencies should I contact?
AI: The agencies that should be contacted are: 1. The Local Emergency Response Agency (9-1-1 or local Fire Department) 2. The Local Unified Program Agency (UPA), if different from the local fire department 3. The California Governor’s Office of Emergency Services, California State Warning Center 4. The California Highway Patrol (if spills occur on highways in the State of California) 5. The federal Emergency Planning and Community Right-to-Know Act hotline.
Human: What chemical is in the tank?
AI: The chemical in the tank is sulfuric acid (H2SO4).
Notice that throughout the conversation, the AI is aware of the following:
In this month’s ‘Tiq’s & Tricks, we’re going to focus on how to achieve the first two bullet points through the use of a Collaboration.
Just what is a Collaboration in Vantiq? So glad you asked. Let’s define our terms first:
Situation: Something that requires a Vantiq application to interact with an outside entity
Role: Parts played in the Situation. These are:
Conversation: Context-kept, unique conversation within a collaboration, between AI and a Collaborator
Now let’s fill in the blanks for our particular use case:
Situation: Dropping pressure in a chemical tank. The Vantiq system needs outside entities to verify and fix related issues.
Entity: The tank
Collaborators: The Vantiq system, the AI, the human at the dashboard. Of these, only the human needs to be counted; the other two collaborators are already assumed, being Vantiq-based
To identify the Entity and Collaborators in the Service, click on the Service Properties button at the top right of the App pane:
Collaborator Roles and Named Conversations just want something to call them by, like “tech” and “issue” respectively. Entities are defined by the event types associated with them. In our case, we’ll use the Sensor event associated with the tank.
Our application starts off normally enough, taking in sensor information, splitting the events to correspond to their separate tanks, sending the readings to the dashboard. We employ a Threshold to detect both conditions of interest to us: Does a tank’s pressure drop to below 85, or does it rise from below 85 to above 85?
If the pressure’s dropping, it’s time to get the Collaboration (and the AI) involved, so we send it to a new Service event handler called “ConvoInput.”
Within Service Event Handlers (aka Apps), there are several Collaboration Activity Patterns. We’re using three of them in our ConvoInput App:
The tasks called “ContinueCollaboration, CollabCompleter and StartCollaboration” are all from the EstablishCollaboration pattern. When the system first detects a
pressure drop, it sends a message to ConvoInput, which starts a new Collaboration, and engages the generative AI (GiveAdvice), sending that output to the dashboard. The Collaboration is now open and active. When the human types in a question, “ContinueCollabora.on” knows not to start a new Collaboration, based on the common entity role, in this case, the leaking tank:
The task “CollabCompleter” does the same thing, making sure the Collaboration is the correct one, before the “CloseCollabora.on” task, based on the CollaborationStatus pattern, marks the status of the Collabora.on as “complete,” closing it.
So, when are we going to cover conversation memory management for the AI? Well, we just did. That’s the beauty of Collaborations. By giving the conversation a name, the Collaboration kept it in order, in state and accessible to the AI, without any extra work for the developer.
Are there ways to manage conversations without Collaborations? Oh, yes, and that will be the subject of an upcoming blog, too. Until next year, enjoy building situationally aware, contextually relevant and automated application systems in Vantiq, especially with the ease and convenience that Collaborations provide.
Happy Holidays!
Attachments:
You must be logged in to view attached files.