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群