<?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: Daniel Nti Boakye</title>
    <description>The latest articles on DEV Community by Daniel Nti Boakye (@dartisan).</description>
    <link>https://dev.to/dartisan</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%2F524218%2F3b24f9f5-af7e-4266-97a6-dcfd708d20e3.jpg</url>
      <title>DEV Community: Daniel Nti Boakye</title>
      <link>https://dev.to/dartisan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dartisan"/>
    <language>en</language>
    <item>
      <title>How I Built a Local, Voice-Enabled AI Chatbot with LangChain and Ollama</title>
      <dc:creator>Daniel Nti Boakye</dc:creator>
      <pubDate>Sun, 06 Apr 2025 21:30:00 +0000</pubDate>
      <link>https://dev.to/dartisan/how-i-built-a-local-voice-enabled-ai-chatbot-with-langchain-and-ollama-dap</link>
      <guid>https://dev.to/dartisan/how-i-built-a-local-voice-enabled-ai-chatbot-with-langchain-and-ollama-dap</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Imagine ChatGPT — but offline, private, and trained on your own files.&lt;br&gt;&lt;br&gt;
No cloud, no API keys, no monthly fees.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's exactly what I built: a personal AI assistant that runs &lt;strong&gt;entirely on your computer&lt;/strong&gt;, with voice support, document understanding, and memory.&lt;/p&gt;




&lt;h3&gt;
  
  
  🔧 What It Does
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;Runs offline&lt;/strong&gt; using local models with &lt;a href="https://ollama.com/" rel="noopener noreferrer"&gt;Ollama&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📄 &lt;strong&gt;Understands uploaded documents&lt;/strong&gt; (PDF or TXT)&lt;/li&gt;
&lt;li&gt;🧠 &lt;strong&gt;Remembers your chat&lt;/strong&gt; and continues where you left off&lt;/li&gt;
&lt;li&gt;🎙️ &lt;strong&gt;Accepts voice input&lt;/strong&gt; (speak to it!)&lt;/li&gt;
&lt;li&gt;🔊 &lt;strong&gt;Replies out loud&lt;/strong&gt; using text-to-speech&lt;/li&gt;
&lt;li&gt;🎨 &lt;strong&gt;Customisable personality&lt;/strong&gt; through a simple UI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All running inside a sleek &lt;a href="https://streamlit.io/" rel="noopener noreferrer"&gt;Streamlit&lt;/a&gt; interface.&lt;/p&gt;




&lt;h3&gt;
  
  
  🛠 Tech Stack
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🧠 &lt;a href="https://python.langchain.com/" rel="noopener noreferrer"&gt;LangChain&lt;/a&gt; for chaining LLM logic, prompts, and memory&lt;/li&gt;
&lt;li&gt;🐍 Python backend&lt;/li&gt;
&lt;li&gt;🖥️ &lt;a href="https://ollama.com/" rel="noopener noreferrer"&gt;Ollama&lt;/a&gt; to run &lt;code&gt;mistral:7b&lt;/code&gt; and other open-source LLMs locally&lt;/li&gt;
&lt;li&gt;📚 FAISS for vector search + document retrieval&lt;/li&gt;
&lt;li&gt;📄 PyPDFLoader + TextLoader to process files&lt;/li&gt;
&lt;li&gt;🎤 SpeechRecognition for microphone input&lt;/li&gt;
&lt;li&gt;🔈 pyttsx3 for voice output&lt;/li&gt;
&lt;li&gt;🎨 Streamlit for real-time UI&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🖼️ Demo
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://shorturl.at/j36oQ" rel="noopener noreferrer"&gt;https://shorturl.at/j36oQ&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  ⚙️ How It Works
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Chat + Memory&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Conversations are saved to disk as JSON. Reload the app — it remembers you.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Document Q&amp;amp;A&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You can upload &lt;code&gt;.pdf&lt;/code&gt; or &lt;code&gt;.txt&lt;/code&gt; files. The app reads them, chunks the content, embeds it using Ollama embeddings, and uses FAISS to retrieve relevant context before responding.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Voice Input &amp;amp; Output&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click the 🎙️ button to speak.&lt;/li&gt;
&lt;li&gt;The assistant replies aloud using TTS.&lt;/li&gt;
&lt;li&gt;Both features are toggleable in the sidebar.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Custom Personality&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You can modify the assistant’s tone with a system prompt (e.g., “You are a sarcastic genius.” 😏)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  💡 What I Learned
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;How to build a full offline AI assistant from scratch&lt;/li&gt;
&lt;li&gt;How to integrate speech recognition + TTS in a web app&lt;/li&gt;
&lt;li&gt;How to handle multi-turn memory using LangChain&lt;/li&gt;
&lt;li&gt;How to combine document loaders, embeddings, and retrieval in one pipeline&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  📦 Want to Try It?
&lt;/h3&gt;

&lt;p&gt;This project is fully open-source. You can find the code and setup instructions here:&lt;/p&gt;

&lt;p&gt;👉 [GitHub Repo Link – &lt;a href="https://github.com/D-artisan/ai-chatbot" rel="noopener noreferrer"&gt;https://github.com/D-artisan/ai-chatbot&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;You’ll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Ollama installed and a model pulled (e.g., &lt;code&gt;ollama pull mistral&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;A mic + speakers if you want voice&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🚀 Future Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;📂 Multi-file upload support
&lt;/li&gt;
&lt;li&gt;🧾 Summarise documents before chat
&lt;/li&gt;
&lt;li&gt;📜 Export conversations
&lt;/li&gt;
&lt;li&gt;🌐 LAN deployment to access from any device&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  👋 Final Thoughts
&lt;/h3&gt;

&lt;p&gt;This was a fun, hands-on way to get deeper into the LLM ecosystem — especially offline tools like Ollama and LangChain.&lt;/p&gt;

&lt;p&gt;Let me know what you’d build with a chatbot like this — or if you’d like a guided version to follow along!&lt;/p&gt;




&lt;h3&gt;
  
  
  🔗 Connect With Me
&lt;/h3&gt;

&lt;p&gt;Let’s chat on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/D-artisan" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/danielnb/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;#AI #LangChain #LLM #Chatbot #Python #Ollama #VoiceAI #Streamlit #OpenSource&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
    </item>
  </channel>
</rss>
