[VOD] Laravel AI SDK just dropped (part 1)

nunomaduro| 01:46:01|Feb 18, 2026
Chapters5
Host introduces the Mighty Laravel AI SDK, outlines the beta state, docs, and the plan to build an end-to-end demo live.

Nuno Maduro dives into Laravel AI SDK by Taylor Otwell, building a personal assistant app live, exploring models, tools, embeddings, streaming, and real-world Laravel integration.

Summary

Nuno Maduro hosts a spirited live session unpacking the new Laravel AI SDK from Taylor Otwell. He starts by installing the package (composer require Laravel AI) and examining the package’s foundations, migrations, and config. He highlights that the SDK takes Prism PHP as its core and leans on Laravel components for a first-class Laravel integration, including migrations for agent conversations and a configurable AI.php that lists providers (OpenAI, 11 Labs, Gemini, etc.). The stream then pivots to hands-on experimentation: creating an agent (php artisan make:agent personal assistant), wiring it to remember conversations, and using prompts with structured output to get JSON responses. Maduro explores practical features like tools (web search, terminal), attachments (PDFs, images via Laravel AI image), streaming responses, and broadcasting for UI updates. He also experiments with model selection (default GPT-4-tied OpenAI, cheapest vs smartest model attributes), and demonstrates image generation and even a custom tool that returns a random subscriber from the chat. The session teases embeddings and vector search, but emphasizes the SDK’s design: testability (Prism base), multiple providers, and a Laravel-centric flow from CLI to database. The vibe is practical and ambitious: build AI-enabled apps in Laravel, with fallbacks, streaming UX, and real-world workflows that blend code, AI prompts, and user data. By the end, Maduro hints at ongoing enhancements like a streaming console for Laravel prompts and the potential to attach terminal tools or custom tools for richer agent capabilities.

Key Takeaways

  • Installing the SDK is lightweight: composer require Laravel AI pulls in Prism PHP as the foundation and Illuminate components as dependencies.
  • AI providers are pluggable via config AI.php, supporting OpenAI, 11 Labs, Gemini, Enthropic, and more; embeddings and vector search are part of the toolkit.
  • Agents in Laravel can remember conversations automatically, using a remember-conversation trait tied to a user, enabling persistent dialogue across prompts.
  • Structured output allows AI responses to be returned as JSON by supplying a schema, enabling easy parsing and downstream processing.
  • Tools extend agent capability: built-ins like web search and terminal, plus custom tools (e.g., a PHP artisan command that returns a random subscriber).
  • Attachments and media are supported (PDFs, images via AI image feature), expanding the ways AI can reason over user data.
  • Streaming responses can be enabled to show token-by-token output in the console, improving the interactive UX (with ongoing work on console streaming via Laravel Prompts).

Who Is This For?

Laravel developers who want to add AI capabilities to their apps, especially those curious about practical integration patterns, agent design, and streaming UX. This video is essential for teams evaluating how to wire AI prompts, tooling, and embeddings into a Laravel stack.

Notable Quotes

"We are going to dive into the new the mighty Laravel AI SDK built by Taylor."
Opening line establishing the scope of the livestream and the SDK in focus.
"Remember conversations. And when I saw this, I was mind blown."
Maduro highlights the automatic conversation memory feature.
"The only thing you have to do to preserve the conversation… is use this beautiful thing, call it remembers conversation."
Explaining the memory feature implementation flow.
"You are a beautiful helpful assistant."
Prompt template content shown in the agent setup.
"This is how easy it is to preserve a conversation on this Laravel AI SDK. Beautiful stuff."
Summarizing the memory/conversation persistence capability.

Questions This Video Answers

  • How do I install and start using Laravel AI SDK in an existing Laravel project?
  • Can Laravel AI SDK remember user conversations across prompts and sessions?
  • What are the best practices for using embeddings and vector search with Laravel AI SDK?
  • How do I create a custom tool for a Laravel AI agent and call it from prompts?
  • What are the differences between the cheapest and smartest OpenAI models in Laravel AI SDK?
