GenAI Intent detection
EARLY ACCESS
The GenAI intent detection tool uses advanced text classification to analyze messages and works with virtual assistants within Answers to enhance communication. It accurately categorizes the intent of end users' messages, ensuring that your chatbot delivers contextually relevant responses.
In the GenAI intent detection tool, configure the intents that you want the GenAI model to identify. Based on these intents, you can redirect end users to a specific part of the chatbot to provide them with better support with their queries.
These intents are different from Answers intents because you do not need to train the GenAI intents with specific training phrases. You only need to provide examples of user messages that are specific to your use case.
For more information about intents, refer to the Intents documentation.
Prerequisites
Contact your Infobip account manager to activate AI features in your account.
Key features
- Classifying messages
- Organizing the conversational flow
Configure the element
To add the GenAI intent detection element to your chatbot, drag it from Apps from Exchange. Complete the following fields.
Request
Provide instructions for the chatbot to identify the intent. Complete the following fields.
User message
Specify the message sent by the end user. GenAI identifies the intent of this message.
You can do one of the following:
- Select the text attribute that contains the end user's message. Example: menu_response.
- Select the predefined attribute, lastReceivedTextMessage.
Prompt instruction, System message, Intents
The prompt instruction, system message, and intents work together to identify the intent of the end user's message.
To configure these fields, do one of the following:
- Configure the field manually.
- Save the field value in an attribute and then specify this attribute in the field.
First, configure the prompt instruction and system message. Then, configure the intents. Refer to the following sections.
Prompt instruction and system message
The following table shows the prompt and system message templates that you can use when configuring the request parameters.
Infobip recommends that you keep the prompt and system message template format unchanged, because they will work well in most cases. Replace the capitalized words with terms specific to your use case.
Prompt template | System message template |
---|---|
- Question: **{query_str}** - Help me classify user's question in one of the categories | - CLIENT is a BANK - I need you to classify user question into one of categories [CATEGORY_1, CATEGORY_2, agent] - CATEGORY_1 category refers to the following types of queries: -- [HOW TO APPLY FOR PERSONAL FINANCING, WHO IS ELIGIBLE FOR PERSONAL LOAN, WHAT ARE THE TERMS AND CONDITIONS, WHAT ARE THE PAYMENT TERMS] - CATEGORY_2 category refers to the following types of queries: -- [I LOST MY CARD, PLEASE DISABLE MY STOLEN CARD, I WANT TO REPORT A LOST CARD] - agent category refers to the following types of queries: -- [Let me talk to an agent, I want to talk to a real person, Transfer me to a live agent] - User question will be delimited by **. - Your answer must be in a valid JSON format, with the key: category, and the value is one of the categories defined above. |
Intents
The intents must have the same name as the categories that are specified in the system message.
In the above example, the categories are CATEGORY_1, CATEGORY_2, and agent.
You do not need to add training phrases for these intents.
If none of the specified intents are found, the intent element returns unknown. This usually happens when messages do not fit into any of the defined intents. You do not need to define the unknown intent in the element because it is automatically added.
Output tokens (Optional)
Configure the maximum number of tokens that the tool can use in a response.
If you use a low value in this field, the response is truncated. Usually, the GenAI Intent Detection element returns very small outputs of approximately 50 tokens. You can increase the value if you need longer, customized responses.
Response
Configure the response. For more information, refer to the Response section.
Fallback
Specify the action that the chatbot needs to take if the GenAI intent detection element fails to execute. For more information, refer to the Fallback section.
Tests (Optional)
Create one or more test cases to check whether the intents are identified correctly.
In the test case, do the following.
- In the User message field, specify a sample message from the end user.
- If you have used attributes to configure the fields in the element, specify the values of the attributes.
- In the Expected response field, specify the intent into which the user message needs to be classified.
After you create the test cases, run them, and view the results.
For an example of a test case, refer to the Example section.
For more information about creating and working with test cases, refer to the Test cases section.
Preview the behavior of the element
Enter examples of end user messages and prompts, and check if the response from GenAI is as expected.
Do the following:
- Select Preview behavior.
- In the User message field, enter an example of a message from the end user. Example: How much can I borrow?
- Configure the other fields, if required.
- Select Preview behavior.
The response from GenAI is displayed in the right pane. The response shows the intent that GenAI matched for the end user's message.
If the result is not what you expect, do the following until you get the required output.
- Modify the fields in the Preview screen.
- Select Preview behavior.
If the result is as expected, select Apply changes to parameters to update the fields in the GenAI intent detection element.
For an example of a preview, refer to the Example section.
Configure the next steps
After configuring the GenAI Intent detection element, define the next steps for specific intents. Example: Use a Conditions element to route the chatbot flow based on the end user's intent.

Example
In this example, the chatbot is for a bank. When end users ask questions, the GenAI intent detection element identifies the intent associated with the question. You can then redirect the end user to the dialog for that intent.
-
To obtain the question from the end user, add a Text element. Example: How can I help you today?
-
Add the GenAI intent detection element.
-
Pass the response from the end user to the GenAI intent detection element. To do so, specify lastReceivedTextMessage in the User message field in the element.
-
In the prompt instruction field, instruct GenAI to classify the end user's response into one of the configured intents. Use the following prompt.
- Question: **{query_str}** - Help me classify user's question in one of the categories
-
In the System message field, add the following instructions.
- InfoBank is a bank - I need you to classify user question into one of categories [Loans, Lost, Agent] - Loans category refers to the following types of queries: -- [How to apply for personal financing, who is eligible for personal loan, what are the terms and conditions, what are the payment terms] - Lost category refers to the following types of queries: -- [I lost my card, Please disable my stolen card, I want to report a lost card] - Agent category refers to the following types of queries: -- [Let me talk to an agent, I want to talk to a real person, Transfer me to a live agent] - User question will be delimited by **. - Your answer must be in a valid JSON format, with the key: category, and the value is one of the categories defined above.
-
In the Intents field, create intents for each category that you specified in the System message field. So, create the Loans, Lost, and Agent intents.
-
Create an attribute, intent_category, to save the response from the GenAI intent detection element.
-
In the GenAI intent detection element > Response tab > Response body field, configure the following.
Attribute: intent_category
Path: $.response
-
Configure the fields in the Fallback tab.
-
In the Tests tab, create test cases. In each test case, provide a sample end user message and specify the intent to which the message must be classified.
Example:
User message is What is the eligibility for borrowing?
Expected response is the intent, Loans.
-
Run the test case and view the result to check whether the intent detected by GenAI matches the intent specified in the test case. Check whether the Actual response matches the Expected response.
-
Preview the behavior of the GenAI intent detection element. In the preview screen, enter a sample end user message in the User message field and select Preview behavior. Check whether the response in the right pane is correct.
Example:
User message is How much can I borrow?
Check whether the response in the right pane is Loans.
-
Test the entire chatbot. In the Test tab of the chatbot, enter a message about one of the banking services.
Example: Send the message, My credit card has been stolen, to the chatbot. Check whether GenAI detects the correct intent.