跳转到主要内容

热门内容

今日:


总体:


最近浏览:


Chinese, Simplified

category

技能清单是一个JSON文件,它描述了技能可以采取的操作、其输入和输出参数以及技能的端点。清单包含机器可读信息,开发人员可以使用该信息从另一个机器人访问技能。

本文描述了Bot框架技能清单模式的支持版本。

Version Notes
version 2.2 Updated some URI properties to accept URI references.
version 2.1 Adds ability to describe proactive activities the skill can send and the dispatch models the skill uses.
version 2.0 Initial version.


Bot框架技能清单模式使用JSON模式词汇表的草案7。

先决条件

技能清单


技能清单包含不同类别的信息:

  • 在一般级别上描述技能的元数据。
  • 技能提供的端点列表。
  • 技能可以接收和主动发送的活动的可选列表。
  • 一个可选的定义对象,包含文档其他部分引用的对象的模式。
  • 技能支持的调度模型的可选列表。


v2.2

下表描述了Bot Framework技能清单v2.2的完整模式。

Category/Field Type/Format Required Description
Metadata      
$id String Required The identifier for the skill manifest.
$schema String/URI Required The HTTPS URI of a JSON schema resource that describes the format of the manifest. For version 2.2, the URI is https://schemas.botframework.com/schemas/skills/v2.2/skill-manifest.json.
copyright String Optional The copyright notice for the skill.
description String Optional A human-readable description of the skill.
iconUrl String/URI-reference Optional The URI of the icon to show for the skill.
license String Optional The license agreement for the skill.
name String Required The name of the skill.
privacyUrl String/URI-reference Optional The URI of the privacy description for the skill.
publisherName String Required The name of the skill publisher.
tags String array Optional A set of tags for the skill. If present, each tag must be unique.
version String Required The version of the skill the manifest describes.
Endpoints      
endpoints endpoint array Required The list of endpoints supported by the skill. At least one endpoint must be defined. Each endpoint must be unique.
Activities      
activities Object containing named activity objects Optional The set of initial activities accepted by the skill.
activitiesSent Object containing named activity objects Optional Describes the proactive activities that the skill can send.
Definitions      
definitions Object Optional An object containing subschemas for objects used in the manifest.
Dispatch models      
dispatchModels dispatchModels object Optional Describes the language models and top-level intents supported by the skill. See Dispatch models for the schema for this object.


 

终点【Endpoints】


每个端点对象都描述了该技能支持的端点。

v2.2

本例列出了一项技能的两个端点。

JSON

"endpoints": [
   {
       "name": "americas",
       "protocol": "BotFrameworkV3",
       "description": "Production endpoint for SkillBot in the Americas",
       "endpointUrl": "http://myskill.contoso.com/api/messages",
       "msAppId": "00000000-0000-0000-0000-000000000000"
   },
   {
       "name": "eu",
       "protocol": "BotFrameworkV3",
       "description": "Production endpoint for SkillBot in Europe",
       "endpointUrl": "http://myskill.contoso.com/api/messages",
       "msAppId": "11111111-0000-0000-0000-000000000000"
   }
],


端点对象


描述技能支持的终结点。

v2.2


 

Field Type/Format Required Description
description String Optional A description of the endpoint.
endpointUrl String/URI Required The URI endpoint for the skill.
msAppId String Required The Microsoft AppId (GUID) for the skill, used to authenticate requests. Must match the regular expression: ^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$.
name String Required The unique name for the endpoint.
protocol String Optional The supported Bot protocol. Default is "BotFrameworkV3", which represents the Bot Connector API version 3. Use the default value unless your skill specifically uses a different protocol.


 

活动


每个活动对象都描述了技能所接受的活动。该技能基于其收到的初始活动开始一个动作或任务。与活动对象相关联的名称表示技能将执行的动作或任务。

某些活动类型具有值属性,可用于为技能提供额外的输入。当技能结束(完成动作)时,它可以在相关联的会话结束活动的value属性中提供返回值。

v2.2

允许的活动类型有:消息、事件、调用和其他活动。技能可以接收调用活动,但不能发送调用活动。

这是一个示例活动描述。

JSON

"bookFlight": {
   "description": "Books a flight",
   "type": "event",
   "name": "BookFlight",
   "value": {
       "$ref": "#/definitions/bookingInfo"
   },
   "resultValue": {
       "$ref": "#/definitions/bookingInfo"
   }
},

eventActivity对象


描述技能接受或发送的事件活动。事件活动的含义由其名称字段定义,该字段在技能范围内是有意义的。

v2.2
 

Field Type Required Description
description String Optional A description of the action the event should initiate.
name String Required The value of the event activity's name property.
resultValue Object Optional A JSON schema definition of the type of object that the action can return.
type String Required The activity type. Must be "event".
value Object Optional A JSON schema definition of the type of object that this action expects as input.


 

invokeActivity对象


描述技能所接受的调用活动。调用活动的含义由其名称字段定义,这在技能范围内是有意义的。

v2.2


 

