Laravel & AI

Watch and track your favorite playlist.

Curated by: Laravel News (16 videos)


Currently Playing: Test Your AI System with Zero API Calls - Ship AI with Laravel EP10

We've built a lot. Agents, tools, a knowledge base, streaming, failover, middleware. So how do you test all of it? You can't hit OpenAI in your test suite and hope for consistent responses. It's slow, it costs money, and the answers change every run. In this episode we test the entire system with Pest and zero API calls, using the SDK's faking system. It works just like faking mail, notifications, or queues in Laravel. You define the responses up front and assert that the right prompts were sent. I start with a project cleanup, moving the middleware into an AI/middleware namespace, then write tests that verify the agent gets prompted correctly, handles context, and returns deterministic responses. I use preventStrayPrompts to catch any accidental AI calls in flows that shouldn't trigger the agent, like ticket creation. I add coverage for queued prompts by asserting the TicketClassifier is queued on valid submissions and not queued on invalid ones. Then I test the custom tools directly. The OrderLookup tool gets tested against real database records, and a failing test actually catches a factory mismatch which I fix on camera. I feature-test the chat HTTP endpoint for authentication, validation, and correct agent interaction. Finally I test the vector store setup and knowledge base seeding by faking store creation, document uploads, and embedding generation. By the end, all 12 AI tests run fast with zero API calls. Next episode we tackle security. Protecting your agent against prompt injection and more, including a local LLM that screens every message before it reaches the provider. ⭐ GitHub: https://github.com/harris21/ship-ai-with-laravel 👉 Full series playlist: https://www.youtube.com/playlist?list=PLsmlCYEtWNI_plnKPPO13XjfDJoMIfhLN 👉 Timestamps 00:00 Testing AI Without APIs 00:25 Project Cleanup and Fakes 01:28 First Agent Prompt Test 04:19 Context and Stray Prompts 06:13 Queued Classifier Prompts 07:46 Testing Custom Tools 10:05 Chat Endpoint Integration 12:40 Vector Store and Embeddings 14:56 Run the Full Suite 15:26 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