Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

orchestrator-core

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orchestrator-core - npm Package Compare versions

Comparing version 4.11.0-dev.20201008.cb67719 to 4.11.0-dev.20201019.99b4b50

74

oc_app.js
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
function buf2hex(buffer) { // buffer is an ArrayBuffer

@@ -9,3 +8,2 @@ return Array.prototype.map.call(new Uint8Array(buffer), x => ('00' + x.toString(16)).slice(-2)).join(' ');

const oc = require('./orchestrator-core.node');

@@ -15,13 +13,13 @@ const util = require('util')

async function addExamples() {
console.log('Create Orchestrator..')
console.log('---- Create Orchestrator..')
const orchestrator = new oc.Orchestrator();
console.log('Loading NLR..')
const load_result = orchestrator.load('../dep/model'); // Return boolean, separate load.
console.log('---- Loading NLR..')
const load_result = orchestrator.load('../dep/model/roberta'); // Return boolean, separate load.
if (load_result === false)
{
console.log('Loading NLR failed!!');
console.log('ERROR: Loading NLR failed!!');
}
console.log('Creating labeler..');
console.log('---- Creating labeler..');
let labeler = orchestrator.createLabelResolver();

@@ -35,3 +33,3 @@

{
console.log("Set runtime params successfully!")
console.log("SUCCESS: set runtime params successfully!")
}

@@ -55,10 +53,10 @@ else

console.log('Adding example COMPLEX..');
console.log('---- Adding example COMPLEX..');
var val = labeler.addExample(example);
if (val == true)
{
console.log('Added example!');
console.log('SUCCESS: added example - 0!');
}
console.log('Adding Labels array.')
console.log('---- Adding Labels array.')
const example_multi_single = {

@@ -78,3 +76,3 @@ text: 'another book a flight to miami.',

{
console.log('Added example2!');
console.log('SUCCESS: added example - 1!');
}

@@ -104,3 +102,3 @@ const example_multi_label = {

{
console.log('Added example2!');
console.log('SUCCESS: added example - 2!');
}

@@ -114,3 +112,3 @@ const example2 = {

{
console.log('Added example2!');
console.log('SUCCESS: added example - 3!');
}

@@ -124,13 +122,22 @@ const example3 = {

{
console.log('Added example3!');
console.log('SUCCESS: added example3 - 4!');
}
//
// Score
//
console.log('---- Scoring')
var results = labeler.score("hey");
console.log(util.inspect(results, true, null, true /* enable colors */));
//
// Score
//
console.log('---- Creating Snapshot')
var snapshot = labeler.createSnapshot();
console.log('Created snapshot!');
console.log('Going to create labeler #2');
console.log('SUCCESS: created snapshot!');
console.log('---- Going to create labeler #2');
let labeler2 = orchestrator.createLabelResolver(snapshot);
console.log('Created Labeler #2.');
console.log('SUCCESS: created Labeler #2.');

@@ -140,3 +147,3 @@ //

//
console.log('Getting examples')
console.log('---- Getting examples')
let examples = labeler2.getExamples();

@@ -147,2 +154,3 @@ console.log(util.inspect(examples, true, null, true /* enable colors */));

//
console.log('---- Removing examples')
labeler2.removeExample(example3);

@@ -155,17 +163,23 @@ examples = labeler2.getExamples();

//
console.log('---- Get Labels');
var labels = labeler2.getLabels();
console.log(util.inspect(labels, true, null, true /* enable colors */));
//
// Get Intent Labels
//
console.log('---- Get Intent Labels');
var labels = labeler2.getLabels(1);
console.log(util.inspect(labels, true, null, true /* enable colors */));
}
addExamples();
const readline = require('readline');
const rl = readline.createInterface({ input: process.stdin, output: process.stdout});
rl.question('>', (answer) => {
console.log('Completed embedding:')
console.log(buf2hex(embedding))
rl.close();
});
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== const readline = require('readline');
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== const rl = readline.createInterface({ input: process.stdin, output: process.stdout});
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ====
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== rl.question('>', (answer) => {
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== console.log('Completed embedding:')
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== console.log(buf2hex(embedding))
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== rl.close();
// ==== TODO-CANNOT-GET-embedding-FROM-ABI ==== });

@@ -5,3 +5,3 @@ {

"description": "Orchestrator for Node.js",
"version": "4.11.0-dev.20201008.cb67719",
"version": "4.11.0-dev.20201019.99b4b50",
"license": "MIT",

@@ -27,3 +27,4 @@ "keywords": [

"node-gyp": "7.0.0",
"node-pre-gyp": "0.15.0"
"node-pre-gyp": "0.15.0",
"onnxruntime": "1.4.0"
},

@@ -45,3 +46,3 @@ "binary": {

"test": "nyc mocha tests/",
"start": "cross-env OC_MODEL_DIR='../dep/model/' node oc_app.js",
"start": "cross-env OC_MODEL_DIR='../dep/model/roberta/' node oc_app.js",
"build:dev": "node-gyp -j 16 build --debug",

@@ -48,0 +49,0 @@ "build": "node-gyp -j 16 build",

@@ -188,2 +188,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

assert.ok(examples.length === 601, `#examples is ${examples.length}`);
const labels = labelResolver.getLabels();
console.log(`DEBUGGING - nodejs - orchestrator-core: labels=${labels}`);
console.log(`DEBUGGING - nodejs - orchestrator-core: labels.length=${labels.length}`);
assert.ok(labels.length === 15, `#labels is ${labels.length}`);
const labelsIntent = labelResolver.getLabels(1);
console.log(`DEBUGGING - nodejs - orchestrator-core: labelsIntent=${labelsIntent}`);
console.log(`DEBUGGING - nodejs - orchestrator-core: labelsIntent.length=${labelsIntent.length}`);
assert.ok(labelsIntent.length === 15, `#labelsIntent is ${labelsIntent.length}`);
});

@@ -190,0 +198,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc