abdullah-ai/ai-automation
Composer 安装命令:
composer require abdullah-ai/ai-automation
包简介
A PHP package for AI-driven automation and chat capabilities with OpenAI's GPT models.
README 文档
README
AI Automation is a PHP package that provides a simple interface to interact with OpenAI's GPT models, enabling seamless AI-driven automation and chat capabilities in your PHP projects.
Features
- Send prompts to OpenAI's GPT models (e.g.,
gpt-3.5-turbo) and receive responses. - AI for chatbots.
- Designed for modern PHP applications, with support for
.envconfiguration.
Installation
Step 1: Install the Package
Add the package to your Laravel or PHP project using Composer:
composer require abdullah-ai/ai-automation:dev-master
Configuration
Step 2: Set Up Your API Key
- Obtain your OpenAI API key from OpenAI API Keys.
- Add the API key to your Laravel or PHP project’s
.envfile:
AI_AUTOMATION_API_KEY=your-openai-api-key
Usage
Example in Laravel
Below is an example of how to use the AI Automation package in a Laravel project:
use AbdullahAI\AIAutomation\AIAutomation; public function getAIResponse() { // Fetch the API key from the .env file $apiKey = env('AI_AUTOMATION_API_KEY'); $model = 'gpt-3.5-turbo', // you can Specify the model $automation = new AIAutomation($apiKey, $model); $prompt = "I have purchased a product but it is of poor quality."; // Get AI response $response = $automation->chatCompletion($prompt); // Return the response as JSON return response()->json(['AI Response' => $response]); }
Methods
__construct(string $apiKey)
Initializes the AIAutomation class with your OpenAI API key.
-
Parameter:
$apiKey- The OpenAI API key.chatCompletion(string $message): stringSends a user prompt to OpenAI's API and retrieves the AI's response. -
Parameter:
$message- The user-provided input for the AI. -
Returns: A string containing the AI's response.
Requirements
- PHP 8.0 or higher
- Composer
- GuzzleHTTP (^7.0)
- Laravel (optional, for framework integration)
- PHPUnit (^10.5 for development and testing)
Author
Abdullah Al Mamun
For support or questions: 📧 almamun00021@gmail.com
abdullah-ai/ai-automation 适用场景与选型建议
abdullah-ai/ai-automation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 abdullah-ai/ai-automation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 abdullah-ai/ai-automation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-15