前些时候因为公司业务需要,调研AI相关的云服务,最终选定了腾讯的AI云平台,别问为什么选它,因为免费(穷)😂。但是它官方没有提供现在化/易用的PHP开发SDK,作为一个web 开发者,只能自己动手丰衣足食了,结果就产生了如下的轮子:

项目地址:https://github.com/justmd5/tencent-ai

腾讯AI开放平台 SDK

Tencent AI open platform sdk

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

Requirement

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

安装

composer require justmd5/tencent-ai

使用

1
2
3
4
5
6
7

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

接口调用示例

智能闲聊 url: https://api.ai.qq.com/fcgi-bin/nlp/nlp_textchat
请求示例如下:

1
2
3
4
5
6
7
8
9
$params = [
'question'=>'腾讯人工智能',
'session'=>123,
];
try {
dd($AI->nlp->request('textchat', $params));
} catch (\Justmd5\TencentAi\Exception\NotFoundException $e) {
dd($e);
}

文档

Tencent AI · Official Documents

帮助

qq群

Todo

  • parameter verify

感谢

源码列表

SDK 联系人 QQ 语言 实现接口 源代码&SDK 地址
910139966 PHP ALL https://github.com/justmd5/tencent-ai
783021975 JAVA ALL https://gitee.com/xshuai/taip
1361653339 Golang ALL https://github.com/shiguanghuxian/txai
1280827369 NodeJS
非全部接口实现
https://github.com/w89612b/qqai-api-sdk
1109527533 Python
非全部接口实现(完善中)
https://gitee.com/french-home/TencentAISDK
1928881525 .NET(C#)
OCR接口实现人脸模块接口实现
https://gitee.com/ch_1928881525/Tentcent.Ai

License

MIT