Improve RAG chatbot

I am currently working on an AI chatbot that uses RAG to answer questions from a PDF. Here’s what I have done so far:

  1. user_message is the message the user sends to the bot. It uses RAG to retrieve relevant topics and send a response back to the user.
  2. For tracking message history for continuous conversation, I have added conversation history to a list.
  3. Since the system was using only the user’s message to retrieve relevant information, I thought it would be better to use both the chat history and the user’s message to retrieve relevant chunks.
  4. However, now there is an issue: If the conversation continues for a while, and I try to change the topic, the system still follows the previous conversation. The RAG pipeline continues fetching relevant information based on the previous conversation.

Is there a way to fix this issue?

you may want to use a session id with chat

1 Like