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 #1636

Closed
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
Generated from faaca6c0dec3efe45b35a48607afa09ed360645a
LUIS runtime changes
  • Loading branch information
AutorestCI committed Mar 19, 2019
commit 0471fcf21e1e95afe30a1a68d7ae1433d90db468
15 changes: 8 additions & 7 deletions packages/@azure/cognitiveservices-luis-runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new LUISRuntimeClient(creds, subscriptionId);
const appId = "testappId";
const azureRegion = "westus";
const azureCloud = "com";
const appId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a;
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) => {
client.prediction.resolve(azureRegion, azureCloud, appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log).then((result) => {
console.log("The result is:");
console.log(result);
});
Expand Down Expand Up @@ -83,15 +85,17 @@ 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 azureRegion = "westus";
const azureCloud = "com";
const appId = ec7b1657-199d-4d8a-bbb2-89a11a42e02a;
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) => {
client.prediction.resolve(azureRegion, azureCloud, appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand All @@ -108,6 +112,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 @@ -20,13 +20,11 @@ class LUISRuntimeClient extends LUISRuntimeClientContext {

/**
* Initializes a new instance of the LUISRuntimeClient class.
* @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
* https://westus.api.cognitive.microsoft.com).
* @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(credentials: msRest.ServiceClientCredentials, options?: msRest.ServiceClientOptions) {
super(credentials, options);
this.prediction = new operations.Prediction(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,31 @@ const packageName = "@azure/cognitiveservices-luis-runtime";
const packageVersion = "2.0.0";

export class LUISRuntimeClientContext extends msRest.ServiceClient {
endpoint: string;
credentials: msRest.ServiceClientCredentials;

/**
* Initializes a new instance of the LUISRuntimeClientContext class.
* @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
* https://westus.api.cognitive.microsoft.com).
* @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.");
}
if (credentials == undefined) {
throw new Error("'credentials' cannot be null.");
constructor(credentials: msRest.ServiceClientCredentials, options?: msRest.ServiceClientOptions) {
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 = "http://{AzureRegion}.api.cognitive.microsoft.{AzureCloud}";
this.requestContentType = "application/json; charset=utf-8";
this.endpoint = endpoint;
this.credentials = credentials;

}
}
Loading