Answers
Generative AI
GenAI tools

GenAI tools

EARLY ACCESS

Add GenAI elements from Exchange to your Answers chatbot to add functionality to the chatbot.

The following GenAI elements are available.

Prerequisites

Enable GenAI elements in Exchange

To enable the GenAI tools, do the following.

  1. Log on (opens in a new tab) to your Infobip account.
  2. Go to Exchange > All apps.
  3. Find the required GenAI elements. You can also use the Search box.
  4. When the GenAI element is displayed, select it, and then select Add.

The selected elements are now available in your chatbot in the Apps from Exchange section.

(Optional) Learn about LLM

Enroll in an LLM or prompting course to enhance your understanding and skills in using advanced LLMs. Example: ChatGPT Prompt Engineering for Developers (opens in a new tab) course.

GenAI Intent detection

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.

Note

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.

Key features

  • Classifying messages
  • Organizing the conversational flow

Configure the GenAI Intent detection 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.

Important

Use the prompt template as it is.

In the system message template, replace the capitalized words with terms specific to your use case. Do not update the format of the template.

Prompt templateSystem 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 CONDITION, IS THERE PERSONAL FINANCING FOR A PRIVATE SECTOR, WHAT ARE THE PAYMENT TERMS]
- Agent category refers to the following types of queries:
-- [Let me talk to an agent, Is there any live agent or customer representative that I can talk with, Transfer me to a live agent]
- CATEGORY_2 category refers to the following types of queries:
-- [REPORT A LOST DEBIT OR CREDIT CARD TO PREVENT UNAUTHORIZED ACCESS AND REQUEST CARD DEACTIVATION, I LOST MY CARD, I WANT TO REPORT A LOST CARD]

- 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.

Important

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.

Specifications: Minimum of 1 and a maximum of 512 tokens.

Response

Save response code to attribute (Optional)

Select the attribute in which to save the response code.

Response body attributes

Select the attribute in which to save the body of the response, and the related path.

You can also view and copy the response code JSON schema.

Configure the response

Fallback

Specify the action that the chatbot needs to take if the GenAI intent detection element fails to execute.

Fallback action

Specify the action that the chatbot needs to take when fallback is triggered. You can either transfer the chat to an agent (Connect to agent) or send the end user to another dialog (Go to dialog).

Dialog

If the Fallback action is Go to dialog, choose the relevant dialog. Example: You can go back to the default dialog, the menu dialog, or the closing dialog.

Fallback message (Optional)

Send the end user a message when to inform them that there is an issue. Example: Sorry, we are experiencing technical difficulties. Please try again later.

The message can contain a maximum of 4.096 characters including spaces, special characters, new line, emojis, and attributes.

To add variations of the message, select Add variation. You can create a maximum of 5 variations. The chatbot randomly selects one of these messages to send to the end user.

Link preview (Optional)

Set whether the end user can see a preview of any link that you share in the Fallback message field. This field is available only for the WhatsApp channel.

Use also for API failures (Optional)

Select this option to trigger fallback if the following errors occur.

  • 408
  • 500, 502, 503, 504

Tests (Optional)

Use this section to test the functionality of the element without testing the entire chatbot. Create one or more test cases to check whether the intents are identified correctly.

Do the following.

  1. Create test cases. Infobip recommends that you create the test cases in a .csv file and import it. Refer to the Import test cases documentation in the following sections.
  2. Run the test cases.
  3. View the results of the test cases.
  4. If the results are not as expected, update the fields in the GenAI element, and run the test cases again.

For more information, refer to the following sections.

Import test cases

You can import saved test cases. Select Import and select the required file.

Supported file format is .csv.

Create a test case manually

To create a new test case, do the following.

  1. Select Add test case.
  2. In the Test detect end user intent screen, name the test case.
  3. In the User message field, specify a sample message from the end user.
  4. If you have used attributes to configure the fields in the element, specify the values of the attributes.
  5. In the Expected response field, specify the intent into which the user message needs to be classified.
  6. Select Save.

