aws-solutions / qnabot-on-aws

AWS QnABot is a multi-channel, multi-language conversational interface (chatbot) that responds to your customer's questions, answers, and feedback. The solution allows you to deploy a fully functional chatbot across multiple channels including chat, voice, SMS and Amazon Alexa.
https://aws.amazon.com/solutions/implementations/aws-qnabot
Apache License 2.0
393 stars 251 forks source link

"FAQ" translates to "page" in en_US #360

Closed boer11 closed 1 year ago

boer11 commented 2 years ago

Describe the bug We use "faq" as an initial utterance in the bot. It stopped matching against "faq" and debug shows it being translated to "page" when multilanguage==True Tested in 4.7.0 and 5.0.1.

Looking at Kibana transcripts shows that the user locale is en_US and that it translates to "page". Tested in browsers with english locale and browsers with swedish locale.

It has previously resolved to "faq".

To Reproduce

  1. Deploy new bot.
  2. Enable multilanguage
  3. Enable debug responses
  4. Go to webclient and type "faq"

Expected behavior "faq" should not be translated at all or not get translated to "page"

Please complete the following information about the solution:

To get the version of the solution, you can look at the description of the created CloudFormation stack. For example, "(SO0189) QnABot [...] v0.0.1".

Screenshots If applicable, add screenshots to help explain your problem (please DO NOT include sensitive information).

