<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Harith Y</title>
    <description>The latest articles on DEV Community by Harith Y (@harith_y_a97ea256afe8255f).</description>
    <link>https://dev.to/harith_y_a97ea256afe8255f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3196799%2Fd708787d-ccb2-4a56-a1da-f86fd8c86618.png</url>
      <title>DEV Community: Harith Y</title>
      <link>https://dev.to/harith_y_a97ea256afe8255f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harith_y_a97ea256afe8255f"/>
    <language>en</language>
    <item>
      <title>New Project</title>
      <dc:creator>Harith Y</dc:creator>
      <pubDate>Thu, 24 Jul 2025 17:01:02 +0000</pubDate>
      <link>https://dev.to/harith_y_a97ea256afe8255f/new-project-564e</link>
      <guid>https://dev.to/harith_y_a97ea256afe8255f/new-project-564e</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/harith_y_a97ea256afe8255f/rag-chatbot-moviesgpt-15mm" class="crayons-story__hidden-navigation-link"&gt;RAG Chatbot - MoviesGPT&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/harith_y_a97ea256afe8255f" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3196799%2Fd708787d-ccb2-4a56-a1da-f86fd8c86618.png" alt="harith_y_a97ea256afe8255f profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/harith_y_a97ea256afe8255f" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Harith Y
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Harith Y
                &lt;a href="/++"&gt;&lt;img alt="Subscriber" class="subscription-icon" src="https://assets.dev.to/assets/subscription-icon-805dfa7ac7dd660f07ed8d654877270825b07a92a03841aa99a1093bd00431b2.png"&gt;&lt;/a&gt;
              
              &lt;div id="story-author-preview-content-2720511" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/harith_y_a97ea256afe8255f" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3196799%2Fd708787d-ccb2-4a56-a1da-f86fd8c86618.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Harith Y&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/harith_y_a97ea256afe8255f/rag-chatbot-moviesgpt-15mm" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Jul 24 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/harith_y_a97ea256afe8255f/rag-chatbot-moviesgpt-15mm" id="article-link-2720511"&gt;
          RAG Chatbot - MoviesGPT
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/rag"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;rag&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/ai"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;ai&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/chatbot"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;chatbot&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/llm"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;llm&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/harith_y_a97ea256afe8255f/rag-chatbot-moviesgpt-15mm#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            2 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>rag</category>
      <category>ai</category>
      <category>chatbot</category>
      <category>llm</category>
    </item>
    <item>
      <title>RAG Chatbot - MoviesGPT</title>
      <dc:creator>Harith Y</dc:creator>
      <pubDate>Thu, 24 Jul 2025 17:00:51 +0000</pubDate>
      <link>https://dev.to/harith_y_a97ea256afe8255f/rag-chatbot-moviesgpt-15mm</link>
      <guid>https://dev.to/harith_y_a97ea256afe8255f/rag-chatbot-moviesgpt-15mm</guid>
      <description>&lt;h2&gt;
  
  
  What is RAG?
&lt;/h2&gt;

&lt;p&gt;Retrieval-Augmented Generation or RAG is when you change the output of a Large Language Model (LLM) by providing the model more context alongside a user’s input. That way, the model can use its ability to generate text along with extra context to provide accurate answers to users’ questions&lt;/p&gt;

&lt;h3&gt;
  
  
  Why is RAG useful?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Cost Effective&lt;/li&gt;
&lt;li&gt;Models have cut-off dates, after which knowledge isn’t updated.&lt;/li&gt;
&lt;li&gt;Covers up for information that does not exist&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Vector Embedding?
&lt;/h2&gt;

