https://codesandbox.io/p/devbox/rate-limiting-in-nodejs-3z744y?embed=1&file=%2Fsrc%2Fapp.controller.ts
1. In the technically growing world, everyone requires rapid digital solutions to succeed. Customer support has also become a core component that is mostly served by chatbots. Thus, using NodeJS and Express as server-side frameworks, an application that allows for building a scalable chatbot was developed for further intelligent conversation using the Google Gemini API.
Generate a Google Gemini key from here.
Build a new NodeJS project. Change your directory to where your project is in your terminal and type this command.
mkdir gemini-chatbot
cd gemini-chatbot
npm init -y
Install the necessary dependencies for your project. Also, install the @openai/gemini package for interacting with Gemini AI.
npm install axios @openai/gemini express dotenv
Create a dotenv(.env) file in your project directory and add your Gemini API credentials.
API_KEY=*******************
Now, replace ******************* with your generated Gemini API key.
Create a new file in the NodeJS application as index.js in your project directory. Add the following code there.
Testing Your Chatbot
Now, Test the chatbot by hitting the api end-point and adding the query parameters to it. To make it easy and intractable, we will create a React app, connect an API, and get the responses.
Create a ReactJS app Using command
npx create-react-app gemini-chatbot
cd gemini-chatbot
npm start
Create component Gen.js and Gen.css and call it in App.js
Hit npm start and it will load the application at http://localhost:3000. Ready to transform your business with our technology solutions? Contact us today to Leverage Our NodeJS Expertise.