stuarttodd/openai-php-client
最新稳定版本:1.0.0
Composer 安装命令:
composer require stuarttodd/openai-php-client
包简介
An OpenAPI PHP Client. This is under construction, however there is some limited functionality available.
README 文档
README
An OpenAPI PHP Client. This is under construction, however there is some limited functionality available.
Composer Installation
composer require stuarttodd/openai-php-client
Chat Completions
<?php use Stuarttodd\OpenAiPhpClient\OpenAI; $apiKey = "YOUR_API_KEY_HERE"; $response = OpenAI::client($apiKey) ->chatCompletions() ->setConfig([ 'model' => 'gpt-3.5-turbo', // if not set, defaults to 'gpt-3.5-turbo' 'temperature' => 0.9, // if not set, defaults to 0.7 'message' => 'Tell me you love me' // If not set, defaults to giving you a random Chuck Norris joke ]) ->fetch(function($response) { // use of closure is optional return json_decode($response)->choices[0]->message->content; }); echo $response; // "As an AI, I do not have the capability to feel emotions or love. However, I am here to assist you with any questions or tasks you may have."
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-07-27