qnabot-on-aws icon indicating copy to clipboard operation
qnabot-on-aws copied to clipboard

Customizable Kendra Fallback

Open e-ndrus opened this issue 1 year ago • 6 comments

Is your feature request related to a problem? Please describe. Kendra Fallback is a great feature of a QnA Bot. However, it seems like we cannot customize Kendra output to meet our needs unless we edit the es-proxy-layer. For instance, by default Kendra would return a highlight which concatenates fields if there are multiple custom fields within the Kendra index.

Describe the feature you'd like Would it be possible to make it customizable what Kendra fallback returns. For instance, indicate which fields to return or whether to trim the highlight?

Additional context We are currently experimenting with QnA Bot Version v5.3.4.

e-ndrus avatar Aug 11 '23 16:08 e-ndrus

Thanks @e-ndrus for submitting the suggestion. I think this sounds like a reasonable enhancement, however I'm not clear on the 'indicate which fields to return' feature. Do you mean to filter out specific document attributes from the QnABot response (for example, removing the source URI)? If this isn't what you meant, can you provide an example?

marcburnie avatar Aug 14 '23 14:08 marcburnie

@marcburnie the default Kendra Fallback answer looks something like this:

[User Input: “What am I supposed to do?”[{“Type":"DOCUMENT","Score":"VERY_HIGH"},{"Type":"DOCUMENT","Score":"VERY_HIGH"}], Source: KENDRA FALLBACK]
While I did not find an exact answer, these search results from Amazon Kendra might be helpful.


...370 What am I supposed to do? Some field value here. Additional Field Value…
Source Link: What am I supposed to do


...371 What am I supposed to do? Some field value here. Additional Field Value...
Source Link: What am I supposed to do

As you can see, the current format is not very clear to the end user. The problem is that KendraFallback presents a user with a highlight where fields in the Kendra document are merged into one string which is also trimmed to a certain number of characters.

A use case would be something like a Kendra index with documents having several custom fields. Let's say: plan, state, brand, etc. We wouldn't want that info to be merged into and shown as a Kendra highlight, rather as separate untrimmed fields.

For example:

KendraFallback response:

Document 1 Title

Document 1 Body
Document 1 Plan | Document 1 State | Document 1 Brand

-----------------

Document 2 Title

Document 2 Body
Document 2 Plan | Document 2 State | Document 2 Brand

It would be great if we could customize KendraFallback output as shown to QnABot users.

e-ndrus avatar Aug 14 '23 18:08 e-ndrus

Thanks for the clarification. We will evaluate this and get back to you.

marcburnie avatar Aug 15 '23 22:08 marcburnie

Hi all, coming back to this as we're building out our roadmap for next year, and are looking at leveraging LLMs for a similar feature. E-ndrus - Can you clarify what new functionality you want to achieve with your recommendation? I'd like to evaluate if there are options outside of customizing our kendra fallback that would achieve the same results.

kroeter avatar Sep 12 '23 14:09 kroeter

Well, the functionality we are aiming for is a more customizable Kendra fallback output. A search result highlight is sometimes not what clients want. Let's say we have documents in Kendra with custom fields. And we want to see a whole search result where we would return some of those custom fields not piled and trimmed by the Kendra highlight as it is right now.

An option to overcome this hurdle is to use a custom lambda hook and query Kendra API in a lambda hook. Thus we can tweak the output and return the results the way we want. It would be great to have this level of customazability in Kendra Fallback by default.

e-ndrus avatar Oct 17 '23 16:10 e-ndrus

+1 This will be great. We have Kendra as fallback and if we can use a custom lambda on the kendrafallback we can customize how the output would appear,

abilash44 avatar Nov 24 '23 08:11 abilash44