Field Type Required Description
description String Optional A description of the action the invoke should initiate.
name String Required The value of the invoke activity's name property.
resultValue Object Optional A JSON schema definition of the type of object that the associated action can return.
type String Required The activity type. Must be "invoke".
value Object Optional A JSON schema definition of the type of object that this action expects as input.


 

messageActivity对象


描述技能接受或发送的消息活动。消息活动的文本属性包含用户或机器人的话语。

v2.2

Field Type Required Description
description String Optional A description of the action.
resultValue Object Optional A JSON schema definition of the type of object that the associated action can return.
type String Required The activity type. Must be "message".
value Object Optional A JSON schema definition of the type of object that this action expects as input.


 

otherActivities对象


描述技能接受或发送的任何其他活动类型。

v2.2/
 

Field Type Required Description
type String Required The activity type. Must be one of the other Bot Framework activity types: "contactRelationUpdate", "conversationUpdate", "deleteUserData", "endOfConversation", "handoff", "installationUpdate", "messageDelete", "messageReaction", "messageUpdate", "suggestion", "trace", or "typing".


otherActivities对象可以包括其他属性,但技能清单模式没有定义它们的含义。

定义


每个定义都描述了一个子模式,该子模式可以由文档的其他部分使用。

这是航班预订信息的子模式示例。

JSON

"bookingInfo": {
   "type": "object",
   "required": [
       "origin"
   ],
   "properties": {
       "origin": {
           "type": "string",
           "description": "this is the origin city for the flight"
       },
       "destination": {
           "type": "string",
           "description": "this is the destination city for the flight"
       },
       "date": {
           "type": "string",
           "description": "The date for the flight in YYYY-MM-DD format"
       }
   }
},


调度模型


调度模型包含语言模型列表和技能支持的顶级意图列表。这是一项高级功能,使技能消费者的开发人员能够组成一个语言模型,将消费者和技能机器人的功能相结合。

每个语言模型都使用.lu或.qna文件格式。有关这些格式的详细信息,请参阅.lu文件格式和.qna文件格式。

v2.2

区域设置名称是与语言相关联的ISO 639两个字母的小写区域性代码和与国家或地区相关联的可选ISO 3166两个字母大写亚文化代码的组合,例如“en”或“en-US”。

Field Type Required Description
intents String array Optional A list of the top-level intents supported by the skill. Each intent must be unique.
languages Object containing named languageModel arrays Optional A list of the language models supported by the skill. Each name is the locale the language models are for, and the array contains the language models for that locale. A dispatch model must support at least one locale. Each locale within the languages field must be unique.


下面是一个示例调度模型,它包含三个地区的两种语言模型。它还描述了技能可以识别的两个顶级意图。

JSON

"dispatchModels": {
   "languages": {
       "en": [
           {
               "name": "SkillBot LU (English)",
               "contentType": "application/lu",
               "url": "http://sample.com/SkillBot-en.lu",
               "description": "English language model for the skill"
           },
           {
               "name": "SkillBot QnA LU (English)",
               "contentType": "application/qna",
               "url": "http://sample.com/SkillBot-QnA-en.qna",
               "description": "English language model for the skill (QnAMaker)"
           }
       ],
       "es-ES": [
           {
               "name": "SkillBot LU (Spanish-Spain)",
               "contentType": "application/lu",
               "url": "http://sample.com/SkillBot-es-ES.lu",
               "description": "Spanish (Spain) language model for the skill"
           },
           {
               "name": "SkillBot QnA LU (Spanish-Spain)",
               "contentType": "application/qna",
               "url": "http://sample.com/SkillBot-QnA-es-ES.qna",
               "description": "Spanish (Spain) language model for the skill (QnAMaker)"
           }
       ],
       "es-MX": [
           {
               "name": "SkillBot LU (Spanish-Mexico)",
               "contentType": "application/lu",
               "url": "http://sample.com/SkillBot-es-MX.lu",
               "description": "Spanish (Mexico) language model for the skill"
           },
           {
               "name": "SkillBot QnA LU (Spanish-Mexico)",
               "contentType": "application/qna",
               "url": "http://sample.com/SkillBot-QnA-es-MX.qna",
               "description": "Spanish (Mexico) language model for the skill (QnAMaker)"
           }
       ]
   },
   "intents": [
       "bookFlight",
       "getWeather"
   ]
},


languageModel对象


描述给定区域性的语言模型。名称是区域设置名称。

Field Type/Format Required Description
contentType String Required Type of the language model.
description String Optional A description of the language model.
name String Required Name of the language model.
url String/URI-reference Required The URL for the language model.


样品清单