Example: User message is What is the eligibility for borrowing? and Expected response is Loans.

Create test cases
Run test cases

After you create the required test cases, run them.

  • To run a specific test case, select the three dots next to the test case and select Run.
  • To run all the test cases, select Run all tests.

You get a message that tells you whether the tests succeeded.

View results of test cases

Check whether the response from GenAI is as expected.

Select the three dots next to a test case and select View result.

Edit test cases

Select the three dots next to the test case that you want to edit and select Edit.

Delete test cases
  • To delete a specific test case, select the three dots next to the test case and select Delete.
  • To delete all the test cases, select Delete all tests.
Export test cases

You can export the test cases that you create. Select Export.

All the test cases are saved in a .csv file.

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:

  1. Select Preview behavior.
  2. In the User message field, enter an example of a message from the end user. Example: How much can I borrow?
  3. Configure the other fields, if required.
  4. 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.

Preview the response

If the result is not what you expect, do the following until you get the required output.

  1. Modify the fields in the Preview screen.
  2. Select Preview behavior.

If the result is as expected, select Apply changes to parameters to update the fields in the GenAI intent detection element.

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.

Next steps

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.

  1. To obtain the question from the end user, add a Text element. Example: How can I help you today?

  2. Add the GenAI intent detection element.

  3. 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.

  4. In the prompt instruction field, instruct GenAI to classify the end user's response into one of the configured intents. Use the following prompt.

    javascript
     
        - Question: **{query_str}**
        - Help me classify user's question in one of the categories
    Configure the prompt instruction
  5. In the System message field, add the following instructions.

    javascript
     
        - 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, is there personal financing for a private sector, what are the payment terms]
        - Agent category refers to the following types of queries:
            -- [Let me talk to an agent, Is there any live agent or customer representative that I can talk with, Transfer me to a live agent]
        - Lost category refers to the following types of queries:
            -- [Report a lost debit or credit card to prevent unauthorized access and request card deactivation, I lost my card, I want to report a lost card]
        - 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.
    Configure the system message
  6. 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.

    Configure the intents
  7. Create an attribute, intent_category, to save the response from the GenAI intent detection element.

  8. In the GenAI intent detection element > Response tab > Response body field, configure the following.

    Attribute: intent_category

    Path: $response.category

    Configure the response
  9. Configure the fields in the Fallback tab.

  10. 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
  11. Run the test case to check whether it is configured correctly. Select the three dots next to the test case and select Run. You should get a message that the test finished successfully.

    Run the test case
  12. Check whether the intent detected by GenAI matches the intent specified in the test case. Select the three dots next to the test case and select View result.

  13. Check whether the Actual response matches the Expected response.

    Verify the result
  14. 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.

    Preview the behavior of the element
  15. 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.

GenAI custom prompt

Use this element to produce custom output based on your instructions.

Example: The following are some examples of what you can ask the element to do.

  • Summarize the input text.
  • Rewrite or create variations of the input text.
  • Translate the input text.
  • Obtain information from the end user.
  • Generate a JSON file in a specific format based on user input. You can then use the file to interact with an API.
  • Create a financial plan based on parameters such as annual income and current savings.

Key features

  • Add custom prompts to your chatbot design.
  • Define and refine prompts.
  • Remember message history.
  • Generate variations, translations, or writing styles.
  • Extract parameters such as email addresses and telephone numbers.
  • Full customization.

Configure the GenAI custom prompt element

To add the GenAI custom prompt element to your chatbot, drag it from Apps from Exchange. Complete the following fields.

Choose function

Select whether the GenAI model must use the conversation history during the chat with the end user.

  • Prompt with conversation history: Use this option if you want the GenAI custom prompt element to use the conversation history as context or reference to return a response. The GenAI model saves the conversation history and then uses this history to provide continuity to the conversation, leading to a human-like interaction.
  • Prompt without conversation history: The GenAI model does not remember the conversation history. Select this option for use cases where GenAI needs to provide specific information that does not need the conversation history. Example: Information about legal documents.

