paint-brush
Pawsitive Results: How to Build the Ultimate Puppy Trainer AI-chatbot With Cozeby@marcushaldd
860 reads
860 reads

Pawsitive Results: How to Build the Ultimate Puppy Trainer AI-chatbot With Coze

by Daria LeonovaAugust 31st, 2024
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

I created an AI-powered puppy trainer bot using Coze, a user-friendly, no-code platform. It helped me train my Australian Shepherd, Jenny, by providing detailed instructions and reminders for her care. The platform’s flexible features, like multiple agents, plugins, and memory variables, made it easy to customize the bot for my needs. While Coze is excellent for building bots without coding, a bit more control over complex logic would be a nice addition. Overall, Coze is a fantastic tool for anyone looking to create personalized AI bots with ease.
featured image - Pawsitive Results: How to Build the Ultimate Puppy Trainer AI-chatbot With Coze
Daria Leonova HackerNoon profile picture

Three weeks ago, I took a puppy, a lovely Australian shepherd named Jenny. Around the same time, I received an email from HackerNoon inviting me to check out AI bots from Coze. It turned out to be kind of a fateful email because the bot I built helped me with training a lot.


"I didn't ask for a roommate"

But first things first.


Overall, Coze is an all-in-one AI chatbot development platform that brings together a bunch of different AI systems in one place. You can create a variety of bots with absolutely different scenarios:


  • News Digest
  • Weather updates
  • Translator
  • Image generation
  • Trip Advisor


+ countless more.


And the possibilities don’t stop there. You’re not limited to existing AI systems — Coze allows you to customize and build your own unique solutions.


So, let’s go through my puppy-trainer bot creation and see if Jenny is on her way to becoming a good girl 🐶

Easy Peasy Puppy Squeezy

One of the undeniable advantages of Coze is its user-friendly interface, which is accompanied by detailed instructions. You can imagine that when you only take a new pet home, you don’t have much spare time. But it took me only 2 hours to make the first iteration and to receive the trainer-helper. That’s all due to the platform's fantastic low entry level.


The process of building an AI-bot with Coze looks like this:

  1. You choose mode*:

    1. Single Agent for one-focused task. For example, “translator”.

    2. Workflow. For complex logic with structured following each other commands. Like form filling.

    3. Multi-agent. For complex, not serial conversations with various functionality.


  2. Set up the agent’s model, database, and memory variables


  3. Add skills: plugins and triggers


  4. Set up Create prompts for your agent(s)*.


*Mandatory actions are marked with an asterisk.


You can also use some other features, like shortcuts, voices, and others, to improve/expand your bot. You can read about them here.

For my first iteration, I made a single agent with only one task: give me a detailed explanation of how to teach a new command. According to the plan, I must choose a mode - obviously, a single agent, and fill out the prompt.

Prompt

To be honest, I’m not precisely a prompt-making pro. In fact, I sometimes struggle to put my thoughts into words! 😅 But Coze makes the process very easy and smooth. You just tell what you want in everyday human language, or even in the way a 5-year-old might say it:

You are a skilled dog trainer.

You use positive reinforcement training.

You can teach the proper techniques for teaching commands.

…

Oh! And I want an ice cream 🍦 (just kidding)


Then, just click the magic “A” button, and your wish list becomes a deliberate prompt.


To get the best results, I edited the prompt a couple of times, added the desired formatting, and repeated the “A” button.


And that’s it! For my needs, this was more than enough — pure magic 🪄✨


Multi-Agent

After a week, when things settled down, Jenny got used to the place and new people, and we got used to her, I found some time to expand my ai-bot.

This time, my inquiry included several tasks based on my previous week's experience. First of all, I am like an overprotective and overly worried mum, always on the lookout for anything “abnormal” in my puppy. Is she weighing enough? Is she eating too little? Is she peeing too much? 😅 So, I do need a helper to calm me down and give some well-being advice about puppies.

Secondly, I wanted to try something fun with this AI stuff. And I was thinking about photos, of course.


To incorporate these new features, I switched from “Single Agent” mode to “Multi-Agent” mode. The idea is pretty simple. You just have several nodes; each does its own functionality and delegates user requests to another if it’s not its “job.”


Each agent has four fields:

  • Scenarios. When should this agent be used?
  • Agent prompt
  • Skill. What tools and plugins does this agency use?
  • Auto-suggestions. Generated options for users to pick up from instead of manually texting input.

The single node, or agent, is almost the same as it was in Single mode, with one exception. A persona should be given for the whole bot.


So, in my case, the Persona for the bot is “Dog expert in training and care.” In the meantime, the “Training agent” will be called when the user asks for a tip on “Sit” — this is its scenario. The “Care agent” will be called when the user asks if the puppy pees too often.



For each node, you’ll want to use a specific prompt tailored to its task. I used a little hack with the magic “A” button: I took my rough, semi-formed prompt, inserted it into the bot’s “Persona & Prompt” field, and let Coze do its magic. The result was a beautifully crafted prompt that I then inserted back into my agent’s prompt field. Easy and effective!


