Skip to content

Commit 19d9367

Browse files
ChongTangChong Tang
andauthored
Copy QuestionAnswering definitions to common.json and refer them in analyzeconversations.json (#19030)
Co-authored-by: Chong Tang <[email protected]>
1 parent e7b96a6 commit 19d9367

File tree

3 files changed

+363
-50
lines changed

3 files changed

+363
-50
lines changed

specification/cognitiveservices/data-plane/Language/stable/2022-05-01/analyzeconversations.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@
7676
"Conversation project result": {
7777
"$ref": "./examples/conversations/SuccessfulAnalyzeConversations.json"
7878
},
79-
"Arbitration result": {
79+
"Orchestration result": {
8080
"$ref": "./examples/conversations/SuccessfulAnalyzeConversationsArbitration.json"
8181
},
82-
"Orchestrator direct target result": {
82+
"Orchestration direct target result": {
8383
"$ref": "./examples/conversations/SuccessfulAnalyzeConversationsArbitrationDirectTarget.json"
8484
}
8585
}
@@ -409,8 +409,8 @@
409409
],
410410
"properties": {
411411
"callingOptions": {
412-
"type": "object",
413-
"description": "The options sent to a Question Answering KB."
412+
"description": "The options sent to a Question Answering KB.",
413+
"$ref": "common.json#/definitions/AnswersOptions"
414414
}
415415
}
416416
},
@@ -1362,7 +1362,7 @@
13621362
"More"
13631363
],
13641364
"x-ms-enum": {
1365-
"name": "Modifier",
1365+
"name": "TemporalModifier",
13661366
"modelAsString": true
13671367
}
13681368
},
@@ -1397,8 +1397,8 @@
13971397
],
13981398
"properties": {
13991399
"result": {
1400-
"type": "object",
1401-
"description": "The generated answer by a Question Answering KB."
1400+
"description": "The generated answer by a Question Answering KB.",
1401+
"$ref": "common.json#/definitions/AnswersResult"
14021402
}
14031403
}
14041404
},

specification/cognitiveservices/data-plane/Language/stable/2022-05-01/common.json

