1

Basically, I have this code from the official documentation. What I'm trying to achieve is to get the list of question-answer pairs that are the closest to the user's input.

async def on_message_activity(self, turn_context: TurnContext):
    # The actual call to the QnA Maker service.
    response = await self.qna_maker.get_answers(turn_context)
    if response:
        await turn_context.send_activity(MessageFactory.text(response[0]))
    else:
        await turn_context.send_activity("No QnA Maker answers were found.")
  • 1
    what documentation? for botframework, azure-bot-service or qnamaker ? what pairs do you means. It get closest value it may need to `fuzzy` searching or it may need to use `Natural Language Processing` and `Machine Learning` (or `Neutral Network`) – furas Nov 25 '21 at 16:29
  • Can you please share the sample/document that you are trying. – Ram Nov 26 '21 at 12:14

2 Answers2

0

Here are the best practices reference for QnAMAker.

Ram
  • 2,459
  • 1
  • 7
  • 14
0

I found a solution after 3 hours. You just need to add QnAMakerOptions(top=10) in the __init__ method.

    def __init__(self, config: DefaultConfig):
        self.qna_maker = QnAMaker(
            QnAMakerEndpoint(
                knowledge_base_id=config.QNA_KNOWLEDGEBASE_ID,
                endpoint_key=config.QNA_ENDPOINT_KEY,
                host=config.QNA_ENDPOINT_HOST,
            ), QnAMakerOptions(
                top=10
            )
        )