Chatbot Reply Suggestions

Hi, I have a dataset that consists of questions and answers pairs. Each question can have multiple answers. I want to create a chatbot that receives a question from the user as an input and returns the top K frequent replies to that matches the question the user asked. Is it possible to do so in Rasa?

@yanagar25 Hi! Is your K frequent replies will be fixed or will varies as per user question.

@nik202 They will vary per user question (from the most similar questions to the user’s input)

@yanagar25 means, if related questions have 10 response, then you planning to show all to the user screen? Or did you decided to fixed the value of K=3 or 4 based on per question? Or are you planning to use APIs for your use case?

It will be k=3

@yanagar25 Your database are in SQL or Excel or other? please mention @ and then my alias

@nik202 it is a json file that contains an array of objects:

{“question”: “how are you?”, “answer”: “i’m good thank you”}

@yanagar25 Perfect, as APIs also work in JSON, you can write the code and fixed the key-value pair for the same.

@yanagar25 Can you share me JSON example, 1 questions and 3 answers?

@yanagar25 When you say top K frequent replies, how you manage to select k=3 from 10 response in your dataset or it will be top 3 or any random replies?

@nik202 here is an example for my JSON of 1 question and answers:

{
    "question": "how are you?",
    "answers": ["i'm good and you?", "i'm good and you?", "i'm fine and you?", "everything great"]
}

In this example: “i’m good and you?” appears twice but i will only take it as one but this suggestion of an answer will appear as the first suggestion since it is most frequent then it will follow by “i’m fine and you?” and “everything great” so basically the most frequent ones will be at the top then the rest of the answers will come.

@yanagar25 did you get the solution for this?