Request

User Message

Specify the message sent by the end user. This field is applicable only if the Choose function field is Prompt with conversation history.

You can do one of the following:

  • Select the text attribute that contains the end user's message.
  • Specify the predefined attribute, lastReceivedTextMessage.
Prompt instruction and System message

The prompt instruction and system message instruct the LLM to generate the required output. These fields do the following:

  • Sets the chatbot's personality and behavior
  • Sets the tone of the generated response
  • Specifies the scope of the chatbot

To configure these fields, do one of the following:

  • Configure the field manually.
  • Save the field values in an attribute and then specify this attribute in the field.

The following table shows the prompt template and an example of the system message template. In the example, the goal is to book an appointment with a doctor. The custom prompt gets the necessary details from the end user's response and stores them in a JSON schema that you define. You can then extract the required variables through the Code element and use the API element with your booking system to check appointment availability.

Important

Use the prompt template as it is.

Prompt templateSystem message template
- The user question you need to classify is: **{query_str}**
- Return only the requested data without additional information.
- If information is not provided - write "0"
- Your role is to extract the doctor's name from the user reply or query.
- The user's query will be delimited with: **
- The result should be in structured format with the key: doctor name
- Examples of response should look like this: [{"doctor name":""}]
Output tokens (Optional)

Configure the maximum number of tokens (opens in a new tab) 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.

Specifications: Minimum of 1 and a maximum of 512 tokens.

Temperature (Optional)

Configure the level of randomness in the generated response.

A response that is generated at a lower temperature can be focused, conventional, and predictable, whereas a response that is generated at a higher temperature can be creative, random, and varied.

Important

Avoid a high temperature because the GenAI model might give incorrect and unclear responses.

Response

Save response code to attribute (Optional)

Select the attribute in which to save the response code.

Response body attributes

Select the attribute in which to save the body of the response, and the related path.

You can also view and copy the response code JSON schema.

Note

If you need to manipulate the data received in the response, ensure that you use a JSON attribute type.

Fallback

Specify the action that the chatbot needs to take if the GenAI custom prompt element fails.

Fallback action

Specify the action that the chatbot needs to take when fallback is triggered. You can either transfer the chat to an agent (Connect to agent) or send the end user to another dialog (Go to dialog).

Dialog

If the Fallback action is Go to dialog, choose the relevant dialog. Example: You can go back to the default dialog, the menu dialog, or the closing dialog.

Fallback message (Optional)

Send the end user a message when the GenAI custom prompt element fails so that they are aware that there is an issue. Example: Sorry, we are experiencing technical difficulties. Please try again later.

The message can contain a maximum of 4.096 characters including spaces, special characters, new line, emojis, and attributes.

To add variations of the message, select Add variation. You can create a maximum of 5 variations. The chatbot randomly selects one of these messages to send to the end user, thus making the end user experience varied.

Link preview (Optional)

Set whether the end user can see a preview of any link that you share in the Fallback message field. This field is available only for the WhatsApp channel.

Use also for API failures (Optional)

Select this option to trigger fallback if the following errors occur.

  • 408
  • 500, 502, 503, 504

Tests (Optional)

Use this section to test the functionality of the element without testing the entire chatbot. Create one or more test cases to check whether GenAI follows the instructions correctly and provides the required response.

Do the following.

  1. Create test cases. Infobip recommends that you create the test cases in a .csv file and import it. Refer to the Import test cases documentation in the following sections.
  2. Run the test cases.
  3. View the results of the test cases.
  4. If the results are not as expected, update the fields in the GenAI element, and run the test cases again.
Example

The system instruction is to repeat the end user's message through role play.

Act like a {{Role}}

In the test case, do the following.

  • Specify the end user's message in the Prompt instruction field.
  • Specify the value of the Role attribute as Pirate.
  • Specify the Expected response as Ahoy.
Create the test case

