how-to-connect-chatbot-with-geminiai-banner
how-to-connect-chatbot-with-geminiai-banner
how-to-connect-chatbot-with-geminiai-banner

Botnoi Voice

Feb 16, 2024

Label

UX/UI

How to connect your LINE chatbot to GEMINI (GEN AI) without writing a single code.

How to connect your LINE chatbot to GEMINI (GEN AI) without writing a single code.

In recent years, many major companies including Open AI, Microsoft, Meta, Google and many others have advanced their artificial intelligence development by launching their AI chatbots. Recently, Google has gained a head start in the AI ​​race by launching a new model called “Gemini”. With the ability to make decisions, give good answers and think carefully when answering more difficult and complex questions, it is an amazing AI that users can integrate into their own system.

What is Chat Gemini?

Gemini is a multi-model AI that is an evolution of a previous project from Google formerly known as Bard, a chatbot that was first unveiled on February 6, 2023. With this rebrand, the new Google chatbot promises a variety of features and functionalities that are much more accurate, nuanced and intuitive. It has the amazing ability to support normal text, code, audio, image and video data types.

example-chatting-with-geminiAI-image

Note: Make sure you only use the free version. Google can use this data to improve its AI, so don't share any sensitive data or company information.

How to connect Gemini to the chatbot?

For us casual users, the most interesting part of Gemini is the possibility of integrating Google Gemini into our mobile app that can significantly enhance app functionality and user interaction. For example, what happens if we connect Gemini with LINE, an instant messaging app that we’re all familiar with? What new features can you explore?

Below you can see an example of connecting LINE Chatbot to Gemini. It takes less than 10 minutes and only four steps if done through BOTNOI's chatbot system.

example-of-using-gemini-with-chatbot

Step 1: Create an API key

First, let’s head Google AI Studio if you have never signed up for an account here before. A page with the terms of use will appear, which you can accept. Note that you have to agree on the first section to gain access. Agree to the terms of use as requested. A box will also appear where you can voluntarily sign up to receive news, updates and invitations.

step1-1-get-api-keystep1-2-get-api-keystep1-3-get-api-key

Steps to get the API key from Google AI Studio:

  1. Select the "Get API key" menu.

  2. Press "Create API key".

  3. In case you have never created one before, select "Create API key in new project".

  4. Wait for a hot second and you will get API keys to use!

Step 2: Create LINE OA account and connect to Botnoi.ai

Create LINE OA

Those who already have a LINE OA (official account) connected to some bots can skip this step. However, those who are yet with a LINE account can watch this video showing how to create a LINE OA.

Account connection to Botnoi.ai

Now we will connect our LINE OA account to BOTNOI platform. The connection method can be found in "How to create a bot and connect it to LINE". Please go ahead and refer to it.

Step 3: Connect Gemini via Botnoi.ai

step3-1-connect-gemini-to-botnoi
  1. Select API menu.

  2. Press Add.

  3. Name API and select the post method.

curl
  -H 'Content-Type: application/json' \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "<<keyword>>"
        }
      ]
    }
  ]
}' \
  -X POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=YOUR_API_KEY
  1. Enter the URL in the field: https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=

    followed by the API key copied in step 1.

  2. Add headers and body. In the header field, enter Content-Type and in the Value field, enter application/json. Copy the code and paste it in the body section.

  3. Then press Save.

step3-2-connect-gemini-to-botnoi

Step 4: Calling Gemini API

step4-1-call-api
  1. Click Train Bot.

  2. Select Default Fallback.

  3. Press BOT RESPONSE.

  4. Select the existing object response and then API_gemini that we named in step 3.

  5. Add another response in text format and enter it like this: <<API_gemini.candidates.0.content.parts.0.text>>. If you have a different API name, please use your own API name to replace it.

  6. When you’re done, press save.


That's it, now you have a super chatbot at your fingertips, powered by Google's access to world-class resources! Those who want to get more details on this topic can read what Dr. Winn Voravuthikunchai, CEO of Botnoi Group, wrote in the Medium article explaining how to create a super-intelligent LINE chatbot for free and without code using AI LLM GEMINI. It's so easy, even those without programming experience can do it!

If you are interested, you can contact the following social media accounts for more information

FB Group: Meta Community

Article explaining how to create a chatbot: How to create dynamic Flex messages that pull data from Google Sheet and display it via Botnoi.ai [with code]

กลับ

Collaborate to Innovate

Together, We Build the Future.

Collaborate to Innovate

Together, We Build the Future.