用于语言理解 (LUIS) 的 SDK、REST 和 CLI 开发人员资源

重要

语言理解智能服务(LUIS)将于 2026 年 3 月 31 日完全停用。 LUIS 资源创建不可用。 从 2025 年 10 月 31 日开始,LUIS 门户将不再可用。 建议将 LUIS 应用程序迁移对话语言理解,以便从持续的产品支持和多语言功能中受益。

SDK、REST API、CLI 用于以编程语言开发语言理解 (LUIS) 应用。 管理 Azure 资源和 LUIS 预测。

Azure 资源管理

使用 Azure AI 服务的管理层来创建、编辑、列出和删除语言理解或 Azure AI 服务资源。

根据以下工具来查找参考文档:

语言理解创作和预测请求

可以从需要创建的 Azure 资源访问语言理解服务。 有两个资源:

  • Use the authoring resource for training to create, edit, train, and publish.
  • Use the prediction for runtime to send user's text and receive a prediction.

使用 Azure AI 服务示例代码,了解并使用最常见的任务。

REST specifications

GitHub 上公开提供 LUIS REST 规范以及所有 Azure REST 规范

REST APIs

创作终结点 API 和预测终结点 API 都可在 REST API 中使用:

类型 Version
Authoring V2
preview V3
Prediction V2
V3

REST Endpoints

LUIS 目前有 2 种类型的终结点:

  • authoring on the training endpoint
  • query prediction on the runtime endpoint.
Purpose URL
在训练终结点上进行 V2 创作 https://{your-resource-name}.api.cognitive.azure.cn/luis/api/v2.0/apps/{appID}/
在训练终结点上进行 V3 创作 https://{your-resource-name}.api.cognitive.azure.cn/luis/authoring/v3.0-preview/apps/{appID}/
V2 预测 - 运行时终结点上的所有预测 https://{your-resource-name}.api.cognitive.azure.cn/luis/v2.0/apps/{appId}?q={q}[&timezoneOffset][&verbose][&spellCheck][&staging][&bing-spell-check-subscription-key][&log]
V3 预测 - 运行时终结点上的版本预测 https://{your-resource-name}.api.cognitive.azure.cn/luis/prediction/v3.0/apps/{appId}/versions/{versionId}/predict?query={query}[&verbose][&log][&show-all-intents]
V3 预测 - 运行时终结点上的槽预测 https://{your-resource-name}.api.cognitive.azure.cn/luis/prediction/v3.0/apps/{appId}/slots/{slotName}/predict?query={query}[&verbose][&log][&show-all-intents]

下表说明了上表中用大括号 {} 表示的参数。

Parameter Purpose
your-resource-name Azure 资源名称
qquery 从客户端应用程序(如聊天机器人)发送的话语文本
version 10 字符版本名称
slot productionstaging

REST 查询字符串参数

V3 API 查询字符串参数包括:

Query parameter LUIS 门户名称 类型 Version Default Purpose
log Save logs boolean V2 和 V3 false 将查询存储在日志文件中。 默认值为 false。
query - 字符串 V3 only 无默认值 - 在 GET 请求中是必需的 In V2, the utterance to be predicted is in the q parameter.

In V3, the functionality is passed in the query parameter.
show-all-intents 包括所有意向的分数 boolean V3 only false Return all intents with the corresponding score in the prediction.intents object. 意向将在父 intents 对象中作为对象返回。 这样,便可以通过编程方式进行访问,而无需在数组中查找意向:prediction.intents.give。 在 V2 中,这些意向在数组中返回。
verbose 包括更多实体详细信息 boolean V2 和 V3 false In V2, when set to true, all predicted intents were returned. 如果需要所有预测的意向,请使用 V3 参数 show-all-intents

In V3, this parameter only provides entity metadata details of entity prediction.
timezoneOffset - 字符串 V2 - 应用于 datetimeV2 实体的时区。
datetimeReference - 字符串 V3 - Timezone applied to datetimeV2 entities. 替换 V2 中的 timezoneOffset

App schema

The app schema is imported and exported in a .json or .lu format.

Language-based SDKs

容器

Language Understanding (LUIS) provides a container to provide on-premises and contained versions of your app.

导出和导入格式

Language Understanding provides the ability to manage your app and its models in a JSON format, the .LU (LUDown) format, and a compressed package for the Language Understanding container.

可以通过 API 和 LUIS 门户导入和导出这些格式。 此门户通过“应用”列表和“版本”列表提供导入和导出功能。

Workshops

Bot Framework 工具

The bot framework is available as an SDK in a variety of languages.

Bot framework provides several tools to help with Language Understanding, including:

  • Bot Framework Emulator - 一款桌面应用程序,可让机器人开发人员测试和调试使用 Bot Framework SDK 构建的机器人。
  • Bot Framework Composer - 一个集成开发工具,供开发人员和多学科团队通过 Microsoft Bot Framework 构建机器人和聊天体验
  • Bot Framework 示例 - 使用 #C、JavaScript、TypeScript 和 Python 编写

Next steps