adebayo27/wetrocloud-sdk
Composer 安装命令:
composer require adebayo27/wetrocloud-sdk
包简介
A laravel sdk for wetrocloud
README 文档
README
A Laravel SDK to interact with Wetrocloud's API for AI-powered features like text generation, data extraction, image-to-text conversion, and collection management.
Installation
Via Composer
You can install the SDK using Composer:
composer require adebayo27/wetrocloud-sdk
Environment Variables
Ensure you add your Wetrocloud API key to your .env file:
WETROCLOUD_API_KEY=your_api_key_here
Usage
Initialize the SDK
The SDK is automatically injected via Laravel's Service Provider. To use it in a controller or service, inject WetrocloudClient:
use Wetrocloud\Sdk\WetrocloudClient; class ExampleController extends Controller { protected WetrocloudClient $wetrocloud; public function __construct() { $this->wetrocloud = new WetrocloudClient(env('WETROCLOUD_API_KEY'), 'v1'); } }
Features
1. List Collections
Retrieves all available collections.
Usage
$collections = $wetrocloud->listCollections();
Response Example
{
"count": 10,
"next": null,
"previous": null,
"collections": [ ... ]
}
2. Create a Collection
Creates a new collection with a unique ID.
Usage
$collection = $wetrocloud->createCollection();
or
$collection = $wetrocloud->createCollection('my_unique_collection');
Response Example
{
"collection_id": "my_unique_collection",
"success": true
}
3. Query a Collection
Retrieves specific data from a collection.
Usage
$queryResult = $wetrocloud->queryCollection('my_collection', 'Find all users with role admin');
Response Example
{
"results": [ ... ]
}
4. Data Categorization
Classifies text into predefined categories.
Usage
$categorization = $wetrocloud->categorizeText( "match review: John Cena vs. The Rock are fighting", ["football", "coding", "entertainment", "basketball", "wrestling", "information"] );
Response Example
{
"response": { "label": "wrestling" },
"tokens": 1746,
"success": true
}
5. Text Generation
Generates AI-powered text responses based on input messages.
Usage
$response = $wetrocloud->generateText([ ['role' => 'user', 'content' => 'What is a large language model?'] ]);
Response Example
{
"response": "A large language model is a type of AI trained on vast datasets..."
}
6. Image-to-Text
Extracts text or answers questions about an image.
Usage
$response = $wetrocloud->imageToText( 'https://example.com/sample-image.jpg', 'What is in this image?' );
Response Example
{
"response": "A golden retriever dog playing in the park."
}
7. Data Extraction from a Website
Extracts structured data from a web page based on a JSON schema.
Usage
$response = $wetrocloud->extractDataFromWebsite( 'https://example.com', ['title' => '', 'description' => ''] );
Response Example
{
"data": { "title": "Example", "description": "This is an example website." }
}
Error Handling
All API requests return errors in a standard format.
Example Error Response
{
"error": "Client error: 401 Unauthorized",
"response": {
"detail": "Invalid token."
}
}
To handle errors, check if error is present in the response:
if (isset($response['error'])) { return response()->json($response, 400); }
Support & Contributions
For issues or feature requests, open an issue on GitHub or contribute via pull requests.
GitHub Repository: https://github.com/adebayo27/wetrocloud-sdk
Documentation
For more details, check out the official API documentation: Wetrocloud Docs
adebayo27/wetrocloud-sdk 适用场景与选型建议
adebayo27/wetrocloud-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 03 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 adebayo27/wetrocloud-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 adebayo27/wetrocloud-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-20