承接 abdullah-ai/ai-automation 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 .env configuration.

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

  1. Obtain your OpenAI API key from OpenAI API Keys.
  2. Add the API key to your Laravel or PHP project’s .env file:
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): string Sends 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

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-15