<?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: Michael Lynn</title>
    <description>The latest articles on DEV Community by Michael Lynn (@michael_lynn_a7c09439545e).</description>
    <link>https://dev.to/michael_lynn_a7c09439545e</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%2F1563453%2F77c05a37-71e3-4a09-b96b-013d93bae6db.png</url>
      <title>DEV Community: Michael Lynn</title>
      <link>https://dev.to/michael_lynn_a7c09439545e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/michael_lynn_a7c09439545e"/>
    <language>en</language>
    <item>
      <title>Build a RAG-Enabled Helpdesk Chatbot in 10 Minutes with MongoDB</title>
      <dc:creator>Michael Lynn</dc:creator>
      <pubDate>Sat, 15 Feb 2025 16:09:13 +0000</pubDate>
      <link>https://dev.to/michael_lynn_a7c09439545e/build-a-rag-enabled-helpdesk-chatbot-in-10-minutes-with-mongodb-4m52</link>
      <guid>https://dev.to/michael_lynn_a7c09439545e/build-a-rag-enabled-helpdesk-chatbot-in-10-minutes-with-mongodb-4m52</guid>
      <description>&lt;p&gt;Oh no... another RAG tutorial... right?&lt;/p&gt;

&lt;p&gt;Hold on... this one's different.  I'm going to show you how to get started with a RAG enabled chatbot app with a brand-new library created specifically to take the pain out of developing a RAG enabled Chatbot. &lt;/p&gt;