{
   "$schema": "https://schemas.botframework.com/schemas/skills/v2.2/skill-manifest.json",
   "$id": "SkillBot",
   "name": "Sample skill definition that can handle multiple types of activities",
   "version": "1.0",
   "description": "This is a sample skill definition for multiple activity types",
   "publisherName": "Microsoft",
   "privacyUrl": "https://myskill.contoso.com/privacy.html",
   "copyright": "Copyright (c) Microsoft Corporation. All rights reserved.",
   "license": "",
   "iconUrl": "skillIcon.png",
   "tags": [
       "sample",
       "travel",
       "weather"
   ],
   "endpoints": [
       {
           "name": "americas",
           "protocol": "BotFrameworkV3",
           "description": "Production endpoint for SkillBot in the Americas",
           "endpointUrl": "http://myskill.contoso.com/api/messages",
           "msAppId": "00000000-0000-0000-0000-000000000000"
       },
       {
           "name": "eu",
           "protocol": "BotFrameworkV3",
           "description": "Production endpoint for SkillBot in Europe",
           "endpointUrl": "http://myskill.contoso.com/api/messages",
           "msAppId": "11111111-0000-0000-0000-000000000000"
       }
   ],
   "dispatchModels": {
       "languages": {
           "en": [
               {
                   "name": "SkillBot LU (English)",
                   "contentType": "application/lu",
                   "url": "http://sample.com/SkillBot-en.lu",
                   "description": "English language model for the skill"
               },
               {
                   "name": "SkillBot QnA LU (English)",
                   "contentType": "application/qna",
                   "url": "http://sample.com/SkillBot-QnA-en.qna",
                   "description": "English language model for the skill (QnAMaker)"
               }
           ],
           "es-ES": [
               {
                   "name": "SkillBot LU (Spanish-Spain)",
                   "contentType": "application/lu",
                   "url": "http://sample.com/SkillBot-es-ES.lu",
                   "description": "Spanish (Spain) language model for the skill"
               },
               {
                   "name": "SkillBot QnA LU (Spanish-Spain)",
                   "contentType": "application/qna",
                   "url": "http://sample.com/SkillBot-QnA-es-ES.qna",
                   "description": "Spanish (Spain) language model for the skill (QnAMaker)"
               }
           ],
           "es-MX": [
               {
                   "name": "SkillBot LU (Spanish-Mexico)",
                   "contentType": "application/lu",
                   "url": "http://sample.com/SkillBot-es-MX.lu",
                   "description": "Spanish (Mexico) language model for the skill"
               },
               {
                   "name": "SkillBot QnA LU (Spanish-Mexico)",
                   "contentType": "application/qna",
                   "url": "http://sample.com/SkillBot-QnA-es-MX.qna",
                   "description": "Spanish (Mexico) language model for the skill (QnAMaker)"
               }
           ]
       },
       "intents": [
           "bookFlight",
           "getWeather"
       ]
   },
   "activities": {
       "bookFlight": {
           "description": "Books a flight",
           "type": "event",
           "name": "BookFlight",
           "value": {
               "$ref": "#/definitions/bookingInfo"
           },
           "resultValue": {
               "$ref": "#/definitions/bookingInfo"
           }
       },
       "getWeather": {
           "description": "Retrieves and returns the weather for the user's location",
           "type": "invoke",
           "name": "GetWeather",
           "value": {
               "$ref": "#/definitions/location"
           },
           "resultValue": {
               "$ref": "#/definitions/weatherReport"
           }
       },
       "message": {
           "type": "message",
           "description": "Receives the user's' utterance and attempts to resolve it using the skill's LU models"
       },
       "typing": {
           "type": "typing"
       },
       "conversationUpdate": {
           "type": "conversationUpdate"
       }
   },
   "definitions": {
       "localeValue": {
           "type": "object",
           "properties": {
               "locale": {
                   "type": "string",
                   "description": "The current user's locale ISO code"
               }
           }
       },
       "bookingInfo": {
           "type": "object",
           "required": [
               "origin"
           ],
           "properties": {
               "origin": {
                   "type": "string",
                   "description": "this is the origin city for the flight"
               },
               "destination": {
                   "type": "string",
                   "description": "this is the destination city for the flight"
               },
               "date": {
                   "type": "string",
                   "description": "The date for the flight in YYYY-MM-DD format"
               }
           }
       },
       "weatherReport": {
           "type": "array",
           "description": "Array of forecasts for the next week.",
           "items": [
               {
                   "type": "string"
               }
           ]
       },
       "location": {
           "type": "object",
           "description": "Location metadata",
           "properties": {
               "latitude": {
                   "type": "number",
                   "title": "Latitude"
               },
               "longitude": {
                   "type": "number",
                   "title": "Longitude"
               },
               "postalCode": {
                   "type": "string",
                   "title": "Postal code"
               }
           }
       }
   },
   "activitiesSent": {
       "flightUpdated": {
           "type": "event",
           "name": "FlightUpdated",
           "description": "Event which is sent by the skill when there is an update in flight info",
           "value": {
               "type": "object",
               "description": "Flight update information",
               "properties": {
                   "flightNumber": {
                       "type": "string"
                   },
                   "departureDate": {
                       "type": "string",
                       "description": "The departure date for the flight in YYYY-MM-DD format"
                   },
                   "departureTime": {
                       "type": "string",
                       "description": "The departure time for the flight in HH-MM format"
                   }
               }
           }
       }
   }
}

Next steps

本文地址
最后修改
星期一, 七月 1, 2024 - 09:40
Article