Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Ship AI with Laravel: Search Entire PDFs with Zero Search Logic

Last updated on by

▶️ Watch the video tutorial (12 minutes)

In Episode 5 we built semantic search from scratch with embeddings and pgvector. Great for FAQ articles and full control over the data. But what if your documentation is bigger than that? Hundreds of pages of policies, product manuals, full PDFs?

In this episode we use the other approach. Upload your docs to the AI provider, let them handle the chunking and embedding, and use the SDK's FileSearch tool to query it. No similarity math on our side. Just upload and search.

I build an Artisan command that creates a vector store called "SupportAI Knowledge Base" and uploads five markdown documents covering return policy, shipping, billing FAQ, account security, and product warranty. The store ID gets saved to .env and config so the rest of the app can reference it.

We add FileSearch to the support agent alongside the KnowledgeSearch tool from Episode 5 so the agent has both options. Then we update the instructions so it picks the right one. KnowledgeSearch for quick FAQ-style questions, FileSearch for detailed policy lookups.

I test it with a question about damaged items and the agent pulls the exact 48-hour reporting requirement from the actual policy doc. Then I throw a combined question with an order number and a policy question, and the agent uses OrderLookup and FileSearch in the same response.

One thing to know before you ship this to production: FileSearch is token-heavy and requires billing credits with the provider since they're hosting and querying the vectors for you.

Next episode we're building the real-time streaming chat UI with Livewire so customers can actually talk to the agent through a proper interface.

⭐ GitHub: https://github.com/harris21/ship-ai-with-laravel

▶️ Watch Episode 6 now →

Harris Raftopoulos photo

Senior Software Engineer • Staff & Educator @ Laravel News • Co-organizer @ Laravel Greece Meetup

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
SerpApi

The Web Search API for Your LLM and AI Applications

Visit SerpApi
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
SerpApi logo

SerpApi

Access real-time search engine results through a simple API—no more scraping headaches! Use it for AI applications, SEO tools, product research, travel information, and more

SerpApi
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell

The latest

View all →
Queue-Wide Inspection Methods in Laravel 13.8.0 image

Queue-Wide Inspection Methods in Laravel 13.8.0

Read article
Verifiable Audit Logging with Laravel Chronicle image

Verifiable Audit Logging with Laravel Chronicle

Read article
Personalized Content Delivery System: Building an AI-powered recommendation engine with Laravel and MongoDB image

Personalized Content Delivery System: Building an AI-powered recommendation engine with Laravel and MongoDB

Read article
Laravel Brain: Visualize Your Application's Request Lifecycle image

Laravel Brain: Visualize Your Application's Request Lifecycle

Read article
Laravel Shopper: A Headless E-Commerce Admin Panel for Laravel image

Laravel Shopper: A Headless E-Commerce Admin Panel for Laravel

Read article
Chevere Workflow: A Declarative PHP Workflow Engine with Async Job Execution image

Chevere Workflow: A Declarative PHP Workflow Engine with Async Job Execution

Read article