User-Friendly Streamlit RAG Chatbot with Text-To-Speech: HuggingFace Embedding, OpenAI LLM, OpenAI Agent and LangChain

Hanan Tabak
9 min readMay 23, 2024
This is the chatbot UI on Streamlit ( Link )

In this article I’ll explain in detail how I constructed a Streamlit-based chatbot utilizing the Retrieval-Augmented Generation (RAG) architecture. The chatbot leverages OpenAI’s Large Language Models (LLMs) and agents, LangChain framework and Open-Source HuggingFace Embedding for context-aware conversation. Additionally, Text-to-Speech (TTS) capability is integrated to enhance user experience.

Before doing this, I’ll briefly explain the basic concepts of RAG for those who are still beginners in it (You can skip the next paragraph if you are familiar enough with it).

This chatbot is co-designed by Mayur Nawal and me, where Mayur went through all the hassle of creating the main design and making it work, while I added more functionalities and some modifications to it.

What is RAG?

Retrieval-Augmented Generation (RAG) is a powerful approach for building advanced chatbots that can answer questions from a specialized knowledge base which is not included in their training data corpus (like Corporate Data). It combines two key techniques: retrieval-based models and generative models. Retrieval-based models excel at efficiently searching through vast amounts of text data to…

--

--

Hanan Tabak

Sr. Data Scientist at e& | Gen AI | ML & AI CVM Analytics