2. Whiz Bot Guide#

We start by importing the basic bot from botiverse.bots and gui for testing.

from botiverse.bots import WhizBot
from botiverse import chat_gui

The Whiz Bot is much like the basic bot except that it is capable of using multinigual embeddings and sequential models which means better performance and multi-linguality at the cose of more training time. In this we train on an Arabic dataset similar to the one we used with the basic bot.

2.1. Dataset Sample#

{
  "tag": "برامج",
  "patterns": [
    "ما هي البرامج التي تقدمها الجامعة؟",
    "ما هي المقررات المتاحة؟",
    "أخبرني عن البرامج الأكاديمية",
    "هل يمكنك تقديم معلومات عن التخصصات؟"
  ],
  "responses": [
    "...تقدم جامعتنا مجموعة واسعة من البرامج في",
    "...نقدم برامج أكاديمية متنوعة تشمل مجالات دراسية مختلفة"
  ]
}

2.1.1. Initiate Chatbot#

We start by initiating the whiz bot. Although it supports two different models (linear and GRU); each of those has its own representation BERT and BytePairOneHotEncoding respectively (for the latter, repr is passed as GRU)

bot = WhizBot(repr=‘BERT’)

2.1.2. Read the Data#

We read the data similar to how we did with the basic bot

bot.read_data('./dataset_ar.json')

2.1.3. Train the chatbot#

We train the chatbot where we can also supply the number of epochs and batch size.

bot.train(epochs=10, batch_size=32)
Train Acc: 0.93: 100%|██████████| 240/240 [00:01<00:00, 220.21it/s]

2.1.4. Infer#

Finally, we can infer given real data as usual

bot.infer("ما هي الدورات المتاحة؟")
"Hello! Welcome to our university's website."

2.1.5. Deploy the Chatbot#

And deploy the model if needed.

chat_gui("Whiz Bot", bot.infer)