Additional context Kibana transcript: { "_index": "qnabot-20211101-metrics_20211101_071124", "_type": "_doc", "_id": "49624162411043094469988422467020494785745212142593769474.0", "_version": 1, "_score": null, "_source": { "entireRequest": { "_event": { "sessionId": "eu-central-1:64f732cf-2857-4a73-89a5-74b8fe0ea5d9", "interpretations": [ { "intent": { "slots": { "qnaslot": { "shape": "Scalar", "value": { "originalValue": "faq", "resolvedValues": [], "interpretedValue": "faq" } } }, "confirmationState": "None", "name": "QnaIntent", "state": "ReadyForFulfillment" }, "nluConfidence": 0.86 }, { "intent": { "slots": {}, "confirmationState": "None", "name": "FallbackIntent", "state": "ReadyForFulfillment" } } ], "inputTranscript": "faq", "responseContentType": "text/plain; charset=utf-8", "invocationSource": "FulfillmentCodeHook", "messageVersion": "1.0", "sessionState": { "sessionAttributes": { "idtokenjwt": "*" }, "intent": { "slots": { "qnaslot": { "shape": "Scalar", "value": { "originalValue": "faq", "resolvedValues": [], "interpretedValue": "faq" } } }, "confirmationState": "None", "name": "QnaIntent", "state": "ReadyForFulfillment" }, "originatingRequestId": "c7db93b2-a352-4630-ad95-525385907e14" }, "inputMode": "Text", "bot": { "aliasId": "NTDJAGRLAE", "aliasName": "live", "name": "QnABot-20211101_QnaBot", "version": "1", "localeId": "en_US", "id": "BSLHGHXE5C" }, "origQuestion": "faq", "errorFound": false }, "_settings": { "ENABLE_DEBUG_RESPONSES": true, "ES_USE_KEYWORD_FILTERS": true, "ES_EXPAND_CONTRACTIONS": "{\"you're\":\"you are\",\"I'm\":\"I am\",\"can't\":\"cannot\"}", "ES_KEYWORD_SYNTAX_TYPES": "NOUN,PROPN,VERB,INTJ", "ES_SYNTAX_CONFIDENCE_LIMIT": ".20", "ES_MINIMUM_SHOULD_MATCH": "2<75%", "ES_NO_HITS_QUESTION": "no_hits", "ES_USE_FUZZY_MATCH": false, "ES_PHRASE_BOOST": "4", "ES_SCORE_ANSWER_FIELD": false, "ENABLE_SENTIMENT_SUPPORT": true, "ENABLE_MULTI_LANGUAGE_SUPPORT": true, "ENABLE_CUSTOM_TERMINOLOGY": false, "MINIMUM_CONFIDENCE_SCORE": 0.6, "ALT_SEARCH_KENDRA_FALLBACK_CONFIDENCE_SCORE": "HIGH", "ALT_SEARCH_KENDRA_FAQ_CONFIDENCE_SCORE": "HIGH", "ALT_SEARCH_KENDRA_INDEXES": "", "ALT_SEARCH_KENDRA_S3_SIGNED_URLS": true, "ALT_SEARCH_KENDRA_S3_SIGNED_URL_EXPIRE_SECS": 300, "ALT_SEARCH_KENDRA_MAX_DOCUMENT_COUNT": 2, "ALT_SEARCH_KENDRA_TOP_ANSWER_MESSAGE": "Amazon Kendra suggested answer.", "ALT_SEARCH_KENDRA_FAQ_MESSAGE": "Answer from Amazon Kendra FAQ.", "ALT_SEARCH_KENDRA_ANSWER_MESSAGE": "While I did not find an exact answer, these search results from Amazon Kendra might be helpful.", "KENDRA_FAQ_INDEX": "", "KENDRA_FAQ_CONFIG_MAX_RETRIES": 8, "KENDRA_FAQ_CONFIG_RETRY_DELAY": 600, "KENDRA_FAQ_ES_FALLBACK": true, "ENABLE_KENDRA_WEB_INDEXER": false, "KENDRA_INDEXER_URLS": "", "KENDRA_INDEXER_SCHEDULE": "rate(1 day)", "KENDRA_WEB_PAGE_INDEX": "", "ERRORMESSAGE": "Unfortunately I encountered an error when searching for your answer. Please ask me again later.", "EMPTYMESSAGE": "You stumped me! Sadly I do not know how to answer your question.", "DEFAULT_ALEXA_LAUNCH_MESSAGE": "Hello, Please ask a question", "DEFAULT_ALEXA_REPROMPT": "Please either answer the question, ask another question or say Goodbye to end the conversation.", "DEFAULT_ALEXA_STOP_MESSAGE": "Goodbye", "SMS_HINT_REMINDER_ENABLE": true, "SMS_HINT_REMINDER": " (Feedback? Reply THUMBS UP or THUMBS DOWN. Ask HELP ME at any time)", "SMS_HINT_REMINDER_INTERVAL_HRS": "24", "IDENTITY_PROVIDER_JWKS_URLS": [], "ENFORCE_VERIFIED_IDENTITY": false, "NO_VERIFIED_IDENTITY_QUESTION": "no_verified_identity", "ELICIT_RESPONSE_MAX_RETRIES": 3, "ELICIT_RESPONSE_RETRY_MESSAGE": "Please try again?", "ELICIT_RESPONSE_BOT_FAILURE_MESSAGE": "Your response was not understood. Please start again.", "ELICIT_RESPONSE_DEFAULT_MSG": "Ok. ", "CONNECT_IGNORE_WORDS": "", "CONNECT_ENABLE_VOICE_RESPONSE_INTERRUPT": false, "CONNECT_NEXT_PROMPT_VARNAME": "connect_nextPrompt", "ENABLE_REDACTING": false, "REDACTING_REGEX": "\b\d{4}\b(?![-])|\b\d{9}\b|\b\d{3}-\d{2}-\d{4}\b", "PII_REJECTION_ENABLED": false, "PII_REJECTION_QUESTION": "pii_rejection_question", "PII_REJECTION_WITH_COMPREHEND": true, "PII_REJECTION_REGEX": "\b\d{4}\b(?![-])|\b\d{9}\b|\b\d{3}-\d{2}-\d{4}\b", "PII_REJECTION_IGNORE_TYPES": "Name,Address", "DISABLE_CLOUDWATCH_LOGGING": false, "MINIMAL_ES_LOGGING": false, "S3_PUT_REQUEST_ENCRYPTION": "", "BOT_ROUTER_WELCOME_BACK_MSG": "Welcome back to QnABot.", "BOT_ROUTER_EXIT_MSGS": "exit,quit,goodbye,leave", "RUN_LAMBDAHOOK_FROM_QUERY_STEP": true, "DEFAULT_USER_POOL_JWKSURL": "https://cognito-idp.eu-central-1.amazonaws.com/eu-central-1*/.well-known/jwks.json" }, "_type": "LEX", "_lexVersion": "V2", "_userId": "eu-central-1:64f732cf-2857-4a73-89a5-74b8fe0ea5d9", "intentname": "QnaIntent", "question": "page", "session": { "userDetectedLocale": "en", "userDetectedLocaleConfidence": 0.1403024047613144, "userDetectedSecondaryLocale": "sq", "qnabotcontext": { "userLocale": "en" }, "userPrefs": {}, "matchlang": "false" }, "_preferredResponseType": "PlainText", "_clientType": "LEX.Text", "_translation": "page", "sentiment": "NEUTRAL", "sentimentScore": { "Positive": 0.020311718806624413, "Negative": 0.04912983626127243, "Neutral": 0.9266681671142578, "Mixed": 0.0038902927190065384 }, "_fulfillment": { "step": "preprocess" }, "_userInfo": { "UserId": "", "InteractionCount": 3, "FirstSeen": "Wed Nov 10 2021 13:08:17 GMT+0000 (Coordinated Universal Time)", "LastSeen": "Wed Nov 24 2021 14:21:27 GMT+0000 (Coordinated Universal Time)", "TimeSinceLastInteraction": 1095.929, "recentTopics": [], "Email": "", "isVerifiedIdentity": "true" }, "_info": { "es": { "address": "****.eu-central-1.es.amazonaws.com", "index": "qnabot-20211101", "type": "qna", "service": { "qid": "QnABot-20211101-ESQidLambda-", "proxy": "QnABot-20211101-ESProxyLambda-" } } } }, "entireResponse": { "type": "PlainText", "message": "[User Input: \"page\", Source: ElasticSearch] Unfortunately I didn't understand your question, can you try typing it in a different way?", "session": { "userDetectedLocale": "en", "userDetectedLocaleConfidence": "0.1403024047613144", "userDetectedSecondaryLocale": "sq", "qnabotcontext": "{\"userLocale\":\"en\",\"previous\":{\"qid\":\"Bot.CustomNoMatches\",\"q\":\"page\"},\"navigation\":{\"next\":\"\",\"previous\":[],\"hasParent\":true}}", "TicketQuestion": "faq", "appContext": "{\"altMessages\":{}}", "qnabot_qid": "Bot.CustomNoMatches", "qnabot_gotanswer": "false" }, "card": { "send": true, "title": "You can also", "text": "", "url": "", "buttons": [ { "text": "Get a response from a person", "value": "Speak with an operator" } ] }, "intentname": "QnaIntent", "_userInfo": { "UserId": "****", "InteractionCount": 4, "FirstSeen": "Wed Nov 10 2021 13:08:17 GMT+0000 (Coordinated Universal Time)", "LastSeen": "Wed Nov 24 2021 14:39:42 GMT+0000 (Coordinated Universal Time)", "TimeSinceLastInteraction": 1095.929, "recentTopics": [], "Email": "", "isVerifiedIdentity": "true" }, "got_hits": 0, "result": { "qid": "Bot.CustomNoMatches", "a": "[User Input: \"page\", Source: ElasticSearch] Unfortunately I didn't understand your question, can you try typing it in a different way?", "r": { "title": "You can also", "buttons": [ { "text": "Get a response from a person", "value": "Speak with an operator" } ] }, "type": "qna", "questions": [ { "q": "no_hits" }, { "q": "What is" } ], "quniqueterms": "no_hits What is", "answersource": "ElasticSearch", "autotranslate": { "a": true, "rp": true, "r": { "title": true, "buttons": { "x": { "text": true, "value": true } } } }, "rp": "Please either answer the question, ask another question or say Goodbye to end the conversation.", "l": "", "args": [], "lambdahooks": [ { "args": [] }, { "l": "", "args": [] } ] }, "plainMessage": "[User Input: \"page\", Source: ElasticSearch] Unfortunately I didn't understand your question, can you try typing it in a different way?", "answerSource": "ELASTICSEARCH", "reprompt": { "type": "PlainText", "text": "Please either answer the question, ask another question or say Goodbye to end the conversation." } }, "qid": "Bot.CustomNoMatches", "utterance": "page", "answer": "[User Input: \"page\", Source: ElasticSearch] Unfortunately I didn't understand your question, can you try typing it in a different way?", "topic": "", "session": { "userDetectedLocale": "en", "userDetectedLocaleConfidence": 0.1403024047613144, "userDetectedSecondaryLocale": "sq", "qnabotcontext": { "userLocale": "en", "previous": { "qid": "Bot.CustomNoMatches", "q": "page" }, "navigation": { "next": "", "previous": [], "hasParent": true } }, "TicketQuestion": "faq", "appContext": { "altMessages": {} }, "qnabot_qid": "Bot.CustomNoMatches", "qnabot_gotanswer": false }, "clientType": "LEX.Text", "datetime": "2021-11-24T14:39:44.437Z" }, "fields": { "datetime": [ "2021-11-24T14:39:44.437Z" ] }, "sort": [ 1637764784437 ] }

trindfus commented 2 years ago

To specify how a word should be translated you can use custom terminology. Refer to the readme for documentation on how to implement this: https://github.com/aws-solutions/aws-qnabot/blob/main/docs/custom_terminology_guide/README.md

From QnABot 5.1 you can also use QID:: (for example “QID::Admin001") to reference a specific question. In previous versions translate would try to translate the qid.