Account

__construct(Request $request)

Creates an instance of Account

$account = new Account($request);

get()

Get the authenticated account.

$response = $account->get();

Inherit

__construct(Request $request)

$request = new Request("your-auth-token");
$model = new Model($request);

getRequest()

Get an instance of Request.

$request = $model->getRequest();

setRequest(Request $request)

Set an instance of Request.

$model->setRequest($request);

Collection

__construct(Request $request)

Creates an instance of Collection

$collection = new Collection($request);

get(string $collection_slug)

Get a collection of models

$response = $collection->get('hello');

list()

List collections of models

$response = $collection->list();

Deployment

__construct(Request $request)

Creates an instance of Deployment

$deployment = new Deployment($request);

create(string $name, string $model, string $version, string $hardware, int $min_instances, int $max_instances)

Create a deployment

$response = $deployment->create('deployment_name', 'model_name', 'version', 'cpu', 1, 3);

delete(string $deployment_owner, string $deployment_name)

Delete a deployment

$response = $deployment->delete('deployment_owner', 'deployment_name');

get(string $deployment_owner, string $deployment_name)

Get a deployment

$response = $deployment->get('deployment_owner', 'deployment_name');

list(string $cursor = null)

List deployments

$response = $deployment->list();

prediction(string $deployment_owner, string $deployment_name, array $input, array $optional = [])

Create a prediction using a deployment

$response = $deployment->prediction('deployment_owner', 'deployment_name', ['input' => ['text' => 'Alice']]);

update(string $deployment_owner, string $deployment_name, array $data)

Update a deployment

$response = $deployment->update('deployment_owner', 'deployment_name', ['min_instances' => 3, 'max_instances' => 10]);

Hardware

__construct(Request $request)

Creates an instance of Hardware

$hardware = new Hardware($request);

list()

List available hardware for models

$response = $hardware->list();

Model

__construct(Request $request)

Creates an instance of Model

$model = new Model($request);

create(string $owner, string $name, string $visibility, string $hardware, array $optional = [])

Create a model

$response = $model->create('model_owner', 'model_name', 'public', 'cpu');

delete(string $model_owner, string $model_name)

Delete a model

$response = $model->delete('model_owner', 'model_name');

deleteVersion(string $model_owner, string $model_name, string $version_id)

Delete a model version

$response = $model->deleteVersion('model_owner', 'model_name', 'version_id');

get(string $model_owner, string $model_name)

Get a model

$response = $model->get('model_owner', 'model_name');

getVersion(string $model_owner, string $model_name, string $version_id)

Get a model version

$response = $model->getVersion('model_owner', 'model_name', 'version_id');

list(string $cursor = null)

List public models

$response = $model->list();

prediction(string $model_owner, string $model_name, array $input, array $optional = [])

Create a prediction using an official model

$response = $model->prediction('model_owner', 'model_name', ['input' => ['prompt' => 'Write a short poem about the weather']]);

Search public models

$response = $model->search('hello');

Prediction

__construct(Request $request)

Creates an instance of Prediction

$prediction = new Prediction($request);

cancel(string $prediction_id)

Cancel a prediction

$response = $prediction->cancel('prediction_id');

create(array $input, string $version, array $optional = [])

Create a prediction

$response = $prediction->create(['input' => ['text' => 'Alice']], 'version');

get(string $prediction_id)

Get a prediction

$response = $prediction->get('prediction_id');

list(string $cursor = null)

List predictions

$response = $prediction->list();

Request

__construct(string $authToken)

Creates an instance of Request.

$request = new Request('auth token');

getAuthToken()

Gets the auth token

echo $request->getAuthToken();

setAuthToken(string $authToken)

Sets the auth token

$request->setAuthToken('auth token');

getClient()

Gets the HTTP client

$client = $request->getClient();

get(string $uri, array $headers = [])

Make a HTTP GET request

$response = $request->get('/models');

post(string $uri, array $data = [], array $headers = [])

Make a HTTP POST request

$response = $request->post("/predictions", [
    "version" => "5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa",
    "input" => [
        "text": "Alice"
    ]
]);

delete(string $uri, array $headers = [])

Make a HTTP DELETE request

$response = $request->delete("/models/{$model_owner}/{$model_name}");

patch(string $uri, array $data, array $headers = [])

Make a HTTP PATCH request

$response = $request->patch("/deployments/{$deployment_owner}/{$deployment_name}", ["min_instances": 3, "max_instances": 10]);

query(string $uri, string $data, array $headers = [])

Make a HTTP QUERY request

$response = $request->query("/models{$qs}", $keyword, [
    'Content-Type' => 'text/plain',
]);

Response

__construct(array $response)

Creates an instance of Response

$response = new Response([
    'url' => $url,
    'method' => $method,
    'http_code' => $statusCode,
    'headers' => $responseHeaders,
    'body' => $body,
    'error' => null,
]);

getBody($format = true)

Get the response

print_r($response->getBody());

getError()

Get the error, if any

echo $response->getError();

getHeaders()

Gets the response headers

print_r($response->getHeaders());

getHttpCode()

Gets the HTTP status code

echo $response-getHttpCode();

getMethod()

Gets the request method

echo $response->getMethod();

getUrl()

Gets the requested URL

echo $response->getUrl();

Training

__construct(Request $request)

Creates an instance of Training.

$training = new Training($request);

cancel(string $training_id)

Cancel a training

$response = $training->cancel('training_id');

create(string $model_owner, string $model_name, string $version_id)

Create a training

$response = $training->create('model_owner', 'model_name', 'version_id');

get(string $training_id)

Get a training

$response = $training->get('training_id');

list(string $cursor = null)

List trainings

$response = $training->list();

Webhook

__construct(Request $request)

Creates an instance of Webhook.

$webhook = new Webhook($request);

secret()

Get the signing secret for the default webhook

$response = $webhook->secret();