Transcript for:
Creating an AI Medical Agent Tool

hello everyone and welcome to another lesson today I have an exciting experiment that I want to do with you guys thank you for joining uh so as you can see here in front of me this is the AI Master agent that we've built together in the past couple of weeks it now consists of 1 2 3 four five 6 7even eight agents that are controlled by one master agent uh this agent now calls whatever uh necess agent uh based on the query of the user today I want to build yet another one yet another agent that I'm going to add to this one that could be added to this one which is an AI medical agent now of course whenever you guys have something hurting you whenever you're sick go to the hospital go to the doctor but uh usually when whenever one whenever someone gets sick or something he picks up his phone which is a bad habit and Googles uh Googles his symptoms or even better uh go go to Reddit and actually hear what people are saying and this is exactly what I want to do today is uh make an AI medical agent that you you can ask him something like uh I have my chest for example is hurting me my throat is hurting me uh I have something I have a headache Etc and then this agent will go in and uh basically scrapes Reddit and gets you a um a summary of most comments and posts about the symptoms that you have and summarizes that for you it will be very cool to do it will I I'm sure it will be very beneficial to have uh so first of all Let's uh let's go ahead and get started before I want to start I want to let you guys know that uh make sure to check out my store here uh I have uh I have the store now now it has 39 plus automations uh these automations are worth thousands you can sell them you can uh alter them you can make them to to create streams of revenue for you make sure to grab this as prices will go up soon I also have a couple of courses make sure to check that out as well and if you're if you're into n8n make sure to check this out as well okay without further Ado let's jump ahead so I'm going to create a new scenario in me.com uh our first so this is the first note okay uh what we want to do is first uh start with a trigger we always start with a trigger so our trigger is the way for the automation to start okay so for this trigger uh we're going to going to start with a slack and we're going to watch for public channels okay then I'm going to use the uh Javis AI agent and I'm going to limit it to one message okay from now on so this is the trigger okay uh if you don't have slack setup make sure to add it here and it's quite straightforward okay uh so I have this uh this trigger okay so we'll get the message from the user what we want to do is uh we want to utilize AI okay so we're going to use to create a chat completion and now you can use whatever you want in terms of agent whatever whatever works for you uh let's go for chat GPT for all for now and let's uh let's start by creating so uh for this one uh we want want as as usual we want a system and a user okay let's start with a system and then add a user for the user it's quite straightforward this is the user message okay and I'm going to put in the text but for the uh for this agent I'm going to paste in the prompt here so you an expert assistant you're analyzed to a message okay the red query this is the uh this is the let's say the symptom that the user would like to search for Reddit this is whether user wants to search Reddit or not so this either true or false okay uh as we say output in Json format as usual expert assistant Expert Medical Assistant and you okay let us now we have everything set up let us save this uh now what we want after we get the answer is usually to parse so we're going to parse because we said we want it as Json so we're going to par whatever the answer is did I okay um let's choose the message content okay so we're going to parse this uh and after we parse we want to check for uh the Reddit uh if it's true okay so uh we we'll do that in a filter so we'll probably we're going to run appify for sure okay but before we run appify we want to check that this um the uh that the node that the result of the Json is uh is going to be true and to do that the Json is three so it's going to be three do Reddit oops okay now we want this is a bullion so if you don't know what I did here it's usually if we don't have the data we'll put it a like a placeholder uh uh placeholder text that gets filled when we have a data I I'll go I go over this in the U uh in the courses that I've mentioned okay so I'm going to go to bully in here and I'm going to say equal and I'm going to choose this true okay don't try true make sure you do this okay ready it check now I'm going to save so this checks that if if this is uh for sure more uh from Reddit okay now what I want to do is uh do the ffi so in ffi which is a great platform uh to that have a lot of good scrapers so I have this Reddit Explorer uh I'm going to start my trial and I'm going to rent the actor okay so after renting the actor now we want to start uh experimenting so we will run this actor first we'll get the posts uh let's go to here so this run actor and then let's um refresh this there you go okay run synchronously always this means that it will wait until the run is over before it proceeds because if it proceeds before the run is over then we'll we'll we'll have an issue okay okay so where we want to put a Json so let me put this Json and what we want to do is take from three dot uh Reddit query as we specified right okay so what we're doing here is we're searching uh posts so as you see we're searching posts and based on relevance and uh this is the query that we want uh now this will run and will get me basically the posts that we get that we want based on the uh on the message so let's save this here now after we run the actor we always need to uh get the get the data because if we just run without getting the data we don't we didn't do anything okay so the data is going to be from here data set ID and everything should be fine okay so now here we will get the data and then probably after we get the data we'll need to uh put all the data together uh in in one uh in one format uh so we are going to do a text aggregator the text aggregator basically takes the text and from different uh uh from different bundles and put them all in one text so get data set we'll we'll take it from there and let me turn on Advanced options and because we want we don't want them all together because we want like a bit of break between each other and then here we will write uh posts okay and then we will do uh we'll basically take the data set from I think four dot content dot because we don't have the uh the data because we didn't run it yet okay okay let's save and uh let's recheck so now we're getting a message we're making sure that it's readed and taking the symptom will parsing well we are running the actor uh and then we're getting the data okay this is all four posts okay now we'll need to do the same thing again but for comments okay so I'm I will uh get these here and I will CR c crol v put that here and connect this okay we don't need the ready check here again let's delete that okay so now this one we are going to uh check for comments okay for comments and we'll have the same thing the same Reddit query we'll save and here also we'll get the data set from the one uh from seven from here and then we will uh also but here we will we'll name it comments and we need to make sure that it comes from eight okay content I think it's called Uh content markdown uh we let's let's wait on that because I'm not sure how the um okay so I'll run it up to here and before we aggregate anything okay and let's go to Jarvis here and let's uh tell hey uh I have a um just Spain for example when I breathe deeply can you search for that on Reddit please so I'm going to send this message and I'm going to go here now I want to uh here we're going choose where to start choose manually uh I'll choose the recent message so I'm going to run now and see how this proceeds we did cut it here okay let's run okay so we have this an [Music] error uh we need to adjust this please output only Json format okay yes so we'll just um what we can do is in order to avoid this is we can add another variable here can try this let's try this okay and we'll take whatever message we get from here we'll add a replace so we'll take this message we want to replace uh um you want to replace this okay this with an empty string and we want to run another replace here and then we'll take all of that put it here and then we want to replace uh the second issue that we get is this U this at the end these and then let's try to search for these and replace them with an empty string as well we'll try this and see if it solves because U don't want to keep pring to this issue okay so we only need now to parse the replace and for the redit check yeah I think this good let's run this okay one 12 so now now the actor is running getting the data in here we have okay perfect so we only need to specify uh what we want think here what we want this one we'll take that copy and we are going to do the same here but here it will be number seven so let's go to here and it will be number seven all right okay so we'll get the comments as well and then what we want to do is uh we want to add another AI module here and this I'm going to you an expert medical assistant will summarize post and comments from okay only output text not mark down perfect what we want also is to give it the text so we'll do that and it will be the posts are are this one and the uh comments are this one okay and then we want to get back to our um uh we want to get back to our agent with a create message and send them the actual result from a list let's choose from a list uh chose this and we will get back to them with whatever is this me message okay I'm going to Auto align everything I'm going to save and then I'm going to rerun this and let's see if what we get okay let me call this AI medical agent and I'm going to run okay everything is looking good here oh this comments did not work let me stop okay so uh here we're getting but we are not see okay uh we got the wrong number that's why let's see let's run it again all right let's go okay the the agent here works well the Json works well here are the comments the posts comments are good now now it's up to the AI agent to summarize now we'll get the message okay so many people disc experience just such as deep breathing movement CH common causes mentioned in the okay anxiety some users report intermittent pain in the left chest those with recent okay many comment emphasize they need to advocate for on self in medical setting sharing frustrating experience with Doctor dis dismissing their concern key take away chest pain with deep breathing is often muscu multical I don't know what this word is I'm not going to try to say it or anxiety related but can sometimes indicate some serious issues it is crucial to seek okay this is perfect it it summarizes everything and gives you key takeaways I like this agent I actually might use it more often uh okay so uh I'm going to save this and I'm going to export this for you guys and I'm going to add it uh to the pack here for you guys to utilize that in your uh applications in your chat in your agents I hope you guys found this beneficial uh if you did please like this video subscribe and I'm going to see you in the next lesson