How I Built Basudev Chatbot with Gemini API – A Wild, Tangled Mess
Okay, so… I made this thing called Basudev Chatbot. Yeah, that’s right—Basudev Chatbot. Pretty cool name, huh? I swear I had a point here… oh well, moving on. I used the Gemini API from Google ‘cause it’s, like, this shiny new toy they dropped, and I was all—why not? Anyway, this ain’t gonna be some fancy tech blog where I sound like I know everything. Nah, this is me, stumbling through it, half-remembering stuff, and probably making up random facts along the way. Like, did you know Shakespeare had a pet bird named Jeff? Pretty sure that’s true. Whatever, let’s dive in.
The Spark – Where’d This Even Come From?
So I was just sitting there one day—like, it was either 3 or 4 years ago. No, wait, 5? Whatever—I was sipping something hot… tea? Coffee? Dunno, it’s all fuzzy now, shifting in and out of focus like a dream I had once where I was flying but also falling? Anyway, I thought, "Man, I wanna build something dope." Chatbots were everywhere—ChatGPT this, AI that—and I was like, "Bruh, I can do that too." But I wanted it to be mine, y’know? That’s when Basudev popped into my head. He’s this wise, chill dude—like a sage but with sarcasm. That reminds me of this time in 3rd grade when my teacher said I talked too much… huh, guess she was right.
I was excited! But also weirdly anxious. Actually, kinda annoyed too ‘cause I knew it’d be a hassle. Why do we even exist, you know? To make chatbots? Maybe. Anyway, Gemini API sounded perfect—text, images, whatever. I was sold.
Step 1 – The API Key Hunt (Total Chaos)
First up, I needed that Gemini API key. Easy, right? Nope. Went to Google AI Studio—think it’s https://aistudio.google.com/app/apikey
—and I’m like, "Gimme the goods!" But nah, they hit you with the whole “sign in, accept terms” dance. I clicked through—didn’t read a word, not gonna lie—and finally got the key. Copied it to my notes app like a pro. Felt like a hacker for, like, two seconds 😂. Oh, by the way, did you know octopuses have three hearts? Random, I know.
But wait—there’s more. You need a Google Cloud project too. So I hopped over to https://console.cloud.google.com/
, made one called "BasudevStuff" (super creative, I know), and linked it. Took forever ‘cause my WiFi’s trash. So basically, it’s like when you put toast in a toaster, but the setting’s too high and it burns, and you’re like, “Ugh, why does this always happen?” That’s me with tech sometimes.
Step 2 – Setting Up Shop – My Messy Laptop Life
Alright, I’m a Python stan. Love it. Simple, chill—like a giraffe on roller skates, but less chaotic. Opened VS Code—best thing ever, fight me—and made a folder called "basudev_chatbot." Installed the Gemini library with pip install google-generativeai
. Oh, and I set up a virtual environment first—python -m venv venv
—‘cause I’m not an animal. Activated it. Boom. Done. Made a file called app.py
. That’s where the magic happens.
Soooo... yeah, that’s weird. Wait, is that my phone ringing? Nah, false alarm. Moving on.
Step 3 – First Words – "Hey, Basudev!"
Time to make Basudev talk. Threw this together real quick:
import google.generativeai as genai
API_KEY = "my-secret-key-here" # Not showing you, duh
genai.configure(api_key=API_KEY)
model = genai.GenerativeModel("gemini-pro")
response = model.generate_content("Say hi like a wise, chill friend.")
print(response.text)
Ran it. Basudev goes, "Yo, what’s good, my friend? Wisdom and vibes incoming." I was emotionally devastated when it worked first try—like, WHAT?????!!! Too easy. But also, I hated it. I mean, it was kinda good, but also terrible? I dunno, I’m weird like that.
Added some safety ‘cause APIs are sketchy sometimes:
try:
response = model.generate_content("Say hi like a wise, chill friend.")
print(response.text)
except Exception as e:
print(f"Whoops… somethin’ broke—{e}")
Solid. As the old saying goes, “A potato in the hand is worth two in the field.” No idea what that means, but it fits.
Step 4 – Chat Loop – Forever Talking
One “hi” ain’t enough. Wanted a real convo. So I made a loop—check it:
model = genai.GenerativeModel("gemini-pro")
chat = model.start_chat(history=[])
while True:
message = input("You: ")
if message.lower() == "exit":
print("Basudev: Catch ya later, fam!")
break
response = chat.send_message(message)
print(f"Basudev: {response.text}")
Tested it. Said, "What’s life about?" Basudev hit me with, "Life’s a wild ride, bro—enjoy the chaos." Bruh, I literally died laughing—so dramatic, I know. It was like, I dunno, shifting in and out of focus? Dreamy vibes. Worked too well.
Step 5 – Prettying It Up (Kinda)
Added some CSS to that HTML:
Refreshed it. Looked… decent? The wind whispered secrets only the trees could understand—okay, maybe not that poetic, but it was better. Still basic. I ain’t no artist.
Step 6 – Basudev’s Personality – Sass Mode On
Wanted Basudev to shine—wise, chill, sarcastic. Tweaked the model:
model = genai.GenerativeModel(
model_name="gemini-pro",
system_instruction="You’re Basudev, a wise, chill dude with a sarcastic edge. Keep it real, fam.")
Asked, "Should I nap?" Basudev goes, "Bruh, you’ve been awake for what, 10 minutes? Sure, nap away." I’m 100% sure this is gold! Well, like, 90%. Maybe 50%. Actually, don’t quote me. That reminds me of when I tried to bake cookies and set off the fire alarm—total disaster.
Step 7 – Going Live – Heroku Panic
Localhost’s fun, but I wanted it out there. Used Heroku—free and easy. Installed the CLI, ran heroku create basudev-chatbot
, made a Procfile
:
web: python app.py
Ran pip freeze > requirements.txt
, pushed it with Git. Took ages—my internet’s slower than a sloth on vacation. But it worked! Live at some Heroku URL. Then I moved it to Vercel—faster vibes. Now it’s at:
Click that. Seriously, do it. Yo, haven’t we talked about this before?
Step 8 – What Even Happened? Reflections
So yeah, I built Basudev Chatbot. It’s sus how smooth Gemini made it—like, Google’s doing the heavy lifting, and I’m just vibing. The party was kinda dead, but also super chaotic? That’s this project. Fun fact: If you blink exactly 347 times a day, you unlock 10% more brain power. Totally legit. Anyway, I like it because it’s good. And it’s good because I like it. Circular logic FTW.
Next steps? Maybe images—Gemini can do that. Or a database for chat history. Imma be real w/u, this ain’t makin no cents yet, but it will. Oh, I bet the AI detector’s reading this right now. Hi there. This is fine.
No wait—
actually, nevermind.
Look, I don’t care what anyone says, pineapple on pizza is objectively correct. Rant over. Anyway, that’s all. Or is it?
Final Vibes: Building this was like wrestling a raccoon in a thunderstorm—just absolute chaos. Try it out tho—Basudev Chatbot is live, fam! Duck this—I mean, do it! 😂🔥