@hydra.ai/hydra-client

0.2.1 • Public • Published

@hydra.ai/hydra-client

hydra.ai makes it easy to use A.I. inside workflows and your apps. You can use hydra.ai for text classification, named entity recognition and senitment analysis. You can create your own A.I. models or use some of our pre-built models.

Installation

npm

npm install @hydra.ai/hydra-client --save

Getting Started

  1. If you haven't already, create your free hydra account.
  2. Follow this guide to build your first model. It covers the steps for creating a pre-trained sentiment analysis model.
  3. Copy your API key, workspace ID, and model ID
import hydra from '@hydra.ai/hydra-client'
const { ApiClient, ModelService, PredictionRequest } = hydra

const client = new ApiClient('YOUR_API_KEY')
const model = new ModelService(client)
let workspaceId = 'YOUR_WORKSPACE_ID'
let modelId = 'YOUR_MODEL_ID'
let predictionRequest = new PredictionRequest('YOUR_TEXT_INPUT_FOR_SENTIMENT_ANALYSIS')

model.predict(workspaceId, modelId, predictionRequest, (error, data, response) => {
  if (error) {
    console.error(error)
  } else {
    console.log('API called successfully. Returned data: ' + JSON.stringify(data));
    console.log(response.status)
  }
});

/@hydra.ai/hydra-client/

    Package Sidebar

    Install

    npm i @hydra.ai/hydra-client

    Weekly Downloads

    0

    Version

    0.2.1

    License

    MIT

    Unpacked Size

    72.5 kB

    Total Files

    11

    Last publish

    Collaborators

    • hpieris