CINXE.COM
E-commerce chatbot build with Redis, Langchain and ChatGPT: a step-by-step tutorial tutorial
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width"/><meta property="og:locale" content="en_US"/><meta name="facebook-domain-verification" content="qeuxj9l2uvc6ghyj3qw5uxkrb7me6u"/><link rel="icon" href="/favicon_new.png"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:site" content="https://lablab.ai"/><meta name="twitter:creator" content="@lablabai"/><meta property="og:type" content="website"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:locale" content="en_IE"/><meta property="og:site_name" content="Lab Lab"/><title>E-commerce chatbot build with Redis, Langchain and ChatGPT: a step-by-step tutorial tutorial</title><meta name="robots" content="index,follow"/><meta name="description" content="In this tutorial, we will build an e-commerce chatbot that can query Amazon product embeddings using Redis, CHatGPT and generate responses with Langchain."/><meta property="og:title" content="E-commerce chatbot build with Redis, Langchain and ChatGPT: a step-by-step tutorial tutorial"/><meta property="og:description" content="In this tutorial, we will build an e-commerce chatbot that can query Amazon product embeddings using Redis, CHatGPT and generate responses with Langchain."/><meta property="og:url" content="https://lablab.ai/t/redis-langchain-ecommerce-chatbot"/><meta property="og:image" content="https://storage.googleapis.com/lablab-static-eu/images/tutorials/ecomm-chatbot.png"/><meta property="og:image:alt" content="E-commerce chatbot build with Redis, Langchain and ChatGPT: a step-by-step tutorial"/><link rel="canonical" href="https://lablab.ai/t/redis-langchain-ecommerce-chatbot"/><link rel="preload" as="image" imageSrcSet="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=384&q=80 384w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=640&q=80 640w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=750&q=80 750w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=828&q=80 828w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=1080&q=80 1080w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=1200&q=80 1200w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=1920&q=80 1920w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=2048&q=80 2048w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=3840&q=80 3840w" imageSizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 50vw" fetchPriority="high"/><meta name="next-head-count" content="23"/><script defer="" strategy="afterInteractive">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-PQZ5V5C');</script><link rel="preload" href="/_next/static/media/a34f9d1faa5f3315-s.p.woff2" as="font" type="font/woff2" crossorigin="anonymous" data-next-font="size-adjust"/><link rel="preload" href="/_next/static/css/e9d19e7dfb126051.css" as="style"/><link rel="stylesheet" href="/_next/static/css/e9d19e7dfb126051.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-1968f8113ab7cb9e.js" defer=""></script><script src="/_next/static/chunks/framework-440fd30d74bf785f.js" defer=""></script><script src="/_next/static/chunks/main-f14e482846886151.js" defer=""></script><script src="/_next/static/chunks/pages/_app-808aab5e7caf924f.js" defer=""></script><script src="/_next/static/chunks/4165-ea07a7cee169e8c6.js" defer=""></script><script src="/_next/static/chunks/3305-8324369e90639915.js" defer=""></script><script src="/_next/static/chunks/6047-d3330adbb21859a2.js" defer=""></script><script src="/_next/static/chunks/9538-29a000378ba6b449.js" defer=""></script><script src="/_next/static/chunks/294-4ce1f828ffad3e72.js" defer=""></script><script src="/_next/static/chunks/2174-8578a3c1520929be.js" defer=""></script><script src="/_next/static/chunks/1424-79c582007cd856c0.js" defer=""></script><script src="/_next/static/chunks/pages/t/%5Bt%5D-2d767dcfdc273dfb.js" defer=""></script><script src="/_next/static/FZb6s4CdJX27Luwq7LZ84/_buildManifest.js" defer=""></script><script src="/_next/static/FZb6s4CdJX27Luwq7LZ84/_ssgManifest.js" defer=""></script><script> !function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="init capture register register_once register_for_session unregister unregister_for_session getFeatureFlag getFeatureFlagPayload isFeatureEnabled reloadFeatureFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSessionId getSurveys getActiveMatchingSurveys renderSurvey canRenderSurvey getNextSurveyStep identify setPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset get_distinct_id getGroups get_session_id get_session_replay_url alias set_config startSessionRecording stopSessionRecording sessionRecordingStarted captureException loadToolbar get_property getSessionProperty createPersonProfile opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing clear_opt_in_out_capturing debug".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]); posthog.init('phc_Pw0RKN72vszKL0PUfICOslhGLGDxefRyC13lxt7HJgX',{api_host:'https://us.i.posthog.com', person_profiles: 'always', session_recording: {recordCrossOriginIframes: true,} // or 'always' to create profiles for anonymous users as well }) </script> </head><body><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PQZ5V5C" height="0" width="0" style="display:none;visibility:hidden" ></iframe></noscript><div id="__next"><div class="__variable_d65c78 font-sans antialiased"><div class="wrapper flex min-h-screen flex-col "><div class="relative top-0 z-[999] flex items-center justify-between gap-x-4 border-b border-gray-200 bg-white px-6 py-2 shadow-md backdrop-blur-lg lg:px-8 lg:py-4 xl:gap-x-16"><span class="flex items-center"><a class="flex shrink-0 items-center" href="/"><img alt="lablab.ai logo - Community innovating and building with artificial intelligence" loading="lazy" width="40" height="40" decoding="async" data-nimg="1" style="color:transparent" srcSet="/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Flablab-logo.8496f44c.png&w=48&q=75 1x, /_next/image?url=%2F_next%2Fstatic%2Fmedia%2Flablab-logo.8496f44c.png&w=96&q=75 2x" src="/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Flablab-logo.8496f44c.png&w=96&q=75"/></a></span><nav class="hidden w-full items-center justify-end gap-x-4 md:flex lg:justify-between"><span class="hidden max-w-3xl flex-1 lg:block"><div class="flex-1"><div class="relative mx-auto w-full text-center"><div class="pointer-events-none absolute inset-y-0 left-0 z-30 flex items-center pl-3"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" data-slot="icon" class="size-5 text-gray-400"><path fill-rule="evenodd" d="M10.5 3.75a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM2.25 10.5a8.25 8.25 0 1 1 14.59 5.28l4.69 4.69a.75.75 0 1 1-1.06 1.06l-4.69-4.69A8.25 8.25 0 0 1 2.25 10.5Z" clip-rule="evenodd"></path></svg></div><input type="text" class="relative block w-full cursor-pointer rounded-lg border border-gray-300 py-2 pl-10 pr-3 text-base shadow-sm outline-none placeholder:text-gray-400 hover:border-gray-600 hover:placeholder:text-gray-600 focus:border-indigo-700 focus:text-gray-900 focus:shadow-xl focus:outline-none focus:ring-1 focus:ring-indigo-500 bg-white" placeholder="Search lablab.ai"/></div></div></span><span class="flex items-center gap-x-4"><a class="inline-flex items-center px-1 pt-1 text-sm font-semibold leading-6 text-slate-700 hover:text-sky-500" href="/event">AI Hackathons</a><a class="inline-flex items-center px-1 pt-1 text-sm font-semibold leading-6 text-slate-700 hover:text-sky-500" href="/apps">AI Apps</a><a class="inline-flex items-center px-1 pt-1 text-sm font-semibold leading-6 text-slate-700 hover:text-sky-500" href="/tech">AI Tech</a><a class="inline-flex items-center px-1 pt-1 text-sm font-semibold leading-6 text-slate-700 hover:text-sky-500" href="/t">AI Tutorials</a><a class="inline-flex items-center px-1 pt-1 text-sm font-semibold leading-6 text-slate-700 hover:text-sky-500" href="/next">AI Accelerator</a><a class="inline-flex items-center px-1 pt-1 text-sm font-semibold leading-6 text-slate-700 hover:text-sky-500" href="/sponsor">Sponsor</a><div class=""><button class="size-9 relative my-auto"><span></span></button></div></span></nav><div class="md:hidden"><button class="inline-flex items-center justify-center rounded-md p-2 text-gray-900 hover:text-gray-400 focus:outline-none focus:ring-2 focus:ring-transparent focus:ring-offset-2"><span class="sr-only">Toggle main menu</span><span></span></button></div></div><section class="w-100 py-0 my-0 relative bg-white"><div class="container relative z-10 mx-auto grow py-0 px-6 undefined"><div class="mx-auto hidden max-w-3xl md:block"><nav class="flex py-5 tracking-tight" aria-label="Breadcrumb"><ol role="list" class="flex items-center "><li><div><a class="text-gray-400 hover:text-gray-500" href="https://lablab.ai"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon" class="size-5 flex-shrink-0"><path fill-rule="evenodd" d="M9.293 2.293a1 1 0 0 1 1.414 0l7 7A1 1 0 0 1 17 11h-1v6a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-6H3a1 1 0 0 1-.707-1.707l7-7Z" clip-rule="evenodd"></path></svg><span class="sr-only">Home</span></a></div></li><li class="m-0 p-0"><div class="flex items-center capitalize"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon" class="size-5 mx-1 flex-shrink-0 text-gray-400"><path fill-rule="evenodd" d="M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd"></path></svg><a class="line-clamp-1 break-keep text-sm text-gray-600 hover:text-gray-800 " href="/t">Tutorials</a></div></li><li class="m-0 p-0"><div class="flex items-center capitalize"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon" class="size-5 mx-1 flex-shrink-0 text-gray-400"><path fill-rule="evenodd" d="M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd"></path></svg><a class="line-clamp-1 break-keep text-sm text-gray-600 hover:text-gray-800 pointer-events-none font-bold " aria-current="page" href="https://lablab.ai/t/redis-langchain-ecommerce-chatbot">E-commerce chatbot build with Redis, Langchain and ChatGPT: a step-by-step tutorial</a></div></li></ol></nav></div><div id="start" class="mt-2 flex flex-row justify-center pb-20 md:mt-0 "><div class="hidden w-72 flex-col items-start opacity-90 xl:flex "><div class="top-20 w-52"><div class="my-5"></div><span class="mb-3 text-base font-bold leading-6 text-slate-900">Events @ lablab</span> <br/><span class="mb-3 text-sm font-light leading-none text-slate-900">For Innovators & Creators</span></div></div><article class="prose prose-slate flex max-w-3xl flex-col xl:mx-5"><div class="order-1"><h1 class="mb-2 text-3xl font-bold tracking-tighter lg:text-5xl undefined">E-commerce chatbot build with Redis, Langchain and ChatGPT: a step-by-step tutorial</h1><div class="text-sm tracking-tight text-gray-500 lg:text-base"><span class="capitalize">Friday, March 24, 2023</span> by<!-- --> <a class="no-underline " href="/u/@ezzcodeezzlife">ezzcodeezzlife</a></div></div><div class="order-last"><div class="flex gap-3 xsm:items-start flex-col xsm:flex-row"><a rel="nofollow noopener noreferrer" target="_self" class="rounded-lg px-5 py-1 text-black font-semibold flex justify-center items-center no-underline cursor-pointer bg-white hover:bg-gray-50 shadow-sm hover:shadow-md border" href="https://lablab.ai/t/redis-langchain-ecommerce-chatbot"><button id="linkedin-share" class="react-share__ShareButton flex items-center justify-center gap-2 " style="background-color:transparent;border:none;padding:0;font:inherit;color:inherit;cursor:pointer"><span></span><span>Share</span></button></a><a rel="nofollow noopener noreferrer" target="_self" class="rounded-lg px-5 py-1 text-black font-semibold flex justify-center items-center no-underline cursor-pointer bg-white hover:bg-gray-50 shadow-sm hover:shadow-md border" href="https://lablab.ai/t/redis-langchain-ecommerce-chatbot"><button id="twitter-share" class="react-share__ShareButton flex items-center justify-center gap-2 " style="background-color:transparent;border:none;padding:0;font:inherit;color:inherit;cursor:pointer"><span></span><span>Share</span></button></a><button class="rounded-lg px-5 py-1 text-black font-semibold flex justify-center items-center no-underline cursor-pointer bg-white hover:bg-gray-50 shadow-sm hover:shadow-md border"><span></span><span>Copy</span></button></div></div><div class="relative order-5"><div class="flex flex-row justify-start py-10"><a href="https://github.com/lablab-ai/community-content/tree/main/tutorials/en/redis-langchain-ecommerce-chatbot.mdx" target="_blank" rel="noopener noreferrer" class="font-base text-sm leading-none text-blue-600">Edit on Github</a></div></div><div class="relative order-3"><div class="relative my-5 aspect-video w-full"><img alt="E-commerce chatbot build with Redis, Langchain and ChatGPT: a step-by-step tutorial" fetchPriority="high" width="550" height="400" decoding="async" data-nimg="1" class="not-prose m-0 w-full p-0 shadow-lg lg:rounded-md" style="color:transparent" sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 50vw" srcSet="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=384&q=80 384w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=640&q=80 640w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=750&q=80 750w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=828&q=80 828w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=1080&q=80 1080w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=1200&q=80 1200w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=1920&q=80 1920w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=2048&q=80 2048w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=3840&q=80 3840w" src="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fimage-redis-langchain.png&w=3840&q=80"/></div><h2 class="h2-1" id="why-use-ai-in-your-e-commerce-business"><a aria-hidden="true" tabindex="-1" href="#why-use-ai-in-your-e-commerce-business" class="break-all"><span class="icon icon-link"></span></a>Why use AI in your e-commerce business?</h2> <p>In today's fast-paced digital world, e-commerce has become a significant part of our daily lives. With the vast number of products available online, it can be challenging for users to find the right product that suits their needs. To address this issue, we can use AI-powered chatbots to help users find the perfect product for their needs by leveraging natural language processing techniques.</p> <p>In this tutorial, we will walk you through the process of building an e-commerce chatbot that utilizes Amazon product embeddings, the <a href="https://lablab.ai/tech/openai/chatgpt" class="break-all">ChatGPT API</a> (gpt-3.5-turbo) and <a href="https://github.com/hwchase17/langchain" class="break-all" rel="noopener noreferrer nofollow" target="_blank">Langchain</a> to create a seamless and engaging user experience. Our chatbot will take user input, find relevant products from a dataset, and present the information in a friendly and detailed manner. This not only enhances the user experience but also makes the process of finding products much more enjoyable.</p> <h2 class="h2-2" id="lets-start"><a aria-hidden="true" tabindex="-1" href="#lets-start" class="break-all"><span class="icon icon-link"></span></a>Let鈥檚 start!</h2> <p>We will begin by loading and preprocessing the product data, followed by creating a Redis index and loading vectors into the index. Then, we will use Langchain to create an LLM chain and a prompt template for generating comma-separated product keywords based on the user input. Next, we will query the product embeddings in Redis using the generated keywords and retrieve the top results. Finally, we will present the retrieved products to the user in a nice and engaging way, allowing them to ask follow-up questions.</p> <p>By the end of this tutorial, you will have a better understanding of how to build an CLI based e-commerce chatbot that can query Amazon product embeddings and generate user-friendly responses using Langchain. This will not only help improve the overall user experience in the e-commerce space but also pave the way for more advanced and personalized chatbot solutions in the future. So, let's get started and build our very own ecommerce chatbot!</p> <p>Here is a quick example of how a conversation with our chatbot might look like:</p> <div class="remark-highlight"><pre class="language-unknown"><code class="language-unknown">User: im looking for some jewelry for my girlfriend Bot: Based on your query, I would recommend checking out these Women&#39;s Engravable 14k Gold Plated 925 Sterling Silver Polished Disc Charm on 18&quot; Chain Pendant Necklace. They might make a great gift for your girlfriend if she likes elegant and stylish jewelry. However, if you are looking for shoes, you might want to check out Amazon Brand - The Fix Women&#39;s Lizzie Block Heel Ruffled Sandal Heeled, Dove Suede, 9 B US. These shoes are great for spring and summer, and perfect for a date night or a fancy event. Another option for shoes could be Amazon Brand - The Fix Women&#39;s Giana Open Toe Bootie with Pearl Buckle, which comes in bright white leather and sizes up to 9.5 B US. I hope this helps! User: tell me more about the necklace Bot: The Women&#39;s Engravable 14k Gold Plated 925 Sterling Silver Polished Disc Charm on 18&quot; Chain Pendant Necklace is a beautiful and elegant piece of jewelry. The pendant is made of 925 sterling silver and is plated with 14k gold for a luxurious look. The pendant is disc-shaped and can be engraved with a personal message or initials to make it even more special. The chain is 18 inches long and adds a delicate touch to the necklace. This necklace is perfect for everyday wear or for special occasions. User: what&#39;s the product id Bot: The product ID for the Women&#39;s Engravable 14k Gold Plated 925 Sterling Silver Polished Disc Charm on 18&quot; Chain Pendant Necklace is B07CJCSYQF.</code></pre></div> <h2 class="h2-3" id="prerequisites"><a aria-hidden="true" tabindex="-1" href="#prerequisites" class="break-all"><span class="icon icon-link"></span></a>Prerequisites</h2> <h3 class="h3-1" id="get-the-dataset-csv-file"><a aria-hidden="true" tabindex="-1" href="#get-the-dataset-csv-file" class="break-all"><span class="icon icon-link"></span></a>Get the dataset CSV file</h3> <p>Get the dataset CSV file from <a href="https://drive.google.com/file/d/1tHWB6u3yQCuAgOYc-DxtZ8Mru3uV5_lj/view?usp=sharing" class="break-all" rel="noopener noreferrer nofollow" target="_blank">here</a>.</p> <h3 class="h3-2" id="install-the-required-python-packages"><a aria-hidden="true" tabindex="-1" href="#install-the-required-python-packages" class="break-all"><span class="icon icon-link"></span></a>Install the required Python packages</h3> <p>Before we start, make sure you have the following Python packages installed:</p> <ul> <li><code>redis</code></li> <li><code>pandas</code></li> <li><code>sentence-transformers</code></li> <li><code>openai</code></li> <li><code>langchain</code></li> </ul> <p>You can install them using the following commands:</p> <div class="remark-highlight"><pre class="language-python"><code class="language-python">pip install redis pandas pip install <span class="token operator">-</span>U sentence<span class="token operator">-</span>transformers pip install openai pip install langchain </code></pre></div> <h2 class="h2-4" id="loading-and-preprocessing-the-data"><a aria-hidden="true" tabindex="-1" href="#loading-and-preprocessing-the-data" class="break-all"><span class="icon icon-link"></span></a>Loading and Preprocessing the Data</h2> <p>First, we need to load the product data from a CSV file and truncate long text fields. We will use the first 1000 products with non-empty item keywords for our chatbot.</p> <div class="remark-highlight"><pre class="language-python"><code class="language-python"><span class="token keyword">import</span> numpy <span class="token keyword">as</span> np <span class="token keyword">import</span> pandas <span class="token keyword">as</span> pd <span class="token keyword">import</span> time <span class="token keyword">from</span> redis<span class="token punctuation">.</span>commands<span class="token punctuation">.</span>search<span class="token punctuation">.</span>field <span class="token keyword">import</span> VectorField <span class="token keyword">from</span> redis<span class="token punctuation">.</span>commands<span class="token punctuation">.</span>search<span class="token punctuation">.</span>field <span class="token keyword">import</span> TextField <span class="token keyword">from</span> redis<span class="token punctuation">.</span>commands<span class="token punctuation">.</span>search<span class="token punctuation">.</span>field <span class="token keyword">import</span> TagField <span class="token keyword">from</span> redis<span class="token punctuation">.</span>commands<span class="token punctuation">.</span>search<span class="token punctuation">.</span>query <span class="token keyword">import</span> Query <span class="token keyword">import</span> redis </code></pre></div> <div class="remark-highlight"><pre class="language-python"><code class="language-python">MAX_TEXT_LENGTH<span class="token operator">=</span><span class="token number">512</span> NUMBER_PRODUCTS<span class="token operator">=</span><span class="token number">1000</span> <span class="token keyword">def</span> <span class="token function">auto_truncate</span><span class="token punctuation">(</span>val<span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">return</span> val<span class="token punctuation">[</span><span class="token punctuation">:</span>MAX_TEXT_LENGTH<span class="token punctuation">]</span> <span class="token comment">#Load Product data and truncate long text fields</span> all_prods_df <span class="token operator">=</span> pd<span class="token punctuation">.</span>read_csv<span class="token punctuation">(</span><span class="token string">"product_data.csv"</span><span class="token punctuation">,</span> converters<span class="token operator">=</span><span class="token punctuation">{</span><span class="token string">'bullet_point'</span><span class="token punctuation">:</span> auto_truncate<span class="token punctuation">,</span><span class="token string">'item_keywords'</span><span class="token punctuation">:</span>auto_truncate<span class="token punctuation">,</span><span class="token string">'item_name'</span><span class="token punctuation">:</span>auto_truncate<span class="token punctuation">}</span><span class="token punctuation">)</span> all_prods_df<span class="token punctuation">[</span><span class="token string">'primary_key'</span><span class="token punctuation">]</span> <span class="token operator">=</span> all_prods_df<span class="token punctuation">[</span><span class="token string">'item_id'</span><span class="token punctuation">]</span> <span class="token operator">+</span> <span class="token string">'-'</span> <span class="token operator">+</span> all_prods_df<span class="token punctuation">[</span><span class="token string">'domain_name'</span><span class="token punctuation">]</span> all_prods_df<span class="token punctuation">[</span><span class="token string">'item_keywords'</span><span class="token punctuation">]</span><span class="token punctuation">.</span>replace<span class="token punctuation">(</span><span class="token string">''</span><span class="token punctuation">,</span> np<span class="token punctuation">.</span>nan<span class="token punctuation">,</span> inplace<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span> all_prods_df<span class="token punctuation">.</span>dropna<span class="token punctuation">(</span>subset<span class="token operator">=</span><span class="token punctuation">[</span><span class="token string">'item_keywords'</span><span class="token punctuation">]</span><span class="token punctuation">,</span> inplace<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span> all_prods_df<span class="token punctuation">.</span>reset_index<span class="token punctuation">(</span>drop<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">,</span>inplace<span class="token operator">=</span><span class="token boolean">True</span><span class="token punctuation">)</span> <span class="token comment">#get the first 1000 products with non-empty item keywords</span> product_metadata <span class="token operator">=</span> all_prods_df<span class="token punctuation">.</span>head<span class="token punctuation">(</span>NUMBER_PRODUCTS<span class="token punctuation">)</span><span class="token punctuation">.</span>to_dict<span class="token punctuation">(</span>orient<span class="token operator">=</span><span class="token string">'index'</span><span class="token punctuation">)</span> all_prods_df<span class="token punctuation">.</span>head<span class="token punctuation">(</span><span class="token punctuation">)</span> </code></pre></div> <h3 class="h3-3" id="creating-the-redis-index-and-loading-vectors"><a aria-hidden="true" tabindex="-1" href="#creating-the-redis-index-and-loading-vectors" class="break-all"><span class="icon icon-link"></span></a>Creating the Redis Index and Loading Vectors</h3> <p>Now, we will create a function to load vectors into the Redis index and a function to create a flat index. We will use these functions later to index our product data.</p> <div class="remark-highlight"><pre class="language-python"><code class="language-python"><span class="token keyword">def</span> <span class="token function">load_vectors</span><span class="token punctuation">(</span>client<span class="token punctuation">,</span> product_metadata<span class="token punctuation">,</span> vector_dict<span class="token punctuation">,</span> vector_field_name<span class="token punctuation">)</span><span class="token punctuation">:</span> p <span class="token operator">=</span> client<span class="token punctuation">.</span>pipeline<span class="token punctuation">(</span>transaction<span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">)</span> <span class="token keyword">for</span> index <span class="token keyword">in</span> product_metadata<span class="token punctuation">.</span>keys<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token comment">#hash key</span> key<span class="token operator">=</span><span class="token string">'product:'</span><span class="token operator">+</span> <span class="token builtin">str</span><span class="token punctuation">(</span>index<span class="token punctuation">)</span><span class="token operator">+</span> <span class="token string">':'</span> <span class="token operator">+</span> product_metadata<span class="token punctuation">[</span>index<span class="token punctuation">]</span><span class="token punctuation">[</span><span class="token string">'primary_key'</span><span class="token punctuation">]</span> <span class="token comment">#hash values</span> item_metadata <span class="token operator">=</span> product_metadata<span class="token punctuation">[</span>index<span class="token punctuation">]</span> item_keywords_vector <span class="token operator">=</span> vector_dict<span class="token punctuation">[</span>index<span class="token punctuation">]</span><span class="token punctuation">.</span>astype<span class="token punctuation">(</span>np<span class="token punctuation">.</span>float32<span class="token punctuation">)</span><span class="token punctuation">.</span>tobytes<span class="token punctuation">(</span><span class="token punctuation">)</span> item_metadata<span class="token punctuation">[</span>vector_field_name<span class="token punctuation">]</span><span class="token operator">=</span>item_keywords_vector <span class="token comment"># HSET</span> p<span class="token punctuation">.</span>hset<span class="token punctuation">(</span>key<span class="token punctuation">,</span>mapping<span class="token operator">=</span>item_metadata<span class="token punctuation">)</span> p<span class="token punctuation">.</span>execute<span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">def</span> <span class="token function">create_flat_index</span> <span class="token punctuation">(</span>redis_conn<span class="token punctuation">,</span>vector_field_name<span class="token punctuation">,</span>number_of_vectors<span class="token punctuation">,</span> vector_dimensions<span class="token operator">=</span><span class="token number">512</span><span class="token punctuation">,</span> distance_metric<span class="token operator">=</span><span class="token string">'L2'</span><span class="token punctuation">)</span><span class="token punctuation">:</span> redis_conn<span class="token punctuation">.</span>ft<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>create_index<span class="token punctuation">(</span><span class="token punctuation">[</span> VectorField<span class="token punctuation">(</span>vector_field_name<span class="token punctuation">,</span> <span class="token string">"FLAT"</span><span class="token punctuation">,</span> <span class="token punctuation">{</span><span class="token string">"TYPE"</span><span class="token punctuation">:</span> <span class="token string">"FLOAT32"</span><span class="token punctuation">,</span> <span class="token string">"DIM"</span><span class="token punctuation">:</span> vector_dimensions<span class="token punctuation">,</span> <span class="token string">"DISTANCE_METRIC"</span><span class="token punctuation">:</span> distance_metric<span class="token punctuation">,</span> <span class="token string">"INITIAL_CAP"</span><span class="token punctuation">:</span> number_of_vectors<span class="token punctuation">,</span> <span class="token string">"BLOCK_SIZE"</span><span class="token punctuation">:</span>number_of_vectors <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> TagField<span class="token punctuation">(</span><span class="token string">"product_type"</span><span class="token punctuation">)</span><span class="token punctuation">,</span> TextField<span class="token punctuation">(</span><span class="token string">"item_name"</span><span class="token punctuation">)</span><span class="token punctuation">,</span> TextField<span class="token punctuation">(</span><span class="token string">"item_keywords"</span><span class="token punctuation">)</span><span class="token punctuation">,</span> TagField<span class="token punctuation">(</span><span class="token string">"country"</span><span class="token punctuation">)</span> <span class="token punctuation">]</span><span class="token punctuation">)</span> </code></pre></div> <h3 class="h3-4" id="connect-to-our-redis-db"><a aria-hidden="true" tabindex="-1" href="#connect-to-our-redis-db" class="break-all"><span class="icon icon-link"></span></a>Connect to our Redis DB</h3> <p>Next, we will create the Redis connection and load the vectors into the Redis index.</p> <div class="remark-highlight"><pre class="language-python"><code class="language-python">ITEM_KEYWORD_EMBEDDING_FIELD<span class="token operator">=</span><span class="token string">'item_keyword_vector'</span> TEXT_EMBEDDING_DIMENSION<span class="token operator">=</span><span class="token number">768</span> NUMBER_PRODUCTS<span class="token operator">=</span><span class="token number">1000</span> <span class="token keyword">print</span> <span class="token punctuation">(</span><span class="token string">'Loading and Indexing + '</span> <span class="token operator">+</span> <span class="token builtin">str</span><span class="token punctuation">(</span>NUMBER_PRODUCTS<span class="token punctuation">)</span> <span class="token operator">+</span> <span class="token string">' products'</span><span class="token punctuation">)</span> <span class="token comment">#flush all data</span> redis_conn<span class="token punctuation">.</span>flushall<span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">#create flat index & load vectors</span> create_flat_index<span class="token punctuation">(</span>redis_conn<span class="token punctuation">,</span> ITEM_KEYWORD_EMBEDDING_FIELD<span class="token punctuation">,</span>NUMBER_PRODUCTS<span class="token punctuation">,</span>TEXT_EMBEDDING_DIMENSION<span class="token punctuation">,</span><span class="token string">'COSINE'</span><span class="token punctuation">)</span> load_vectors<span class="token punctuation">(</span>redis_conn<span class="token punctuation">,</span>product_metadata<span class="token punctuation">,</span>item_keywords_vectors<span class="token punctuation">,</span>ITEM_KEYWORD_EMBEDDING_FIELD<span class="token punctuation">)</span> </code></pre></div> <h2 class="h2-5" id="creating-the-chatbot"><a aria-hidden="true" tabindex="-1" href="#creating-the-chatbot" class="break-all"><span class="icon icon-link"></span></a>Creating the Chatbot</h2> <p>We will use the ChatGPT API (gpt-3.5-turbo) in combination with Langchain to create a response to our questions. If you want to dive deep and learn more about how to integrate the <a href="https://lablab.ai/t/chatgpt-tutorial-how-to-integrate-chatgpt-and-whisper-api-into-your-project" class="break-all">ChatGPT API</a> to your other projects, we have dedicated tutorials for this.</p> <h3 class="h3-5" id="go-from-user-input-string-to-product-keywords"><a aria-hidden="true" tabindex="-1" href="#go-from-user-input-string-to-product-keywords" class="break-all"><span class="icon icon-link"></span></a>Go from user input string to product keywords</h3> <p>We will use Langchain to create an LLM chain for our chatbot. First, we will create a prompt template to generate comma-separated product keywords from the user input.</p> <div class="remark-highlight"><pre class="language-python"><code class="language-python"><span class="token keyword">from</span> langchain<span class="token punctuation">.</span>prompts <span class="token keyword">import</span> PromptTemplate <span class="token keyword">from</span> langchain<span class="token punctuation">.</span>llms <span class="token keyword">import</span> OpenAI llm <span class="token operator">=</span> OpenAI<span class="token punctuation">(</span>model_name<span class="token operator">=</span><span class="token string">"gpt-3.5-turbo"</span><span class="token punctuation">,</span> temperature<span class="token operator">=</span><span class="token number">0.3</span><span class="token punctuation">,</span> openai_api_key<span class="token operator">=</span><span class="token string">"sk-9xxxxxxxxxx4"</span><span class="token punctuation">)</span> prompt <span class="token operator">=</span> PromptTemplate<span class="token punctuation">(</span> input_variables<span class="token operator">=</span><span class="token punctuation">[</span><span class="token string">"product_description"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> template<span class="token operator">=</span><span class="token string">"Create comma seperated product keywords to perform a query on a amazon dataset for this user input: {product_description}"</span><span class="token punctuation">,</span> <span class="token punctuation">)</span> <span class="token keyword">from</span> langchain<span class="token punctuation">.</span>chains <span class="token keyword">import</span> LLMChain chain <span class="token operator">=</span> LLMChain<span class="token punctuation">(</span>llm<span class="token operator">=</span>llm<span class="token punctuation">,</span> prompt<span class="token operator">=</span>prompt<span class="token punctuation">)</span> </code></pre></div> <p>Now, let's use our chain.</p> <div class="remark-highlight"><pre class="language-python"><code class="language-python">userinput <span class="token operator">=</span> <span class="token builtin">input</span><span class="token punctuation">(</span><span class="token string">"Hey im a E-commerce Chatbot, how can i help you today? "</span><span class="token punctuation">)</span> <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"User:"</span><span class="token punctuation">,</span> userinput<span class="token punctuation">)</span> <span class="token comment"># Run the chain only specifying the input variable.</span> keywords <span class="token operator">=</span> chain<span class="token punctuation">.</span>run<span class="token punctuation">(</span>userinput<span class="token punctuation">)</span> </code></pre></div> <h3 class="h3-6" id="query-our-data"><a aria-hidden="true" tabindex="-1" href="#query-our-data" class="break-all"><span class="icon icon-link"></span></a>Query our data</h3> <p>We will then use the generated keywords to query the product embeddings in Redis and retrieve the top 3 results.</p> <div class="remark-highlight"><pre class="language-python"><code class="language-python">topK <span class="token operator">=</span> <span class="token number">3</span> <span class="token comment"># Vectorize the query</span> query_vector <span class="token operator">=</span> model<span class="token punctuation">.</span>encode<span class="token punctuation">(</span>keywords<span class="token punctuation">)</span><span class="token punctuation">.</span>astype<span class="token punctuation">(</span>np<span class="token punctuation">.</span>float32<span class="token punctuation">)</span><span class="token punctuation">.</span>tobytes<span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment"># Prepare the query</span> q <span class="token operator">=</span> Query<span class="token punctuation">(</span><span class="token string-interpolation"><span class="token string">f'*=>[KNN </span><span class="token interpolation"><span class="token punctuation">{</span>topK<span class="token punctuation">}</span></span><span class="token string"> @</span><span class="token interpolation"><span class="token punctuation">{</span>ITEM_KEYWORD_EMBEDDING_FIELD<span class="token punctuation">}</span></span><span class="token string"> $vec_param AS vector_score]'</span></span><span class="token punctuation">)</span><span class="token punctuation">.</span>sort_by<span class="token punctuation">(</span><span class="token string">'vector_score'</span><span class="token punctuation">)</span><span class="token punctuation">.</span>paging<span class="token punctuation">(</span><span class="token number">0</span><span class="token punctuation">,</span> topK<span class="token punctuation">)</span><span class="token punctuation">.</span>return_fields<span class="token punctuation">(</span><span class="token string">'vector_score'</span><span class="token punctuation">,</span> <span class="token string">'item_name'</span><span class="token punctuation">,</span> <span class="token string">'item_id'</span><span class="token punctuation">,</span> <span class="token string">'item_keywords'</span><span class="token punctuation">)</span><span class="token punctuation">.</span>dialect<span class="token punctuation">(</span><span class="token number">2</span><span class="token punctuation">)</span> params_dict <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token string">"vec_param"</span><span class="token punctuation">:</span> query_vector<span class="token punctuation">}</span> <span class="token comment"># Execute the query</span> results <span class="token operator">=</span> redis_conn<span class="token punctuation">.</span>ft<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span>search<span class="token punctuation">(</span>q<span class="token punctuation">,</span> query_params<span class="token operator">=</span>params_dict<span class="token punctuation">)</span> full_result_string <span class="token operator">=</span> <span class="token string">''</span> <span class="token keyword">for</span> product <span class="token keyword">in</span> results<span class="token punctuation">.</span>docs<span class="token punctuation">:</span> full_result_string <span class="token operator">+=</span> product<span class="token punctuation">.</span>item_name <span class="token operator">+</span> <span class="token string">' '</span> <span class="token operator">+</span> product<span class="token punctuation">.</span>item_keywords <span class="token operator">+</span> <span class="token string">' '</span> <span class="token operator">+</span> product<span class="token punctuation">.</span>item_id <span class="token operator">+</span> <span class="token string">"\n\n\n"</span> </code></pre></div> <h3 class="h3-7" id="create-the-chatbot"><a aria-hidden="true" tabindex="-1" href="#create-the-chatbot" class="break-all"><span class="icon icon-link"></span></a>Create the chatbot</h3> <p>Finally, we will create another LLM chain to generate a nice response from the retrieved products and present it to the user. The user is also able to ask follow up questions. Note, that we added a memory to the chain to keep track of the chat history.</p> <div class="remark-highlight"><pre class="language-python"><code class="language-python"><span class="token keyword">from</span> langchain<span class="token punctuation">.</span>memory <span class="token keyword">import</span> ConversationBufferMemory template <span class="token operator">=</span> <span class="token triple-quoted-string string">"""You are a chatbot. Be kind, detailed and nice. Present the given queried search result in a nice way as answer to the user input. dont ask questions back! just take the given context</span> <span class="token triple-quoted-string string"></span> <span class="token triple-quoted-string string">{chat_history}</span> <span class="token triple-quoted-string string">Human: {user_msg}</span> <span class="token triple-quoted-string string">Chatbot:"""</span> prompt <span class="token operator">=</span> PromptTemplate<span class="token punctuation">(</span> input_variables<span class="token operator">=</span><span class="token punctuation">[</span><span class="token string">"chat_history"</span><span class="token punctuation">,</span> <span class="token string">"user_msg"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> template<span class="token operator">=</span>template <span class="token punctuation">)</span> memory <span class="token operator">=</span> ConversationBufferMemory<span class="token punctuation">(</span>memory_key<span class="token operator">=</span><span class="token string">"chat_history"</span><span class="token punctuation">)</span> llm_chain <span class="token operator">=</span> LLMChain<span class="token punctuation">(</span> llm<span class="token operator">=</span>OpenAI<span class="token punctuation">(</span>model_name<span class="token operator">=</span><span class="token string">"gpt-3.5-turbo"</span><span class="token punctuation">,</span> temperature<span class="token operator">=</span><span class="token number">0.8</span><span class="token punctuation">,</span> openai_api_key<span class="token operator">=</span><span class="token string">"sk-9xxxxxxxxxxxxxxxxxxxx4"</span><span class="token punctuation">)</span><span class="token punctuation">,</span> prompt<span class="token operator">=</span>prompt<span class="token punctuation">,</span> verbose<span class="token operator">=</span><span class="token boolean">False</span><span class="token punctuation">,</span> memory<span class="token operator">=</span>memory<span class="token punctuation">,</span> <span class="token punctuation">)</span> answer <span class="token operator">=</span> llm_chain<span class="token punctuation">.</span>predict<span class="token punctuation">(</span>user_msg<span class="token operator">=</span><span class="token string-interpolation"><span class="token string">f"</span><span class="token interpolation"><span class="token punctuation">{</span>full_result_string<span class="token punctuation">}</span></span><span class="token string"> ---\n\n </span><span class="token interpolation"><span class="token punctuation">{</span>userinput<span class="token punctuation">}</span></span><span class="token string">"</span></span><span class="token punctuation">)</span> <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"Bot:"</span><span class="token punctuation">,</span> answer<span class="token punctuation">)</span> time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">0.5</span><span class="token punctuation">)</span> <span class="token keyword">while</span> <span class="token boolean">True</span><span class="token punctuation">:</span> follow_up <span class="token operator">=</span> <span class="token builtin">input</span><span class="token punctuation">(</span><span class="token string">"Anything else you want to ask about this topic?"</span><span class="token punctuation">)</span> <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"User:"</span><span class="token punctuation">,</span> follow_up<span class="token punctuation">)</span> answer <span class="token operator">=</span> llm_chain<span class="token punctuation">.</span>predict<span class="token punctuation">(</span> user_msg<span class="token operator">=</span>follow_up <span class="token punctuation">)</span> <span class="token keyword">print</span><span class="token punctuation">(</span><span class="token string">"Bot:"</span><span class="token punctuation">,</span> answer<span class="token punctuation">)</span> time<span class="token punctuation">.</span>sleep<span class="token punctuation">(</span><span class="token number">0.5</span><span class="token punctuation">)</span> </code></pre></div> <h2 class="h2-6" id="conclusion"><a aria-hidden="true" tabindex="-1" href="#conclusion" class="break-all"><span class="icon icon-link"></span></a>Conclusion</h2> <figure class="w-full intrinsic"><a target="_blank" rel="noopener noreferrer nofollow" class="" href="https://storage.googleapis.com/lablab-static-eu/images/tutorials/New_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png"><img alt="conclusion banner" loading="lazy" width="1000" height="1000" decoding="async" data-nimg="1" class="w-full rounded-lg shadow-md" style="color:transparent" sizes="(max-width: 768px) 100vw, 50vw" srcSet="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=384&q=100 384w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=640&q=100 640w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=750&q=100 750w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=828&q=100 828w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=1080&q=100 1080w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=1200&q=100 1200w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=1920&q=100 1920w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=2048&q=100 2048w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=3840&q=100 3840w" src="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FNew_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png&w=3840&q=100"/></a><figcaption class="-mt-3 line-clamp-2 text-center text-sm text-gray-500 underline"></figcaption></figure> <p>In this tutorial, we have built an e-commerce chatbot that can query Amazon product embeddings using Redis and generate detailed and friendly responses with Langchain. We have demonstrated how to load and preprocess product data, create a Redis index, and load vectors into the index. We have also shown how to use Langchain to create an LLM chain for generating keywords and responses for user queries.</p> <p>By utilizing the power of product embeddings and language models, our chatbot can efficiently search for relevant product recommendations and present them in an engaging and informative manner. This approach can be further extended to include more products, handle complex queries, and even provide personalized recommendations by incorporating user preferences.</p> <p>We hope this tutorial has given you a good starting point for building your own e-commerce chatbot or implementing similar solutions in other domains. With the rapid advancements in AI technologies, there are endless possibilities for creating intelligent, engaging, and helpful chatbots that can improve user experience and drive business success.</p> <p>You can find the full source code for this tutorial <a href="https://github.com/lablab-ai/redis-langchain-ecommerce-chatbot" class="break-all" rel="noopener noreferrer nofollow" target="_blank">here on Github</a></p> <p>And if you want to give your new skills a spin and build an amazing app with cutting edge technology and assistance from our mentors, <a href="https://lablab.ai/event" class="break-all">join our AI Hackathons and build the future with AI</a>.</p> <p><strong>Thank you!</strong> If you enjoyed this tutorial you can find more and continue reading <a href="https://lablab.ai/t" class="break-all">on our tutorial page</a> - <a href="https://github.com/ezzcodeezzlife" class="break-all" rel="noopener noreferrer nofollow" target="_blank">Fabian Stehle</a>, Full Stack Developer at <a href="https://newnative.ai/" class="break-all" rel="noopener noreferrer nofollow" target="_blank">New Native</a></p></div></article><div class="hidden w-72 flex-col xl:flex "><div class="sticky top-10 hidden w-full flex-col space-y-10 pb-5 pl-5 pr-10 lg:flex "><nav><ul class=" w-60 space-y-1 flex-col gap-1.5 text-base"><div class="mb-4 w-full text-base font-semibold leading-6 text-slate-900 ">On this page</div></ul></nav><div class="w-100 p-2 text-left "><span class="w-full text-base font-semibold leading-6 text-slate-900 ">Technologiess</span><div class=" mt-5 flex flex-wrap gap-1"><a href="/tech/langchain/langchain"><span class="mb-2 mr-1 inline-flex rounded-full bg-[#e1effe] px-2 text-xs font-semibold leading-5 text-primary no-underline">LangChain</span></a><a href="/tech/redis"><span class="mb-2 mr-1 inline-flex rounded-full bg-[#e1effe] px-2 text-xs font-semibold leading-5 text-primary no-underline">Redis</span></a><a href="/tech/openai/chatgpt"><span class="mb-2 mr-1 inline-flex rounded-full bg-[#e1effe] px-2 text-xs font-semibold leading-5 text-primary no-underline">ChatGPT</span></a></div></div></div></div></div></div></section><section class="w-100 py-0 my-0 relative bg-slate-50"><div class="max-w-7xl relative z-10 mx-auto grow py-0 px-6 undefined"><div class="w-full text-center undefined py-12 "><h2 class="text-slate-900 mt-4 font-bold md:mt-0 text-3xl lg:text-5xl">Discover tutorials with similar technologies</h2></div><div class="mb-6 undefined"><div class="grid sm:grid-cols-2 grid-2 lg:grid-cols-3 gap-6 lg:gap-6"><div class="card-animation card-border card-shadow relative flex h-full flex-col overflow-hidden rounded-lg bg-white"><a class="flex h-full flex-col justify-between" href="/t/autogpt-tutorial-building-ai-agent-powered-research-assistant-app"><div class=""><div class="relative aspect-video"><img alt="AutoGPT Tutorial: Building an AI Agent-Powered Research Assistant App" loading="lazy" decoding="async" data-nimg="fill" class="absolute inset-0 size-full bg-gray-50 object-cover sm:object-fill" style="position:absolute;height:100%;width:100%;left:0;top:0;right:0;bottom:0;color:transparent" sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" srcSet="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=256&q=75 256w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=384&q=75 384w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=640&q=75 640w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=750&q=75 750w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=828&q=75 828w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=1080&q=75 1080w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=1200&q=75 1200w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=1920&q=75 1920w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=2048&q=75 2048w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=3840&q=75 3840w" src="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fautogpt-tut-thumbnail.png&w=3840&q=75"/></div></div><div class="absolute right-2 top-2 flex items-center justify-between text-xs"><span title="TUTORIAL" class="inline-flex items-center shadow-md rounded-full px-3 py-1 bg-gray-200 text-black"><span>TUTORIAL</span></span></div><div class="p-4 flex h-max flex-1 flex-col justify-start"><div class="mb-auto"><div class="flex w-full items-center justify-between"></div><h2 class="mt-1 line-clamp-1 font-bold leading-tight text-2xl">AutoGPT Tutorial: Building an AI Agent-Powered Research Assistant App</h2><p class="mt-2 line-clamp-2 text-sm text-gray-500">Learn how to develop a research assistant app powered by AI agents. These agents can formulate step-by-step solutions and generate reports in text files.</p></div></div></a></div><div class="card-animation card-border card-shadow relative flex h-full flex-col overflow-hidden rounded-lg bg-white"><a class="flex h-full flex-col justify-between" href="/t/ai-agents-tutorial-how-to-use-and-create-them"><div class=""><div class="relative aspect-video"><img alt="AI Agents tutorial: How to use and build AI Agents" loading="lazy" decoding="async" data-nimg="fill" class="absolute inset-0 size-full bg-gray-50 object-cover sm:object-fill" style="position:absolute;height:100%;width:100%;left:0;top:0;right:0;bottom:0;color:transparent" sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" srcSet="/_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=256&q=75 256w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=384&q=75 384w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=640&q=75 640w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=750&q=75 750w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=828&q=75 828w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=1080&q=75 1080w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=1200&q=75 1200w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=1920&q=75 1920w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=2048&q=75 2048w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=3840&q=75 3840w" src="/_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2Fc77c8021-39ee-4d97-7ffd-31d6bb0fd100%2Ffull&w=3840&q=75"/></div></div><div class="absolute right-2 top-2 flex items-center justify-between text-xs"><span title="TUTORIAL" class="inline-flex items-center shadow-md rounded-full px-3 py-1 bg-gray-200 text-black"><span>TUTORIAL</span></span></div><div class="p-4 flex h-max flex-1 flex-col justify-start"><div class="mb-auto"><div class="flex w-full items-center justify-between"></div><h2 class="mt-1 line-clamp-1 font-bold leading-tight text-2xl">AI Agents tutorial: How to use and build AI Agents</h2><p class="mt-2 line-clamp-2 text-sm text-gray-500">Have you heard of AI Agents? If you didn鈥檛 - don鈥檛 worry. In a few moments you鈥檙e gonna learn everything about AI Agents - their capabilities, how to use them and create tools for them!</p></div></div></a></div><div class="card-animation card-border card-shadow relative flex h-full flex-col overflow-hidden rounded-lg bg-white"><a class="flex h-full flex-col justify-between" href="/t/t2i-assistant-redis"><div class=""><div class="relative aspect-video"><img alt="Redis tutorial: Text to Image AI assistant with Redis Search" loading="lazy" decoding="async" data-nimg="fill" class="absolute inset-0 size-full bg-gray-50 object-cover sm:object-fill" style="position:absolute;height:100%;width:100%;left:0;top:0;right:0;bottom:0;color:transparent" sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" srcSet="/_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=256&q=75 256w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=384&q=75 384w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=640&q=75 640w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=750&q=75 750w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=828&q=75 828w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=1080&q=75 1080w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=1200&q=75 1200w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=1920&q=75 1920w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=2048&q=75 2048w, /_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=3840&q=75 3840w" src="/_next/image?url=https%3A%2F%2Fimagedelivery.net%2FK11gkZF3xaVyYzFESMdWIQ%2F3ef1c25b-f2b4-45d0-ba79-fa13ca835400%2Ffull&w=3840&q=75"/></div></div><div class="absolute right-2 top-2 flex items-center justify-between text-xs"><span title="TUTORIAL" class="inline-flex items-center shadow-md rounded-full px-3 py-1 bg-gray-200 text-black"><span>TUTORIAL</span></span></div><div class="p-4 flex h-max flex-1 flex-col justify-start"><div class="mb-auto"><div class="flex w-full items-center justify-between"></div><h2 class="mt-1 line-clamp-1 font-bold leading-tight text-2xl">Redis tutorial: Text to Image AI assistant with Redis Search</h2><p class="mt-2 line-clamp-2 text-sm text-gray-500">In this tutorial you will learn how to use Redis Database and Vector Similarity Search to create a text-to-image AI assistant</p></div></div></a></div><div class="card-animation card-border card-shadow relative flex h-full flex-col overflow-hidden rounded-lg bg-white"><a class="flex h-full flex-col justify-between" href="/t/efficient-vector-similarity-search-with-redis-a-step-by-step-tutorial"><div class=""><div class="relative aspect-video"><img alt="Efficient vector similarity search with Redis: a step-by-step tutorial" loading="lazy" decoding="async" data-nimg="fill" class="absolute inset-0 size-full bg-gray-50 object-cover sm:object-fill" style="position:absolute;height:100%;width:100%;left:0;top:0;right:0;bottom:0;color:transparent" sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" srcSet="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=256&q=75 256w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=384&q=75 384w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=640&q=75 640w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=750&q=75 750w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=828&q=75 828w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=1080&q=75 1080w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=1200&q=75 1200w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=1920&q=75 1920w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=2048&q=75 2048w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=3840&q=75 3840w" src="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fredis-tut-img.png&w=3840&q=75"/></div></div><div class="absolute right-2 top-2 flex items-center justify-between text-xs"><span title="TUTORIAL" class="inline-flex items-center shadow-md rounded-full px-3 py-1 bg-gray-200 text-black"><span>TUTORIAL</span></span></div><div class="p-4 flex h-max flex-1 flex-col justify-start"><div class="mb-auto"><div class="flex w-full items-center justify-between"></div><h2 class="mt-1 line-clamp-1 font-bold leading-tight text-2xl">Efficient vector similarity search with Redis: a step-by-step tutorial</h2><p class="mt-2 line-clamp-2 text-sm text-gray-500">Vector similarity can be used to find similar products, articles and much more. In this tutorial, we will show you how to use Redis to index and search for similar vectors.</p></div></div></a></div><div class="card-animation card-border card-shadow relative flex h-full flex-col overflow-hidden rounded-lg bg-white"><a class="flex h-full flex-col justify-between" href="/t/chatgpt-tutorial-how-to-create-a-website-with-chatgpt"><div class=""><div class="relative aspect-video"><img alt="ChatGPT tutorial: How to create a website with ChatGPT" loading="lazy" decoding="async" data-nimg="fill" class="absolute inset-0 size-full bg-gray-50 object-cover sm:object-fill" style="position:absolute;height:100%;width:100%;left:0;top:0;right:0;bottom:0;color:transparent" sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" srcSet="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=256&q=75 256w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=384&q=75 384w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=640&q=75 640w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=750&q=75 750w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=828&q=75 828w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=1080&q=75 1080w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=1200&q=75 1200w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=1920&q=75 1920w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=2048&q=75 2048w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=3840&q=75 3840w" src="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fchatgpt_website_creation.jpg&w=3840&q=75"/></div></div><div class="absolute right-2 top-2 flex items-center justify-between text-xs"><span title="TUTORIAL" class="inline-flex items-center shadow-md rounded-full px-3 py-1 bg-gray-200 text-black"><span>TUTORIAL</span></span></div><div class="p-4 flex h-max flex-1 flex-col justify-start"><div class="mb-auto"><div class="flex w-full items-center justify-between"></div><h2 class="mt-1 line-clamp-1 font-bold leading-tight text-2xl">ChatGPT tutorial: How to create a website with ChatGPT</h2><p class="mt-2 line-clamp-2 text-sm text-gray-500">ChatGPT - the hottest AI topic</p></div></div></a></div><div class="card-animation card-border card-shadow relative flex h-full flex-col overflow-hidden rounded-lg bg-white"><a class="flex h-full flex-col justify-between" href="/t/chatgpt-how-to-improve-your-work-with-chatgpt"><div class=""><div class="relative aspect-video"><img alt="ChatGPT tutorial: How to improve your work with ChatGPT" loading="lazy" decoding="async" data-nimg="fill" class="absolute inset-0 size-full bg-gray-50 object-cover sm:object-fill" style="position:absolute;height:100%;width:100%;left:0;top:0;right:0;bottom:0;color:transparent" sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" srcSet="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=256&q=75 256w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=384&q=75 384w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=640&q=75 640w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=750&q=75 750w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=828&q=75 828w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=1080&q=75 1080w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=1200&q=75 1200w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=1920&q=75 1920w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=2048&q=75 2048w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=3840&q=75 3840w" src="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2FGPT-3_tutorial__Trip_Scheduler_1.jpg&w=3840&q=75"/></div></div><div class="absolute right-2 top-2 flex items-center justify-between text-xs"><span title="TUTORIAL" class="inline-flex items-center shadow-md rounded-full px-3 py-1 bg-gray-200 text-black"><span>TUTORIAL</span></span></div><div class="p-4 flex h-max flex-1 flex-col justify-start"><div class="mb-auto"><div class="flex w-full items-center justify-between"></div><h2 class="mt-1 line-clamp-1 font-bold leading-tight text-2xl">ChatGPT tutorial: How to improve your work with ChatGPT</h2><p class="mt-2 line-clamp-2 text-sm text-gray-500">ChatGPT is a tool that allows you to generate text in a conversation style. In this tutorial, we will show you how to use it to improve your work.</p></div></div></a></div><div class="card-animation card-border card-shadow relative flex h-full flex-col overflow-hidden rounded-lg bg-white"><a class="flex h-full flex-col justify-between" href="/t/chatgpt-guide"><div class=""><div class="relative aspect-video"><img alt="ChatGPT tutorial: ChatGPT - A guide on how to use OpenAI's new ChatGPT" loading="lazy" decoding="async" data-nimg="fill" class="absolute inset-0 size-full bg-gray-50 object-cover sm:object-fill" style="position:absolute;height:100%;width:100%;left:0;top:0;right:0;bottom:0;color:transparent" sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" srcSet="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=256&q=75 256w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=384&q=75 384w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=640&q=75 640w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=750&q=75 750w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=828&q=75 828w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=1080&q=75 1080w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=1200&q=75 1200w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=1920&q=75 1920w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=2048&q=75 2048w, /_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=3840&q=75 3840w" src="/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Flablab-static-eu%2Fimages%2Ftutorials%2Fthumbnailchatgpt.png&w=3840&q=75"/></div></div><div class="absolute right-2 top-2 flex items-center justify-between text-xs"><span title="TUTORIAL" class="inline-flex items-center shadow-md rounded-full px-3 py-1 bg-gray-200 text-black"><span>TUTORIAL</span></span></div><div class="p-4 flex h-max flex-1 flex-col justify-start"><div class="mb-auto"><div class="flex w-full items-center justify-between"></div><h2 class="mt-1 line-clamp-1 font-bold leading-tight text-2xl">ChatGPT tutorial: ChatGPT - A guide on how to use OpenAI's new ChatGPT</h2><p class="mt-2 line-clamp-2 text-sm text-gray-500">ChatGPT is a new tool from OpenAI that allows you to have a conversation with a chatbot. This tutorial will show you how to use it and what it can do.</p></div></div></a></div></div></div><div class="w-full text-center undefined py-12 "><h2 class="text-slate-900 mt-4 font-bold md:mt-0 text-3xl lg:text-5xl">Upcoming AI Hackathons and Events</h2></div></div></section><footer class="bg-black z-10 mt-auto" aria-labelledby="footer-heading"><h3 id="footer-heading" class="sr-only">Footer navigation</h3><div class="mx-auto max-w-7xl px-4 py-12 sm:px-6 lg:px-8 lg:py-16"><div class="xl:grid xl:grid-cols-3 xl:gap-8"><div class="space-y-8 xl:col-span-1"><img alt="Community innovating and building with artificial intelligence" loading="lazy" width="40" height="40" decoding="async" data-nimg="1" style="color:transparent" srcSet="/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Flablab-logo-invertedcolor.903446af.png&w=48&q=75 1x, /_next/image?url=%2F_next%2Fstatic%2Fmedia%2Flablab-logo-invertedcolor.903446af.png&w=96&q=75 2x" src="/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Flablab-logo-invertedcolor.903446af.png&w=96&q=75"/><p class="text-base text-gray-400">Unlocking state-of-the-art artificial intelligence and building with the world's talent</p><div><ul role="list" class="mt-4 flex flex-row gap-6"><li><a target="_blank" rel="noopener noreferrer nofollow" href="https://www.instagram.com/lablab.ai/" class="text-sm text-gray-200 hover:text-gray-500"><span class="sr-only">Instagram</span><svg fill="currentColor" viewBox="0 0 24 24" class="size-6" aria-hidden="true"><path fill-rule="evenodd" d="M12.315 2c2.43 0 2.784.013 3.808.06 1.064.049 1.791.218 2.427.465a4.902 4.902 0 011.772 1.153 4.902 4.902 0 011.153 1.772c.247.636.416 1.363.465 2.427.048 1.067.06 1.407.06 4.123v.08c0 2.643-.012 2.987-.06 4.043-.049 1.064-.218 1.791-.465 2.427a4.902 4.902 0 01-1.153 1.772 4.902 4.902 0 01-1.772 1.153c-.636.247-1.363.416-2.427.465-1.067.048-1.407.06-4.123.06h-.08c-2.643 0-2.987-.012-4.043-.06-1.064-.049-1.791-.218-2.427-.465a4.902 4.902 0 01-1.772-1.153 4.902 4.902 0 01-1.153-1.772c-.247-.636-.416-1.363-.465-2.427-.047-1.024-.06-1.379-.06-3.808v-.63c0-2.43.013-2.784.06-3.808.049-1.064.218-1.791.465-2.427a4.902 4.902 0 011.153-1.772A4.902 4.902 0 015.45 2.525c.636-.247 1.363-.416 2.427-.465C8.901 2.013 9.256 2 11.685 2h.63zm-.081 1.802h-.468c-2.456 0-2.784.011-3.807.058-.975.045-1.504.207-1.857.344-.467.182-.8.398-1.15.748-.35.35-.566.683-.748 1.15-.137.353-.3.882-.344 1.857-.047 1.023-.058 1.351-.058 3.807v.468c0 2.456.011 2.784.058 3.807.045.975.207 1.504.344 1.857.182.466.399.8.748 1.15.35.35.683.566 1.15.748.353.137.882.3 1.857.344 1.054.048 1.37.058 4.041.058h.08c2.597 0 2.917-.01 3.96-.058.976-.045 1.505-.207 1.858-.344.466-.182.8-.398 1.15-.748.35-.35.566-.683.748-1.15.137-.353.3-.882.344-1.857.048-1.055.058-1.37.058-4.041v-.08c0-2.597-.01-2.917-.058-3.96-.045-.976-.207-1.505-.344-1.858a3.097 3.097 0 00-.748-1.15 3.098 3.098 0 00-1.15-.748c-.353-.137-.882-.3-1.857-.344-1.023-.047-1.351-.058-3.807-.058zM12 6.865a5.135 5.135 0 110 10.27 5.135 5.135 0 010-10.27zm0 1.802a3.333 3.333 0 100 6.666 3.333 3.333 0 000-6.666zm5.338-3.205a1.2 1.2 0 110 2.4 1.2 1.2 0 010-2.4z" clip-rule="evenodd"></path></svg></a></li><li><a target="_blank" rel="noopener noreferrer nofollow" href="https://www.reddit.com/r/lablabai/" class="text-sm text-gray-200 hover:text-gray-500"><span class="sr-only">Reddit</span><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" role="img" width="24" height="24" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 640 640"><path d="M160.018 360.052c0-22.087 17.918-40.004 40.004-40.004 22.087 0 39.993 17.917 39.993 40.004 0 22.087-17.906 40.004-39.993 40.004-22.086 0-40.004-17.917-40.004-40.004zm239.991 0c0-22.087 17.918-40.004 40.004-40.004 22.087 0 40.005 17.917 40.005 40.004 0 22.087-17.918 40.004-40.005 40.004-22.086 0-40.004-17.917-40.004-40.004zm1.949 85.477c10.323-8.114 25.252-6.366 33.366 3.957 8.115 10.323 6.367 25.252-3.956 33.367-28.678 22.606-72.403 37.205-111.32 37.205-38.906 0-82.631-14.599-111.356-37.205-10.323-8.115-12.071-23.044-3.957-33.367 8.114-10.323 23.044-12.07 33.367-3.957 16.523 13.005 49.193 27 81.945 27 32.765 0 65.446-13.996 81.958-27h-.047zM640 280.055c0-44.209-35.8-80.008-79.997-80.008-30.083 0-56.245 16.606-69.922 41.126-41.115-22.477-91.206-37.04-145.797-40.394L392 93.58l91.347 26.362c8.245 23.327 30.438 40.076 56.611 40.076 33.119 0 60.001-26.883 60.001-60.001 0-33.119-26.882-60-60-60-22.843 0-42.733 12.755-52.844 31.57l-101.8-29.41c-11.398-3.283-23.48 2.316-28.288 13.158l-64.843 145.62c-53.197 3.768-102.037 18.13-142.266 40.158-13.689-24.52-39.839-41.126-69.922-41.126-44.21 0-79.997 35.8-79.997 80.009 0 32.681 19.63 60.804 47.705 73.194-5.031 15-7.724 30.673-7.724 46.807 0 110.434 125.352 199.987 279.996 199.987 154.644 0 279.996-89.552 279.996-199.987 0-16.122-2.681-31.795-7.725-46.807 28.123-12.39 47.706-40.513 47.706-73.194l.047.059zM539.995 77.588c12.449 0 22.536 10.075 22.536 22.524 0 12.438-10.087 22.524-22.536 22.524-12.437 0-22.524-10.086-22.524-22.524 0-12.449 10.087-22.524 22.524-22.524zM40.015 280.055c0-22.04 17.954-40.004 39.993-40.004 15.97 0 29.73 9.354 36.166 22.914-20.93 15.85-38.233 34.17-51.036 54.201-14.728-5.929-25.122-20.315-25.122-37.11zm279.997 272.507c-128.4 0-232.515-68.268-232.515-152.518 0-84.249 104.068-152.529 232.515-152.529 128.387 0 232.503 68.28 232.503 152.53 0 84.248-104.068 152.517-232.503 152.517zm254.86-235.397c-12.802-20.079-30.106-38.35-51.035-54.201 6.437-13.512 20.197-22.914 36.166-22.914 22.04 0 40.004 17.965 40.004 40.005 0 16.795-10.406 31.205-25.134 37.11z"></path></svg></a></li><li><a target="_blank" rel="noopener noreferrer nofollow" href="https://twitter.com/lablabai" class="text-sm text-gray-200 hover:text-gray-500"><span class="sr-only">Twitter</span><svg fill="currentColor" viewBox="0 0 24 24" class="size-6" aria-hidden="true"><path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84"></path></svg></a></li><li><a target="_blank" rel="noopener noreferrer nofollow" href="https://github.com/lablab-ai" class="text-sm text-gray-200 hover:text-gray-500"><span class="sr-only">GitHub</span><svg fill="currentColor" viewBox="0 0 24 24" class="size-6" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg></a></li><li><a target="_blank" rel="noopener noreferrer nofollow" href="https://discord.com/invite/XnxrJ8ytRs" class="text-sm text-gray-200 hover:text-gray-500"><span class="sr-only">Discord</span><svg width="22" height="100%" viewBox="0 0 71 55" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0)"><path d="M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z" fill="currentColor"></path></g><defs><clipPath id="clip0"><rect width="71" height="55" fill="white"></rect></clipPath></defs></svg></a></li><li><a target="_blank" rel="noopener noreferrer nofollow" href="https://hackernoon.com/u/lablab" class="text-sm text-gray-200 hover:text-gray-500"><span class="sr-only">HackerNoon</span><svg fill="currentColor" viewBox="0 0 24 24" class="size-6" aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg"><path d="M5.701 0v6.223H8.85V4.654h1.576v7.842H12V4.654h1.574v1.569h3.15V0zm11.024 6.223v3.136h1.574V6.223zm1.574 3.136v4.705h1.576v-1.568h1.574v-1.568h-1.574V9.359zm0 4.705h-1.574v3.137h1.574zm-1.574 3.137h-3.15v1.569H8.85V17.2H5.7V24h11.024zm-11.024 0v-3.137H4.125v3.137zm-1.576-3.137V9.36H2.551v4.705zm0-4.705h1.576V6.223H4.125z"></path></svg></a></li></ul></div><div class="flex flex-col gap-3"><p class="text-sm text-gray-200">Other group brands: </p><div class="flex w-full flex-col gap-7 md:flex-row"><a href="https://gaia.newnative.ai/" target="_blank" rel="noopener noreferrer"><img alt="https://gaia.newnative.ai/" loading="lazy" width="110" height="25" decoding="async" data-nimg="1" class="h-6 w-auto object-cover brightness-90 hover:brightness-50" style="color:transparent" src="/GAIA.svg"/></a><a href="https://newnative.ai/" target="_blank" rel="noopener noreferrer"><img alt="https://newnative.ai/" loading="lazy" width="110" height="25" decoding="async" data-nimg="1" class="h-6 w-auto object-cover brightness-90 hover:brightness-50" style="color:transparent" src="/new-native.svg"/></a><a href="/next" target="_blank" rel="noopener noreferrer"><img alt="/next" loading="lazy" width="110" height="25" decoding="async" data-nimg="1" class="h-6 w-auto object-cover brightness-90 hover:brightness-50" style="color:transparent" src="/next-logo.svg"/></a></div></div></div><div class="mg:grid-cols-2 mt-12 grid grid-cols-1 gap-2 sm:grid-cols-3 lg:pl-24 xl:col-span-2 xl:mt-0"><div><span class="text-sm font-semibold uppercase tracking-wider text-gray-400">Links</span><ul role="list" class="mt-4 space-y-2"><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/tech">AI Tech</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/t">AI Tutorials</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/event">AI Hackathons</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/apps">AI Applications</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/next">AI Accelerator</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/blog">Blog</a></li></ul></div><div><span class="text-sm font-semibold uppercase tracking-wider text-gray-400">lablab</span><ul role="list" class="mt-4 space-y-2"><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/about">About</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/brand">Brand</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/guide">Hackathon Guidelines</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/terms-of-use">Terms of Use</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/code-of-conduct">Code of Conduct</a></li><li><a class="text-sm text-gray-200 hover:text-gray-500" href="/privacy-policy">Privacy Policy</a></li></ul></div><div><span class="text-sm font-semibold uppercase tracking-wider text-gray-400">Get in touch</span><ul role="list" class="mt-4 space-y-2"><li><a target="_blank" rel="noopener noreferrer nofollow" href="https://discord.gg/XnxrJ8ytRs" class="text-sm text-gray-200 hover:text-gray-500"><span>Discord</span></a></li><li><a target="_blank" rel="opener" href="/sponsor" class="text-sm text-gray-200 hover:text-gray-500"><span>Sponsor</span></a></li><li><a target="_self" rel="opener" href="/cooperation" class="text-sm text-gray-200 hover:text-gray-500"><span>Cooperation</span></a></li><li><a target="_blank" rel="noopener noreferrer nofollow" href="https://newnative.ai/careers" class="text-sm text-gray-200 hover:text-gray-500"><span>Join the team</span></a></li><li><a target="_blank" rel="noopener noreferrer nofollow" href="https://wkf.ms/3PQMLlq" class="text-sm text-gray-200 hover:text-gray-500"><span>Contribute</span></a></li><li><a target="_blank" rel="opener" href="mailto:community@lablab.ai" class="text-sm text-gray-200 hover:text-gray-500"><span>community@lablab.ai</span></a></li></ul></div></div></div><div class="flex flex-col md:flex-row md:justify-between mt-12"><p class="text-sm text-gray-400 xl:text-center">漏 <!-- -->2025<!-- --> New Native Inc. All rights reserved.</p><p class="text-sm text-gray-400 xl:text-center">0.14.456</p></div></div></footer></div><div style="position:fixed;z-index:9999;top:16px;left:16px;right:16px;bottom:16px;pointer-events:none"></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"source":{"compiledSource":"/*@jsxRuntime automatic @jsxImportSource react*/\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = Object.assign({\n h2: \"h2\",\n a: \"a\",\n span: \"span\",\n p: \"p\",\n div: \"div\",\n pre: \"pre\",\n code: \"code\",\n h3: \"h3\",\n ul: \"ul\",\n li: \"li\",\n strong: \"strong\"\n }, _provideComponents(), props.components), {Img} = _components;\n if (!Img) _missingMdxReference(\"Img\", true);\n return _jsxs(_Fragment, {\n children: [_jsxs(_components.h2, {\nclassName: \"h2-1\",\n id: \"why-use-ai-in-your-e-commerce-business\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#why-use-ai-in-your-e-commerce-business\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Why use AI in your e-commerce business?\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"In today's fast-paced digital world, e-commerce has become a significant part of our daily lives. With the vast number of products available online, it can be challenging for users to find the right product that suits their needs. To address this issue, we can use AI-powered chatbots to help users find the perfect product for their needs by leveraging natural language processing techniques.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"In this tutorial, we will walk you through the process of building an e-commerce chatbot that utilizes Amazon product embeddings, the \", _jsx(_components.a, {\n href: \"https://lablab.ai/tech/openai/chatgpt\",\n className: \"break-all\",\n children: \"ChatGPT API\"\n }), \" (gpt-3.5-turbo) and \", _jsx(_components.a, {\n href: \"https://github.com/hwchase17/langchain\",\n className: \"break-all\",\n rel: \"noopener noreferrer nofollow\",\n target: \"_blank\",\n children: \"Langchain\"\n }), \" to create a seamless and engaging user experience. Our chatbot will take user input, find relevant products from a dataset, and present the information in a friendly and detailed manner. This not only enhances the user experience but also makes the process of finding products much more enjoyable.\"]\n }), \"\\n\", _jsxs(_components.h2, {\nclassName: \"h2-2\",\n id: \"lets-start\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#lets-start\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Let鈥檚 start!\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"We will begin by loading and preprocessing the product data, followed by creating a Redis index and loading vectors into the index. Then, we will use Langchain to create an LLM chain and a prompt template for generating comma-separated product keywords based on the user input. Next, we will query the product embeddings in Redis using the generated keywords and retrieve the top results. Finally, we will present the retrieved products to the user in a nice and engaging way, allowing them to ask follow-up questions.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"By the end of this tutorial, you will have a better understanding of how to build an CLI based e-commerce chatbot that can query Amazon product embeddings and generate user-friendly responses using Langchain. This will not only help improve the overall user experience in the e-commerce space but also pave the way for more advanced and personalized chatbot solutions in the future. So, let's get started and build our very own ecommerce chatbot!\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"Here is a quick example of how a conversation with our chatbot might look like:\"\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-unknown\",\n children: _jsx(_components.code, {\n className: \"language-unknown\",\n children: \"User: im looking for some jewelry for my girlfriend\\nBot: Based on your query, I would recommend checking out these Women\u0026#39;s Engravable 14k Gold Plated 925 Sterling Silver Polished Disc Charm on 18\u0026quot; Chain Pendant Necklace. They might make a great gift for your girlfriend if she likes elegant and stylish jewelry. However, if you are looking for shoes, you might want to check out Amazon Brand - The Fix Women\u0026#39;s Lizzie Block Heel Ruffled Sandal Heeled, Dove Suede, 9 B US. These shoes are great for spring and summer, and perfect for a date night or a fancy event. Another option for shoes could be Amazon Brand - The Fix Women\u0026#39;s Giana Open Toe Bootie with Pearl Buckle, which comes in bright white leather and sizes up to 9.5 B US. I hope this helps!\\nUser: tell me more about the necklace\\nBot: The Women\u0026#39;s Engravable 14k Gold Plated 925 Sterling Silver Polished Disc Charm on 18\u0026quot; Chain Pendant Necklace is a beautiful and elegant piece of jewelry. The pendant is made of 925 sterling silver and is plated with 14k gold for a luxurious look. The pendant is disc-shaped and can be engraved with a personal message or initials to make it even more special. The chain is 18 inches long and adds a delicate touch to the necklace. This necklace is perfect for everyday wear or for special occasions.\\nUser: what\u0026#39;s the product id\\nBot: The product ID for the Women\u0026#39;s Engravable 14k Gold Plated 925 Sterling Silver Polished Disc Charm on 18\u0026quot; Chain Pendant Necklace is B07CJCSYQF.\"\n })\n })\n }), \"\\n\", _jsxs(_components.h2, {\nclassName: \"h2-3\",\n id: \"prerequisites\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#prerequisites\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Prerequisites\"]\n }), \"\\n\", _jsxs(_components.h3, {\nclassName: \"h3-1\",\n id: \"get-the-dataset-csv-file\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#get-the-dataset-csv-file\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Get the dataset CSV file\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Get the dataset CSV file from \", _jsx(_components.a, {\n href: \"https://drive.google.com/file/d/1tHWB6u3yQCuAgOYc-DxtZ8Mru3uV5_lj/view?usp=sharing\",\n className: \"break-all\",\n rel: \"noopener noreferrer nofollow\",\n target: \"_blank\",\n children: \"here\"\n }), \".\"]\n }), \"\\n\", _jsxs(_components.h3, {\nclassName: \"h3-2\",\n id: \"install-the-required-python-packages\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#install-the-required-python-packages\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Install the required Python packages\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"Before we start, make sure you have the following Python packages installed:\"\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsx(_components.li, {\n children: _jsx(_components.code, {\n children: \"redis\"\n })\n }), \"\\n\", _jsx(_components.li, {\n children: _jsx(_components.code, {\n children: \"pandas\"\n })\n }), \"\\n\", _jsx(_components.li, {\n children: _jsx(_components.code, {\n children: \"sentence-transformers\"\n })\n }), \"\\n\", _jsx(_components.li, {\n children: _jsx(_components.code, {\n children: \"openai\"\n })\n }), \"\\n\", _jsx(_components.li, {\n children: _jsx(_components.code, {\n children: \"langchain\"\n })\n }), \"\\n\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"You can install them using the following commands:\"\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [\"pip install redis pandas\\npip install \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"-\"\n }), \"U sentence\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"-\"\n }), \"transformers\\npip install openai\\npip install langchain\\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.h2, {\nclassName: \"h2-4\",\n id: \"loading-and-preprocessing-the-data\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#loading-and-preprocessing-the-data\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Loading and Preprocessing the Data\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"First, we need to load the product data from a CSV file and truncate long text fields. We will use the first 1000 products with non-empty item keywords for our chatbot.\"\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" numpy \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"as\"\n }), \" np\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" pandas \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"as\"\n }), \" pd\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" time\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"from\"\n }), \" redis\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"commands\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"search\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"field \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" VectorField\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"from\"\n }), \" redis\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"commands\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"search\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"field \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" TextField\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"from\"\n }), \" redis\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"commands\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"search\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"field \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" TagField\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"from\"\n }), \" redis\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"commands\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"search\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"query \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" Query\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" redis\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [\"MAX_TEXT_LENGTH\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"512\"\n }), \"\\nNUMBER_PRODUCTS\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"1000\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"def\"\n }), \" \", _jsx(_components.span, {\n className: \"token function\",\n children: \"auto_truncate\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"val\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \"\\n \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"return\"\n }), \" val\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \"MAX_TEXT_LENGTH\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token comment\",\n children: \"#Load Product data and truncate long text fields\"\n }), \"\\nall_prods_df \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" pd\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"read_csv\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"product_data.csv\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" converters\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'bullet_point'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" auto_truncate\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'item_keywords'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \"auto_truncate\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'item_name'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \"auto_truncate\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\nall_prods_df\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'primary_key'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), \" \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" all_prods_df\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'item_id'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), \" \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'-'\"\n }), \" \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" all_prods_df\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'domain_name'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), \"\\nall_prods_df\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'item_keywords'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"replace\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"''\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" np\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"nan\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" inplace\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token boolean\",\n children: \"True\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\nall_prods_df\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"dropna\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"subset\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'item_keywords'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" inplace\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token boolean\",\n children: \"True\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\nall_prods_df\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"reset_index\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"drop\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token boolean\",\n children: \"True\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"inplace\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token boolean\",\n children: \"True\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token comment\",\n children: \"#get the first 1000 products with non-empty item keywords\"\n }), \"\\nproduct_metadata \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" all_prods_df\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"head\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"NUMBER_PRODUCTS\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"to_dict\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"orient\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'index'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\nall_prods_df\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"head\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.h3, {\nclassName: \"h3-3\",\n id: \"creating-the-redis-index-and-loading-vectors\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#creating-the-redis-index-and-loading-vectors\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Creating the Redis Index and Loading Vectors\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"Now, we will create a function to load vectors into the Redis index and a function to create a flat index. We will use these functions later to index our product data.\"\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"def\"\n }), \" \", _jsx(_components.span, {\n className: \"token function\",\n children: \"load_vectors\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"client\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" product_metadata\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" vector_dict\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" vector_field_name\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \"\\n p \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" client\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"pipeline\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"transaction\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token boolean\",\n children: \"False\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"for\"\n }), \" index \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"in\"\n }), \" product_metadata\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"keys\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" \\n \", _jsx(_components.span, {\n className: \"token comment\",\n children: \"#hash key\"\n }), \"\\n key\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'product:'\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" \", _jsx(_components.span, {\n className: \"token builtin\",\n children: \"str\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"index\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"':'\"\n }), \" \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" product_metadata\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), \"index\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'primary_key'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), \"\\n \\n \", _jsx(_components.span, {\n className: \"token comment\",\n children: \"#hash values\"\n }), \"\\n item_metadata \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" product_metadata\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), \"index\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), \"\\n item_keywords_vector \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" vector_dict\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), \"index\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"astype\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"np\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"float32\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"tobytes\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n item_metadata\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), \"vector_field_name\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"item_keywords_vector\\n \\n \", _jsx(_components.span, {\n className: \"token comment\",\n children: \"# HSET\"\n }), \"\\n p\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"hset\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"key\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"mapping\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"item_metadata\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n \\n p\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"execute\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"def\"\n }), \" \", _jsx(_components.span, {\n className: \"token function\",\n children: \"create_flat_index\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"redis_conn\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"vector_field_name\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"number_of_vectors\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" vector_dimensions\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"512\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" distance_metric\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'L2'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \"\\n redis_conn\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"ft\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"create_index\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), \"\\n VectorField\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"vector_field_name\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"FLAT\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"TYPE\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"FLOAT32\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"DIM\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" vector_dimensions\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"DISTANCE_METRIC\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" distance_metric\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"INITIAL_CAP\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" number_of_vectors\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"BLOCK_SIZE\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \"number_of_vectors \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n TagField\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"product_type\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n TextField\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"item_name\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n TextField\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"item_keywords\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n TagField\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"country\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \" \\n \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \" \\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.h3, {\nclassName: \"h3-4\",\n id: \"connect-to-our-redis-db\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#connect-to-our-redis-db\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Connect to our Redis DB\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"Next, we will create the Redis connection and load the vectors into the Redis index.\"\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [\"ITEM_KEYWORD_EMBEDDING_FIELD\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'item_keyword_vector'\"\n }), \"\\nTEXT_EMBEDDING_DIMENSION\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"768\"\n }), \"\\nNUMBER_PRODUCTS\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"1000\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'Loading and Indexing + '\"\n }), \" \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" \", _jsx(_components.span, {\n className: \"token builtin\",\n children: \"str\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"NUMBER_PRODUCTS\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \" \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"' products'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token comment\",\n children: \"#flush all data\"\n }), \"\\nredis_conn\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"flushall\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token comment\",\n children: \"#create flat index \u0026 load vectors\"\n }), \"\\ncreate_flat_index\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"redis_conn\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" ITEM_KEYWORD_EMBEDDING_FIELD\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"NUMBER_PRODUCTS\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"TEXT_EMBEDDING_DIMENSION\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'COSINE'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\nload_vectors\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"redis_conn\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"product_metadata\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"item_keywords_vectors\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"ITEM_KEYWORD_EMBEDDING_FIELD\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n \\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.h2, {\nclassName: \"h2-5\",\n id: \"creating-the-chatbot\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#creating-the-chatbot\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Creating the Chatbot\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"We will use the ChatGPT API (gpt-3.5-turbo) in combination with Langchain to create a response to our questions. If you want to dive deep and learn more about how to integrate the \", _jsx(_components.a, {\n href: \"https://lablab.ai/t/chatgpt-tutorial-how-to-integrate-chatgpt-and-whisper-api-into-your-project\",\n className: \"break-all\",\n children: \"ChatGPT API\"\n }), \" to your other projects, we have dedicated tutorials for this.\"]\n }), \"\\n\", _jsxs(_components.h3, {\nclassName: \"h3-5\",\n id: \"go-from-user-input-string-to-product-keywords\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#go-from-user-input-string-to-product-keywords\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Go from user input string to product keywords\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"We will use Langchain to create an LLM chain for our chatbot. First, we will create a prompt template to generate comma-separated product keywords from the user input.\"\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"from\"\n }), \" langchain\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"prompts \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" PromptTemplate\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"from\"\n }), \" langchain\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"llms \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" OpenAI\\n\\nllm \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" OpenAI\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"model_name\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"gpt-3.5-turbo\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" temperature\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"0.3\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" openai_api_key\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"sk-9xxxxxxxxxx4\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\nprompt \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" PromptTemplate\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"\\n input_variables\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"product_description\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n template\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Create comma seperated product keywords to perform a query on a amazon dataset for this user input: {product_description}\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"from\"\n }), \" langchain\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"chains \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" LLMChain\\nchain \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" LLMChain\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"llm\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"llm\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" prompt\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"prompt\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"Now, let's use our chain.\"\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [\"userinput \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token builtin\",\n children: \"input\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Hey im a E-commerce Chatbot, how can i help you today? \\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"User:\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" userinput\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Run the chain only specifying the input variable.\"\n }), \"\\nkeywords \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" chain\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"run\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"userinput\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.h3, {\nclassName: \"h3-6\",\n id: \"query-our-data\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#query-our-data\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Query our data\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"We will then use the generated keywords to query the product embeddings in Redis and retrieve the top 3 results.\"\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [\"topK \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token number\",\n children: \"3\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Vectorize the query\"\n }), \"\\nquery_vector \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" model\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"encode\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"keywords\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"astype\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"np\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"float32\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"tobytes\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Prepare the query\"\n }), \"\\nq \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" Query\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsxs(_components.span, {\n className: \"token string-interpolation\",\n children: [_jsx(_components.span, {\n className: \"token string\",\n children: \"f'*=\u003e[KNN \"\n }), _jsxs(_components.span, {\n className: \"token interpolation\",\n children: [_jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), \"topK\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \" @\"\n }), _jsxs(_components.span, {\n className: \"token interpolation\",\n children: [_jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), \"ITEM_KEYWORD_EMBEDDING_FIELD\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \" $vec_param AS vector_score]'\"\n })]\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"sort_by\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'vector_score'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"paging\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"0\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" topK\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"return_fields\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"'vector_score'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'item_name'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'item_id'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"'item_keywords'\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"dialect\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"2\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\nparams_dict \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"vec_param\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \" query_vector\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token comment\",\n children: \"# Execute the query\"\n }), \"\\nresults \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" redis_conn\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"ft\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"search\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"q\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" query_params\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"params_dict\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\nfull_result_string \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"''\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"for\"\n }), \" product \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"in\"\n }), \" results\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"docs\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \"\\n full_result_string \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+=\"\n }), \" product\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"item_name \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"' '\"\n }), \" \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" product\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"item_keywords \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"' '\"\n }), \" \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" product\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"item_id \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"+\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"\\\\n\\\\n\\\\n\\\"\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.h3, {\nclassName: \"h3-7\",\n id: \"create-the-chatbot\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#create-the-chatbot\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Create the chatbot\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"Finally, we will create another LLM chain to generate a nice response from the retrieved products and present it to the user. The user is also able to ask follow up questions. Note, that we added a memory to the chain to keep track of the chat history.\"\n }), \"\\n\", _jsx(_components.div, {\n className: \"remark-highlight\",\n children: _jsx(_components.pre, {\n className: \"language-python\",\n children: _jsxs(_components.code, {\n className: \"language-python\",\n children: [_jsx(_components.span, {\n className: \"token keyword\",\n children: \"from\"\n }), \" langchain\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"memory \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"import\"\n }), \" ConversationBufferMemory\\n\\ntemplate \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token triple-quoted-string string\",\n children: \"\\\"\\\"\\\"You are a chatbot. Be kind, detailed and nice. Present the given queried search result in a nice way as answer to the user input. dont ask questions back! just take the given context\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token triple-quoted-string string\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token triple-quoted-string string\",\n children: \"{chat_history}\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token triple-quoted-string string\",\n children: \"Human: {user_msg}\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token triple-quoted-string string\",\n children: \"Chatbot:\\\"\\\"\\\"\"\n }), \"\\n\\nprompt \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" PromptTemplate\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"\\n input_variables\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"[\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"chat_history\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" \", _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"user_msg\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"]\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n template\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"template\\n\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\nmemory \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" ConversationBufferMemory\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"memory_key\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"chat_history\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\nllm_chain \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" LLMChain\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"\\n llm\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"OpenAI\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"model_name\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"gpt-3.5-turbo\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" temperature\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"0.8\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" openai_api_key\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"sk-9xxxxxxxxxxxxxxxxxxxx4\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n prompt\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"prompt\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n verbose\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsx(_components.span, {\n className: \"token boolean\",\n children: \"False\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n memory\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"memory\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\nanswer \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" llm_chain\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"predict\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"user_msg\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), _jsxs(_components.span, {\n className: \"token string-interpolation\",\n children: [_jsx(_components.span, {\n className: \"token string\",\n children: \"f\\\"\"\n }), _jsxs(_components.span, {\n className: \"token interpolation\",\n children: [_jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), \"full_result_string\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \" ---\\\\n\\\\n \"\n }), _jsxs(_components.span, {\n className: \"token interpolation\",\n children: [_jsx(_components.span, {\n className: \"token punctuation\",\n children: \"{\"\n }), \"userinput\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"}\"\n })]\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"\"\n })]\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Bot:\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" answer\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\ntime\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"sleep\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"0.5\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\\n\", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"while\"\n }), \" \", _jsx(_components.span, {\n className: \"token boolean\",\n children: \"True\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \":\"\n }), \"\\n follow_up \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" \", _jsx(_components.span, {\n className: \"token builtin\",\n children: \"input\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Anything else you want to ask about this topic?\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"User:\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" follow_up\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n answer \", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \" llm_chain\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"predict\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), \"\\n user_msg\", _jsx(_components.span, {\n className: \"token operator\",\n children: \"=\"\n }), \"follow_up\\n \", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n \", _jsx(_components.span, {\n className: \"token keyword\",\n children: \"print\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token string\",\n children: \"\\\"Bot:\\\"\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \",\"\n }), \" answer\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n time\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \".\"\n }), \"sleep\", _jsx(_components.span, {\n className: \"token punctuation\",\n children: \"(\"\n }), _jsx(_components.span, {\n className: \"token number\",\n children: \"0.5\"\n }), _jsx(_components.span, {\n className: \"token punctuation\",\n children: \")\"\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.h2, {\nclassName: \"h2-6\",\n id: \"conclusion\",\n children: [_jsx(_components.a, {\n \"aria-hidden\": \"true\",\n tabIndex: \"-1\",\n href: \"#conclusion\",\n className: \"break-all\",\n children: _jsx(_components.span, {\n className: \"icon icon-link\"\n })\n }), \"Conclusion\"]\n }), \"\\n\", _jsx(Img, {\n src: \"https://storage.googleapis.com/lablab-static-eu/images/tutorials/New_Native_a_dreamlike_picture_of_a_robotclerk_selling_a_trinqu_579b7263-dc3e-4165-a008-801184b76a71.png\",\n alt: \"conclusion banner\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"In this tutorial, we have built an e-commerce chatbot that can query Amazon product embeddings using Redis and generate detailed and friendly responses with Langchain. We have demonstrated how to load and preprocess product data, create a Redis index, and load vectors into the index. We have also shown how to use Langchain to create an LLM chain for generating keywords and responses for user queries.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"By utilizing the power of product embeddings and language models, our chatbot can efficiently search for relevant product recommendations and present them in an engaging and informative manner. This approach can be further extended to include more products, handle complex queries, and even provide personalized recommendations by incorporating user preferences.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"We hope this tutorial has given you a good starting point for building your own e-commerce chatbot or implementing similar solutions in other domains. With the rapid advancements in AI technologies, there are endless possibilities for creating intelligent, engaging, and helpful chatbots that can improve user experience and drive business success.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"You can find the full source code for this tutorial \", _jsx(_components.a, {\n href: \"https://github.com/lablab-ai/redis-langchain-ecommerce-chatbot\",\n className: \"break-all\",\n rel: \"noopener noreferrer nofollow\",\n target: \"_blank\",\n children: \"here on Github\"\n })]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"And if you want to give your new skills a spin and build an amazing app with cutting edge technology and assistance from our mentors, \", _jsx(_components.a, {\n href: \"https://lablab.ai/event\",\n className: \"break-all\",\n children: \"join our AI Hackathons and build the future with AI\"\n }), \".\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Thank you!\"\n }), \"\\nIf you enjoyed this tutorial you can find more and continue reading \", _jsx(_components.a, {\n href: \"https://lablab.ai/t\",\n className: \"break-all\",\n children: \"on our tutorial page\"\n }), \" - \", _jsx(_components.a, {\n href: \"https://github.com/ezzcodeezzlife\",\n className: \"break-all\",\n rel: \"noopener noreferrer nofollow\",\n target: \"_blank\",\n children: \"Fabian Stehle\"\n }), \", Full Stack Developer at \", _jsx(_components.a, {\n href: \"https://newnative.ai/\",\n className: \"break-all\",\n rel: \"noopener noreferrer nofollow\",\n target: \"_blank\",\n children: \"New Native\"\n })]\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = Object.assign({}, _provideComponents(), props.components);\n return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {\n children: _jsx(_createMdxContent, props)\n })) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\nfunction _missingMdxReference(id, component) {\n throw new Error(\"Expected \" + (component ? \"component\" : \"object\") + \" `\" + id + \"` to be defined: you likely forgot to import, pass, or provide it.\");\n}\n","frontmatter":{},"scope":{"title":"E-commerce chatbot build with Redis, Langchain and ChatGPT: a step-by-step tutorial","description":"In this tutorial, we will build an e-commerce chatbot that can query Amazon product embeddings using Redis, CHatGPT and generate responses with Langchain.","image":"https://storage.googleapis.com/lablab-static-eu/images/tutorials/ecomm-chatbot.png","authorUsername":"ezzcodeezzlife"}},"frontMatter":{"title":"E-commerce chatbot build with Redis, Langchain and ChatGPT: a step-by-step tutorial","description":"In this tutorial, we will build an e-commerce chatbot that can query Amazon product embeddings using Redis, CHatGPT and generate responses with Langchain.","image":"https://storage.googleapis.com/lablab-static-eu/images/tutorials/ecomm-chatbot.png","authorUsername":"ezzcodeezzlife"},"author":{"id":"cl5tk6oal628360sd3pb4r909z","email":"trapffm@web.de","emailVerified":null,"image":"https://avatars.githubusercontent.com/u/64021988?v=4","name":"fabi.s","role":"USER","createdAt":"2023-07-21T09:31:49.072Z","updatedAt":"2024-08-13T12:04:58.539Z","profile":{"userId":"cl5tk6oal628360sd3pb4r909z","firstName":"Fabian","lastName":"Stehle","email":"fabian.stehle@newnative.ai","image":"https://storage.googleapis.com/lablab-static-eu/images%2Fusers%2Fusers%2Fcl5tk6oal628360sd3pb4r909z_vp03hrv_cover.jpg","createdAt":"2022-08-09T10:34:05.587Z","updatedAt":"2024-09-27T21:48:23.405Z","hire":false,"id":"cl6m1p2tv61040ua8dpot8irx","about":"Dev from Germany 馃殌","userName":"ezzcodeezzlife","discord":"Fabian Stehle#6149","githubUrl":"https://github.com/ezzcodeezzlife","linkedinUrl":"https://www.linkedin.com/in/fabianstehle/","facebookUrl":"","instagramUrl":"","redditUrl":"","personalwebsiteUrl":"","role":"Dev at NN","twitterUrl":"https://twitter.com/FabiStehle","organization":"Fulda University of Applied Sciences","volunteer":false,"timezone":"UTC +02:00","picture":"https://storage.googleapis.com/lablab-static-eu/images/users/undefined_picture_y927pt0uqu.jpg","location":"Germany","discordId":"1003992950759510176","public":true,"yearsOfExp":3,"technicalExp":"4","businessExp":"4","creativeExp":"3","leaderExp":"3","subscribedToMail":true}},"createdAt":"Friday, March 24, 2023","imageUrl":"https://storage.googleapis.com/lablab-static-eu/images/tutorials/image-redis-langchain.png","pageUrl":"https://lablab.ai/t/redis-langchain-ecommerce-chatbot","techs":[{"id":"clfmvhob2000icy0ruvix80tr","techId":"cleo443u10000da0sldjo08il","techName":"LangChain","techSlug":"langchain","eventId":null,"eventName":null,"eventSlug":null,"submissionId":null,"submissionName":null,"submissionSlug":null,"streamId":null,"streamName":null,"streamSlug":null,"tutorialId":"clfmvhob2000gcy0rgqbwfhfc","tutorialName":null,"tutorialSlug":null,"applicationId":null,"articleId":null,"articleName":null,"articleSlug":null,"profileId":null,"tech":{"id":"cleo443u10000da0sldjo08il","name":"LangChain","fullName":"LangChain","slug":"langchain","description":"Large language models (LLMs) have transformed the way we approach machine learning and artificial intelligence. These models are incredibly powerful, but their true potential lies in their ability to work in harmony with other sources of data and computation. This library has been developed to assist developers in building applications that combine LLMs with other technologies, allowing them to create truly intelligent and innovative products.","color":null,"discovery":true,"providerId":"clp6yfqer0006pf0hw679qu8v","order":8,"categoryId":null,"typeId":"cljqyyssh0002qk0hfjxmwidd","baseTechnologyId":null,"provider":{"id":"clp6yfqer0006pf0hw679qu8v","name":"Langchain","slug":"langchain","description":"Large language models (LLMs) have transformed the way we approach machine learning and artificial intelligence. These models are incredibly powerful, but their true potential lies in their ability to work in harmony with other sources of data and computation. This library has been developed to assist developers in building applications that combine LLMs with other technologies, allowing them to create truly intelligent and innovative products.","color":null}}},{"id":"clfmvhob2000jcy0rfwsco4dx","techId":"cleft5ldi0000er0sh779ni5o","techName":"Redis","techSlug":"redis","eventId":null,"eventName":null,"eventSlug":null,"submissionId":null,"submissionName":null,"submissionSlug":null,"streamId":null,"streamName":null,"streamSlug":null,"tutorialId":"clfmvhob2000gcy0rgqbwfhfc","tutorialName":null,"tutorialSlug":null,"applicationId":null,"articleId":null,"articleName":null,"articleSlug":null,"profileId":null,"tech":{"id":"cleft5ldi0000er0sh779ni5o","name":"Redis","fullName":"Redis","slug":"redis","description":"Redis is an open-source, in-memory data store that provides access to mutable data structures via a set of commands. It offers high performance and scalability, making it a popular choice for use in web applications and other use cases that require fast data access. Redis supports various advanced features such as persistence options, replication, clustering, and pub/sub messaging.","color":null,"discovery":true,"providerId":null,"order":14,"categoryId":null,"typeId":"cljqyok2g0000qk0h05obaczf","baseTechnologyId":null,"provider":null}},{"id":"clfmvhob2000kcy0r9f7p8aux","techId":"clbqfik170002890s9mm8h2qz","techName":"ChatGPT","techSlug":"chatgpt","eventId":null,"eventName":null,"eventSlug":null,"submissionId":null,"submissionName":null,"submissionSlug":null,"streamId":null,"streamName":null,"streamSlug":null,"tutorialId":"clfmvhob2000gcy0rgqbwfhfc","tutorialName":null,"tutorialSlug":null,"applicationId":null,"articleId":null,"articleName":null,"articleSlug":null,"profileId":null,"tech":{"id":"clbqfik170002890s9mm8h2qz","name":"ChatGPT","fullName":"Chat Generative Pre-Trained Transformer","slug":"chatgpt","description":"ChatGPT is a large language model trained by OpenAI to generate human-like text in a conversational style. It is a variant of the GPT-3 model, which was specifically designed to be used to generate text in response to user input. The ChatGPT model has been trained on a vast amount of text data, including conversations and other types of human-generated text, which allows it to generate text that is similar in style and content to human conversation. ChatGPT can be used to generate responses to questions, code, make suggestions, or provide information in a conversational manner, and it is able to do so in a way that is often indistinguishable from human-generated text. The initial model has been trained using Reinforcement Learning from Human Feedback (RLHF), using methods similar to InstructGPT, but with slight differences in the data collection setup. The model is trained using supervised fine-tuning, where human AI trainers provided conversations in which they played both sides鈥攖he user and an AI assistant. The trainers would have had access to model-written suggestions to help them compose their responses.","color":null,"discovery":true,"providerId":"cldlkuxyv0000pj0hygcjxstl","order":1,"categoryId":null,"typeId":"cljqyyssh0002qk0hfjxmwidd","baseTechnologyId":null,"provider":{"id":"cldlkuxyv0000pj0hygcjxstl","name":"OpenAI","slug":"openai","description":"OpenAI is an AI research and deployment company","color":"blue-100"}}}],"otherTutorials":[{"id":"cljfjlkbk0000p60h6147egex","slug":"autogpt-tutorial-building-ai-agent-powered-research-assistant-app","createdAt":"2023-06-28T09:57:01.854Z","authorId":"clhovwr1j000yen0sngtmz4l0","textChannelId":null,"title":"AutoGPT Tutorial: Building an AI Agent-Powered Research Assistant App","imageUrl":"https://storage.googleapis.com/lablab-static-eu/images/tutorials/autogpt-tut-thumbnail.png","description":"Learn how to develop a research assistant app powered by AI agents. These agents can formulate step-by-step solutions and generate reports in text files.","published":true,"boost":1},{"id":"clhqf8sn200037x0stajk8119","slug":"ai-agents-tutorial-how-to-use-and-create-them","createdAt":"2023-05-16T15:21:10.910Z","authorId":"cl7kmske9149200uatld04xsoj","textChannelId":null,"title":"AI Agents tutorial: How to use and build AI Agents","imageUrl":"https://imagedelivery.net/K11gkZF3xaVyYzFESMdWIQ/c77c8021-39ee-4d97-7ffd-31d6bb0fd100/full","description":"Have you heard of AI Agents? If you didn鈥檛 - don鈥檛 worry. In a few moments you鈥檙e gonna learn everything about AI Agents - their capabilities, how to use them and create tools for them!","published":true,"boost":1},{"id":"clgw5kk8i0001cv0sn0jas2lh","slug":"t2i-assistant-redis","createdAt":"2023-04-25T10:57:18.450Z","authorId":"cl7kmske9149200uatld04xsoj","textChannelId":null,"title":"Redis tutorial: Text to Image AI assistant with Redis Search","imageUrl":"https://imagedelivery.net/K11gkZF3xaVyYzFESMdWIQ/3ef1c25b-f2b4-45d0-ba79-fa13ca835400/full","description":"In this tutorial you will learn how to use Redis Database and Vector Similarity Search to create a text-to-image AI assistant","published":true,"boost":1},{"id":"clefs9an60002ap0sdzhzjm2p","slug":"efficient-vector-similarity-search-with-redis-a-step-by-step-tutorial","createdAt":"2023-02-22T14:40:54.306Z","authorId":"cl5tk6oal628360sd3pb4r909z","textChannelId":null,"title":"Efficient vector similarity search with Redis: a step-by-step tutorial","imageUrl":"https://storage.googleapis.com/lablab-static-eu/images/tutorials/redis-tut-img.png","description":"Vector similarity can be used to find similar products, articles and much more. In this tutorial, we will show you how to use Redis to index and search for similar vectors.","published":true,"boost":1},{"id":"clbznq6io0001940sur51rpia","slug":"chatgpt-tutorial-how-to-create-a-website-with-chatgpt","createdAt":"2022-12-22T22:30:20.543Z","authorId":"cl2q8yd8r000409l8ebw242w1","textChannelId":null,"title":"ChatGPT tutorial: How to create a website with ChatGPT","imageUrl":"https://storage.googleapis.com/lablab-static-eu/images/tutorials/chatgpt_website_creation.jpg","description":"ChatGPT - the hottest AI topic","published":true,"boost":1},{"id":"clchgahrk0003c80se1hxjshh","slug":"chatgpt-how-to-improve-your-work-with-chatgpt","createdAt":"2023-01-04T09:22:02.480Z","authorId":"cl5tk6oal628360sd3pb4r909z","textChannelId":null,"title":"ChatGPT tutorial: How to improve your work with ChatGPT","imageUrl":"https://storage.googleapis.com/lablab-static-eu/images/tutorials/GPT-3_tutorial__Trip_Scheduler_1.jpg","description":"ChatGPT is a tool that allows you to generate text in a conversation style. In this tutorial, we will show you how to use it to improve your work.","published":true,"boost":1},{"id":"clbnfagdh00017y0sulvvv4w4","slug":"chatgpt-guide","createdAt":"2022-12-14T09:00:55.781Z","authorId":"cl5tk6oal628360sd3pb4r909z","textChannelId":null,"title":"ChatGPT tutorial: ChatGPT - A guide on how to use OpenAI's new ChatGPT","imageUrl":"https://storage.googleapis.com/lablab-static-eu/images/tutorials/thumbnailchatgpt.png","description":"ChatGPT is a new tool from OpenAI that allows you to have a conversation with a chatbot. This tutorial will show you how to use it and what it can do.","published":true,"boost":1}],"upcomingEvents":[],"token":"W21jb6h9u2REXUdGiPAmLXGrcGRBJZcV","slug":"redis-langchain-ecommerce-chatbot","id":"clfmvhob2000gcy0rgqbwfhfc","textChannelId":null},"__N_SSG":true},"page":"/t/[t]","query":{"t":"redis-langchain-ecommerce-chatbot"},"buildId":"FZb6s4CdJX27Luwq7LZ84","runtimeConfig":{"version":"0.14.456"},"isFallback":false,"gsp":true,"scriptLoader":[]}</script></body></html>