一個輪子 tencent-ai 騰訊 AI 開放平臺 SDK

騰訊AI開放平臺 SDK

Tencent AI open platform sdkphp

PHP from Packagist GitHub stars Latest Stable Version Latest Unstable Version License

項目地址:github.com/justmd5/ten…html

歡迎前來 star 以及提 issue !laravel

Requirement

  1. PHP >= 7.0
  2. Composer
  3. ext-curl 拓展
  4. ext-json 拓展

Install

$ composer require justmd5/tencent-ai
複製代碼

Usage

$config  = [
    'appKey'    => '1106944xxx',
    'appSecret' => 'dsgnbnWnX8Yxxxxxx',
    'debug'     => 0,//1 show debug info 
];
$AI      = new \Justmd5\TencentAi\Ai($config);

複製代碼

Interface call example

$params = [
'question'=>'騰訊人工智能',
'session'=>123,
];
try {
    dd($AI->nlp->request('textchat', $params));
} catch (\Justmd5\TencentAi\Exception\NotFoundException $e) {
    dd($e);
}
複製代碼

固然laravel版的少不了啦

項目地址:github.com/justmd5/lar…git

Install

in your laravel application, execute the following command:github

composer require justmd5/laravel-tencent-ai:dev-mastershell

Configure

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,
];
複製代碼

Usage

$params = [
            'question'=>'騰訊人工智能',
            'session'=>123,
    ];
    
    dd(app('tencent-ai')->nlp->request('textchat', $params));

複製代碼

Documentation

Tencent AI · Official Documents

Help

qq羣

相關文章
相關標籤/搜索