&lt;p&gt;A popular technique to represent information in a format that algorithms, especially deep learning models, can easily process. This ‘information’ can be text, pictures, video or audio.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step-by-step workflow of MoviesGPT
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Data Collection (Wikipedia Scraping)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The project uses Puppeteer (via LangChain) to scrape Wikipedia pages containing lists of movies in various Indian languages for the year 2025.&lt;/li&gt;
&lt;li&gt;Each Wikipedia page’s content is fetched and cleaned of HTML tags.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Text Chunking
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The scraped content is split into manageable chunks using a text splitter (RecursiveCharacterTextSplitter).&lt;/li&gt;
&lt;li&gt;This ensures each chunk is of optimal size for embedding and storage.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Embedding Generation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Each text chunk is sent to NVIDIA’s embedding API (&lt;code&gt;nvidia/nv-embedqa-e5-v5&lt;/code&gt; model) to generate a high-dimensional vector representation.&lt;/li&gt;
&lt;li&gt;These embeddings capture the semantic meaning of each chunk.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Database Storage (AstraDB)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The vector embeddings and their corresponding text chunks are stored in AstraDB, a vector database.&lt;/li&gt;
&lt;li&gt;The database is set up to support efficient similarity search using the chosen metric (e.g., dot product).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  User Interaction (Frontend)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Users interact with a chat interface built with Next.js.&lt;/li&gt;
&lt;li&gt;When a user submits a question, it is sent to the backend API.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Query Embedding &amp;amp; Context Retrieval
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The backend generates an embedding for the user’s question using the same NVIDIA model.&lt;/li&gt;
&lt;li&gt;It then queries AstraDB for the most similar text chunks (context) based on vector similarity to the question embedding.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Prompt Construction
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The retrieved context is formatted and combined with the user’s question to create a system prompt.&lt;/li&gt;
&lt;li&gt;This prompt instructs the AI to use the provided context to answer the question, but to fall back on its own knowledge if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AI Response Generation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The prompt and chat history are sent to OpenRouter’s chat API (using a model like &lt;code&gt;deepseek/deepseek-chat&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The AI generates a streaming response, which is sent back to the frontend in real time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  User Receives Answer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The user sees the AI’s answer in the chat interface, formatted in markdown for readability.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Workflow Diagram (Textual)
&lt;/h2&gt;

&lt;p&gt;Wikipedia Pages&lt;br&gt;
       ↓&lt;br&gt;
[Scraping &amp;amp; Cleaning]&lt;br&gt;
         ↓&lt;br&gt;
[Text Chunking]&lt;br&gt;
       ↓&lt;br&gt;
[Embedding Generation]&lt;br&gt;
         ↓&lt;br&gt;
[AstraDB Storage]&lt;br&gt;
          ↓&lt;br&gt;
(User asks a question)&lt;br&gt;
          ↓&lt;br&gt;
[Question Embedding]&lt;br&gt;
          ↓&lt;br&gt;
[Vector Search in AstraDB]&lt;br&gt;
             ↓&lt;br&gt;
[Relevant Context Retrieved]&lt;br&gt;
             ↓&lt;br&gt;
[Prompt Construction]&lt;br&gt;
           ↓&lt;br&gt;
[OpenRouter AI Chat Completion]&lt;br&gt;
               ↓&lt;br&gt;
[Streaming Response to User]&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend&lt;/strong&gt;: Handles scraping, embedding, storage, and retrieval.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend&lt;/strong&gt;: Provides a chat interface for users using NextJS via TypeScript.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI Models&lt;/strong&gt;: NVIDIA for embeddings, OpenRouter for chat.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database&lt;/strong&gt;: AstraDB for vector search and storage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This workflow ensures that MoviesGPT can answer movie-related questions with up-to-date, contextually relevant information, providing a seamless and intelligent user experience.&lt;/p&gt;




&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/Harith-Y/MoviesGPT" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;br&gt;
Demo: &lt;a href="https://movies-gpt-pi.vercel.app/" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rag</category>
      <category>ai</category>
      <category>chatbot</category>
      <category>llm</category>
    </item>
    <item>
      <title>New project</title>
      <dc:creator>Harith Y</dc:creator>
      <pubDate>Thu, 24 Jul 2025 16:51:47 +0000</pubDate>
      <link>https://dev.to/harith_y_a97ea256afe8255f/new-project-5dce</link>
      <guid>https://dev.to/harith_y_a97ea256afe8255f/new-project-5dce</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/harith_y_a97ea256afe8255f/i-built-a-supercharged-pdfs-chatbot-with-langchain-and-streamlit-and-you-can-too-1h1" class="crayons-story__hidden-navigation-link"&gt;I built a Supercharged PDFs-ChatBot with LangChain and Streamlit, and you can too!&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/harith_y_a97ea256afe8255f" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3196799%2Fd708787d-ccb2-4a56-a1da-f86fd8c86618.png" alt="harith_y_a97ea256afe8255f profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/harith_y_a97ea256afe8255f" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Harith Y
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Harith Y
                &lt;a href="/++"&gt;&lt;img alt="Subscriber" class="subscription-icon" src="https://assets.dev.to/assets/subscription-icon-805dfa7ac7dd660f07ed8d654877270825b07a92a03841aa99a1093bd00431b2.png"&gt;&lt;/a&gt;
              
              &lt;div id="story-author-preview-content-2720497" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/harith_y_a97ea256afe8255f" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3196799%2Fd708787d-ccb2-4a56-a1da-f86fd8c86618.png" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Harith Y&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/harith_y_a97ea256afe8255f/i-built-a-supercharged-pdfs-chatbot-with-langchain-and-streamlit-and-you-can-too-1h1" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Jul 24 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/harith_y_a97ea256afe8255f/i-built-a-supercharged-pdfs-chatbot-with-langchain-and-streamlit-and-you-can-too-1h1" id="article-link-2720497"&gt;
          I built a Supercharged PDFs-ChatBot with LangChain and Streamlit, and you can too!
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/langchain"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;langchain&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/streamlit"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;streamlit&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/ai"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;ai&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/chatbot"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;chatbot&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
            &lt;a href="https://dev.to/harith_y_a97ea256afe8255f/i-built-a-supercharged-pdfs-chatbot-with-langchain-and-streamlit-and-you-can-too-1h1#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              2&lt;span class="hidden s:inline"&gt; comments&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            4 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>langchain</category>
      <category>streamlit</category>
      <category>ai</category>
      <category>chatbot</category>
    </item>
    <item>
      <title>I built a Supercharged PDFs-ChatBot with LangChain and Streamlit, and you can too!</title>
      <dc:creator>Harith Y</dc:creator>
      <pubDate>Thu, 24 Jul 2025 16:49:45 +0000</pubDate>
      <link>https://dev.to/harith_y_a97ea256afe8255f/i-built-a-supercharged-pdfs-chatbot-with-langchain-and-streamlit-and-you-can-too-1h1</link>
      <guid>https://dev.to/harith_y_a97ea256afe8255f/i-built-a-supercharged-pdfs-chatbot-with-langchain-and-streamlit-and-you-can-too-1h1</guid>
      <description>&lt;p&gt;A step-by-step journey into building a flexible, multi-provider RAG application that lets you talk to your documents.&lt;/p&gt;

&lt;p&gt;We’ve all been there: staring at a 100-page PDF, knowing the answer to our question is buried somewhere inside. Skimming through dense academic papers, legal documents, or technical manuals is a tedious process. What if you could just… ask the document a question and get a straight answer instead of doing Ctrl+F multiple times?&lt;/p&gt;

&lt;p&gt;That’s exactly what I set out to build: an interactive chatbot that ingests any PDF (not 1 but many hehe) and allows you to have a natural conversation with it.&lt;/p&gt;

&lt;p&gt;In this post, I’ll walk you through how I built this PDFs-ChatBot using the power of Streamlit for the UI and LangChain for the AI orchestration. More importantly, I’ll show you how I designed it to be incredibly flexible, allowing users to switch between different AI providers like Google Gemini, Cohere, and NVIDIA on the fly.&lt;/p&gt;

&lt;p&gt;You can find the full source code on &lt;a href="https://github.com/Harith-Y/PDFs-ChatBot" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Also, try it out &lt;a href="https://pdfs-chatbot.streamlit.app/" rel="noopener noreferrer"&gt;Here&lt;/a&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  The Core Idea: Retrieval-Augmented Generation (RAG)
&lt;/h2&gt;

&lt;p&gt;The magic behind this application is a technique called Retrieval-Augmented Generation (RAG). Instead of just relying on a Large Language Model’s (LLM) general knowledge, we give it access to specific information from our documents.&lt;/p&gt;

&lt;p&gt;Here’s the workflow in a nutshell:&lt;/p&gt;

&lt;h3&gt;
  
  
  Indexing (The “Library”):
&lt;/h3&gt;

&lt;p&gt;First, we process the PDFs and create a searchable knowledge library.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Load &amp;amp; Split&lt;/strong&gt;: The text from the PDFs is extracted and broken down into smaller, manageable chunks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Embed&lt;/strong&gt;: Each chunk is converted into a numerical representation called an “embedding” using a model (like Google’s &lt;code&gt;embedding-001&lt;/code&gt; or NVIDIA’s &lt;code&gt;nv-embedqa-e5-v5&lt;/code&gt;, or any other model. The Project supports dynamic addition of LLMs). These embeddings capture the semantic meaning of the text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Store&lt;/strong&gt;: These embeddings are stored in a specialized database called a vector store (I’m using FAISS), which is incredibly fast at finding similar vectors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Retrieval &amp;amp; Generation (The “Conversation”):
&lt;/h3&gt;

&lt;p&gt;When you ask a question:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your question is also converted into an embedding (Make sure to use the same Embedding model used for processing the PDFs for obtaining optimal results).&lt;/li&gt;
&lt;li&gt;The vector store finds the text chunks from the PDF that are most semantically similar to your question.&lt;/li&gt;
&lt;li&gt;Finally, your question and these relevant chunks are passed to an LLM (like Gemini or Cohere) with a prompt like: “Based on the following context, answer this question: [Your Question] [Relevant Chunks]”.&lt;/li&gt;
&lt;li&gt;The LLM generates a coherent, context-aware answer.
This approach ensures the answers are grounded in the document’s content, dramatically reducing hallucinations and providing accurate, relevant information.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Architecting for Flexibility: The Factory Pattern
&lt;/h2&gt;

&lt;p&gt;One of my main goals was to avoid being locked into a single AI provider. I wanted the freedom to experiment with different models. To achieve this, I used a simple but powerful software design pattern: the Factory Pattern.&lt;/p&gt;

&lt;p&gt;Instead of cluttering my main app.py with model initialisation logic, I created separate files: &lt;code&gt;llm_providers.py&lt;/code&gt; and &lt;code&gt;embedding_providers.py&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# llm_providers.py

import os
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain.llms import Cohere, HuggingFaceHub

# The “Factory” dictionary
llm_providers = {
# Helper function for Initializing and returning the Google Gemini LLM.
‘gemini’: _get_gemini_llm,
# Helper function for Initializing and returning the Cohere LLM.
‘cohere’: _get_cohere_llm
}

# The main factory function
def get_llm(model_choice: str):
“””
Factory function to select and initialize the chosen LLM.
“””
return llm_providers[model_choice]()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This design keeps my code clean and modular. Adding a new LLM provider is as simple as adding a new helper function and one line to the dictionary.&lt;/p&gt;




&lt;h2&gt;
  
  
  Building the UI with Streamlit
&lt;/h2&gt;

&lt;p&gt;Streamlit is a game-changer for building interactive data and AI applications in Python. It allowed me to create a polished user interface with minimal code.&lt;/p&gt;

&lt;p&gt;The sidebar is the control center of the application.&lt;/p&gt;

&lt;p&gt;A key part of making a Streamlit app feel seamless is managing its state. I used &lt;code&gt;st.session_state&lt;/code&gt; extensively to store the conversation history, the user’s model choices, and the main conversation chain object, ensuring they persist between user interactions.&lt;/p&gt;

&lt;p&gt;For the chat bubbles, I used a little custom CSS and HTML templating to create a familiar and visually appealing chat experience.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts and Next Steps
&lt;/h2&gt;

&lt;p&gt;Building this PDF-ChatBot was an incredibly rewarding experience. It clarified the RAG pipeline and highlighted the importance of clean, modular code when working with rapidly evolving AI technologies. Of course, I had the trouble of going through multiple Documentations, I’m not an expert either!&lt;/p&gt;

&lt;p&gt;The final application is a powerful tool that not only works well but is also easy to extend. Here are a few ideas for future improvements (Maybe any of you could create a PR, I would be very much happy to accept it :D):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Displaying Sources&lt;/strong&gt;: Highlighting which parts of the PDF were used to generate an answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More Vector Stores&lt;/strong&gt;: Adding support for other vector databases like Chroma or Pinecone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment&lt;/strong&gt;: Packaging the application in Docker and deploying it to the cloud.
If you’re looking to get your hands dirty with building practical LLM applications, I highly encourage you to try building a project like this. It’s a fantastic way to learn the fundamentals of the modern AI stack along with scouring the internet, looking through docs and stack overflow!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading! Feel free to check out the project on GitHub and build your own.&lt;/p&gt;

</description>
      <category>langchain</category>
      <category>streamlit</category>
      <category>ai</category>
      <category>chatbot</category>
    </item>
  </channel>
</rss>
