Check out a free preview of the full Build an AI Agent from Scratch course
The "Combining Tools into an Agent" Lesson is part of the full, Build an AI Agent from Scratch course featured in this preview video. Here's what you'd learn in this lesson:
Scott demonstrates how to combine the tools to generate a meme image from a random dad joke. He shows the process of inputting the prompt, retrieving the dad joke, generating the image, and receiving the final result. He also discuss the limitations of the tool and how it can be improved.
Transcript from the "Combining Tools into an Agent" Lesson
[00:00:00]
>> Scott Moss: Okay, so we have, our tools, our tool definitions, everything looks good, we'll see what happens. Let me make sure I delete my history cuz I think it's about to get weird. [LAUGH] Whenever you got red it's going to get weird. Yeah, I didn't put messages. Okay, there we go.
[00:00:21]
>> Scott Moss: There we go, okay, so yeah, make me a meme image from a random dad joke. Cool, it's getting the dad joke, even though I said make the meme first, it went and got the dad joke first, that's smart. It's like I need the dad joke before I generate the image, so it went and got it.
[00:00:39]
But I think it was really, really good sign. And it generated the image, and now it's answering, it's gonna answer, and then there it is, here you go. Here's a meme image featuring a dad joke. Why was it called the dark ages? Because all of the knights. Okay I feel this was gonna be bad.
[00:00:58]
[LAUGH] I feel this is going to be so bad. Let me see. My god, why was it called the Dark Ages? Okay, this one's not that bad.
>> Speaker 2: It's not bad. It almost even spelled it right.
>> Scott Moss: Yeah, that's really good, actually. Okay, I can't believe it actually got the text.
[00:01:14]
I mean, what the hell is that? That W, the two Hs. It's struggling on the Hs but-
>> Speaker 2: Or it's artistic.
>> Scott Moss: Or maybe it's the font. Okay, I'm actually shocked.
>> Jamie: That's pretty good.
>> Speaker 2: It's Gothic.
>> Scott Moss: Yeah.
>> Jamie: Modern Gothic.
>> Scott Moss: Yeah, I kind of feel it made it look like me in the middle too, a little bit.
[00:01:34]
How did it know that? It's kind of creepy, yeah?
>> Speaker 2: I mean, I like that it did all the Hs consistently, at least.
>> Scott Moss: Right, it did, yeah, okay, okay. Excuse me, DALL·E, I still don't think you're that good, but I get it. Let's try something with Reddit.
[00:01:54]
[LAUGH] Let's to do something with all three of them. So I have Reddit, I have NBA stuff, I have dad jokes, and I have image generation. What can I do with all three of those?
>> Scott Moss: Find me a post on Reddit that makes, no, no, no, no, no, cuz this one's random.
[00:02:15]
Hold on, let me see. What am I doing?
>> Speaker 2: Why are we not asking the AI for this?
>> Scott Moss: [LAUGH] What am I doing? I have three tools, get all the posts from NBA Reddit, generate an image with a diffusion model,
>> Scott Moss: And get a random dad joke.
[00:02:59]
Make me a prompt I can use that uses all three of these. Yeah, what are we doing? Why do I have to think about anything? Here we go. [INAUDIBLE]
>> Speaker 2: Now, would you even need to have told it about the tool? Just say, give me a prompt that uses all the tools.
[00:03:18]
>> Scott Moss: That's true, it already knows about the tools. I forgot i'm using the same AI that generates the thing. I'm not good enough, I'm not worthy. Okay, let's workshop this one cuz it doesn't know about NBA so we have fake that. No, no. Okay, first, retrieve the latest post from Reddit to gather trending topics and discussions.
[00:03:45]
Then ,select a popular image post related to the NBA. That should be fine, cuz they're all from the NBA. Next, use that post as inspiration to generate a meme image with a diffusion model. I don't have to say with a diffusion model. Incorporating a funny or clever twist.
[00:04:03]
Finally, add a random dad joke that relates to basketball sports in general. It's not gonna be able to do that. Or it might-
>> Speaker 2: It'll just keep asking.
>> Scott Moss: It'll just keep asking it until it finds one. [LAUGH] Yeah, yeah, yeah.
>> Speaker 2: And then it [INAUDIBLE].
>> Scott Moss: All right.
[00:04:18]
I'm down. [LAUGH]
>> Scott Moss: Okay, it went and got a joke, I guess it's satisfied with a joke that it has. It's getting an image now. What happened, what happened? It tried to generate a bad image, [LAUGH] I got moderated. [LAUGH]
>> Speaker 2: Reddit did that?
>> Scott Moss: My goodness, that thing got moderated to hell.
[00:04:51]
Your prompt may contain text that is not allowed by our safety system.
>> Speaker 2: We didn't log the prompt it came up with.
>> Scott Moss: Well, it might already be in the database.
>> Speaker 2: I bet.
>> Scott Moss: Yeah, let's see. I'm scared to look at it now. I don't know if it's got moderated.
[00:05:08]
>> Jamie: Ja Morant, that's why.
>> Scott Moss: [LAUGH] Ja Morant, he's got guns.
>> Speaker 2: [LAUGH]
>> Scott Moss: I mean, this looks fine. [INAUDIBLE] I wonder, if it's probably copywritten. I wonder if it's copywritten, I think that's why. It's probably copyright with the NBA and using celebrities names. I think that's it, because-
[00:05:31]
>> Speaker 2: Or maybe their jerseys number.
>> Scott Moss: Yeah, yeah, I think it's copywritten because, I mean, he literally just did this last night. Ja Morant just did this 360 layup last night. So, that's funny.
>> Speaker 2: It's probably Will Smith, honestly.
>> Scott Moss: [LAUGH] yeah.
>> Speaker 2: Cuz it says Will Smith in the snow.
[00:05:46]
>> Scott Moss: It does.
>> Speaker 2: Probably not Ja Morant. It's probably Will Smith.
>> Scott Moss: How do you find Will Smith in the snow? Look for Fresh Prince. My God,.
>> Speaker 2: That's pretty good, though.
>> Scott Moss: That is pretty good. Okay, it did a good job. It did a good job. But this is the case for having local diffusion models so you don't get moderated to hell, but yeah, okay.
[00:06:06]
What you say, Jamie?
>> Jamie: Did you just denied?
>> Scott Moss: Yeah, I just got denied, yeah, absolutely, pooped on. But, yeah, we have an agent, and it works pretty good under the constraints in which it belongs. So I think that's really cool that we could just AI all the way down, do some cool stuff like that.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops