@softforte/lu
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

lu

Simple .lu format validator based on @microsoft/bf-lu library

oclif Version Downloads/week License

Introduction

Preparing LUIS training data by hand in the form of .lu files can get daunting quickly. Even though the Bot Framework Composer provides their validation, it is often hard to know exactly where the typo is. This simple command-line utility uses the same @microsoft/bf-lu parsing and validation library as does the Composer, but shows any errors more explicitly. To validate an .lu file just type:

$lu <path to .lu file>

Other times, even when the @microsoft/bf-lu validator is satisfied, the LUIS service may not be. To make sure a valid LUIS application can be created from the given .lu file, use this command:

$lu <path to .lu file> -l -k=<authoring_key> 

Upon completion of local validation it will connect to the LUIS service and attempt to create a temporary LUIS app using the contents of the .lu file. If creation of the temporary app succeeds then the app will be deleted automatically and validation will succeed. Otherwise, a detailed error message will be shown.

Installation

Install the tool using the following command:

$ npm install -g @softforte/lu

Configuration

The following additional configuration is only needed if you intend to validate the .lu file against LUIS service. Default cofiguration values are stored in the .env file and look as follows:

# Base URL of LUIS REST API
LUIS_APP_BASE_URL=https://westus.api.cognitive.microsoft.com

# REST API command path to import a temporary application
LUIS_APP_PATH_IMPORT=/luis/authoring/v3.0-preview/apps/import

# REST API command path to delete a temporary application
LUIS_APP_PATH_DELETE=/luis/authoring/v3.0-preview/apps

# Prefix of temporary LUIS application name (the suffix is randomly generated)
LUIS_APP_NAME_PREFIX=tmp-lu-validation

The .env file is located inside the root directory the @softforte/lu package resides in. For global installations (-g flag) on most systems this file would be under /usr/local/lib/node_modules/@softforte/lu. On Windows it would normally be in %AppData%\npm\node_modules\@softforte\lu directory. These values could also be set as environment variables, in which case they would take precedence over the contents of the .env file. For more information see dotenv npm package documentation.

Typically you would only want to change the value of LUIS_APP_BASE_URL in there to match that of the Endpoint value on the Keys and Endpoint tab of the LUIS authoring resource in your Azure tenant.

Usage

$ lu [FILE]

ARGUMENTS
  FILE    <path to .lu file>

OPTIONS
  -h, --help                   show CLI help
  -k, --key=authoring_key      LUIS authoring key required when using --luis/-l option
  -l, --luis                   validates the ability to import parsed .lu file to a temporary LUIS application
  -o, --out=file               file path to save the generated JSON to
  -v, --version                show CLI version

LUIS authoring key is used for connecting to the LUIS authornig resource via REST API. You can optionally save the JSON representation of the model to a file using the -o option with a path to persist the JSON to.

Readme

Keywords

Package Sidebar

Install

npm i @softforte/lu

Weekly Downloads

6

Version

1.0.5

License

MIT

Unpacked Size

19.8 kB

Total Files

8

Last publish

Collaborators

  • softforte