Skip to content

A LLaMa-3.1-8B-Instruct chatbot enabling devs to earn money with custom AI chatbots

Notifications You must be signed in to change notification settings

machaao/llama-3.1-8b-instruct-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Meta-Llama-3.1 Chatbot Template for FREE monetization

Use this template to rapidly build and monetise a Meta Llama 3.1 chatbot and start earning money

Requirements for running it locally on laptop

  • 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

Get MessengerX.io API Key

  • 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 and Description.
    • Select Custom Bot option
    • It should look something like this:
    • figure
  • Click on Save. It will redirect you to your dashboard.
  • On your dashboard you can see your newly created bot
    • figure
  • Click on Settings tab. It will open your bot configuration page.
    • figure
  • On the configuration page you'd be able to see a string named token. That's your Machaao API Token

Local Setup

Download or clone this repository

git clone https://github.com/machaao/llama-3.1-8b-instruct-chatbot.git

cd llama-3.1-8b-instruct-chatbot

Install requirements

pip install -r requirements.txt

Create a new .env file in the llama-3.1-8b-sample directory

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

Change CREDIT variable to change the cost of a text message

CREDIT=5 implies one message would consume 5 credits

Modify logic/prompt.txt to change the system prompt

You are a helpful assistant named [name]

Modify the core() function in logic/bot_logic.py to personalize responses

def core(self, req: str, user_id: str):

Run the chatbot server from the root directory of the repo

python app.py

Start ngrok.io tunnel

ngrok http 5000
  • You'll get a Forwarding URL mentioned on the console as shown below
    • figure
  • Copy the Forwarding URL. In this example it would be:
https://26ea-150-107-177-46.ngrok-free.app

Update your webhook

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 figure

Test your bot:

Click on Preview to chat with your bot

Get Dashbot.io API KEY (Recommended for Production)

  • You can acquire the API Key via Dashbot.io and replace it in the .env file under the entry DASHBOT_KEY

Remote Setup (Heroku)

We are assuming you have access to a heroku account and have installed heroku command line client for your OS.

Login to Heroku

heroku login

Create a new app on Heroku and note down your heroku app name

heroku create

Commit changes and push the repository to Heroku

git commit -m ".env updated"
git push heroku master

Open the logs to confirm successful Deployment

heroku logs --tail

Update your webhook

Update your bot Webhook URL at MessengerX.io Portal with the heroku app url

Webhook Url: <YOUR-HEROKU-APP-URL>/machaao/hook

Test your bot:

Visit: https://messengerx.io/<your-character-name>

Notes / Additional Resources

  • 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

About

A LLaMa-3.1-8B-Instruct chatbot enabling devs to earn money with custom AI chatbots

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published