1 package qnamaker 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/qnamaker" 15 16 // ActiveLearningSettingsDTO active Learning settings of the endpoint. 17 type ActiveLearningSettingsDTO struct { 18 // Enable - True/False string providing Active Learning 19 Enable *string `json:"enable,omitempty"` 20 } 21 22 // AlterationsDTO collection of words that are synonyms. 23 type AlterationsDTO struct { 24 // Alterations - Words that are synonymous with each other. 25 Alterations *[]string `json:"alterations,omitempty"` 26 } 27 28 // ContextDTO context associated with Qna. 29 type ContextDTO struct { 30 // IsContextOnly - To mark if a prompt is relevant only with a previous question or not. 31 // true - Do not include this QnA as search result for queries without context 32 // false - ignores context and includes this QnA in search result 33 IsContextOnly *bool `json:"isContextOnly,omitempty"` 34 // Prompts - List of prompts associated with the answer. 35 Prompts *[]PromptDTO `json:"prompts,omitempty"` 36 } 37 38 // CreateKbDTO post body schema for CreateKb operation. 39 type CreateKbDTO struct { 40 // Name - Friendly name for the knowledgebase. 41 Name *string `json:"name,omitempty"` 42 // QnaList - List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. 43 QnaList *[]QnADTO `json:"qnaList,omitempty"` 44 // Urls - List of URLs to be used for extracting Q-A. 45 Urls *[]string `json:"urls,omitempty"` 46 // Files - List of files from which to Extract Q-A. 47 Files *[]FileDTO `json:"files,omitempty"` 48 // EnableHierarchicalExtraction - Enable hierarchical extraction of Q-A from files and urls. Value to be considered False if this field is not present. 49 EnableHierarchicalExtraction *bool `json:"enableHierarchicalExtraction,omitempty"` 50 // DefaultAnswerUsedForExtraction - Text string to be used as the answer in any Q-A which has no extracted answer from the document but has a hierarchy. Required when EnableHierarchicalExtraction field is set to True. 51 DefaultAnswerUsedForExtraction *string `json:"defaultAnswerUsedForExtraction,omitempty"` 52 // Language - Language of the knowledgebase. Please find the list of supported languages <a href="https://aka.ms/qnamaker-languages#languages-supported" target="_blank">here</a>. 53 Language *string `json:"language,omitempty"` 54 } 55 56 // CreateKbInputDTO input to create KB. 57 type CreateKbInputDTO struct { 58 // QnaList - List of QNA to be added to the index. Ids are generated by the service and should be omitted. 59 QnaList *[]QnADTO `json:"qnaList,omitempty"` 60 // Urls - List of URLs to be added to knowledgebase. 61 Urls *[]string `json:"urls,omitempty"` 62 // Files - List of files to be added to knowledgebase. 63 Files *[]FileDTO `json:"files,omitempty"` 64 } 65 66 // DeleteKbContentsDTO PATCH body schema of Delete Operation in UpdateKb 67 type DeleteKbContentsDTO struct { 68 // Ids - List of Qna Ids to be deleted 69 Ids *[]int32 `json:"ids,omitempty"` 70 // Sources - List of sources to be deleted from knowledgebase. 71 Sources *[]string `json:"sources,omitempty"` 72 } 73 74 // EndpointKeysDTO schema for EndpointKeys generate/refresh operations. 75 type EndpointKeysDTO struct { 76 autorest.Response `json:"-"` 77 // PrimaryEndpointKey - Primary Access Key. 78 PrimaryEndpointKey *string `json:"primaryEndpointKey,omitempty"` 79 // SecondaryEndpointKey - Secondary Access Key. 80 SecondaryEndpointKey *string `json:"secondaryEndpointKey,omitempty"` 81 // InstalledVersion - Current version of runtime. 82 InstalledVersion *string `json:"installedVersion,omitempty"` 83 // LastStableVersion - Latest version of runtime. 84 LastStableVersion *string `json:"lastStableVersion,omitempty"` 85 // Language - Language setting of runtime. 86 Language *string `json:"language,omitempty"` 87 } 88 89 // EndpointSettingsDTO endpoint settings. 90 type EndpointSettingsDTO struct { 91 autorest.Response `json:"-"` 92 // ActiveLearning - Active Learning settings of the endpoint. 93 ActiveLearning *EndpointSettingsDTOActiveLearning `json:"activeLearning,omitempty"` 94 } 95 96 // EndpointSettingsDTOActiveLearning active Learning settings of the endpoint. 97 type EndpointSettingsDTOActiveLearning struct { 98 // Enable - True/False string providing Active Learning 99 Enable *string `json:"enable,omitempty"` 100 } 101 102 // Error the error object. As per Microsoft One API guidelines - 103 // https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. 104 type Error struct { 105 // 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' 106 Code ErrorCodeType `json:"code,omitempty"` 107 // Message - A human-readable representation of the error. 108 Message *string `json:"message,omitempty"` 109 // Target - The target of the error. 110 Target *string `json:"target,omitempty"` 111 // Details - An array of details about specific errors that led to this reported error. 112 Details *[]Error `json:"details,omitempty"` 113 // InnerError - An object containing more specific information than the current object about the error. 114 InnerError *InnerErrorModel `json:"innerError,omitempty"` 115 } 116 117 // ErrorResponse error response. As per Microsoft One API guidelines - 118 // https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. 119 type ErrorResponse struct { 120 // Error - The error object. 121 Error *ErrorResponseError `json:"error,omitempty"` 122 } 123 124 // ErrorResponseError the error object. 125 type ErrorResponseError struct { 126 // 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' 127 Code ErrorCodeType `json:"code,omitempty"` 128 // Message - A human-readable representation of the error. 129 Message *string `json:"message,omitempty"` 130 // Target - The target of the error. 131 Target *string `json:"target,omitempty"` 132 // Details - An array of details about specific errors that led to this reported error. 133 Details *[]Error `json:"details,omitempty"` 134 // InnerError - An object containing more specific information than the current object about the error. 135 InnerError *InnerErrorModel `json:"innerError,omitempty"` 136 } 137 138 // FileDTO DTO to hold details of uploaded files. 139 type FileDTO struct { 140 // FileName - File name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", ".xlsx". 141 FileName *string `json:"fileName,omitempty"` 142 // FileURI - Public URI of the file. 143 FileURI *string `json:"fileUri,omitempty"` 144 } 145 146 // InnerErrorModel an object containing more specific information about the error. As per Microsoft One API 147 // guidelines - 148 // https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. 149 type InnerErrorModel struct { 150 // Code - A more specific error code than was provided by the containing error. 151 Code *string `json:"code,omitempty"` 152 // InnerError - An object containing more specific information than the current object about the error. 153 InnerError *InnerErrorModel `json:"innerError,omitempty"` 154 } 155 156 // KnowledgebaseDTO response schema for CreateKb operation. 157 type KnowledgebaseDTO struct { 158 autorest.Response `json:"-"` 159 // ID - Unique id that identifies a knowledgebase. 160 ID *string `json:"id,omitempty"` 161 // HostName - URL host name at which the knowledgebase is hosted. 162 HostName *string `json:"hostName,omitempty"` 163 // LastAccessedTimestamp - Time stamp at which the knowledgebase was last accessed (UTC). 164 LastAccessedTimestamp *string `json:"lastAccessedTimestamp,omitempty"` 165 // LastChangedTimestamp - Time stamp at which the knowledgebase was last modified (UTC). 166 LastChangedTimestamp *string `json:"lastChangedTimestamp,omitempty"` 167 // LastPublishedTimestamp - Time stamp at which the knowledgebase was last published (UTC). 168 LastPublishedTimestamp *string `json:"lastPublishedTimestamp,omitempty"` 169 // Name - Friendly name of the knowledgebase. 170 Name *string `json:"name,omitempty"` 171 // UserID - User who created / owns the knowledgebase. 172 UserID *string `json:"userId,omitempty"` 173 // Urls - URL sources from which Q-A were extracted and added to the knowledgebase. 174 Urls *[]string `json:"urls,omitempty"` 175 // Sources - Custom sources from which Q-A were extracted or explicitly added to the knowledgebase. 176 Sources *[]string `json:"sources,omitempty"` 177 } 178 179 // KnowledgebasesDTO collection of knowledgebases owned by a user. 180 type KnowledgebasesDTO struct { 181 autorest.Response `json:"-"` 182 // Knowledgebases - Collection of knowledgebase records. 183 Knowledgebases *[]KnowledgebaseDTO `json:"knowledgebases,omitempty"` 184 } 185 186 // MetadataDTO name - value pair of metadata. 187 type MetadataDTO struct { 188 // Name - Metadata name. 189 Name *string `json:"name,omitempty"` 190 // Value - Metadata value. 191 Value *string `json:"value,omitempty"` 192 } 193 194 // Operation record to track long running operation. 195 type Operation struct { 196 autorest.Response `json:"-"` 197 // OperationState - Operation state. Possible values include: 'Failed', 'NotStarted', 'Running', 'Succeeded' 198 OperationState OperationStateType `json:"operationState,omitempty"` 199 // CreatedTimestamp - Timestamp when the operation was created. 200 CreatedTimestamp *string `json:"createdTimestamp,omitempty"` 201 // LastActionTimestamp - Timestamp when the current state was entered. 202 LastActionTimestamp *string `json:"lastActionTimestamp,omitempty"` 203 // ResourceLocation - Relative URI to the target resource location for completed resources. 204 ResourceLocation *string `json:"resourceLocation,omitempty"` 205 // UserID - User Id 206 UserID *string `json:"userId,omitempty"` 207 // OperationID - Operation Id. 208 OperationID *string `json:"operationId,omitempty"` 209 // ErrorResponse - Error details in case of failures. 210 ErrorResponse *ErrorResponse `json:"errorResponse,omitempty"` 211 } 212 213 // PromptDTO prompt for an answer. 214 type PromptDTO struct { 215 // DisplayOrder - Index of the prompt - used in ordering of the prompts 216 DisplayOrder *int32 `json:"displayOrder,omitempty"` 217 // QnaID - Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored. 218 QnaID *int32 `json:"qnaId,omitempty"` 219 // Qna - QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object 220 Qna *PromptDTOQna `json:"qna,omitempty"` 221 // DisplayText - Text displayed to represent a follow up question prompt 222 DisplayText *string `json:"displayText,omitempty"` 223 } 224 225 // PromptDTOQna qnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object 226 type PromptDTOQna struct { 227 // ID - Unique id for the Q-A. 228 ID *int32 `json:"id,omitempty"` 229 // Answer - Answer text 230 Answer *string `json:"answer,omitempty"` 231 // Source - Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs 232 Source *string `json:"source,omitempty"` 233 // Questions - List of questions associated with the answer. 234 Questions *[]string `json:"questions,omitempty"` 235 // Metadata - List of metadata associated with the answer. 236 Metadata *[]MetadataDTO `json:"metadata,omitempty"` 237 // Context - Context of a QnA 238 Context *QnADTOContext `json:"context,omitempty"` 239 } 240 241 // QnADocumentsDTO list of QnADTO 242 type QnADocumentsDTO struct { 243 autorest.Response `json:"-"` 244 // QnaDocuments - List of answers. 245 QnaDocuments *[]QnADTO `json:"qnaDocuments,omitempty"` 246 } 247 248 // QnADTO q-A object. 249 type QnADTO struct { 250 // ID - Unique id for the Q-A. 251 ID *int32 `json:"id,omitempty"` 252 // Answer - Answer text 253 Answer *string `json:"answer,omitempty"` 254 // Source - Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs 255 Source *string `json:"source,omitempty"` 256 // Questions - List of questions associated with the answer. 257 Questions *[]string `json:"questions,omitempty"` 258 // Metadata - List of metadata associated with the answer. 259 Metadata *[]MetadataDTO `json:"metadata,omitempty"` 260 // Context - Context of a QnA 261 Context *QnADTOContext `json:"context,omitempty"` 262 } 263 264 // QnADTOContext context of a QnA 265 type QnADTOContext struct { 266 // IsContextOnly - To mark if a prompt is relevant only with a previous question or not. 267 // true - Do not include this QnA as search result for queries without context 268 // false - ignores context and includes this QnA in search result 269 IsContextOnly *bool `json:"isContextOnly,omitempty"` 270 // Prompts - List of prompts associated with the answer. 271 Prompts *[]PromptDTO `json:"prompts,omitempty"` 272 } 273 274 // ReplaceKbDTO post body schema for Replace KB operation. 275 type ReplaceKbDTO struct { 276 // QnAList - List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted. 277 QnAList *[]QnADTO `json:"qnAList,omitempty"` 278 } 279 280 // UpdateContextDTO update Body schema to represent context to be updated 281 type UpdateContextDTO struct { 282 // PromptsToDelete - List of prompts associated with qna to be deleted 283 PromptsToDelete *[]int32 `json:"promptsToDelete,omitempty"` 284 // PromptsToAdd - List of prompts to be added to the qna. 285 PromptsToAdd *[]PromptDTO `json:"promptsToAdd,omitempty"` 286 // IsContextOnly - To mark if a prompt is relevant only with a previous question or not. 287 // true - Do not include this QnA as search result for queries without context 288 // false - ignores context and includes this QnA in search result 289 IsContextOnly *bool `json:"isContextOnly,omitempty"` 290 } 291 292 // UpdateKbContentsDTO PATCH body schema for Update operation in Update Kb 293 type UpdateKbContentsDTO struct { 294 // Name - Friendly name for the knowledgebase. 295 Name *string `json:"name,omitempty"` 296 // QnaList - List of Q-A (UpdateQnaDTO) to be added to the knowledgebase. 297 QnaList *[]UpdateQnaDTO `json:"qnaList,omitempty"` 298 // Urls - List of existing URLs to be refreshed. The content will be extracted again and re-indexed. 299 Urls *[]string `json:"urls,omitempty"` 300 } 301 302 // UpdateKbOperationDTO contains list of QnAs to be updated 303 type UpdateKbOperationDTO struct { 304 // Add - An instance of CreateKbInputDTO for add operation 305 Add *UpdateKbOperationDTOAdd `json:"add,omitempty"` 306 // Delete - An instance of DeleteKbContentsDTO for delete Operation 307 Delete *UpdateKbOperationDTODelete `json:"delete,omitempty"` 308 // Update - An instance of UpdateKbContentsDTO for Update Operation 309 Update *UpdateKbOperationDTOUpdate `json:"update,omitempty"` 310 // EnableHierarchicalExtraction - Enable hierarchical extraction of Q-A from files and urls. The value set during KB creation will be used if this field is not present. 311 EnableHierarchicalExtraction *bool `json:"enableHierarchicalExtraction,omitempty"` 312 // DefaultAnswerUsedForExtraction - Text string to be used as the answer in any Q-A which has no extracted answer from the document but has a hierarchy. Required when EnableHierarchicalExtraction field is set to True. 313 DefaultAnswerUsedForExtraction *string `json:"defaultAnswerUsedForExtraction,omitempty"` 314 } 315 316 // UpdateKbOperationDTOAdd an instance of CreateKbInputDTO for add operation 317 type UpdateKbOperationDTOAdd struct { 318 // QnaList - List of QNA to be added to the index. Ids are generated by the service and should be omitted. 319 QnaList *[]QnADTO `json:"qnaList,omitempty"` 320 // Urls - List of URLs to be added to knowledgebase. 321 Urls *[]string `json:"urls,omitempty"` 322 // Files - List of files to be added to knowledgebase. 323 Files *[]FileDTO `json:"files,omitempty"` 324 } 325 326 // UpdateKbOperationDTODelete an instance of DeleteKbContentsDTO for delete Operation 327 type UpdateKbOperationDTODelete struct { 328 // Ids - List of Qna Ids to be deleted 329 Ids *[]int32 `json:"ids,omitempty"` 330 // Sources - List of sources to be deleted from knowledgebase. 331 Sources *[]string `json:"sources,omitempty"` 332 } 333 334 // UpdateKbOperationDTOUpdate an instance of UpdateKbContentsDTO for Update Operation 335 type UpdateKbOperationDTOUpdate struct { 336 // Name - Friendly name for the knowledgebase. 337 Name *string `json:"name,omitempty"` 338 // QnaList - List of Q-A (UpdateQnaDTO) to be added to the knowledgebase. 339 QnaList *[]UpdateQnaDTO `json:"qnaList,omitempty"` 340 // Urls - List of existing URLs to be refreshed. The content will be extracted again and re-indexed. 341 Urls *[]string `json:"urls,omitempty"` 342 } 343 344 // UpdateMetadataDTO PATCH Body schema to represent list of Metadata to be updated 345 type UpdateMetadataDTO struct { 346 // Delete - List of Metadata associated with answer to be deleted 347 Delete *[]MetadataDTO `json:"delete,omitempty"` 348 // Add - List of metadata associated with answer to be added 349 Add *[]MetadataDTO `json:"add,omitempty"` 350 } 351 352 // UpdateQnaDTO PATCH Body schema for Update Qna List 353 type UpdateQnaDTO struct { 354 // ID - Unique id for the Q-A 355 ID *int32 `json:"id,omitempty"` 356 // Answer - Answer text 357 Answer *string `json:"answer,omitempty"` 358 // Source - Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs 359 Source *string `json:"source,omitempty"` 360 // Questions - List of questions associated with the answer. 361 Questions *UpdateQnaDTOQuestions `json:"questions,omitempty"` 362 // Metadata - List of metadata associated with the answer to be updated 363 Metadata *UpdateQnaDTOMetadata `json:"metadata,omitempty"` 364 // Context - Context associated with Qna to be updated. 365 Context *UpdateQnaDTOContext `json:"context,omitempty"` 366 } 367 368 // UpdateQnaDTOContext context associated with Qna to be updated. 369 type UpdateQnaDTOContext struct { 370 // PromptsToDelete - List of prompts associated with qna to be deleted 371 PromptsToDelete *[]int32 `json:"promptsToDelete,omitempty"` 372 // PromptsToAdd - List of prompts to be added to the qna. 373 PromptsToAdd *[]PromptDTO `json:"promptsToAdd,omitempty"` 374 // IsContextOnly - To mark if a prompt is relevant only with a previous question or not. 375 // true - Do not include this QnA as search result for queries without context 376 // false - ignores context and includes this QnA in search result 377 IsContextOnly *bool `json:"isContextOnly,omitempty"` 378 } 379 380 // UpdateQnaDTOMetadata list of metadata associated with the answer to be updated 381 type UpdateQnaDTOMetadata struct { 382 // Delete - List of Metadata associated with answer to be deleted 383 Delete *[]MetadataDTO `json:"delete,omitempty"` 384 // Add - List of metadata associated with answer to be added 385 Add *[]MetadataDTO `json:"add,omitempty"` 386 } 387 388 // UpdateQnaDTOQuestions list of questions associated with the answer. 389 type UpdateQnaDTOQuestions struct { 390 // Add - List of questions to be added 391 Add *[]string `json:"add,omitempty"` 392 // Delete - List of questions to be deleted. 393 Delete *[]string `json:"delete,omitempty"` 394 } 395 396 // UpdateQuestionsDTO PATCH Body schema for Update Kb which contains list of questions to be added and 397 // deleted 398 type UpdateQuestionsDTO struct { 399 // Add - List of questions to be added 400 Add *[]string `json:"add,omitempty"` 401 // Delete - List of questions to be deleted. 402 Delete *[]string `json:"delete,omitempty"` 403 } 404 405 // WordAlterationsDTO collection of word alterations. 406 type WordAlterationsDTO struct { 407 autorest.Response `json:"-"` 408 // WordAlterations - Collection of word alterations. 409 WordAlterations *[]AlterationsDTO `json:"wordAlterations,omitempty"` 410 } 411