一个轮子 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群

相关文章
相关标签/搜索