The following image shows the results of the test case.

Create the test case

For information about creating and managing test cases, refer to the following sections.

Import test cases

You can import saved test cases. Select Import and select the required file.

Supported file format is .csv.

Create a test case

To create a new test case, do the following.

  1. Select Add test case.
  2. Name the test case.
  3. If you have enabled prompt without conversation history: In the Prompt instruction field, specify a sample message from the end user.
  4. If you have enabled prompt with conversation history: In the User message field, specify a sample message from the end user.
  5. If you have used attributes to configure the fields in the element, specify the values of the attributes.
  6. In the Expected response field, specify the response expected from GenAI.
  7. Select Save.
Create the test case
Run test cases

After you create the required test cases, run them.

  • To run a specific test case, select the three dots next to the test case and select Run.

    Run the test case
  • To run all the test cases, select Run all tests.

You get a message that tells you whether the tests succeeded.

View results of test cases

Check whether the response from GenAI is as expected.

Select the three dots next to a test case and select View result.

View results of the test case
Edit test cases

Select the three dots next to the test case that you want to edit and select Edit.

Delete test cases
  • To delete a specific test case, select the three dots next to the test case and select Delete.
  • To delete all the test cases, select Delete all tests.
Export test cases

You can export the test cases that you create. Select Export.

All the test cases are saved in a .csv file.

Preview the behavior of the element

Enter examples of end user messages and check if the response from GenAI is as expected.

Do the following.

  1. Select Preview behavior.
  2. If the Function field is Prompt with conversation history, in the User message field, enter an example of a message from the end user.
  3. Configure the other fields, if required.
  4. Select Preview behavior.

The response from GenAI is displayed in the right pane.

If the result is not what you expect, do the following until you get the required output.

  1. Modify the fields in the Preview section.
  2. Select Preview behavior.

If the result is as expected, select Apply changes to parameters to update the fields in the GenAI custom prompt element.

Preview the response

Example

In this example, the purpose of the GenAI custom prompt element is to get information from the end user to book an appointment with a doctor. The expectation is that the end user's message would contain the doctor's name. The GenAI custom prompt element would return the information in the specified format.

  1. To obtain the appointment information from the end user and save this information in an attribute, use the Attribute element (opens in a new tab). In this element, do the following:

    • Ask the end user for the name of the doctor with whom the appointment needs to be booked.
    • Store the end user's response in the booking_information attribute.
    Get the information from the end user
  2. Add the GenAI custom prompt element.

  3. Pass the response from the end user to the GenAI custom prompt element. Do the following in the element.

    1. Enable conversation history so that you can add the end user's message in the element. In the Choose function field, select Prompt with conversation history.
    2. Specify the booking_information attribute in the User message field.
    Configure the user message
  4. In the prompt instruction field, instruct GenAI to obtain information from the end user's message and provide a response. Specify the following information in the prompt.

    • Specify how to get the end user's message.
    • Instruct GenAI to extract booking information from the end user's message. The booking information should contain the doctor's name. If the information is missing, specify 0.
    • Instruct GenAI to return the response in the required format.
    • Instruct GenAI to return only the requested information.

    Use the following prompt.

    javascript
     
    - The user question you need to classify is: **{query_str}**
    - Return only the requested data without additional information.
    - If information is not provided - write "0"
    Configure the prompt instruction
  5. In the System message field, provide further context and guidance to GenAI. Specify the following information in this field.

    • Specify the role, purpose, or expected action for GenAI.
    •  Let GenAI know that the end user's response could contain the doctor's name.
    • Let GenAI know the format of the end user's message.
    • Specify the format in which GenAI needs to give the response.
    • Share an example of the response expected from GenAI.

    Use the following content.

    javascript
     
    - Your role is to extract the doctor's name from the user reply or query.
    - The user's query will be delimited with: **
    - The result should be in structured format with the key: doctor name
    - Examples of response should look like this: [{"doctor name":""}]
  6. In the Response tab > Response body attributes section, specify the attribute in which GenAI must save its response and the associated path.

    Example:

    Create the attribute, prompt_response, and specify this in the Attribute field.

    In the Path field, specify $.

    Configure the response
  7. In the Tests section, create test cases. In each test case, provide a sample end user message and specify the response expected from GenAI. Example:

    User message is John Smith

    Expected response is doctor name: John Smith.

    Create the test case
  8. Run the test case to check whether GenAI provides the correct response. Select the three dots next to the test case and select Run. You should get a message that the test finished successfully.

  9. Check whether the response from GenAI is as expected. Select the three dots next to the test case and select View result.

  10. Check whether the Actual response matches the Expected response.

  11. Preview the behavior of the GenAI custom prompt 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 John Smith.

    Response is

    javascript
     
    \{"response":"\[\{\\"doctor\\":\\"John Smith\\"\}\]"\}
  12. Create an attribute to save the information extracted from the end user's message. Create the doctorname attribute.

    Create attributes
  13. Add the Code element after the GenAI custom prompt element to parse the attributes from the end user's message. Save the extracted information into the attribute that you created - doctorName.

    Example: Use the following code.

    javascript
     
    let data = attributeApi.get('prompt_response');
     
    let parsedData = JSON.parse(data);
    let responseArray = JSON.parse(parsedData.response);
     
    attributeApi.set('doctorName', responseArray[0]["doctor name"]);
    Add the Code element
  14. Add a Text element to return the response from GenAI. Enter the following information in the element.

    javascript
     
    Your appointment is being booked with Dr. {{doctorName}}
  15. Test the entire chatbot. In the Test tab of the chatbot, enter the booking information.

    Example: Send the message, I want to talk to the same doctor as last time, John Smith, to the chatbot. Check whether GenAI returns the correct response.

    Test the chatbot

