wontonee/laravel-qdrant-sdk
Composer 安装命令:
composer require wontonee/laravel-qdrant-sdk
包简介
Laravel SDK for Qdrant vector database with embedders like OpenAI and Gemini
README 文档
README
Laravel Qdrant SDK is a Laravel package that provides a simple, expressive interface for working with the Qdrant vector database. It supports collection management, vector upserts, similarity search, and integration with embedders like OpenAI and Gemini.
Features
- Create, update, delete, and list Qdrant collections
- Upsert and manage vector points
- Perform similarity search and recommendations
- Easily integrate with OpenAI or Gemini for vector embeddings
- Simple trait for adding vector support to Eloquent models
Installation
-
Require the package:
composer require wontonee/laravel-qdrant-sdk
-
Publish the config:
php artisan vendor:publish --provider="Wontonee\LarQ\Providers\LarQServiceProvider" --tag=larq-config -
Set your .env variables:
LARQ_HOST=http://localhost:6333 LARQ_API_KEY= OPENAI_API_KEY=sk-... OPENAI_MODEL=text-embedding-ada-002 GEMINI_API_KEY=... GEMINI_MODEL=models/embedding-001
-
Run Qdrant with persistent storage (recommended for local dev):
docker run -p 6333:6333 -v $(pwd)/qdrant_storage:/qdrant/storage qdrant/qdrant
Usage
Creating a Collection
use Wontonee\LarQ\Qdrant\Collections\CreateCollection; $vectorParams = [ 'size' => 3, 'distance' => 'Cosine', ]; $response = (new CreateCollection())->handle('my_collection', $vectorParams);
Upserting Points
use Wontonee\LarQ\Qdrant\Points\UpsertPoints; $points = [ [ 'id' => 1, 'vector' => [0.1, 0.2, 0.3], 'payload' => ['label' => 'A'], ], ]; $response = (new UpsertPoints())->handle('my_collection', $points);
Scrolling Points
use Wontonee\LarQ\Qdrant\Points\ScrollPoints; $response = (new ScrollPoints())->handle('my_collection', 10);
Listing All Collections
use Wontonee\LarQ\Qdrant\Collections\ListCollections; $response = (new ListCollections())->handle();
Using the HasVectors Trait
Add vector support to your Eloquent model:
use Wontonee\LarQ\Traits\HasVectors; class Product extends Model { use HasVectors; // Optionally override vectorText(), vectorPayload(), etc. }
Example Controller Test
See QdrantDemoController for a full example of creating a collection, upserting points, and listing them.
Troubleshooting
- Data disappears after restart: Make sure Qdrant is running with persistent storage (see above).
- Connection issues: Check your
LARQ_HOSTand API key settings in.env.
License
MIT
wontonee/laravel-qdrant-sdk 适用场景与选型建议
wontonee/laravel-qdrant-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 97 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 05 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wontonee/laravel-qdrant-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wontonee/laravel-qdrant-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 97
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-27