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:
Login Botastic and obtain authentication
Configure the bot, incorporating prompts and middleware
Index files using the Botastic-cli
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
Navigate to the Pando Developers Console
Connect your wallet via MetaMask, twice: first to log in to the console, and secondly to log in to Botastic
Press "+" in the Apps section to create an app; note the
App ID
andApp Secret
for later usePress "+" in the Bots section to create a bot; take note of the
bot_id
for future conversation creation
2. Configuring Prompts and Middleware
- 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}}
- 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
}
}
]
}
After setting prompt and middlewares, the bot set looks like this:
3. Indexing Custom Content
- Prerequisite: Prepare your content files
- 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
Access ChatGPT
Request general steps for an instant messaging system from ChatGPT
Ask it to implement the steps provided by ChatGPT
(Optional) Add any desired features
Note: Source code generated by chatGPT
Further Explanation of Botastic
The prompt should include "You will talk to me as you are Scott Alexander" or a similar statement
{{.MiddlewareOutput}}
in the prompt signifies that the middleware will automatically search for similar indexes and present them to ChatGPT