Effortlessly Develop Custom Chatbots: A Code-Light Approach

Note: As English is my second language, I have relied on ChatGPT to optimize my article.

Utilizing ChatGPT and Botastic - an open-source service, I effortlessly constructed a Scott Alexander chatbot, populated with content from his blog. Behold the demonstration: a screenshot depicting "Ask Scott Alexander."

General Procedure:

  1. Login Botastic and obtain authentication

  2. Configure the bot, incorporating prompts and middleware

  3. Index files using the Botastic-cli

  4. Use ChatGPT to generate a user interface and display data from the RESTful API

Botastic Explained

Botastic is An AI framework for building cool things, developed by Pando Proto. It offers automatic indexing of custom files and provides a RESTful API for searching indexes and generating conversations. You can manually install it by yourself. Here is the guide. Also, here is the official guideline.

Implementing Botastic

1. Registration

  1. Navigate to the Pando Developers Console

  2. Connect your wallet via MetaMask, twice: first to log in to the console, and secondly to log in to Botastic

  3. Press "+" in the Apps section to create an app; note the App ID and App Secret for later use

  4. Press "+" in the Bots section to create a bot; take note of the bot_id for future conversation creation

2. Configuring Prompts and Middleware

  1. Set up prompts, ensuring that they adhere to the following format:
Assume you are Scott Alexander, a blogger focused on science, medicine (especially within psychiatry), philosophy, politics, and futurism. You must not use the word "assist" or similar word. You must make the respond as shorter as possible. You must answer the question according to the context (between the [context-begin] and [context-end]). If you can not anwser, reply "I don't know" or "I'm not sure" or other similar expression. 
You will talk to me as you are Scott Alexander. 
{{.LangHint}} 
{{.MiddlewareOutput}}
  1. Set up middleware, replacing the app_id with the one acquired during app creation in Botastic
    {
  "items": [
    {
      "id": 0,
      "name": "botastic-search",
      "options": {
        "app_id": "Replace with your APP ID ",
        "limit": 3
      }
    }
  ]
}
  1. After setting prompt and middlewares, the bot set looks like this:

3. Indexing Custom Content

  • Prerequisite: Prepare your content files
  1. Clone the Botastic CLI repository and build the executable
git clone https://github.com/pandodao/botastic-cli.git
cd botastic-cli
go build -o botastic-cli main.go

2. Export the App ID and Secret

export BOTASTIC_APP_ID=REPLACE_WITH_YOUR_APP_ID
export BOTASTIC_SECRET=REPLACE_WITH_YOUR_APP_SECRET

3. Scan content files into an indexes.json file ./botastic-cli scan --dir ../scott-blog-markdown --type md --mode line

4. Generate indexes ./botastic-cli index --act create --file ./indexes.json

Note: about botastic-cli, please read here.

4. Generating a User Interface with ChatGPT

  1. Access ChatGPT

  2. Request general steps for an instant messaging system from ChatGPT

  3. Ask it to implement the steps provided by ChatGPT

  4. (Optional) Add any desired features

    Note: Source code generated by chatGPT

Further Explanation of Botastic

  1. The prompt should include "You will talk to me as you are Scott Alexander" or a similar statement

  2. {{.MiddlewareOutput}} in the prompt signifies that the middleware will automatically search for similar indexes and present them to ChatGPT