fuzzy-ai/sdk
Composer 安装命令:
composer require fuzzy-ai/sdk
包简介
Fuzzy.ai PHP Library
README 文档
README
PHP library for accessing the fuzzy.ai API.
Requirements
PHP 5.3.3 or later with the cURL extension.
Installation
You can install the library via Composer:
composer require fuzzy-ai/sdk
To load the library, use Composer's autoload:
require_once('vendor/autoload.php');
Usage
All API calls require an API key from https://fuzzy.ai/
$client = new FuzzyAi\Client('YourAPIKey'); list($result, $evalID) = $client->evaluate('YourAgentID', array('input1' => 42));
Client
This is the main class and serves as an entry point to the API.
- FuzzyAi\Client($key, $root) Constructor that takes the following arguments and returns a new Client object.
key: Your Fuzzy.ai API keyroot(optional): The API endpoint (defaults to https://api.fuzzy.ai)
- evaluate($agentId, $inputs) The main method to use, it performs a single inference. Returns an array of outputs and an evaluation ID (for training feedback, see below).
agentId: The ID of the Agent to perform the evaluation againstinputs: An associative array of input name => values.
- feedback($evaluationId, $performance) This is the method used for training better results. Returns a feedback object.
evaluationId: Unique identifier returned from an evaluate() call.performance: The performance metrics (as an associative array) to provide the learning.
- newAgent($props) Use this method to create a new Agent. Returns an Agent object.
props: An associative array representing an agent with at leastinputs,outputs, andrules.
- getAgent($agentId) This will fetch an existing agent definition. Returns an Agent object.
agentId: ID of the agent to retrieve
Agent
This class represents an Agent and provides full CRUD features.
- FuzzyAi\Agent($client) Constructor - takes an HTTP Client object, but it's easier to use either
newAgentorgetAgentfrom above to create the Agent object. - evaluate($inputs) Like Client::evaluate, but on an existing Agent instance. NOTE Returns an Evaluation object.
inputs: An associative array of input name => values.
- create($props) Creates a new agent (although Client::newAgent is likely easier).
props: An associative array representing an agent with at leastinputs,outputs, andrules.
- read($props) Reads an agent definition from the API. Probably easier to use Client::getAgent().
id: Agent ID to read.
- update($props) Updates the current agent instance with $props.
props: New agent properties.
- delete() Deletes current agent from the API.
Evaluation
This class represents a single evaluation.
- read($id) Load a single evaluation object by ID.
- feedback($values) Provide learning feedback data to a single evaluation . Returns a Feedback object.
values: the performance metrics to provide for feedback.
Examples
The examples/ directory has some examples of using the library.
Development
Install dependencies:
composer install
Run the tests:
./vendor/bin/phpunit
统计信息
- 总下载量: 51
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2016-11-18