@zcatalyst/quickml
v0.0.3
Published
JavaScript SDK for Catalyst QuickML - Prediction
Maintainers
Readme
@zcatalyst/quickml
JavaScript SDK for Catalyst QuickML - Prediction
Overview
The @zcatalyst/quickml package provides JavaScript/TypeScript methods to call deployed Catalyst QuickML prediction endpoints. Runs in Node.js (server-side) environments only.
Prerequisites
- A Catalyst project set up
- Training dataset in CSV format
- Model trained in QuickML Console
- Model endpoint key for predictions
Installation
To install this package, simply type add or install @zcatalyst/quickml using your favorite package manager:
npm install @zcatalyst/quickmlyarn add @zcatalyst/quickmlpnpm add @zcatalyst/quickml
Getting Started
Import
The Catalyst SDK is modularized by Components.
To send a request, you only need to import the QuickML:
// ES5 example
const { QuickML } = require('@zcatalyst/quickml');// ES6+ example
import { QuickML } from '@zcatalyst/quickml';Usage
To send a request, you:
- Create a QuickML Instance.
- Call the QuickML operation with input parameters.
const quickml = new QuickML();
const data = await quickml.predict('endpoint_key', {
// Enter column name and value as per your dataset
column_name1: 'value1',
column_name2: 'value2'
});Async/await
We recommend using await operator to wait for the promise returned by send operation as follows:
// async/await.
try {
const quickml = new QuickML();
const data = await quickml.predict('endpoint_key', {
// Enter column name and value as per your dataset
column_name1: 'value1',
column_name2: 'value2'
});
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}Error Handling
try {
const data = await quickml.predict('endpoint_key', {
// Enter column name and value as per your dataset
column_name1: 'value1',
column_name2: 'value2'
});
// process data.
} catch (error) {
const message = error.message;
const status = error.statusCode;
console.log({ message, status });
}Resources
Contributing
See CONTRIBUTING for more information on how to get started.
License
This SDK is distributed under the Apache License 2.0. See LICENSE file for more information.