AI assistant

An artificial intelligence (AI) assistant (opens in a new tab) is an AI model that performs tasks based on the training data and instructions that you specify. Example: Answer FAQ based on the uploaded training documentation.

Use the AI assistant element to add an AI assistant to your chatbot. You can do one of the following.

  • Use an existing assistant.
  • Create and train an assistant. Upload the training documentation to the model and give it instructions on how to respond to end user's questions.

Configure the AI assistant element

To add the AI assistant element to your chatbot, drag it from Apps from Exchange. Complete the following fields.

Request

Select AI assistant

Do one of the following:

  • Use an existing assistant: Select an AI assistant from the list.
  • Create a new assistant: Select Create AI assistant. The AI assistants section opens in the web interface. Create the AI assistant and then return to the AI assistant element. For more information about creating the assistant, refer to the AI Assistants documentation (opens in a new tab).

You can add only one AI assistant to the AI assistant element.

Add AI assistant
User message

Specify the message sent by the end user.

You can do one of the following:

  • Select the text attribute that contains the end user's message.
  • Select the predefined attribute, lastReceivedTextMessage.
External content source (Optional)

Use this option if you want the AI assistant to use an external content source instead of using its own knowledgebase. You can use this option in scenarios where you want to get real-time data, such as the end user's personal information, through an API.

Prompt variable (Optional)

Use this field to specify the following.

  • Configure instructions for the AI Assistant.

  • Use variables to pass information from the chatbot to the AI assistant. Example: Name of the end user.

    In the Prompt variable field, specify the variable that contains the information. If the prompt section in the selected AI assistant contains {prompt_var}, the value from the variable is passed to {prompt_var}. This helps you personalize chats or give context to the AI assistant.

    Example: In the Prompt variable field, add Refer to the end user as {{name}}.

Response

Save response code to attribute (Optional)

Select the attribute in which to save the response code.

Response body

Select the attribute in which to save the body of the response, and the related path.

You can also view and copy the response code JSON schema.

Fallback

Specify the action that the chatbot needs to take if the AI assistant element fails.

Fallback action

