so there's lots of different AI agent Builders popping up and it's really hard to know which ones are the right ones for your use case and which ones are actually worth learning I'm reviewing lots of different tools and dite ranks highly in terms of majority support and ease of use So today we're going to build a chatbot agent for an e-commerce store with the new defi workflow Builder we're going to connected to a knowledge base have it make decisions and classify next steps which you can then deploy as your own own app via nextjs onto
a website with a simple embed script or uh onto your own Chrome plugin so right now dii has about 39,000 stars on GitHub and it's growing at a really great rate what I like about it is that you can actually set it up on its own Docker instance and you can put it on your own infrastructure if privacy is a concern and also if you want to run it a lot more uh efficiently and and more affordably um it's got a good r pipeline setup you can actually connect it to your own um databases if
you want but if you just want to upload the information it's got a pretty good way of chunking and breaking down the content so that you can add it in I didn't need to create anything separate in this case it's built for the Enterprise it's got good logging that comes with it so you can actually see and explain what's happening in each flow of the segment and then see logs after the fact you can connect it to multiple different llms it's not just open AI you've got anthropic CLA hugging face and anything else that you
want to work with and it's all open source which we absolutely love okay so when you log in you're going to be presented with um several different tabs up the top here so the explore tab basically gives you a lot of different app examples you can actually take those and add them to your workspace plug in your own knowledge bases and just see um how a typical workflow and you can see how a typical agent might be setup so it's divided into multiple different types here you have an agent assistance different functions for companies and
workflow apps so really you just divide them into two different types of Agents chat flow or workflow chat flow is when you want a more chat-based experience and workflow is if you want to do something in batches or you're running it continuously with a set amount of steps if that helps you understand how that works so then we have the studio over here this is where we can create from an existing template you can create a blank one or you can import a DSL file which is essentially a template file that you can um pull
in if you want to share or copy templates um we've also got uh knowledge base so you can add in whatever knowledge that you want to we'll talk about that in a sec and there's also a wide range of tools but it is missing some key tools I'd like to see there like notion air table and some other popular noode tools so for this for this tutorial we're going to build a e-commerce chap out agent for a fictional PC store um you can run it and wrap it in a nextjs wrapper uh you can put
it and embed it on any website with a simple JavaScript embed link and you can actually add it as a chrome plugin so that you can have it pop up in any Chrome window of your own and basically ask it questions which I think is pretty cool so let's just start the chat here um we're going to ask it um let's say what motherboards do you have in stock and how much are they and it's running a workflow process and it's telling me I have the Asus Rog gaming motherboard in stock for $329 Okay cool
so let's see how all that's built so this is the workflow we're going to end up with when we're finished it has a start node a question classifier to decide which knowledge base it needs to ask the question from the separate knowledge bases and I'll show you how to do knowledge based setup um alternate answers llm questioning and the final answer and we're also going to have features like a conversation opener a follow-up question questions text to speech speech to text and citations as well along with content moderation input and output so those are all
the kind of main features that we need and I'll also show how you can log responses and see how your chatbot is working everything You' need for a production launch so let's get into it okay so it's important that you guys learn step by step so I'm actually going to build this with you we're going to go up here to create from blank so when you're creating from blank you're going to get a couple of different options essentially all the tools are available to each one the only real difference is between chatbot and workflow so
a chatbot is more of a conversational based interface where you're going to have an over and back conversation more suited to something you'll put on a website for use with a customer or for internal use and a workflow agent is something like where you would upload a um a blog post it would scrape it and then it would step through a number of steps to Output it into um different posts across your social media so it's kind of like a batch process as opposed to um a conversational interface think of it something bit like a
no code Builder like zapier or make so in our case we're going to go with a chatbot and we're going to use the chat flow because it seems to be the way that Diffy is going to be um building out its Bots going for forward so let's give it a name I'm going to call it Mr Robot PC store we call it version two and let's just click create okay so it gives us a starting basis to work from we have these different nodes we have the llm and we have the answer so if we
just go up here and we can type in something here into the chat in the bottom hey how are you today hey I'm just a computer program so right now we're running you can select it here the model is GPT 3.5 and then you have options to select the complete open AI Suite along with Cloud as well I'm just going to stick with 3.5 for now because it suits our needs you've complete control over the typical parameters via the API so things like temperature presence frequency the amount of tokens that's specific to each model so
next thing to understand is here all these different nodes that you have you've got your input fields which you can add here you have a choice between um short text paragraph you can put in a little selection box or a number and then we've got all these little inputs that have previously been added which is the user ID conversation ID the any files that are uploaded and this is the actual query get that gets put through you can see that this is a string and then it's showing the next step where it moves on to
next so that's pretty straightforward so that's our starting point okay so we're going to need a knowledge base attached here so in order to create the product information I just went to open aai and I said can you create a CSV file for 20 computer hardware products you would use to build a PC give the name description price and what it's used for and then I also went and created a similar one for software products so great can you now create a similar file but for software commonly installed on a PC give the name description
price and use for columns and then I just downloaded those as a CSV okay so let's go to the know base and now we're going to create knowledge so in terms of data sources you can import from a new file you can sync from notion or actually sync from a website and what we're going to do is just drag and drop and upload our CSV file here okay once we've done that we just click next so next we'll be presented with this screen it actually gives you a lot of control over all the variables the
chunking the chunk length the pre-processing rules Etc but if that's a bit overwhelming for you at the start you can just set it to um automatic and we can pick high quality uh we're not going to worry about the different types of hybrid searching or full teex search it's great to have those options but we're just going to stick with Vector search for now and we're going to click save and process okay and it's telling us that that is complete and then we can go to the document now what's important is that you wait to
make sure that the status is available if you try and work with the knowledge base before it's available because it needs to pre-process if it's pretty big you're not going to get any responses back so we can actually do some retrieval testing we can ask it um do you have any fans available and hit testing perfect and you can see the retrieval that's coming back here we have a Cooler Master we have a supernova power supply um all these things that are relevant to our search and then you can actually change the settings after the
fact as well okay so that's great we've got our knowledge base set up so let's go back to Studio again and let's go back to okay so here we go we have our starting point and we have um our input Fields so right now by default we have the user ID conversation ID these are all just these are background variables that the system will use to get past you'll see them normally set up before you start the one we're interested in is the query sometimes that's not there when you start it up but you can
just add it in by going to input field the type of field that we want we want a short text field you can just call the variable name query give it a label that the user might see and give it a max length and just click save you can also put in paragraphs you could have a selection drop down if there's multiple options those are our input Fields so let's cancel that for now so next thing we want is we want to do some classification so we want to decide which knowledge base we want to
search when the uh user asks a question so let's hit plus and then we can go for question classifier here perfect so it's going to use uh GPD 3.5 into to classify the questions that seems to work perfectly fine and then you've got these different classes so if we go over here first thing you'll see that the input variable is the system query string which if you'll remember it's what we set up here and it's getting passed in and then these are the different classes okay so I've just set up the different classes we have
class one questions about PC Hardware questions about PC software and then non-pc related questions uh so what we'll want to do next is attach our knowledge bases so hit plus here and then knowledge retrieval and in here we want to set these variables so again we'll see that the query V query variable is coming from the start it's the input of the question that the user is going to give it's important that that's passed and then we need to add our knowledge so let's click the plus button here and then I'm going to pick computer
hardware and select add now let's duplicate this and then connect to this second class and in this case we're going to remove computer hardware and we're going to add software products and click add and then we're going to add a last last node here which is a simple answer and the answer is going to be sorry I can only handle questions related to building and purchasing for a PC okay so next what we want to do is add in our llm for each one of these now when we click on the llm Block we see
that the model we're using is gpt3 we can set the variable here and here are all the variables that are available from earlier in the flow so here we have knowledge retrieval and result so let's just pop that in there so we actually need to refer to the knowledge in our prompt so so here's a recommended from prompt from Diffy to help you deal with the workflow so use the following context as your learned knowledged inside these XML tags and then we have the actual tags here so in here what we want to do is
Slash and then you'll see context here so context is actually pulling in whatever we have inputed here so the rest of the prompt is just a little bit of cleanup if you don't know just say that you don't know and then if you don't know when you're not exactly sure ask for more clarification so we've added the system prompt which is all the information in the background going straight to the llm and then we want to actually add the user prompt that's passed through so again we just hit slash and then we're going to put
in the query okay and next up we want to just end and answer the node so let's put our answer in here so this is going to generate a text string as an output when we look to the next node then we want to make sure that we type in slash and we're pulling in that text string as our answer so it's important always just to remember that you need to link the variables down the chain of blocks and if you remember that it helps an awful lot in debugging okay so what else do we
want to do in terms of features we can do lots of cool things like upload an image if you want to do that it's not really relevant in this case um you can have citations and attributions enabled so that basically means that when it does pull up a response it will give the knowledge base or chunk that it was actually pulled from and that's useful for um grounding and making sure that uh the correct information is sourced other features we can add we can have a a conversation opener uh followup so deciding setting up the
next question in the flow we can have text to speech so that the chatbot can actually speak out loud and we have speech to text so that you can actually record what you want to say into the chat bot I will convert it to text so that it can be processed by the llm so you can actually add content moderation as well and that includes moderation of the inputed text from the user if there's certain things you don't want want them putting them in there or you want a flag for and also certain things that
you don't want the model to Output so these are really important in terms of Enterprise operations and making sure that the chat bot doesn't go off the rails so in our conversation opener we've given it some basic prompts and some opening questions and we can save that so what's happening is we have the query starts off here it gets classified the which which which knowledge base we need is decided and then the llm fires up it's given the context and the background to what knowledge base it needs to pull from and that actual context and
then it's given the prompt from all the way over here and then with the answer we can just go up here and type slash add in text which we've already done and we should be good to go on both of those and we can hit the preview button up here so it's giving us a preview of the app hey I'm here to help you build your custom PC I've got access to our catalog of pricing what would you like to know yeah sure so what motherboards do you have so you can see it running through
it's asked to knowledge base it's gone to the llm and here we go I have the Asos Rog stricks egaming motherboard in stock and it's giving us the citation of where it came from if you don't actually want to expose your entire catalog here as a citation you can either break it down into smaller chunks or you can just go to Features here back to add feature and just switch off the citations here perfect so now we can actually publish this so let's go up here and click publish and now we have the option to
embed into a site so we can basically take this iframe or we can put a little script widget that will pop up on a website so you just put this into your web flow or WordPress template and you'll have a widget that'll pop up or you can actually uh install the the Diffy Chrome extension and it will um and you add in this URL and in your Chrome extension you can just click a button down in the bottom right and it will constantly pop up so you'll have it with you wherever you browse so I
think that's pretty cool so let's go back to publish here and we can run the app and just out of interest you can do lots of different changes here and create lots of different previews um and they won't actually get published until you actually hit publish so that's a great way if you're updating and want to test without having it released to production so let's go and run the app here and start the chat um let me see do you have Microsoft Office and how much is it so running through the workflow process yes we've
Microsoft Office and it's priced at $99 okay that's pretty cool so Diffy gives you full API access to your chat bot or your chat workflow that you've created and there's also a helpful starter GitHub called conversation which uh basically allows you to spin up a nextjs app with your API in integrated so basically you're getting a whole custom app uh for free there which is pretty cool so another great Enterprise feature is logging and annotations so all the uh requests that are passed through you can double check them and you can annotate them for debugging
and there's also um a really powerful monitoring built in you can see tokage usage session interaction um uh total messages and it even has user satisfaction rate using some semantic analysis active users Etc so what we're what we've built here is basically a chatbot using the chat flow approach where you've got node after node after node and we have an output you can also create a defined workflow and to be honest it looks exactly the same as this the only different is that in instead of an answer at the end we just have an endo
and then that whole workflow can be used as a Custom Tool uh it can be called by API by uh by make or any other service that you want and it can run independently and you can also set it up to run in batches there's lots of other Cool Tools as part of the workflow in terms of using IFL statements you can do iteration if you have to run through and map through multiple different um sources of content um and lots of other things like variable aggregation and httv requests so this is very similar to
make if you've used that before um which really makes this quite extensible if you've got a HTTP request built in you can essentially make requests to any API that's out there um and build whatever it is that you need to build so that's a great function built in so you have multiple different options you can run there's Diffy Cloud which which is basically plug andplay it's a cloud-based web app but you do have to pay for it they offer a free trial where you can get up and running and test it out as much as
you want and then packages start from about $59 a month after that uh you can also just hosted yourself for free using the Community Edition uh there's a starter guide here you can set it up with Docker happy to do a video on that if anyone's interested and then of course they've got more Enterprise level deployments if you like what's great is that you can deploy this on your own infrastructure uh or on premise and they offer white label abilities as well so hopefully you're up and running if you have any questions on dii drop
them in the comments and I'd love to know what your favorite AI agent Builder is at the moment and why if you're into Ai and automation for your business as a consultant or just have a curiosity drop me a subscribe I'll be doing a lot more reviews and tutorials like this over the coming weeks