Making Custom Chatbots through Google AI Studio (Simplest way to make a Chatbot)

Tejas Patel
5 min readJul 5, 2024

--

Ever thought of creating your own custom chatbot ? Or like how these guys in hackathons create one lol… Well tighten your seatbelts as we dive into a productive session on how to create our own chatbot ;)

Google AI Studio

Well here’s the link to Google AI Studio: https://ai.google.dev/aistudio

After clicking the landing page would be something like:

Here you need to click on CTA button attached below “Sign In to Google AI Studio”. After clicking you need to sign in and then you will be redirected to the dashboard of Google AI Studio.

Here is the how the dashboard would look.

The section we gonna traverse are ‘Get API Key’, ‘Create new prompt’ (deafault page), and my library. You can also take a look at the documentation and Gemini cookbook one we complete our exploration.

So lets cook !!! 🔪

  1. Well you can see the main section, heading with “Untitled Prompt”. You can rename it and give your name to your chatbot or application.
  2. Click on ‘System Intructions’ written below it. Here you need to provide all the details that you want your chatbot to be trained on. This is basically what your model would respond when questions will be asked.

Well here’s an example of it. I wanted my assistant to answer people when they visit my portfolio website.

“Your are an assistant for a portfolio website of Tejas Patel. Tejas Patel is a full stack web developer based in Ahmedabad, specializing in Next.js. His portfolio website includes four pages: Home, Contact, Projects, and About Me. He holds a Diploma in Information Technology and is currently pursuing a Bachelor’s degree. Tejas is proficient in Java, Python, and JavaScript, actively working on DSA (Data Structures and Algorithms) in Java, with over 100 problems solved on LeetCode. For contact, reach out via techtezofficial@gmail.com. He enjoys reading books and binge-watching series and movies for entertainment, with a preference for pop and hip hop music. Check out his taste through the Spotify embed at the end of each page on his site.

Tejas has developed full-fledged projects with CRUD operations and relational functionalities, including a SaaS AI software using OpenAI, a comprehensive Blog app, and an Event app featuring event creation, ticketing, and Stripe integrations. His additional skills include Firebase, Prisma, Redux, Recoil, Zustand, and more. He created an AI assistant named Tez, trained by Tejas, to provide insights about him and his work. For any questions outside this scope, Tez will let you know it’s not trained to answer them.”

Here’s how I trained my model to answer information related to me and my work. Anything outside the scope would not be answered with a user friendly message.

3. Well you are ready to go !! Now you can test it by writing prompts and you can see how your model would respond. You can make changes to your training dataset accordingly.

4. You can change models and Temperature of your model as you need. If you are wandering what temperature is then “temperature” refers to a parameter that controls the randomness of the model’s output. A higher temperature value (e.g., 1.0) makes the output more random, while a lower value (e.g., 0.2) makes the output more deterministic and focused.

Well there are some other settings as well like safety settings, Top-k Sampling, Top-p (Nucleus) Sampling etc.

configurations in model

5. Now the MAIN THING… integration in our application (web/ mobile). Well thats simple too…If you already discovered then bingo ! There’s stays a button on top right “Get Code” (not available in Gemma2 model yet).

Once you click on it you will see google already provides the boilerplate code to run your model. Its available in 4 languages (javaScript 👑, python 🐍, Kotlin, and Swift 🍎

6. Well before integrating it don’t forget to get an API Key ! Click on “Get API Key” (top left blue CTA button). You can click on “create API key” and create your own API key. Then replace the API key in code where it is needed while making the instance of model.

Well this is only one way about how you can leverage the power of Google AI Studio. It holds the worth to create many useful applications !

  • Creative Text Generation: Craft poems, scripts, musical pieces, emails, letters, etc., by providing prompts and letting the AI generate different creative text formats.
  • Code Generation: Get help writing code by giving the model descriptions of the desired functionalities. AI Studio can generate code snippets or even full functions.
  • Image and Audio Generation: Produce images or audio based on your descriptions.

Well the new Vertex AI hold much more capabilities. Dont’t forget to explore it.

Thank you for reading so far !! EXPLORE !!!

--

--