intufind/ai-sdk
Composer 安装命令:
composer require intufind/ai-sdk
包简介
PHP SDK for Intufind AI Cloud Services
关键字:
README 文档
README
Official PHP SDK for Intufind AI Cloud Services — AI-powered semantic search, chat, and recommendations for e-commerce.
Installation
composer require intufind/ai-sdk
Quick Start
<?php use Intufind\AI\Client; $client = new Client([ 'api_key' => 'your-api-key', 'site_id' => 'your-site-id', ]); // Search products semantically $results = $client->products()->search([ 'text' => 'wireless noise cancelling headphones', 'limit' => 10, ]); foreach ($results->getResults() as $product) { echo $product->name . ' - $' . $product->price . "\n"; }
Features
- Semantic Search — AI-powered product and content search
- AI Chat — Conversational shopping assistant with streaming support
- Recommendations — Trending, similar, and personalized product suggestions
- Content Indexing — Index products, posts, and custom content
- Webhooks — Real-time event notifications
Configuration
use Intufind\AI\Client; use Intufind\AI\Config\Configuration; $config = new Configuration([ 'api_key' => 'your-api-key', 'site_id' => 'your-site-id', 'api_endpoint' => 'https://api.intufind.com', // Optional: custom endpoint 'streaming_endpoint' => 'https://stream.intufind.com', // Optional: for chat streaming 'timeout' => 30, // Request timeout in seconds 'debug' => false, // Enable debug logging ]); $client = new Client($config);
Usage Examples
Products
// Index a product $client->products()->upsert([ 'id' => 'sku-123', 'name' => 'Wireless Headphones', 'content' => 'Premium wireless headphones with active noise cancellation...', 'price' => 299.99, 'categories' => ['electronics', 'audio'], 'attributes' => [ 'color' => ['Black', 'Silver'], 'brand' => ['AudioPro'], ], ]); // Search products $results = $client->products()->search([ 'text' => 'comfortable headphones for working from home', 'limit' => 10, 'filters' => [ 'categories' => ['electronics'], ], ]); // Delete a product $client->products()->delete('sku-123');
Posts / Content
// Index a blog post $client->posts()->upsert([ 'id' => 'post-456', 'title' => 'Best Headphones for Remote Work', 'content' => 'Finding the perfect headphones for your home office...', 'status' => 'publish', 'categories' => ['guides', 'audio'], ]); // Search posts $results = $client->posts()->search([ 'text' => 'headphone buying guide', 'limit' => 5, ]);
AI Chat
// Send a chat message $response = $client->chat()->send([ 'message' => 'I need headphones for working from home, budget around $200', 'threadId' => 'user-session-123', ]); echo $response->getIntro(); foreach ($response->getProducts() as $product) { echo "- {$product->name}: \${$product->price}\n"; } // Streaming chat (for real-time responses) $client->chat()->stream([ 'message' => 'Tell me more about the first option', 'threadId' => 'user-session-123', ], function ($chunk) { echo $chunk->getContent(); flush(); });
Recommendations
// Get trending products $trending = $client->recommendations()->getTrending(['limit' => 5]); // Get similar products $similar = $client->recommendations()->getSimilar('sku-123', ['limit' => 5]); // Get personalized recommendations $personalized = $client->recommendations()->getPersonalized([ 'userId' => 'user-456', 'limit' => 10, ]);
Webhooks
// Register a webhook $client->webhooks()->create([ 'url' => 'https://yoursite.com/webhook', 'events' => ['product.indexed', 'chat.completed'], ]); // List webhooks $webhooks = $client->webhooks()->list(); // Test a webhook $result = $client->webhooks()->test('webhook-id');
Error Handling
use Intufind\AI\Exceptions\ApiException; use Intufind\AI\Exceptions\AuthenticationException; use Intufind\AI\Exceptions\RateLimitException; use Intufind\AI\Exceptions\ValidationException; try { $results = $client->products()->search(['text' => 'headphones']); } catch (AuthenticationException $e) { // Invalid API key or license error_log('Auth failed: ' . $e->getMessage()); } catch (RateLimitException $e) { // Too many requests $retryAfter = $e->getRetryAfter(); error_log("Rate limited. Retry after {$retryAfter} seconds"); } catch (ValidationException $e) { // Invalid request parameters error_log('Validation error: ' . $e->getMessage()); } catch (ApiException $e) { // General API error error_log('API error: ' . $e->getMessage()); error_log('Status: ' . $e->getStatusCode()); }
Available Services
| Service | Access | Description |
|---|---|---|
| Products | $client->products() |
Product indexing and search |
| Posts | $client->posts() |
Content/blog post management |
| Chat | $client->chat() |
AI conversational interface |
| Recommendations | $client->recommendations() |
Product recommendations |
| Taxonomy | $client->taxonomy() |
Category and tag management |
| Prompts | $client->prompts() |
Custom AI prompt templates |
| Threads | $client->threads() |
Chat thread management |
| Feedback | $client->feedback() |
User feedback collection |
| Webhooks | $client->webhooks() |
Webhook management |
| Tenant | $client->tenant() |
Account and subscription info |
| Provisioning | $client->provisioning() |
License activation |
Requirements
- PHP 7.4 or 8.0+
ext-jsonext-curl- Guzzle HTTP client (installed automatically)
Development
# Install dependencies composer install # Run tests composer test # Static analysis composer phpstan # Code style check composer cs-check # Fix code style composer cs-fix # Pre-release validation (runs all checks) composer pre-release
Support
- Documentation: docs.intufind.com
- Email: support@intufind.com
- Issues: GitHub Issues
License
MIT License — see LICENSE for details.
intufind/ai-sdk 适用场景与选型建议
intufind/ai-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ecommerce」 「search」 「sdk」 「ai」 「intufind」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 intufind/ai-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 intufind/ai-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 intufind/ai-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to retrieve data from Google Search Console
Nevogate Payment Gateway SDK
Indexed Search Autocomplete - Extends the TYPO3 Core Extension Indexed_Search searchform with an autocomplete feature.
Abstraction Layer to index and search entities
Dealing with payments through the Egyptian payment gateway PayMob
Pimcore 10.x Website Indexer (powered by Zend Search Lucene)
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-22