&lt;p&gt;The best part? You'll have it up and running in &lt;strong&gt;less than 10 minutes!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Prefer to watch?  Checkout the &lt;a href="https://youtu.be/8PTATSNl1WU" rel="noopener noreferrer"&gt;Video Walkthrough here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Before we begin, if you need more information about RAG, check out &lt;a href="https://www.mongodb.com/resources/basics/artificial-intelligence/retrieval-augmented-generation" rel="noopener noreferrer"&gt;this article&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;As part of my job as a Developer Advocate at MongoDB, I help customers make the best use of software, and data including MongoDB. A common request I encounter is around customers wanting to create an intelligent chatbot that knows the specifics of their company, customers, and personalization.  This is a perfect use-case for Retrieval Augmented Generation, or RAG.  To simplify the process, I've created a &lt;a href="https://npmjs.com/package/mongodb-rag" rel="noopener noreferrer"&gt;new library&lt;/a&gt; that will help developers create and deploy a custom RAG enabled chatbot in about 10 minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What We're Building
&lt;/h2&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2F37v8ssajsg4zxl9ucqfy.png" class="article-body-image-wrapper"&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%2Farticles%2F37v8ssajsg4zxl9ucqfy.png" alt="MongoDB-RAG Helpdesk Chatbot" width="680" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We'll create a &lt;strong&gt;modern helpdesk application&lt;/strong&gt; that includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A sleek React frontend&lt;/strong&gt; with a search interface
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A robust Express backend API&lt;/strong&gt; for processing queries
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RAG-powered vector search&lt;/strong&gt; using &lt;strong&gt;MongoDB Atlas Vector Search&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easy document ingestion&lt;/strong&gt; for helpdesk articles
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Automatic vector embedding generation&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;By the end, your chatbot will retrieve the &lt;strong&gt;most relevant support articles&lt;/strong&gt; using &lt;strong&gt;semantic search&lt;/strong&gt;!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we dive in, ensure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Node.js&lt;/strong&gt; installed on your machine&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;MongoDB Atlas&lt;/strong&gt; account (&lt;a href="https://mdb.link/rag-signup" rel="noopener noreferrer"&gt;Sign up for free&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;OpenAI API key&lt;/strong&gt; for generating embeddings&lt;/li&gt;
&lt;li&gt;Basic familiarity with &lt;strong&gt;JavaScript &amp;amp; Node.js&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Set Up MongoDB Atlas (3 minutes)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Create a Free Atlas Cluster
&lt;/h3&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Favbe7s1p120nvx7g6bge.png" class="article-body-image-wrapper"&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%2Farticles%2Favbe7s1p120nvx7g6bge.png" alt="MongoDB Atlas" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://www.mongodb.com/cloud/atlas" rel="noopener noreferrer"&gt;MongoDB Atlas&lt;/a&gt; and &lt;strong&gt;sign in&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;"Create"&lt;/strong&gt; to deploy a new cluster&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;FREE (M0)&lt;/strong&gt; tier&lt;/li&gt;
&lt;li&gt;Choose your preferred cloud provider and region&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;"Create Cluster"&lt;/strong&gt; and wait for deployment&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  2. Configure Database Access
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;"Database Access"&lt;/strong&gt; under the security tab&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;"Add New Database User"&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Password Authentication&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Set a &lt;strong&gt;secure username and password&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Assign &lt;strong&gt;"Read and write to any database"&lt;/strong&gt; permissions&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  3. Set Network Access
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;"Network Access"&lt;/strong&gt; and click &lt;strong&gt;"Add IP Address"&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;"Allow Access from Anywhere"&lt;/strong&gt; (for development)&lt;/li&gt;
&lt;li&gt;Confirm and wait for the change to propagate&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  4. Get Your Connection String
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;"Connect"&lt;/strong&gt; on your cluster&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;"Connect your application"&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Copy the &lt;strong&gt;connection string&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;&amp;lt;password&amp;gt;&lt;/code&gt; with your actual password&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 2: Configure Your Environment
&lt;/h2&gt;

&lt;p&gt;First, initialize your mongodb-rag configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx mongodb-rag init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a &lt;code&gt;.mongodb-rag.json&lt;/code&gt; file with settings like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mongoUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mongodb+srv://your_user:your_password@your-cluster.mongodb.net/mongorag"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"database"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"helpdesk"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"collection"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"articles"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"embedding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"openai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apiKey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your-embedding-api-key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"text-embedding-3-small"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"dimensions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1536&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"search"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"maxResults"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"minScore"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"indexName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vector_index"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then convert it to environment variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx mongodb-rag create-env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a &lt;code&gt;.env&lt;/code&gt; file with the correct variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MONGODB_URI=mongodb+srv://your_user:your_password@your-cluster.mongodb.net/mongorag
MONGODB_DATABASE=helpdesk
MONGODB_COLLECTION=articles
PORT=4001

# Embedding Configuration
EMBEDDING_PROVIDER=openai
EMBEDDING_API_KEY=your-embedding-api-key
EMBEDDING_MODEL=text-embedding-3-small
EMBEDDING_DIMENSIONS=1536

# Vector Search Configuration
VECTOR_INDEX=vector_index
MAX_RESULTS=5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Create a Vector Search Index (1 minute)
&lt;/h2&gt;

&lt;p&gt;You have two options for creating your vector search index:&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1: Using the CLI (Recommended)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx mongodb-rag create-index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an index optimized for OpenAI's text-embedding-3-small model&lt;/li&gt;
&lt;li&gt;Configure proper dimensions (1536) and similarity metrics (cosine)&lt;/li&gt;
&lt;li&gt;Handle any existing index conflicts&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Option 2: Using Atlas UI
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to your cluster in Atlas&lt;/li&gt;
&lt;li&gt;Click "Browse Collections"&lt;/li&gt;
&lt;li&gt;Click the "Search" tab&lt;/li&gt;
&lt;li&gt;Click "Create Search Index"&lt;/li&gt;
&lt;li&gt;Choose "JSON Editor" and select "Atlas Vector Search" &lt;/li&gt;
&lt;li&gt;Use this configuration:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vector_index"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vectorSearch"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"definition"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"fields"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vector"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"embedding"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"numDimensions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1536&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"similarity"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cosine"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Deploy Your Helpdesk Chatbot
&lt;/h2&gt;

&lt;p&gt;Generate your application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx mongodb-rag create-rag-app my-helpdesk
&lt;span class="nb"&gt;cd &lt;/span&gt;my-helpdesk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your application will be structured as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-helpdesk/
├── frontend/           # React frontend
│   ├── src/
│   │   ├── components/
│   │   ├── App.jsx
│   │   └── main.jsx
├── backend/           # Express backend
│   ├── config/
│   ├── server.js
│   └── package.json
└── package.json      # Root workspace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install dependencies and start the servers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will start:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frontend at &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Backend API at &lt;a href="http://localhost:4001" rel="noopener noreferrer"&gt;http://localhost:4001&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 5: Add Your Helpdesk Documents
&lt;/h2&gt;

&lt;p&gt;Create a &lt;code&gt;helpdesk-docs&lt;/code&gt; directory with markdown files for common IT support issues.  Here are some samples - but you should feel free to create your own, or use your company's helpdesk documents.  Let's stick to markdown for this example implementation... but know that mongodb-rag supports ingestion of PDF documents. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;wifi-connection.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### Wi-Fi Connection Issues&lt;/span&gt;

&lt;span class="gs"&gt;**Issue:**&lt;/span&gt; My Wi-Fi is not working.

&lt;span class="gs"&gt;**Solution:**&lt;/span&gt;
&lt;span class="p"&gt;1.&lt;/span&gt; Restart your router and modem
&lt;span class="p"&gt;2.&lt;/span&gt; Check if other devices can connect
&lt;span class="p"&gt;3.&lt;/span&gt; Forget the Wi-Fi network and reconnect
&lt;span class="p"&gt;4.&lt;/span&gt; If the issue persists, contact your ISP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;password-reset.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### Password Reset Guide&lt;/span&gt;

&lt;span class="gs"&gt;**Issue:**&lt;/span&gt; I forgot my password.

&lt;span class="gs"&gt;**Solution:**&lt;/span&gt;
&lt;span class="p"&gt;1.&lt;/span&gt; Go to the login page and click "Forgot Password?"
&lt;span class="p"&gt;2.&lt;/span&gt; Enter your registered email address
&lt;span class="p"&gt;3.&lt;/span&gt; Check your email for a password reset link
&lt;span class="p"&gt;4.&lt;/span&gt; Click the link and enter a new password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;software-install.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### Software Installation Issues&lt;/span&gt;

&lt;span class="gs"&gt;**Issue:**&lt;/span&gt; I can't install the application.

&lt;span class="gs"&gt;**Solution:**&lt;/span&gt;
&lt;span class="p"&gt;1.&lt;/span&gt; Ensure your device meets the system requirements
&lt;span class="p"&gt;2.&lt;/span&gt; Check if you have administrator privileges
&lt;span class="p"&gt;3.&lt;/span&gt; Disable any antivirus software temporarily
&lt;span class="p"&gt;4.&lt;/span&gt; Try reinstalling the application
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Ingest the Documents
&lt;/h3&gt;

&lt;p&gt;Use the CLI to ingest all documents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx mongodb-rag ingest &lt;span class="nt"&gt;--directory&lt;/span&gt; ./helpdesk-docs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or use the API for programmatic ingestion:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:4001/api/ingest&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;documents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wifi-help&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;readFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./helpdesk-docs/wifi-connection.md&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;utf8&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;category&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;network&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wifi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔍 Step 6: Test Your Chatbot
&lt;/h2&gt;

&lt;p&gt;Try searching through the frontend interface or use the CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx mongodb-rag search &lt;span class="s2"&gt;"wifi not connecting"&lt;/span&gt;
npx mongodb-rag search &lt;span class="s2"&gt;"how to reset password"&lt;/span&gt;
npx mongodb-rag search &lt;span class="s2"&gt;"software installation failed"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Available API endpoints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;GET /api/search?query=&amp;lt;text&amp;gt;&lt;/code&gt; - Search documents&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;POST /api/ingest&lt;/code&gt; - Ingest new documents&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DELETE /api/documents/:id&lt;/code&gt; - Remove documents&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GET /api/health&lt;/code&gt; - Health check endpoint&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔧 Troubleshooting
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Vector Index Creation Failures
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Invalid Index Definition&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error: "Invalid index specification"&lt;/li&gt;
&lt;li&gt;Solution: Double-check your index JSON syntax. The most common issues are:

&lt;ul&gt;
&lt;li&gt;Missing &lt;code&gt;type": "vectorSearch"&lt;/code&gt; field&lt;/li&gt;
&lt;li&gt;Incorrect nesting of &lt;code&gt;fields&lt;/code&gt; array&lt;/li&gt;
&lt;li&gt;Wrong similarity metric spelling&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dimension Mismatch&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error: "Vector dimensions do not match index definition"&lt;/li&gt;
&lt;li&gt;Solution: Ensure your vector dimensions match your embedding model's output (1536 for text-embedding-3-small)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Permission Issues&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error: "Insufficient permissions to create index"&lt;/li&gt;
&lt;li&gt;Solution: Ensure you have Project Data Access Admin or higher role&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Ingestion Issues
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Embedding Generation Failures&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error: "Failed to generate embeddings"&lt;/li&gt;
&lt;li&gt;Solution: 

&lt;ul&gt;
&lt;li&gt;Verify your OpenAI API key is valid&lt;/li&gt;
&lt;li&gt;Check OpenAI service status&lt;/li&gt;
&lt;li&gt;Ensure text content is within token limits&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Batch Processing Errors&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error: "Batch ingestion failed"&lt;/li&gt;
&lt;li&gt;Solution:

&lt;ul&gt;
&lt;li&gt;Reduce batch size&lt;/li&gt;
&lt;li&gt;Check for malformed documents&lt;/li&gt;
&lt;li&gt;Verify network connectivity&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Search Issues
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;No Results Returned&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Possible causes:

&lt;ul&gt;
&lt;li&gt;Vector index still building (check status)&lt;/li&gt;
&lt;li&gt;Query vector dimensions don't match&lt;/li&gt;
&lt;li&gt;Similarity score threshold too high&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Solution: Monitor index status and verify query parameters&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Performance Issues&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If searches are slow:

&lt;ul&gt;
&lt;li&gt;Verify index is built and active&lt;/li&gt;
&lt;li&gt;Check your &lt;code&gt;numCandidates&lt;/code&gt; setting&lt;/li&gt;
&lt;li&gt;Consider adjusting &lt;code&gt;maxResults&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;To enhance your chatbot, consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding authentication for admin functions&lt;/li&gt;
&lt;li&gt;Implementing conversation history&lt;/li&gt;
&lt;li&gt;Adding support for file uploads&lt;/li&gt;
&lt;li&gt;Customizing the chunking strategy for your documents&lt;/li&gt;
&lt;li&gt;Setting up automated document ingestion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://mongodb-developer.github.io/mongodb-rag" rel="noopener noreferrer"&gt;MongoDB RAG Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mongodb-developer/mongodb-rag" rel="noopener noreferrer"&gt;MongoDB RAG GitHub Repo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mongodb.com/docs/atlas/atlas-vector-search/" rel="noopener noreferrer"&gt;MongoDB Vector Search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://platform.openai.com/docs/guides/embeddings" rel="noopener noreferrer"&gt;OpenAI Embeddings&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;In just about 10 minutes, we've built a professional, full-stack helpdesk chatbot that leverages the power of MongoDB Atlas Vector Search and RAG architecture. The mongodb-rag library and CLI tools make it incredibly easy to get started, while providing the flexibility to customize and enhance your application as needed.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed this... if you have ideas for enhancements to the &lt;a href="https://npmjs.com/package/mongodb-rag" rel="noopener noreferrer"&gt;mongodb-rag NPM library&lt;/a&gt;, please reach out - you can find me on &lt;a href="https://linkedin.com/in/mlynn" rel="noopener noreferrer"&gt;linkedIn&lt;/a&gt;!&lt;/p&gt;




&lt;p&gt;Have you built something similar? Share your experience in the comments below! And don't forget to follow for more tutorials on MongoDB, AI, and web development.&lt;/p&gt;

</description>
      <category>rag</category>
      <category>ai</category>
      <category>vectordatabase</category>
      <category>mongodb</category>
    </item>
  </channel>
</rss>
