Dev.to chatbot! 🤖
Paweł Ciosek
Posted on April 28, 2024
This is a submission for the Coze AI Bot Challenge: Bot Innovator.
What I Built
I built dev.to chatbot! 🤓
The bot is able to search the content of our beloved website and answer our questions.
For example, you can ask him to send you an article on a specific topic, and he can also analyze the found content in terms of the information I am looking for! 🤓
I see that it has potential as an advanced search engine for website content!
To create the robot, I wrote a plugin for integration with the search engine and the dev.to API 🤗, more information in the journey section 🚂
Demo
Link to bot: https://www.coze.com/store/bot/7358908091464794117
Your Configuration
Journey
It was an interesting task, initially it seemed much simpler, but in practice I got a little tired 😅
First of all, I want to mention that the coze.com platform is great! I had a lot of fun creating a bot or plugin is easy. I really like the built-in IDE for building the plugin, bravo! 👏
I was wondering about the use case for using the robot. Why would it be of value to anyone. I had a problem with this, but I decided to build a prototype to see how the AI would use what I prepared. 🧑💻
At first I started using the "Browser" and "Google web search" plugins. However, the bot is unable to use the search engine on the dev.to website 😭 (it probably has problems with dynamically loaded content)
So I thought there must be some other way 🫰, I started searching for the API and found it 🥳
https://developers.forem.com/api/v1
The great joy was quickly extinguished by the fact that the API does not have a search engine 😭, there is an end for downloading published articles, but the results are completely different, and that's what I wanted. 🙋
Still looking for a solution, I started analyzing how the search engine works, guess what? I found that the search engine queries the endpoint underneath! 🥳 (not in the documentation 🫣)
https://dev.to/search/feed_content
Best of all, you can search not only articles but also users, podcasts, organizations, tags and comments! 🚀
At this point I already had the integration tool, but how do I integrate it with the chatbot? 🤖
The answer is a plugin! At the very beginning, I knew that I would need to prepare a simpler interface for the chatbot, so I immediately started working on a plugin built in the IDE. 🧑💻
Ultimately, it turned out that I would need:
- content search tools
- a tool to download article details (content), so that the chat bot can analyze the content in terms of the content I am looking for
However, along the way I created more tools, but these two remained as the most sensible ones.
I needed to add some of my own code, for example to build an appropriate query to the search engine endpoint:
const buildSearchQuery = async (input: Args<Input>['input']) => {
let data: Record<string, string> = {
"class_name": objectTypeVales[input.object],
"per_page": '60', // it's default value on dev.to. We want chatbot to use search like a user.
"page": '0', // default value
"search_fields": input.phrase
};
if (input.sort_by === 'newest') {
data = {
...data,
"sort_by": "published_at",
"sort_direction": "desc",
};
}
if (input.sort_by === 'oldest') {
data = {
...data,
"sort_by": "published_at",
"sort_direction": "asc",
};
}
const params = new URLSearchParams(data);
const query = params.toString();
return query;
}
After writing the code, a plugin for dev.to was created 🤓 -> https://www.coze.com/store/plugin/7362263649500741638
With connecting the plugin to my bot, I got an answer to a question that the previous bot was unable to answer. 🥳
The last thing left to decide was which model to connect to the test:
- ChatGPT 3.5 -> quick replies, but unfortunately not very accurate
- ChatGPT 4 -> slower, responses much better. Unfortunately, there is too little context to analyze more content
- ChatGPT 4 turbo -> even slower, but gives the best results.
Finally, I set ChatGPT 4 Turbo, after testing it is the most practical for a chatbot.
I'm curious about your chatbot use! Is it practical for you? How can it be developed?
See you in the next challenge!
Posted on April 28, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.