Specify the action that the chatbot needs to take when fallback is triggered. You can either transfer the chat to an agent (Connect to agent) or send the end user to another dialog (Go to dialog).

Dialog

If the Fallback action is Go to dialog, choose the relevant dialog. Example: You can go back to the default dialog, the menu dialog, or the closing dialog.

Fallback message (Optional)

Send the end user a message when to inform them that there is an issue. Example: Sorry, we are experiencing technical difficulties. Please try again later.

The message can contain a maximum of 4.096 characters including spaces, special characters, new line, emojis, and attributes.

To add variations of the message, select Add variation. You can create a maximum of 5 variations. The chatbot randomly selects one of these messages to send to the end user.

Link preview (Optional)

Set whether the end user can see a preview of any link that you share in the Fallback message field. This field is available only for the WhatsApp channel.

Use also for API failures (Optional)

Select this option to trigger fallback if the following errors occur.

  • 408
  • 500, 502, 503, 504

Preview the behavior of the element

Preview the behavior of the element. Enter examples of end user messages and check if the response from GenAI is as expected.

Do the following.

  1. Select Preview behavior.
  2. In the User message field, enter an example of a message from the end user.
  3. Configure the other fields, if required.
  4. Select Preview behavior.

The response from GenAI is displayed in the right pane.

If the result is not what you expect, do the following until you get the required output.

  1. Modify the fields in the Preview section.
  2. Select Preview behavior.

If the result is as expected, select Apply changes to parameters to update the AI assistant element.

Preview the behavior of the AI assistant

Example

In this example, the purpose of the AI assistant element is to answer questions about dialogs in Answers. The expectation is that the end user's message would contain a question about dialogs. The AI assistant element would provide a response based on the content uploaded to the AI assistant within the element.

  1. Create an AI assistantAnswers - dialogs.

    Create an AI assistant
  2. In the assistant, add the following link as the training documentation (opens in a new tab).https://www.infobip.com/docs/answers/chatbot-structure/dialogs (opens in a new tab).

  3. In your chatbot, add the Save user response element to obtain the question from the end user and save this information in an attribute. In this element, do the following.

    • Prompt the end user to ask a question.
    • Store the end user's question in the end_user_question_assistant attribute.
    Add Save user response element
  4. Add the AI assistant element.

  5. In the Select AI assistant field, select the Answers - dialogs assistant.

    Select the AI assistant
  6. Pass the question from the end user to the AI assistant element. To do so, specify the end_user_question_assistant attribute in the User message field.

    Configure the user message
  7. In the Prompt variable field, instruct GenAI to address the end user by their name.

    Use the following prompt.

    Refer to the end user as: {{firstname}}

    Configure the prompt variable
  8. In the Response tab > Response body attributes section, specify the attribute in which GenAI must save its response and the associated path.

    Example:

    Create the attribute, assistant_response, and specify this in the Attribute field.

    In the Path field, specify $.

    Configure the response
  9. Preview the behavior of the AI assistant 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 *What is a dialog?

    Response is

    javascript
     
    {"response":"A dialog is a component of a chatbot that performs a specific task or set of tasks. Dialogs divide a chatbot into manageable parts. The entire communication between the chatbot and the end user happens through dialogs. Each dialog contains a set of chatbot elements that work together to perform the task. There are different types of dialogs, such as standard dialogs, default dialogs, and authentication dialogs. Standard dialogs are the dialogs that you create for performing various tasks. These dialogs contain most of the actions of a chatbot. The default dialog is added by default when you create a chatbot. This is always the first dialog. Use this dialog to send a welcome message and identify what the end user wants. The authentication dialog is used to verify the identity of end users."}
  10. Test the entire chatbot. In the Test tab of the chatbot, enter a question about dialogs. Example: Send the message, What is a dialog, to the chatbot. Check whether GenAI returns the correct response.

Need assistance

Explore Infobip Tutorials

Encountering issues

Contact our support

What's new? Check out

Release Notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Service Terms & ConditionsPrivacy policyTerms of use