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.
There 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
Towards AI Academy
We Build Enterprise-Grade AI. We'll Teach You to Master It Too.
15 engineers. 100,000+ students. Towards AI Academy teaches what actually survives production.
Start free — no commitment:
→ 6-Day Agentic AI Engineering Email Guide — one practical lesson per day
→ Agents Architecture Cheatsheet — 3 years of architecture decisions in 6 pages
Our courses:
→ AI Engineering Certification — 90+ lessons from project selection to deployed product. The most comprehensive practical LLM course out there.
→ Agent Engineering Course — Hands on with production agent architectures, memory, routing, and eval frameworks — built from real enterprise engagements.
→ AI for Work — Understand, evaluate, and apply AI for complex work tasks.
Note: Article content contains the views of the contributing authors and not Towards AI.