Building an Interactive Chatbot For Pre-Existing Questions with LLM Integration to Chat with multiple CSV Files
Author(s): Ganesh Bajaj
Originally published on Towards AI.
This member-only story is on us. Upgrade to access all of Medium.
Streamlit UI-Image Illustrated by AuthorThere are multiple types of Chatbots:
Rule Based ChatbotRAG Based ChatbotHybrid Chatbot
This article covers how to create a chatbot using streamlit that answers questions using a pre-existing question-answer dataset along with an LLM integration to a csv file. Basically, chatbot is hybrid type designed to handle both known and unknown questions. This article will give a good starting point with an understanding of how the chatbot would work with different types of output and error handling using streamlit.
Bot first trys to match the input to a saved question and, if no match is found, uses an LLM model to generate relevant responses.
Weβll walk through the steps to build this chatbot, highlighting key features such as similarity-based search, error handling, and LLM query support.
To make the chatbot quick and responsive, we store question-answer pairs in a json format so that they can be directly referenced when a user query is similar to any existing question.
The qna.json file contains a list of dictionaries, each with a question (query) and corresponding response data (response).
An example structure in qna.json might look like this:
[ { "query": "Enter your question here", "response":… Read the full blog for free on Medium.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.
Published via Towards AI