Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

[AutoPR] cognitiveservices/data-plane/LUIS/Runtime #4600

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions lib/services/luis/runtime/.scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

const resetColor = "\x1b[0m";
const brightColor = "\x1b[1m";
const highlightColor = "\x1b[31m";

try {
const invisibleCharactersLength = resetColor.length + brightColor.length + highlightColor.length;

const firstLine = `Active development of this SDK has been moved to ${highlightColor}@azure/cognitiveservices-luis-runtime${resetColor}${brightColor} package.`;
const secondLine = "This package is in maintenance mode and will be deprecated in July 2018.";
const thirdLine = "Visit https://aka.ms/azure-sdk-for-js-migration for more information.";

const framePadding = 4;
const adjustedFirstLineLength = firstLine.length - invisibleCharactersLength;
const width = Math.max(adjustedFirstLineLength, secondLine.length, thirdLine.length) + framePadding;
const getPaddingLength = (strLength) => width - strLength - framePadding;

const firstLinePaddingLength = getPaddingLength(adjustedFirstLineLength);
const secondLinePaddingLength = getPaddingLength(secondLine.length);
const thirdLinePaddingLength = getPaddingLength(thirdLine.length);
const line = "#".repeat(width);

const formatTextLine = (text, padding) => `#${" ".repeat(Math.floor(padding / 2))} ${text} ${" ".repeat(Math.ceil(padding / 2))}#`;

console.log(brightColor);
console.log("\n" + line);
console.log(formatTextLine(firstLine, firstLinePaddingLength));
console.log(formatTextLine(secondLine, secondLinePaddingLength));
console.log(formatTextLine(thirdLine, thirdLinePaddingLength));
console.log(line + "\n");
console.log(resetColor);
} catch (err) {
// ignore
}
42 changes: 21 additions & 21 deletions lib/services/luis/runtime/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The MIT License (MIT)
Copyright (c) 2019 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
105 changes: 53 additions & 52 deletions lib/services/luis/runtime/README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
---
uid: azure-cognitiveservices-luis-runtime
summary: *content

---
**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.**
## Microsoft Azure SDK for Node.js - LUISRuntimeClient

This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**

### Features


### How to Install

```bash
npm install azure-cognitiveservices-luis-runtime
```

### How to use

#### Authentication, client creation, and resolve prediction as an example.

```javascript
const msRest = require("ms-rest");
const LUISRuntimeClient = require("azure-cognitiveservices-luis-runtime");
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const subscriptionId = "<Subscription_Id>";
const client = new LUISRuntimeClient(creds, subscriptionId);
const appId = "testappId";
const query = "testquery";
const timezoneOffset = 1.01;
const verbose = true;
const staging = true;
const spellCheck = true;
const bingSpellCheckSubscriptionKey = "testbingSpellCheckSubscriptionKey";
const log = true;

client.prediction.resolve(appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.dir(err, {depth: null, colors: true});
});
```

### Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
---
uid: azure-cognitiveservices-luis-runtime
summary: *content

---
**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://www.npmjs.com/package/@azure/cognitiveservices-luis-runtime) which works on Node.js and browsers.**
**See https://aka.ms/azure-sdk-for-js-migration to learn more.**
## Microsoft Azure SDK for Node.js - LUISRuntimeClient

This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**

### Features


### How to Install

```bash
npm install azure-cognitiveservices-luis-runtime
```

### How to use

#### Authentication, client creation, and resolve prediction as an example.

```javascript
const msRest = require("ms-rest");
const LUISRuntimeClient = require("azure-cognitiveservices-luis-runtime");
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const subscriptionId = "<Subscription_Id>";
const client = new LUISRuntimeClient(creds, subscriptionId);
const appId = "testappId";
const query = "testquery";
const timezoneOffset = 1.01;
const verbose = true;
const staging = true;
const spellCheck = true;
const bingSpellCheckSubscriptionKey = "testbingSpellCheckSubscriptionKey";
const log = true;

client.prediction.resolve(appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error occurred:');
console.dir(err, {depth: null, colors: true});
});
```

### Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
3 changes: 2 additions & 1 deletion lib/services/luis/runtime/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export interface Sentiment {
*/
export interface LuisResult {
/**
* The input utterance that was analized.
* The input utterance that was analyzed.
*/
query?: string;
/**
Expand All @@ -120,6 +120,7 @@ export interface LuisResult {
*/
compositeEntities?: CompositeEntityModel[];
sentimentAnalysis?: Sentiment;
connectedServiceResult?: LuisResult;
}

export interface EntityWithScore extends EntityModel {
Expand Down
11 changes: 10 additions & 1 deletion lib/services/luis/runtime/lib/models/luisResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class LuisResult {
/**
* Create a LuisResult.
* @property {string} [query] The input utterance that was analized.
* @property {string} [query] The input utterance that was analyzed.
* @property {string} [alteredQuery] The corrected utterance (when spell
* checking was enabled).
* @property {object} [topScoringIntent]
Expand All @@ -35,6 +35,7 @@ class LuisResult {
* sentiment, can be positive, neutral or negative.
* @property {number} [sentimentAnalysis.score] Score of the sentiment,
* ranges from 0 (most negative) to 1 (most positive).
* @property {object} [connectedServiceResult]
*/
constructor() {
}
Expand Down Expand Up @@ -139,6 +140,14 @@ class LuisResult {
name: 'Composite',
className: 'Sentiment'
}
},
connectedServiceResult: {
required: false,
serializedName: 'connectedServiceResult',
type: {
name: 'Composite',
className: 'LuisResult'
}
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions lib/services/luis/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "azure-cognitiveservices-luis-runtime",
"author": "Microsoft Corporation",
"description": "LUISRuntimeClient Library with typescript type definitions for node",
"version": "1.1.1",
"version": "1.2.0",
"dependencies": {
"ms-rest": "^2.3.3"
"ms-rest": "^2.5.0"
},
"keywords": [
"node",
Expand All @@ -20,5 +20,8 @@
},
"bugs": {
"url": "https://github.com/azure/azure-sdk-for-node/issues"
},
"scripts": {
"postinstall": "node .scripts/postinstall.js"
}
}