- To get a quick response, join our Discord channel.
- Visit the Chai Docs for more information.
pip install chaipy
- Visit Chai - download the Chai app on your iPhone or Android device.
- Visit Chai Developer Platform.
- Sign in.
- Scroll to the bottom to see your "Developer Unique ID" (referred to as
developer_uidin this tutorial) and your "Developer Key". - Git clone this starter repo.
git clone https://github.com/chai-nexus/chai_quickstart.git
cd chai_quickstart- Open the file
uploader.pyusing your text editor.
DEVELOPER_UID = None # SET THIS VALUE
DEVELOPER_KEY = None # SET THIS VALUE
if DEVELOPER_KEY is None or DEVELOPER_UID is None:
raise RuntimeError("Please fetch your UID and KEY from the bottom of the Chai Developer Platform. https://chai.ml/dev")- You must set your
DEVELOPER_UIDandDEVELOPER_KEY. Save and exit this file. - Let’s take a look at our starter bot in the file
starter_bot.pyand set our first message. Change "Hi I’m an ExampleBot" to "I love AI" then save and exit the file.
from chai_py import ChaiBot, Update
class Bot(ChaiBot):
def setup(self):
self.logger.info("Setting up...")
async def on_message(self, update: Update) -> str:
return "Hi, I'm ExampleBot." # EDIT THIS MESSAGE- Now lets upload our bot! Simply run
python uploader.py. - Press Y when prompted, as this is a new bot. Next time we will press N.
- You’ll get a QR code. First install the Chai app, and then scan the QR code. This will allow you to open the app so you can speak to your chat AI.
- Chat with your bot!
Visit the Chai Docs for more information.
Join our Discord channel.
Have fun building!