LuisRecognizer class
Recognize intents in a user utterance using a configured LUIS model.
Constructors
Luis |
Creates a new LuisRecognizer instance. |
Luis |
Creates a new LuisRecognizer instance. |
Luis |
Creates a new LuisRecognizer instance. |
Properties
log |
Gets a value indicating whether determines whether to log personal information that came from the user. |
telemetry |
Gets the currently configured BotTelemetryClient that logs the events. |
Methods
recognize(Dialog |
Calls LUIS to recognize intents and entities in a users utterance. |
recognize(string, Luis |
Calls LUIS to recognize intents and entities in a users utterance. |
sorted |
Sorts recognizer result intents in ascending order by score, filtering those that
have scores less that |
top |
Returns the name of the top scoring intent from a set of LUIS results. |
Constructor Details
LuisRecognizer(LuisApplication | string, LuisRecognizerOptionsV3 | LuisRecognizerOptionsV2)
Creates a new LuisRecognizer instance.
new LuisRecognizer(application: LuisApplication | string, options?: LuisRecognizerOptionsV3 | LuisRecognizerOptionsV2)
Parameters
- application
-
LuisApplication | string
The LUIS application endpoint, usually retrieved from https://luis.ai.
Optional. Options object used to control predictions. Should conform to the LuisPredictionOptions definition.
LuisRecognizer(LuisApplication, LuisPredictionOptions, boolean)
Creates a new LuisRecognizer instance.
new LuisRecognizer(application: LuisApplication, options?: LuisPredictionOptions, includeApiResults?: boolean)
Parameters
- application
- LuisApplication
The LUIS application endpoint, usually retrieved from https://luis.ai.
- options
- LuisPredictionOptions
Optional. Options object used to control predictions. Should conform to the LuisPredictionOptions definition.
- includeApiResults
-
boolean
(Deprecated) Flag that if set to true
will force the inclusion of LUIS Api call in results returned by the LuisRecognizer.recognize method. Defaults to a value of false
.
LuisRecognizer(string, LuisPredictionOptions, boolean)
Creates a new LuisRecognizer instance.
new LuisRecognizer(application: string, options?: LuisPredictionOptions, includeApiResults?: boolean)
Parameters
- application
-
string
The LUIS application endpoint, usually retrieved from https://luis.ai.
- options
- LuisPredictionOptions
Optional. Options object used to control predictions. Should conform to the LuisPredictionOptions definition.
- includeApiResults
-
boolean
(Deprecated) Flag that if set to true
will force the inclusion of LUIS Api call in results returned by the LuisRecognizer.recognize method. Defaults to a value of false
.
Property Details
logPersonalInformation
Gets a value indicating whether determines whether to log personal information that came from the user.
boolean logPersonalInformation
Property Value
boolean
True if will log personal information into the BotTelemetryClient.TrackEvent method; otherwise the properties will be filtered.
telemetryClient
Gets the currently configured BotTelemetryClient that logs the events.
BotTelemetryClient telemetryClient
Property Value
BotTelemetryClient
Currently configured BotTelemetryClient that logs the LuisResult event.
Method Details
recognize(DialogContext | TurnContext, Record<string, string>, Record<string, number>, LuisRecognizerOptionsV2 | LuisRecognizerOptionsV3 | LuisPredictionOptions)
Calls LUIS to recognize intents and entities in a users utterance.
function recognize(context: DialogContext | TurnContext, telemetryProperties?: Record<string, string>, telemetryMetrics?: Record<string, number>, options?: LuisRecognizerOptionsV2 | LuisRecognizerOptionsV3 | LuisPredictionOptions): Promise<RecognizerResult>
Parameters
- context
-
DialogContext | TurnContext
Context for the current turn of conversation with the use.
- telemetryProperties
-
Record<string, string>
Additional properties to be logged to telemetry with the LuisResult event.
- telemetryMetrics
-
Record<string, number>
Additional metrics to be logged to telemetry with the LuisResult event.
(Optional) options object used to override control predictions. Should conform to the [LuisRecognizerOptionsV2] or [LuisRecognizerOptionsV3] definition.
Returns
Promise<RecognizerResult>
A promise that resolved to the recognizer result.
recognize(string, LuisRecognizerOptionsV2 | LuisRecognizerOptionsV3 | LuisPredictionOptions)
Calls LUIS to recognize intents and entities in a users utterance.
function recognize(utterance: string, options?: LuisRecognizerOptionsV2 | LuisRecognizerOptionsV3 | LuisPredictionOptions): Promise<RecognizerResult>
Parameters
- utterance
-
string
The utterance to be recognized.
(Optional) options object used to override control predictions. Should conform to the [LuisRecognizerOptionsV2] or [LuisRecognizerOptionsV3] definition.
Returns
Promise<RecognizerResult>
sortedIntents(RecognizerResult, number)
Sorts recognizer result intents in ascending order by score, filtering those that
have scores less that minScore
.
static function sortedIntents(result?: RecognizerResult, minScore?: number): Array<{ intent: string, score: number }>
Parameters
- result
-
RecognizerResult
recognizer result to be sorted and filtered
- minScore
-
number
minimum score threshold, lower score results will be filtered
Returns
Array<{ intent: string, score: number }>
} sorted result intents
topIntent(RecognizerResult, string, number)
Returns the name of the top scoring intent from a set of LUIS results.
static function topIntent(results?: RecognizerResult, defaultIntent?: string, minScore?: number): string
Parameters
- results
-
RecognizerResult
Result set to be searched.
- defaultIntent
-
string
(Optional) intent name to return should a top intent be found. Defaults to a value of None
.
- minScore
-
number
(Optional) minimum score needed for an intent to be considered as a top intent. If all intents in the set are below this threshold then the defaultIntent
will be returned. Defaults to a value of 0.0
.
Returns
string
the top intent