1 package qnamakerruntime 2 3 // Copyright (c) Microsoft Corporation. All rights reserved. 4 // Licensed under the MIT License. See License.txt in the project root for license information. 5 // 6 // Code generated by Microsoft (R) AutoRest Code Generator. 7 // Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9 import ( 10 "github.com/Azure/go-autorest/autorest" 11 ) 12 13 // The package's fully qualified name. 14 const fqdn = "github.com/Azure/azure-sdk-for-go/services/cognitiveservices/v4.0/qnamakerruntime" 15 16 // ContextDTO context associated with Qna. 17 type ContextDTO struct { 18 // IsContextOnly - To mark if a prompt is relevant only with a previous question or not. 19 // true - Do not include this QnA as search result for queries without context 20 // false - ignores context and includes this QnA in search result 21 IsContextOnly *bool `json:"isContextOnly,omitempty"` 22 // Prompts - List of prompts associated with the answer. 23 Prompts *[]PromptDTO `json:"prompts,omitempty"` 24 } 25 26 // Error the error object. As per Microsoft One API guidelines - 27 // https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. 28 type Error struct { 29 // Code - One of a server-defined set of error codes. Possible values include: 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', 'ValidationFailure', 'ExtractionFailure' 30 Code ErrorCodeType `json:"code,omitempty"` 31 // Message - A human-readable representation of the error. 32 Message *string `json:"message,omitempty"` 33 // Target - The target of the error. 34 Target *string `json:"target,omitempty"` 35 // Details - An array of details about specific errors that led to this reported error. 36 Details *[]Error `json:"details,omitempty"` 37 // InnerError - An object containing more specific information than the current object about the error. 38 InnerError *InnerErrorModel `json:"innerError,omitempty"` 39 } 40 41 // ErrorResponse error response. As per Microsoft One API guidelines - 42 // https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. 43 type ErrorResponse struct { 44 // Error - The error object. 45 Error *ErrorResponseError `json:"error,omitempty"` 46 } 47 48 // ErrorResponseError the error object. 49 type ErrorResponseError struct { 50 // Code - One of a server-defined set of error codes. Possible values include: 'BadArgument', 'Forbidden', 'NotFound', 'KbNotFound', 'Unauthorized', 'Unspecified', 'EndpointKeysError', 'QuotaExceeded', 'QnaRuntimeError', 'SKULimitExceeded', 'OperationNotFound', 'ServiceError', 'ValidationFailure', 'ExtractionFailure' 51 Code ErrorCodeType `json:"code,omitempty"` 52 // Message - A human-readable representation of the error. 53 Message *string `json:"message,omitempty"` 54 // Target - The target of the error. 55 Target *string `json:"target,omitempty"` 56 // Details - An array of details about specific errors that led to this reported error. 57 Details *[]Error `json:"details,omitempty"` 58 // InnerError - An object containing more specific information than the current object about the error. 59 InnerError *InnerErrorModel `json:"innerError,omitempty"` 60 } 61 62 // FeedbackRecordDTO active learning feedback record. 63 type FeedbackRecordDTO struct { 64 // UserID - Unique identifier for the user. 65 UserID *string `json:"userId,omitempty"` 66 // UserQuestion - The suggested question being provided as feedback. 67 UserQuestion *string `json:"userQuestion,omitempty"` 68 // QnaID - The qnaId for which the suggested question is provided as feedback. 69 QnaID *int32 `json:"qnaId,omitempty"` 70 } 71 72 // FeedbackRecordsDTO active learning feedback records. 73 type FeedbackRecordsDTO struct { 74 // FeedbackRecords - List of feedback records. 75 FeedbackRecords *[]FeedbackRecordDTO `json:"feedbackRecords,omitempty"` 76 } 77 78 // InnerErrorModel an object containing more specific information about the error. As per Microsoft One API 79 // guidelines - 80 // https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. 81 type InnerErrorModel struct { 82 // Code - A more specific error code than was provided by the containing error. 83 Code *string `json:"code,omitempty"` 84 // InnerError - An object containing more specific information than the current object about the error. 85 InnerError *InnerErrorModel `json:"innerError,omitempty"` 86 } 87 88 // MetadataDTO name - value pair of metadata. 89 type MetadataDTO struct { 90 // Name - Metadata name. 91 Name *string `json:"name,omitempty"` 92 // Value - Metadata value. 93 Value *string `json:"value,omitempty"` 94 } 95 96 // PromptDTO prompt for an answer. 97 type PromptDTO struct { 98 // DisplayOrder - Index of the prompt - used in ordering of the prompts 99 DisplayOrder *int32 `json:"displayOrder,omitempty"` 100 // QnaID - Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored. 101 QnaID *int32 `json:"qnaId,omitempty"` 102 // Qna - QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object 103 Qna *PromptDTOQna `json:"qna,omitempty"` 104 // DisplayText - Text displayed to represent a follow up question prompt 105 DisplayText *string `json:"displayText,omitempty"` 106 } 107 108 // PromptDTOQna qnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object 109 type PromptDTOQna struct { 110 // ID - Unique id for the Q-A. 111 ID *int32 `json:"id,omitempty"` 112 // Answer - Answer text 113 Answer *string `json:"answer,omitempty"` 114 // Source - Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs 115 Source *string `json:"source,omitempty"` 116 // Questions - List of questions associated with the answer. 117 Questions *[]string `json:"questions,omitempty"` 118 // Metadata - List of metadata associated with the answer. 119 Metadata *[]MetadataDTO `json:"metadata,omitempty"` 120 // Context - Context of a QnA 121 Context *QnADTOContext `json:"context,omitempty"` 122 } 123 124 // QnADTO q-A object. 125 type QnADTO struct { 126 // ID - Unique id for the Q-A. 127 ID *int32 `json:"id,omitempty"` 128 // Answer - Answer text 129 Answer *string `json:"answer,omitempty"` 130 // Source - Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs 131 Source *string `json:"source,omitempty"` 132 // Questions - List of questions associated with the answer. 133 Questions *[]string `json:"questions,omitempty"` 134 // Metadata - List of metadata associated with the answer. 135 Metadata *[]MetadataDTO `json:"metadata,omitempty"` 136 // Context - Context of a QnA 137 Context *QnADTOContext `json:"context,omitempty"` 138 } 139 140 // QnADTOContext context of a QnA 141 type QnADTOContext struct { 142 // IsContextOnly - To mark if a prompt is relevant only with a previous question or not. 143 // true - Do not include this QnA as search result for queries without context 144 // false - ignores context and includes this QnA in search result 145 IsContextOnly *bool `json:"isContextOnly,omitempty"` 146 // Prompts - List of prompts associated with the answer. 147 Prompts *[]PromptDTO `json:"prompts,omitempty"` 148 } 149 150 // QnASearchResult represents Search Result. 151 type QnASearchResult struct { 152 // Questions - List of questions. 153 Questions *[]string `json:"questions,omitempty"` 154 // Answer - Answer. 155 Answer *string `json:"answer,omitempty"` 156 // Score - Search result score. 157 Score *float64 `json:"score,omitempty"` 158 // ID - Id of the QnA result. 159 ID *int32 `json:"id,omitempty"` 160 // Source - Source of QnA result. 161 Source *string `json:"source,omitempty"` 162 // Metadata - List of metadata. 163 Metadata *[]MetadataDTO `json:"metadata,omitempty"` 164 // Context - Context object of the QnA 165 Context *QnASearchResultContext `json:"context,omitempty"` 166 } 167 168 // QnASearchResultContext context object of the QnA 169 type QnASearchResultContext struct { 170 // IsContextOnly - To mark if a prompt is relevant only with a previous question or not. 171 // true - Do not include this QnA as search result for queries without context 172 // false - ignores context and includes this QnA in search result 173 IsContextOnly *bool `json:"isContextOnly,omitempty"` 174 // Prompts - List of prompts associated with the answer. 175 Prompts *[]PromptDTO `json:"prompts,omitempty"` 176 } 177 178 // QnASearchResultList represents List of Question Answers. 179 type QnASearchResultList struct { 180 autorest.Response `json:"-"` 181 // Answers - Represents Search Result list. 182 Answers *[]QnASearchResult `json:"answers,omitempty"` 183 } 184 185 // QueryContextDTO context object with previous QnA's information. 186 type QueryContextDTO struct { 187 // PreviousQnaID - Previous QnA Id - qnaId of the top result. 188 PreviousQnaID *string `json:"previousQnaId,omitempty"` 189 // PreviousUserQuery - Previous user query. 190 PreviousUserQuery *string `json:"previousUserQuery,omitempty"` 191 } 192 193 // QueryDTO POST body schema to query the knowledgebase. 194 type QueryDTO struct { 195 // QnaID - Exact qnaId to fetch from the knowledgebase, this field takes priority over question. 196 QnaID *string `json:"qnaId,omitempty"` 197 // Question - User question to query against the knowledge base. 198 Question *string `json:"question,omitempty"` 199 // Top - Max number of answers to be returned for the question. 200 Top *int32 `json:"top,omitempty"` 201 // UserID - Unique identifier for the user. Optional parameter for telemetry. For more information, refer <a href="http://aka.ms/qnamaker-analytics#user-traffic" target="blank">Analytics and Telemetry</a>. 202 UserID *string `json:"userId,omitempty"` 203 // IsTest - Query against the test index. 204 IsTest *bool `json:"isTest,omitempty"` 205 // ScoreThreshold - Threshold for answers returned based on score. 206 ScoreThreshold *float64 `json:"scoreThreshold,omitempty"` 207 // Context - Context object with previous QnA's information. 208 Context *QueryDTOContext `json:"context,omitempty"` 209 // RankerType - Optional field. Set to 'QuestionOnly' for using a question only Ranker. 210 RankerType *string `json:"rankerType,omitempty"` 211 // StrictFilters - Find only answers that contain these metadata. 212 StrictFilters *[]MetadataDTO `json:"strictFilters,omitempty"` 213 // StrictFiltersCompoundOperationType - Optional field. Set to OR for using OR as Operation for Strict Filters. Possible values include: 'AND', 'OR' 214 StrictFiltersCompoundOperationType StrictFiltersCompoundOperationType `json:"strictFiltersCompoundOperationType,omitempty"` 215 } 216 217 // QueryDTOContext context object with previous QnA's information. 218 type QueryDTOContext struct { 219 // PreviousQnaID - Previous QnA Id - qnaId of the top result. 220 PreviousQnaID *string `json:"previousQnaId,omitempty"` 221 // PreviousUserQuery - Previous user query. 222 PreviousUserQuery *string `json:"previousUserQuery,omitempty"` 223 } 224