Context generation for chat based Q&A bot

Hi, I’ve created an GTP-4 powered Q&A bot capable of answering questions about products. Bot is using knowledge base and embeddings mechanism to create a context for the GPT to answer the question. And it works great. I can ask questions like:

What is product A?
Which options does product A have?
How is product A different from product B?

Now I want to take my bot a step further and enable chat style conversation. For example:

What is product A?
How is it different from product B?

My problem here is how to create the context for the second question? For the first question it is clear: calculate embeddings for the question and select the closest topics from the knowledge base. Provide the context and the question to the GPT and answer will be generated.
Now I get the second question from the user. I provide the first question and the first answer to the GPT-4, followed by the second question and which context? How to select topics from the knowledge base that will cover both products A and B? Calculate embeddings for string containing both questions and select the closest topics from the KB?

The third question from the user could be “What is product C?”. This is unrelated question to the previous ones so context containing KB topics about only product C would be enough. You see where I’m going with this? I need an efficiant and effective strategy for creating context for the Q&A session taking into account previous questions if the last question is related to the previous conversation. Otherwise context can be related only to the last question.

Did anyone do this or think about how to do this? Any guidance will be much appreciated.

Mario

2 Likes

Hi # mstefanec,

I am trying to build my own bot with my own knowledge base. Any suggestion where to start? Are you using fine-tune or embeddings?

Any help would be appreciated.

Hi Daniel,

you can find a great guide explaining the main principle here:

When you understand the principle the rest is easy. My bot runs on Azure and uses MS Teams as a frontend.

Mario

hello …
did u find anything so far?
im trying to build my own chatbot and im stuck with the same problem…
if you found anything please share sum with me

Hi. @mmoulay47 I found a solution. Read chapter 5.1 in https://arxiv.org/pdf/2303.12712.pdf.

Mario