iazaran/ai-insights
Composer 安装命令:
composer require iazaran/ai-insights
包简介
Using AI to analyze data and receive insights to improve specific areas of your business
README 文档
README
Using AI LLMs to analyze data and receive insights and charts to improve specific areas of your business. The default LLM is OpenAI, but you can use any other LLMs.
Requirements
- PHP >=8.1
- Laravel >= 10
Get Started
Install iazaran/ai-insights via the Composer package manager:
composer require iazaran/ai-insights
Optionally, publish the configuration file
php artisan vendor:publish --provider="AIInsights\Providers\AIInsightsServiceProvider"
Set .env configuration. You can get your OpenAI API key here. Others are optional.
AI_BASE_URL="" AI_CHAT_PATH="" AI_IMAGE_PATH="" AI_API_KEY="" AI_ORGANIZATION="" AI_PROJECT="" AI_MODEL="" AI_IMAGE_MODEL="" AI_MAX_TOKENS="" AI_TEMPERATURE="" AI_INSIGHTS_DEFAULT_GOAL="" AI_IMAGE_SIZE=""
Use the AIInsightsProcessor class to analyze your data. As default, it will use your last rows in DB
$businessType = 'Retail'; $goal = 'Increase sales'; $tables = ['orders', 'products']; $limit = 5; $insights = AIInsightsProcessor::analyze($businessType, $goal, $tables, $limit);
And sample response can be like this, if you are using OpenAI:
[
'insights' => [
[
'index' => 0,
'message' => [
'role' => 'assistant',
'content' => "Based on the provided data from the 'orders' and 'products' tables, here are some insights to improve your Retail business and increase sales:\n\n1. Focus on promoting high-margin products: The data shows that Product A has a higher profit margin compared to other products. Consider running targeted marketing campaigns for this item.\n2. Implement a loyalty program: Analyzing customer purchase history reveals repeat buyers. Introduce a loyalty program to incentivize these customers and encourage more frequent purchases.\n3. Optimize inventory management: The product data indicates some items have low stock levels. Ensure popular products are always available to avoid missing sales opportunities.\n4. Personalize marketing efforts: Use customer order history to create personalized product recommendations, potentially increasing cross-selling and upselling."
],
'finish_reason' => 'stop',
],
],
'charts' => [
[
'url' => 'https://oaidalleapiprodscus.blob.core.windows.net/private/org-123456/user-123456/img-abcdef.png'
],
]
]
iazaran/ai-insights 适用场景与选型建议
iazaran/ai-insights 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 08 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel package」 「ai-insights」 「ai insights laravel」 「ai data analysis」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 iazaran/ai-insights 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 iazaran/ai-insights 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 iazaran/ai-insights 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple ASCII output of array data
Alfabank REST API integration
Package for view storage in laravel
User Approval Laravel Package
PHPUnit Pretty Result Printer
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-28