Laravel & AI

Watch and track your favorite playlist.

Curated by: Laravel News (16 videos)


Currently Playing: Persistent Chat History with the Laravel AI SDK - Ship AI with Laravel EP4

Episode 4 of Ship AI with Laravel, a series on Laravel News where we build a full AI platform using Laravel 13 and the Laravel AI SDK. Our agent can look up orders and pull customer history, but every message is a blank slate. Ask about order 1042, get a perfect answer. Follow up with "can I return it?" and the agent has no idea what you're talking about. It forgot everything. In this episode we add conversation memory. The SDK has a Conversational interface and a RemembersConversations trait that handles storing and loading chat history through the database tables we set up in Episode 1. We show three patterns: starting a new conversation tied to a user, continuing an existing conversation by passing the conversation ID, and resuming the last session automatically. Then we build a ChatController with a send endpoint that creates or continues conversations based on an optional conversation ID. We also cover the messages method if you want full control over how history is stored and loaded. By the end, the agent remembers the entire conversation and follow-up questions work exactly how you'd expect. ⭐ GitHub: https://github.com/harris21/ship-ai-with-laravel 👉 Full series playlist: https://www.youtube.com/playlist?list=PLsmlCYEtWNI_plnKPPO13XjfDJoMIfhLN 👉 Timestamps 00:00 Memoryless Agent Problem 00:23 Reproducing the Bug 01:38 Seeing It Fail Live 02:18 Adding Memory in SDK 03:03 Starting a New Chat 04:10 Continuing the Thread 05:06 Resuming Last Session 05:46 Chat Controller Backend 07:43 Frontend Request Flow 08:29 Custom History Control 09:31 Wrap Up and Next Steps ---------------------------------------------------------------------- ➫ Business Inquiries: hello@laravel-news.com ---------------------------------------------------------------------- JOIN OUR WEEKLY LARAVEL NEWSLETTER 👉 https://laravel-news.com/newsletter ----------------------------------------------------------------------


Tracks in this Playlist