omeratagunn/openai
Composer 安装命令:
composer require omeratagunn/openai
包简介
Composer package for openAI cli
关键字:
README 文档
README
#OpenAI-php
PHP client for https://beta.openai.com/docs/api-reference
- Guzzle client. Check examples to parse response as you wish.
Simply call composer
composer require omeratagunn/openai
#Example Usage
$test = new OpenAI('your-key');
// default davinci, to see other engines please visit openAI documentation//
$test->setEngineId('davinci');
try {
$a = $test->postCompletions([
'prompt' => "I wish i had a flying fish",
'max_tokens' => 5,
'temperature' => 1,
'top_p' => 1,
'n' => 1,
'stream' => false,
'logprobs' => null,
'stop' => "\n"
]);
$response = $a->getBody()->getContents();
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
$e->getMessage();
}
try {
$b = $test->search([
'documents' => [
'white house',
'hospital',
'school'
],
'query' => "the president"
]);
$response = $b->getBody()->getContents();
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
$e->getMessage();
}
#License Published under the MIT License
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-29