So, for my care helper, I made sure to specify what AI model I wanted to use. Because it seems crucial to have a reliable data source for this topic. You actually have two options to do it (if we are speaking about text output).


  1. Model settings. Each agent operates based on a model, with GPT by default. This model is responsible for interactions with users in this node. It generates answers and questions for users regarding prompts and user input and handles generating suggestions.

  1. The model itself can use plugins to process user tasks. For example, if you want to generate an image, you do something like that in the prompt: Use {text2img} to generate a cartoonish image of a dog from user input. You ask your GPT model to use another one. Oh, and don’t forget to add this plugin {text2img} in skills 😀

I found it helpful to use different text models for the agent itself and for output generation when you don’t really like the way one of them speaks to the user. I'll share a specific example when we get to the memory variables.


Overall, I chose Claude 3.5 Sonnet for the agent and asked it to use GPT-4 to retrieve the most accurate information about the puppy's well-being. The result was good and, most importantly for me, reassuring 😄

Plugins

The variety of available plugins can’t leave anyone indifferent. Naturally, I decided to experiment with more of them. The great thing is that there’s no limit to the number of plugins you can use within a single agent. Combining them allows you to create non-trivial flows. You simply convert user input from one output to another, and so on.

I came up with a simple idea using just two plugins, but I really love how it turned out! The concept is to generate an adult dog photo from a puppy image.


At the current moment, there is no plugin that can convert (image + text) into a new image on the platform. That’s why I used these two:

  1. img2text. To convert input (puppy photo) into a detailed photo description.


  2. text2img. To convert generated text again into an image. But adding info that it should be a photo of an adult dog this time.


To achieve the most plausible results, I had to play around with the prompts and specify that it’s important to pay attention to colors, spots, and their positions. However, it was fun and relatively accurate.


I can believe it

Triggers

Besides plugins, I love the “Triggers” (Skills) feature. It’s beneficial in a puppy trainer bot for a couple of reasons:

  1. It helps establish routines, such as when to feed, go out, train, etc. It is handy to have all information about your puppy in one place, not to set up a separate alarm.


  2. A puppy is not always fun. One might feel discouraged when it chews everything, doesn’t behave, and pees on the carpet. Triggers can help by allowing users to set up reminders for positive reinforcement or motivational tips when things get tough.


To enable reminders, switch them on in the left panel. To create custom reminders, use the same left panel and click the “+” button.


Unfortunately, this feature is only available on Discord at the time of writing.

Memory Variables

To add a personal touch to your bot, you can use the memory variables feature. It is amazing how such a small change can make the user believe they are speaking with a real person and expert. Of course, there are also other fields of memory variables applications, but for my puppy trainer, it’s all about personality.


In the left panel, you can add memory variables, things that chat will remember about the user. It will update this info if needed lately. In my case, it’s some info about Jenny. It’s helpful to keep breed and age because care advice depends on such things, and you don’t want to enter these details again and again. Sometimes, even training advice can depend on the breed.


Border Collie:

"Day 1: Teach your Collie to fetch.

Day 2: Advanced fetching – include complex routes and obstacle courses.

Day 7: Wait for the newspaper, slippers and breakfast, which your Border Collie will fetch for you.”

Bulldog:

"Day 1: Teach your Bulldog to fetch... if he feels like it.

Day 2: Celebrate if he even looks at the ball.

Day 7: aim for a solid 10-second stare at the ball before he decides it’s nap time again.”






Bonus. Memory Variables or Model Settings

As promised, I wanted to share a bit more about model settings. Initially, I used GPT-4 for the acquaintance agent, and it was a disaster. For some reason, it always ignored the data that I provided.


It took me some time to consider trying new model settings. And for a good reason. Switching to another model finally gave me the desired outcome: It stopped repeatedly asking my puppy's name.

Deploying

Finally, deploying turned out to be the easiest part of the whole process. All you need to do is follow the instructions kindly provided by Coze. The instructions are well-organized, with clear headings and detailed screenshots — bravo to the Coze team!


Long story short, all you need is a bot token. And sometimes some additional tokens and IDs. To get them for most publishing platforms, you need to authorize and go to settings. Not a rocket since. It can be tedious, though.










Conclusion

My Jenny’s already learned a lot 💪, and I believe she is on her way to being a good girl. My favorite commands so far are “paw” and “middle.” Cause they are so cute! 💕



As for Coze, I can definitely recommend it. As I said initially, the platform is super easy to use. I can’t imagine that building even your first bot can be so effortlessly and fun. I’d also highlight the flexibility provided by different modes and various plugins. You literally can make a bot for anything.

I may not have had enough code-based things. Some flows are pretty determined. For example,

If puppyName.isEmpty {

	ask name

} else {

	goto training

}

Just with human language prompts and not persistent AI, this scenario cannot be 100% achievable.


However, aside from that, I can’t think of any other significant issues. It is a great tool that makes bot-building easy, fun, and flexible.