Skip to main content

Partner SDK v3.3

JavaScript/TypeScript SDK for OTTO integration. OTTOClient with streamAsk(), nlpCapabilities(), and executeAction(). FastLearningClient for data ingestion.

Installation

npm install @brainpredict/otto-sdk
# or
yarn add @brainpredict/otto-sdk

OTTOClient

import { OTTOClient } from '@brainpredict/otto-sdk';

const otto = new OTTOClient({
  baseUrl:  'http://your-otto-server:6670',
  apiKey:   'bp_otto_live_xxxx',
  tenantId: 'acme-corp',
});

// JSON response
const card = await otto.ask('what is our Q1 profitability?');

// SSE streaming
await otto.streamAsk(
  'simulate next quarter revenue',
  chunk => process.stdout.write(chunk),
  card  => console.log(card.brain_score)
);

// NLP diagnostics
const nlp = await otto.nlpCapabilities();
// { classifier_backend: 'sbert', benchmark_accuracy: 100, domain_count: 17 }

// Fast Learning
await otto.learn({ domain: 'SALES', label: 'Q1 KPIs', data: { revenue: '€47M' } });

// Execute Action
await otto.executeAction({ action: 'Approve Q2 plan', platform: 'FINANCE', severity: 'high' });

FastLearningClient

import { FastLearningClient } from '@brainpredict/otto-sdk';

const learner = new FastLearningClient({ baseUrl: 'http://your-otto-server:6670' });
await learner.ingest('FINANCE', 'Q1 Actuals', { ebitda: '25%', cash: '€28.4M' });
const status = await learner.status();

Constants

import { OTTO_SDK_VERSION, OTTO_SUPPORTED_DOMAINS,
         OTTO_NLP_BENCHMARK_ACC, OTTO_NLP_CLASSIFIER,
         OTTO_NER_MODEL } from '@brainpredict/otto-sdk';

// OTTO_SDK_VERSION        = "3.3.0"
// OTTO_SUPPORTED_DOMAINS  = 17
// OTTO_NLP_BENCHMARK_ACC  = 100
// OTTO_NLP_CLASSIFIER     = "sentence-transformers/all-MiniLM-L6-v2"
// OTTO_NER_MODEL          = "en_core_web_trf"