DHIORA AI
A GUIDE FOR CURIOUS MINDS

You don’t need to know everything.
Just where to start.

Meet the building blocks behind your first AI chatbot. Learn a little, change something, and see what happens.

Beginner friendlyPython, explained simplyLearn at your own pace

From an idea to “hello”.

A chatbot reads a message and sends a reply. You decide its purpose; your Python code connects the pieces.

  1. 1

    Choose something you’d like to build

    Open a guided project. Start with Study Buddy, Quiz Master, Story Studio, or Idea Lab.

  2. 2

    Give it a name and a personality

    Describe how your bot should help. The guided builder turns your choices into four editable Python files.

  3. 3

    Run it. Say hello. Make a change.

    Open your project in the playground and select Run my bot. When chat says Ready, send a message. Stop the bot before running changed code again.

Start without an account.

The playground saves code on this device. In demo mode it echoes messages; an AI connection enables generated replies.

Want account projects and AI credits? Create a workspace, then manage your saved projects from My projects.

Give your bot a way to think.

Select Connect AI in the playground. Choose a provider, use its “Get a key” link, then paste your API key into the labelled field and save.

On a classroom computer

Leave “Remember this key” unchecked. Your key stays in the tab’s session. Ask your teacher which provider to use.

On your own device

You can choose to remember a key. Use Remove key in connection settings when you want to delete it from browser storage.

Saving a key doesn’t verify it. Run your bot and send a message to test the connection. Keys are sent with run requests to Dhiora’s server for provider calls, and provider usage may cost money.

The chat is your testing ground.

Try the suggested questions or write your own. Enter sends a message; Shift + Enter adds a new line. On a phone, switch between Your code and Test your bot.

Select Style in the chat panel to customise colours, backgrounds, and message bubbles. Use the expand control when you want more room.

Try the same question twice—with different instructions.

Ask “What is gravity?”, then tell your bot to explain using a football example. Stop, run again, and compare. AI answers can be incorrect: checking them is part of building.

Four files. A place for every idea.

Start with the personality file. You can explore the other pieces as you get comfortable.

prompt.pyThe personality

Instructions in plain English. Tell your AI what to do, how to speak, and what to focus on.

prompt.py
# These instructions shape every answer. Experiment with them!
SYSTEM_PROMPT = "You are a friendly study buddy for students. Explain ideas in simple language, use a relatable example, and ask one question to check understanding. Give hints before giving answers. If you are unsure, say so."
config.pyThe name tag

A home for your bot’s settings. Change BOT_NAME to give your creation a new name.

config.py
# Give your chatbot a name.
BOT_NAME = "Study Buddy"
logic.pyThe thinking steps

The respond() function combines your instructions with the message and asks the AI for a reply.

logic.py
# Keep the last three exchanges so your bot can follow a conversation.
# Restarting the bot clears this memory.
from collections import deque
from ai import ask
from prompt import SYSTEM_PROMPT

conversation = deque(maxlen=6)

def respond(message: str) -> str:
    history = "\n".join(conversation)
    answer = ask(f"{SYSTEM_PROMPT}\n\nRecent conversation:\n{history}\nStudent: {message}\nAssistant:")
    conversation.append(f"Student: {message[:2000]}")
    conversation.append(f"Assistant: {answer[:2000]}")
    return answer
main.pyThe on switch

Connects the files, creates your chatbot, and starts it. Keep bot.start() at the bottom.

main.py
# This is the starting point of your chatbot — the file that runs first.
# The real work happens in the other 3 tabs (config.py, prompt.py, logic.py);
# this file just plugs them together. You usually won't need to change much
# here — try editing the other files first!
from ai import *
from config import BOT_NAME
from logic import respond

bot = ChatBot(BOT_NAME)

# Whenever someone sends your chatbot a message, Python runs this function
# and sends whatever it returns back as the reply.
@bot.on_message
def handle_message(message):
    return respond(message)

# This line switches your chatbot on. Keep it at the very bottom of the file.
bot.start()

A little code. A lot you can do.

These predefined functions save you from writing everything yourself. Expand a function for its explanation and examples.

11 functions found

ChatBotclassAvailable
ChatBot(name: str = "Assistant")

A text chatbot.

bot = ChatBot()

@bot.on_message
def respond(message):
    return "Hello " + message

bot.start()
on_messagemethodAvailable
@bot.on_message

ChatBot method. Decorator: registers the function below it as the handler called for every incoming message. The handler receives the visitor's message (str) and must return the reply (str).

startmethodAvailable
bot.start()

ChatBot method. Starts the bot — the platform automatically exposes it as a live chat endpoint in the preview panel. Call this once, last, at module level.

askfunctionAvailable
ask(question: str) -> str

Ask the AI a question and get a text answer back.

answer = ask("What is the capital of France?")
replyfunctionAvailable
reply(text: str) -> str

Same as ask() — reads more naturally inside a chatbot handler.

@bot.on_message
def respond(message):
    return reply(message)
memoryfunctionAvailable
memory() -> Memory

Create a new, empty conversation memory buffer.

mem = memory()
mem.append("user", "hi")
databasefunctionAvailable
database() -> Database

Get a handle to this project's simple key-value database.

db = database()
db.set("visits", db.get("visits", 0) + 1)
savefunctionAvailable
save(key: str, value) -> None

Save a value under a name so you can load() it later.

save("high_score", 42)
loadfunctionAvailable
load(key: str, default=None)

Load a value previously saved with save().

score = load("high_score", 0)
create_tablefunctionAvailable
create_table(name: str) -> Table

Create (or open) a named table for structured rows.

users = create_table("users")
users.insert({"name": "Ada"})
queryfunctionAvailable
query(table: str, **filters) -> list[dict]

Query rows from a table made with create_table(), filtered by exact-match keyword arguments.

query("users", name="Ada")

Your next “what if?”

Stuck? You’re still learning.

My bot repeats everything I say

You’re in demo mode. Connect an AI provider, save your key, then stop and run your bot again. Without a provider, an echo is expected.

I see an error instead of a reply

Open Run console below the code. Read the last error line for a typo or missing quote. If it mentions your provider, check the key and provider account. Never share your key in a screenshot.

I changed my instructions, but the bot didn’t change

A running bot uses the files it started with. Select Stop bot, then Run my bot to apply your changes. This also resets the conversation memory.

My chatbot is taking too long

Check your connection and the run console. If the provider isn’t responding, stop the bot, review AI settings, and run again.

Where is my project saved?

Playground projects are stored in this browser. Clearing browser data removes them. Export your code before moving to another computer; account projects live in your signed-in workspace.

Small words, big ideas.

Prompt
Instructions that tell an AI what you want it to do.
Function
A reusable set of steps, such as ask().
Variable
A name for a value, like BOT_NAME holding your bot’s name.
String
Text wrapped in quotation marks.
API key
A private credential that lets your code use an AI provider.
Run
Execute your code to see what it does.
READY WHEN YOU ARE

Your first chatbot is waiting.

Make something yours →