承接 davor/open-ai 相关项目开发

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

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

davor/open-ai

最新稳定版本:v1.4.0

Composer 安装命令:

composer require davor/open-ai

包简介

Package for communication with OpenAI

README 文档

README

This package is intended for communication with OpenAI. Installation:

  1. composer require davor/open-ai
  2. php artisan vendor:publish --tag=config --provider="Hoks\OpenAI\OpenAIServiceProvider"
  3. Set up config/openai.php
  4. Use package :D

Code example

/**
 * This example shows how to ask OpenAI to create prompt for creating OpenAI image
 */

//using facade we create client and specify uri for OpenAI API
$askClient = \OpenAI::client('chat/completions');
//we ask for prompt (note that we use ['content'] to retrieve prompt)
$imagePrompt = $askClient->ask('Write best prompt for creating poster of Novak Djokovic being the best tennis player ever')['content'];
//using facade we create ampther client for image
$imageClient = \OpenAI::client('images/generations',60,'dall-e-3');
//we retrieve image url (by default)
$imageUrl = $imageClient->generateImage($imagePrompt)[0];

Check command GenerateAINews.php for more use cases, as well as OpenAI class for more options on methods

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-03