Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR cognitiveservices/data-plane/LUIS/Runtime] LUIS runtime changes #2073

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
7 changes: 2 additions & 5 deletions packages/@azure/cognitiveservices-luis-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
}
118 changes: 85 additions & 33 deletions packages/@azure/cognitiveservices-luis-runtime/lib/models/index.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Expand All @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const appId: msRest.OperationURLParameter = {
required: true,
serializedName: "appId",
type: {
name: "String"
name: "Uuid"
}
}
};
Expand Down
Loading