<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Gatsby Starter Blog RSS Feed]]></title><description><![CDATA[Silversoftwerks' Tutorials and Blog]]></description><link>https://blog.silversoftwerks.com</link><generator>GatsbyJS</generator><lastBuildDate>Tue, 31 Oct 2023 01:15:53 GMT</lastBuildDate><item><title><![CDATA[Personal Knowledge Search]]></title><description><![CDATA[How to Create an AI Chatbot Using a Personal Knowledge Base in Just 20 Minutes In the age of information, having instant access to knowledge…]]></description><link>https://blog.silversoftwerks.com/personal-knowledge-search/</link><guid isPermaLink="false">https://blog.silversoftwerks.com/personal-knowledge-search/</guid><pubDate>Mon, 16 Oct 2023 03:51:15 GMT</pubDate><content:encoded>&lt;p&gt;&lt;strong&gt;How to Create an AI Chatbot Using a Personal Knowledge Base in Just 20 Minutes&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In the age of information, having instant access to knowledge is invaluable. What if you could build an AI chatbot that uses your personal knowledge base to provide accurate answers? The good news is, it&apos;s easier than you think. In this tutorial, we&apos;ll walk you through setting up an AI chatbot using Vercel and OpenAI in just 20 minutes.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Setting Up the Site&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;1. Get Started with Vercel&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Begin by signing up on &lt;a href=&quot;https://vercel.com/&quot;&gt;Vercel&lt;/a&gt;. This platform allows for seamless deployment of web projects.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;2. Kickstart with a Template&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Create a new project using the &lt;a href=&quot;https://vercel.com/new/templates/next.js/nextjs-openai-doc-search-starter&quot;&gt;Next.js OpenAI Doc Search Starter&lt;/a&gt; template available on Vercel.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;3. Integrate Supabase&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Complete the integration process with Supabase, a powerful backend-as-a-service platform.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;4. Pull the GitHub Repo&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Clone the repository to your local machine to start the customization process.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Add Your API Keys&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;1. Set Up Environment Variables&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Make a copy of the &lt;code class=&quot;language-text&quot;&gt;.env.example&lt;/code&gt; file and rename it to &lt;code class=&quot;language-text&quot;&gt;.env&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;2. Input OpenAI Key&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Fill in your OpenAI API key which can be obtained from the &lt;a href=&quot;https://openai.com/&quot;&gt;OpenAI portal&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;3. Configure Supabase Keys&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Fetch your unique Supabase keys from your Supabase dashboard and input them into the &lt;code class=&quot;language-text&quot;&gt;.env&lt;/code&gt; file.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Modify the Repo to Suit Your Data&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;1. Update Embeddings Generation Code&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Locate the &lt;code class=&quot;language-text&quot;&gt;generate embeddings&lt;/code&gt; section and on line 330, modify to: &lt;code class=&quot;language-text&quot;&gt;type Singular&amp;lt;T&gt; = T extends any[] ? any : T&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;2. Implement pdf2md&lt;/strong&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Install the pdf2md tool using the command: &lt;code class=&quot;language-text&quot;&gt;pnpm i pdf2md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add a script in &lt;code class=&quot;language-text&quot;&gt;package.json&lt;/code&gt;: &lt;code class=&quot;language-text&quot;&gt;&quot;pdf2md&quot;: &quot;npx @opendocsg/pdf2md --inputFolderPath=./pdfs --outputFolderPath=./pages/docs --recursive&quot;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;strong&gt;3. Store Knowledge Files&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Create a folder named &lt;code class=&quot;language-text&quot;&gt;./pdf&lt;/code&gt; at the root level and add all your knowledge PDFs to it.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;4. Convert PDFs to Markdown&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Run the command: &lt;code class=&quot;language-text&quot;&gt;pnpm run pdf2md&lt;/code&gt;. Your data will now be converted and stored in the &lt;code class=&quot;language-text&quot;&gt;./pages/docs&lt;/code&gt; directory as markdown files.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Creating Embeddings from .md Files&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;1. Generate Embeddings&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Execute the command: &lt;code class=&quot;language-text&quot;&gt;pnpm run embeddings&lt;/code&gt; to generate vector embeddings from the markdown files.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;2. Verify Embeddings Upload&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Visit your Supabase dashboard and ensure that the embeddings have been successfully uploaded to your database.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Enhance Vector Search&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;1. Adjust Vector Search Criteria&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;The application sends a vector embedding of our text to Supabase&apos;s vector database to query similar texts. Modify the criteria on line 85 as shown in the outline for optimal results.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;2. Generalize Content Summarization&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Update the &lt;code class=&quot;language-text&quot;&gt;pages/api/vector-search&lt;/code&gt; function for broader content summarization. Follow the changes mentioned in the outline to adjust the GPT-3.5 prompt and usage.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Deploying on Vercel&lt;/strong&gt;&lt;/h2&gt;
&lt;h3&gt;&lt;strong&gt;1. Commit and Push Changes&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;After making all the necessary changes, commit your code and push it to GitHub.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;2. Deploy Your Chatbot&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Head over to Vercel, select your domain, and type a question into the search box. Voilà! Your AI chatbot is now live and ready to answer queries.&lt;/p&gt;
&lt;h2&gt;&lt;strong&gt;Optimizations for the Future&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;To further enhance the performance and efficiency of your chatbot:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Consider breaking up the &lt;code class=&quot;language-text&quot;&gt;.md&lt;/code&gt; files into smaller chunks before embedding.&lt;/li&gt;
&lt;li&gt;Clean the markdown files by removing redundant or irrelevant information.&lt;/li&gt;
&lt;li&gt;Stay tuned for more updates and optimization techniques.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Creating a personalized AI chatbot has never been this straightforward. With the right tools and a bit of coding, you can have a chatbot ready to serve your knowledge in no time. Dive in and give it a try!&lt;/p&gt;</content:encoded></item></channel></rss>