定制 laraveladmin/laravel-open-ai 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

laraveladmin/laravel-open-ai

最新稳定版本:v1.0.3

Composer 安装命令:

composer require laraveladmin/laravel-open-ai

包简介

laravel project based on orhanerday/open-ai

README 文档

README



Use extension packs

Project Name Required PHP Version Description Type (Official / Community) Support
orhanerday/open-ai PHP 7.4+ Most downloaded, forked, contributed, huge community supported, and used PHP SDK for OpenAI GPT-3 and DALL-E. It also supports chatGPT-like streaming. Community Available, (Community driven Discord Server or personal mail orhan@duck.com)

Publish config file:

php artisan vendor:publish --provider="LaravelAdmin\LaravelOpenAi\ServiceProvider"

About this package config in ".env"

OPENAI_API_KEY=
OPENAI_BASE_URI=
OPENAI_ORGANIZATION=
OPENAI_PROXY=
<?php
use LaravelAdmin\LaravelOpenAi\Facades\OpenAI;
$chat = OpenAI::chat([
   'model' => 'gpt-3.5-turbo',
   'messages' => [
       [
           "role" => "system",
           "content" => "You are a helpful assistant."
       ],
       [
           "role" => "user",
           "content" => "Who won the world series in 2020?"
       ],
       [
           "role" => "assistant",
           "content" => "The Los Angeles Dodgers won the World Series in 2020."
       ],
       [
           "role" => "user",
           "content" => "Where was it played?"
       ],
   ],
   'temperature' => 1.0,
   'max_tokens' => 4000,
   'frequency_penalty' => 0,
   'presence_penalty' => 0,
]);


var_dump($chat);
echo "<br>";
echo "<br>";
echo "<br>";
// decode response
$d = json_decode($chat);
// Get Content
echo($d->choices[0]->message->content);

Use more documentation reference

https://packagist.org/packages/orhanerday/open-ai

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-28