diff --git a/packages/@azure/cognitiveservices-luis-runtime/README.md b/packages/@azure/cognitiveservices-luis-runtime/README.md index 53a4ab635ea2..95924ed42b50 100644 --- a/packages/@azure/cognitiveservices-luis-runtime/README.md +++ b/packages/@azure/cognitiveservices-luis-runtime/README.md @@ -33,7 +33,7 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; msRestNodeAuth.interactiveLogin().then((creds) => { const client = new LUISRuntimeClient(creds, subscriptionId); - const appId = "testappId"; + const appId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a; const query = "testquery"; const timezoneOffset = 1.01; const verbose = true; @@ -83,7 +83,7 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to authManager.login(); } const client = new Azure.CognitiveservicesLuisRuntime.LUISRuntimeClient(res.creds, subscriptionId); - const appId = "testappId"; + const appId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a; const query = "testquery"; const timezoneOffset = 1.01; const verbose = true; @@ -108,6 +108,3 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to ## Related projects - [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fpackages%2F%40azure%2Fcognitiveservices-luis-runtime%2FREADME.png) diff --git a/packages/@azure/cognitiveservices-luis-runtime/lib/lUISRuntimeClient.ts b/packages/@azure/cognitiveservices-luis-runtime/lib/lUISRuntimeClient.ts index d55de41ebde8..b7d545732afc 100644 --- a/packages/@azure/cognitiveservices-luis-runtime/lib/lUISRuntimeClient.ts +++ b/packages/@azure/cognitiveservices-luis-runtime/lib/lUISRuntimeClient.ts @@ -25,8 +25,8 @@ class LUISRuntimeClient extends LUISRuntimeClientContext { * @param credentials Subscription credentials which uniquely identify client subscription. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) { - super(credentials, endpoint, options); + constructor(endpoint: string, credentials: msRest.ServiceClientCredentials, options?: msRest.ServiceClientOptions) { + super(endpoint, credentials, options); this.prediction = new operations.Prediction(this); } } diff --git a/packages/@azure/cognitiveservices-luis-runtime/lib/lUISRuntimeClientContext.ts b/packages/@azure/cognitiveservices-luis-runtime/lib/lUISRuntimeClientContext.ts index b8ca93e8fa8a..fa047d17b901 100644 --- a/packages/@azure/cognitiveservices-luis-runtime/lib/lUISRuntimeClientContext.ts +++ b/packages/@azure/cognitiveservices-luis-runtime/lib/lUISRuntimeClientContext.ts @@ -24,28 +24,28 @@ export class LUISRuntimeClientContext extends msRest.ServiceClient { * @param credentials Subscription credentials which uniquely identify client subscription. * @param [options] The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, endpoint: string, options?: msRest.ServiceClientOptions) { - if (endpoint == undefined) { - throw new Error("'endpoint' cannot be null."); + constructor(endpoint: string, credentials: msRest.ServiceClientCredentials, options?: msRest.ServiceClientOptions) { + if (endpoint === null || endpoint === undefined) { + throw new Error('\'endpoint\' cannot be null.'); } - if (credentials == undefined) { - throw new Error("'credentials' cannot be null."); + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); } if (!options) { options = {}; } - - if (!options.userAgent) { + if(!options.userAgent) { const defaultUserAgent = msRest.getDefaultUserAgentValue(); options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; } super(credentials, options); - this.baseUri = "{Endpoint}/luis/v2.0"; + this.baseUri = "{Endpoint}"; this.requestContentType = "application/json; charset=utf-8"; this.endpoint = endpoint; this.credentials = credentials; + } } diff --git a/packages/@azure/cognitiveservices-luis-runtime/lib/models/index.ts b/packages/@azure/cognitiveservices-luis-runtime/lib/models/index.ts index 93de9ea9fd06..bf39b3267796 100644 --- a/packages/@azure/cognitiveservices-luis-runtime/lib/models/index.ts +++ b/packages/@azure/cognitiveservices-luis-runtime/lib/models/index.ts @@ -1,189 +1,242 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. */ - import * as msRest from "@azure/ms-rest-js"; + /** + * @interface + * An interface representing IntentModel. * An intent detected from the utterance. + * */ export interface IntentModel { /** - * Name of the intent, as defined in LUIS. + * @member {string} [intent] Name of the intent, as defined in LUIS. */ intent?: string; /** - * Associated prediction score for the intent (float). + * @member {number} [score] Associated prediction score for the intent + * (float). */ score?: number; } /** + * @interface + * An interface representing EntityModel. * An entity extracted from the utterance. + * */ export interface EntityModel { /** - * Name of the entity, as defined in LUIS. + * @member {string} entity Name of the entity, as defined in LUIS. */ entity: string; /** - * Type of the entity, as defined in LUIS. + * @member {string} type Type of the entity, as defined in LUIS. */ type: string; /** - * The position of the first character of the matched entity within the utterance. + * @member {number} startIndex The position of the first character of the + * matched entity within the utterance. */ startIndex: number; /** - * The position of the last character of the matched entity within the utterance. + * @member {number} endIndex The position of the last character of the + * matched entity within the utterance. */ endIndex: number; /** - * Describes unknown properties. The value of an unknown property can be of "any" type. + * @property Describes unknown properties. The value of an unknown property + * can be of "any" type. */ [property: string]: any; } /** + * @interface + * An interface representing CompositeChildModel. * Child entity in a LUIS Composite Entity. + * */ export interface CompositeChildModel { /** - * Type of child entity. + * @member {string} type Type of child entity. */ type: string; /** - * Value extracted by LUIS. + * @member {string} value Value extracted by LUIS. */ value: string; } /** + * @interface + * An interface representing CompositeEntityModel. * LUIS Composite Entity. + * */ export interface CompositeEntityModel { /** - * Type/name of parent entity. + * @member {string} parentType Type/name of parent entity. */ parentType: string; /** - * Value for composite entity extracted by LUIS. + * @member {string} value Value for composite entity extracted by LUIS. */ value: string; /** - * Child entities. + * @member {CompositeChildModel[]} children Child entities. */ children: CompositeChildModel[]; } /** + * @interface + * An interface representing Sentiment. * Sentiment of the input utterance. + * */ export interface Sentiment { /** - * The polarity of the sentiment, can be positive, neutral or negative. + * @member {string} [label] The polarity of the sentiment, can be positive, + * neutral or negative. */ label?: string; /** - * Score of the sentiment, ranges from 0 (most negative) to 1 (most positive). + * @member {number} [score] Score of the sentiment, ranges from 0 (most + * negative) to 1 (most positive). */ score?: number; } /** + * @interface + * An interface representing LuisResult. * Prediction, based on the input query, containing intent(s) and entities. + * */ export interface LuisResult { /** - * The input utterance that was analyzed. + * @member {string} [query] The input utterance that was analyzed. */ query?: string; /** - * The corrected utterance (when spell checking was enabled). + * @member {string} [alteredQuery] The corrected utterance (when spell + * checking was enabled). */ alteredQuery?: string; + /** + * @member {IntentModel} [topScoringIntent] + */ topScoringIntent?: IntentModel; /** - * All the intents (and their score) that were detected from utterance. + * @member {IntentModel[]} [intents] All the intents (and their score) that + * were detected from utterance. */ intents?: IntentModel[]; /** - * The entities extracted from the utterance. + * @member {EntityModel[]} [entities] The entities extracted from the + * utterance. */ entities?: EntityModel[]; /** - * The composite entities extracted from the utterance. + * @member {CompositeEntityModel[]} [compositeEntities] The composite + * entities extracted from the utterance. */ compositeEntities?: CompositeEntityModel[]; + /** + * @member {Sentiment} [sentimentAnalysis] + */ sentimentAnalysis?: Sentiment; + /** + * @member {LuisResult} [connectedServiceResult] + */ connectedServiceResult?: LuisResult; } /** + * @interface * An interface representing EntityWithScore. + * @extends EntityModel */ export interface EntityWithScore extends EntityModel { /** - * Associated prediction score for the intent (float). + * @member {number} score Associated prediction score for the intent (float). */ score: number; } /** + * @interface * An interface representing EntityWithResolution. + * @extends EntityModel */ export interface EntityWithResolution extends EntityModel { /** - * Resolution values for pre-built LUIS entities. + * @member {any} resolution Resolution values for pre-built LUIS entities. */ resolution: any; } /** + * @interface + * An interface representing APIError. * Error information returned by the API + * */ export interface APIError { /** - * HTTP Status code + * @member {string} [statusCode] HTTP Status code */ statusCode?: string; /** - * Cause of the error. + * @member {string} [message] Cause of the error. */ message?: string; } /** + * @interface + * An interface representing PredictionResolveOptionalParams. * Optional Parameters. + * + * @extends RequestOptionsBase */ export interface PredictionResolveOptionalParams extends msRest.RequestOptionsBase { /** - * The timezone offset for the location of the request. + * @member {number} [timezoneOffset] The timezone offset for the location of + * the request. */ timezoneOffset?: number; /** - * If true, return all intents instead of just the top scoring intent. + * @member {boolean} [verbose] If true, return all intents instead of just + * the top scoring intent. */ verbose?: boolean; /** - * Use the staging endpoint slot. + * @member {boolean} [staging] Use the staging endpoint slot. */ staging?: boolean; /** - * Enable spell checking. + * @member {boolean} [spellCheck] Enable spell checking. */ spellCheck?: boolean; /** - * The subscription key to use when enabling bing spell check + * @member {string} [bingSpellCheckSubscriptionKey] The subscription key to + * use when enabling Bing spell check */ bingSpellCheckSubscriptionKey?: string; /** - * Log query (default is true) + * @member {boolean} [log] Log query (default is true) */ log?: boolean; } @@ -200,7 +253,6 @@ export type PredictionResolveResponse = LuisResult & { * The response body as text (string format) */ bodyAsText: string; - /** * The response body as parsed JSON or XML */ diff --git a/packages/@azure/cognitiveservices-luis-runtime/lib/models/mappers.ts b/packages/@azure/cognitiveservices-luis-runtime/lib/models/mappers.ts index fce7171486fd..adfb6e94ce82 100644 --- a/packages/@azure/cognitiveservices-luis-runtime/lib/models/mappers.ts +++ b/packages/@azure/cognitiveservices-luis-runtime/lib/models/mappers.ts @@ -1,9 +1,11 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. */ import * as msRest from "@azure/ms-rest-js"; diff --git a/packages/@azure/cognitiveservices-luis-runtime/lib/models/parameters.ts b/packages/@azure/cognitiveservices-luis-runtime/lib/models/parameters.ts index 064d94f1d936..22e9463631ec 100644 --- a/packages/@azure/cognitiveservices-luis-runtime/lib/models/parameters.ts +++ b/packages/@azure/cognitiveservices-luis-runtime/lib/models/parameters.ts @@ -16,7 +16,7 @@ export const appId: msRest.OperationURLParameter = { required: true, serializedName: "appId", type: { - name: "String" + name: "Uuid" } } }; diff --git a/packages/@azure/cognitiveservices-luis-runtime/lib/models/predictionMappers.ts b/packages/@azure/cognitiveservices-luis-runtime/lib/models/predictionMappers.ts index 51a31d9f8896..811d97c4ce62 100644 --- a/packages/@azure/cognitiveservices-luis-runtime/lib/models/predictionMappers.ts +++ b/packages/@azure/cognitiveservices-luis-runtime/lib/models/predictionMappers.ts @@ -1,19 +1,22 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. */ export { - APIError, - CompositeChildModel, - CompositeEntityModel, + LuisResult, + IntentModel, EntityModel, - EntityWithResolution, + CompositeEntityModel, + CompositeChildModel, + Sentiment, + APIError, EntityWithScore, - IntentModel, - LuisResult, - Sentiment + EntityWithResolution } from "../models/mappers"; + diff --git a/packages/@azure/cognitiveservices-luis-runtime/package.json b/packages/@azure/cognitiveservices-luis-runtime/package.json index 72b0c12318c2..7364fde60a59 100644 --- a/packages/@azure/cognitiveservices-luis-runtime/package.json +++ b/packages/@azure/cognitiveservices-luis-runtime/package.json @@ -4,7 +4,7 @@ "description": "LUISRuntimeClient Library with typescript type definitions for node.js and browser.", "version": "2.0.0", "dependencies": { - "@azure/ms-rest-js": "^1.6.0", + "@azure/ms-rest-js": "^1.2.0", "tslib": "^1.9.3" }, "keywords": [ @@ -43,7 +43,6 @@ "esm/**/*.d.ts", "esm/**/*.d.ts.map", "lib/**/*.ts", - "README.md", "rollup.config.js", "tsconfig.json" ], @@ -52,6 +51,5 @@ "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/cognitiveservices-luis-runtime.js.map'\" -o ./dist/cognitiveservices-luis-runtime.min.js ./dist/cognitiveservices-luis-runtime.js", "prepack": "npm install && npm run build" }, - "sideEffects": false, - "autoPublish": true + "sideEffects": false }