Use this template to rapidly build and monetise a Meta Llama 3.1 chatbot and start earning money
- Windows / Mac / Linux with Git installed
- Python 3.8
- Ngrok for Tunneling (For Local Laptop Development Environment)
- Hugging Face API token
- MessengerX.io API Token - Follow the instructions below to get your token
- Available on the MessengerX.io portal
- If you aren't registered, please create an account and login
- Set up your new bot by providing it a
Character Name
andDescription
. - Click on
Save
. It will redirect you to your dashboard. - On your dashboard you can see your newly created bot
- Click on
Settings
tab. It will open your bot configuration page. - On the configuration page you'd be able to see a string named
token
. That's yourMachaao API Token
git clone https://github.com/machaao/llama-3.1-8b-instruct-chatbot.git
cd llama-3.1-8b-instruct-chatbot
pip install -r requirements.txt
nano -w .env
Put these key-value pairs in your .env file
API_TOKEN=<Machaao API Token>
BASE_URL=https://ganglia.machaao.com
NAME=Jess
HUGGINGFACEHUB_API_TOKEN=<YOUR Huggingface API TOKEN>
MODEL_NAME=meta/meta-llama-3.1-405b-instruct
CREDIT=5
Get your HF api token here
CREDIT=5 implies one message would consume 5 credits
You are a helpful assistant named [name]
def core(self, req: str, user_id: str):
- Refer to platform documentation for personalization options
python app.py
ngrok http 5000
- You'll get a
Forwarding
URL mentioned on the console as shown below - Copy the
Forwarding
URL. In this example it would be:
https://26ea-150-107-177-46.ngrok-free.app
Update your bot Webhook URL
on the bot configuration page with the NGROK Forwarding URL
In this example your Webhook URL would be:
https://26ea-150-107-177-46.ngrok-free.app/machaao/hook
Refer to this screenshot below
Click on Preview
to chat with your bot
- You can acquire the API Key via Dashbot.io and replace it in the
.env
file under the entryDASHBOT_KEY
We are assuming you have access to a heroku account and have installed heroku command line client for your OS.
heroku login
heroku create
git commit -m ".env updated"
git push heroku master
heroku logs --tail
Update your bot Webhook URL at MessengerX.io Portal with the heroku app url
Webhook Url: <YOUR-HEROKU-APP-URL>/machaao/hook
Visit: https://messengerx.io/<your-character-name>
- Please note that this document isn't meant to be used as a guide for production environment setup.
- Reach out to us on Twitter for any queries