This is a step-by-step guide to create a Mall Chat Assistant using Flows in GeneXus Enterprise AI.
This Flow manages multiple assistants, which are specialized in different areas such as querying store catalogs, booking movie tickets, and orchestrating conversations. The steps required to set up and test this assistant are described below.
To get started, first make sure you have access to the Globant Enterprise AI Backoffice and are familiar with the interface for creating Flows. This environment will allow you to create, manage, and orchestrate the various assistants that make up the Mall Chat Assistant.
This RAG Assistant is designed to provide information about the stores in the mall. The objective is to allow end users to check the availability of products or services in the different stores of the mall.
The assistant is configured to answer questions related to the location, products and opening hours of the stores. It uses a simple JSON document containing the store name and a short description.
This API Assistant allows users to search the movie listings available in the mall and book tickets.
It is based on the integration with an API that simulates the availability of movies in a movie theater. This assistant must be able to handle questions about schedules and reservations.
This Chat Assistant manages and redirects conversations to the appropriate assistant. The orchestrator is responsible for understanding the end user's intent and redirecting the conversation accordingly.
It uses a system of predefined prompts to redirect queries to the corresponding assistant. The orchestrator keeps the context of the conversation, so the interaction is fluid and coherent.
It defines variables such as user name and date.
Orchestrator Mall Assistant Prompt:
Assistant is a large language model.
Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.
Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions.
Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.
Overall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.
Assistant is a helpful Mall Customer Service agent; you are kind but you always follow the rules.
CONVERSATION CONTEXT
----------------------------------------
The user name is: {name}
Today is: {today}
OTHER ASSISTANTS
-----------------------------
Assistant can ask the user to use other Assistants to look up information that may be helpful in answering the user’s original question. The other Assistants the human can ask are:
> Mall Shops Catalog: This Assistant provides information about shops inside the mall.
> Movie Ticket Assistant: This assistant provides information about the movie theater inside the mall.
RESPONSE FORMAT
-----------------------------
When responding to me, if you want the human to ask another Assistant JUST ANSWER WITH THE ASSISTANT NAME AND NOTHING ELSE.
For any other response, you can create an HTML fragment with RICH TEXT if it's needed.
Follow the steps described in How to create a Flow to create the Flow called Mall Chat Assistant with the following structure:
To add variables to the Flow, click on the Variable option in the LOGICAL section of the Flows Menu. Next, drag the component below the User input node into the flow. In this case, a variable has been added: today.
Today variable:
It is defined by clicking on the down arrow inside the variables node and selecting the option + Add new variable.
Next, enter the name today and press Enter.
Deactivate the Clear option.
To set the value of this variable, click on the edit icon to the right of the node. In the left menu, click on the Open in new window icon, and in the window that opens (Value) add $today.
Every user query must be evaluated to determine which assistant is the most appropriate to answer. This is implemented with IF conditions in the flow, where the user's intentions are compared with the available assistants.
To add the Conditional component, go to the Interactions section and, below LOGICAL in the Flow menu, drag the component and drop it between the Assistant and Go to nodes.
Dragging the Conditional node generates a branch with two paths: one labeled If and one labeled Else. This structure allows you to evaluate a condition and direct the flow according to the result. To add an additional condition, click on the Add condition option to the right of the first node of the branch:
After clicking on Add condition in the first node of the branch, an additional node of Expression type is added, just like the first one. These Expression nodes allow evaluating different conditional expressions.
To add the variable to be evaluated, click on the word Variable, located at the bottom of each node.
In the first two nodes of Expression type, you can see how each condition evaluates the orchestrationResponse variable. Depending on the value of this variable, the flow is directed to different assistants: either to the Movie Ticket Assistant or to the Mall Shops Catalog. If neither of these conditions is met, the flow continues through the Else branch, where by default there is a Go to node. A Message node has been added before the Go to node so that the flow can display a specific message to the user.
Then, the corresponding nodes are added to handle the responses according to the evaluated condition.
A node of API Assistant type that is configured for the Movie Ticket Assistant and handles queries related to the movie theater in the shopping mall is placed below the first node of Expression type (which checks if orchestrationResponse is equal to "Movie Ticket Assistant").
A node of RAG Assistant type that is configured for the Mall Shop Catalog Assistant and provides information about the stores in the mall is added below the second node of Expression type (which checks if orchestrationResponse is equal to "Mall Shops Catalog").
Finally, below each node a Go to is added, which redirects back to the User Input node. Once the assistant has processed and answered the query, this allows the flow to return to the entry point to receive new user interactions, ensuring a continuous and fluid conversation.
Once you have configured the flow, make sure to click on the 'Save' button located at the top left of the screen. This step is essential to save all changes made to the flow.
To test the flow you have created, you have three options available from the same design window:
- Click on the arrow icon (similar to the play button) to run the flow ('Run Flow').
- Click on the message icon to open the testing assistant ('Open Testing Assistant').
- Click on the open in new window icon (the box with an arrow) to access the demo page ('Go to Demo Page').
The first two options will open a window on the right side of the screen, while the third option will open a new window in the browser, allowing you to see how the flow runs in a demo environment.
During testing, you can run various queries to make sure that the flow responds correctly. For example, you can ask "Where can I purchase books?" and the flow should correctly identify the query and direct it to the Mall Shop Catalog, where the user will be informed about the availability of stores that sell books. Then, you can ask "What movies can I watch?" and verify that the flow correctly redirects to the Movie Ticket Assistant to get the list of available movies.
If the answer is ambiguous, as in "I would like to watch the last one", the orchestrator should use the context of the conversation to identify the last movie mentioned and continue the interaction with the Movie Ticket Assistant. In situations where the query does not correspond to any assistant—such as "What is Linux?"—the orchestrator should handle the response using a fallback and provide the information directly from the model, so that the flow covers all possible user interactions.
These tests will allow you to adjust the flow as needed, ensuring that the Mall Chat Assistant runs efficiently and delivers a smooth and accurate experience for users.