几天内即可获得 Laravel 代码审查方面的专家指导

Ship AI with Laravel: RAG with Embeddings and pgvector in Laravel 13

发布日期 经过

▶️ 观看视频教程 (15分钟)

Our agent can look up orders, classify tickets, and remember conversations. But ask it "what's your return policy for damaged items?" and it makes something up. The agent has no access to our actual policies.

In this episode we give it a searchable knowledge base. Real documentation it can search by meaning.

I start with what embeddings actually are. Text converted into vectors that capture meaning. "How do I return a damaged item?" and "What if my package arrived broken?" use different words but mean the same thing, so their vectors end up close together. That's how semantic search works.

We build a KnowledgeArticle model with a vector column using PostgreSQL's pgvector extension, set up a 1,536-dimension embedding column, and use the Laravel AI SDK's Embeddings facade to generate vectors for each article. An Artisan command seeds eight FAQ articles and generates their embeddings.

For searching we use Laravel 13's whereVectorSimilarTo method. I test it in the browser with a few queries and the right article comes back even when the wording is completely different from what's stored.

Then we wire it into the support agent as a similarity search tool and update the instructions so the agent reaches for the knowledge base on policy questions.

Ask "what's your return policy?" and the answer comes from the actual return policy.

Next episode we use provider-hosted vector stores and the FileSearch tool so the agent can search entire PDFs without us writing the search logic.

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

▶️ Watch Episode 5 now →

哈里斯·拉夫托普洛斯摄

高级软件工程师 • Laravel News 员工及讲师 • Laravel Greece Meetup 联合组织者

归档于:
立方体

Laravel 时事通讯

加入超过 4 万名开发者的行列,不错过任何新的技巧、教程等内容。

图像
廷克威尔

这款编辑器专为快速反馈和快速迭代而设计,让您尽享编码和调试的乐趣。它就像您应用程序的一个外壳——但具备多行编辑、代码自动完成等更多功能。

参观廷克韦尔
PhpStorm 标志

PhpStorm

首选的 PHP IDE,对 Laravel 及其生态系统提供广泛的开箱即用支持。

PhpStorm
Shift 标志

转移

还在运行旧版本的 Laravel?立即实现 Laravel 自动升级和代码现代化,让您的应用程序保持最新状态。

转移
Lucky Media 标志

幸运传媒

Get Lucky Now——拥有十余年经验的 Laravel 开发理想之选!

幸运传媒
鱼叉:新一代时间跟踪和发票标志

Harpoon:新一代时间跟踪和发票系统

新一代时间跟踪和计费软件,帮助您的机构规划和预测盈利的未来。

Harpoon:新一代时间跟踪和发票系统
了解 Softtech 的标志

了解软科技

Acquaint Softtech 提供 AI 就绪的 Laravel 开发人员,48 小时内即可上手,每月费用为 3000 美元,没有冗长的销售流程,并提供 100% 退款保证。

了解软科技
Laravel Cloud 标志

Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

Laravel 云
MongoDB 徽标

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB
SaaSykit:Laravel SaaS 入门套件徽标

SaaSykit:Laravel SaaS 入门套件

SaaSykit 是一个多租户 Laravel SaaS 入门套件,包含运行现代 SaaS 所需的所有功能,例如支付、美观的结账界面、管理面板、用户仪表盘、身份验证、现成组件、统计数据、博客、文档等等。

SaaSykit:Laravel SaaS 入门套件
Kirschbaum 标志

樱桃树

提供创新和稳定性,确保您的Web应用程序取得成功。

樱桃树
Tinkerwell 徽标

廷克威尔

Laravel 开发者必备的代码运行器。可在本地和生产环境中体验 AI、自动补全和即时反馈功能。

廷克威尔
几天内即可获得 Laravel 代码审查徽标的专家指导

几天内即可获得 Laravel 代码审查方面的专家指导

专家级代码审查!两位拥有 10 年以上 Laravel 开发经验的开发者将为您提供清晰、实用的反馈,帮助团队构建更优质的应用程序。

几天内即可获得 Laravel 代码审查方面的专家指导
A Free Shift to Check If Your App is Ready for Laravel Cloud image

A Free Shift to Check If Your App is Ready for Laravel Cloud

阅读文章
Laravel Idempotency: HTTP Idempotency Middleware for Laravel image

Laravel Idempotency: HTTP Idempotency Middleware for Laravel

阅读文章
Polyscope for Windows is Now Available image

Polyscope for Windows is Now Available

阅读文章
Laravel Sluggable image

Laravel Sluggable

阅读文章
Laravel Mobile Pass: Generate Apple Wallet and Google Wallet Passes image

Laravel Mobile Pass: Generate Apple Wallet and Google Wallet Passes

阅读文章
PHPverse 2026 Returns June 9th image

PHPverse 2026 Returns June 9th

阅读文章