Laravel AI SDKTaylor OtwellPrism PHPOpenAI11 LabsGeminiEmbeddingsVector SearchMemory / Remember ConversationsStructured Output (JSON schema) in AI responses','AI Tools (web search, terminal) in Laravel AI SDK','Streaming API in Laravel AI SDK','Attachments with AI (PDFs, Images) in Laravel AI SDK','Anonymous / custom agents in Laravel AI SDK
Full Transcript
Hey, hey, hey, hey, hey, hey, hey, hey, hey, hey, hey, hey. [music] Black magnum [music] jump. Black I white. Uh-huh. Yeah. [music] [music] Hey. Hey, hey, hey, hey, hey, hey, hey, hey, hey, hey, hey, hey, hey, hey. Black [music] magnum. What's up, beautiful PHP people? Welcome back to another live stream. And oh boy, just excited to be back to my office after this huge trip to Larakon, India. How everyone is feeling today? Excited to see you all? What's up Alexandro Florida, nice to see you? Oscar Ronak Numidian, what's up everyone? Kra, what's up? Nice to see you. How things are? I'm there are doing fantastic ma'am. Just happy to be back. W Nuno, thank you. Thank you. Thank you. Thank you. Thank you. Oh my god. Just happy. So happy to be back. Honestly, I was out for 10 days at Lacon India. It was fantastic, but I was exhausted at the end. Just be h just happy to be back, man. Just happy to be back. And with some exciting news today, we are going to dive into Laravel live. Laravel live. What the [ __ ] I'm saying? Laravel SDK for AI. It will be awesome. I'm going to dive into this [snorts] into this package just like you guys. You know, I have seen a very a very little bit of this package already and you know, but I haven't used it. So, we'll be, you know, first time for me. First time for me. Happy to see you. Thank you. Thank you. Happy to see you too. Carlo is saying the following. How do I know I'm a PHP dev? I'm sorry, dude. You know my my audience are typically PHP devs, right? I am a PHP dev if you are a PHP dev and I right. I'm not if you are not a PHP dev. Nice to see you all. What's up, Tik Tokers? Nice to see you as well. Twitter people, what's up? What's up? What's up? And Twitch people, how you guys are doing? Long time after live. I know. I know. I know. PHP for the win in for life. Oh yeah. Pick and nice to see you, man. It's been a while. How you doing? Here we go. A bunch of PHP developers, you know, kind of expected. That's the audience I do have in chat. Today will be a super exciting live stream. Okay, I don't know if you guys are ready for what is about to come on this live stream, but but we are about to dive into the new the mighty Laravel AI SDK built by Taylor. And this is like the first package from Taylor from the last 2 three years I think and the guy have basically locked himself for 3 months building this beauty and we are going to jump into all of this. So the documentation is out the packages released under a beta release. I think we need to see all of this man. This is kind of new for me. I just arrived from the gym and we need to check all of this man. You motivate motivate me to learn Laravel. Thank you. Thank you. You motivate me to be here streaming for you man. Thank you. Thank you. Thank you. Good luck. Good luck. Good luck. Hey, Francesco. Nice to see you. How you doing, man? How you doing? Noo-Noo nation, what's up? What's up? What's up, chat? We need to dive into this. Okay, we need to dive into this. So, the goal of today's live stream will be the following. Understand a little bit what is lived. So, I'm going to find this with you guys. Okay, this is kind of new for me too. Understand what this is, what kind of models can we use, what kind of features this brings to the table. Okay, this is what we are going to do. We are going to see the code as well. Also everything is open source. We are going to jump into the code as well and we are going to just build a Laravel app together. You know just something on the CLI where we can use this beautiful features all together. Okay. So we are going to do that. I have literally set up an openi key so we can use this open key with this project. So we have that. What else we have? We have the tweets from Taylor Roell as well which they should be here we go. Here we go. Here we go. They should be here actually. So tweeted Taylor just tweeted something about this new package. Here we go. Here we go. Here we go. It should be literally around here. Yeah, 3 minutes ago as you can see, but there's also stuff below. We are going to see all of this together as well. We have tweets from the Laval account. We have a bunch of stuff to do. Man, this will be a huge live stream. Grab a slice of pizza, grab some water, and we are going to dive into this stuff all together. All together. Okay, it'll be awesome. Expect a live stream from two hours, man. Two hours live stream today. Okay, hope you guys are feeling fantastic. Before we just dive into all of this stuff, let's, you know, let's let's acknowledge how awesome you guys are. Okay, ordering a pizza right now. That's a nice one, Florian. Oh my god. Oh my god. Nice to see you all. By the way, Shad, don't forget subscribe my channel. We now have the followers count right here. Meaning the following. If any of you watching right now is not subscriber, if you subscribe, this little thing right here should go a number up. That's the theory. I don't know if it works, but if it works, it will be like that. Here we go. Someone subscribed and event number as you can see. Oh my god. So good. So good. So good. Make an agent to do gym for you. Well, it would be nice if that worked. You know, it would be if that work, but it doesn't work. I think I'm going to build my own personal assistant with this AI SDK [ __ ] This is what we're going to do. Okay, first of all, let's say thanks to our beautiful sponsors for making this possible. Redberry International, one of the best digital agencies out there to build a lot of apps, view apps. They're absolutely awesome. Check them out. We obviously have Titan as well. You know, they build and rescue web apps. They're absolutely awesome for sponsoring my work as well. And the Matt Stford of course wrote this beautiful book which was one of the my very first books actually. Lot development running. Check them out if you haven't already. Titan and of course Mailprap. Mailshap used to be the solution which was only for local development but now they have production email as well. Check them out. They are awesome and they are sponsoring my work too. Jet Brains of course the company behind the mighty PHP storm the best editor in the entire planet is sponsoring my work as well. Check them out. They are awesome. Okay, they're absolutely awesome. Code Rabbit of course if you want to have some nice AI reviewing your pull requests and have this beautiful sequence diagrams in your pull requests too. Check them out. They are beautifully awesome. Devon AI. If you want to just basically have Slack linear integrating with AI, it will just do tasks for you. They're absolutely awesome. Check them out too. That being said, I would just arrive from India where I've made a bunch of content. If you haven't checked my content on India, check it out. That is literally an in real life live stream of 6 hours. There is this video interviewing Povillas and Taylor Otwell. Okay, here we go. Here we go. A video interviewing Taylor Otwell and Povillas if you haven't checked that already. And while you do that, just do me a favor. You see this beautiful like button right here? Just takes a second and literally supports my work right here. This beautiful like button. You just click on it. Takes nothing if whatever. And it just really helps my work. Leander, nice to see you. How you doing? I need the SDK to support Copilot Enterprise. I don't have metal API keys. Well, I don't even know if that works. We are going to check that out. We are going to check that out. All right. All right. What else? We just reached 26 26 26K subscribers, which is absolutely awesome. Thank you. Thank you. Thank you. Thank you. What else? My Twitter account. Yes. Yes. Yes. Yes. Yes. What I have here? I'm going to be MC at Lacon EU real real soon. That's happening at the end of the month. Okay. So, if you haven't checked this lacon.eu website, check it out. Tickets are literally almost sold out. That's the only thing I know. Okay. Lakon EU for the win as well. Ted out. Well, this is the first thing we're going to check. All right. Do we have anything else we need to check before that? Lakon US, it's announced. Okay. Lakonuans just announced will be in Boston. I love Boston. My wife loves Boston. So 100% she will be coming. Check it out. That is this beautiful website. I will be one of the speakers at Lacon US as well alongside Aaron Francis and Taylor. I'm 100% sure there will be a bunch of good speakers. And this is Lakon US. You know, it's the Champions League of the Lakons. Check it out if you haven't already. Okay. Boom. Uh so this is Lacon US. Here we go. Here is the website. Here is the website chat. Okay, so that's done as well. What else we have? I think we're ready. [ __ ] Are you guys ready to check Taylor mighty Laravel SDK? If yes, type PS on the chat. We are so ready, man. We are so ready. [snorts] Can you use your open code Zen account for the AI SDK? I have no idea, man. I've contacted David Hill to see if he can hook me up. Hook me up with uh black subscription, but he's not answering today, so I don't know. But 100% I need I need a a black subscription. So today if we need AI actually we are going to use let me just move this here. If we need AI yet I think we are going to use cloud code CLI. Okay. You just type cloud code and we have this beautiful cloud code thing and we just work from here. Okay. Okay. Okay. Okay. Velix is not ready. What's up Velrix? Most of you guys are ready. So let's dive into this stuff. Okay. So let's start by seeing the announcement from the Laval team. Let's go here and see the following. Laval team. Just say the following. Composer require a lot of LII lot of LII SDK provides build agents with tools, memory, structured outputs and streaming all testable with built-in fakes. Okay, so apparently all of this stuff can be super testable using past PHP and we are going to check that out together as well. It supports Enthropic, Gemini, Open AI, 11 Labs and more. You can literally swap the models using a single line of code. Smart fallbacks. This is important by the way. I have built AI apps uh you know on the AI team and something we noticed is that cloud code API is actually down like [ __ ] 20 times a day. I don't know what you guys have been experienced with cloud code API but I do know for a fact that the cloud code API is being loud it's been down like 20 times a day. Okay. So having fallbacks is actually super important. So your features don't l don't literally rely on a single API. Okay. Insanely important especially with AI. Okay. Okay. That's important. Fabu 14 is saying the following. Do you think being a pro with with the SDK will be a demonary skill? Yeah. I think like in general it's kind of just expected that all apps have AI features. All every single application is just expected to have AI features and just have this smart interfaces through AI. you know like all the kids in 20 years every every single one of those kids will expect not 20 years even like 5 10 years maybe will just expect your AI to just be you know they just speak with your website you know this kind of stuff that's what that's what I believe on okay so of course bu learn how to build apps using lot of SDK is something that you'll probably you know will use today but also like it will just be a demonary skill in the future okay SDK is just released chat. That's right. That's right. That's right. What else we have? We just also cheap Laravel AISDK skill for Laravel Boost. Okay, so Boost in theory knows how to work with a lot of AI SDK already. We need to find that out. Okay, we need to find that out. What else we have? We have Taylor Outwell going live stream next uh in a couple days, I think. Hopefully it's not today. Otherwise, the guy is just live as I am right now. Someone check the Laval account on YouTube, the Laravel PHP account on YouTube and see if Taylor is alive. Hopefully, it's not. [laughter] Okay, [snorts] so that's the tweet from the Laval account. Let's see the tweet from Taylor's account. Uh, where I can see that Taylor Otwell. Let's go. Let's go. Let's go. Let's go. Let's go. Let's go. Let's go. Oh, it's on the 9th February. Cool. So, that's not today. What else we have? Uh we have Taylor Otwell making a tweet as well. The Laravel SDK is now available really part of this package in how easy makes building AI features into your Laravel applications. We have agents image audio transcription embedding simulating search PG vector support and more. By the way if you don't know what this is embeddings in searching basically means that you can take an image okay let's see a blue sky for example or just a sky in the pool. you transform those two image into embeddings and then you search for blue and those two two images will come up because they contain blue on it. Okay, so that's a little bit what embeddings means and you can search blue or aul in Portuguese or whatever blue means in other languages will always work. Okay, that's what the first time I saw it like embeddings in vector searching I was [ __ ] mind blown. Okay, I was mind blown just being able to search for blue in no matter language it is and just give me stuff u or even stuff like anger for example you can search for anger and that any image that have like an anger person on the behind the scenes will show up it's inc it's insane by the way I have no idea what how this works but it is insane boom bada boom bada boom will be on the ninth nice nice nice 100% embedding for search will be essential on most production apps I agree with you I agree with you you know so lot of SDK also brings that we are going to set check that in a second tuto says the following this is the better release I plan to test the stable release in about four weeks so we have a a month of full of full testing and meanwhile it's a great time to dive into open source I would love your contributions and plus I have a list of things that I would like to I would like to improve before the stable release also huge shout out to TJ Miller that's right lot of SDK relies on TJ Miller is Prism package so I want every single one of you clapping on the chat. Every single one of you, okay, saying thanks. Thanks. Thanks, thanks TG Miller for bringing this beautiful foundation that Tiller Out. Well, now it's building on top of it. Okay. Okay. Okay. Everyone clapping on the chat right now. We need that. We need that. Okay. Thank you. Thank you. Thank you TJ Miller. By the way, I see a lot of people saying that Cloud Opus 4.6 just came out. I don't [ __ ] care. I don't know what you guys think, but I honestly I don't [ __ ] care. We have It is models coming out every 3 days. Can we just acknowledge that a package from Taylor comes out once a year, so I kind of want to just focus on this? And [ __ ] OP 4.6. Okay, can we just do that today? Come on, man. We have AI stuff every single day on Twitter. new models, new XYZ. I just want a break and just focus on Laravel cool stuff. Can we just do that? Come on, everyone. Do you guys agree with me? Come on. If you agree with me, type yes, please. Cuz we need we we need to we need to see some Laval stuff today. Okay. All right. So, yes, yes, yes. Thank you. Thank you, picking for appreciate your feedback. Oh my god. Thank you. Thank you. Thank you. Thank you. All right. All right. What else we have? Boom boom boom boom boom boom boom. So, this is done. Uh, everyone's super excited and XYZ. Let's just do this. What else we have? A beautiful landing page for a lot of Lai. Here we go. Here we go. Here we go. Okay. Beautiful landing page for a lot of Lai. Okay. It just looks gorgeous apparently. Okay. Lot of LA SDK gives you powerful bad. Let's jump into the docs and let's start actually building something. So, I was thinking I was thinking about building my personal assistant to begin with. I think that's the the better the betterable minimum I would expect from this package. So that allows us to understand a little bit how can you install this package today and see how can we install that on this LL hap to see how it goes and then we potentially have some time to dive into other stuff like embeddings potentially searching and XYZ. Let's see how it goes. Okay, so starting with the installation process chat this looks easy peasy lemon squeezy simple. Okay, the first thing you have to do is just copy this little thing. Call it composer require a lot of LII. Okay, you go into your app. Let's actually use this for cloud code. Let's move here. This herea bada boom bada boom bada boom. Let's open this beautiful terminal on PHP storm the best editor in the entire planet. And let's just type composer required a lot of lei. I expect to see two things. Here we go. And we see two things chat. Two things already. Of course we see prism form prism php which is the foundation of this lavall package and then we see only lot of laii being installed meaning that it's a very minimal package okay only prism basically is a foundation and that's it and if we go to the repo itself lot of lai I kind of expect the compos json to have illuminate component here we go illuminate components so rely on the components of the foundation and then just below relies on laval promps which is equally a component from the foundation And we have stilizable closure which I don't know why it's being used but we can check that out. And of course we have prism PHP and that's it. Okay. And that's it. We have lot of pint and baba boom baba ba boom baba boom. We have php 8.4 as the minimum supported version chat. Okay. And laval 12 also as required version. This means the following chat means that if you are using laval 11 this package won't work. If you are using php.3 this package won't equally work. Okay. By the way, chat, and by the way, if you just arrived, my name is Nun Maduro, peach laval developer. Today, we are checking Laravel SDK. Give me a follow, chat. If you want to see this number going up, if you want to see this number going up, just give me a follow. That would mean the world to me. Would mean the world in the planet, in the sky, in the stars if you give me a follow to support my work. Okay. [snorts] Okay. You need to order a lot of shift. Yeah, man. If you want this, you kind of have to do it. You kind of have to do it. [snorts] Okay. Okay. Okay. What else we have? Okay. So, we just type composer require Laravel AI. That just worked. Uh kind of expected. We can clear the terminal and move forward. Next command is vendor publish AI service provider. Let's just do that. Okay. Let's just do that. And we have a few things here. Interesting. So we have the configuration file, the agent stub. So if you guys are fans of readonly classes and you know that kind of crap, final classes and everything like that, you can customize your stub. Okay. I was thinking though that this stub situation would be something optional, you know, like something you do it a little bit after and not something would be just be there by default. Interesting though that if I go now to stubs, I see this three stubs right here. Okay, that's interesting [ __ ] Okay, a little bit interesting. I would say the minimum expected interesting. And then we have migrations, chat. Migrations meaning that this is something I was really hoping that Taylor would do, which is having this AI SDK super well integrated with things like Eloquent, with queuing, with broadcasting, with all the cool stuff that has not being a simple API client. Okay, which is interesting. So if we d if we dive into the migrations, we see this beautiful new AI migration. Okay. And this migration creates a new table for agent conversations. Interesting. Those agent conversations will be onetoone mapping with a user table. Meaning that you any user can have one to one. No, one to end mapping to the user table. Meaning that one user can have multiple conversations. A conversation has a title and it's index. This is kind of expected. And we have also a message. And this message should have type and royal xyz blah blah blah blah blah. All the co all the cool stuff I would expect to see from this table as well. Okay. Okay. Interesting chat. I know. Interesting. I know. I know. Interesting. So, we have migrations on this package as well. Okay. And we have a down method. Sh. Let's just fix this migration. Do a pull request and remove this down method. Unacceptable. unacceptable having a down method on migration chat. [laughter] Oh my god, you guys would you should be seeing my presentation at Lakon India. I was like super being opinionated on this kind of stuff like no down method final classes blah blah blah blah blah. People were like getting mad, you know, like saying why you don't have down method why you don't have that. I was like because I don't want to. Okay, so what else we have? We have migrations. Okay, so this is done. I expect the next command to be migrate. Here we go. And here it is. PHPR doesn't migrate. Okay, just works. PHPR migrate done now we have migrations we have a configuration okay so under config AI.php we have this AI.php PHP and we have default provider names. Okay, default provider names. The default is open AAI. I think this this is for for text by the way. Okay, this is for text and anything else. For images is Gemini. Audio again open AAI transcript or transcriptation is open AI. Embeddings is open AI as well. And reranking which I don't know what it is. Okay, I don't know what it is. We see a cohhere which I don't know what it is as well. Okay. Caching which is something apparently used for embeddings. Interesting. AI providers. We see enthropping be supported and using the API key which I have configured it already. We see core here 11 which I assume is 11 labs. Here we go. 11 labs already supported as well which is interesting. We see Gemini. We see Grock. We see Jina. What is Jina? I don't know. We see OpenAI. OpenAI again. Is that a bug? Oh, this is Enthropic. Okay, with Cynthropic, OpenAI, Open Router as well, XAI, a bunch of providers you guys can choose. Okay, that's cool stuff. That's cool stuff. What else? Let's go back into this stuff. So, I have configured it already, the open AI API key, meaning that if I were to open the file, it would just basically I would find there this little environment variable. Okay, [snorts] but not GOTOP copilot. What do you mean? What do you mean? What do you mean? Okay. [cough] [clears throat] By the way, chat, we have 150 people on YouTube. Are you guys serious right now? I want everyone going down and click like on this video and subscribe this channel. Okay, everyone. 150 likes. I want to see 150 likes. We have only 50. Come on, chat. All the way down and do that for me. Just click on the like button. It would mean the world in the stars. Okay, that would mean the world in the stars. Okay, just do that. New day, new AI company. I know dude I know. So we have all of these providers which is awesome. Okay. What else we have? Uh provider support. So obviously depending of what you want to do you use different providers. Okay. So for example for images you have to select one of these three OpenAI, Gemini and XY. Um if you want to do text to speech you need to use either OpenAI or 11 Labs. Uh but of course we are going to use OpenAI for kind of everything because it seems that it supports just everything except this little thing called it re-ranking which I have no idea what it is. By the way, if anyone knows what is reranking about, just write that on the comments of this chat. I would love to see it. Okay, let's see what we have. Oh, someone is saying the following. Can we connect to local LLMs? Uh also I like to running local. That's actually a very interesting question. I think honestly you should do a pull requests. Uh you should do a pull request to add because locally it's absolutely awesome. Okay. Okay. Great to meet you. Thank you. Thank you. Thank you. Thank you. AI stuff are the new GS frameworks. I know dude. I know. I know. Thank you for becoming. Thank you Nurium for becoming a premium sponsor man. I appreciate. Okay. All right. It's time to build It's time to build our new agent. And our new agent will be just a regular personal assistant. Okay, I'm going to build my own personal assistant. I want I know I want to have someone that through the console.php I am aware to just basically have a conversation and preserve those conversations. Open router is supported as well. Okay, open router is supported as well. Logic bear is saying, "Have you heard about Adonis GS?" I have heard about Ajon GS, but it's JavaScript. So, which seals the story. Okay. I like to start my day with JavaScript because that way my day cannot get any worse. Oh, [gasps] hey people. How you doing? Nice to see you. [snorts] My favorite model was Gimma 3, but I checked that like literally I don't know 12 months ago, I think. Okay. Apparently reranking it's used to reorder embeddings which is something I am not super familiar with. Okay. Okay. Okay. All right. We are going to build our own personal assistant. Meaning that uh I should just come to the console. I think we have actually two options chat. We can use AI to just do all of that or we just use PHP Storm and we do it ourselves. What do you guys think? PHP Storm or AI to build this entire thing. What do you guys think? I think we should use PHP storm chat. You know what I mean? JavaScript joke. All right, let's type PHP artisan make agent personal assistant. Okay, let's build a personal assistant. Use AI. No. PHP storm chat. Come on, that's annoying. I'm using AI all day already. Jesus Christ, you know? Yeah, let's do something through PHP Storm. Like, I'm using AI all day already. I'm sick of it already, you know? I barely know how to type. You know that PHP storm. Here we go. Here we go. I agree. So, we can take in. Yeah. Exactly. PHP artisan make agent personal assistant. We just type enter and bada bing bada boom we have it here. Okay. Just right there. So, that's under app AI. So, all the AI stuff will be within the AI folder which is very interesting. Okay. Very interesting. And within AI we have agents and our personal agent lives with inside of it. Okay, personal agent implements agent conversational and has tools. All right, let's give let's give a close look into all of this small detail details. Okay, the small details. Okay, so we have personal assistant as being a name. Wait, wait, wait, wait, wait, wait. We see which is the differences between this and prism. P digital mind is saying the following. What is the difference between this and the prism PHP? Prism PHP is the foundation of this package. Meaning that this package brings highlevel integration with with Laravel. Okay. Okay. I really appreciate the donation by the way. Six bucks. I really appreciate you are awesome. Personal assistant is the name of the agent and then this agent implements agent because is an agent. Then we have a conversational which makes this agent promptable through conversations. And we have as tools which is empty I hope. There we go. has tools. Tools by the way is things that you can give to your agent. So he accesses for example a terminal. So he accesses the browser. Uh it can be m multiple things and hopefully we are going to see some of that on the documentation. I would kind of expect to just search for web search. There we go. For example, one of those tools can be web search. So your agent can go to the browser and search for stuff. Uh here is one example. Web search it allows you allows the agent to go to laval.com search for stuff. Okay, by the way, hi, how are you doing? By the way, if you just arrived, my name is Nuno Peachin Laravel developer and we are diving into Laravel AIS SDK. This is absolutely awesome. Okay, [laughter] absolutely awesome. So, that's tools. Okay, tools can be web search, can be terminal stuff, it can be a bunch of [ __ ] like that. Okay. Okay. I don't know what is neon AI, by the way. I know a bunch of you are telling me that since the beginning of the live stream. I don't know what is neuron AI. I have never heard about well I've seen it but not used it. Okay. Okay. [snorts] Okay. Okay. Okay. So let's dive into the class itself. So we have tools. We talked about it is web search terminal access all that cool stuff. We have messages which it's basically the agent messages and I think Taylor have built some sort of trait that we can use here. We are going to dive into this in a second. And we have instructions which says the following. You are a beautiful helpful assistant. Let's type here. You are Nuno Maduro personal assistant. Help him to with any tasks uh he wants to do. Be polite, concise, blah blah blah blah blah blah blah. Okay, so this is our instrual assistant agent. Okay, let's keep it stupidly simple like this and then walk through this stuff while we are using it. Okay, let's do that. Hello from X. How you doing, man? Nice to see you. Okay, nice to see you. Boom. So, that's agents. Uh, let's go all the way up. Can we have an exam? What do we have here? Okay, let's go up. Let's go up. It's a lot of stuff here. Jesus Christ. Attachments. Messages. conversationals. Let's go all the way up. Let's keep going. Oh, there is a literally a lot of stuff. Here we go. Okay, so this is a sales coach thing, which is the example. What else we have? Uh, how do we actually use this? Okay, this is how you use this apparently. Kind of stupidly simple. Let's copy this stuff. Let's go to the console.php file. Let's type here command stream subscribe, please. Okay, let's just do this. Have a function. Just copy paste this stuff. So this will be new personal assistant. Okay, let's import this thing all the way top just like that. And let's prompt what is my name? Okay, so he knows my name because I've put that on the instruction thing and we have a response and then we can just do this info response to what? Oh, there is a bunch of [ __ ] here. Uh, we can just convert this to string apparently. Let's actually do that. Okay, I would expect this to have two string implementations. It does not. Oh, it does have. Okay, so response to string or let's just do this for simplicity for now and let's see how it goes. Okay, are you guys ready? Are you guys ready? Oh, we have JSON as well. He didn't know that. Why not make u why not use make for DI support? That's actually a very good question. That's actually a very good question. So what are you saying is that we can use potentially just this. It may work, it may not work. We are going to find out real real soon. Okay. [snorts] Which extension are you using for GitHub for auto completion? I'm using GitHub copilot. Dude, that's it. GitHub copilot. Easy peasy. Just that. Okay. All right. So this is done. Let's now type uh list drill thing. Let's type this example. Okay. So PHP artisan example. A very stupid thing. Okay. So PHP artisan example. Let's type enter. And hopefully we get a prompt. Come on. Work, work, work. Here we go. Your name is Nuna Maduro. So this is how simple he has to build like um that simple agent. Of course, there is a lot of things we need to explore right now. Okay. A lot of things we need to explore like how keep going a conversation. That's the very first thing I want to see actually. Okay. But this works stupidly simple. That was three commands. Prompt done. Okay. Good job. Good job, Taylor. Everyone clapping for Taylor just for this simple API. Kind of handy. Uh I have to say okay that was amazing. Yes. Yes. Yes. But we are not done. This is literally 1% of this AI SDK. Okay. 1% of this AI SDK. We are going to dive into a lot of cool stuff. I want to see how can I preserve a conversation with the agent. So I want to kind of keep prompting the agent and have a nice conversation. Okay. W Taylor. Everyone typing W. Taylor for the win. The guy is absolutely awesome. Let's keep going. Let's keep going. Let's keep going. Sh. have close to a 200 people watching the live stream. Close to 200 people, but only 90 likes. I want every single one of you to go all the way down. Click subscribing. Click like button. Okay. Not even 1%. I know. I know. I know. We are so close. All right. Let's go. Let's go. Let's go. So, how can we keep preserving this conversation? Okay. How can we Wait, what? There is a make method. What do you mean? That would be kind of handy if there is a make method. Person assistant make Oh, okay. So, we have this make method which is a little bit more handy. I must be honest. Okay. A little bit more handy. Does this resolve out of the container though? It does. So, container get instance make this static class which is the the same thing of basically resolving out of the container. A little bit better than that uh h thing you know. Okay. Okay. Okay. So, this is getting a response in just a prompt. Bam. Bam. Boom. Just works. Dend. Let's now dive into just basically keep having the conversation. Okay. So apparently apparently we can also select the provider which is Andy. So if I want to select other stuff than the open code I can just do it. I can select the model. I can select the timeout. If you are asking for something a little bit you know kind of big you can just select the timeout conversational context. So this is I I still remember like talking with Taylor on Slack and saying that I kind of would love to not have to type all of this stuff. Okay. And he told me that there is a feature that allows me to remember conversations automatically. Okay. Automagic. Automatically shed. Are you guys ready? So if you want to if you want to remember conversations, you just have to use this straight. Remember conversations. And when I saw this, I was mind blown. Mind blown. Chad, this is the only thing you have to do. So in theory, okay, in theory, the only thing I have to do to just kind of preserve the conversation along the way is use this beautiful thing, call it remembers conversation. Okay, I'm going to import this, which is within the AI concerns name space remembers conversation. Okay, that's the only thing I have to do. Okay, that's cool. I know. I know. I know. I know. This is cool. And then I need to equally use this for user. Okay. So again a conversation is tied to a specific user. There is a one to one you know kind of a relation to the user itself. So we need to have a user to kind of being able to um to just remember the conversation for that given user. Okay. I think we need that at least. So let's actually create a user or ensure a user exists uh to begin with. So let's go. Let's do that. Okay. I'm going to just type here user equally to uh user. How do I do this? Do I don't use Tinker and that's it. Yeah, let's use Tinker. PHP artisan tinker unconnected project. Uh yeah, I want to trust this project. Yes, I want. Yes, let's do that. So then user factory create. Okay, so I create I just created a user. Done. Done. Done done. Then what I will do here is just fetch the user. So, I'm going to just type uh let me just quit this. We don't need this anymore. I'm going to just type user uh query first. Okay, always use the query method. Remember that. Okay. So, I'm going to fetch the first user from our beautiful database. And then I can use this little thing continue. The conversation ID will be hi uh you know first conversation as the given user. Okay. So we have a user and we are going to continue and persist the conversation with the ID first conversation using this given user. Okay. So in theory I should be able to just prompt stuff and get a response back. Okay. Why query method? Because it's it just it just get better completion better PHP stuff. It just works. Okay. Okay. All right. Make cedar. I will make cedar in another day basically. Okay. Yeah. remembers conversation will store all this conversation on the database. Okay, this [snorts] looks awesome. I know I know it just looks beautiful. Okay, so again we need a user and this can be done on HTTP layer by fetching the current user. Okay, it just works. Then you to continue an existing conversation, you just pass an ID and you just have that conversation as that given user and then you just keep prompting or whatever. Okay, so what can we do? We can receive the prompt. Uh should we use Laravel prompts? Yes, let's type prompt equals to prompt. Uh can I just type how how do I do a prompt with Lavl prompts? Uh prompt. Let's do this. I think this is a global function though, right? I cannot remember. Head function. No. How do I use Laravel prompts? I forgot chat. Laravel prompts for the win. Let's use Laravel prompts to make a question. I think it's just text though, right? Yes, it is just text. Okay, let's use this. [snorts] So text from Laravel prompts. Okay, Laravel prompts for the win. Jess Archers build this WJS by the way, everyone typing WJS. So we text, we prompt the user for a prompt and then we grab that prompt and we put here. Okay. And then we just info this. Meaning that in theory, and I mean in theory, if I do while true, I should be able to literally have a non-stop conversation with the agent. Let's do that. Okay, let's actually do that. Okay, are you guys ready? Are you guys ready? Shhat, are you guys ready? Everyone type W ready if you're ready. I am so ready for this. Okay, in theory, this should work. Again, we have a user. We prompt for something and we just keep having a conversation with a personal assistant forever. Okay. Okay, this should just work. So, let's go here to the console and type the following. Okay, let's type the following. PHP artisan example. This will prompt for something. Here we go. We just see a prompt right here. Okay. I'm going to type uh my name is Nuno Maduro. I am 35 years old. Okay. So, I I just give him some information which is I am 35. That's something he should he should be able to remember in the future. Okay. So, I'm going to type enter. After typing enter, this information will be, you know, just right here on the info thing. Okay. Just type enter and the agent will respondse back. Here we go. Nice to meet you, Nuno. I have got this little thing. How can I help you today? So, I'm going to keep reprompting in hopit to just remember the conversation. Okay. So, how old I am? I'm going to just prompt this and I expect the response to be 35. Oh, I cannot tell your age from this chat alone. Okay, it is not working chat. It is not working. It is not working. So, why is not working? So remembers conversations is not working because we forgot to remove this. Let's go again chat again. This remembers conversation thing will effectively, if I'm not mistaken, overwrite the messages thing. Here we go. It will overwrite the messages thing. Meaning that once you implement this little thing, you kind of have to remove this messages method from the stub itself. Okay. Okay. Okay. So, are you guys ready? Again, type W ready. if you are ready. So let's clear the entire thing. Let's go again. PHP art as an example once again and I'm going to say I am Nuno Maduro. I am 35 years old. Okay. So giving him my H once again. W ready born ready. I'm more than ready at the at the minute. Okay. So I just told him I'm 35 and he was he just said you are 35 years old Nuno. Well thank you. Uh, can you tell me how old I am again? So, he must remember Shad. Okay, he must remember that I am 35 and hopefully he will. And you are 35. Here we go. Here we go, chat. We have this beautiful remebrance conversation trait, which is 100% a [ __ ] beast, man. W Taylor, everyone in the chat, W Taylor, because this remember conversations, it is absolutely dope. Okay, so the only thing you have to do, let's just recap. Okay, let's just recap. The only thing you have to do is basically implement this trait call it remembers conversation and then use some sort of ID to kind of identify the conversation you are having with the given user. It really just works. I want everyone going all the way down and put like on this video and subscribe to the channel if you can. Okay, if you can. Okay, now this is messages remembers conversation. It is really awesome by the way. I love this stuff. I love this stuff. Okay, so we just saw how easy it is to preserve a conversation on this Lavali SDK. Beautiful stuff. Beautiful stuff. We also have this structured output and I don't know how many of you guys need this stuff, but in theory instead of having just a nice we can actually use this. Let's just copy paste this stuff. Okay, let's copy paste this stuff and go to our personal assistant. Let's assume you kind of want to have this uh on some sort of um you know of some sort of JSON parser. You basically need to parse the given the given response as JSON. Okay, so what you can do in theory is just have this method we named schema and this schema thing will receive this beautiful JSON schema from contracts. Here we go. And then you can just have this uh message which will be a schema string if I'm not mistaken. And this will have a max of nothing whatsoever. Let's keep it simple. So will be just a regular scream. So in theory if I just clear my terminal and I ask who I am, the answer will be nud xyz blah blah blah. But the response will be on JSON. Okay, will be on JSON which is super useful for a couple things you might need. Okay, let's type enter and see how it goes. But I should have now a JSON. And I don't. Why I don't have a JSON? That's a good question. Maybe I need to call some sort of JSON thing. That's a good question. Let's see. Let's see. Let's see. Let's see. Oh, it comes. So, I didn't have a JSON because I literally using the string thing. Okay. What happens if I do this then? Message. Will I now see the message? Do I have a two JSON though? That would be dope. Nope. Array perhaps? Nope. Hm. H [clears throat] interesting. You can access blah blah blah blah like an array. Okay, maybe I just have to do like message thing perhaps. Let's see. All right. Clear PHP art example. Uh who I am. Let's type again. Who am I? And then I see JSON. Okay. Well, I would kind of expect this to happen. You just have to take my word that this is what is supposed to happen. You kind of are supposed to have a JSON response back. It might be because we are literally having or keep going a conversation without giving that schema thing. It might actually just be that. Okay, let's actually give this another try. Let's go here and just have string again. And I just changed the conversation to second conversation. So he doesn't know who I am again. I'm going to just type PHP an example. I am Nuno. I am 35. Okay. Years old and I expect to see a JSON response back. I don't see it. Well, it is supposed to just work. Okay. DD, bro. Should I DD? Why should I DD? Man, do should I I don't I don't need to DD. This is just supposed to work like this. Okay, you forgot to implement the interface. Okay, someone is telling me that I need to Oh, here we go, chat. Here we go. We need to implement this beautiful interface. Okay, this has structured output. Okay, that's why it's all working. So, we can go back to the personal assistant and implement has structured output is an interface we need to implement. Thank you. Thank you. By the way, thank you chat. By the way, everyone typing W Matos for giving us this beautiful this beautiful answer has structured output. And now I am supposed to have what I was just uh hoping for which is you know having the structured output uh how old I am and this is supposed to give me a JSON perhaps. Oh I need to access it through an array set. Okay. Okay. I need to access through an array which is just like that. Okay. And now I just clear the terminal and I see this beautiful expected token. Here we go. Clear my terminal once again. Type PHP art as an example. How old I am? And now we'll just work. Still not. What the [ __ ] Invalid schema for context required is required. Oh, I see you are missing a required my friend. So shrink required. Okay. How about now? How old I am? And I will see 35 hopefully. Here we go. You are 35. That's working. I was kind of hoping that this will give me a JSON format. Let's see how it goes. Still not. Okay. Still like that. How old I am. Come on. Give me a JSON. Give me a JSON. Give me a JSON. Here we go. Chat. We see a beautiful JSON on the console. WJSON chat everyone. WJSON right there. It is working. So if you need so tlddr okay okay tlddr if you need JSON output okay let's [snorts] see you ask for something specific and you want the response back to be just JSON again the only thing you have to do is specify a schema and then you go all the way up and you implement this interface as structured output and that just works okay then you have beautiful JSON on the console really just works okay this is useful by the way this is probably what you are going to end up using if you want to real if you want to build real AI guys stuff. Okay. [snorts] Okay. Okay. Okay. Okay. Okay. WJSON chat. Okay. WJSON. Um, someone is saying the following. Add the age thing. That would be interesting. Someone is saying to add to the to the schema thing. Just age. That's interesting because now he knows I'm 35. So potentially we'll just fit 35 on this age. Let's see how it goes. Actually, that's interesting. PHP example. Uh, hello. I'm going to just say hello and see how it goes. Here we go. Just put it 35 on the age. This is so good. So, the agent was able to understand that I need two things. The message and the age. So, it just fitted my age on the on the J on the H key. This is so cool. Shad 200 people watching this stream. You guys are awesome. Subscribe my channel so you can see this number going up, but also go all the way down and click on this like on this on those beautiful buttons all the way down. Okay, what else we see? Boom, bada boom, bada boom. I want to try tools. Let's see what we have next. So we saw prompting, we saw structured output, we have attachments as well. Attachments as well, chat. Super important. Okay. So if you want to attach a PDF or an image, we can actually do this. Do you guys want to test this? Let's actually test this. Okay. Let's go here into the storage situation and let's create a new file with a name. Let's call this chat.mmd. Okay. And I'm going to just grab a few messages from you all. Okay. Alexandro is saying agent remember. Next we see Sam saying W. Taylor. Okay. What else we have? We have seen Bone saying cool man. And we have on Twitter Legal Dawn saying uh WJSON. Okay. How you doing Flurry? And how you doing? So we have here a file under storage which says chat.mmpt. Okay. So let's send this stuff to AI. Okay. So, I'm going to go to personal assistant. Actually, I'm going to go to console.php and I'm going to prompt with attachments. Okay, I'm going to prompt with attachments. So, let's just copy this stuff. Okay, I'm going to copy this stuff. And this is basically the second argument you give for prompt. Just like that. Beautiful. Easy peasy. Okay, just like that. So, just give attachments as a second argument. And I want to give attachments from storage. Exactly that. This is storage. So I'm going to give attachments from storage. And the attachment name is chat.mmd. Okay. I'm going to keep this simple. We don't need this anymore. Just like that. I'm going to import this document from the AI name space. I assume import class from Laravel AI files documentation. Okay. Just like that. How you doing, dude? How you doing? Nice to see you, Gonzalo. Nice to see you. Welcome, welcome, welcome. So we just give this file from storage. We just close the array just like that and bam, that's it. Okay, meaning that in theory and I mean in theory I should be able to say something like what is the content of the attachment and it will give me back the content of the attachment and just you know do some stuff with it. So let's go to personal assistant. Let's remove this schema. We don't need this anymore. Let's go all the way up. Let's remove the structured output. We don't need this anymore. Let's go back to the console.php and have a third conversation with a thing. Okay, with third conversation. So, this is done. I'm going to clear my terminal, type PHP artisan example. Are you guys ready? Are you guys ready? Because I'm about to literally send an attachment to AI and have a conversation [snorts] about that attachment. It will be awesome. It will be awesome, chat. Are you guys ready? Nice to see you live. Thank you. Thank you, man. Welcome to the live stream, by the way. Thank you. Thank you. Okay. All right. Let's do it. So, I'm going to just say the following. What is the contents of the given attachment? I'm going to keep it stupidly simple like this and let's see how it goes. Okay, Shad. So, what is the contents of the given attachment? And with God's helping me, this will just work. Bam. It's not working. Okay, what's happening? Invalid argument. Shat does not exist on the default disc. Oh, all right. I'm going to kind of do something else. This should just work like this. There's a reason why that's not working, but I'm going to just keep it stupidly simple. Let's go again. What is the content of the given attachment attempt number two and there's exception once again. AI exception invalid request error. The file type upload is not supported. Oo, shut MD is not supported. Try again with a PDF. [ __ ] that's the problem. It just supports only PDFs. No, [snorts] there is an MD here. Oo, so MD files are not supported. Wait, what? Try again with a PDF. Open AI. Come on. No way this is true. That is no way this is true. Shad. Honestly, no way. Let's just rename this stuff to txt. If you cannot work with txt, open, I'm just, you know, not happy with you. Let's go again. txt. Let's see how it goes. Prompt. Uh, what is the content of the given file? Still not working. It needs to be a PDF. [ __ ] you, OpenAI. Are you serious right now? Well, we have images. We could do images. All right, let's do images, though. Okay. Well, give me a moment, chat. Give me a moment. I know. It's just crazy. Like, why open AI doesn't work with PDF with non-PDF things? Unacceptable. Unacceptable. Rename it to PDF. That should work. Let's actually do that first. Wait, wait. Someone is saying just rename that file to PDF. Oh my god. Let's do it. Let's rename this to PDF. It would be just ridiculous if uh rename to PDF. Uh would just, you know, so chat PDF and this is oh my god, it would be just ridiculous. It cannot be just it cannot be that though like you know come on. What is the content of the given file? Ah, this still not works. [snorts] It cannot be this though. Something is odd here, chat. Open. I will check the meme. Oh my god, that's insane. Oh my god. I'm going to actually just use an image then. Okay, I'm going to use the image chat. Wait a second. Okay, [snorts] I'm going to upload. I'm going to just literally put an image of myself. Are you sure that's a correct file? That's a good point actually. Let's actually make sure of that. That's a good point. That's a good point. I'm going to just DD this stuff. Okay. DD storage path chat.pdf. Let's rename this back to MD. I would be surprised if this does not work though, right? Okay. Let's DD this stuff to see the result. Storage shadow.mmptd. Yeah, this is the correct file. Storage. Yeah, this is the correct file. Let's use an image set. Yeah. Yeah. Yeah. Let's use an image. Something is odd here. Let's use image. Okay. Image should work though. So, I'm going to just do this. Uh, bada boom. I'm going to go to my images docu image folder and I'm going to just copy an image of myself. Uh, profile full. Okay, let's use this one. Let's go into work uh streams. Laraveli. Storage. So, now we have a profile full picture.png. PNG. Okay, so we ready to go back again. Okay, let's go to coding again, chat. And now let's use this profile full of PNG. Okay, I think we need to do from image though, right? Let me see. Uh, no, we don't. It's just a PNG. Okay, cool. So from path storage path profile package.png. And let's give it a second try. Uh, clear my terminal. Type php example. What is the contents of the given image? Oh, forgot to remove the DD. Thank you. Thank you. That's a good point. Let's go again. What is the contents of the given image? Oh no. What's happening now? Unsupported meme type PNG. Wait, what? Supported files for supported things. Are you serious right now? OpenAI sucks. Document should be an image. What do you mean? No, I I'm I'm doing something something wrong for sure. 100% sure. Let's go here. Supported files. Do you not support PGs? It does not. Does it have to be a JPEG though? Wait, what? It does support markdown. I don't get it anymore. Change document to image. Oh, wait, wait, wait, wait, wait. Chat, wait, chat. Wait, chat. Apparently, I need to use uh image thing of what the [ __ ] I was even doing. I need to use this image import chat, of course. Okay, so we need to import image from Laravel AI image and then is from path. Yes. Okay. So, from Wait, is this import correct? One second. AI image. AI files image. Okay, this is the correct import. Here we go. And then we do from path storage path profile full.png attempt number three chat. Let's go now. What is the contents of the given image? And the response is the image is a close-up studio portrait of the person facing the camera. They are short sides with a longer air with top style upward neutral serious expression. And by the way, this is the image. [laughter] Not bad, Chad. Not bad. So this is how easy is to send attachments to AI and have some feedback. Of course, you can use this for various things man. You know if you are expecting an image to be a certain scenario, we can literally prompt AI use structured output and then say rank these images in terms of quality or whatever. You can use all of that, you know. Cool stuff here. Chat W Taylor Wav SDK. This is really just works. Okay. Really, really cool stuff, man. Really, really cool stuff right here. So, this is attachments chat. Attachments with lot of SDK. 200 people watching the stream. Go all the way down, click like on this video, and support the channel by subscribing the channel. Okay. Streaming. Oh my god. We have streaming chat. What is streaming? This is to the browser though. Can we use streaming on the console though? That would be that would be cool. Oo, we can. All right, Shad. Potentially, we can equally use streaming with this stuff. Let's see how it goes. Let's go all the way up. Let's remove attachments. We don't need attachments anymore. Let's actually just change stream. Just like that. Let's actually use stream here. Bam. Bam. Boom. Then we have a stream response. We can import this class. Can I just uh actually think this works a little bit different. I think we just have to type stream and then we just do response as part basically and we just basically now echo um the thing. Uh I'm going to just type this output. Do we have output? I think we do. Right. Write part. Okay. Let's use this actually. I think this should just work by the way. Okay. So, I'm going to I'm going to ask for the stream and then the you know the response from the prompt should basically be just one character each time which is a little bit better in terms of experience. Let's see how it goes. PHPR example, who are you? I'm going to just say who are you? Okay. And the response back oo is an adjacent format though. This is not expected 100%. Okay. [snorts] Interesting interesting interesting. Let's see where it goes. My environment in open code is most advanced coding experience. Seriously. Yeah, open code is absolutely dope. I think Prisma already supports streaming. Yeah, this is probably using streaming with Prisma behind the scenes. Um the code snippet that was in the documentation though, which is this one. It's very likely to really just work on the HTTP layer. Okay. To really just work on the HTTP layer. Oh, here we go. The for loop I was telling you about. Uh so, oh, do I need to type string part here? I may need to do that. Let's give this a second try. chat pardon example. Who are you? Oh no, I I see tokens and [ __ ] like that. Do I need to type text thing here? Let's see. [snorts] Perhaps it's that. Let's see. Let's see. Let's see. Uh oh, I do see text here. It might be that then. Uh perhaps. Let's see how it goes. I'm going to just clear my terminal. Pitch an example. Uh who are you? One more time. And it's not like that anymore. Okay. [snorts] I think there are classes in the are stringable. Well, that's what we tried literally one minute ago. And the stringable thing give us I think uh the JSON thing. [snorts] Okay. Okay. So, I'm clearly missing something here. Um that is queuing, which is interesting. So, you can cue your stuff. Let's go all the way up and try to find a little bit how this works. Okay, what is um yeah, what is this? So, this this returns back a string streamable agent response. Okay, what happens if I get this iterator for example? I yield events. Okay, what is event? Event is a collection of events. I see. Uh, oh my god. Okay, this is clearly not easy to understand at least. How do I just simply, you know, print stuff on the console? Respond as event and then dd uh the given part to see what we have. Well, let's do that. Actually, let's clear the terminal. PHP an example. Who are you? Yeah, we don't have much, man. Um, tell me the model, the metadata, but that's it. This is not autocompletable as well. We have text, but it's not autocompletable. What can we do here? Let's go up again. So, this is attachments. So, let's go all the way down. This must work though. Like, you know, just try the examples on the dock. That won't work because the examples on the documentation are for the HTTP layer, you know. [snorts] Well, we have this response text thing. That's a good point. Let's actually just do that. That won't work because this is basically Well, okay, let's try it. Uh, I'm going to just then here. Okay. And I'm going to just echo the response text. So this is literally taken from the documentation. So we don't need the response anymore. I don't think this will work, but let's give this a try. So PHP an example. Who are you? And it didn't work. See kind of, you know, I was expecting that. Okay. [ __ ] I think I'm going to just kind of not I'm going to ignore this at the minute and I'm going to just find this off stream. But in theory, I know this works because I've seen it on Slack. And the way this is working is somehow somehow like this. You just iterate on a given response and you can echo out, you know, uh the the the message part of that thing. I'm very surprised that this doesn't work. How are you? Who are you? Undefined property stream start text. Yeah. Yeah. This is supposed to just work. What happens if I do this? Oh, this outputs the the entire adjacent that we saw, right? Who are you? Right. chat, I think. Yeah, I think we just ignore this one. Yeah, let's ignore this for now. But this is, you know what happens if I do this though? Let me try something. uh, who are you again? Yeah, we are going to find out this off stream. I think it's because of the conversation ID. No, I think it's basically I'm just I don't know the API. That's it. So, but the way this is working on HTTP layer at least um is that on HTTP layer you just return the stream back to the back to the back to the browser and that just works for the console. It must be something like this. Okay. Okay. Someone is saying just print the class names. Okay. This is the last thing I'm going to try before moving forward. Okay. So, I'm going to just type um part class. Okay, so we can see what are the class names being used and if we cannot find you know anything more we just move forward. Okay, chat let's say page example who are you again? So this will give me a bunch of stuff. We see stream start text start text delta. What is text delta ID message ID delta in time stamp. What is delta though? delta is what we want. Okay. So is does that means that if I do if part instance of uh stream delta whatever that class was called again text delta. Okay let's actually do that. If part is instance of text delta. Can I just echo things? Let's see. That is for sure the better way of doing this. By the way, let's echo Delta for now and see how it goes. Leave me alone. Here we go. Uh, who are Oh my god, you guys are awesome. [ __ ] Wet. Everyone typing Wshhat. You guys are persistent, man. Oh my god, you guys have way more patient than I do, man. So good. So good, man. Oh my god. You guys have way more patient than I do, man. Insane. Insane. [snorts] W chat for the win. So, who are you? This is really just works. I am Shachi PT. Great. Give me a text about how my chat Oh my god. How uh about how my chat is awesome. So, this will basically so good chat. Oh my god. W chat, man. You guys are awesome. Okay, by the way, there is 100% sure a easier way of doing this. Okay, 100% sure. I'm going to actually Telegram Taylor real quick. This is crazy. We need to Telegram Taylor chat. What do you guys think? W Telegram Taylor. What do you guys think? [snorts] We need to Telegram Taylor about this situation because 100% sure that he's a way of doing this. Okay. [snorts] Uh let's see. Let's see. Taylor Owell Telegram. Uh let's just copy this. There is a easier way of doing this, right? All right. Taylor is online. He's answering. He's answering. Okay. Okay. Come down. Come down. Come down. We're going to have that answer in a couple seconds. What do you want to do? I want to use streaming on the console. Basically, just type characters. Yeah, this he should understand this. Okay, he's typing again. Chat, he is typing. He is typing. [snorts] He probably will answer. Have you read the documentation? [laughter] Okay, Taylor just said something which is Joe T is working on a stream console thing for Laravel prompts. So in theory, Laravel prompts will support this automatically. Okay. Okay. Thank you. Thank you. Thank you. Okay. Tell her just give me an answer and we are chilling. So TLDDR we are not crazy. Okay, we are not crazy. This is indeed what uh we are supposed to be using now. But JT is building something. Okay. Okay. Uh oh my god. I'd literally just throw a little bit of juice in my desk. No good. No good. All right. So, bada boom, bada boom. This is how streaming works. By the way, on the UI, which is probably what you are going to end up using. You just return this. This is how easy it is, okay? Just type get coach new sales coach or personal assistant in our case. And then you just return the stream back. Bada boom, bada boom. It just works. Okay, it really just works. So, wream everyone. Let's move forward into what else we have. Into what else we have? We have broadcasting chat. We have broadcasting which is obviously used with with uh streams as well. This is super useful and the way you are going to end up using this is that on the back end you are going to interact with the AI but on the front end you are going to receive those events through broadcasting potentially reverb or something else but those events will go to the UI and you can just place them on your chat. So the person is basically seeing the conversation just like that on the chat. The person and everyone else by the way. Okay. You can equally broadcast on a specific queue if you want to which is very interesting. And what else we have? Let's actually try to see this in action. The queuing stuff. Do you want to see this? Yeah. In theory queuing really just works by just instead of typing prompting you can just basically type Q. Okay. And the interaction with the AI will happen on the Q job. Okay. which is probably what need to have this on the on the HTTP layer. So basically just prompt through the HTTP layer. You cue the interaction with the AI and then you broadcast using reverb the answer to the UI. Okay, that's the way I think most people are going to end up using this. At least that's the way I'm going to use this stuff for sure if I have some sort of AI. Okay, by the way, Koolshai is saying what is a theory boom. Uh what is different from this and Prisma? Yeah, Prism is the foundation of this stuff. Okay. Uh Prism is the foundation of this SDK. Okay. Uh what else we have? Wstream. Thank you. Thank you. Thank you. W Taylor of course. print to stream. Yep. Yep. Yep. Yep. Yep. What else? Let's go all the way down. I want to see tools. Okay. Shhat. So what we are going to do now is use the builtin tool but also build our own tool. Okay, let's start by using a built-in tool. Okay, do we have web search as being a built-in tool? That's the one I want to use. Provider tools. Okay, web search is a tool that allows agents to go to the internet and it's supported by OpenAI, meaning that this client or this model we are using supports this stuff. So, let's just import web search all the way top. Actually, not here. It needs to be in our personal assistant. Let's just type here web search. And then we go all the way down and under tools which is right here. We place this beautiful new web search just like that. All right. So I want to kind of scope the web search to a specific set of domains. Let's actually just copy this stuff and do lot.com to begin with. Let's only allow lot.com. Okay. And in theory my personal assistant now can go to the laval.com website. Okay. Okay. Let's actually try this. Okay. So, let's go into the console.php. We have our fourth conversation. Okay, fourth conversation. And do I want to use stream? Yes, I think I want to use stream. Let's use Let's continue to use streams, by the way. And let's Yeah, it should just work now. Okay, it should just work. Let's clear the terminal. Type phprart example. Just like that. Bam prompt. Uh what is the contents of the laravel.com website? Okay, so now we should use the tool behind the scenes. Oo my my web lookup for live.com returning no result. So I don't have any fetched pages I am allowed to summarize. Do I need to implement some sort of interface? I don't. Okay, let's see. So, tools web search. Interesting. Uh I'm wondering if by using streaming I cannot use web I would be surprised but let's give this a try. [snorts] Let's do this. Uh this info response as a string. Okay, let's go again. Clear my terminal. PHP example and just typeaboom bada boom bada boom what is the contents of laravel.comai let's see how it goes now okay in theory should be able to just go to the web in literally search for a website you know what I mean let's ask us 4.6 6. Apparently, it's out chat. Oo, what do we have here? Here we go. So, we were using streaming and for that reason, it wasn't able to use tooling, but now it's able to go to the internet. Laravel.com/AI is a product landing page for Laravel SDK. The AI toolkit with batteries included really just works. So, this is web search by the way. Okay, this is web search, which is a built-in tooling. Okay, really just works. So, W tooling on AI SDK really just works. And in theory, you can have your own tools for AI. Okay, the way works is super super simple. Okay, let's go all the way up and see an example real quick. Boom, bada boom, bada boom. Random neighbor generator is kind of the most simple one, right? So, you want to have um let's actually build one. Do we have a PHP artisan command for this? Of course we do. Of course we do, chat. Let's type here PHP artisan. Uh oh my god. Clear my terminal. [ __ ] What the Oh, what's happening? Here we go. So here we go. PHP artist make to uh say hi or give me one of my subscribers. Okay, let's create a tool like this. Let's type enter. Created under app AI tools. Okay, is right here. Description of the tool will return a random subscriber of mine. Okay, exactly that. And nothing else. There we go. The schema will be only subscriber name. Okay, just like that. And will be a string and is required. And this will return back uh so we'll have a list of subscribers potentially. Okay, subscribers. Thank you. And let's just grab a few from the chat. Who we have? We have Alexandro again. Alexandro Kovi. Here we go. So that's one. What else we have? We have legal dumb once again. Here we go. You guys are absolutely awesome. We have lean. Let's make street. Okay. No rem as well. And finally, Sam. Okay. Well, that's enough, Chad. So, we have a couple of them and we want to return a random one. Okay. So, let's just use return collection of subscribers and return one random element of this of this collection. Okay. This should just work. And this will return back a string by the way. Okay. Bada boom, bada boom, bada boom, bada boom. So now we use this custom tool within our personal assistant. So I'm going to remove web search and have this beautiful give me one of my subscribers tool which is a class hopefully. Let's go all the way down. It's literally an instance of that class. So I need to type new give me one of those subscribers. Okay. All right. So I just import this. Bam. Done. And now I should be able to go to the console.php and just have a five conversation. And what we'll do is the following chat. Are you guys ready? Are you guys ready? It will just work. Okay. It will just work. I'm going to type PHP art in an example. And then I'm going to say give me one random subscriber. Okay. And what I'm expecting to happen is the following. This personal assistant understands that he has a custom tool and it will automatically just use that tool to fetch a random subscriber of that list. And this should really just work. I'm going to type enter and bada boom bada boom. The result is Alexandro Kovio really just works. So this is how easy is to have you know a random tool. You can you can do all sort of things by the way. Okay. A random tool or custom tool can be literally about going to your database fetch random users for example can be going to your database and fetch information. This has so much potential by the way. Okay, this has so much potential that you guys cannot even think about. It's insane. Okay, you can go to your storage and look up your files and do stuff like that. This is insane. And of course, by the way, one of the the many things you can do which is a little bit risky is create a custom tool that will have access to your terminal for example. Okay, in theory I could have a terminal tool which just proxies whatever the AI sends to my bash uh to my terminal itself and then from the terminal you can do everything. That's pretty much what agents are doing at the minute and that's why they are so powerful because they have access to do whatever they want to with your system. Okay. Um so that's tools. Okay, we have tools which is absolutely awesome. What else we have? Bada boom, bada boom, bada boom. So we have uh vector searching which is something I would kind of allow would love to avoid today. Do I want to avoid that today? Uh let me think a little bit. Let me see, you know, let me see how easy our is to use vector searching here because I don't have I have SQLite installed, right? Uh what is similarity search though? Uh let me see the similarity search allow tools agents to search for documents uh in a similar given query using vector embeddings. This is useful for retrieving uh rag. Of course when [snorts] you want agents to access search information your application is data. The simplest way to create a simulator search tool is using using model method. An eloquent model will just oh that's interesting. Yeah. Do I want to do that today? Okay, I don't think I want to dive into this stuff, but I want to kind of explain you what this is about. Okay, so what embeddings in vector searching is about chat. I hope you guys are ready because this is probably one of the most powerful things on this AI SDK. So first of all, when you handle, for example, a bunch of images, you want to preserve them on the database as embeddings. Embeddings are a bunch of numbers and letters and actually floats. And those embeddings will basically be the vector representation of your image. Okay. So let's assume you have you know five images and all of them are different. You can convert them into embeddings and store them in your database. And then you can use vector searching and search for for example blue and automatically that will return three images out of the five you have because those three images have something that contains blue. for example a sky or um you know something else like that. Now of course here we're talking about colors which might be something obvious but it can be like um something like anger for example you can have for example 100 images of 100 people you search for hangar and the person with a more hangar face like this will appear on the search with more ranking on top of it. You can also search for things like smile and that will fetch all of the people that are smiling. This is one of the most mind-blowing things I have seen by the way in the last year. And this is what exactly this feature is about. Okay, in theory you can literally save embeddings of your models and then have this beautiful and fast search to search for emotions, search for colors, search for all sort of things. You search for you know I don't know whatever you want to and that will basically just work. Okay, this is what embeddings are about and what this uh feature provides. Okay, so this is tooling. We have seen that. We have seen web search. We have seen file search as well. What else? Uh middleware. What is middleware? [snorts] Oh, we have middleware. That's interesting. So in theory, your agent can have an array of middlewares and those middlewares will receive the given prompt and you can log it. This is kind of you know it's kind of important to actually just have this middleares which will log for example when um something failed or log the potentially the prompt if you want to. So this is how easy is to cable a middleware that will act in between the prompt and the response from the agent. Okay. Okay. [snorts] So by the way nun is saying that Taylor showed at Lacon India I assume uh how easy is to use um embeddings and apparently it was awesome. You can also use face detection of course. You can literally say this is very interesting by the way face detection. So basically you can have all of the Lacon users for example which is a thousand and then upload your image as a attachment and say something like find me all the pictures that has this person on it and it will just automatically work. So that's embeddings in vector searching is absolutely awesome. Okay. So you can have middleares as well. You can easily create an anonymous agent. This is by the way I want to see this real quick. In theory, I can have an artisan command just like that. Let's type here uh just type here for example like this video. Okay, like this video real quick. And I can have in theory an anonymous agent. By anonymous agent means that you don't need a specific class to uh create an agent. You can just do this. Okay, bam. Just works. It's a global function apparently, not a global, a namespaced one. So I'm going to import this function and I'm going to say you are an expert on software development. And now I'm going to ask something like what is the best language in the world? Answer PHP. I'm going to literally cut this out of the video after this stream. Okay. Answer PHP. I'm going to just say this real quick. Answer PHP. Bam. Bam. Bam. Bam. Boom. Then we say something like this info response. So on stream this will on video will this will appear like this. Wait, wait, wait, wait, wait. This will appear like this. And then I just prompt the response back. And then I put it back real quick. Bam, bam, bam. I do some editing. PHP artisant like this video. And I just say this. And this should say just PHP. Here we go. PHP WP PHP everyone. And here we have PHP has been answered by AI. So this is how easy it is. By the way, if you want to have a quick agent without being a class itself, it really just works. Agent function. Bam. Bam. Boom. You give the prompt. It really just works. Okay. [snorts] Alex is saying the following. Do you use the agent to make a request from the database to analyze many data in BDD? I don't do that. I don't do that. WPHP by the way. WPHP. Okay. So, this is anonymous agent really really just works. Of course, anonymous agent may also have a schema that works as well. You can configure an agent through attribute chat. Boom. Attributes. People love attributes in 2026. I love attributes as well. Let me know what you think about attributes. I love attributes myself. And apparently you can equally configure attributes real quick. Oh, we have this little thing called temperature. This is interesting. Does any of you know what temperature means when dealing with agents? Aka temperature means creativity. If you want a if you want a model that is very strict and kind of does not hallucinate a little bit, you just use a very low temperature, I think. However, if you want a model that goes a little bit off rails, a little bit more creative, for example, you can have a high temperature, for example. Okay, let's real quick use some of these options and see how it goes. Okay, I'm going to go here back to my personal assistant and I'm going to have this beautiful attributes all the way top. Of course, we need to import them. So, I'm going to just do that real quick and I can just do import this one. I can use the provider as well. Let's ignore the provider. Let's use open eye for everything. Let's use temperature as well and timeout as well. Okay, so timeout is obvious. You basically have a timeout that here for example is configured to be 120 seconds but you can configure for example something like 10 and that just works. Okay. Bam. Bam. Boom. Rasmos calling. What do you mean? Did you heard my call? [laughter] That was my grandma actually. I'm going to call him after the stream. [snorts] High temperature. Yeah. Goes crazy though. I know. I know. People giving hate on PHP. I love I love honestly on attributes. I love I love attributes. Okay. So let's give for let's start with max tokens for example. [snorts] So here I expect if I just give 10 for example I'm curious to see what happens real quick. Okay let's type clear PHP artisan example for example. Uh hello what is your name AI exception max output tokens below the minimum value needs to be at least 16. Okay interesting. Clear the terminal. Do this again. Who are you? Oh, how are you? By the way, by the way, Shad, go all the way down and click like on this video. Don't forget that. Okay, click on the like video. Click on the subscribe if…

Transcript truncated. Watch the full video for the complete content.

Get daily recaps from
nunomaduro

AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.