Chatbot training and optimization
- It will require some time for your chatbot to consistently provide correct answers to all questions. To improve its performance, you and your human agents should continuously train the chatbot by incorporating new question variations and Intents. This approach will effectively enhance the capabilities of your chatbot.
- Agents can add new Intents and chatbot responses, and add new training phrases to existing intents on the fly from the admin area by moving the mouse cursor over a message and clicking the Dialogflow Intent icon. Enable Settings > Artificial Intelligence > OpenAI > Generate user expressions to automatically add variations of the question and to rewrite the answer. New Intents will contain also the responses, while the update of existing intents will add new training phrases only, but not new chatbot responses. If you’re using Dialogflow CX, the chatbot responses will be added to the latest flow used in the conversation if any, otherwise to the start flow.
- If the chatbot is replying with the wrong intents, go to Dialogflow Console > chatbot Settings > ML Settings, and set the ML CLASSIFICATION THRESHOLD to a larger number, such as 0.6. Also check the Intent detection confidence.
Dialogflow Intent detection confidence
When searching for a matching intent, Dialogflow scores potential matches with an intent detection confidence, also known as the confidence score. These values range from 0.0 (completely uncertain) to 1.0 (completely certain). Specify a value ranging from 0.1 to 1.0. Any answer provided by Dialogflow that is less than this value will not be considered. If you are utilizing Dialogflow alongside your OpenAI chatbot that is trained using your resources, it is recommended to configure the value as 0.81.
Knowledge Base
Knowledge Base are automatically enabled. Knowledge Base is a feature that gives your chatbot the ability to search within documents (such as a PDF) or web pages to find an answer. To create your first Knowledge Base, go to cloud.google.com/dialogflow/docs/knowledge-connectors
Dialogflow response
The full Dialogflow JSON response is automatically saved in the database, sb_messages, column payload.
Ignore an Intent if it doesn’t fit the provided keywords
Sometimes Dialogflow gives incorrect answers due to similar questions with different subjects. To solve this, you can instruct ParrotGPT to ignore an Intent if specific keywords are not present in the user’s message. Here’s how you can do it:
- Enter Dialogflow and edit the Intent.
- For each training phrase, select the keywords you want to be required and link them to a new Entity, or an existing one.
- Under Actions and parameters check Required and add a new Prompt with value skip-intent
- Save the Intent.
User attachments
User attachments are sent to Dialogflow by appending the attachments to the message details in the following format:[name:file-name.ext,url:URL,extension:file-extension]
Example:[name:archive.zip,url:https://parrotgpt.ai/archive.zip,extension:zip] [name:license.pdf,url:https://parrotgpt.ai/license.pdf,extension:pdf]
Chatbot attachments
To allow the chatbot to send attachments, add a Custom Payload response and insert this JSON code:{ “attachments”: [[“name”, “YOUR-LINK”], [“name”, “YOUR-LINK”], [“name”, “YOUR-LINK”]]}
Replace “name” with the actual name of the attachment to display and replace “YOUR-LINK” with the actual URL of the file. Images attachments are displayed automatically as images.
Rich messages
To allow Dialogflow to send rich messages, simply enter the rich message shortcode into the TEXT RESPONSE field or add a new Custom Payload response and insert this JSON code: { “rich-message”: “shortcode” }. Replace “shortcode” with the rich message shortcode, to have a valid JSON code you need to replace all “ chars with \”. To obtain the shortcodes or to learn how to create a rich message, please click here.
Rich message response
When the user interacts with rich messages via the ParrotGPT chat (e.g. by clicking a button), the rich message response is sent to Dialogflow in the following format: ID|response, or ID if the rich message type is registration, email, follow up, in this case the rich message values are sent as array in the queryParams[‘payload’] key. ID is the rich message ID, which can be set by adding the attribute id=”YOUR-ID” to the shortcode. If no ID has been set, a random ID will be used instead. response is the input or selection of the user. To block Dialogflow from replying to a rich message add a new intent with ID as the only user expression and no response.
If the user is interacting with the chatbot via a messaging app (e.g. WhatsApp), the response of the rich message does not contain the rich message ID and Dialogflow contexts must be used to allow Dialogflow to understand which Intent to activate for a specific rich message response.
Get rich message response for registration, email, follow up
- Check the option ParrotGPT > Settings > Artificial Intelligence > Google > Send user details.
- From Left menu > Fulfillment enable Webhooks, you only need to enter the URL of the file that will receive the Dialogflow webhook data.
- Create an Intent with the ID of the rich message, for the registration form, enter registration, for the follow up form enter sb-follow-up-form, for email forms enter email.
- Enable the Fulfillment for the Intent.
- You’re done! The file of the webhook URL will receive the ParrotGPT rich message user details.
Sequential survey
To create a sequential survey like the one of the demo you need to Enter the Rich message ID in the Training phrases, check the example below.
- Go to Dialogflow and create a new intent. In the Training phrases area enter the user expression survey example. In the Responses area enter the code [buttons id=”test-survey-1? options=”Software,Physical products,Services” title=”What is your type of business?” message=”Please choose the type that best suits your company.” success=”Your company type is “]
- Create a new intent. Enter the user expression test-survey-1 and as response enter [select id=”seq-survey-2? options=”Priority post, Express courier, International courier” title=”Shipping methods” message=”Choose the preferred shipping method of your customers” success=”Your customers preferred shipping method is”]
- Create a new intent. Enter the user expression test-survey-2 and as response enter Thank you for completing our survey!.
- You’re done.
Departments linking
- Get the department IDs from Settings > Miscellaneous > departments.
- Get the project IDs from the Dialogflow settings area of your agents.
More information
- Dialogflow supports the use of voice messages through speech recognition.
- You can activate the chatbot via API but sending a message with no text and payload { “event”: “activate-bot” }.
- The following details are sent to Dialogflow in the queryParams parameter when detecting an intent: conversation_id, user_id.
- To trigger the welcome event in Dialogflow CX, create a Event Handler and insert Welcome as Custom Event.
- ParrotGPT articles are synchronized automatically with the Dialogflow knowledge base.
- Use the JS variable SB_DIALOGFLOW_AGENT = “AGENT ID” to change the default Dialogflow agent, replace “AGENT ID” with the project ID.
- If the user sends the same message again, triggering the same Intent in Dialogflow, and OpenAI is active, ParrotGPT will attempt to send a message from OpenAI and will ignore the response from Dialogflow.
- You can access the user_id and conversation_id of the current user and conversation in Dialogflow CX using the $session.params.user_id and $session.params.conversation_id codes, which are located in the Condition area of the route.