DEV Community

Cover image for Dev.to chatbot! 🤖
Paweł Ciosek
Paweł Ciosek

Posted on

Dev.to chatbot! 🤖

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

Image description

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)

Image description

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
Enter fullscreen mode Exit fullscreen mode

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.

Image description

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;
}
Enter fullscreen mode Exit fullscreen mode

After writing the code, a plugin for dev.to was created 🤓 -> https://www.coze.com/store/plugin/7362263649500741638

Image description

With connecting the plugin to my bot, I got an answer to a question that the previous bot was unable to answer. 🥳

Image description

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!

Top comments (12)

Collapse
 
nathan_tarbert profile image
Nathan Tarbert

This is awesome, very cool!

Collapse
 
mattryanmtl profile image
Matt Ryan

Awesome project, well done. I see this one coming out as the winner.

Collapse
 
thomasbnt profile image
Thomas Bnt ☕

Very cool project!

Collapse
 
pavelee profile image
Paweł Ciosek

Thank you! 🙏

Collapse
 
ka0sdev profile image
ka0sdev

Can we stop genderizing AI, it's neither a he or she.

Collapse
 
opensourceyllen profile image
Yllen Fernandez

Fantastic project!
Do I need to create an account to start using it?

Collapse
 
pavelee profile image
Paweł Ciosek

Thank you! 🙏

Yes, you need an account. You can easily sing in using google account.

Image description

Collapse
 
opensourceyllen profile image
Yllen Fernandez

🤔

Collapse
 
zly profile image
zly

hello

Collapse
 
pavelee profile image
Paweł Ciosek

🙋

Collapse
 
neo_rival67 profile image
Daffa Rabbani

hey, can u give a repos this chatbot?

Collapse
 
pavelee profile image
Paweł Ciosek

Hey! chatbot is based on coze platform (build on their engine), no repo here, just setting in the platform.

Did you mean plugin?