# 简介

官方的sdk用起来的感觉实在是太忧伤了,换一种更好的调用方式吧

## 特点

* 优雅的调用方式
* 仅支持php 7.0以上版本
* 参数兼容原生接口
* 隐藏了开发者不需要关注的细节
* 高度抽象的类
* 符合psr4标准 方便集成到各种项目中

## 支持的平台

* 百度AI平台
* 腾讯AI平台

## 安装

```
composer require  "crisen/ai":"^1.0.0"
```

laravel框架,请点击[这里](https://github.com/crisenchou/laravel-ai)

## 使用示例

```php
use Crisen\AI\AI;

...

//百度ai
$baiduConfig = [
     'app_id' => 'your appid',
     'api_key' => 'your api key',
     'secret_key' => 'your secret key'
];
$ai = AI::baidu($baiduConfig);
//腾讯ai
$tencentConfig = [
     'app_id' => 'your appid',
     'app_key' => 'your secret id',
];
$ai = AI::tencent($tencentConfig);

// 图片检索
$url = 'http://aip.bdstatic.com/portal/dist/1543924308745/ai_images/logo.png';
$res =     $ai->face()->url($url)->detect();
if($res->success()){
    var_dump($res->toArray())
}else{
    var_dump($res->getErrMsg());
}
```

## 文档

[详细文档](https://doc.crisen.org/ai)

## LICENSE

[MIT](https://github.com/crisenchou/ai/tree/04e6214c90c1ee91d9082012ded3fbde6047538e/LICENSE/README.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.crisen.org/ai/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