Lines changed: 344 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,350 @@
172172
}
173173
]
174174
}
175+
},
176+
"AnswersResult": {
177+
"type": "object",
178+
"description": "Represents List of Question Answers.",
179+
"additionalProperties": false,
180+
"properties": {
181+
"answers": {
182+
"type": "array",
183+
"description": "Represents Answer Result list.",
184+
"items": {
185+
"$ref": "#/definitions/KnowledgeBaseAnswer"
186+
}
187+
}
188+
}
189+
},
190+
"KnowledgeBaseAnswer": {
191+
"type": "object",
192+
"description": "Represents knowledge base answer.",
193+
"additionalProperties": false,
194+
"properties": {
195+
"questions": {
196+
"type": "array",
197+
"description": "List of questions associated with the answer.",
198+
"items": {
199+
"type": "string"
200+
}
201+
},
202+
"answer": {
203+
"type": "string",
204+
"description": "Answer text."
205+
},
206+
"confidenceScore": {
207+
"type": "number",
208+
"format": "double",
209+
"x-ms-client-name": "confidence",
210+
"description": "Answer confidence score, value ranges from 0 to 1.",
211+
"maximum": 1,
212+
"minimum": 0
213+
},
214+
"id": {
215+
"type": "integer",
216+
"x-ms-client-name": "qnaId",
217+
"description": "ID of the QnA result.",
218+
"format": "int32"
219+
},
220+
"source": {
221+
"type": "string",
222+
"description": "Source of QnA result."
223+
},
224+
"metadata": {
225+
"type": "object",
226+
"description": "Metadata associated with the answer, useful to categorize or filter question answers.",
227+
"additionalProperties": {
228+
"type": "string"
229+
}
230+
},
231+
"dialog": {
232+
"type": "object",
233+
"$ref": "#/definitions/KnowledgeBaseAnswerDialog"
234+
},
235+
"answerSpan": {
236+
"type": "object",
237+
"x-ms-client-name": "shortAnswer",
238+
"description": "Answer span object of QnA with respect to user's question.",
239+
"$ref": "#/definitions/AnswerSpan"
240+
}
241+
}
242+
},
243+
"KnowledgeBaseAnswerDialog": {
244+
"type": "object",
245+
"description": "Dialog associated with Answer.",
246+
"properties": {
247+
"isContextOnly": {
248+
"type": "boolean",
249+
"description": "To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result."
250+
},
251+
"prompts": {
252+
"type": "array",
253+
"description": "List of prompts associated with the answer.",
254+
"maxItems": 20,
255+
"items": {
256+
"$ref": "#/definitions/KnowledgeBaseAnswerPrompt"
257+
}
258+
}
259+
}
260+
},
261+
"KnowledgeBaseAnswerPrompt": {
262+
"type": "object",
263+
"description": "Prompt for an answer.",
264+
"properties": {
265+
"displayOrder": {
266+
"type": "integer",
267+
"description": "Index of the prompt - used in ordering of the prompts.",
268+
"format": "int32"
269+
},
270+
"qnaId": {
271+
"type": "integer",
272+
"description": "QnA ID corresponding to the prompt.",
273+
"format": "int32"
274+
},
275+
"displayText": {
276+
"type": "string",
277+
"description": "Text displayed to represent a follow up question prompt.",
278+
"maxLength": 200
279+
}
280+
}
281+
},
282+
"AnswerSpan": {
283+
"type": "object",
284+
"description": "Answer span object of QnA.",
285+
"additionalProperties": false,
286+
"properties": {
287+
"text": {
288+
"type": "string",
289+
"description": "Predicted text of answer span."
290+
},
291+
"confidenceScore": {
292+
"type": "number",
293+
"x-ms-client-name": "confidence",
294+
"description": "Predicted score of answer span, value ranges from 0 to 1.",
295+
"format": "double",
296+
"maximum": 1,
297+
"minimum": 0
298+
},
299+
"offset": {
300+
"type": "integer",
301+
"description": "The answer span offset from the start of answer.",
302+
"format": "int32"
303+
},
304+
"length": {
305+
"type": "integer",
306+
"description": "The length of the answer span.",
307+
"format": "int32"
308+
}
309+
}
310+
},
311+
"AnswersOptions": {
312+
"type": "object",
313+
"description": "Parameters to query a knowledge base.",
314+
"additionalProperties": false,
315+
"properties": {
316+
"qnaId": {
317+
"type": "integer",
318+
"description": "Exact QnA ID to fetch from the knowledge base, this field takes priority over question.",
319+
"format": "int32"
320+
},
321+
"question": {
322+
"type": "string",
323+
"description": "User question to query against the knowledge base."
324+
},
325+
"top": {
326+
"type": "integer",
327+
"description": "Max number of answers to be returned for the question.",
328+
"format": "int32"
329+
},
330+
"userId": {
331+
"type": "string",
332+
"description": "Unique identifier for the user."
333+
},
334+
"confidenceScoreThreshold": {
335+
"type": "number",
336+
"format": "double",
337+
"x-ms-client-name": "confidenceThreshold",
338+
"description": "Minimum threshold score for answers, value ranges from 0 to 1.",
339+
"maximum": 1,
340+
"minimum": 0
341+
},
342+
"context": {
343+
"x-ms-client-name": "answerContext",
344+
"description": "Context object with previous QnA's information.",
345+
"$ref": "#/definitions/KnowledgeBaseAnswerContext"
346+
},
347+
"rankerType": {
348+
"type": "string",
349+
"x-ms-client-name": "rankerKind",
350+
"description": "Type of ranker to be used.",
351+
"x-ms-enum": {
352+
"name": "RankerKind",
353+
"modelAsString": true,
354+
"values": [
355+
{
356+
"value": "QuestionOnly",
357+
"description": "Question only ranker."
358+
},
359+
{
360+
"value": "Default",
361+
"description": "Default ranker."
362+
}
363+
]
364+
},
365+
"enum": [
366+
"Default",
367+
"QuestionOnly"
368+
]
369+
},
370+
"filters": {
371+
"description": "Filter QnAs based on given metadata list and knowledge base sources.",
372+
"$ref": "#/definitions/QueryFilters"
373+
},
374+
"answerSpanRequest": {
375+
"x-ms-client-name": "shortAnswerOptions",
376+
"description": "To configure Answer span prediction feature.",
377+
"$ref": "#/definitions/ShortAnswerOptions"
378+
},
379+
"includeUnstructuredSources": {
380+
"type": "boolean",
381+
"description": "(Optional) Flag to enable Query over Unstructured Sources."
382+
}
383+
}
384+
},
385+
"KnowledgeBaseAnswerContext": {
386+
"type": "object",
387+
"description": "Context object with previous QnA's information.",
388+
"additionalProperties": false,
389+
"required": [
390+
"previousQnaId"
391+
],
392+
"properties": {
393+
"previousQnaId": {
394+
"type": "integer",
395+
"description": "Previous turn top answer result QnA ID.",
396+
"format": "int32"
397+
},
398+
"previousUserQuery": {
399+
"type": "string",
400+
"x-ms-client-name": "previousQuestion",
401+
"description": "Previous user query."
402+
}
403+
}
404+
},
405+
"QueryFilters": {
406+
"type": "object",
407+
"description": "filters over knowledge base.",
408+
"additionalProperties": false,
409+
"properties": {
410+
"metadataFilter": {
411+
"type": "object",
412+
"$ref": "#/definitions/MetadataFilter"
413+
},
414+
"sourceFilter": {
415+
"type": "object",
416+
"$ref": "#/definitions/SourceFilter"
417+
},
418+
"logicalOperation": {
419+
"type": "string",
420+
"description": "Logical operation used to join metadata filter with source filter.",
421+
"$ref": "#/definitions/LogicalOperationKind",
422+
"default": "AND"
423+
}
424+
}
425+
},
426+
"MetadataFilter": {
427+
"type": "object",
428+
"description": "Find QnAs that are associated with the given list of metadata.",
429+
"additionalProperties": false,
430+
"properties": {
431+
"metadata": {
432+
"type": "array",
433+
"items": {
434+
"$ref": "#/definitions/MetadataRecord"
435+
}
436+
},
437+
"logicalOperation": {
438+
"type": "string",
439+
"description": "Operation used to join metadata filters.",
440+
"$ref": "#/definitions/LogicalOperationKind",
441+
"default": "AND"
442+
}
443+
}
444+
},
445+
"MetadataRecord": {
446+
"type": "object",
447+
"description": "Object to provide the key value pair for each metadata.",
448+
"additionalProperties": false,
449+
"required": [
450+
"key",
451+
"value"
452+
],
453+
"properties": {
454+
"key": {
455+
"type": "string",
456+
"description": "Metadata Key from Metadata dictionary used in the QnA."
457+
},
458+
"value": {
459+
"type": "string",
460+
"description": "Metadata Value from Metadata dictionary used in the QnA."
461+
}
462+
}
463+
},
464+
"SourceFilter": {
465+
"type": "array",
466+
"description": "Find QnAs that are associated with any of the given list of sources in knowledge base.",
467+
"items": {
468+
"type": "string"
469+
}
470+
},
471+
"LogicalOperationKind": {
472+
"type": "string",
473+
"description": "Set to 'OR' or 'AND' for using corresponding logical operation.",
474+
"x-ms-enum": {
475+
"name": "LogicalOperationKind",
476+
"modelAsString": true
477+
},
478+
"enum": [
479+
"AND",
480+
"OR"
481+
]
482+
},
483+
"ShortAnswerOptions": {
484+
"type": "object",
485+
"description": "To configure Answer span prediction feature.",
486+
"additionalProperties": false,
487+
"required": [
488+
"enable"
489+
],
490+
"properties": {
491+
"enable": {
492+
"type": "boolean",
493+
"description": "Enable or disable Answer Span prediction.",
494+
"enum": [
495+
true
496+
],
497+
"x-ms-enum": {
498+
"name": "enable",
499+
"modelAsString": false
500+
}
501+
},
502+
"confidenceScoreThreshold": {
503+
"type": "number",
504+
"format": "double",
505+
"x-ms-client-name": "confidenceThreshold",
506+
"description": "Minimum threshold score required to include an answer span, value ranges from 0 to 1.",
507+
"maximum": 1,
508+
"minimum": 0
509+
},
510+
"topAnswersWithSpan": {
511+
"type": "integer",
512+
"x-ms-client-name": "top",
513+
"description": "Number of Top answers to be considered for span prediction from 1 to 10.",
514+
"format": "int32",
515+
"maximum": 10,
516+
"minimum": 1
517+
}
518+
}
175519
}
176520
},
177521
"parameters": {

0 commit comments

Comments
 (0)