Tencent AI open platform sdkphp
項目地址:github.com/justmd5/ten…html
歡迎前來 star 以及提 issue !laravel
$ composer require justmd5/tencent-ai
複製代碼
$config = [
'appKey' => '1106944xxx',
'appSecret' => 'dsgnbnWnX8Yxxxxxx',
'debug' => 0,//1 show debug info
];
$AI = new \Justmd5\TencentAi\Ai($config);
複製代碼
$params = [
'question'=>'騰訊人工智能',
'session'=>123,
];
try {
dd($AI->nlp->request('textchat', $params));
} catch (\Justmd5\TencentAi\Exception\NotFoundException $e) {
dd($e);
}
複製代碼
項目地址:github.com/justmd5/lar…git
in your laravel application, execute the following command:github
composer require justmd5/laravel-tencent-ai:dev-master
shell
add service provider to the app.php:json
'providers' => [
// Application Service Providers...
Justmd5\LaravelTencentAi\ServiceProvider::class,
],
複製代碼
if you use laravel that >= 5.5 ,the above steps are not required.bash
publish config:session
php artisan vendor:publish --provider="Justmd5\LaravelTencentAi\ServiceProvider"
複製代碼
after that, you might want to change some config about tencentai:app
// config/tencentai.php
return [
'appKey' => '',
'appSecret' => '',
'debug' => 0,
];
複製代碼
$params = [
'question'=>'騰訊人工智能',
'session'=>123,
];
dd(app('tencent-ai')->nlp->request('textchat', $params));
複製代碼
Tencent AI · Official Documents
qq羣