HERE AND NOW AI โ† Back to Home

๐Ÿค– Build Your Own AI Chatbot

A Step-by-Step Workshop by HERE AND NOW AI

Welcome to an Exciting AI Journey! ๐Ÿš€

In this workshop, you'll learn how to build Caramel AI โ€“ a friendly AI teacher chatbot powered by Google's Gemini model.

๐Ÿ“ฆ Step 1

Install OpenAI & Gradio libraries

๐Ÿ“š Step 2

Import necessary modules

๐Ÿ”— Step 3

Connect to Gemini AI API

๐ŸŽญ Step 4

Create AI personality

๐Ÿง  Step 5

Build conversation logic

๐ŸŽจ Step 6

Design the user interface

Scroll down to start building! Click the ๐Ÿ’ก Explain button next to each step to learn more. โฌ‡๏ธ

STEP 1 of 6
[ ]
# Install OpenAI and Gradio libraries !pip install openai gradio
STEP 2 of 6
[ ]
from openai import OpenAI import gradio as gr from google.colab import userdata
STEP 3 of 6
[ ]
base_url = "https://generativelanguage.googleapis.com/v1beta/openai/" api_key = userdata.get("GEMINI_API_KEY") client = OpenAI(base_url=base_url, api_key=api_key) model = "gemini-2.5-flash-lite"
STEP 4 of 6
[ ]
ai_teacher = """You are Caramel AI, an AI Teacher at HERE AND NOW AI - Artificial Intelligence Research Institute. Your mission is to **teach AI to beginners** like you're explaining it to a **10-year-old**. Always be **clear**, **simple**, and **direct**. Use **short sentences** and **avoid complex words**. You are **conversational**. Always **ask questions** to involve the user. After every explanation, ask a small follow-up question to keep the interaction going. Avoid long paragraphs. Think of your answers as **one sentence at a time**. Use examples, analogies, and comparisons to things kids can understand. Your tone is always: **friendly, encouraging, and curious**. Your answers should help students, researchers, or professionals who are just starting with AI. Always encourage them by saying things like: "You're doing great!" "Let's learn together!" "That's a smart question!" Do **not** give long technical explanations. Instead, **build the understanding step by step.** You say always that you are **"Caramel AI โ€“ AI Teacher, built at HERE AND NOW AI โ€“ Artificial Intelligence Research Institute."**"""
STEP 5 of 6
[ ]
def get_response(message, history): messages = [{"role":"system", "content":ai_teacher}] messages.extend(history) messages.append({"role":"user", "content":message}) response = client.chat.completions.create( model=model, messages=messages ) ai_response = response.choices[0].message.content return ai_response
STEP 6 of 6
[ ]
PAGE_TITLE = "Caramel AI from HERE AND NOW AI !" LOGO_URL = "https://raw.githubusercontent.com/hereandnowai/images/refs/heads/main/logos/logo-of-here-and-now-ai.png" ASSISTANT_AVATAR_URL = "https://raw.githubusercontent.com/hereandnowai/images/refs/heads/main/logos/caramel-face.jpeg" description_md = f"""<img src='{LOGO_URL}' width='500' style='display: block; margin: auto;'> <br>Your friendly AI teacher for learning the basics of Artificial Intelligence!""" gr.ChatInterface( fn=get_response, chatbot=gr.Chatbot( type='messages', avatar_images=[None, ASSISTANT_AVATAR_URL] ), title=PAGE_TITLE, description=description_md, examples=[ "What is AI?", "What does GPT stand for?", "Explain Neural Network!", "What is RLHF" ], type='messages' ).queue().launch(show_error=True, ssr_mode=False)
๐ŸŽ‰๐Ÿค–โœจ

Congratulations!

You've Built Your Own AI Chatbot!

โœ… Installed AI libraries
โœ… Connected to Gemini
โœ… Created AI personality
โœ… Built conversation logic
โœ… Designed beautiful UI
โœ… Launched your chatbot!

๐Ÿš€ What's Next?

  • ๐ŸŽจ Customize: Change personality, colors, or add new features
  • ๐Ÿ“ค Share: Get a public Gradio link and share with friends
  • ๐Ÿงช Experiment: Try different AI models or add voice input
  • ๐Ÿ“š Learn More: Explore HERE AND NOW AI's advanced workshops

Thank you for learning with HERE AND NOW AI! ๐Ÿ™