Skip to content

Bedrock knowledge base fallback permitting language translation #838

@sneff91

Description

@sneff91

Describe the bug
When QnABot is configured to use Bedrock knowledge base for fallback, queries in foreign (non-English) languages get translated to English, Bedrock attempts to resolve the query, and the response is translated back into the foreign language and returned to the user.

This may sound beneficial, but it is a liability and poses a risk to our organization. We want and need our QnABot to ONLY support the language that our content (static Q&A bank and Bedrock knowledge base) English is written in.

ENABLE_MULTI_LANGUAGE_SUPPORT in the Designer UI is set to false.

In the fulfillment Lambda logs, in the portion that shows the Bedrock knowledge base input, it appears to show the query in the original language, so QnABot isn't translating it itself:
Image

To Reproduce
Submit a query in a foreign language to QnABot that gets handled by Bedrock knowledge base fallback. This can be performed using the standard internal QnABot chat client.

Expected behavior
Bedrock should receive the query in the original language, fail to answer it, and respond with it's standard "I don't know" message.

Configuration context

  • QnABot v7.1.3
  • Region: ca-central-1
  • Solution is not modified beyond standard configuration options

Additional context
I discussed this with our AWS appointed Solutions Architect who reached out to the QnABot dev team (I'll withhold their name for privacy reasons). Our SA and the QnABot dev identified that the issue is with how QnABot invokes Bedrock, and that due to a particular parameter that is used, it permits some form of query disambiguation or translation for Bedrock. We were advised to implement a "fix" by exporting the ESProxy layer of the fulfillment Lambda, and adjusting the lib --> bedrock --> bedrockAgent.js to comment out line 79 (sessionId: response?.sessionId,), then re-zip the layer and re-upload it as a new layer version to our fulfillment Lambda. This resolved the issue, however it is not suitable as a long-term fix, as I expect that this change will continuously be overwritten when we update QnABot through our CFN stack.

I'm not quite sure what the best way of approaching this problem is. If there are other use cases where the line referenced above is needed, can a modification be made to QnABot to allow for some kind of setting to control how translation of foreign languages is handled by Bedrock? Ultimately, we're looking for a setting to control this behaviour in our enterprise environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions