The Inferable Client SDK is a library that allows you to interact with the Inferable API. It provides a simple interface for registering services and by extension functions.

Installation

The Inferable Client SDK is available as an NodeJs or Go package.

bash npm i inferable

Intialize the client

import { Inferable } from "inferable";

// Instantiate the Inferable client.
const i = new Inferable({
  // To get a new key, run:
  // npx @inferable/cli auth keys create 'My New Machine Key' --type='cluster_machine'
  apiSecret: process.env.INFERABLE_API_SECRET
})

The client will attempt to use the API Secret from the environment variable INFERABLE_API_SECRET by default. If you need to specify the API Secret manually, you can pass it in via the apiSecret option when initializing the client.

Options

apiSecret

The API Secret used to authenticate with the Inferable API. If not provided, the client will attempt to use the INFERABLE_API_SECRET environment variable.

jobPollWaitTime

The amount of time in milliseconds that the client will maintain a connection to the control-plane when polling for jobs. Defaults to 20000ms. If a job is not received within this time, the client will close the connection and try again