orchestrator-core
Advanced tools
Comparing version 4.10.0-dev.20200814.975fe7b to 4.10.0-dev.20200821.2454b18
@@ -5,3 +5,3 @@ { | ||
"description": "Orchestrator for Node.js", | ||
"version": "4.10.0-dev.20200814.975fe7b", | ||
"version": "4.10.0-dev.20200821.2454b18", | ||
"license": "MIT", | ||
@@ -37,3 +37,4 @@ "keywords": [ | ||
"mocha": "^5.2.0", | ||
"nyc": "^15.0.0" | ||
"nyc": "^15.0.0", | ||
"fast-text-encoding": "^1.0.3" | ||
}, | ||
@@ -40,0 +41,0 @@ "scripts": { |
@@ -1,3 +0,70 @@ | ||
# Orchestrator for node.js | ||
# orchestrator-core | ||
Bot Framework Orchestrator component. | ||
This package contains Orchestrator APIs for Node.js. Orchestrator is a [transformer](https://en.wikipedia.org/wiki/Transformer_(machine_learning_model)) based solution for language understanding (LU) needs that is heavily optimized for conversational AI applications. It is built ground-up to run locally with your bot or application. | ||
## Prerequisite | ||
Install Bot Framework Orchestrator CLI to download natural language representation model needed to use this library. | ||
```bash | ||
npm install -g @microsoft/bf-orchestrator-cli | ||
``` | ||
## Install | ||
```bash | ||
npm install -g orchestrator-core | ||
``` | ||
## Examples | ||
``` | ||
const oc: any = require('orchestrator-core'); | ||
const orchestrator = new oc.Orchestrator(); | ||
// use bf cli orchestrator:nlr:get command to download Orchestrator model and | ||
// set nlrPath to where the model is downloaded to locally | ||
if (!orchestrator.loadAsync(nlrPath)) { | ||
throw new Error('Failed loading Orchestrator model'); | ||
} | ||
const example2 = { | ||
label: 'schedule', | ||
text: 'when is my next appointment?', | ||
}; | ||
val = labeler.addExample(example2); | ||
if (val == true) | ||
{ | ||
console.log('Added example2!'); | ||
} | ||
const example3 = { | ||
label: 'greeting', | ||
text: 'hello there!', | ||
}; | ||
val = labeler.addExample(example3); | ||
if (val == true) | ||
{ | ||
console.log('Added example3!'); | ||
} | ||
var results = labeler.score("hey"); | ||
console.log(JSON.stringify(results, null, 4)); | ||
var snapshot = labeler.createSnapshot(); | ||
// Create labeler initialized with previously created snapshot | ||
let labeler2 = orchestrator.createLabelResolver(snapshot); | ||
// Get Examples | ||
let examples = labeler2.getExamples(); | ||
// Remove Example | ||
labeler2.removeExample(example3); | ||
// examples should no longer have example3 | ||
examples = labeler2.getExamples(); | ||
// Get Labels | ||
var labels = labeler2.getLabels(); | ||
``` |
@@ -5,4 +5,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. | ||
const assert = require('assert'); | ||
const oc = require('../build/orchestrator-core.node'); | ||
const path = require('path'); | ||
const oc = require('../orchestrator-core.node'); | ||
const path = require('path'); | ||
require('fast-text-encoding'); | ||
@@ -125,4 +126,3 @@ // Finds onnx model | ||
const snapshotContent = new TextEncoder().encode(fs.readFileSync(snapshotPath)); | ||
const snapshotContent = new TextEncoder().encode(fs.readFileSync(snapshotPath, 'utf8')); | ||
assert.ok(snapshotContent.length > 0, `snapshot content length is ${snapshotContent.length}`); | ||
@@ -129,0 +129,0 @@ const labelResolver = orchestrator.createLabelResolver(snapshotContent); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
464105
28
325
70
4