From a8951528e22de086f3896974cfe1ecb163375c49 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 30 Mar 2021 15:58:41 +0000 Subject: [PATCH] CodeGen from PR 13444 in Azure/azure-rest-api-specs QnaMaker v5.0-preview.2 (#13444) * iinitial commit * avacado fix * modelValidationFix * prettier fix * try fix for lintDiff * fix attempt * fix lint diff 2 * swaggerLintfix * minor updates * fix sdk error --- .../MANIFEST.in | 1 + .../_meta.json | 8 + .../knowledge/qnamaker/authoring/__init__.py | 7 +- .../qnamaker/authoring/_configuration.py | 47 + ..._amaker_client.py => _qn_amaker_client.py} | 49 +- .../qnamaker/authoring/models/__init__.py | 214 +-- .../qnamaker/authoring/models/_models.py | 1103 +++++++++++ .../qnamaker/authoring/models/_models_py3.py | 1103 +++++++++++ ...nt_enums.py => _qn_amaker_client_enums.py} | 0 .../authoring/models/alterations_dto.py | 34 - .../authoring/models/alterations_dto_py3.py | 34 - .../qnamaker/authoring/models/context_dto.py | 41 - .../authoring/models/context_dto_py3.py | 41 - .../authoring/models/create_kb_dto.py | 68 - .../authoring/models/create_kb_dto_py3.py | 68 - .../authoring/models/create_kb_input_dto.py | 39 - .../models/create_kb_input_dto_py3.py | 39 - .../models/delete_kb_contents_dto.py | 32 - .../models/delete_kb_contents_dto_py3.py | 32 - .../authoring/models/endpoint_keys_dto.py | 44 - .../authoring/models/endpoint_keys_dto_py3.py | 44 - .../authoring/models/endpoint_settings_dto.py | 29 - .../endpoint_settings_dto_active_learning.py | 27 - ...dpoint_settings_dto_active_learning_py3.py | 27 - .../models/endpoint_settings_dto_py3.py | 29 - .../qnamaker/authoring/models/error.py | 61 - .../qnamaker/authoring/models/error_py3.py | 61 - .../authoring/models/error_response.py | 43 - .../authoring/models/error_response_error.py | 55 - .../models/error_response_error_py3.py | 55 - .../authoring/models/error_response_py3.py | 43 - .../qnamaker/authoring/models/file_dto.py | 40 - .../qnamaker/authoring/models/file_dto_py3.py | 40 - .../authoring/models/inner_error_model.py | 37 - .../authoring/models/inner_error_model_py3.py | 37 - .../authoring/models/knowledgebase_dto.py | 65 - .../authoring/models/knowledgebase_dto_py3.py | 65 - .../authoring/models/knowledgebases_dto.py | 29 - .../models/knowledgebases_dto_py3.py | 29 - .../qnamaker/authoring/models/metadata_dto.py | 39 - .../authoring/models/metadata_dto_py3.py | 39 - .../qnamaker/authoring/models/operation.py | 57 - .../authoring/models/operation_py3.py | 57 - .../qnamaker/authoring/models/prompt_dto.py | 49 - .../authoring/models/prompt_dto_py3.py | 49 - .../authoring/models/prompt_dto_qna.py | 53 - .../authoring/models/prompt_dto_qna_py3.py | 53 - .../authoring/models/qn_adocuments_dto.py | 29 - .../authoring/models/qn_adocuments_dto_py3.py | 29 - .../qnamaker/authoring/models/qn_adto.py | 59 - .../authoring/models/qn_adto_context.py | 39 - .../authoring/models/qn_adto_context_py3.py | 39 - .../qnamaker/authoring/models/qn_adto_py3.py | 59 - .../authoring/models/replace_kb_dto.py | 36 - .../authoring/models/replace_kb_dto_py3.py | 36 - .../authoring/models/update_context_dto.py | 42 - .../models/update_context_dto_py3.py | 42 - .../models/update_kb_contents_dto.py | 39 - .../models/update_kb_contents_dto_py3.py | 39 - .../models/update_kb_operation_dto.py | 56 - .../models/update_kb_operation_dto_add.py | 36 - .../models/update_kb_operation_dto_add_py3.py | 36 - .../models/update_kb_operation_dto_delete.py | 30 - .../update_kb_operation_dto_delete_py3.py | 30 - .../models/update_kb_operation_dto_py3.py | 56 - .../models/update_kb_operation_dto_update.py | 36 - .../update_kb_operation_dto_update_py3.py | 36 - .../authoring/models/update_metadata_dto.py | 34 - .../models/update_metadata_dto_py3.py | 34 - .../authoring/models/update_qna_dto.py | 57 - .../models/update_qna_dto_context.py | 39 - .../models/update_qna_dto_context_py3.py | 39 - .../models/update_qna_dto_metadata.py | 32 - .../models/update_qna_dto_metadata_py3.py | 32 - .../authoring/models/update_qna_dto_py3.py | 57 - .../models/update_qna_dto_questions.py | 30 - .../models/update_qna_dto_questions_py3.py | 30 - .../authoring/models/update_questions_dto.py | 33 - .../models/update_questions_dto_py3.py | 33 - .../authoring/models/word_alterations_dto.py | 35 - .../models/word_alterations_dto_py3.py | 35 - .../qnamaker/authoring/operations/__init__.py | 10 +- ...erations.py => _alterations_operations.py} | 3 +- ...ations.py => _endpoint_keys_operations.py} | 4 +- ...ns.py => _endpoint_settings_operations.py} | 19 +- ...ations.py => _knowledgebase_operations.py} | 25 +- .../{operations.py => _operations.py} | 5 +- .../__init__.py} | 19 +- .../qnamaker/preview/_configuration.py | 47 + .../qnamaker/preview/_qn_amaker_client.py | 74 + .../qnamaker/preview/models/__init__.py | 185 ++ .../qnamaker/preview/models/_models.py | 1624 +++++++++++++++++ .../qnamaker/preview/models/_models_py3.py | 1624 +++++++++++++++++ .../preview/models/_qn_amaker_client_enums.py | 50 + .../qnamaker/preview/operations/__init__.py | 26 + .../operations/_alterations_operations.py | 242 +++ .../operations/_endpoint_keys_operations.py | 139 ++ .../_endpoint_settings_operations.py | 136 ++ .../operations/_knowledgebase_operations.py | 585 ++++++ .../preview/operations/_operations.py | 94 + .../operations/_prebuilt_operations.py | 98 + .../version.py} | 17 +- .../knowledge/qnamaker/runtime/__init__.py | 7 +- .../qnamaker/runtime/_configuration.py | 47 + ...client.py => _qn_amaker_runtime_client.py} | 37 +- .../qnamaker/runtime/models/__init__.py | 102 +- .../qnamaker/runtime/models/_models.py | 600 ++++++ .../qnamaker/runtime/models/_models_py3.py | 600 ++++++ ....py => _qn_amaker_runtime_client_enums.py} | 6 + .../qnamaker/runtime/models/context_dto.py | 41 - .../runtime/models/context_dto_py3.py | 41 - .../qnamaker/runtime/models/error.py | 61 - .../qnamaker/runtime/models/error_py3.py | 61 - .../qnamaker/runtime/models/error_response.py | 43 - .../runtime/models/error_response_error.py | 55 - .../models/error_response_error_py3.py | 55 - .../runtime/models/error_response_py3.py | 43 - .../runtime/models/feedback_record_dto.py | 41 - .../runtime/models/feedback_record_dto_py3.py | 41 - .../runtime/models/feedback_records_dto.py | 29 - .../models/feedback_records_dto_py3.py | 29 - .../runtime/models/inner_error_model.py | 37 - .../runtime/models/inner_error_model_py3.py | 37 - .../qnamaker/runtime/models/metadata_dto.py | 39 - .../runtime/models/metadata_dto_py3.py | 39 - .../qnamaker/runtime/models/prompt_dto.py | 49 - .../qnamaker/runtime/models/prompt_dto_py3.py | 49 - .../qnamaker/runtime/models/prompt_dto_qna.py | 53 - .../runtime/models/prompt_dto_qna_py3.py | 53 - .../qnamaker/runtime/models/qn_adto.py | 59 - .../runtime/models/qn_adto_context.py | 39 - .../runtime/models/qn_adto_context_py3.py | 39 - .../qnamaker/runtime/models/qn_adto_py3.py | 59 - .../runtime/models/qn_asearch_result.py | 54 - .../models/qn_asearch_result_context.py | 39 - .../models/qn_asearch_result_context_py3.py | 39 - .../runtime/models/qn_asearch_result_list.py | 29 - .../models/qn_asearch_result_list_py3.py | 29 - .../runtime/models/qn_asearch_result_py3.py | 54 - .../runtime/models/query_context_dto.py | 32 - .../runtime/models/query_context_dto_py3.py | 32 - .../qnamaker/runtime/models/query_dto.py | 64 - .../runtime/models/query_dto_context.py | 30 - .../runtime/models/query_dto_context_py3.py | 30 - .../qnamaker/runtime/models/query_dto_py3.py | 64 - .../qnamaker/runtime/operations/__init__.py | 2 +- ...e_operations.py => _runtime_operations.py} | 3 +- 147 files changed, 8665 insertions(+), 4893 deletions(-) create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/_meta.json create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/_configuration.py rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/{qn_amaker_client.py => _qn_amaker_client.py} (63%) create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_models.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_models_py3.py rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/{qn_amaker_client_enums.py => _qn_amaker_client_enums.py} (100%) delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/alterations_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/alterations_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/context_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/context_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_input_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_input_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/delete_kb_contents_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/delete_kb_contents_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_keys_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_keys_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_active_learning.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_active_learning_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_error.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_error_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/file_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/file_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/inner_error_model.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/inner_error_model_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebase_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebase_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebases_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebases_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/metadata_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/metadata_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/operation.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/operation_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_qna.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_qna_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adocuments_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adocuments_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_context.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_context_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/replace_kb_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/replace_kb_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_context_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_context_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_contents_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_contents_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_add.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_add_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_delete.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_delete_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_update.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_update_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_metadata_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_metadata_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_context.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_context_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_metadata.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_metadata_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_questions.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_questions_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_questions_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_questions_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/word_alterations_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/word_alterations_dto_py3.py rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/{alterations_operations.py => _alterations_operations.py} (97%) rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/{endpoint_keys_operations.py => _endpoint_keys_operations.py} (97%) rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/{endpoint_settings_operations.py => _endpoint_settings_operations.py} (91%) rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/{knowledgebase_operations.py => _knowledgebase_operations.py} (94%) rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/{operations.py => _operations.py} (96%) rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/{authoring/models/active_learning_settings_dto.py => preview/__init__.py} (51%) create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/_configuration.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/_qn_amaker_client.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/__init__.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_models.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_models_py3.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_qn_amaker_client_enums.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/__init__.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_alterations_operations.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_endpoint_keys_operations.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_endpoint_settings_operations.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_knowledgebase_operations.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_operations.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_prebuilt_operations.py rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/{authoring/models/active_learning_settings_dto_py3.py => preview/version.py} (50%) create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/_configuration.py rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/{qn_amaker_runtime_client.py => _qn_amaker_runtime_client.py} (58%) create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models.py create mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models_py3.py rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/{qn_amaker_runtime_client_enums.py => _qn_amaker_runtime_client_enums.py} (91%) delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/context_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/context_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_error.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_error_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_record_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_record_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_records_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_records_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/inner_error_model.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/inner_error_model_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/metadata_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/metadata_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_qna.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_qna_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_context.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_context_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_context.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_context_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_list.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_list_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_context_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_context_dto_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_context.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_context_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_py3.py rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/{runtime_operations.py => _runtime_operations.py} (97%) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/MANIFEST.in b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/MANIFEST.in index 2bdf4d1a87d24..9745aa4eb223d 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/MANIFEST.in +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/_meta.json b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/_meta.json new file mode 100644 index 0000000000000..21f2e405fecbd --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "V2", + "use": "@microsoft.azure/autorest.python@~4.0.71", + "commit": "230844b2d3439b1be01f0abab28fb1226033748a", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/cognitiveservices/data-plane/QnAMaker/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2", + "readme": "specification/cognitiveservices/data-plane/QnAMaker/readme.md" +} \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/__init__.py index 1b5232d238e3e..fb3872ea774c4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .qn_amaker_client import QnAMakerClient -from .version import VERSION +from ._configuration import QnAMakerClientConfiguration +from ._qn_amaker_client import QnAMakerClient +__all__ = ['QnAMakerClient', 'QnAMakerClientConfiguration'] -__all__ = ['QnAMakerClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/_configuration.py new file mode 100644 index 0000000000000..183dc51c9f49e --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/_configuration.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest import Configuration + +from .version import VERSION + + +class QnAMakerClientConfiguration(Configuration): + """Configuration for QnAMakerClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Supported Cognitive Services endpoint (e.g., https://< + qnamaker-resource-name> .api.cognitiveservices.azure.com). + :type endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, endpoint, credentials): + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + base_url = '{Endpoint}/qnamaker/v4.0' + + super(QnAMakerClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-cognitiveservices-knowledge-qnamaker/{}'.format(VERSION)) + + self.endpoint = endpoint + self.credentials = credentials diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/qn_amaker_client.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/_qn_amaker_client.py similarity index 63% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/qn_amaker_client.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/_qn_amaker_client.py index fe0afce73bd70..aec369392b36c 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/qn_amaker_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/_qn_amaker_client.py @@ -10,46 +10,17 @@ # -------------------------------------------------------------------------- from msrest.service_client import SDKClient -from msrest import Configuration, Serializer, Deserializer -from .version import VERSION -from .operations.endpoint_settings_operations import EndpointSettingsOperations -from .operations.endpoint_keys_operations import EndpointKeysOperations -from .operations.alterations_operations import AlterationsOperations -from .operations.knowledgebase_operations import KnowledgebaseOperations -from .operations.operations import Operations +from msrest import Serializer, Deserializer + +from ._configuration import QnAMakerClientConfiguration +from .operations import EndpointSettingsOperations +from .operations import EndpointKeysOperations +from .operations import AlterationsOperations +from .operations import KnowledgebaseOperations +from .operations import Operations from . import models -class QnAMakerClientConfiguration(Configuration): - """Configuration for QnAMakerClient - Note that all parameters used to create this instance are saved as instance - attributes. - - :param endpoint: Supported Cognitive Services endpoints (protocol and - hostname, for example: https://westus.api.cognitive.microsoft.com). - :type endpoint: str - :param credentials: Subscription credentials which uniquely identify - client subscription. - :type credentials: None - """ - - def __init__( - self, endpoint, credentials): - - if endpoint is None: - raise ValueError("Parameter 'endpoint' must not be None.") - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - base_url = '{Endpoint}/qnamaker/v4.0' - - super(QnAMakerClientConfiguration, self).__init__(base_url) - - self.add_user_agent('azure-cognitiveservices-knowledge-qnamaker/{}'.format(VERSION)) - - self.endpoint = endpoint - self.credentials = credentials - - class QnAMakerClient(SDKClient): """An API for QnAMaker Service @@ -67,8 +38,8 @@ class QnAMakerClient(SDKClient): :ivar operations: Operations operations :vartype operations: azure.cognitiveservices.knowledge.qnamaker.authoring.operations.Operations - :param endpoint: Supported Cognitive Services endpoints (protocol and - hostname, for example: https://westus.api.cognitive.microsoft.com). + :param endpoint: Supported Cognitive Services endpoint (e.g., https://< + qnamaker-resource-name> .api.cognitiveservices.azure.com). :type endpoint: str :param credentials: Subscription credentials which uniquely identify client subscription. diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/__init__.py index 2b0cd8aa1e1f5..451223ee9e776 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/__init__.py @@ -10,125 +10,125 @@ # -------------------------------------------------------------------------- try: - from .update_kb_operation_dto_add_py3 import UpdateKbOperationDTOAdd - from .update_kb_operation_dto_delete_py3 import UpdateKbOperationDTODelete - from .update_kb_operation_dto_update_py3 import UpdateKbOperationDTOUpdate - from .update_kb_operation_dto_py3 import UpdateKbOperationDTO - from .update_qna_dto_questions_py3 import UpdateQnaDTOQuestions - from .update_qna_dto_metadata_py3 import UpdateQnaDTOMetadata - from .update_qna_dto_context_py3 import UpdateQnaDTOContext - from .update_qna_dto_py3 import UpdateQnaDTO - from .update_kb_contents_dto_py3 import UpdateKbContentsDTO - from .update_questions_dto_py3 import UpdateQuestionsDTO - from .metadata_dto_py3 import MetadataDTO - from .update_metadata_dto_py3 import UpdateMetadataDTO - from .prompt_dto_qna_py3 import PromptDTOQna - from .prompt_dto_py3 import PromptDTO - from .update_context_dto_py3 import UpdateContextDTO - from .delete_kb_contents_dto_py3 import DeleteKbContentsDTO - from .qn_adto_context_py3 import QnADTOContext - from .qn_adto_py3 import QnADTO - from .file_dto_py3 import FileDTO - from .create_kb_input_dto_py3 import CreateKbInputDTO - from .qn_adocuments_dto_py3 import QnADocumentsDTO - from .create_kb_dto_py3 import CreateKbDTO - from .replace_kb_dto_py3 import ReplaceKbDTO - from .context_dto_py3 import ContextDTO - from .error_response_error_py3 import ErrorResponseError - from .error_response_py3 import ErrorResponse, ErrorResponseException - from .inner_error_model_py3 import InnerErrorModel - from .error_py3 import Error - from .operation_py3 import Operation - from .knowledgebase_dto_py3 import KnowledgebaseDTO - from .knowledgebases_dto_py3 import KnowledgebasesDTO - from .endpoint_settings_dto_active_learning_py3 import EndpointSettingsDTOActiveLearning - from .endpoint_settings_dto_py3 import EndpointSettingsDTO - from .active_learning_settings_dto_py3 import ActiveLearningSettingsDTO - from .alterations_dto_py3 import AlterationsDTO - from .word_alterations_dto_py3 import WordAlterationsDTO - from .endpoint_keys_dto_py3 import EndpointKeysDTO + from ._models_py3 import ActiveLearningSettingsDTO + from ._models_py3 import AlterationsDTO + from ._models_py3 import ContextDTO + from ._models_py3 import CreateKbDTO + from ._models_py3 import CreateKbInputDTO + from ._models_py3 import DeleteKbContentsDTO + from ._models_py3 import EndpointKeysDTO + from ._models_py3 import EndpointSettingsDTO + from ._models_py3 import EndpointSettingsDTOActiveLearning + from ._models_py3 import Error + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ErrorResponseError + from ._models_py3 import FileDTO + from ._models_py3 import InnerErrorModel + from ._models_py3 import KnowledgebaseDTO + from ._models_py3 import KnowledgebasesDTO + from ._models_py3 import MetadataDTO + from ._models_py3 import Operation + from ._models_py3 import PromptDTO + from ._models_py3 import PromptDTOQna + from ._models_py3 import QnADocumentsDTO + from ._models_py3 import QnADTO + from ._models_py3 import QnADTOContext + from ._models_py3 import ReplaceKbDTO + from ._models_py3 import UpdateContextDTO + from ._models_py3 import UpdateKbContentsDTO + from ._models_py3 import UpdateKbOperationDTO + from ._models_py3 import UpdateKbOperationDTOAdd + from ._models_py3 import UpdateKbOperationDTODelete + from ._models_py3 import UpdateKbOperationDTOUpdate + from ._models_py3 import UpdateMetadataDTO + from ._models_py3 import UpdateQnaDTO + from ._models_py3 import UpdateQnaDTOContext + from ._models_py3 import UpdateQnaDTOMetadata + from ._models_py3 import UpdateQnaDTOQuestions + from ._models_py3 import UpdateQuestionsDTO + from ._models_py3 import WordAlterationsDTO except (SyntaxError, ImportError): - from .update_kb_operation_dto_add import UpdateKbOperationDTOAdd - from .update_kb_operation_dto_delete import UpdateKbOperationDTODelete - from .update_kb_operation_dto_update import UpdateKbOperationDTOUpdate - from .update_kb_operation_dto import UpdateKbOperationDTO - from .update_qna_dto_questions import UpdateQnaDTOQuestions - from .update_qna_dto_metadata import UpdateQnaDTOMetadata - from .update_qna_dto_context import UpdateQnaDTOContext - from .update_qna_dto import UpdateQnaDTO - from .update_kb_contents_dto import UpdateKbContentsDTO - from .update_questions_dto import UpdateQuestionsDTO - from .metadata_dto import MetadataDTO - from .update_metadata_dto import UpdateMetadataDTO - from .prompt_dto_qna import PromptDTOQna - from .prompt_dto import PromptDTO - from .update_context_dto import UpdateContextDTO - from .delete_kb_contents_dto import DeleteKbContentsDTO - from .qn_adto_context import QnADTOContext - from .qn_adto import QnADTO - from .file_dto import FileDTO - from .create_kb_input_dto import CreateKbInputDTO - from .qn_adocuments_dto import QnADocumentsDTO - from .create_kb_dto import CreateKbDTO - from .replace_kb_dto import ReplaceKbDTO - from .context_dto import ContextDTO - from .error_response_error import ErrorResponseError - from .error_response import ErrorResponse, ErrorResponseException - from .inner_error_model import InnerErrorModel - from .error import Error - from .operation import Operation - from .knowledgebase_dto import KnowledgebaseDTO - from .knowledgebases_dto import KnowledgebasesDTO - from .endpoint_settings_dto_active_learning import EndpointSettingsDTOActiveLearning - from .endpoint_settings_dto import EndpointSettingsDTO - from .active_learning_settings_dto import ActiveLearningSettingsDTO - from .alterations_dto import AlterationsDTO - from .word_alterations_dto import WordAlterationsDTO - from .endpoint_keys_dto import EndpointKeysDTO -from .qn_amaker_client_enums import ( + from ._models import ActiveLearningSettingsDTO + from ._models import AlterationsDTO + from ._models import ContextDTO + from ._models import CreateKbDTO + from ._models import CreateKbInputDTO + from ._models import DeleteKbContentsDTO + from ._models import EndpointKeysDTO + from ._models import EndpointSettingsDTO + from ._models import EndpointSettingsDTOActiveLearning + from ._models import Error + from ._models import ErrorResponse, ErrorResponseException + from ._models import ErrorResponseError + from ._models import FileDTO + from ._models import InnerErrorModel + from ._models import KnowledgebaseDTO + from ._models import KnowledgebasesDTO + from ._models import MetadataDTO + from ._models import Operation + from ._models import PromptDTO + from ._models import PromptDTOQna + from ._models import QnADocumentsDTO + from ._models import QnADTO + from ._models import QnADTOContext + from ._models import ReplaceKbDTO + from ._models import UpdateContextDTO + from ._models import UpdateKbContentsDTO + from ._models import UpdateKbOperationDTO + from ._models import UpdateKbOperationDTOAdd + from ._models import UpdateKbOperationDTODelete + from ._models import UpdateKbOperationDTOUpdate + from ._models import UpdateMetadataDTO + from ._models import UpdateQnaDTO + from ._models import UpdateQnaDTOContext + from ._models import UpdateQnaDTOMetadata + from ._models import UpdateQnaDTOQuestions + from ._models import UpdateQuestionsDTO + from ._models import WordAlterationsDTO +from ._qn_amaker_client_enums import ( + EnvironmentType, ErrorCodeType, OperationStateType, - EnvironmentType, ) __all__ = [ - 'UpdateKbOperationDTOAdd', - 'UpdateKbOperationDTODelete', - 'UpdateKbOperationDTOUpdate', - 'UpdateKbOperationDTO', - 'UpdateQnaDTOQuestions', - 'UpdateQnaDTOMetadata', - 'UpdateQnaDTOContext', - 'UpdateQnaDTO', - 'UpdateKbContentsDTO', - 'UpdateQuestionsDTO', - 'MetadataDTO', - 'UpdateMetadataDTO', - 'PromptDTOQna', - 'PromptDTO', - 'UpdateContextDTO', - 'DeleteKbContentsDTO', - 'QnADTOContext', - 'QnADTO', - 'FileDTO', - 'CreateKbInputDTO', - 'QnADocumentsDTO', - 'CreateKbDTO', - 'ReplaceKbDTO', + 'ActiveLearningSettingsDTO', + 'AlterationsDTO', 'ContextDTO', - 'ErrorResponseError', + 'CreateKbDTO', + 'CreateKbInputDTO', + 'DeleteKbContentsDTO', + 'EndpointKeysDTO', + 'EndpointSettingsDTO', + 'EndpointSettingsDTOActiveLearning', + 'Error', 'ErrorResponse', 'ErrorResponseException', + 'ErrorResponseError', + 'FileDTO', 'InnerErrorModel', - 'Error', - 'Operation', 'KnowledgebaseDTO', 'KnowledgebasesDTO', - 'EndpointSettingsDTOActiveLearning', - 'EndpointSettingsDTO', - 'ActiveLearningSettingsDTO', - 'AlterationsDTO', + 'MetadataDTO', + 'Operation', + 'PromptDTO', + 'PromptDTOQna', + 'QnADocumentsDTO', + 'QnADTO', + 'QnADTOContext', + 'ReplaceKbDTO', + 'UpdateContextDTO', + 'UpdateKbContentsDTO', + 'UpdateKbOperationDTO', + 'UpdateKbOperationDTOAdd', + 'UpdateKbOperationDTODelete', + 'UpdateKbOperationDTOUpdate', + 'UpdateMetadataDTO', + 'UpdateQnaDTO', + 'UpdateQnaDTOContext', + 'UpdateQnaDTOMetadata', + 'UpdateQnaDTOQuestions', + 'UpdateQuestionsDTO', 'WordAlterationsDTO', - 'EndpointKeysDTO', 'ErrorCodeType', 'OperationStateType', 'EnvironmentType', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_models.py new file mode 100644 index 0000000000000..d435ab6d2bd21 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_models.py @@ -0,0 +1,1103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActiveLearningSettingsDTO(Model): + """Active Learning settings of the endpoint. + + :param enable: True/False string providing Active Learning + :type enable: str + """ + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ActiveLearningSettingsDTO, self).__init__(**kwargs) + self.enable = kwargs.get('enable', None) + + +class AlterationsDTO(Model): + """Collection of words that are synonyms. + + All required parameters must be populated in order to send to Azure. + + :param alterations: Required. Words that are synonymous with each other. + :type alterations: list[str] + """ + + _validation = { + 'alterations': {'required': True}, + } + + _attribute_map = { + 'alterations': {'key': 'alterations', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(AlterationsDTO, self).__init__(**kwargs) + self.alterations = kwargs.get('alterations', None) + + +class ContextDTO(Model): + """Context associated with Qna. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, **kwargs): + super(ContextDTO, self).__init__(**kwargs) + self.is_context_only = kwargs.get('is_context_only', None) + self.prompts = kwargs.get('prompts', None) + + +class CreateKbDTO(Model): + """Post body schema for CreateKb operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (QnADTO) to be added to the knowledgebase. + Q-A Ids are assigned by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + :param urls: List of URLs to be used for extracting Q-A. + :type urls: list[str] + :param files: List of files from which to Extract Q-A. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] + :param enable_hierarchical_extraction: Enable hierarchical extraction of + Q-A from files and urls. Value to be considered False if this field is not + present. + :type enable_hierarchical_extraction: bool + :param default_answer_used_for_extraction: 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. + :type default_answer_used_for_extraction: str + :param language: Language of the knowledgebase. Please find the list of + supported languages here. + :type language: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, + 'language': {'max_length': 100, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, + 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CreateKbDTO, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.qna_list = kwargs.get('qna_list', None) + self.urls = kwargs.get('urls', None) + self.files = kwargs.get('files', None) + self.enable_hierarchical_extraction = kwargs.get('enable_hierarchical_extraction', None) + self.default_answer_used_for_extraction = kwargs.get('default_answer_used_for_extraction', None) + self.language = kwargs.get('language', None) + + +class CreateKbInputDTO(Model): + """Input to create KB. + + :param qna_list: List of QNA to be added to the index. Ids are generated + by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + :param urls: List of URLs to be added to knowledgebase. + :type urls: list[str] + :param files: List of files to be added to knowledgebase. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] + """ + + _attribute_map = { + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + } + + def __init__(self, **kwargs): + super(CreateKbInputDTO, self).__init__(**kwargs) + self.qna_list = kwargs.get('qna_list', None) + self.urls = kwargs.get('urls', None) + self.files = kwargs.get('files', None) + + +class DeleteKbContentsDTO(Model): + """PATCH body schema of Delete Operation in UpdateKb. + + :param ids: List of Qna Ids to be deleted + :type ids: list[int] + :param sources: List of sources to be deleted from knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'ids': {'key': 'ids', 'type': '[int]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(DeleteKbContentsDTO, self).__init__(**kwargs) + self.ids = kwargs.get('ids', None) + self.sources = kwargs.get('sources', None) + + +class EndpointKeysDTO(Model): + """Schema for EndpointKeys generate/refresh operations. + + :param primary_endpoint_key: Primary Access Key. + :type primary_endpoint_key: str + :param secondary_endpoint_key: Secondary Access Key. + :type secondary_endpoint_key: str + :param installed_version: Current version of runtime. + :type installed_version: str + :param last_stable_version: Latest version of runtime. + :type last_stable_version: str + :param language: Language setting of runtime. + :type language: str + """ + + _attribute_map = { + 'primary_endpoint_key': {'key': 'primaryEndpointKey', 'type': 'str'}, + 'secondary_endpoint_key': {'key': 'secondaryEndpointKey', 'type': 'str'}, + 'installed_version': {'key': 'installedVersion', 'type': 'str'}, + 'last_stable_version': {'key': 'lastStableVersion', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EndpointKeysDTO, self).__init__(**kwargs) + self.primary_endpoint_key = kwargs.get('primary_endpoint_key', None) + self.secondary_endpoint_key = kwargs.get('secondary_endpoint_key', None) + self.installed_version = kwargs.get('installed_version', None) + self.last_stable_version = kwargs.get('last_stable_version', None) + self.language = kwargs.get('language', None) + + +class EndpointSettingsDTO(Model): + """Endpoint settings. + + :param active_learning: Active Learning settings of the endpoint. + :type active_learning: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.EndpointSettingsDTOActiveLearning + """ + + _attribute_map = { + 'active_learning': {'key': 'activeLearning', 'type': 'EndpointSettingsDTOActiveLearning'}, + } + + def __init__(self, **kwargs): + super(EndpointSettingsDTO, self).__init__(**kwargs) + self.active_learning = kwargs.get('active_learning', None) + + +class EndpointSettingsDTOActiveLearning(ActiveLearningSettingsDTO): + """Active Learning settings of the endpoint. + + :param enable: True/False string providing Active Learning + :type enable: str + """ + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EndpointSettingsDTOActiveLearning, self).__init__(**kwargs) + + +class Error(Model): + """The error object. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + self.inner_error = kwargs.get('inner_error', None) + + +class ErrorResponse(Model): + """Error response. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param error: The error object. + :type error: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ErrorResponseError(Error): + """The error object. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, **kwargs): + super(ErrorResponseError, self).__init__(**kwargs) + + +class FileDTO(Model): + """DTO to hold details of uploaded files. + + All required parameters must be populated in order to send to Azure. + + :param file_name: Required. File name. Supported file types are ".tsv", + ".pdf", ".txt", ".docx", ".xlsx". + :type file_name: str + :param file_uri: Required. Public URI of the file. + :type file_uri: str + """ + + _validation = { + 'file_name': {'required': True, 'max_length': 200, 'min_length': 1}, + 'file_uri': {'required': True}, + } + + _attribute_map = { + 'file_name': {'key': 'fileName', 'type': 'str'}, + 'file_uri': {'key': 'fileUri', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(FileDTO, self).__init__(**kwargs) + self.file_name = kwargs.get('file_name', None) + self.file_uri = kwargs.get('file_uri', None) + + +class InnerErrorModel(Model): + """An object containing more specific information about the error. As per + Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param code: A more specific error code than was provided by the + containing error. + :type code: str + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, **kwargs): + super(InnerErrorModel, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.inner_error = kwargs.get('inner_error', None) + + +class KnowledgebaseDTO(Model): + """Response schema for CreateKb operation. + + :param id: Unique id that identifies a knowledgebase. + :type id: str + :param host_name: URL host name at which the knowledgebase is hosted. + :type host_name: str + :param last_accessed_timestamp: Time stamp at which the knowledgebase was + last accessed (UTC). + :type last_accessed_timestamp: str + :param last_changed_timestamp: Time stamp at which the knowledgebase was + last modified (UTC). + :type last_changed_timestamp: str + :param last_published_timestamp: Time stamp at which the knowledgebase was + last published (UTC). + :type last_published_timestamp: str + :param name: Friendly name of the knowledgebase. + :type name: str + :param user_id: User who created / owns the knowledgebase. + :type user_id: str + :param urls: URL sources from which Q-A were extracted and added to the + knowledgebase. + :type urls: list[str] + :param sources: Custom sources from which Q-A were extracted or explicitly + added to the knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'last_accessed_timestamp': {'key': 'lastAccessedTimestamp', 'type': 'str'}, + 'last_changed_timestamp': {'key': 'lastChangedTimestamp', 'type': 'str'}, + 'last_published_timestamp': {'key': 'lastPublishedTimestamp', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(KnowledgebaseDTO, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.host_name = kwargs.get('host_name', None) + self.last_accessed_timestamp = kwargs.get('last_accessed_timestamp', None) + self.last_changed_timestamp = kwargs.get('last_changed_timestamp', None) + self.last_published_timestamp = kwargs.get('last_published_timestamp', None) + self.name = kwargs.get('name', None) + self.user_id = kwargs.get('user_id', None) + self.urls = kwargs.get('urls', None) + self.sources = kwargs.get('sources', None) + + +class KnowledgebasesDTO(Model): + """Collection of knowledgebases owned by a user. + + :param knowledgebases: Collection of knowledgebase records. + :type knowledgebases: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.KnowledgebaseDTO] + """ + + _attribute_map = { + 'knowledgebases': {'key': 'knowledgebases', 'type': '[KnowledgebaseDTO]'}, + } + + def __init__(self, **kwargs): + super(KnowledgebasesDTO, self).__init__(**kwargs) + self.knowledgebases = kwargs.get('knowledgebases', None) + + +class MetadataDTO(Model): + """Name - value pair of metadata. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Metadata name. + :type name: str + :param value: Required. Metadata value. + :type value: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'value': {'required': True, 'max_length': 500, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetadataDTO, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class Operation(Model): + """Record to track long running operation. + + :param operation_state: Operation state. Possible values include: + 'Failed', 'NotStarted', 'Running', 'Succeeded' + :type operation_state: str or + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.OperationStateType + :param created_timestamp: Timestamp when the operation was created. + :type created_timestamp: str + :param last_action_timestamp: Timestamp when the current state was + entered. + :type last_action_timestamp: str + :param resource_location: Relative URI to the target resource location for + completed resources. + :type resource_location: str + :param user_id: User Id + :type user_id: str + :param operation_id: Operation Id. + :type operation_id: str + :param error_response: Error details in case of failures. + :type error_response: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorResponse + """ + + _attribute_map = { + 'operation_state': {'key': 'operationState', 'type': 'str'}, + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'last_action_timestamp': {'key': 'lastActionTimestamp', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'error_response': {'key': 'errorResponse', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.operation_state = kwargs.get('operation_state', None) + self.created_timestamp = kwargs.get('created_timestamp', None) + self.last_action_timestamp = kwargs.get('last_action_timestamp', None) + self.resource_location = kwargs.get('resource_location', None) + self.user_id = kwargs.get('user_id', None) + self.operation_id = kwargs.get('operation_id', None) + self.error_response = kwargs.get('error_response', None) + + +class PromptDTO(Model): + """Prompt for an answer. + + :param display_order: Index of the prompt - used in ordering of the + prompts + :type display_order: int + :param qna_id: Qna id corresponding to the prompt - if QnaId is present, + QnADTO object is ignored. + :type qna_id: int + :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a + PromptDTO object + :type qna: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTOQna + :param display_text: Text displayed to represent a follow up question + prompt + :type display_text: str + """ + + _validation = { + 'display_text': {'max_length': 200}, + } + + _attribute_map = { + 'display_order': {'key': 'displayOrder', 'type': 'int'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, + 'display_text': {'key': 'displayText', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PromptDTO, self).__init__(**kwargs) + self.display_order = kwargs.get('display_order', None) + self.qna_id = kwargs.get('qna_id', None) + self.qna = kwargs.get('qna', None) + self.display_text = kwargs.get('display_text', None) + + +class QnADTO(Model): + """Q-A object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTOContext + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + } + + def __init__(self, **kwargs): + super(QnADTO, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.answer = kwargs.get('answer', None) + self.source = kwargs.get('source', None) + self.questions = kwargs.get('questions', None) + self.metadata = kwargs.get('metadata', None) + self.context = kwargs.get('context', None) + + +class PromptDTOQna(QnADTO): + """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTOContext + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + } + + def __init__(self, **kwargs): + super(PromptDTOQna, self).__init__(**kwargs) + + +class QnADocumentsDTO(Model): + """List of QnADTO. + + :param qna_documents: List of answers. + :type qna_documents: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + """ + + _attribute_map = { + 'qna_documents': {'key': 'qnaDocuments', 'type': '[QnADTO]'}, + } + + def __init__(self, **kwargs): + super(QnADocumentsDTO, self).__init__(**kwargs) + self.qna_documents = kwargs.get('qna_documents', None) + + +class QnADTOContext(ContextDTO): + """Context of a QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, **kwargs): + super(QnADTOContext, self).__init__(**kwargs) + + +class ReplaceKbDTO(Model): + """Post body schema for Replace KB operation. + + All required parameters must be populated in order to send to Azure. + + :param qn_alist: Required. List of Q-A (QnADTO) to be added to the + knowledgebase. Q-A Ids are assigned by the service and should be omitted. + :type qn_alist: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + """ + + _validation = { + 'qn_alist': {'required': True}, + } + + _attribute_map = { + 'qn_alist': {'key': 'qnAList', 'type': '[QnADTO]'}, + } + + def __init__(self, **kwargs): + super(ReplaceKbDTO, self).__init__(**kwargs) + self.qn_alist = kwargs.get('qn_alist', None) + + +class UpdateContextDTO(Model): + """Update Body schema to represent context to be updated. + + :param prompts_to_delete: List of prompts associated with qna to be + deleted + :type prompts_to_delete: list[int] + :param prompts_to_add: List of prompts to be added to the qna. + :type prompts_to_add: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + """ + + _attribute_map = { + 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, + 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(UpdateContextDTO, self).__init__(**kwargs) + self.prompts_to_delete = kwargs.get('prompts_to_delete', None) + self.prompts_to_add = kwargs.get('prompts_to_add', None) + self.is_context_only = kwargs.get('is_context_only', None) + + +class UpdateKbContentsDTO(Model): + """PATCH body schema for Update operation in Update Kb. + + :param name: Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the + knowledgebase. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTO] + :param urls: List of existing URLs to be refreshed. The content will be + extracted again and re-indexed. + :type urls: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UpdateKbContentsDTO, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.qna_list = kwargs.get('qna_list', None) + self.urls = kwargs.get('urls', None) + + +class UpdateKbOperationDTO(Model): + """Contains list of QnAs to be updated. + + :param add: An instance of CreateKbInputDTO for add operation + :type add: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTOAdd + :param delete: An instance of DeleteKbContentsDTO for delete Operation + :type delete: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTODelete + :param update: An instance of UpdateKbContentsDTO for Update Operation + :type update: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTOUpdate + :param enable_hierarchical_extraction: 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. + :type enable_hierarchical_extraction: bool + :param default_answer_used_for_extraction: 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. + :type default_answer_used_for_extraction: str + """ + + _validation = { + 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'add': {'key': 'add', 'type': 'UpdateKbOperationDTOAdd'}, + 'delete': {'key': 'delete', 'type': 'UpdateKbOperationDTODelete'}, + 'update': {'key': 'update', 'type': 'UpdateKbOperationDTOUpdate'}, + 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, + 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UpdateKbOperationDTO, self).__init__(**kwargs) + self.add = kwargs.get('add', None) + self.delete = kwargs.get('delete', None) + self.update = kwargs.get('update', None) + self.enable_hierarchical_extraction = kwargs.get('enable_hierarchical_extraction', None) + self.default_answer_used_for_extraction = kwargs.get('default_answer_used_for_extraction', None) + + +class UpdateKbOperationDTOAdd(CreateKbInputDTO): + """An instance of CreateKbInputDTO for add operation. + + :param qna_list: List of QNA to be added to the index. Ids are generated + by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + :param urls: List of URLs to be added to knowledgebase. + :type urls: list[str] + :param files: List of files to be added to knowledgebase. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] + """ + + _attribute_map = { + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + } + + def __init__(self, **kwargs): + super(UpdateKbOperationDTOAdd, self).__init__(**kwargs) + + +class UpdateKbOperationDTODelete(DeleteKbContentsDTO): + """An instance of DeleteKbContentsDTO for delete Operation. + + :param ids: List of Qna Ids to be deleted + :type ids: list[int] + :param sources: List of sources to be deleted from knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'ids': {'key': 'ids', 'type': '[int]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UpdateKbOperationDTODelete, self).__init__(**kwargs) + + +class UpdateKbOperationDTOUpdate(UpdateKbContentsDTO): + """An instance of UpdateKbContentsDTO for Update Operation. + + :param name: Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the + knowledgebase. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTO] + :param urls: List of existing URLs to be refreshed. The content will be + extracted again and re-indexed. + :type urls: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UpdateKbOperationDTOUpdate, self).__init__(**kwargs) + + +class UpdateMetadataDTO(Model): + """PATCH Body schema to represent list of Metadata to be updated. + + :param delete: List of Metadata associated with answer to be deleted + :type delete: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + :param add: List of metadata associated with answer to be added + :type add: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + """ + + _attribute_map = { + 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, + 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + } + + def __init__(self, **kwargs): + super(UpdateMetadataDTO, self).__init__(**kwargs) + self.delete = kwargs.get('delete', None) + self.add = kwargs.get('add', None) + + +class UpdateQnaDTO(Model): + """PATCH Body schema for Update Qna List. + + :param id: Unique id for the Q-A + :type id: int + :param answer: Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: List of questions associated with the answer. + :type questions: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOQuestions + :param metadata: List of metadata associated with the answer to be updated + :type metadata: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOMetadata + :param context: Context associated with Qna to be updated. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOContext + """ + + _validation = { + 'id': {'maximum': 2147483647, 'minimum': 0}, + 'source': {'max_length': 300}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': 'UpdateQnaDTOQuestions'}, + 'metadata': {'key': 'metadata', 'type': 'UpdateQnaDTOMetadata'}, + 'context': {'key': 'context', 'type': 'UpdateQnaDTOContext'}, + } + + def __init__(self, **kwargs): + super(UpdateQnaDTO, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.answer = kwargs.get('answer', None) + self.source = kwargs.get('source', None) + self.questions = kwargs.get('questions', None) + self.metadata = kwargs.get('metadata', None) + self.context = kwargs.get('context', None) + + +class UpdateQnaDTOContext(UpdateContextDTO): + """Context associated with Qna to be updated. + + :param prompts_to_delete: List of prompts associated with qna to be + deleted + :type prompts_to_delete: list[int] + :param prompts_to_add: List of prompts to be added to the qna. + :type prompts_to_add: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + """ + + _attribute_map = { + 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, + 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(UpdateQnaDTOContext, self).__init__(**kwargs) + + +class UpdateQnaDTOMetadata(UpdateMetadataDTO): + """List of metadata associated with the answer to be updated. + + :param delete: List of Metadata associated with answer to be deleted + :type delete: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + :param add: List of metadata associated with answer to be added + :type add: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + """ + + _attribute_map = { + 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, + 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + } + + def __init__(self, **kwargs): + super(UpdateQnaDTOMetadata, self).__init__(**kwargs) + + +class UpdateQuestionsDTO(Model): + """PATCH Body schema for Update Kb which contains list of questions to be + added and deleted. + + :param add: List of questions to be added + :type add: list[str] + :param delete: List of questions to be deleted. + :type delete: list[str] + """ + + _attribute_map = { + 'add': {'key': 'add', 'type': '[str]'}, + 'delete': {'key': 'delete', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UpdateQuestionsDTO, self).__init__(**kwargs) + self.add = kwargs.get('add', None) + self.delete = kwargs.get('delete', None) + + +class UpdateQnaDTOQuestions(UpdateQuestionsDTO): + """List of questions associated with the answer. + + :param add: List of questions to be added + :type add: list[str] + :param delete: List of questions to be deleted. + :type delete: list[str] + """ + + _attribute_map = { + 'add': {'key': 'add', 'type': '[str]'}, + 'delete': {'key': 'delete', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UpdateQnaDTOQuestions, self).__init__(**kwargs) + + +class WordAlterationsDTO(Model): + """Collection of word alterations. + + All required parameters must be populated in order to send to Azure. + + :param word_alterations: Required. Collection of word alterations. + :type word_alterations: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.AlterationsDTO] + """ + + _validation = { + 'word_alterations': {'required': True}, + } + + _attribute_map = { + 'word_alterations': {'key': 'wordAlterations', 'type': '[AlterationsDTO]'}, + } + + def __init__(self, **kwargs): + super(WordAlterationsDTO, self).__init__(**kwargs) + self.word_alterations = kwargs.get('word_alterations', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_models_py3.py new file mode 100644 index 0000000000000..529b43d281bb3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_models_py3.py @@ -0,0 +1,1103 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActiveLearningSettingsDTO(Model): + """Active Learning settings of the endpoint. + + :param enable: True/False string providing Active Learning + :type enable: str + """ + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'str'}, + } + + def __init__(self, *, enable: str=None, **kwargs) -> None: + super(ActiveLearningSettingsDTO, self).__init__(**kwargs) + self.enable = enable + + +class AlterationsDTO(Model): + """Collection of words that are synonyms. + + All required parameters must be populated in order to send to Azure. + + :param alterations: Required. Words that are synonymous with each other. + :type alterations: list[str] + """ + + _validation = { + 'alterations': {'required': True}, + } + + _attribute_map = { + 'alterations': {'key': 'alterations', 'type': '[str]'}, + } + + def __init__(self, *, alterations, **kwargs) -> None: + super(AlterationsDTO, self).__init__(**kwargs) + self.alterations = alterations + + +class ContextDTO(Model): + """Context associated with Qna. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: + super(ContextDTO, self).__init__(**kwargs) + self.is_context_only = is_context_only + self.prompts = prompts + + +class CreateKbDTO(Model): + """Post body schema for CreateKb operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (QnADTO) to be added to the knowledgebase. + Q-A Ids are assigned by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + :param urls: List of URLs to be used for extracting Q-A. + :type urls: list[str] + :param files: List of files from which to Extract Q-A. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] + :param enable_hierarchical_extraction: Enable hierarchical extraction of + Q-A from files and urls. Value to be considered False if this field is not + present. + :type enable_hierarchical_extraction: bool + :param default_answer_used_for_extraction: 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. + :type default_answer_used_for_extraction: str + :param language: Language of the knowledgebase. Please find the list of + supported languages here. + :type language: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, + 'language': {'max_length': 100, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, + 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, *, name: str, qna_list=None, urls=None, files=None, enable_hierarchical_extraction: bool=None, default_answer_used_for_extraction: str=None, language: str=None, **kwargs) -> None: + super(CreateKbDTO, self).__init__(**kwargs) + self.name = name + self.qna_list = qna_list + self.urls = urls + self.files = files + self.enable_hierarchical_extraction = enable_hierarchical_extraction + self.default_answer_used_for_extraction = default_answer_used_for_extraction + self.language = language + + +class CreateKbInputDTO(Model): + """Input to create KB. + + :param qna_list: List of QNA to be added to the index. Ids are generated + by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + :param urls: List of URLs to be added to knowledgebase. + :type urls: list[str] + :param files: List of files to be added to knowledgebase. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] + """ + + _attribute_map = { + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + } + + def __init__(self, *, qna_list=None, urls=None, files=None, **kwargs) -> None: + super(CreateKbInputDTO, self).__init__(**kwargs) + self.qna_list = qna_list + self.urls = urls + self.files = files + + +class DeleteKbContentsDTO(Model): + """PATCH body schema of Delete Operation in UpdateKb. + + :param ids: List of Qna Ids to be deleted + :type ids: list[int] + :param sources: List of sources to be deleted from knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'ids': {'key': 'ids', 'type': '[int]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, *, ids=None, sources=None, **kwargs) -> None: + super(DeleteKbContentsDTO, self).__init__(**kwargs) + self.ids = ids + self.sources = sources + + +class EndpointKeysDTO(Model): + """Schema for EndpointKeys generate/refresh operations. + + :param primary_endpoint_key: Primary Access Key. + :type primary_endpoint_key: str + :param secondary_endpoint_key: Secondary Access Key. + :type secondary_endpoint_key: str + :param installed_version: Current version of runtime. + :type installed_version: str + :param last_stable_version: Latest version of runtime. + :type last_stable_version: str + :param language: Language setting of runtime. + :type language: str + """ + + _attribute_map = { + 'primary_endpoint_key': {'key': 'primaryEndpointKey', 'type': 'str'}, + 'secondary_endpoint_key': {'key': 'secondaryEndpointKey', 'type': 'str'}, + 'installed_version': {'key': 'installedVersion', 'type': 'str'}, + 'last_stable_version': {'key': 'lastStableVersion', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, *, primary_endpoint_key: str=None, secondary_endpoint_key: str=None, installed_version: str=None, last_stable_version: str=None, language: str=None, **kwargs) -> None: + super(EndpointKeysDTO, self).__init__(**kwargs) + self.primary_endpoint_key = primary_endpoint_key + self.secondary_endpoint_key = secondary_endpoint_key + self.installed_version = installed_version + self.last_stable_version = last_stable_version + self.language = language + + +class EndpointSettingsDTO(Model): + """Endpoint settings. + + :param active_learning: Active Learning settings of the endpoint. + :type active_learning: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.EndpointSettingsDTOActiveLearning + """ + + _attribute_map = { + 'active_learning': {'key': 'activeLearning', 'type': 'EndpointSettingsDTOActiveLearning'}, + } + + def __init__(self, *, active_learning=None, **kwargs) -> None: + super(EndpointSettingsDTO, self).__init__(**kwargs) + self.active_learning = active_learning + + +class EndpointSettingsDTOActiveLearning(ActiveLearningSettingsDTO): + """Active Learning settings of the endpoint. + + :param enable: True/False string providing Active Learning + :type enable: str + """ + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'str'}, + } + + def __init__(self, *, enable: str=None, **kwargs) -> None: + super(EndpointSettingsDTOActiveLearning, self).__init__(enable=enable, **kwargs) + + +class Error(Model): + """The error object. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + self.inner_error = inner_error + + +class ErrorResponse(Model): + """Error response. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param error: The error object. + :type error: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ErrorResponseError(Error): + """The error object. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: + super(ErrorResponseError, self).__init__(code=code, message=message, target=target, details=details, inner_error=inner_error, **kwargs) + + +class FileDTO(Model): + """DTO to hold details of uploaded files. + + All required parameters must be populated in order to send to Azure. + + :param file_name: Required. File name. Supported file types are ".tsv", + ".pdf", ".txt", ".docx", ".xlsx". + :type file_name: str + :param file_uri: Required. Public URI of the file. + :type file_uri: str + """ + + _validation = { + 'file_name': {'required': True, 'max_length': 200, 'min_length': 1}, + 'file_uri': {'required': True}, + } + + _attribute_map = { + 'file_name': {'key': 'fileName', 'type': 'str'}, + 'file_uri': {'key': 'fileUri', 'type': 'str'}, + } + + def __init__(self, *, file_name: str, file_uri: str, **kwargs) -> None: + super(FileDTO, self).__init__(**kwargs) + self.file_name = file_name + self.file_uri = file_uri + + +class InnerErrorModel(Model): + """An object containing more specific information about the error. As per + Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param code: A more specific error code than was provided by the + containing error. + :type code: str + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, *, code: str=None, inner_error=None, **kwargs) -> None: + super(InnerErrorModel, self).__init__(**kwargs) + self.code = code + self.inner_error = inner_error + + +class KnowledgebaseDTO(Model): + """Response schema for CreateKb operation. + + :param id: Unique id that identifies a knowledgebase. + :type id: str + :param host_name: URL host name at which the knowledgebase is hosted. + :type host_name: str + :param last_accessed_timestamp: Time stamp at which the knowledgebase was + last accessed (UTC). + :type last_accessed_timestamp: str + :param last_changed_timestamp: Time stamp at which the knowledgebase was + last modified (UTC). + :type last_changed_timestamp: str + :param last_published_timestamp: Time stamp at which the knowledgebase was + last published (UTC). + :type last_published_timestamp: str + :param name: Friendly name of the knowledgebase. + :type name: str + :param user_id: User who created / owns the knowledgebase. + :type user_id: str + :param urls: URL sources from which Q-A were extracted and added to the + knowledgebase. + :type urls: list[str] + :param sources: Custom sources from which Q-A were extracted or explicitly + added to the knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'last_accessed_timestamp': {'key': 'lastAccessedTimestamp', 'type': 'str'}, + 'last_changed_timestamp': {'key': 'lastChangedTimestamp', 'type': 'str'}, + 'last_published_timestamp': {'key': 'lastPublishedTimestamp', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, *, id: str=None, host_name: str=None, last_accessed_timestamp: str=None, last_changed_timestamp: str=None, last_published_timestamp: str=None, name: str=None, user_id: str=None, urls=None, sources=None, **kwargs) -> None: + super(KnowledgebaseDTO, self).__init__(**kwargs) + self.id = id + self.host_name = host_name + self.last_accessed_timestamp = last_accessed_timestamp + self.last_changed_timestamp = last_changed_timestamp + self.last_published_timestamp = last_published_timestamp + self.name = name + self.user_id = user_id + self.urls = urls + self.sources = sources + + +class KnowledgebasesDTO(Model): + """Collection of knowledgebases owned by a user. + + :param knowledgebases: Collection of knowledgebase records. + :type knowledgebases: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.KnowledgebaseDTO] + """ + + _attribute_map = { + 'knowledgebases': {'key': 'knowledgebases', 'type': '[KnowledgebaseDTO]'}, + } + + def __init__(self, *, knowledgebases=None, **kwargs) -> None: + super(KnowledgebasesDTO, self).__init__(**kwargs) + self.knowledgebases = knowledgebases + + +class MetadataDTO(Model): + """Name - value pair of metadata. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Metadata name. + :type name: str + :param value: Required. Metadata value. + :type value: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'value': {'required': True, 'max_length': 500, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str, **kwargs) -> None: + super(MetadataDTO, self).__init__(**kwargs) + self.name = name + self.value = value + + +class Operation(Model): + """Record to track long running operation. + + :param operation_state: Operation state. Possible values include: + 'Failed', 'NotStarted', 'Running', 'Succeeded' + :type operation_state: str or + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.OperationStateType + :param created_timestamp: Timestamp when the operation was created. + :type created_timestamp: str + :param last_action_timestamp: Timestamp when the current state was + entered. + :type last_action_timestamp: str + :param resource_location: Relative URI to the target resource location for + completed resources. + :type resource_location: str + :param user_id: User Id + :type user_id: str + :param operation_id: Operation Id. + :type operation_id: str + :param error_response: Error details in case of failures. + :type error_response: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorResponse + """ + + _attribute_map = { + 'operation_state': {'key': 'operationState', 'type': 'str'}, + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'last_action_timestamp': {'key': 'lastActionTimestamp', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'error_response': {'key': 'errorResponse', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, operation_state=None, created_timestamp: str=None, last_action_timestamp: str=None, resource_location: str=None, user_id: str=None, operation_id: str=None, error_response=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.operation_state = operation_state + self.created_timestamp = created_timestamp + self.last_action_timestamp = last_action_timestamp + self.resource_location = resource_location + self.user_id = user_id + self.operation_id = operation_id + self.error_response = error_response + + +class PromptDTO(Model): + """Prompt for an answer. + + :param display_order: Index of the prompt - used in ordering of the + prompts + :type display_order: int + :param qna_id: Qna id corresponding to the prompt - if QnaId is present, + QnADTO object is ignored. + :type qna_id: int + :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a + PromptDTO object + :type qna: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTOQna + :param display_text: Text displayed to represent a follow up question + prompt + :type display_text: str + """ + + _validation = { + 'display_text': {'max_length': 200}, + } + + _attribute_map = { + 'display_order': {'key': 'displayOrder', 'type': 'int'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, + 'display_text': {'key': 'displayText', 'type': 'str'}, + } + + def __init__(self, *, display_order: int=None, qna_id: int=None, qna=None, display_text: str=None, **kwargs) -> None: + super(PromptDTO, self).__init__(**kwargs) + self.display_order = display_order + self.qna_id = qna_id + self.qna = qna + self.display_text = display_text + + +class QnADTO(Model): + """Q-A object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTOContext + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + } + + def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: + super(QnADTO, self).__init__(**kwargs) + self.id = id + self.answer = answer + self.source = source + self.questions = questions + self.metadata = metadata + self.context = context + + +class PromptDTOQna(QnADTO): + """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTOContext + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + } + + def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: + super(PromptDTOQna, self).__init__(id=id, answer=answer, source=source, questions=questions, metadata=metadata, context=context, **kwargs) + + +class QnADocumentsDTO(Model): + """List of QnADTO. + + :param qna_documents: List of answers. + :type qna_documents: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + """ + + _attribute_map = { + 'qna_documents': {'key': 'qnaDocuments', 'type': '[QnADTO]'}, + } + + def __init__(self, *, qna_documents=None, **kwargs) -> None: + super(QnADocumentsDTO, self).__init__(**kwargs) + self.qna_documents = qna_documents + + +class QnADTOContext(ContextDTO): + """Context of a QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: + super(QnADTOContext, self).__init__(is_context_only=is_context_only, prompts=prompts, **kwargs) + + +class ReplaceKbDTO(Model): + """Post body schema for Replace KB operation. + + All required parameters must be populated in order to send to Azure. + + :param qn_alist: Required. List of Q-A (QnADTO) to be added to the + knowledgebase. Q-A Ids are assigned by the service and should be omitted. + :type qn_alist: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + """ + + _validation = { + 'qn_alist': {'required': True}, + } + + _attribute_map = { + 'qn_alist': {'key': 'qnAList', 'type': '[QnADTO]'}, + } + + def __init__(self, *, qn_alist, **kwargs) -> None: + super(ReplaceKbDTO, self).__init__(**kwargs) + self.qn_alist = qn_alist + + +class UpdateContextDTO(Model): + """Update Body schema to represent context to be updated. + + :param prompts_to_delete: List of prompts associated with qna to be + deleted + :type prompts_to_delete: list[int] + :param prompts_to_add: List of prompts to be added to the qna. + :type prompts_to_add: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + """ + + _attribute_map = { + 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, + 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + } + + def __init__(self, *, prompts_to_delete=None, prompts_to_add=None, is_context_only: bool=None, **kwargs) -> None: + super(UpdateContextDTO, self).__init__(**kwargs) + self.prompts_to_delete = prompts_to_delete + self.prompts_to_add = prompts_to_add + self.is_context_only = is_context_only + + +class UpdateKbContentsDTO(Model): + """PATCH body schema for Update operation in Update Kb. + + :param name: Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the + knowledgebase. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTO] + :param urls: List of existing URLs to be refreshed. The content will be + extracted again and re-indexed. + :type urls: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + } + + def __init__(self, *, name: str=None, qna_list=None, urls=None, **kwargs) -> None: + super(UpdateKbContentsDTO, self).__init__(**kwargs) + self.name = name + self.qna_list = qna_list + self.urls = urls + + +class UpdateKbOperationDTO(Model): + """Contains list of QnAs to be updated. + + :param add: An instance of CreateKbInputDTO for add operation + :type add: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTOAdd + :param delete: An instance of DeleteKbContentsDTO for delete Operation + :type delete: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTODelete + :param update: An instance of UpdateKbContentsDTO for Update Operation + :type update: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTOUpdate + :param enable_hierarchical_extraction: 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. + :type enable_hierarchical_extraction: bool + :param default_answer_used_for_extraction: 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. + :type default_answer_used_for_extraction: str + """ + + _validation = { + 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'add': {'key': 'add', 'type': 'UpdateKbOperationDTOAdd'}, + 'delete': {'key': 'delete', 'type': 'UpdateKbOperationDTODelete'}, + 'update': {'key': 'update', 'type': 'UpdateKbOperationDTOUpdate'}, + 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, + 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, + } + + def __init__(self, *, add=None, delete=None, update=None, enable_hierarchical_extraction: bool=None, default_answer_used_for_extraction: str=None, **kwargs) -> None: + super(UpdateKbOperationDTO, self).__init__(**kwargs) + self.add = add + self.delete = delete + self.update = update + self.enable_hierarchical_extraction = enable_hierarchical_extraction + self.default_answer_used_for_extraction = default_answer_used_for_extraction + + +class UpdateKbOperationDTOAdd(CreateKbInputDTO): + """An instance of CreateKbInputDTO for add operation. + + :param qna_list: List of QNA to be added to the index. Ids are generated + by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] + :param urls: List of URLs to be added to knowledgebase. + :type urls: list[str] + :param files: List of files to be added to knowledgebase. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] + """ + + _attribute_map = { + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + } + + def __init__(self, *, qna_list=None, urls=None, files=None, **kwargs) -> None: + super(UpdateKbOperationDTOAdd, self).__init__(qna_list=qna_list, urls=urls, files=files, **kwargs) + + +class UpdateKbOperationDTODelete(DeleteKbContentsDTO): + """An instance of DeleteKbContentsDTO for delete Operation. + + :param ids: List of Qna Ids to be deleted + :type ids: list[int] + :param sources: List of sources to be deleted from knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'ids': {'key': 'ids', 'type': '[int]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, *, ids=None, sources=None, **kwargs) -> None: + super(UpdateKbOperationDTODelete, self).__init__(ids=ids, sources=sources, **kwargs) + + +class UpdateKbOperationDTOUpdate(UpdateKbContentsDTO): + """An instance of UpdateKbContentsDTO for Update Operation. + + :param name: Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the + knowledgebase. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTO] + :param urls: List of existing URLs to be refreshed. The content will be + extracted again and re-indexed. + :type urls: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + } + + def __init__(self, *, name: str=None, qna_list=None, urls=None, **kwargs) -> None: + super(UpdateKbOperationDTOUpdate, self).__init__(name=name, qna_list=qna_list, urls=urls, **kwargs) + + +class UpdateMetadataDTO(Model): + """PATCH Body schema to represent list of Metadata to be updated. + + :param delete: List of Metadata associated with answer to be deleted + :type delete: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + :param add: List of metadata associated with answer to be added + :type add: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + """ + + _attribute_map = { + 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, + 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + } + + def __init__(self, *, delete=None, add=None, **kwargs) -> None: + super(UpdateMetadataDTO, self).__init__(**kwargs) + self.delete = delete + self.add = add + + +class UpdateQnaDTO(Model): + """PATCH Body schema for Update Qna List. + + :param id: Unique id for the Q-A + :type id: int + :param answer: Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: List of questions associated with the answer. + :type questions: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOQuestions + :param metadata: List of metadata associated with the answer to be updated + :type metadata: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOMetadata + :param context: Context associated with Qna to be updated. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOContext + """ + + _validation = { + 'id': {'maximum': 2147483647, 'minimum': 0}, + 'source': {'max_length': 300}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': 'UpdateQnaDTOQuestions'}, + 'metadata': {'key': 'metadata', 'type': 'UpdateQnaDTOMetadata'}, + 'context': {'key': 'context', 'type': 'UpdateQnaDTOContext'}, + } + + def __init__(self, *, id: int=None, answer: str=None, source: str=None, questions=None, metadata=None, context=None, **kwargs) -> None: + super(UpdateQnaDTO, self).__init__(**kwargs) + self.id = id + self.answer = answer + self.source = source + self.questions = questions + self.metadata = metadata + self.context = context + + +class UpdateQnaDTOContext(UpdateContextDTO): + """Context associated with Qna to be updated. + + :param prompts_to_delete: List of prompts associated with qna to be + deleted + :type prompts_to_delete: list[int] + :param prompts_to_add: List of prompts to be added to the qna. + :type prompts_to_add: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + """ + + _attribute_map = { + 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, + 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + } + + def __init__(self, *, prompts_to_delete=None, prompts_to_add=None, is_context_only: bool=None, **kwargs) -> None: + super(UpdateQnaDTOContext, self).__init__(prompts_to_delete=prompts_to_delete, prompts_to_add=prompts_to_add, is_context_only=is_context_only, **kwargs) + + +class UpdateQnaDTOMetadata(UpdateMetadataDTO): + """List of metadata associated with the answer to be updated. + + :param delete: List of Metadata associated with answer to be deleted + :type delete: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + :param add: List of metadata associated with answer to be added + :type add: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] + """ + + _attribute_map = { + 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, + 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + } + + def __init__(self, *, delete=None, add=None, **kwargs) -> None: + super(UpdateQnaDTOMetadata, self).__init__(delete=delete, add=add, **kwargs) + + +class UpdateQuestionsDTO(Model): + """PATCH Body schema for Update Kb which contains list of questions to be + added and deleted. + + :param add: List of questions to be added + :type add: list[str] + :param delete: List of questions to be deleted. + :type delete: list[str] + """ + + _attribute_map = { + 'add': {'key': 'add', 'type': '[str]'}, + 'delete': {'key': 'delete', 'type': '[str]'}, + } + + def __init__(self, *, add=None, delete=None, **kwargs) -> None: + super(UpdateQuestionsDTO, self).__init__(**kwargs) + self.add = add + self.delete = delete + + +class UpdateQnaDTOQuestions(UpdateQuestionsDTO): + """List of questions associated with the answer. + + :param add: List of questions to be added + :type add: list[str] + :param delete: List of questions to be deleted. + :type delete: list[str] + """ + + _attribute_map = { + 'add': {'key': 'add', 'type': '[str]'}, + 'delete': {'key': 'delete', 'type': '[str]'}, + } + + def __init__(self, *, add=None, delete=None, **kwargs) -> None: + super(UpdateQnaDTOQuestions, self).__init__(add=add, delete=delete, **kwargs) + + +class WordAlterationsDTO(Model): + """Collection of word alterations. + + All required parameters must be populated in order to send to Azure. + + :param word_alterations: Required. Collection of word alterations. + :type word_alterations: + list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.AlterationsDTO] + """ + + _validation = { + 'word_alterations': {'required': True}, + } + + _attribute_map = { + 'word_alterations': {'key': 'wordAlterations', 'type': '[AlterationsDTO]'}, + } + + def __init__(self, *, word_alterations, **kwargs) -> None: + super(WordAlterationsDTO, self).__init__(**kwargs) + self.word_alterations = word_alterations diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_amaker_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_qn_amaker_client_enums.py similarity index 100% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_amaker_client_enums.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/_qn_amaker_client_enums.py diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/alterations_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/alterations_dto.py deleted file mode 100644 index 35562e26932a2..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/alterations_dto.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AlterationsDTO(Model): - """Collection of words that are synonyms. - - All required parameters must be populated in order to send to Azure. - - :param alterations: Required. Words that are synonymous with each other. - :type alterations: list[str] - """ - - _validation = { - 'alterations': {'required': True}, - } - - _attribute_map = { - 'alterations': {'key': 'alterations', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(AlterationsDTO, self).__init__(**kwargs) - self.alterations = kwargs.get('alterations', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/alterations_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/alterations_dto_py3.py deleted file mode 100644 index 3adbcce49bf6c..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/alterations_dto_py3.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class AlterationsDTO(Model): - """Collection of words that are synonyms. - - All required parameters must be populated in order to send to Azure. - - :param alterations: Required. Words that are synonymous with each other. - :type alterations: list[str] - """ - - _validation = { - 'alterations': {'required': True}, - } - - _attribute_map = { - 'alterations': {'key': 'alterations', 'type': '[str]'}, - } - - def __init__(self, *, alterations, **kwargs) -> None: - super(AlterationsDTO, self).__init__(**kwargs) - self.alterations = alterations diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/context_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/context_dto.py deleted file mode 100644 index 5cacb84f39a04..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/context_dto.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ContextDTO(Model): - """Context associated with Qna. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, **kwargs): - super(ContextDTO, self).__init__(**kwargs) - self.is_context_only = kwargs.get('is_context_only', None) - self.prompts = kwargs.get('prompts', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/context_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/context_dto_py3.py deleted file mode 100644 index 78c451d0da9e1..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/context_dto_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ContextDTO(Model): - """Context associated with Qna. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: - super(ContextDTO, self).__init__(**kwargs) - self.is_context_only = is_context_only - self.prompts = prompts diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_dto.py deleted file mode 100644 index 2ecfd2e3a615d..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_dto.py +++ /dev/null @@ -1,68 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CreateKbDTO(Model): - """Post body schema for CreateKb operation. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Friendly name for the knowledgebase. - :type name: str - :param qna_list: List of Q-A (QnADTO) to be added to the knowledgebase. - Q-A Ids are assigned by the service and should be omitted. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - :param urls: List of URLs to be used for extracting Q-A. - :type urls: list[str] - :param files: List of files from which to Extract Q-A. - :type files: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] - :param enable_hierarchical_extraction: Enable hierarchical extraction of - Q-A from files and urls. Value to be considered False if this field is not - present. - :type enable_hierarchical_extraction: bool - :param default_answer_used_for_extraction: 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. - :type default_answer_used_for_extraction: str - :param language: Language of the knowledgebase. - :type language: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 100, 'min_length': 1}, - 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, - 'language': {'max_length': 100, 'min_length': 1}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - 'files': {'key': 'files', 'type': '[FileDTO]'}, - 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, - 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, - 'language': {'key': 'language', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(CreateKbDTO, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.qna_list = kwargs.get('qna_list', None) - self.urls = kwargs.get('urls', None) - self.files = kwargs.get('files', None) - self.enable_hierarchical_extraction = kwargs.get('enable_hierarchical_extraction', None) - self.default_answer_used_for_extraction = kwargs.get('default_answer_used_for_extraction', None) - self.language = kwargs.get('language', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_dto_py3.py deleted file mode 100644 index f65481aa84afb..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_dto_py3.py +++ /dev/null @@ -1,68 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CreateKbDTO(Model): - """Post body schema for CreateKb operation. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Friendly name for the knowledgebase. - :type name: str - :param qna_list: List of Q-A (QnADTO) to be added to the knowledgebase. - Q-A Ids are assigned by the service and should be omitted. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - :param urls: List of URLs to be used for extracting Q-A. - :type urls: list[str] - :param files: List of files from which to Extract Q-A. - :type files: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] - :param enable_hierarchical_extraction: Enable hierarchical extraction of - Q-A from files and urls. Value to be considered False if this field is not - present. - :type enable_hierarchical_extraction: bool - :param default_answer_used_for_extraction: 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. - :type default_answer_used_for_extraction: str - :param language: Language of the knowledgebase. - :type language: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 100, 'min_length': 1}, - 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, - 'language': {'max_length': 100, 'min_length': 1}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - 'files': {'key': 'files', 'type': '[FileDTO]'}, - 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, - 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, - 'language': {'key': 'language', 'type': 'str'}, - } - - def __init__(self, *, name: str, qna_list=None, urls=None, files=None, enable_hierarchical_extraction: bool=None, default_answer_used_for_extraction: str=None, language: str=None, **kwargs) -> None: - super(CreateKbDTO, self).__init__(**kwargs) - self.name = name - self.qna_list = qna_list - self.urls = urls - self.files = files - self.enable_hierarchical_extraction = enable_hierarchical_extraction - self.default_answer_used_for_extraction = default_answer_used_for_extraction - self.language = language diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_input_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_input_dto.py deleted file mode 100644 index b67e9972485ad..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_input_dto.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CreateKbInputDTO(Model): - """Input to create KB. - - :param qna_list: List of QNA to be added to the index. Ids are generated - by the service and should be omitted. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - :param urls: List of URLs to be added to knowledgebase. - :type urls: list[str] - :param files: List of files to be added to knowledgebase. - :type files: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] - """ - - _attribute_map = { - 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - 'files': {'key': 'files', 'type': '[FileDTO]'}, - } - - def __init__(self, **kwargs): - super(CreateKbInputDTO, self).__init__(**kwargs) - self.qna_list = kwargs.get('qna_list', None) - self.urls = kwargs.get('urls', None) - self.files = kwargs.get('files', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_input_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_input_dto_py3.py deleted file mode 100644 index 9cc2b68094be3..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/create_kb_input_dto_py3.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class CreateKbInputDTO(Model): - """Input to create KB. - - :param qna_list: List of QNA to be added to the index. Ids are generated - by the service and should be omitted. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - :param urls: List of URLs to be added to knowledgebase. - :type urls: list[str] - :param files: List of files to be added to knowledgebase. - :type files: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] - """ - - _attribute_map = { - 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - 'files': {'key': 'files', 'type': '[FileDTO]'}, - } - - def __init__(self, *, qna_list=None, urls=None, files=None, **kwargs) -> None: - super(CreateKbInputDTO, self).__init__(**kwargs) - self.qna_list = qna_list - self.urls = urls - self.files = files diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/delete_kb_contents_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/delete_kb_contents_dto.py deleted file mode 100644 index d4563cc31a8d2..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/delete_kb_contents_dto.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class DeleteKbContentsDTO(Model): - """PATCH body schema of Delete Operation in UpdateKb. - - :param ids: List of Qna Ids to be deleted - :type ids: list[int] - :param sources: List of sources to be deleted from knowledgebase. - :type sources: list[str] - """ - - _attribute_map = { - 'ids': {'key': 'ids', 'type': '[int]'}, - 'sources': {'key': 'sources', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(DeleteKbContentsDTO, self).__init__(**kwargs) - self.ids = kwargs.get('ids', None) - self.sources = kwargs.get('sources', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/delete_kb_contents_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/delete_kb_contents_dto_py3.py deleted file mode 100644 index 50532c441a7e7..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/delete_kb_contents_dto_py3.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class DeleteKbContentsDTO(Model): - """PATCH body schema of Delete Operation in UpdateKb. - - :param ids: List of Qna Ids to be deleted - :type ids: list[int] - :param sources: List of sources to be deleted from knowledgebase. - :type sources: list[str] - """ - - _attribute_map = { - 'ids': {'key': 'ids', 'type': '[int]'}, - 'sources': {'key': 'sources', 'type': '[str]'}, - } - - def __init__(self, *, ids=None, sources=None, **kwargs) -> None: - super(DeleteKbContentsDTO, self).__init__(**kwargs) - self.ids = ids - self.sources = sources diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_keys_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_keys_dto.py deleted file mode 100644 index ecb62afcf79d5..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_keys_dto.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class EndpointKeysDTO(Model): - """Schema for EndpointKeys generate/refresh operations. - - :param primary_endpoint_key: Primary Access Key. - :type primary_endpoint_key: str - :param secondary_endpoint_key: Secondary Access Key. - :type secondary_endpoint_key: str - :param installed_version: Current version of runtime. - :type installed_version: str - :param last_stable_version: Latest version of runtime. - :type last_stable_version: str - :param language: Language setting of runtime. - :type language: str - """ - - _attribute_map = { - 'primary_endpoint_key': {'key': 'primaryEndpointKey', 'type': 'str'}, - 'secondary_endpoint_key': {'key': 'secondaryEndpointKey', 'type': 'str'}, - 'installed_version': {'key': 'installedVersion', 'type': 'str'}, - 'last_stable_version': {'key': 'lastStableVersion', 'type': 'str'}, - 'language': {'key': 'language', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(EndpointKeysDTO, self).__init__(**kwargs) - self.primary_endpoint_key = kwargs.get('primary_endpoint_key', None) - self.secondary_endpoint_key = kwargs.get('secondary_endpoint_key', None) - self.installed_version = kwargs.get('installed_version', None) - self.last_stable_version = kwargs.get('last_stable_version', None) - self.language = kwargs.get('language', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_keys_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_keys_dto_py3.py deleted file mode 100644 index 30c6c1878e1ab..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_keys_dto_py3.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class EndpointKeysDTO(Model): - """Schema for EndpointKeys generate/refresh operations. - - :param primary_endpoint_key: Primary Access Key. - :type primary_endpoint_key: str - :param secondary_endpoint_key: Secondary Access Key. - :type secondary_endpoint_key: str - :param installed_version: Current version of runtime. - :type installed_version: str - :param last_stable_version: Latest version of runtime. - :type last_stable_version: str - :param language: Language setting of runtime. - :type language: str - """ - - _attribute_map = { - 'primary_endpoint_key': {'key': 'primaryEndpointKey', 'type': 'str'}, - 'secondary_endpoint_key': {'key': 'secondaryEndpointKey', 'type': 'str'}, - 'installed_version': {'key': 'installedVersion', 'type': 'str'}, - 'last_stable_version': {'key': 'lastStableVersion', 'type': 'str'}, - 'language': {'key': 'language', 'type': 'str'}, - } - - def __init__(self, *, primary_endpoint_key: str=None, secondary_endpoint_key: str=None, installed_version: str=None, last_stable_version: str=None, language: str=None, **kwargs) -> None: - super(EndpointKeysDTO, self).__init__(**kwargs) - self.primary_endpoint_key = primary_endpoint_key - self.secondary_endpoint_key = secondary_endpoint_key - self.installed_version = installed_version - self.last_stable_version = last_stable_version - self.language = language diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto.py deleted file mode 100644 index 8f0074782f2a6..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class EndpointSettingsDTO(Model): - """Endpoint settings. - - :param active_learning: Active Learning settings of the endpoint. - :type active_learning: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.EndpointSettingsDTOActiveLearning - """ - - _attribute_map = { - 'active_learning': {'key': 'activeLearning', 'type': 'EndpointSettingsDTOActiveLearning'}, - } - - def __init__(self, **kwargs): - super(EndpointSettingsDTO, self).__init__(**kwargs) - self.active_learning = kwargs.get('active_learning', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_active_learning.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_active_learning.py deleted file mode 100644 index 1dea50ca111d8..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_active_learning.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .active_learning_settings_dto import ActiveLearningSettingsDTO - - -class EndpointSettingsDTOActiveLearning(ActiveLearningSettingsDTO): - """Active Learning settings of the endpoint. - - :param enable: True/False string providing Active Learning - :type enable: str - """ - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(EndpointSettingsDTOActiveLearning, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_active_learning_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_active_learning_py3.py deleted file mode 100644 index b7f3f0279eeb7..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_active_learning_py3.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .active_learning_settings_dto_py3 import ActiveLearningSettingsDTO - - -class EndpointSettingsDTOActiveLearning(ActiveLearningSettingsDTO): - """Active Learning settings of the endpoint. - - :param enable: True/False string providing Active Learning - :type enable: str - """ - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'str'}, - } - - def __init__(self, *, enable: str=None, **kwargs) -> None: - super(EndpointSettingsDTOActiveLearning, self).__init__(enable=enable, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_py3.py deleted file mode 100644 index cd59276214d94..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/endpoint_settings_dto_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class EndpointSettingsDTO(Model): - """Endpoint settings. - - :param active_learning: Active Learning settings of the endpoint. - :type active_learning: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.EndpointSettingsDTOActiveLearning - """ - - _attribute_map = { - 'active_learning': {'key': 'activeLearning', 'type': 'EndpointSettingsDTOActiveLearning'}, - } - - def __init__(self, *, active_learning=None, **kwargs) -> None: - super(EndpointSettingsDTO, self).__init__(**kwargs) - self.active_learning = active_learning diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error.py deleted file mode 100644 index f6cc50f3a277e..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Error(Model): - """The error object. As per Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. 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' - :type code: str or - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorCodeType - :param message: A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this - reported error. - :type details: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.Error] - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel - """ - - _validation = { - 'code': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, **kwargs): - super(Error, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - self.inner_error = kwargs.get('inner_error', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_py3.py deleted file mode 100644 index 342925344e20e..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_py3.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Error(Model): - """The error object. As per Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. 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' - :type code: str or - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorCodeType - :param message: A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this - reported error. - :type details: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.Error] - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel - """ - - _validation = { - 'code': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: - super(Error, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - self.inner_error = inner_error diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response.py deleted file mode 100644 index c14d1afc0f4f8..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError - - -class ErrorResponse(Model): - """Error response. As per Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - :param error: The error object. - :type error: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorResponseError - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, - } - - def __init__(self, **kwargs): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_error.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_error.py deleted file mode 100644 index f9cb75c599563..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_error.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .error import Error - - -class ErrorResponseError(Error): - """The error object. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. 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' - :type code: str or - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorCodeType - :param message: A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this - reported error. - :type details: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.Error] - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel - """ - - _validation = { - 'code': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, **kwargs): - super(ErrorResponseError, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_error_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_error_py3.py deleted file mode 100644 index fb2fe99a622d0..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_error_py3.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .error_py3 import Error - - -class ErrorResponseError(Error): - """The error object. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. 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' - :type code: str or - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorCodeType - :param message: A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this - reported error. - :type details: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.Error] - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel - """ - - _validation = { - 'code': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: - super(ErrorResponseError, self).__init__(code=code, message=message, target=target, details=details, inner_error=inner_error, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_py3.py deleted file mode 100644 index 489c0bd116cbe..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/error_response_py3.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError - - -class ErrorResponse(Model): - """Error response. As per Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - :param error: The error object. - :type error: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorResponseError - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, - } - - def __init__(self, *, error=None, **kwargs) -> None: - super(ErrorResponse, self).__init__(**kwargs) - self.error = error - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/file_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/file_dto.py deleted file mode 100644 index 06b50f07d8c61..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/file_dto.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class FileDTO(Model): - """DTO to hold details of uploaded files. - - All required parameters must be populated in order to send to Azure. - - :param file_name: Required. File name. Supported file types are ".tsv", - ".pdf", ".txt", ".docx", ".xlsx". - :type file_name: str - :param file_uri: Required. Public URI of the file. - :type file_uri: str - """ - - _validation = { - 'file_name': {'required': True, 'max_length': 200, 'min_length': 1}, - 'file_uri': {'required': True}, - } - - _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, - 'file_uri': {'key': 'fileUri', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(FileDTO, self).__init__(**kwargs) - self.file_name = kwargs.get('file_name', None) - self.file_uri = kwargs.get('file_uri', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/file_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/file_dto_py3.py deleted file mode 100644 index 4874c20c485e3..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/file_dto_py3.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class FileDTO(Model): - """DTO to hold details of uploaded files. - - All required parameters must be populated in order to send to Azure. - - :param file_name: Required. File name. Supported file types are ".tsv", - ".pdf", ".txt", ".docx", ".xlsx". - :type file_name: str - :param file_uri: Required. Public URI of the file. - :type file_uri: str - """ - - _validation = { - 'file_name': {'required': True, 'max_length': 200, 'min_length': 1}, - 'file_uri': {'required': True}, - } - - _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, - 'file_uri': {'key': 'fileUri', 'type': 'str'}, - } - - def __init__(self, *, file_name: str, file_uri: str, **kwargs) -> None: - super(FileDTO, self).__init__(**kwargs) - self.file_name = file_name - self.file_uri = file_uri diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/inner_error_model.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/inner_error_model.py deleted file mode 100644 index 41860a511576e..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/inner_error_model.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class InnerErrorModel(Model): - """An object containing more specific information about the error. As per - Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - :param code: A more specific error code than was provided by the - containing error. - :type code: str - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, **kwargs): - super(InnerErrorModel, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.inner_error = kwargs.get('inner_error', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/inner_error_model_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/inner_error_model_py3.py deleted file mode 100644 index f61fe5b7ca274..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/inner_error_model_py3.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class InnerErrorModel(Model): - """An object containing more specific information about the error. As per - Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - :param code: A more specific error code than was provided by the - containing error. - :type code: str - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.InnerErrorModel - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, *, code: str=None, inner_error=None, **kwargs) -> None: - super(InnerErrorModel, self).__init__(**kwargs) - self.code = code - self.inner_error = inner_error diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebase_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebase_dto.py deleted file mode 100644 index 508ee085d1b42..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebase_dto.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class KnowledgebaseDTO(Model): - """Response schema for CreateKb operation. - - :param id: Unique id that identifies a knowledgebase. - :type id: str - :param host_name: URL host name at which the knowledgebase is hosted. - :type host_name: str - :param last_accessed_timestamp: Time stamp at which the knowledgebase was - last accessed (UTC). - :type last_accessed_timestamp: str - :param last_changed_timestamp: Time stamp at which the knowledgebase was - last modified (UTC). - :type last_changed_timestamp: str - :param last_published_timestamp: Time stamp at which the knowledgebase was - last published (UTC). - :type last_published_timestamp: str - :param name: Friendly name of the knowledgebase. - :type name: str - :param user_id: User who created / owns the knowledgebase. - :type user_id: str - :param urls: URL sources from which Q-A were extracted and added to the - knowledgebase. - :type urls: list[str] - :param sources: Custom sources from which Q-A were extracted or explicitly - added to the knowledgebase. - :type sources: list[str] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'last_accessed_timestamp': {'key': 'lastAccessedTimestamp', 'type': 'str'}, - 'last_changed_timestamp': {'key': 'lastChangedTimestamp', 'type': 'str'}, - 'last_published_timestamp': {'key': 'lastPublishedTimestamp', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'user_id': {'key': 'userId', 'type': 'str'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - 'sources': {'key': 'sources', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(KnowledgebaseDTO, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.host_name = kwargs.get('host_name', None) - self.last_accessed_timestamp = kwargs.get('last_accessed_timestamp', None) - self.last_changed_timestamp = kwargs.get('last_changed_timestamp', None) - self.last_published_timestamp = kwargs.get('last_published_timestamp', None) - self.name = kwargs.get('name', None) - self.user_id = kwargs.get('user_id', None) - self.urls = kwargs.get('urls', None) - self.sources = kwargs.get('sources', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebase_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebase_dto_py3.py deleted file mode 100644 index 008843eb04f5c..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebase_dto_py3.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class KnowledgebaseDTO(Model): - """Response schema for CreateKb operation. - - :param id: Unique id that identifies a knowledgebase. - :type id: str - :param host_name: URL host name at which the knowledgebase is hosted. - :type host_name: str - :param last_accessed_timestamp: Time stamp at which the knowledgebase was - last accessed (UTC). - :type last_accessed_timestamp: str - :param last_changed_timestamp: Time stamp at which the knowledgebase was - last modified (UTC). - :type last_changed_timestamp: str - :param last_published_timestamp: Time stamp at which the knowledgebase was - last published (UTC). - :type last_published_timestamp: str - :param name: Friendly name of the knowledgebase. - :type name: str - :param user_id: User who created / owns the knowledgebase. - :type user_id: str - :param urls: URL sources from which Q-A were extracted and added to the - knowledgebase. - :type urls: list[str] - :param sources: Custom sources from which Q-A were extracted or explicitly - added to the knowledgebase. - :type sources: list[str] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'last_accessed_timestamp': {'key': 'lastAccessedTimestamp', 'type': 'str'}, - 'last_changed_timestamp': {'key': 'lastChangedTimestamp', 'type': 'str'}, - 'last_published_timestamp': {'key': 'lastPublishedTimestamp', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'user_id': {'key': 'userId', 'type': 'str'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - 'sources': {'key': 'sources', 'type': '[str]'}, - } - - def __init__(self, *, id: str=None, host_name: str=None, last_accessed_timestamp: str=None, last_changed_timestamp: str=None, last_published_timestamp: str=None, name: str=None, user_id: str=None, urls=None, sources=None, **kwargs) -> None: - super(KnowledgebaseDTO, self).__init__(**kwargs) - self.id = id - self.host_name = host_name - self.last_accessed_timestamp = last_accessed_timestamp - self.last_changed_timestamp = last_changed_timestamp - self.last_published_timestamp = last_published_timestamp - self.name = name - self.user_id = user_id - self.urls = urls - self.sources = sources diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebases_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebases_dto.py deleted file mode 100644 index bc8a8fab05149..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebases_dto.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class KnowledgebasesDTO(Model): - """Collection of knowledgebases owned by a user. - - :param knowledgebases: Collection of knowledgebase records. - :type knowledgebases: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.KnowledgebaseDTO] - """ - - _attribute_map = { - 'knowledgebases': {'key': 'knowledgebases', 'type': '[KnowledgebaseDTO]'}, - } - - def __init__(self, **kwargs): - super(KnowledgebasesDTO, self).__init__(**kwargs) - self.knowledgebases = kwargs.get('knowledgebases', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebases_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebases_dto_py3.py deleted file mode 100644 index 52ff3e4c7f339..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/knowledgebases_dto_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class KnowledgebasesDTO(Model): - """Collection of knowledgebases owned by a user. - - :param knowledgebases: Collection of knowledgebase records. - :type knowledgebases: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.KnowledgebaseDTO] - """ - - _attribute_map = { - 'knowledgebases': {'key': 'knowledgebases', 'type': '[KnowledgebaseDTO]'}, - } - - def __init__(self, *, knowledgebases=None, **kwargs) -> None: - super(KnowledgebasesDTO, self).__init__(**kwargs) - self.knowledgebases = knowledgebases diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/metadata_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/metadata_dto.py deleted file mode 100644 index ad81d7a694a1d..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/metadata_dto.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class MetadataDTO(Model): - """Name - value pair of metadata. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Metadata name. - :type name: str - :param value: Required. Metadata value. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 100, 'min_length': 1}, - 'value': {'required': True, 'max_length': 500, 'min_length': 1}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(MetadataDTO, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/metadata_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/metadata_dto_py3.py deleted file mode 100644 index da4c1d010f8c4..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/metadata_dto_py3.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class MetadataDTO(Model): - """Name - value pair of metadata. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Metadata name. - :type name: str - :param value: Required. Metadata value. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 100, 'min_length': 1}, - 'value': {'required': True, 'max_length': 500, 'min_length': 1}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, *, name: str, value: str, **kwargs) -> None: - super(MetadataDTO, self).__init__(**kwargs) - self.name = name - self.value = value diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/operation.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/operation.py deleted file mode 100644 index 334bdf8ecb9cd..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/operation.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Operation(Model): - """Record to track long running operation. - - :param operation_state: Operation state. Possible values include: - 'Failed', 'NotStarted', 'Running', 'Succeeded' - :type operation_state: str or - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.OperationStateType - :param created_timestamp: Timestamp when the operation was created. - :type created_timestamp: str - :param last_action_timestamp: Timestamp when the current state was - entered. - :type last_action_timestamp: str - :param resource_location: Relative URI to the target resource location for - completed resources. - :type resource_location: str - :param user_id: User Id - :type user_id: str - :param operation_id: Operation Id. - :type operation_id: str - :param error_response: Error details in case of failures. - :type error_response: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorResponse - """ - - _attribute_map = { - 'operation_state': {'key': 'operationState', 'type': 'str'}, - 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, - 'last_action_timestamp': {'key': 'lastActionTimestamp', 'type': 'str'}, - 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, - 'user_id': {'key': 'userId', 'type': 'str'}, - 'operation_id': {'key': 'operationId', 'type': 'str'}, - 'error_response': {'key': 'errorResponse', 'type': 'ErrorResponse'}, - } - - def __init__(self, **kwargs): - super(Operation, self).__init__(**kwargs) - self.operation_state = kwargs.get('operation_state', None) - self.created_timestamp = kwargs.get('created_timestamp', None) - self.last_action_timestamp = kwargs.get('last_action_timestamp', None) - self.resource_location = kwargs.get('resource_location', None) - self.user_id = kwargs.get('user_id', None) - self.operation_id = kwargs.get('operation_id', None) - self.error_response = kwargs.get('error_response', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/operation_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/operation_py3.py deleted file mode 100644 index 927e5756a5983..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/operation_py3.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Operation(Model): - """Record to track long running operation. - - :param operation_state: Operation state. Possible values include: - 'Failed', 'NotStarted', 'Running', 'Succeeded' - :type operation_state: str or - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.OperationStateType - :param created_timestamp: Timestamp when the operation was created. - :type created_timestamp: str - :param last_action_timestamp: Timestamp when the current state was - entered. - :type last_action_timestamp: str - :param resource_location: Relative URI to the target resource location for - completed resources. - :type resource_location: str - :param user_id: User Id - :type user_id: str - :param operation_id: Operation Id. - :type operation_id: str - :param error_response: Error details in case of failures. - :type error_response: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.ErrorResponse - """ - - _attribute_map = { - 'operation_state': {'key': 'operationState', 'type': 'str'}, - 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, - 'last_action_timestamp': {'key': 'lastActionTimestamp', 'type': 'str'}, - 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, - 'user_id': {'key': 'userId', 'type': 'str'}, - 'operation_id': {'key': 'operationId', 'type': 'str'}, - 'error_response': {'key': 'errorResponse', 'type': 'ErrorResponse'}, - } - - def __init__(self, *, operation_state=None, created_timestamp: str=None, last_action_timestamp: str=None, resource_location: str=None, user_id: str=None, operation_id: str=None, error_response=None, **kwargs) -> None: - super(Operation, self).__init__(**kwargs) - self.operation_state = operation_state - self.created_timestamp = created_timestamp - self.last_action_timestamp = last_action_timestamp - self.resource_location = resource_location - self.user_id = user_id - self.operation_id = operation_id - self.error_response = error_response diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto.py deleted file mode 100644 index d185f305d78ce..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class PromptDTO(Model): - """Prompt for an answer. - - :param display_order: Index of the prompt - used in ordering of the - prompts - :type display_order: int - :param qna_id: Qna id corresponding to the prompt - if QnaId is present, - QnADTO object is ignored. - :type qna_id: int - :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a - PromptDTO object - :type qna: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTOQna - :param display_text: Text displayed to represent a follow up question - prompt - :type display_text: str - """ - - _validation = { - 'display_text': {'max_length': 200}, - } - - _attribute_map = { - 'display_order': {'key': 'displayOrder', 'type': 'int'}, - 'qna_id': {'key': 'qnaId', 'type': 'int'}, - 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, - 'display_text': {'key': 'displayText', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PromptDTO, self).__init__(**kwargs) - self.display_order = kwargs.get('display_order', None) - self.qna_id = kwargs.get('qna_id', None) - self.qna = kwargs.get('qna', None) - self.display_text = kwargs.get('display_text', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_py3.py deleted file mode 100644 index f107ef480943e..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_py3.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class PromptDTO(Model): - """Prompt for an answer. - - :param display_order: Index of the prompt - used in ordering of the - prompts - :type display_order: int - :param qna_id: Qna id corresponding to the prompt - if QnaId is present, - QnADTO object is ignored. - :type qna_id: int - :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a - PromptDTO object - :type qna: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTOQna - :param display_text: Text displayed to represent a follow up question - prompt - :type display_text: str - """ - - _validation = { - 'display_text': {'max_length': 200}, - } - - _attribute_map = { - 'display_order': {'key': 'displayOrder', 'type': 'int'}, - 'qna_id': {'key': 'qnaId', 'type': 'int'}, - 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, - 'display_text': {'key': 'displayText', 'type': 'str'}, - } - - def __init__(self, *, display_order: int=None, qna_id: int=None, qna=None, display_text: str=None, **kwargs) -> None: - super(PromptDTO, self).__init__(**kwargs) - self.display_order = display_order - self.qna_id = qna_id - self.qna = qna - self.display_text = display_text diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_qna.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_qna.py deleted file mode 100644 index 8b22ae98ce753..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_qna.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .qn_adto import QnADTO - - -class PromptDTOQna(QnADTO): - """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. - - All required parameters must be populated in order to send to Azure. - - :param id: Unique id for the Q-A. - :type id: int - :param answer: Required. Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: Required. List of questions associated with the answer. - :type questions: list[str] - :param metadata: List of metadata associated with the answer. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - :param context: Context of a QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTOContext - """ - - _validation = { - 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, - 'source': {'max_length': 300}, - 'questions': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': '[str]'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnADTOContext'}, - } - - def __init__(self, **kwargs): - super(PromptDTOQna, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_qna_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_qna_py3.py deleted file mode 100644 index 7fa7775eb6238..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/prompt_dto_qna_py3.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .qn_adto_py3 import QnADTO - - -class PromptDTOQna(QnADTO): - """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. - - All required parameters must be populated in order to send to Azure. - - :param id: Unique id for the Q-A. - :type id: int - :param answer: Required. Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: Required. List of questions associated with the answer. - :type questions: list[str] - :param metadata: List of metadata associated with the answer. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - :param context: Context of a QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTOContext - """ - - _validation = { - 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, - 'source': {'max_length': 300}, - 'questions': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': '[str]'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnADTOContext'}, - } - - def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: - super(PromptDTOQna, self).__init__(id=id, answer=answer, source=source, questions=questions, metadata=metadata, context=context, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adocuments_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adocuments_dto.py deleted file mode 100644 index 73f1ad7c92fcc..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adocuments_dto.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnADocumentsDTO(Model): - """List of QnADTO. - - :param qna_documents: List of answers. - :type qna_documents: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - """ - - _attribute_map = { - 'qna_documents': {'key': 'qnaDocuments', 'type': '[QnADTO]'}, - } - - def __init__(self, **kwargs): - super(QnADocumentsDTO, self).__init__(**kwargs) - self.qna_documents = kwargs.get('qna_documents', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adocuments_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adocuments_dto_py3.py deleted file mode 100644 index 35577d108936e..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adocuments_dto_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnADocumentsDTO(Model): - """List of QnADTO. - - :param qna_documents: List of answers. - :type qna_documents: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - """ - - _attribute_map = { - 'qna_documents': {'key': 'qnaDocuments', 'type': '[QnADTO]'}, - } - - def __init__(self, *, qna_documents=None, **kwargs) -> None: - super(QnADocumentsDTO, self).__init__(**kwargs) - self.qna_documents = qna_documents diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto.py deleted file mode 100644 index d248792c62dba..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnADTO(Model): - """Q-A object. - - All required parameters must be populated in order to send to Azure. - - :param id: Unique id for the Q-A. - :type id: int - :param answer: Required. Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: Required. List of questions associated with the answer. - :type questions: list[str] - :param metadata: List of metadata associated with the answer. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - :param context: Context of a QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTOContext - """ - - _validation = { - 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, - 'source': {'max_length': 300}, - 'questions': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': '[str]'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnADTOContext'}, - } - - def __init__(self, **kwargs): - super(QnADTO, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.answer = kwargs.get('answer', None) - self.source = kwargs.get('source', None) - self.questions = kwargs.get('questions', None) - self.metadata = kwargs.get('metadata', None) - self.context = kwargs.get('context', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_context.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_context.py deleted file mode 100644 index 18c258ade7833..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_context.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .context_dto import ContextDTO - - -class QnADTOContext(ContextDTO): - """Context of a QnA. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, **kwargs): - super(QnADTOContext, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_context_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_context_py3.py deleted file mode 100644 index 16d76fcd39db3..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_context_py3.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .context_dto_py3 import ContextDTO - - -class QnADTOContext(ContextDTO): - """Context of a QnA. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: - super(QnADTOContext, self).__init__(is_context_only=is_context_only, prompts=prompts, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_py3.py deleted file mode 100644 index 98c0ed36c5e73..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/qn_adto_py3.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnADTO(Model): - """Q-A object. - - All required parameters must be populated in order to send to Azure. - - :param id: Unique id for the Q-A. - :type id: int - :param answer: Required. Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: Required. List of questions associated with the answer. - :type questions: list[str] - :param metadata: List of metadata associated with the answer. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - :param context: Context of a QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTOContext - """ - - _validation = { - 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, - 'source': {'max_length': 300}, - 'questions': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': '[str]'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnADTOContext'}, - } - - def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: - super(QnADTO, self).__init__(**kwargs) - self.id = id - self.answer = answer - self.source = source - self.questions = questions - self.metadata = metadata - self.context = context diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/replace_kb_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/replace_kb_dto.py deleted file mode 100644 index dd1bc3932df7d..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/replace_kb_dto.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReplaceKbDTO(Model): - """Post body schema for Replace KB operation. - - All required parameters must be populated in order to send to Azure. - - :param qn_alist: Required. List of Q-A (QnADTO) to be added to the - knowledgebase. Q-A Ids are assigned by the service and should be omitted. - :type qn_alist: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - """ - - _validation = { - 'qn_alist': {'required': True}, - } - - _attribute_map = { - 'qn_alist': {'key': 'qnAList', 'type': '[QnADTO]'}, - } - - def __init__(self, **kwargs): - super(ReplaceKbDTO, self).__init__(**kwargs) - self.qn_alist = kwargs.get('qn_alist', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/replace_kb_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/replace_kb_dto_py3.py deleted file mode 100644 index bce1679cef4c9..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/replace_kb_dto_py3.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ReplaceKbDTO(Model): - """Post body schema for Replace KB operation. - - All required parameters must be populated in order to send to Azure. - - :param qn_alist: Required. List of Q-A (QnADTO) to be added to the - knowledgebase. Q-A Ids are assigned by the service and should be omitted. - :type qn_alist: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - """ - - _validation = { - 'qn_alist': {'required': True}, - } - - _attribute_map = { - 'qn_alist': {'key': 'qnAList', 'type': '[QnADTO]'}, - } - - def __init__(self, *, qn_alist, **kwargs) -> None: - super(ReplaceKbDTO, self).__init__(**kwargs) - self.qn_alist = qn_alist diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_context_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_context_dto.py deleted file mode 100644 index bf80f3e0767ca..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_context_dto.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateContextDTO(Model): - """Update Body schema to represent context to be updated. - - :param prompts_to_delete: List of prompts associated with qna to be - deleted - :type prompts_to_delete: list[int] - :param prompts_to_add: List of prompts to be added to the qna. - :type prompts_to_add: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - """ - - _attribute_map = { - 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, - 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(UpdateContextDTO, self).__init__(**kwargs) - self.prompts_to_delete = kwargs.get('prompts_to_delete', None) - self.prompts_to_add = kwargs.get('prompts_to_add', None) - self.is_context_only = kwargs.get('is_context_only', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_context_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_context_dto_py3.py deleted file mode 100644 index cd0946e75c84d..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_context_dto_py3.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateContextDTO(Model): - """Update Body schema to represent context to be updated. - - :param prompts_to_delete: List of prompts associated with qna to be - deleted - :type prompts_to_delete: list[int] - :param prompts_to_add: List of prompts to be added to the qna. - :type prompts_to_add: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - """ - - _attribute_map = { - 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, - 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - } - - def __init__(self, *, prompts_to_delete=None, prompts_to_add=None, is_context_only: bool=None, **kwargs) -> None: - super(UpdateContextDTO, self).__init__(**kwargs) - self.prompts_to_delete = prompts_to_delete - self.prompts_to_add = prompts_to_add - self.is_context_only = is_context_only diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_contents_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_contents_dto.py deleted file mode 100644 index 0086a6f15a1cc..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_contents_dto.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateKbContentsDTO(Model): - """PATCH body schema for Update operation in Update Kb. - - :param name: Friendly name for the knowledgebase. - :type name: str - :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the - knowledgebase. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTO] - :param urls: List of existing URLs to be refreshed. The content will be - extracted again and re-indexed. - :type urls: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(UpdateKbContentsDTO, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.qna_list = kwargs.get('qna_list', None) - self.urls = kwargs.get('urls', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_contents_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_contents_dto_py3.py deleted file mode 100644 index d1c60f4977ba2..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_contents_dto_py3.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateKbContentsDTO(Model): - """PATCH body schema for Update operation in Update Kb. - - :param name: Friendly name for the knowledgebase. - :type name: str - :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the - knowledgebase. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTO] - :param urls: List of existing URLs to be refreshed. The content will be - extracted again and re-indexed. - :type urls: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - } - - def __init__(self, *, name: str=None, qna_list=None, urls=None, **kwargs) -> None: - super(UpdateKbContentsDTO, self).__init__(**kwargs) - self.name = name - self.qna_list = qna_list - self.urls = urls diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto.py deleted file mode 100644 index 8c5a98f88b992..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateKbOperationDTO(Model): - """Contains list of QnAs to be updated. - - :param add: An instance of CreateKbInputDTO for add operation - :type add: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTOAdd - :param delete: An instance of DeleteKbContentsDTO for delete Operation - :type delete: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTODelete - :param update: An instance of UpdateKbContentsDTO for Update Operation - :type update: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTOUpdate - :param enable_hierarchical_extraction: 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. - :type enable_hierarchical_extraction: bool - :param default_answer_used_for_extraction: 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. - :type default_answer_used_for_extraction: str - """ - - _validation = { - 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, - } - - _attribute_map = { - 'add': {'key': 'add', 'type': 'UpdateKbOperationDTOAdd'}, - 'delete': {'key': 'delete', 'type': 'UpdateKbOperationDTODelete'}, - 'update': {'key': 'update', 'type': 'UpdateKbOperationDTOUpdate'}, - 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, - 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(UpdateKbOperationDTO, self).__init__(**kwargs) - self.add = kwargs.get('add', None) - self.delete = kwargs.get('delete', None) - self.update = kwargs.get('update', None) - self.enable_hierarchical_extraction = kwargs.get('enable_hierarchical_extraction', None) - self.default_answer_used_for_extraction = kwargs.get('default_answer_used_for_extraction', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_add.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_add.py deleted file mode 100644 index 1dbe0ac290cc2..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_add.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .create_kb_input_dto import CreateKbInputDTO - - -class UpdateKbOperationDTOAdd(CreateKbInputDTO): - """An instance of CreateKbInputDTO for add operation. - - :param qna_list: List of QNA to be added to the index. Ids are generated - by the service and should be omitted. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - :param urls: List of URLs to be added to knowledgebase. - :type urls: list[str] - :param files: List of files to be added to knowledgebase. - :type files: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] - """ - - _attribute_map = { - 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - 'files': {'key': 'files', 'type': '[FileDTO]'}, - } - - def __init__(self, **kwargs): - super(UpdateKbOperationDTOAdd, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_add_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_add_py3.py deleted file mode 100644 index cca01b6df666f..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_add_py3.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .create_kb_input_dto_py3 import CreateKbInputDTO - - -class UpdateKbOperationDTOAdd(CreateKbInputDTO): - """An instance of CreateKbInputDTO for add operation. - - :param qna_list: List of QNA to be added to the index. Ids are generated - by the service and should be omitted. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.QnADTO] - :param urls: List of URLs to be added to knowledgebase. - :type urls: list[str] - :param files: List of files to be added to knowledgebase. - :type files: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.FileDTO] - """ - - _attribute_map = { - 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - 'files': {'key': 'files', 'type': '[FileDTO]'}, - } - - def __init__(self, *, qna_list=None, urls=None, files=None, **kwargs) -> None: - super(UpdateKbOperationDTOAdd, self).__init__(qna_list=qna_list, urls=urls, files=files, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_delete.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_delete.py deleted file mode 100644 index fb62e5bf659cc..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_delete.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .delete_kb_contents_dto import DeleteKbContentsDTO - - -class UpdateKbOperationDTODelete(DeleteKbContentsDTO): - """An instance of DeleteKbContentsDTO for delete Operation. - - :param ids: List of Qna Ids to be deleted - :type ids: list[int] - :param sources: List of sources to be deleted from knowledgebase. - :type sources: list[str] - """ - - _attribute_map = { - 'ids': {'key': 'ids', 'type': '[int]'}, - 'sources': {'key': 'sources', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(UpdateKbOperationDTODelete, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_delete_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_delete_py3.py deleted file mode 100644 index 67628e63b0a3b..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_delete_py3.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .delete_kb_contents_dto_py3 import DeleteKbContentsDTO - - -class UpdateKbOperationDTODelete(DeleteKbContentsDTO): - """An instance of DeleteKbContentsDTO for delete Operation. - - :param ids: List of Qna Ids to be deleted - :type ids: list[int] - :param sources: List of sources to be deleted from knowledgebase. - :type sources: list[str] - """ - - _attribute_map = { - 'ids': {'key': 'ids', 'type': '[int]'}, - 'sources': {'key': 'sources', 'type': '[str]'}, - } - - def __init__(self, *, ids=None, sources=None, **kwargs) -> None: - super(UpdateKbOperationDTODelete, self).__init__(ids=ids, sources=sources, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_py3.py deleted file mode 100644 index 074e8a005b7e7..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_py3.py +++ /dev/null @@ -1,56 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateKbOperationDTO(Model): - """Contains list of QnAs to be updated. - - :param add: An instance of CreateKbInputDTO for add operation - :type add: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTOAdd - :param delete: An instance of DeleteKbContentsDTO for delete Operation - :type delete: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTODelete - :param update: An instance of UpdateKbContentsDTO for Update Operation - :type update: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateKbOperationDTOUpdate - :param enable_hierarchical_extraction: 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. - :type enable_hierarchical_extraction: bool - :param default_answer_used_for_extraction: 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. - :type default_answer_used_for_extraction: str - """ - - _validation = { - 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, - } - - _attribute_map = { - 'add': {'key': 'add', 'type': 'UpdateKbOperationDTOAdd'}, - 'delete': {'key': 'delete', 'type': 'UpdateKbOperationDTODelete'}, - 'update': {'key': 'update', 'type': 'UpdateKbOperationDTOUpdate'}, - 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, - 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, - } - - def __init__(self, *, add=None, delete=None, update=None, enable_hierarchical_extraction: bool=None, default_answer_used_for_extraction: str=None, **kwargs) -> None: - super(UpdateKbOperationDTO, self).__init__(**kwargs) - self.add = add - self.delete = delete - self.update = update - self.enable_hierarchical_extraction = enable_hierarchical_extraction - self.default_answer_used_for_extraction = default_answer_used_for_extraction diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_update.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_update.py deleted file mode 100644 index 95441d5bb77f2..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_update.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .update_kb_contents_dto import UpdateKbContentsDTO - - -class UpdateKbOperationDTOUpdate(UpdateKbContentsDTO): - """An instance of UpdateKbContentsDTO for Update Operation. - - :param name: Friendly name for the knowledgebase. - :type name: str - :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the - knowledgebase. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTO] - :param urls: List of existing URLs to be refreshed. The content will be - extracted again and re-indexed. - :type urls: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(UpdateKbOperationDTOUpdate, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_update_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_update_py3.py deleted file mode 100644 index cab9340822918..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_kb_operation_dto_update_py3.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .update_kb_contents_dto_py3 import UpdateKbContentsDTO - - -class UpdateKbOperationDTOUpdate(UpdateKbContentsDTO): - """An instance of UpdateKbContentsDTO for Update Operation. - - :param name: Friendly name for the knowledgebase. - :type name: str - :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the - knowledgebase. - :type qna_list: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTO] - :param urls: List of existing URLs to be refreshed. The content will be - extracted again and re-indexed. - :type urls: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, - 'urls': {'key': 'urls', 'type': '[str]'}, - } - - def __init__(self, *, name: str=None, qna_list=None, urls=None, **kwargs) -> None: - super(UpdateKbOperationDTOUpdate, self).__init__(name=name, qna_list=qna_list, urls=urls, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_metadata_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_metadata_dto.py deleted file mode 100644 index 7d6e8d72d942d..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_metadata_dto.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateMetadataDTO(Model): - """PATCH Body schema to represent list of Metadata to be updated. - - :param delete: List of Metadata associated with answer to be deleted - :type delete: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - :param add: List of metadata associated with answer to be added - :type add: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - """ - - _attribute_map = { - 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, - 'add': {'key': 'add', 'type': '[MetadataDTO]'}, - } - - def __init__(self, **kwargs): - super(UpdateMetadataDTO, self).__init__(**kwargs) - self.delete = kwargs.get('delete', None) - self.add = kwargs.get('add', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_metadata_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_metadata_dto_py3.py deleted file mode 100644 index 79792cc38bf84..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_metadata_dto_py3.py +++ /dev/null @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateMetadataDTO(Model): - """PATCH Body schema to represent list of Metadata to be updated. - - :param delete: List of Metadata associated with answer to be deleted - :type delete: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - :param add: List of metadata associated with answer to be added - :type add: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - """ - - _attribute_map = { - 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, - 'add': {'key': 'add', 'type': '[MetadataDTO]'}, - } - - def __init__(self, *, delete=None, add=None, **kwargs) -> None: - super(UpdateMetadataDTO, self).__init__(**kwargs) - self.delete = delete - self.add = add diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto.py deleted file mode 100644 index 10baaaebc7131..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateQnaDTO(Model): - """PATCH Body schema for Update Qna List. - - :param id: Unique id for the Q-A - :type id: int - :param answer: Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: List of questions associated with the answer. - :type questions: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOQuestions - :param metadata: List of metadata associated with the answer to be updated - :type metadata: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOMetadata - :param context: Context associated with Qna to be updated. - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOContext - """ - - _validation = { - 'id': {'maximum': 2147483647, 'minimum': 0}, - 'source': {'max_length': 300}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': 'UpdateQnaDTOQuestions'}, - 'metadata': {'key': 'metadata', 'type': 'UpdateQnaDTOMetadata'}, - 'context': {'key': 'context', 'type': 'UpdateQnaDTOContext'}, - } - - def __init__(self, **kwargs): - super(UpdateQnaDTO, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.answer = kwargs.get('answer', None) - self.source = kwargs.get('source', None) - self.questions = kwargs.get('questions', None) - self.metadata = kwargs.get('metadata', None) - self.context = kwargs.get('context', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_context.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_context.py deleted file mode 100644 index b74e05d28668f..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_context.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .update_context_dto import UpdateContextDTO - - -class UpdateQnaDTOContext(UpdateContextDTO): - """Context associated with Qna to be updated. - - :param prompts_to_delete: List of prompts associated with qna to be - deleted - :type prompts_to_delete: list[int] - :param prompts_to_add: List of prompts to be added to the qna. - :type prompts_to_add: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - """ - - _attribute_map = { - 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, - 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(UpdateQnaDTOContext, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_context_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_context_py3.py deleted file mode 100644 index 3bc0e057f78fd..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_context_py3.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .update_context_dto_py3 import UpdateContextDTO - - -class UpdateQnaDTOContext(UpdateContextDTO): - """Context associated with Qna to be updated. - - :param prompts_to_delete: List of prompts associated with qna to be - deleted - :type prompts_to_delete: list[int] - :param prompts_to_add: List of prompts to be added to the qna. - :type prompts_to_add: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.PromptDTO] - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - """ - - _attribute_map = { - 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, - 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - } - - def __init__(self, *, prompts_to_delete=None, prompts_to_add=None, is_context_only: bool=None, **kwargs) -> None: - super(UpdateQnaDTOContext, self).__init__(prompts_to_delete=prompts_to_delete, prompts_to_add=prompts_to_add, is_context_only=is_context_only, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_metadata.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_metadata.py deleted file mode 100644 index 681d67dabc858..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_metadata.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .update_metadata_dto import UpdateMetadataDTO - - -class UpdateQnaDTOMetadata(UpdateMetadataDTO): - """List of metadata associated with the answer to be updated. - - :param delete: List of Metadata associated with answer to be deleted - :type delete: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - :param add: List of metadata associated with answer to be added - :type add: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - """ - - _attribute_map = { - 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, - 'add': {'key': 'add', 'type': '[MetadataDTO]'}, - } - - def __init__(self, **kwargs): - super(UpdateQnaDTOMetadata, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_metadata_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_metadata_py3.py deleted file mode 100644 index 331f518018f3d..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_metadata_py3.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .update_metadata_dto_py3 import UpdateMetadataDTO - - -class UpdateQnaDTOMetadata(UpdateMetadataDTO): - """List of metadata associated with the answer to be updated. - - :param delete: List of Metadata associated with answer to be deleted - :type delete: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - :param add: List of metadata associated with answer to be added - :type add: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.MetadataDTO] - """ - - _attribute_map = { - 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, - 'add': {'key': 'add', 'type': '[MetadataDTO]'}, - } - - def __init__(self, *, delete=None, add=None, **kwargs) -> None: - super(UpdateQnaDTOMetadata, self).__init__(delete=delete, add=add, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_py3.py deleted file mode 100644 index e980c2545661c..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_py3.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateQnaDTO(Model): - """PATCH Body schema for Update Qna List. - - :param id: Unique id for the Q-A - :type id: int - :param answer: Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: List of questions associated with the answer. - :type questions: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOQuestions - :param metadata: List of metadata associated with the answer to be updated - :type metadata: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOMetadata - :param context: Context associated with Qna to be updated. - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.UpdateQnaDTOContext - """ - - _validation = { - 'id': {'maximum': 2147483647, 'minimum': 0}, - 'source': {'max_length': 300}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': 'UpdateQnaDTOQuestions'}, - 'metadata': {'key': 'metadata', 'type': 'UpdateQnaDTOMetadata'}, - 'context': {'key': 'context', 'type': 'UpdateQnaDTOContext'}, - } - - def __init__(self, *, id: int=None, answer: str=None, source: str=None, questions=None, metadata=None, context=None, **kwargs) -> None: - super(UpdateQnaDTO, self).__init__(**kwargs) - self.id = id - self.answer = answer - self.source = source - self.questions = questions - self.metadata = metadata - self.context = context diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_questions.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_questions.py deleted file mode 100644 index c30d3c4c3a43b..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_questions.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .update_questions_dto import UpdateQuestionsDTO - - -class UpdateQnaDTOQuestions(UpdateQuestionsDTO): - """List of questions associated with the answer. - - :param add: List of questions to be added - :type add: list[str] - :param delete: List of questions to be deleted. - :type delete: list[str] - """ - - _attribute_map = { - 'add': {'key': 'add', 'type': '[str]'}, - 'delete': {'key': 'delete', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(UpdateQnaDTOQuestions, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_questions_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_questions_py3.py deleted file mode 100644 index 833f6036ef74f..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_qna_dto_questions_py3.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .update_questions_dto_py3 import UpdateQuestionsDTO - - -class UpdateQnaDTOQuestions(UpdateQuestionsDTO): - """List of questions associated with the answer. - - :param add: List of questions to be added - :type add: list[str] - :param delete: List of questions to be deleted. - :type delete: list[str] - """ - - _attribute_map = { - 'add': {'key': 'add', 'type': '[str]'}, - 'delete': {'key': 'delete', 'type': '[str]'}, - } - - def __init__(self, *, add=None, delete=None, **kwargs) -> None: - super(UpdateQnaDTOQuestions, self).__init__(add=add, delete=delete, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_questions_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_questions_dto.py deleted file mode 100644 index 66d9acf040810..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_questions_dto.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateQuestionsDTO(Model): - """PATCH Body schema for Update Kb which contains list of questions to be - added and deleted. - - :param add: List of questions to be added - :type add: list[str] - :param delete: List of questions to be deleted. - :type delete: list[str] - """ - - _attribute_map = { - 'add': {'key': 'add', 'type': '[str]'}, - 'delete': {'key': 'delete', 'type': '[str]'}, - } - - def __init__(self, **kwargs): - super(UpdateQuestionsDTO, self).__init__(**kwargs) - self.add = kwargs.get('add', None) - self.delete = kwargs.get('delete', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_questions_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_questions_dto_py3.py deleted file mode 100644 index bfed42c94bc65..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/update_questions_dto_py3.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class UpdateQuestionsDTO(Model): - """PATCH Body schema for Update Kb which contains list of questions to be - added and deleted. - - :param add: List of questions to be added - :type add: list[str] - :param delete: List of questions to be deleted. - :type delete: list[str] - """ - - _attribute_map = { - 'add': {'key': 'add', 'type': '[str]'}, - 'delete': {'key': 'delete', 'type': '[str]'}, - } - - def __init__(self, *, add=None, delete=None, **kwargs) -> None: - super(UpdateQuestionsDTO, self).__init__(**kwargs) - self.add = add - self.delete = delete diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/word_alterations_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/word_alterations_dto.py deleted file mode 100644 index b7e4ffbcec0b8..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/word_alterations_dto.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class WordAlterationsDTO(Model): - """Collection of word alterations. - - All required parameters must be populated in order to send to Azure. - - :param word_alterations: Required. Collection of word alterations. - :type word_alterations: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.AlterationsDTO] - """ - - _validation = { - 'word_alterations': {'required': True}, - } - - _attribute_map = { - 'word_alterations': {'key': 'wordAlterations', 'type': '[AlterationsDTO]'}, - } - - def __init__(self, **kwargs): - super(WordAlterationsDTO, self).__init__(**kwargs) - self.word_alterations = kwargs.get('word_alterations', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/word_alterations_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/word_alterations_dto_py3.py deleted file mode 100644 index 5183b48255a2f..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/word_alterations_dto_py3.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class WordAlterationsDTO(Model): - """Collection of word alterations. - - All required parameters must be populated in order to send to Azure. - - :param word_alterations: Required. Collection of word alterations. - :type word_alterations: - list[~azure.cognitiveservices.knowledge.qnamaker.authoring.models.AlterationsDTO] - """ - - _validation = { - 'word_alterations': {'required': True}, - } - - _attribute_map = { - 'word_alterations': {'key': 'wordAlterations', 'type': '[AlterationsDTO]'}, - } - - def __init__(self, *, word_alterations, **kwargs) -> None: - super(WordAlterationsDTO, self).__init__(**kwargs) - self.word_alterations = word_alterations diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/__init__.py index e89d051424b1d..bdc2419b05d68 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/__init__.py @@ -9,11 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .endpoint_settings_operations import EndpointSettingsOperations -from .endpoint_keys_operations import EndpointKeysOperations -from .alterations_operations import AlterationsOperations -from .knowledgebase_operations import KnowledgebaseOperations -from .operations import Operations +from ._endpoint_settings_operations import EndpointSettingsOperations +from ._endpoint_keys_operations import EndpointKeysOperations +from ._alterations_operations import AlterationsOperations +from ._knowledgebase_operations import KnowledgebaseOperations +from ._operations import Operations __all__ = [ 'EndpointSettingsOperations', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/alterations_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_alterations_operations.py similarity index 97% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/alterations_operations.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_alterations_operations.py index 2f292128400fd..14c10df47edfb 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/alterations_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_alterations_operations.py @@ -17,6 +17,8 @@ class AlterationsOperations(object): """AlterationsOperations operations. + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -73,7 +75,6 @@ def get( raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: deserialized = self._deserialize('WordAlterationsDTO', response) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/endpoint_keys_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_endpoint_keys_operations.py similarity index 97% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/endpoint_keys_operations.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_endpoint_keys_operations.py index 9dc374b95219a..b394046f2e007 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/endpoint_keys_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_endpoint_keys_operations.py @@ -17,6 +17,8 @@ class EndpointKeysOperations(object): """EndpointKeysOperations operations. + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -73,7 +75,6 @@ def get_keys( raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: deserialized = self._deserialize('EndpointKeysDTO', response) @@ -127,7 +128,6 @@ def refresh_keys( raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: deserialized = self._deserialize('EndpointKeysDTO', response) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/endpoint_settings_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_endpoint_settings_operations.py similarity index 91% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/endpoint_settings_operations.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_endpoint_settings_operations.py index 823ca9d95ad97..be96fabe720c1 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/endpoint_settings_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_endpoint_settings_operations.py @@ -17,6 +17,8 @@ class EndpointSettingsOperations(object): """EndpointSettingsOperations operations. + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -73,7 +75,6 @@ def get_settings( raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: deserialized = self._deserialize('EndpointSettingsDTO', response) @@ -96,8 +97,8 @@ def update_settings( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: str or ClientRawResponse if raw=true - :rtype: str or ~msrest.pipeline.ClientRawResponse + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ @@ -115,7 +116,6 @@ def update_settings( # Construct headers header_parameters = {} - header_parameters['Accept'] = 'application/json' header_parameters['Content-Type'] = 'application/json; charset=utf-8' if custom_headers: header_parameters.update(custom_headers) @@ -127,17 +127,10 @@ def update_settings( request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [204]: raise models.ErrorResponseException(self._deserialize, response) - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('str', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) return client_raw_response - - return deserialized update_settings.metadata = {'url': '/endpointSettings'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/knowledgebase_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_knowledgebase_operations.py similarity index 94% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/knowledgebase_operations.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_knowledgebase_operations.py index de6afacab71ff..51f900dca7632 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/knowledgebase_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_knowledgebase_operations.py @@ -17,6 +17,8 @@ class KnowledgebaseOperations(object): """KnowledgebaseOperations operations. + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -73,7 +75,6 @@ def list_all( raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: deserialized = self._deserialize('KnowledgebasesDTO', response) @@ -127,7 +128,6 @@ def get_details( raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: deserialized = self._deserialize('KnowledgebaseDTO', response) @@ -331,9 +331,8 @@ def update( if response.status_code not in [202]: raise models.ErrorResponseException(self._deserialize, response) - deserialized = None header_dict = {} - + deserialized = None if response.status_code == 202: deserialized = self._deserialize('Operation', response) header_dict = { @@ -395,7 +394,6 @@ def create( raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 202: deserialized = self._deserialize('Operation', response) @@ -407,7 +405,7 @@ def create( create.metadata = {'url': '/knowledgebases/create'} def download( - self, kb_id, environment, custom_headers=None, raw=False, **operation_config): + self, kb_id, environment, source=None, changed_since=None, custom_headers=None, raw=False, **operation_config): """Download the knowledgebase. :param kb_id: Knowledgebase id. @@ -416,6 +414,16 @@ def download( Possible values include: 'Prod', 'Test' :type environment: str or ~azure.cognitiveservices.knowledge.qnamaker.authoring.models.EnvironmentType + :param source: The source property filter to apply. Sample value: + Editorial, smartLight%20FAQ.tsv . + :type source: str + :param changed_since: changedSince property is used to return all QnAs + created or updated after a specific time duration. The user can filter + QnAs by seconds (s), minutes (m), hours (h) and days (d). The user may + use any integral value along with the suffix for time. For instance, + the value of 5m returns all QnA pairs updated or created in the last 5 + minutes. + :type changed_since: str :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -439,6 +447,10 @@ def download( # Construct parameters query_parameters = {} + if source is not None: + query_parameters['source'] = self._serialize.query("source", source, 'str') + if changed_since is not None: + query_parameters['changedSince'] = self._serialize.query("changed_since", changed_since, 'str') # Construct headers header_parameters = {} @@ -454,7 +466,6 @@ def download( raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: deserialized = self._deserialize('QnADocumentsDTO', response) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_operations.py similarity index 96% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/operations.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_operations.py index b4973f1268228..f0ab3fa49f098 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/operations/_operations.py @@ -17,6 +17,8 @@ class Operations(object): """Operations operations. + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -75,9 +77,8 @@ def get_details( if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) - deserialized = None header_dict = {} - + deserialized = None if response.status_code == 200: deserialized = self._deserialize('Operation', response) header_dict = { diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/active_learning_settings_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/__init__.py similarity index 51% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/active_learning_settings_dto.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/__init__.py index 8290efe090a0d..fb3872ea774c4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/active_learning_settings_dto.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/__init__.py @@ -9,20 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from ._configuration import QnAMakerClientConfiguration +from ._qn_amaker_client import QnAMakerClient +__all__ = ['QnAMakerClient', 'QnAMakerClientConfiguration'] +from .version import VERSION -class ActiveLearningSettingsDTO(Model): - """Active Learning settings of the endpoint. +__version__ = VERSION - :param enable: True/False string providing Active Learning - :type enable: str - """ - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(ActiveLearningSettingsDTO, self).__init__(**kwargs) - self.enable = kwargs.get('enable', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/_configuration.py new file mode 100644 index 0000000000000..d2f8c9a6cff4b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/_configuration.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest import Configuration + +from .version import VERSION + + +class QnAMakerClientConfiguration(Configuration): + """Configuration for QnAMakerClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: Supported Cognitive Services endpoint (e.g., https://< + qnamaker-resource-name >.api.cognitiveservices.azure.com). + :type endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, endpoint, credentials): + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + base_url = '{Endpoint}/qnamaker/v5.0-preview.2' + + super(QnAMakerClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-cognitiveservices-knowledge-qnamaker/{}'.format(VERSION)) + + self.endpoint = endpoint + self.credentials = credentials diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/_qn_amaker_client.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/_qn_amaker_client.py new file mode 100644 index 0000000000000..24a99993a190f --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/_qn_amaker_client.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import QnAMakerClientConfiguration +from .operations import EndpointSettingsOperations +from .operations import EndpointKeysOperations +from .operations import AlterationsOperations +from .operations import KnowledgebaseOperations +from .operations import Operations +from .operations import PrebuiltOperations +from . import models + + +class QnAMakerClient(SDKClient): + """An API for QnAMaker Service + + :ivar config: Configuration for client. + :vartype config: QnAMakerClientConfiguration + + :ivar endpoint_settings: EndpointSettings operations + :vartype endpoint_settings: azure.cognitiveservices.knowledge.qnamaker.preview.operations.EndpointSettingsOperations + :ivar endpoint_keys: EndpointKeys operations + :vartype endpoint_keys: azure.cognitiveservices.knowledge.qnamaker.preview.operations.EndpointKeysOperations + :ivar alterations: Alterations operations + :vartype alterations: azure.cognitiveservices.knowledge.qnamaker.preview.operations.AlterationsOperations + :ivar knowledgebase: Knowledgebase operations + :vartype knowledgebase: azure.cognitiveservices.knowledge.qnamaker.preview.operations.KnowledgebaseOperations + :ivar operations: Operations operations + :vartype operations: azure.cognitiveservices.knowledge.qnamaker.preview.operations.Operations + :ivar prebuilt: Prebuilt operations + :vartype prebuilt: azure.cognitiveservices.knowledge.qnamaker.preview.operations.PrebuiltOperations + + :param endpoint: Supported Cognitive Services endpoint (e.g., https://< + qnamaker-resource-name >.api.cognitiveservices.azure.com). + :type endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, endpoint, credentials): + + self.config = QnAMakerClientConfiguration(endpoint, credentials) + super(QnAMakerClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self.api_version = 'v5.0-preview.2' + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.endpoint_settings = EndpointSettingsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.endpoint_keys = EndpointKeysOperations( + self._client, self.config, self._serialize, self._deserialize) + self.alterations = AlterationsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.knowledgebase = KnowledgebaseOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.prebuilt = PrebuiltOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/__init__.py new file mode 100644 index 0000000000000..ea657776fbf7b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/__init__.py @@ -0,0 +1,185 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ActiveLearningSettingsDTO + from ._models_py3 import AlterationsDTO + from ._models_py3 import AnswerSpanRequestDTO + from ._models_py3 import AnswerSpanResponseDTO + from ._models_py3 import ContextDTO + from ._models_py3 import CreateKbDTO + from ._models_py3 import CreateKbInputDTO + from ._models_py3 import DeleteKbContentsDTO + from ._models_py3 import EndpointKeysDTO + from ._models_py3 import EndpointSettingsDTO + from ._models_py3 import EndpointSettingsDTOActiveLearning + from ._models_py3 import Error + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ErrorResponseError + from ._models_py3 import FeedbackRecordDTO + from ._models_py3 import FeedbackRecordsDTO + from ._models_py3 import FileDTO + from ._models_py3 import GenerateAnswerBatchResultItem + from ._models_py3 import GenerateAnswerBatchResultItemAnswerSpan + from ._models_py3 import InnerErrorModel + from ._models_py3 import KnowledgebaseDTO + from ._models_py3 import KnowledgebasesDTO + from ._models_py3 import MetadataDTO + from ._models_py3 import Operation + from ._models_py3 import PrebuiltQuery + from ._models_py3 import PromptDTO + from ._models_py3 import PromptDTOQna + from ._models_py3 import QnADocumentsDTO + from ._models_py3 import QnADTO + from ._models_py3 import QnADTOContext + from ._models_py3 import QnASearchResult + from ._models_py3 import QnASearchResultAnswerSpan + from ._models_py3 import QnASearchResultContext + from ._models_py3 import QnASearchResultList + from ._models_py3 import QueryContextDTO + from ._models_py3 import QueryDTO + from ._models_py3 import QueryDTOAnswerSpanRequest + from ._models_py3 import QueryDTOContext + from ._models_py3 import ReplaceKbDTO + from ._models_py3 import TextInput + from ._models_py3 import UpdateContextDTO + from ._models_py3 import UpdateKbContentsDTO + from ._models_py3 import UpdateKbOperationDTO + from ._models_py3 import UpdateKbOperationDTOAdd + from ._models_py3 import UpdateKbOperationDTODelete + from ._models_py3 import UpdateKbOperationDTOUpdate + from ._models_py3 import UpdateMetadataDTO + from ._models_py3 import UpdateQnaDTO + from ._models_py3 import UpdateQnaDTOContext + from ._models_py3 import UpdateQnaDTOMetadata + from ._models_py3 import UpdateQnaDTOQuestions + from ._models_py3 import UpdateQuestionsDTO + from ._models_py3 import WordAlterationsDTO +except (SyntaxError, ImportError): + from ._models import ActiveLearningSettingsDTO + from ._models import AlterationsDTO + from ._models import AnswerSpanRequestDTO + from ._models import AnswerSpanResponseDTO + from ._models import ContextDTO + from ._models import CreateKbDTO + from ._models import CreateKbInputDTO + from ._models import DeleteKbContentsDTO + from ._models import EndpointKeysDTO + from ._models import EndpointSettingsDTO + from ._models import EndpointSettingsDTOActiveLearning + from ._models import Error + from ._models import ErrorResponse, ErrorResponseException + from ._models import ErrorResponseError + from ._models import FeedbackRecordDTO + from ._models import FeedbackRecordsDTO + from ._models import FileDTO + from ._models import GenerateAnswerBatchResultItem + from ._models import GenerateAnswerBatchResultItemAnswerSpan + from ._models import InnerErrorModel + from ._models import KnowledgebaseDTO + from ._models import KnowledgebasesDTO + from ._models import MetadataDTO + from ._models import Operation + from ._models import PrebuiltQuery + from ._models import PromptDTO + from ._models import PromptDTOQna + from ._models import QnADocumentsDTO + from ._models import QnADTO + from ._models import QnADTOContext + from ._models import QnASearchResult + from ._models import QnASearchResultAnswerSpan + from ._models import QnASearchResultContext + from ._models import QnASearchResultList + from ._models import QueryContextDTO + from ._models import QueryDTO + from ._models import QueryDTOAnswerSpanRequest + from ._models import QueryDTOContext + from ._models import ReplaceKbDTO + from ._models import TextInput + from ._models import UpdateContextDTO + from ._models import UpdateKbContentsDTO + from ._models import UpdateKbOperationDTO + from ._models import UpdateKbOperationDTOAdd + from ._models import UpdateKbOperationDTODelete + from ._models import UpdateKbOperationDTOUpdate + from ._models import UpdateMetadataDTO + from ._models import UpdateQnaDTO + from ._models import UpdateQnaDTOContext + from ._models import UpdateQnaDTOMetadata + from ._models import UpdateQnaDTOQuestions + from ._models import UpdateQuestionsDTO + from ._models import WordAlterationsDTO +from ._qn_amaker_client_enums import ( + EnvironmentType, + ErrorCodeType, + OperationStateType, + StrictFiltersCompoundOperationType, +) + +__all__ = [ + 'ActiveLearningSettingsDTO', + 'AlterationsDTO', + 'AnswerSpanRequestDTO', + 'AnswerSpanResponseDTO', + 'ContextDTO', + 'CreateKbDTO', + 'CreateKbInputDTO', + 'DeleteKbContentsDTO', + 'EndpointKeysDTO', + 'EndpointSettingsDTO', + 'EndpointSettingsDTOActiveLearning', + 'Error', + 'ErrorResponse', 'ErrorResponseException', + 'ErrorResponseError', + 'FeedbackRecordDTO', + 'FeedbackRecordsDTO', + 'FileDTO', + 'GenerateAnswerBatchResultItem', + 'GenerateAnswerBatchResultItemAnswerSpan', + 'InnerErrorModel', + 'KnowledgebaseDTO', + 'KnowledgebasesDTO', + 'MetadataDTO', + 'Operation', + 'PrebuiltQuery', + 'PromptDTO', + 'PromptDTOQna', + 'QnADocumentsDTO', + 'QnADTO', + 'QnADTOContext', + 'QnASearchResult', + 'QnASearchResultAnswerSpan', + 'QnASearchResultContext', + 'QnASearchResultList', + 'QueryContextDTO', + 'QueryDTO', + 'QueryDTOAnswerSpanRequest', + 'QueryDTOContext', + 'ReplaceKbDTO', + 'TextInput', + 'UpdateContextDTO', + 'UpdateKbContentsDTO', + 'UpdateKbOperationDTO', + 'UpdateKbOperationDTOAdd', + 'UpdateKbOperationDTODelete', + 'UpdateKbOperationDTOUpdate', + 'UpdateMetadataDTO', + 'UpdateQnaDTO', + 'UpdateQnaDTOContext', + 'UpdateQnaDTOMetadata', + 'UpdateQnaDTOQuestions', + 'UpdateQuestionsDTO', + 'WordAlterationsDTO', + 'ErrorCodeType', + 'OperationStateType', + 'StrictFiltersCompoundOperationType', + 'EnvironmentType', +] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_models.py new file mode 100644 index 0000000000000..d40a0a21c5063 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_models.py @@ -0,0 +1,1624 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActiveLearningSettingsDTO(Model): + """Active Learning settings of the endpoint. + + :param enable: True/False string providing Active Learning + :type enable: str + """ + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ActiveLearningSettingsDTO, self).__init__(**kwargs) + self.enable = kwargs.get('enable', None) + + +class AlterationsDTO(Model): + """Collection of words that are synonyms. + + All required parameters must be populated in order to send to Azure. + + :param alterations: Required. Words that are synonymous with each other. + :type alterations: list[str] + """ + + _validation = { + 'alterations': {'required': True}, + } + + _attribute_map = { + 'alterations': {'key': 'alterations', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(AlterationsDTO, self).__init__(**kwargs) + self.alterations = kwargs.get('alterations', None) + + +class AnswerSpanRequestDTO(Model): + """To configure Answer span prediction feature. + + :param enable: Enable or Disable Answer Span prediction. + :type enable: bool + :param score_threshold: Minimum threshold score required to include an + answer span. + :type score_threshold: float + :param top_answers_with_span: Number of Top answers to be considered for + span prediction. + :type top_answers_with_span: int + """ + + _validation = { + 'top_answers_with_span': {'maximum': 10, 'minimum': 1}, + } + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'bool'}, + 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, + 'top_answers_with_span': {'key': 'topAnswersWithSpan', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(AnswerSpanRequestDTO, self).__init__(**kwargs) + self.enable = kwargs.get('enable', None) + self.score_threshold = kwargs.get('score_threshold', None) + self.top_answers_with_span = kwargs.get('top_answers_with_span', None) + + +class AnswerSpanResponseDTO(Model): + """Answer span object of QnA. + + :param text: Predicted text of answer span. + :type text: str + :param score: Predicted score of answer span. + :type score: float + :param start_index: Start index of answer span in answer. + :type start_index: int + :param end_index: End index of answer span in answer. + :type end_index: int + """ + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'start_index': {'key': 'startIndex', 'type': 'int'}, + 'end_index': {'key': 'endIndex', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(AnswerSpanResponseDTO, self).__init__(**kwargs) + self.text = kwargs.get('text', None) + self.score = kwargs.get('score', None) + self.start_index = kwargs.get('start_index', None) + self.end_index = kwargs.get('end_index', None) + + +class ContextDTO(Model): + """Context associated with Qna. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, **kwargs): + super(ContextDTO, self).__init__(**kwargs) + self.is_context_only = kwargs.get('is_context_only', None) + self.prompts = kwargs.get('prompts', None) + + +class CreateKbDTO(Model): + """Post body schema for CreateKb operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (QnADTO) to be added to the knowledgebase. + Q-A Ids are assigned by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + :param urls: List of URLs to be used for extracting Q-A. + :type urls: list[str] + :param files: List of files from which to Extract Q-A. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.FileDTO] + :param enable_hierarchical_extraction: Enable hierarchical extraction of + Q-A from files and urls. Value to be considered False if this field is not + present. + :type enable_hierarchical_extraction: bool + :param default_answer_used_for_extraction: 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. + :type default_answer_used_for_extraction: str + :param language: Language of the knowledgebase. Please find the list of + supported languages here. + :type language: str + :param enable_multiple_languages: Set to true to enable creating KBs in + different languages for the same resource. + :type enable_multiple_languages: bool + :param default_answer: Default answer sent to user if no good match is + found in the KB. + :type default_answer: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, + 'language': {'max_length': 100, 'min_length': 1}, + 'default_answer': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, + 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + 'enable_multiple_languages': {'key': 'enableMultipleLanguages', 'type': 'bool'}, + 'default_answer': {'key': 'defaultAnswer', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CreateKbDTO, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.qna_list = kwargs.get('qna_list', None) + self.urls = kwargs.get('urls', None) + self.files = kwargs.get('files', None) + self.enable_hierarchical_extraction = kwargs.get('enable_hierarchical_extraction', None) + self.default_answer_used_for_extraction = kwargs.get('default_answer_used_for_extraction', None) + self.language = kwargs.get('language', None) + self.enable_multiple_languages = kwargs.get('enable_multiple_languages', None) + self.default_answer = kwargs.get('default_answer', None) + + +class CreateKbInputDTO(Model): + """Input to create KB. + + :param qna_list: List of QNA to be added to the index. Ids are generated + by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + :param urls: List of URLs to be added to knowledgebase. + :type urls: list[str] + :param files: List of files to be added to knowledgebase. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.FileDTO] + """ + + _attribute_map = { + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + } + + def __init__(self, **kwargs): + super(CreateKbInputDTO, self).__init__(**kwargs) + self.qna_list = kwargs.get('qna_list', None) + self.urls = kwargs.get('urls', None) + self.files = kwargs.get('files', None) + + +class DeleteKbContentsDTO(Model): + """PATCH body schema of Delete Operation in UpdateKb. + + :param ids: List of Qna Ids to be deleted + :type ids: list[int] + :param sources: List of sources to be deleted from knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'ids': {'key': 'ids', 'type': '[int]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(DeleteKbContentsDTO, self).__init__(**kwargs) + self.ids = kwargs.get('ids', None) + self.sources = kwargs.get('sources', None) + + +class EndpointKeysDTO(Model): + """Schema for EndpointKeys generate/refresh operations. + + :param primary_endpoint_key: Primary Access Key. + :type primary_endpoint_key: str + :param secondary_endpoint_key: Secondary Access Key. + :type secondary_endpoint_key: str + :param installed_version: Current version of runtime. + :type installed_version: str + :param last_stable_version: Latest version of runtime. + :type last_stable_version: str + :param language: Language setting of runtime. + :type language: str + """ + + _attribute_map = { + 'primary_endpoint_key': {'key': 'primaryEndpointKey', 'type': 'str'}, + 'secondary_endpoint_key': {'key': 'secondaryEndpointKey', 'type': 'str'}, + 'installed_version': {'key': 'installedVersion', 'type': 'str'}, + 'last_stable_version': {'key': 'lastStableVersion', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EndpointKeysDTO, self).__init__(**kwargs) + self.primary_endpoint_key = kwargs.get('primary_endpoint_key', None) + self.secondary_endpoint_key = kwargs.get('secondary_endpoint_key', None) + self.installed_version = kwargs.get('installed_version', None) + self.last_stable_version = kwargs.get('last_stable_version', None) + self.language = kwargs.get('language', None) + + +class EndpointSettingsDTO(Model): + """Endpoint settings. + + :param active_learning: Active Learning settings of the endpoint. + :type active_learning: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.EndpointSettingsDTOActiveLearning + """ + + _attribute_map = { + 'active_learning': {'key': 'activeLearning', 'type': 'EndpointSettingsDTOActiveLearning'}, + } + + def __init__(self, **kwargs): + super(EndpointSettingsDTO, self).__init__(**kwargs) + self.active_learning = kwargs.get('active_learning', None) + + +class EndpointSettingsDTOActiveLearning(ActiveLearningSettingsDTO): + """Active Learning settings of the endpoint. + + :param enable: True/False string providing Active Learning + :type enable: str + """ + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(EndpointSettingsDTOActiveLearning, self).__init__(**kwargs) + + +class Error(Model): + """The error object. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + self.inner_error = kwargs.get('inner_error', None) + + +class ErrorResponse(Model): + """Error response. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param error: The error object. + :type error: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ErrorResponseError(Error): + """The error object. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, **kwargs): + super(ErrorResponseError, self).__init__(**kwargs) + + +class FeedbackRecordDTO(Model): + """Active learning feedback record. + + :param user_id: Unique identifier for the user. + :type user_id: str + :param user_question: The suggested question being provided as feedback. + :type user_question: str + :param qna_id: The qnaId for which the suggested question is provided as + feedback. + :type qna_id: int + """ + + _validation = { + 'user_question': {'max_length': 1000}, + } + + _attribute_map = { + 'user_id': {'key': 'userId', 'type': 'str'}, + 'user_question': {'key': 'userQuestion', 'type': 'str'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(FeedbackRecordDTO, self).__init__(**kwargs) + self.user_id = kwargs.get('user_id', None) + self.user_question = kwargs.get('user_question', None) + self.qna_id = kwargs.get('qna_id', None) + + +class FeedbackRecordsDTO(Model): + """Active learning feedback records. + + :param feedback_records: List of feedback records. + :type feedback_records: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.FeedbackRecordDTO] + """ + + _attribute_map = { + 'feedback_records': {'key': 'feedbackRecords', 'type': '[FeedbackRecordDTO]'}, + } + + def __init__(self, **kwargs): + super(FeedbackRecordsDTO, self).__init__(**kwargs) + self.feedback_records = kwargs.get('feedback_records', None) + + +class FileDTO(Model): + """DTO to hold details of uploaded files. + + All required parameters must be populated in order to send to Azure. + + :param file_name: Required. File name. Supported file types are ".tsv", + ".pdf", ".txt", ".docx", ".xlsx". + :type file_name: str + :param file_uri: Required. Public URI of the file. + :type file_uri: str + :param is_unstructured: Optional Flag to specify if the given file is + Unstructured. + :type is_unstructured: bool + """ + + _validation = { + 'file_name': {'required': True, 'max_length': 200, 'min_length': 1}, + 'file_uri': {'required': True}, + } + + _attribute_map = { + 'file_name': {'key': 'fileName', 'type': 'str'}, + 'file_uri': {'key': 'fileUri', 'type': 'str'}, + 'is_unstructured': {'key': 'isUnstructured', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(FileDTO, self).__init__(**kwargs) + self.file_name = kwargs.get('file_name', None) + self.file_uri = kwargs.get('file_uri', None) + self.is_unstructured = kwargs.get('is_unstructured', None) + + +class GenerateAnswerBatchResultItem(Model): + """Represents Prebuilt Answer Result. + + :param answer: Answer. + :type answer: str + :param score: Search result score. + :type score: float + :param id: Document Id. + :type id: str + :param answer_span: Answer span object with respect to user's question. + :type answer_span: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.GenerateAnswerBatchResultItemAnswerSpan + :param answer_start_index: Start index of answer in document text. + :type answer_start_index: int + :param answer_end_index: End index of answer in document text. + :type answer_end_index: int + """ + + _attribute_map = { + 'answer': {'key': 'answer', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'id': {'key': 'id', 'type': 'str'}, + 'answer_span': {'key': 'answerSpan', 'type': 'GenerateAnswerBatchResultItemAnswerSpan'}, + 'answer_start_index': {'key': 'answerStartIndex', 'type': 'int'}, + 'answer_end_index': {'key': 'answerEndIndex', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(GenerateAnswerBatchResultItem, self).__init__(**kwargs) + self.answer = kwargs.get('answer', None) + self.score = kwargs.get('score', None) + self.id = kwargs.get('id', None) + self.answer_span = kwargs.get('answer_span', None) + self.answer_start_index = kwargs.get('answer_start_index', None) + self.answer_end_index = kwargs.get('answer_end_index', None) + + +class GenerateAnswerBatchResultItemAnswerSpan(AnswerSpanResponseDTO): + """Answer span object with respect to user's question. + + :param text: Predicted text of answer span. + :type text: str + :param score: Predicted score of answer span. + :type score: float + :param start_index: Start index of answer span in answer. + :type start_index: int + :param end_index: End index of answer span in answer. + :type end_index: int + """ + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'start_index': {'key': 'startIndex', 'type': 'int'}, + 'end_index': {'key': 'endIndex', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(GenerateAnswerBatchResultItemAnswerSpan, self).__init__(**kwargs) + + +class InnerErrorModel(Model): + """An object containing more specific information about the error. As per + Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param code: A more specific error code than was provided by the + containing error. + :type code: str + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.InnerErrorModel + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, **kwargs): + super(InnerErrorModel, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.inner_error = kwargs.get('inner_error', None) + + +class KnowledgebaseDTO(Model): + """Response schema for CreateKb operation. + + :param id: Unique id that identifies a knowledgebase. + :type id: str + :param host_name: URL host name at which the knowledgebase is hosted. + :type host_name: str + :param last_accessed_timestamp: Time stamp at which the knowledgebase was + last accessed (UTC). + :type last_accessed_timestamp: str + :param last_changed_timestamp: Time stamp at which the knowledgebase was + last modified (UTC). + :type last_changed_timestamp: str + :param last_published_timestamp: Time stamp at which the knowledgebase was + last published (UTC). + :type last_published_timestamp: str + :param name: Friendly name of the knowledgebase. + :type name: str + :param user_id: User who created / owns the knowledgebase. + :type user_id: str + :param urls: URL sources from which Q-A were extracted and added to the + knowledgebase. + :type urls: list[str] + :param sources: Custom sources from which Q-A were extracted or explicitly + added to the knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'last_accessed_timestamp': {'key': 'lastAccessedTimestamp', 'type': 'str'}, + 'last_changed_timestamp': {'key': 'lastChangedTimestamp', 'type': 'str'}, + 'last_published_timestamp': {'key': 'lastPublishedTimestamp', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(KnowledgebaseDTO, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.host_name = kwargs.get('host_name', None) + self.last_accessed_timestamp = kwargs.get('last_accessed_timestamp', None) + self.last_changed_timestamp = kwargs.get('last_changed_timestamp', None) + self.last_published_timestamp = kwargs.get('last_published_timestamp', None) + self.name = kwargs.get('name', None) + self.user_id = kwargs.get('user_id', None) + self.urls = kwargs.get('urls', None) + self.sources = kwargs.get('sources', None) + + +class KnowledgebasesDTO(Model): + """Collection of knowledgebases owned by a user. + + :param knowledgebases: Collection of knowledgebase records. + :type knowledgebases: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.KnowledgebaseDTO] + """ + + _attribute_map = { + 'knowledgebases': {'key': 'knowledgebases', 'type': '[KnowledgebaseDTO]'}, + } + + def __init__(self, **kwargs): + super(KnowledgebasesDTO, self).__init__(**kwargs) + self.knowledgebases = kwargs.get('knowledgebases', None) + + +class MetadataDTO(Model): + """Name - value pair of metadata. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Metadata name. + :type name: str + :param value: Required. Metadata value. + :type value: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'value': {'required': True, 'max_length': 500, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetadataDTO, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class Operation(Model): + """Record to track long running operation. + + :param operation_state: Operation state. Possible values include: + 'Failed', 'NotStarted', 'Running', 'Succeeded' + :type operation_state: str or + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.OperationStateType + :param created_timestamp: Timestamp when the operation was created. + :type created_timestamp: str + :param last_action_timestamp: Timestamp when the current state was + entered. + :type last_action_timestamp: str + :param resource_location: Relative URI to the target resource location for + completed resources. + :type resource_location: str + :param user_id: User Id + :type user_id: str + :param operation_id: Operation Id. + :type operation_id: str + :param error_response: Error details in case of failures. + :type error_response: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.ErrorResponse + """ + + _attribute_map = { + 'operation_state': {'key': 'operationState', 'type': 'str'}, + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'last_action_timestamp': {'key': 'lastActionTimestamp', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'error_response': {'key': 'errorResponse', 'type': 'ErrorResponse'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.operation_state = kwargs.get('operation_state', None) + self.created_timestamp = kwargs.get('created_timestamp', None) + self.last_action_timestamp = kwargs.get('last_action_timestamp', None) + self.resource_location = kwargs.get('resource_location', None) + self.user_id = kwargs.get('user_id', None) + self.operation_id = kwargs.get('operation_id', None) + self.error_response = kwargs.get('error_response', None) + + +class PrebuiltQuery(Model): + """POST body schema to query the documents via Prebuilt Question Answering. + + All required parameters must be populated in order to send to Azure. + + :param question: Required. User question to query against the given + documents. + :type question: str + :param documents: Required. Documents to be searched for given question. + :type documents: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.TextInput] + :param language: (Optional) Language of the documents. This is ISO 639-1 + representation of a language. For example, use "en" for English; "es" for + Spanish etc. If not set, use "en" for English as default. + :type language: str + """ + + _validation = { + 'question': {'required': True}, + 'documents': {'required': True}, + 'language': {'max_length': 100, 'min_length': 2}, + } + + _attribute_map = { + 'question': {'key': 'question', 'type': 'str'}, + 'documents': {'key': 'documents', 'type': '[TextInput]'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrebuiltQuery, self).__init__(**kwargs) + self.question = kwargs.get('question', None) + self.documents = kwargs.get('documents', None) + self.language = kwargs.get('language', None) + + +class PromptDTO(Model): + """Prompt for an answer. + + :param display_order: Index of the prompt - used in ordering of the + prompts + :type display_order: int + :param qna_id: Qna id corresponding to the prompt - if QnaId is present, + QnADTO object is ignored. + :type qna_id: int + :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a + PromptDTO object + :type qna: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTOQna + :param display_text: Text displayed to represent a follow up question + prompt + :type display_text: str + """ + + _validation = { + 'display_text': {'max_length': 200}, + } + + _attribute_map = { + 'display_order': {'key': 'displayOrder', 'type': 'int'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, + 'display_text': {'key': 'displayText', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PromptDTO, self).__init__(**kwargs) + self.display_order = kwargs.get('display_order', None) + self.qna_id = kwargs.get('qna_id', None) + self.qna = kwargs.get('qna', None) + self.display_text = kwargs.get('display_text', None) + + +class QnADTO(Model): + """Q-A object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTOContext + :param last_updated_timestamp: Timestamp when the QnA was last updated. + :type last_updated_timestamp: str + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + 'last_updated_timestamp': {'max_length': 300}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(QnADTO, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.answer = kwargs.get('answer', None) + self.source = kwargs.get('source', None) + self.questions = kwargs.get('questions', None) + self.metadata = kwargs.get('metadata', None) + self.context = kwargs.get('context', None) + self.last_updated_timestamp = kwargs.get('last_updated_timestamp', None) + + +class PromptDTOQna(QnADTO): + """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTOContext + :param last_updated_timestamp: Timestamp when the QnA was last updated. + :type last_updated_timestamp: str + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + 'last_updated_timestamp': {'max_length': 300}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PromptDTOQna, self).__init__(**kwargs) + + +class QnADocumentsDTO(Model): + """List of QnADTO. + + :param qna_documents: List of answers. + :type qna_documents: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + """ + + _attribute_map = { + 'qna_documents': {'key': 'qnaDocuments', 'type': '[QnADTO]'}, + } + + def __init__(self, **kwargs): + super(QnADocumentsDTO, self).__init__(**kwargs) + self.qna_documents = kwargs.get('qna_documents', None) + + +class QnADTOContext(ContextDTO): + """Context of a QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, **kwargs): + super(QnADTOContext, self).__init__(**kwargs) + + +class QnASearchResult(Model): + """Represents Search Result. + + :param questions: List of questions. + :type questions: list[str] + :param answer: Answer. + :type answer: str + :param score: Search result score. + :type score: float + :param id: Id of the QnA result. + :type id: int + :param source: Source of QnA result. + :type source: str + :param metadata: List of metadata. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param context: Context object of the QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnASearchResultContext + :param answer_span: Answer span object of QnA with respect to user's + question. + :type answer_span: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnASearchResultAnswerSpan + """ + + _attribute_map = { + 'questions': {'key': 'questions', 'type': '[str]'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'id': {'key': 'id', 'type': 'int'}, + 'source': {'key': 'source', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnASearchResultContext'}, + 'answer_span': {'key': 'answerSpan', 'type': 'QnASearchResultAnswerSpan'}, + } + + def __init__(self, **kwargs): + super(QnASearchResult, self).__init__(**kwargs) + self.questions = kwargs.get('questions', None) + self.answer = kwargs.get('answer', None) + self.score = kwargs.get('score', None) + self.id = kwargs.get('id', None) + self.source = kwargs.get('source', None) + self.metadata = kwargs.get('metadata', None) + self.context = kwargs.get('context', None) + self.answer_span = kwargs.get('answer_span', None) + + +class QnASearchResultAnswerSpan(AnswerSpanResponseDTO): + """Answer span object of QnA with respect to user's question. + + :param text: Predicted text of answer span. + :type text: str + :param score: Predicted score of answer span. + :type score: float + :param start_index: Start index of answer span in answer. + :type start_index: int + :param end_index: End index of answer span in answer. + :type end_index: int + """ + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'start_index': {'key': 'startIndex', 'type': 'int'}, + 'end_index': {'key': 'endIndex', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(QnASearchResultAnswerSpan, self).__init__(**kwargs) + + +class QnASearchResultContext(ContextDTO): + """Context object of the QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, **kwargs): + super(QnASearchResultContext, self).__init__(**kwargs) + + +class QnASearchResultList(Model): + """Represents List of Question Answers. + + :param answers: Represents Search Result list. + :type answers: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnASearchResult] + """ + + _attribute_map = { + 'answers': {'key': 'answers', 'type': '[QnASearchResult]'}, + } + + def __init__(self, **kwargs): + super(QnASearchResultList, self).__init__(**kwargs) + self.answers = kwargs.get('answers', None) + + +class QueryContextDTO(Model): + """Context object with previous QnA's information. + + :param previous_qna_id: Previous QnA Id - qnaId of the top result. + :type previous_qna_id: int + :param previous_user_query: Previous user query. + :type previous_user_query: str + """ + + _attribute_map = { + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'int'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(QueryContextDTO, self).__init__(**kwargs) + self.previous_qna_id = kwargs.get('previous_qna_id', None) + self.previous_user_query = kwargs.get('previous_user_query', None) + + +class QueryDTO(Model): + """POST body schema to query the knowledgebase. + + :param qna_id: Exact qnaId to fetch from the knowledgebase, this field + takes priority over question. + :type qna_id: str + :param question: User question to query against the knowledge base. + :type question: str + :param top: Max number of answers to be returned for the question. + :type top: int + :param user_id: Unique identifier for the user. + :type user_id: str + :param is_test: Query against the test index. + :type is_test: bool + :param score_threshold: Minimum threshold score for answers. + :type score_threshold: float + :param context: Context object with previous QnA's information. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QueryDTOContext + :param ranker_type: Optional field. Set to 'QuestionOnly' for using a + question only Ranker. + :type ranker_type: str + :param strict_filters: Find QnAs that are associated with the given list + of metadata. + :type strict_filters: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param strict_filters_compound_operation_type: Optional field. Set to 'OR' + for using OR operation for strict filters. Possible values include: 'AND', + 'OR' + :type strict_filters_compound_operation_type: str or + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.StrictFiltersCompoundOperationType + :param answer_span_request: To configure Answer span prediction feature. + :type answer_span_request: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QueryDTOAnswerSpanRequest + :param include_unstructured_sources: Optional Flag to enable Query over + Unstructured Sources. + :type include_unstructured_sources: bool + """ + + _attribute_map = { + 'qna_id': {'key': 'qnaId', 'type': 'str'}, + 'question': {'key': 'question', 'type': 'str'}, + 'top': {'key': 'top', 'type': 'int'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'is_test': {'key': 'isTest', 'type': 'bool'}, + 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, + 'context': {'key': 'context', 'type': 'QueryDTOContext'}, + 'ranker_type': {'key': 'rankerType', 'type': 'str'}, + 'strict_filters': {'key': 'strictFilters', 'type': '[MetadataDTO]'}, + 'strict_filters_compound_operation_type': {'key': 'strictFiltersCompoundOperationType', 'type': 'str'}, + 'answer_span_request': {'key': 'answerSpanRequest', 'type': 'QueryDTOAnswerSpanRequest'}, + 'include_unstructured_sources': {'key': 'includeUnstructuredSources', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(QueryDTO, self).__init__(**kwargs) + self.qna_id = kwargs.get('qna_id', None) + self.question = kwargs.get('question', None) + self.top = kwargs.get('top', None) + self.user_id = kwargs.get('user_id', None) + self.is_test = kwargs.get('is_test', None) + self.score_threshold = kwargs.get('score_threshold', None) + self.context = kwargs.get('context', None) + self.ranker_type = kwargs.get('ranker_type', None) + self.strict_filters = kwargs.get('strict_filters', None) + self.strict_filters_compound_operation_type = kwargs.get('strict_filters_compound_operation_type', None) + self.answer_span_request = kwargs.get('answer_span_request', None) + self.include_unstructured_sources = kwargs.get('include_unstructured_sources', None) + + +class QueryDTOAnswerSpanRequest(AnswerSpanRequestDTO): + """To configure Answer span prediction feature. + + :param enable: Enable or Disable Answer Span prediction. + :type enable: bool + :param score_threshold: Minimum threshold score required to include an + answer span. + :type score_threshold: float + :param top_answers_with_span: Number of Top answers to be considered for + span prediction. + :type top_answers_with_span: int + """ + + _validation = { + 'top_answers_with_span': {'maximum': 10, 'minimum': 1}, + } + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'bool'}, + 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, + 'top_answers_with_span': {'key': 'topAnswersWithSpan', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(QueryDTOAnswerSpanRequest, self).__init__(**kwargs) + + +class QueryDTOContext(QueryContextDTO): + """Context object with previous QnA's information. + + :param previous_qna_id: Previous QnA Id - qnaId of the top result. + :type previous_qna_id: int + :param previous_user_query: Previous user query. + :type previous_user_query: str + """ + + _attribute_map = { + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'int'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(QueryDTOContext, self).__init__(**kwargs) + + +class ReplaceKbDTO(Model): + """Post body schema for Replace KB operation. + + All required parameters must be populated in order to send to Azure. + + :param qn_alist: Required. List of Q-A (QnADTO) to be added to the + knowledgebase. Q-A Ids are assigned by the service and should be omitted. + :type qn_alist: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + """ + + _validation = { + 'qn_alist': {'required': True}, + } + + _attribute_map = { + 'qn_alist': {'key': 'qnAList', 'type': '[QnADTO]'}, + } + + def __init__(self, **kwargs): + super(ReplaceKbDTO, self).__init__(**kwargs) + self.qn_alist = kwargs.get('qn_alist', None) + + +class TextInput(Model): + """List of documents to be queried over. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique identifier for the document. + :type id: str + :param text: Required. Text contents of the document + :type text: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TextInput, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.text = kwargs.get('text', None) + + +class UpdateContextDTO(Model): + """Update Body schema to represent context to be updated. + + :param prompts_to_delete: List of prompts associated with qna to be + deleted + :type prompts_to_delete: list[int] + :param prompts_to_add: List of prompts to be added to the qna. + :type prompts_to_add: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + """ + + _attribute_map = { + 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, + 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(UpdateContextDTO, self).__init__(**kwargs) + self.prompts_to_delete = kwargs.get('prompts_to_delete', None) + self.prompts_to_add = kwargs.get('prompts_to_add', None) + self.is_context_only = kwargs.get('is_context_only', None) + + +class UpdateKbContentsDTO(Model): + """PATCH body schema for Update operation in Update Kb. + + :param name: Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the + knowledgebase. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTO] + :param urls: List of existing URLs to be refreshed. The content will be + extracted again and re-indexed. + :type urls: list[str] + :param default_answer: Default answer sent to user if no good match is + found in the KB. + :type default_answer: str + """ + + _validation = { + 'default_answer': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'default_answer': {'key': 'defaultAnswer', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UpdateKbContentsDTO, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.qna_list = kwargs.get('qna_list', None) + self.urls = kwargs.get('urls', None) + self.default_answer = kwargs.get('default_answer', None) + + +class UpdateKbOperationDTO(Model): + """Contains list of QnAs to be updated. + + :param add: An instance of CreateKbInputDTO for add operation + :type add: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateKbOperationDTOAdd + :param delete: An instance of DeleteKbContentsDTO for delete Operation + :type delete: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateKbOperationDTODelete + :param update: An instance of UpdateKbContentsDTO for Update Operation + :type update: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateKbOperationDTOUpdate + :param enable_hierarchical_extraction: 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. + :type enable_hierarchical_extraction: bool + :param default_answer_used_for_extraction: 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. + :type default_answer_used_for_extraction: str + """ + + _validation = { + 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'add': {'key': 'add', 'type': 'UpdateKbOperationDTOAdd'}, + 'delete': {'key': 'delete', 'type': 'UpdateKbOperationDTODelete'}, + 'update': {'key': 'update', 'type': 'UpdateKbOperationDTOUpdate'}, + 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, + 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UpdateKbOperationDTO, self).__init__(**kwargs) + self.add = kwargs.get('add', None) + self.delete = kwargs.get('delete', None) + self.update = kwargs.get('update', None) + self.enable_hierarchical_extraction = kwargs.get('enable_hierarchical_extraction', None) + self.default_answer_used_for_extraction = kwargs.get('default_answer_used_for_extraction', None) + + +class UpdateKbOperationDTOAdd(CreateKbInputDTO): + """An instance of CreateKbInputDTO for add operation. + + :param qna_list: List of QNA to be added to the index. Ids are generated + by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + :param urls: List of URLs to be added to knowledgebase. + :type urls: list[str] + :param files: List of files to be added to knowledgebase. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.FileDTO] + """ + + _attribute_map = { + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + } + + def __init__(self, **kwargs): + super(UpdateKbOperationDTOAdd, self).__init__(**kwargs) + + +class UpdateKbOperationDTODelete(DeleteKbContentsDTO): + """An instance of DeleteKbContentsDTO for delete Operation. + + :param ids: List of Qna Ids to be deleted + :type ids: list[int] + :param sources: List of sources to be deleted from knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'ids': {'key': 'ids', 'type': '[int]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UpdateKbOperationDTODelete, self).__init__(**kwargs) + + +class UpdateKbOperationDTOUpdate(UpdateKbContentsDTO): + """An instance of UpdateKbContentsDTO for Update Operation. + + :param name: Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the + knowledgebase. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTO] + :param urls: List of existing URLs to be refreshed. The content will be + extracted again and re-indexed. + :type urls: list[str] + :param default_answer: Default answer sent to user if no good match is + found in the KB. + :type default_answer: str + """ + + _validation = { + 'default_answer': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'default_answer': {'key': 'defaultAnswer', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UpdateKbOperationDTOUpdate, self).__init__(**kwargs) + + +class UpdateMetadataDTO(Model): + """PATCH Body schema to represent list of Metadata to be updated. + + :param delete: List of Metadata associated with answer to be deleted + :type delete: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param add: List of metadata associated with answer to be added + :type add: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + """ + + _attribute_map = { + 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, + 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + } + + def __init__(self, **kwargs): + super(UpdateMetadataDTO, self).__init__(**kwargs) + self.delete = kwargs.get('delete', None) + self.add = kwargs.get('add', None) + + +class UpdateQnaDTO(Model): + """PATCH Body schema for Update Qna List. + + :param id: Unique id for the Q-A + :type id: int + :param answer: Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: List of questions associated with the answer. + :type questions: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTOQuestions + :param metadata: List of metadata associated with the answer to be updated + :type metadata: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTOMetadata + :param context: Context associated with Qna to be updated. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTOContext + """ + + _validation = { + 'id': {'maximum': 2147483647, 'minimum': 0}, + 'source': {'max_length': 300}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': 'UpdateQnaDTOQuestions'}, + 'metadata': {'key': 'metadata', 'type': 'UpdateQnaDTOMetadata'}, + 'context': {'key': 'context', 'type': 'UpdateQnaDTOContext'}, + } + + def __init__(self, **kwargs): + super(UpdateQnaDTO, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.answer = kwargs.get('answer', None) + self.source = kwargs.get('source', None) + self.questions = kwargs.get('questions', None) + self.metadata = kwargs.get('metadata', None) + self.context = kwargs.get('context', None) + + +class UpdateQnaDTOContext(UpdateContextDTO): + """Context associated with Qna to be updated. + + :param prompts_to_delete: List of prompts associated with qna to be + deleted + :type prompts_to_delete: list[int] + :param prompts_to_add: List of prompts to be added to the qna. + :type prompts_to_add: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + """ + + _attribute_map = { + 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, + 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(UpdateQnaDTOContext, self).__init__(**kwargs) + + +class UpdateQnaDTOMetadata(UpdateMetadataDTO): + """List of metadata associated with the answer to be updated. + + :param delete: List of Metadata associated with answer to be deleted + :type delete: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param add: List of metadata associated with answer to be added + :type add: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + """ + + _attribute_map = { + 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, + 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + } + + def __init__(self, **kwargs): + super(UpdateQnaDTOMetadata, self).__init__(**kwargs) + + +class UpdateQuestionsDTO(Model): + """PATCH Body schema for Update Kb which contains list of questions to be + added and deleted. + + :param add: List of questions to be added + :type add: list[str] + :param delete: List of questions to be deleted. + :type delete: list[str] + """ + + _attribute_map = { + 'add': {'key': 'add', 'type': '[str]'}, + 'delete': {'key': 'delete', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UpdateQuestionsDTO, self).__init__(**kwargs) + self.add = kwargs.get('add', None) + self.delete = kwargs.get('delete', None) + + +class UpdateQnaDTOQuestions(UpdateQuestionsDTO): + """List of questions associated with the answer. + + :param add: List of questions to be added + :type add: list[str] + :param delete: List of questions to be deleted. + :type delete: list[str] + """ + + _attribute_map = { + 'add': {'key': 'add', 'type': '[str]'}, + 'delete': {'key': 'delete', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(UpdateQnaDTOQuestions, self).__init__(**kwargs) + + +class WordAlterationsDTO(Model): + """Collection of word alterations. + + All required parameters must be populated in order to send to Azure. + + :param word_alterations: Required. Collection of word alterations. + :type word_alterations: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.AlterationsDTO] + """ + + _validation = { + 'word_alterations': {'required': True}, + } + + _attribute_map = { + 'word_alterations': {'key': 'wordAlterations', 'type': '[AlterationsDTO]'}, + } + + def __init__(self, **kwargs): + super(WordAlterationsDTO, self).__init__(**kwargs) + self.word_alterations = kwargs.get('word_alterations', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_models_py3.py new file mode 100644 index 0000000000000..a6bd6a0ba7aa3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_models_py3.py @@ -0,0 +1,1624 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ActiveLearningSettingsDTO(Model): + """Active Learning settings of the endpoint. + + :param enable: True/False string providing Active Learning + :type enable: str + """ + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'str'}, + } + + def __init__(self, *, enable: str=None, **kwargs) -> None: + super(ActiveLearningSettingsDTO, self).__init__(**kwargs) + self.enable = enable + + +class AlterationsDTO(Model): + """Collection of words that are synonyms. + + All required parameters must be populated in order to send to Azure. + + :param alterations: Required. Words that are synonymous with each other. + :type alterations: list[str] + """ + + _validation = { + 'alterations': {'required': True}, + } + + _attribute_map = { + 'alterations': {'key': 'alterations', 'type': '[str]'}, + } + + def __init__(self, *, alterations, **kwargs) -> None: + super(AlterationsDTO, self).__init__(**kwargs) + self.alterations = alterations + + +class AnswerSpanRequestDTO(Model): + """To configure Answer span prediction feature. + + :param enable: Enable or Disable Answer Span prediction. + :type enable: bool + :param score_threshold: Minimum threshold score required to include an + answer span. + :type score_threshold: float + :param top_answers_with_span: Number of Top answers to be considered for + span prediction. + :type top_answers_with_span: int + """ + + _validation = { + 'top_answers_with_span': {'maximum': 10, 'minimum': 1}, + } + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'bool'}, + 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, + 'top_answers_with_span': {'key': 'topAnswersWithSpan', 'type': 'int'}, + } + + def __init__(self, *, enable: bool=None, score_threshold: float=None, top_answers_with_span: int=None, **kwargs) -> None: + super(AnswerSpanRequestDTO, self).__init__(**kwargs) + self.enable = enable + self.score_threshold = score_threshold + self.top_answers_with_span = top_answers_with_span + + +class AnswerSpanResponseDTO(Model): + """Answer span object of QnA. + + :param text: Predicted text of answer span. + :type text: str + :param score: Predicted score of answer span. + :type score: float + :param start_index: Start index of answer span in answer. + :type start_index: int + :param end_index: End index of answer span in answer. + :type end_index: int + """ + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'start_index': {'key': 'startIndex', 'type': 'int'}, + 'end_index': {'key': 'endIndex', 'type': 'int'}, + } + + def __init__(self, *, text: str=None, score: float=None, start_index: int=None, end_index: int=None, **kwargs) -> None: + super(AnswerSpanResponseDTO, self).__init__(**kwargs) + self.text = text + self.score = score + self.start_index = start_index + self.end_index = end_index + + +class ContextDTO(Model): + """Context associated with Qna. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: + super(ContextDTO, self).__init__(**kwargs) + self.is_context_only = is_context_only + self.prompts = prompts + + +class CreateKbDTO(Model): + """Post body schema for CreateKb operation. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (QnADTO) to be added to the knowledgebase. + Q-A Ids are assigned by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + :param urls: List of URLs to be used for extracting Q-A. + :type urls: list[str] + :param files: List of files from which to Extract Q-A. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.FileDTO] + :param enable_hierarchical_extraction: Enable hierarchical extraction of + Q-A from files and urls. Value to be considered False if this field is not + present. + :type enable_hierarchical_extraction: bool + :param default_answer_used_for_extraction: 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. + :type default_answer_used_for_extraction: str + :param language: Language of the knowledgebase. Please find the list of + supported languages here. + :type language: str + :param enable_multiple_languages: Set to true to enable creating KBs in + different languages for the same resource. + :type enable_multiple_languages: bool + :param default_answer: Default answer sent to user if no good match is + found in the KB. + :type default_answer: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, + 'language': {'max_length': 100, 'min_length': 1}, + 'default_answer': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, + 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + 'enable_multiple_languages': {'key': 'enableMultipleLanguages', 'type': 'bool'}, + 'default_answer': {'key': 'defaultAnswer', 'type': 'str'}, + } + + def __init__(self, *, name: str, qna_list=None, urls=None, files=None, enable_hierarchical_extraction: bool=None, default_answer_used_for_extraction: str=None, language: str=None, enable_multiple_languages: bool=None, default_answer: str=None, **kwargs) -> None: + super(CreateKbDTO, self).__init__(**kwargs) + self.name = name + self.qna_list = qna_list + self.urls = urls + self.files = files + self.enable_hierarchical_extraction = enable_hierarchical_extraction + self.default_answer_used_for_extraction = default_answer_used_for_extraction + self.language = language + self.enable_multiple_languages = enable_multiple_languages + self.default_answer = default_answer + + +class CreateKbInputDTO(Model): + """Input to create KB. + + :param qna_list: List of QNA to be added to the index. Ids are generated + by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + :param urls: List of URLs to be added to knowledgebase. + :type urls: list[str] + :param files: List of files to be added to knowledgebase. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.FileDTO] + """ + + _attribute_map = { + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + } + + def __init__(self, *, qna_list=None, urls=None, files=None, **kwargs) -> None: + super(CreateKbInputDTO, self).__init__(**kwargs) + self.qna_list = qna_list + self.urls = urls + self.files = files + + +class DeleteKbContentsDTO(Model): + """PATCH body schema of Delete Operation in UpdateKb. + + :param ids: List of Qna Ids to be deleted + :type ids: list[int] + :param sources: List of sources to be deleted from knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'ids': {'key': 'ids', 'type': '[int]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, *, ids=None, sources=None, **kwargs) -> None: + super(DeleteKbContentsDTO, self).__init__(**kwargs) + self.ids = ids + self.sources = sources + + +class EndpointKeysDTO(Model): + """Schema for EndpointKeys generate/refresh operations. + + :param primary_endpoint_key: Primary Access Key. + :type primary_endpoint_key: str + :param secondary_endpoint_key: Secondary Access Key. + :type secondary_endpoint_key: str + :param installed_version: Current version of runtime. + :type installed_version: str + :param last_stable_version: Latest version of runtime. + :type last_stable_version: str + :param language: Language setting of runtime. + :type language: str + """ + + _attribute_map = { + 'primary_endpoint_key': {'key': 'primaryEndpointKey', 'type': 'str'}, + 'secondary_endpoint_key': {'key': 'secondaryEndpointKey', 'type': 'str'}, + 'installed_version': {'key': 'installedVersion', 'type': 'str'}, + 'last_stable_version': {'key': 'lastStableVersion', 'type': 'str'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, *, primary_endpoint_key: str=None, secondary_endpoint_key: str=None, installed_version: str=None, last_stable_version: str=None, language: str=None, **kwargs) -> None: + super(EndpointKeysDTO, self).__init__(**kwargs) + self.primary_endpoint_key = primary_endpoint_key + self.secondary_endpoint_key = secondary_endpoint_key + self.installed_version = installed_version + self.last_stable_version = last_stable_version + self.language = language + + +class EndpointSettingsDTO(Model): + """Endpoint settings. + + :param active_learning: Active Learning settings of the endpoint. + :type active_learning: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.EndpointSettingsDTOActiveLearning + """ + + _attribute_map = { + 'active_learning': {'key': 'activeLearning', 'type': 'EndpointSettingsDTOActiveLearning'}, + } + + def __init__(self, *, active_learning=None, **kwargs) -> None: + super(EndpointSettingsDTO, self).__init__(**kwargs) + self.active_learning = active_learning + + +class EndpointSettingsDTOActiveLearning(ActiveLearningSettingsDTO): + """Active Learning settings of the endpoint. + + :param enable: True/False string providing Active Learning + :type enable: str + """ + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'str'}, + } + + def __init__(self, *, enable: str=None, **kwargs) -> None: + super(EndpointSettingsDTOActiveLearning, self).__init__(enable=enable, **kwargs) + + +class Error(Model): + """The error object. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + self.inner_error = inner_error + + +class ErrorResponse(Model): + """Error response. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param error: The error object. + :type error: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ErrorResponseError(Error): + """The error object. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: + super(ErrorResponseError, self).__init__(code=code, message=message, target=target, details=details, inner_error=inner_error, **kwargs) + + +class FeedbackRecordDTO(Model): + """Active learning feedback record. + + :param user_id: Unique identifier for the user. + :type user_id: str + :param user_question: The suggested question being provided as feedback. + :type user_question: str + :param qna_id: The qnaId for which the suggested question is provided as + feedback. + :type qna_id: int + """ + + _validation = { + 'user_question': {'max_length': 1000}, + } + + _attribute_map = { + 'user_id': {'key': 'userId', 'type': 'str'}, + 'user_question': {'key': 'userQuestion', 'type': 'str'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + } + + def __init__(self, *, user_id: str=None, user_question: str=None, qna_id: int=None, **kwargs) -> None: + super(FeedbackRecordDTO, self).__init__(**kwargs) + self.user_id = user_id + self.user_question = user_question + self.qna_id = qna_id + + +class FeedbackRecordsDTO(Model): + """Active learning feedback records. + + :param feedback_records: List of feedback records. + :type feedback_records: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.FeedbackRecordDTO] + """ + + _attribute_map = { + 'feedback_records': {'key': 'feedbackRecords', 'type': '[FeedbackRecordDTO]'}, + } + + def __init__(self, *, feedback_records=None, **kwargs) -> None: + super(FeedbackRecordsDTO, self).__init__(**kwargs) + self.feedback_records = feedback_records + + +class FileDTO(Model): + """DTO to hold details of uploaded files. + + All required parameters must be populated in order to send to Azure. + + :param file_name: Required. File name. Supported file types are ".tsv", + ".pdf", ".txt", ".docx", ".xlsx". + :type file_name: str + :param file_uri: Required. Public URI of the file. + :type file_uri: str + :param is_unstructured: Optional Flag to specify if the given file is + Unstructured. + :type is_unstructured: bool + """ + + _validation = { + 'file_name': {'required': True, 'max_length': 200, 'min_length': 1}, + 'file_uri': {'required': True}, + } + + _attribute_map = { + 'file_name': {'key': 'fileName', 'type': 'str'}, + 'file_uri': {'key': 'fileUri', 'type': 'str'}, + 'is_unstructured': {'key': 'isUnstructured', 'type': 'bool'}, + } + + def __init__(self, *, file_name: str, file_uri: str, is_unstructured: bool=None, **kwargs) -> None: + super(FileDTO, self).__init__(**kwargs) + self.file_name = file_name + self.file_uri = file_uri + self.is_unstructured = is_unstructured + + +class GenerateAnswerBatchResultItem(Model): + """Represents Prebuilt Answer Result. + + :param answer: Answer. + :type answer: str + :param score: Search result score. + :type score: float + :param id: Document Id. + :type id: str + :param answer_span: Answer span object with respect to user's question. + :type answer_span: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.GenerateAnswerBatchResultItemAnswerSpan + :param answer_start_index: Start index of answer in document text. + :type answer_start_index: int + :param answer_end_index: End index of answer in document text. + :type answer_end_index: int + """ + + _attribute_map = { + 'answer': {'key': 'answer', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'id': {'key': 'id', 'type': 'str'}, + 'answer_span': {'key': 'answerSpan', 'type': 'GenerateAnswerBatchResultItemAnswerSpan'}, + 'answer_start_index': {'key': 'answerStartIndex', 'type': 'int'}, + 'answer_end_index': {'key': 'answerEndIndex', 'type': 'int'}, + } + + def __init__(self, *, answer: str=None, score: float=None, id: str=None, answer_span=None, answer_start_index: int=None, answer_end_index: int=None, **kwargs) -> None: + super(GenerateAnswerBatchResultItem, self).__init__(**kwargs) + self.answer = answer + self.score = score + self.id = id + self.answer_span = answer_span + self.answer_start_index = answer_start_index + self.answer_end_index = answer_end_index + + +class GenerateAnswerBatchResultItemAnswerSpan(AnswerSpanResponseDTO): + """Answer span object with respect to user's question. + + :param text: Predicted text of answer span. + :type text: str + :param score: Predicted score of answer span. + :type score: float + :param start_index: Start index of answer span in answer. + :type start_index: int + :param end_index: End index of answer span in answer. + :type end_index: int + """ + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'start_index': {'key': 'startIndex', 'type': 'int'}, + 'end_index': {'key': 'endIndex', 'type': 'int'}, + } + + def __init__(self, *, text: str=None, score: float=None, start_index: int=None, end_index: int=None, **kwargs) -> None: + super(GenerateAnswerBatchResultItemAnswerSpan, self).__init__(text=text, score=score, start_index=start_index, end_index=end_index, **kwargs) + + +class InnerErrorModel(Model): + """An object containing more specific information about the error. As per + Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param code: A more specific error code than was provided by the + containing error. + :type code: str + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.InnerErrorModel + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, *, code: str=None, inner_error=None, **kwargs) -> None: + super(InnerErrorModel, self).__init__(**kwargs) + self.code = code + self.inner_error = inner_error + + +class KnowledgebaseDTO(Model): + """Response schema for CreateKb operation. + + :param id: Unique id that identifies a knowledgebase. + :type id: str + :param host_name: URL host name at which the knowledgebase is hosted. + :type host_name: str + :param last_accessed_timestamp: Time stamp at which the knowledgebase was + last accessed (UTC). + :type last_accessed_timestamp: str + :param last_changed_timestamp: Time stamp at which the knowledgebase was + last modified (UTC). + :type last_changed_timestamp: str + :param last_published_timestamp: Time stamp at which the knowledgebase was + last published (UTC). + :type last_published_timestamp: str + :param name: Friendly name of the knowledgebase. + :type name: str + :param user_id: User who created / owns the knowledgebase. + :type user_id: str + :param urls: URL sources from which Q-A were extracted and added to the + knowledgebase. + :type urls: list[str] + :param sources: Custom sources from which Q-A were extracted or explicitly + added to the knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'last_accessed_timestamp': {'key': 'lastAccessedTimestamp', 'type': 'str'}, + 'last_changed_timestamp': {'key': 'lastChangedTimestamp', 'type': 'str'}, + 'last_published_timestamp': {'key': 'lastPublishedTimestamp', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, *, id: str=None, host_name: str=None, last_accessed_timestamp: str=None, last_changed_timestamp: str=None, last_published_timestamp: str=None, name: str=None, user_id: str=None, urls=None, sources=None, **kwargs) -> None: + super(KnowledgebaseDTO, self).__init__(**kwargs) + self.id = id + self.host_name = host_name + self.last_accessed_timestamp = last_accessed_timestamp + self.last_changed_timestamp = last_changed_timestamp + self.last_published_timestamp = last_published_timestamp + self.name = name + self.user_id = user_id + self.urls = urls + self.sources = sources + + +class KnowledgebasesDTO(Model): + """Collection of knowledgebases owned by a user. + + :param knowledgebases: Collection of knowledgebase records. + :type knowledgebases: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.KnowledgebaseDTO] + """ + + _attribute_map = { + 'knowledgebases': {'key': 'knowledgebases', 'type': '[KnowledgebaseDTO]'}, + } + + def __init__(self, *, knowledgebases=None, **kwargs) -> None: + super(KnowledgebasesDTO, self).__init__(**kwargs) + self.knowledgebases = knowledgebases + + +class MetadataDTO(Model): + """Name - value pair of metadata. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Metadata name. + :type name: str + :param value: Required. Metadata value. + :type value: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'value': {'required': True, 'max_length': 500, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str, **kwargs) -> None: + super(MetadataDTO, self).__init__(**kwargs) + self.name = name + self.value = value + + +class Operation(Model): + """Record to track long running operation. + + :param operation_state: Operation state. Possible values include: + 'Failed', 'NotStarted', 'Running', 'Succeeded' + :type operation_state: str or + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.OperationStateType + :param created_timestamp: Timestamp when the operation was created. + :type created_timestamp: str + :param last_action_timestamp: Timestamp when the current state was + entered. + :type last_action_timestamp: str + :param resource_location: Relative URI to the target resource location for + completed resources. + :type resource_location: str + :param user_id: User Id + :type user_id: str + :param operation_id: Operation Id. + :type operation_id: str + :param error_response: Error details in case of failures. + :type error_response: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.ErrorResponse + """ + + _attribute_map = { + 'operation_state': {'key': 'operationState', 'type': 'str'}, + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'last_action_timestamp': {'key': 'lastActionTimestamp', 'type': 'str'}, + 'resource_location': {'key': 'resourceLocation', 'type': 'str'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'error_response': {'key': 'errorResponse', 'type': 'ErrorResponse'}, + } + + def __init__(self, *, operation_state=None, created_timestamp: str=None, last_action_timestamp: str=None, resource_location: str=None, user_id: str=None, operation_id: str=None, error_response=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.operation_state = operation_state + self.created_timestamp = created_timestamp + self.last_action_timestamp = last_action_timestamp + self.resource_location = resource_location + self.user_id = user_id + self.operation_id = operation_id + self.error_response = error_response + + +class PrebuiltQuery(Model): + """POST body schema to query the documents via Prebuilt Question Answering. + + All required parameters must be populated in order to send to Azure. + + :param question: Required. User question to query against the given + documents. + :type question: str + :param documents: Required. Documents to be searched for given question. + :type documents: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.TextInput] + :param language: (Optional) Language of the documents. This is ISO 639-1 + representation of a language. For example, use "en" for English; "es" for + Spanish etc. If not set, use "en" for English as default. + :type language: str + """ + + _validation = { + 'question': {'required': True}, + 'documents': {'required': True}, + 'language': {'max_length': 100, 'min_length': 2}, + } + + _attribute_map = { + 'question': {'key': 'question', 'type': 'str'}, + 'documents': {'key': 'documents', 'type': '[TextInput]'}, + 'language': {'key': 'language', 'type': 'str'}, + } + + def __init__(self, *, question: str, documents, language: str=None, **kwargs) -> None: + super(PrebuiltQuery, self).__init__(**kwargs) + self.question = question + self.documents = documents + self.language = language + + +class PromptDTO(Model): + """Prompt for an answer. + + :param display_order: Index of the prompt - used in ordering of the + prompts + :type display_order: int + :param qna_id: Qna id corresponding to the prompt - if QnaId is present, + QnADTO object is ignored. + :type qna_id: int + :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a + PromptDTO object + :type qna: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTOQna + :param display_text: Text displayed to represent a follow up question + prompt + :type display_text: str + """ + + _validation = { + 'display_text': {'max_length': 200}, + } + + _attribute_map = { + 'display_order': {'key': 'displayOrder', 'type': 'int'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, + 'display_text': {'key': 'displayText', 'type': 'str'}, + } + + def __init__(self, *, display_order: int=None, qna_id: int=None, qna=None, display_text: str=None, **kwargs) -> None: + super(PromptDTO, self).__init__(**kwargs) + self.display_order = display_order + self.qna_id = qna_id + self.qna = qna + self.display_text = display_text + + +class QnADTO(Model): + """Q-A object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTOContext + :param last_updated_timestamp: Timestamp when the QnA was last updated. + :type last_updated_timestamp: str + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + 'last_updated_timestamp': {'max_length': 300}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, last_updated_timestamp: str=None, **kwargs) -> None: + super(QnADTO, self).__init__(**kwargs) + self.id = id + self.answer = answer + self.source = source + self.questions = questions + self.metadata = metadata + self.context = context + self.last_updated_timestamp = last_updated_timestamp + + +class PromptDTOQna(QnADTO): + """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTOContext + :param last_updated_timestamp: Timestamp when the QnA was last updated. + :type last_updated_timestamp: str + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + 'last_updated_timestamp': {'max_length': 300}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, last_updated_timestamp: str=None, **kwargs) -> None: + super(PromptDTOQna, self).__init__(id=id, answer=answer, source=source, questions=questions, metadata=metadata, context=context, last_updated_timestamp=last_updated_timestamp, **kwargs) + + +class QnADocumentsDTO(Model): + """List of QnADTO. + + :param qna_documents: List of answers. + :type qna_documents: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + """ + + _attribute_map = { + 'qna_documents': {'key': 'qnaDocuments', 'type': '[QnADTO]'}, + } + + def __init__(self, *, qna_documents=None, **kwargs) -> None: + super(QnADocumentsDTO, self).__init__(**kwargs) + self.qna_documents = qna_documents + + +class QnADTOContext(ContextDTO): + """Context of a QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: + super(QnADTOContext, self).__init__(is_context_only=is_context_only, prompts=prompts, **kwargs) + + +class QnASearchResult(Model): + """Represents Search Result. + + :param questions: List of questions. + :type questions: list[str] + :param answer: Answer. + :type answer: str + :param score: Search result score. + :type score: float + :param id: Id of the QnA result. + :type id: int + :param source: Source of QnA result. + :type source: str + :param metadata: List of metadata. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param context: Context object of the QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnASearchResultContext + :param answer_span: Answer span object of QnA with respect to user's + question. + :type answer_span: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnASearchResultAnswerSpan + """ + + _attribute_map = { + 'questions': {'key': 'questions', 'type': '[str]'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'id': {'key': 'id', 'type': 'int'}, + 'source': {'key': 'source', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnASearchResultContext'}, + 'answer_span': {'key': 'answerSpan', 'type': 'QnASearchResultAnswerSpan'}, + } + + def __init__(self, *, questions=None, answer: str=None, score: float=None, id: int=None, source: str=None, metadata=None, context=None, answer_span=None, **kwargs) -> None: + super(QnASearchResult, self).__init__(**kwargs) + self.questions = questions + self.answer = answer + self.score = score + self.id = id + self.source = source + self.metadata = metadata + self.context = context + self.answer_span = answer_span + + +class QnASearchResultAnswerSpan(AnswerSpanResponseDTO): + """Answer span object of QnA with respect to user's question. + + :param text: Predicted text of answer span. + :type text: str + :param score: Predicted score of answer span. + :type score: float + :param start_index: Start index of answer span in answer. + :type start_index: int + :param end_index: End index of answer span in answer. + :type end_index: int + """ + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'start_index': {'key': 'startIndex', 'type': 'int'}, + 'end_index': {'key': 'endIndex', 'type': 'int'}, + } + + def __init__(self, *, text: str=None, score: float=None, start_index: int=None, end_index: int=None, **kwargs) -> None: + super(QnASearchResultAnswerSpan, self).__init__(text=text, score=score, start_index=start_index, end_index=end_index, **kwargs) + + +class QnASearchResultContext(ContextDTO): + """Context object of the QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: + super(QnASearchResultContext, self).__init__(is_context_only=is_context_only, prompts=prompts, **kwargs) + + +class QnASearchResultList(Model): + """Represents List of Question Answers. + + :param answers: Represents Search Result list. + :type answers: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnASearchResult] + """ + + _attribute_map = { + 'answers': {'key': 'answers', 'type': '[QnASearchResult]'}, + } + + def __init__(self, *, answers=None, **kwargs) -> None: + super(QnASearchResultList, self).__init__(**kwargs) + self.answers = answers + + +class QueryContextDTO(Model): + """Context object with previous QnA's information. + + :param previous_qna_id: Previous QnA Id - qnaId of the top result. + :type previous_qna_id: int + :param previous_user_query: Previous user query. + :type previous_user_query: str + """ + + _attribute_map = { + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'int'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, + } + + def __init__(self, *, previous_qna_id: int=None, previous_user_query: str=None, **kwargs) -> None: + super(QueryContextDTO, self).__init__(**kwargs) + self.previous_qna_id = previous_qna_id + self.previous_user_query = previous_user_query + + +class QueryDTO(Model): + """POST body schema to query the knowledgebase. + + :param qna_id: Exact qnaId to fetch from the knowledgebase, this field + takes priority over question. + :type qna_id: str + :param question: User question to query against the knowledge base. + :type question: str + :param top: Max number of answers to be returned for the question. + :type top: int + :param user_id: Unique identifier for the user. + :type user_id: str + :param is_test: Query against the test index. + :type is_test: bool + :param score_threshold: Minimum threshold score for answers. + :type score_threshold: float + :param context: Context object with previous QnA's information. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QueryDTOContext + :param ranker_type: Optional field. Set to 'QuestionOnly' for using a + question only Ranker. + :type ranker_type: str + :param strict_filters: Find QnAs that are associated with the given list + of metadata. + :type strict_filters: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param strict_filters_compound_operation_type: Optional field. Set to 'OR' + for using OR operation for strict filters. Possible values include: 'AND', + 'OR' + :type strict_filters_compound_operation_type: str or + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.StrictFiltersCompoundOperationType + :param answer_span_request: To configure Answer span prediction feature. + :type answer_span_request: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QueryDTOAnswerSpanRequest + :param include_unstructured_sources: Optional Flag to enable Query over + Unstructured Sources. + :type include_unstructured_sources: bool + """ + + _attribute_map = { + 'qna_id': {'key': 'qnaId', 'type': 'str'}, + 'question': {'key': 'question', 'type': 'str'}, + 'top': {'key': 'top', 'type': 'int'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'is_test': {'key': 'isTest', 'type': 'bool'}, + 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, + 'context': {'key': 'context', 'type': 'QueryDTOContext'}, + 'ranker_type': {'key': 'rankerType', 'type': 'str'}, + 'strict_filters': {'key': 'strictFilters', 'type': '[MetadataDTO]'}, + 'strict_filters_compound_operation_type': {'key': 'strictFiltersCompoundOperationType', 'type': 'str'}, + 'answer_span_request': {'key': 'answerSpanRequest', 'type': 'QueryDTOAnswerSpanRequest'}, + 'include_unstructured_sources': {'key': 'includeUnstructuredSources', 'type': 'bool'}, + } + + def __init__(self, *, qna_id: str=None, question: str=None, top: int=None, user_id: str=None, is_test: bool=None, score_threshold: float=None, context=None, ranker_type: str=None, strict_filters=None, strict_filters_compound_operation_type=None, answer_span_request=None, include_unstructured_sources: bool=None, **kwargs) -> None: + super(QueryDTO, self).__init__(**kwargs) + self.qna_id = qna_id + self.question = question + self.top = top + self.user_id = user_id + self.is_test = is_test + self.score_threshold = score_threshold + self.context = context + self.ranker_type = ranker_type + self.strict_filters = strict_filters + self.strict_filters_compound_operation_type = strict_filters_compound_operation_type + self.answer_span_request = answer_span_request + self.include_unstructured_sources = include_unstructured_sources + + +class QueryDTOAnswerSpanRequest(AnswerSpanRequestDTO): + """To configure Answer span prediction feature. + + :param enable: Enable or Disable Answer Span prediction. + :type enable: bool + :param score_threshold: Minimum threshold score required to include an + answer span. + :type score_threshold: float + :param top_answers_with_span: Number of Top answers to be considered for + span prediction. + :type top_answers_with_span: int + """ + + _validation = { + 'top_answers_with_span': {'maximum': 10, 'minimum': 1}, + } + + _attribute_map = { + 'enable': {'key': 'enable', 'type': 'bool'}, + 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, + 'top_answers_with_span': {'key': 'topAnswersWithSpan', 'type': 'int'}, + } + + def __init__(self, *, enable: bool=None, score_threshold: float=None, top_answers_with_span: int=None, **kwargs) -> None: + super(QueryDTOAnswerSpanRequest, self).__init__(enable=enable, score_threshold=score_threshold, top_answers_with_span=top_answers_with_span, **kwargs) + + +class QueryDTOContext(QueryContextDTO): + """Context object with previous QnA's information. + + :param previous_qna_id: Previous QnA Id - qnaId of the top result. + :type previous_qna_id: int + :param previous_user_query: Previous user query. + :type previous_user_query: str + """ + + _attribute_map = { + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'int'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, + } + + def __init__(self, *, previous_qna_id: int=None, previous_user_query: str=None, **kwargs) -> None: + super(QueryDTOContext, self).__init__(previous_qna_id=previous_qna_id, previous_user_query=previous_user_query, **kwargs) + + +class ReplaceKbDTO(Model): + """Post body schema for Replace KB operation. + + All required parameters must be populated in order to send to Azure. + + :param qn_alist: Required. List of Q-A (QnADTO) to be added to the + knowledgebase. Q-A Ids are assigned by the service and should be omitted. + :type qn_alist: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + """ + + _validation = { + 'qn_alist': {'required': True}, + } + + _attribute_map = { + 'qn_alist': {'key': 'qnAList', 'type': '[QnADTO]'}, + } + + def __init__(self, *, qn_alist, **kwargs) -> None: + super(ReplaceKbDTO, self).__init__(**kwargs) + self.qn_alist = qn_alist + + +class TextInput(Model): + """List of documents to be queried over. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Unique identifier for the document. + :type id: str + :param text: Required. Text contents of the document + :type text: str + """ + + _validation = { + 'id': {'required': True}, + 'text': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + } + + def __init__(self, *, id: str, text: str, **kwargs) -> None: + super(TextInput, self).__init__(**kwargs) + self.id = id + self.text = text + + +class UpdateContextDTO(Model): + """Update Body schema to represent context to be updated. + + :param prompts_to_delete: List of prompts associated with qna to be + deleted + :type prompts_to_delete: list[int] + :param prompts_to_add: List of prompts to be added to the qna. + :type prompts_to_add: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + """ + + _attribute_map = { + 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, + 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + } + + def __init__(self, *, prompts_to_delete=None, prompts_to_add=None, is_context_only: bool=None, **kwargs) -> None: + super(UpdateContextDTO, self).__init__(**kwargs) + self.prompts_to_delete = prompts_to_delete + self.prompts_to_add = prompts_to_add + self.is_context_only = is_context_only + + +class UpdateKbContentsDTO(Model): + """PATCH body schema for Update operation in Update Kb. + + :param name: Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the + knowledgebase. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTO] + :param urls: List of existing URLs to be refreshed. The content will be + extracted again and re-indexed. + :type urls: list[str] + :param default_answer: Default answer sent to user if no good match is + found in the KB. + :type default_answer: str + """ + + _validation = { + 'default_answer': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'default_answer': {'key': 'defaultAnswer', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, qna_list=None, urls=None, default_answer: str=None, **kwargs) -> None: + super(UpdateKbContentsDTO, self).__init__(**kwargs) + self.name = name + self.qna_list = qna_list + self.urls = urls + self.default_answer = default_answer + + +class UpdateKbOperationDTO(Model): + """Contains list of QnAs to be updated. + + :param add: An instance of CreateKbInputDTO for add operation + :type add: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateKbOperationDTOAdd + :param delete: An instance of DeleteKbContentsDTO for delete Operation + :type delete: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateKbOperationDTODelete + :param update: An instance of UpdateKbContentsDTO for Update Operation + :type update: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateKbOperationDTOUpdate + :param enable_hierarchical_extraction: 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. + :type enable_hierarchical_extraction: bool + :param default_answer_used_for_extraction: 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. + :type default_answer_used_for_extraction: str + """ + + _validation = { + 'default_answer_used_for_extraction': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'add': {'key': 'add', 'type': 'UpdateKbOperationDTOAdd'}, + 'delete': {'key': 'delete', 'type': 'UpdateKbOperationDTODelete'}, + 'update': {'key': 'update', 'type': 'UpdateKbOperationDTOUpdate'}, + 'enable_hierarchical_extraction': {'key': 'enableHierarchicalExtraction', 'type': 'bool'}, + 'default_answer_used_for_extraction': {'key': 'defaultAnswerUsedForExtraction', 'type': 'str'}, + } + + def __init__(self, *, add=None, delete=None, update=None, enable_hierarchical_extraction: bool=None, default_answer_used_for_extraction: str=None, **kwargs) -> None: + super(UpdateKbOperationDTO, self).__init__(**kwargs) + self.add = add + self.delete = delete + self.update = update + self.enable_hierarchical_extraction = enable_hierarchical_extraction + self.default_answer_used_for_extraction = default_answer_used_for_extraction + + +class UpdateKbOperationDTOAdd(CreateKbInputDTO): + """An instance of CreateKbInputDTO for add operation. + + :param qna_list: List of QNA to be added to the index. Ids are generated + by the service and should be omitted. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + :param urls: List of URLs to be added to knowledgebase. + :type urls: list[str] + :param files: List of files to be added to knowledgebase. + :type files: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.FileDTO] + """ + + _attribute_map = { + 'qna_list': {'key': 'qnaList', 'type': '[QnADTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'files': {'key': 'files', 'type': '[FileDTO]'}, + } + + def __init__(self, *, qna_list=None, urls=None, files=None, **kwargs) -> None: + super(UpdateKbOperationDTOAdd, self).__init__(qna_list=qna_list, urls=urls, files=files, **kwargs) + + +class UpdateKbOperationDTODelete(DeleteKbContentsDTO): + """An instance of DeleteKbContentsDTO for delete Operation. + + :param ids: List of Qna Ids to be deleted + :type ids: list[int] + :param sources: List of sources to be deleted from knowledgebase. + :type sources: list[str] + """ + + _attribute_map = { + 'ids': {'key': 'ids', 'type': '[int]'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__(self, *, ids=None, sources=None, **kwargs) -> None: + super(UpdateKbOperationDTODelete, self).__init__(ids=ids, sources=sources, **kwargs) + + +class UpdateKbOperationDTOUpdate(UpdateKbContentsDTO): + """An instance of UpdateKbContentsDTO for Update Operation. + + :param name: Friendly name for the knowledgebase. + :type name: str + :param qna_list: List of Q-A (UpdateQnaDTO) to be added to the + knowledgebase. + :type qna_list: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTO] + :param urls: List of existing URLs to be refreshed. The content will be + extracted again and re-indexed. + :type urls: list[str] + :param default_answer: Default answer sent to user if no good match is + found in the KB. + :type default_answer: str + """ + + _validation = { + 'default_answer': {'max_length': 300, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'qna_list': {'key': 'qnaList', 'type': '[UpdateQnaDTO]'}, + 'urls': {'key': 'urls', 'type': '[str]'}, + 'default_answer': {'key': 'defaultAnswer', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, qna_list=None, urls=None, default_answer: str=None, **kwargs) -> None: + super(UpdateKbOperationDTOUpdate, self).__init__(name=name, qna_list=qna_list, urls=urls, default_answer=default_answer, **kwargs) + + +class UpdateMetadataDTO(Model): + """PATCH Body schema to represent list of Metadata to be updated. + + :param delete: List of Metadata associated with answer to be deleted + :type delete: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param add: List of metadata associated with answer to be added + :type add: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + """ + + _attribute_map = { + 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, + 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + } + + def __init__(self, *, delete=None, add=None, **kwargs) -> None: + super(UpdateMetadataDTO, self).__init__(**kwargs) + self.delete = delete + self.add = add + + +class UpdateQnaDTO(Model): + """PATCH Body schema for Update Qna List. + + :param id: Unique id for the Q-A + :type id: int + :param answer: Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: List of questions associated with the answer. + :type questions: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTOQuestions + :param metadata: List of metadata associated with the answer to be updated + :type metadata: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTOMetadata + :param context: Context associated with Qna to be updated. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateQnaDTOContext + """ + + _validation = { + 'id': {'maximum': 2147483647, 'minimum': 0}, + 'source': {'max_length': 300}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': 'UpdateQnaDTOQuestions'}, + 'metadata': {'key': 'metadata', 'type': 'UpdateQnaDTOMetadata'}, + 'context': {'key': 'context', 'type': 'UpdateQnaDTOContext'}, + } + + def __init__(self, *, id: int=None, answer: str=None, source: str=None, questions=None, metadata=None, context=None, **kwargs) -> None: + super(UpdateQnaDTO, self).__init__(**kwargs) + self.id = id + self.answer = answer + self.source = source + self.questions = questions + self.metadata = metadata + self.context = context + + +class UpdateQnaDTOContext(UpdateContextDTO): + """Context associated with Qna to be updated. + + :param prompts_to_delete: List of prompts associated with qna to be + deleted + :type prompts_to_delete: list[int] + :param prompts_to_add: List of prompts to be added to the qna. + :type prompts_to_add: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.PromptDTO] + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + """ + + _attribute_map = { + 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, + 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + } + + def __init__(self, *, prompts_to_delete=None, prompts_to_add=None, is_context_only: bool=None, **kwargs) -> None: + super(UpdateQnaDTOContext, self).__init__(prompts_to_delete=prompts_to_delete, prompts_to_add=prompts_to_add, is_context_only=is_context_only, **kwargs) + + +class UpdateQnaDTOMetadata(UpdateMetadataDTO): + """List of metadata associated with the answer to be updated. + + :param delete: List of Metadata associated with answer to be deleted + :type delete: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + :param add: List of metadata associated with answer to be added + :type add: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.MetadataDTO] + """ + + _attribute_map = { + 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, + 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + } + + def __init__(self, *, delete=None, add=None, **kwargs) -> None: + super(UpdateQnaDTOMetadata, self).__init__(delete=delete, add=add, **kwargs) + + +class UpdateQuestionsDTO(Model): + """PATCH Body schema for Update Kb which contains list of questions to be + added and deleted. + + :param add: List of questions to be added + :type add: list[str] + :param delete: List of questions to be deleted. + :type delete: list[str] + """ + + _attribute_map = { + 'add': {'key': 'add', 'type': '[str]'}, + 'delete': {'key': 'delete', 'type': '[str]'}, + } + + def __init__(self, *, add=None, delete=None, **kwargs) -> None: + super(UpdateQuestionsDTO, self).__init__(**kwargs) + self.add = add + self.delete = delete + + +class UpdateQnaDTOQuestions(UpdateQuestionsDTO): + """List of questions associated with the answer. + + :param add: List of questions to be added + :type add: list[str] + :param delete: List of questions to be deleted. + :type delete: list[str] + """ + + _attribute_map = { + 'add': {'key': 'add', 'type': '[str]'}, + 'delete': {'key': 'delete', 'type': '[str]'}, + } + + def __init__(self, *, add=None, delete=None, **kwargs) -> None: + super(UpdateQnaDTOQuestions, self).__init__(add=add, delete=delete, **kwargs) + + +class WordAlterationsDTO(Model): + """Collection of word alterations. + + All required parameters must be populated in order to send to Azure. + + :param word_alterations: Required. Collection of word alterations. + :type word_alterations: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.AlterationsDTO] + """ + + _validation = { + 'word_alterations': {'required': True}, + } + + _attribute_map = { + 'word_alterations': {'key': 'wordAlterations', 'type': '[AlterationsDTO]'}, + } + + def __init__(self, *, word_alterations, **kwargs) -> None: + super(WordAlterationsDTO, self).__init__(**kwargs) + self.word_alterations = word_alterations diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_qn_amaker_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_qn_amaker_client_enums.py new file mode 100644 index 0000000000000..d1a82445bb31d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/models/_qn_amaker_client_enums.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class ErrorCodeType(str, Enum): + + bad_argument = "BadArgument" + forbidden = "Forbidden" + not_found = "NotFound" + kb_not_found = "KbNotFound" + unauthorized = "Unauthorized" + unspecified = "Unspecified" + endpoint_keys_error = "EndpointKeysError" + quota_exceeded = "QuotaExceeded" + qna_runtime_error = "QnaRuntimeError" + sku_limit_exceeded = "SKULimitExceeded" + operation_not_found = "OperationNotFound" + service_error = "ServiceError" + validation_failure = "ValidationFailure" + extraction_failure = "ExtractionFailure" + + +class OperationStateType(str, Enum): + + failed = "Failed" + not_started = "NotStarted" + running = "Running" + succeeded = "Succeeded" + + +class StrictFiltersCompoundOperationType(str, Enum): + + and_enum = "AND" + or_enum = "OR" + + +class EnvironmentType(str, Enum): + + prod = "Prod" + test = "Test" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/__init__.py new file mode 100644 index 0000000000000..ee30edb62607d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._endpoint_settings_operations import EndpointSettingsOperations +from ._endpoint_keys_operations import EndpointKeysOperations +from ._alterations_operations import AlterationsOperations +from ._knowledgebase_operations import KnowledgebaseOperations +from ._operations import Operations +from ._prebuilt_operations import PrebuiltOperations + +__all__ = [ + 'EndpointSettingsOperations', + 'EndpointKeysOperations', + 'AlterationsOperations', + 'KnowledgebaseOperations', + 'Operations', + 'PrebuiltOperations', +] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_alterations_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_alterations_operations.py new file mode 100644 index 0000000000000..db2cc781747b6 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_alterations_operations.py @@ -0,0 +1,242 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class AlterationsOperations(object): + """AlterationsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get( + self, custom_headers=None, raw=False, **operation_config): + """Download alterations from runtime. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: WordAlterationsDTO or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.WordAlterationsDTO + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WordAlterationsDTO', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/alterations'} + + def replace( + self, word_alterations, custom_headers=None, raw=False, **operation_config): + """Replace alterations data. + + :param word_alterations: Collection of word alterations. + :type word_alterations: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.AlterationsDTO] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + word_alterations1 = models.WordAlterationsDTO(word_alterations=word_alterations) + + # Construct URL + url = self.replace.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(word_alterations1, 'WordAlterationsDTO') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + replace.metadata = {'url': '/alterations'} + + def get_alterations_for_kb( + self, kb_id, custom_headers=None, raw=False, **operation_config): + """Download alterations per Knowledgebase (QnAMaker Managed). + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: WordAlterationsDTO or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.WordAlterationsDTO + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_alterations_for_kb.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WordAlterationsDTO', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_alterations_for_kb.metadata = {'url': '/alterations/{kbId}'} + + def replace_alterations_for_kb( + self, kb_id, word_alterations, custom_headers=None, raw=False, **operation_config): + """Replace alterations data per Knowledgebase (QnAMaker Managed). + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param word_alterations: Collection of word alterations. + :type word_alterations: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.AlterationsDTO] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + word_alterations1 = models.WordAlterationsDTO(word_alterations=word_alterations) + + # Construct URL + url = self.replace_alterations_for_kb.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(word_alterations1, 'WordAlterationsDTO') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + replace_alterations_for_kb.metadata = {'url': '/alterations/{kbId}'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_endpoint_keys_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_endpoint_keys_operations.py new file mode 100644 index 0000000000000..63aaf19e9b5f2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_endpoint_keys_operations.py @@ -0,0 +1,139 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class EndpointKeysOperations(object): + """EndpointKeysOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get_keys( + self, custom_headers=None, raw=False, **operation_config): + """Gets endpoint keys for an endpoint. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EndpointKeysDTO or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.EndpointKeysDTO + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_keys.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EndpointKeysDTO', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_keys.metadata = {'url': '/endpointkeys'} + + def refresh_keys( + self, key_type, custom_headers=None, raw=False, **operation_config): + """Re-generates an endpoint key. + + :param key_type: Type of Key + :type key_type: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EndpointKeysDTO or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.EndpointKeysDTO + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.refresh_keys.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'keyType': self._serialize.url("key_type", key_type, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EndpointKeysDTO', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + refresh_keys.metadata = {'url': '/endpointkeys/{keyType}'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_endpoint_settings_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_endpoint_settings_operations.py new file mode 100644 index 0000000000000..bdc20da42568c --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_endpoint_settings_operations.py @@ -0,0 +1,136 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class EndpointSettingsOperations(object): + """EndpointSettingsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get_settings( + self, custom_headers=None, raw=False, **operation_config): + """Gets endpoint settings for an endpoint. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: EndpointSettingsDTO or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.EndpointSettingsDTO + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_settings.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('EndpointSettingsDTO', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_settings.metadata = {'url': '/endpointSettings'} + + def update_settings( + self, active_learning=None, custom_headers=None, raw=False, **operation_config): + """Updates endpoint settings for an endpoint. + + :param active_learning: Active Learning settings of the endpoint. + :type active_learning: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.EndpointSettingsDTOActiveLearning + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + endpoint_settings_payload = models.EndpointSettingsDTO(active_learning=active_learning) + + # Construct URL + url = self.update_settings.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(endpoint_settings_payload, 'EndpointSettingsDTO') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + update_settings.metadata = {'url': '/endpointSettings'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_knowledgebase_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_knowledgebase_operations.py new file mode 100644 index 0000000000000..1a68bdc034dce --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_knowledgebase_operations.py @@ -0,0 +1,585 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class KnowledgebaseOperations(object): + """KnowledgebaseOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def list_all( + self, custom_headers=None, raw=False, **operation_config): + """Gets all knowledgebases for a user. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: KnowledgebasesDTO or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.KnowledgebasesDTO + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_all.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('KnowledgebasesDTO', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_all.metadata = {'url': '/knowledgebases'} + + def get_details( + self, kb_id, custom_headers=None, raw=False, **operation_config): + """Gets details of a specific knowledgebase. + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: KnowledgebaseDTO or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.KnowledgebaseDTO + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_details.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('KnowledgebaseDTO', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_details.metadata = {'url': '/knowledgebases/{kbId}'} + + def delete( + self, kb_id, custom_headers=None, raw=False, **operation_config): + """Deletes the knowledgebase and all its data. + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/knowledgebases/{kbId}'} + + def publish( + self, kb_id, custom_headers=None, raw=False, **operation_config): + """Publishes all changes in test index of a knowledgebase to its prod + index. + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.publish.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + publish.metadata = {'url': '/knowledgebases/{kbId}'} + + def replace( + self, kb_id, qn_alist, custom_headers=None, raw=False, **operation_config): + """Replace knowledgebase contents. + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param qn_alist: List of Q-A (QnADTO) to be added to the + knowledgebase. Q-A Ids are assigned by the service and should be + omitted. + :type qn_alist: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADTO] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + replace_kb = models.ReplaceKbDTO(qn_alist=qn_alist) + + # Construct URL + url = self.replace.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(replace_kb, 'ReplaceKbDTO') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + replace.metadata = {'url': '/knowledgebases/{kbId}'} + + def update( + self, kb_id, update_kb, custom_headers=None, raw=False, **operation_config): + """Asynchronous operation to modify a knowledgebase. + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param update_kb: Post body of the request. + :type update_kb: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.UpdateKbOperationDTO + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Operation or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.Operation + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(update_kb, 'UpdateKbOperationDTO') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise models.ErrorResponseException(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 202: + deserialized = self._deserialize('Operation', response) + header_dict = { + 'Location': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + update.metadata = {'url': '/knowledgebases/{kbId}'} + + def create( + self, create_kb_payload, custom_headers=None, raw=False, **operation_config): + """Asynchronous operation to create a new knowledgebase. + + :param create_kb_payload: Post body of the request. + :type create_kb_payload: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.CreateKbDTO + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Operation or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.Operation + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(create_kb_payload, 'CreateKbDTO') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [202]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 202: + deserialized = self._deserialize('Operation', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/knowledgebases/create'} + + def download( + self, kb_id, environment, source=None, changed_since=None, custom_headers=None, raw=False, **operation_config): + """Download the knowledgebase. + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param environment: Specifies whether environment is Test or Prod. + Possible values include: 'Prod', 'Test' + :type environment: str or + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.EnvironmentType + :param source: The source property filter to apply. + :type source: str + :param changed_since: The last changed status property filter to + apply. + :type changed_since: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: QnADocumentsDTO or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnADocumentsDTO + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.download.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str'), + 'environment': self._serialize.url("environment", environment, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if source is not None: + query_parameters['source'] = self._serialize.query("source", source, 'str') + if changed_since is not None: + query_parameters['changedSince'] = self._serialize.query("changed_since", changed_since, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QnADocumentsDTO', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + download.metadata = {'url': '/knowledgebases/{kbId}/{environment}/qna'} + + def generate_answer( + self, kb_id, generate_answer_payload, custom_headers=None, raw=False, **operation_config): + """GenerateAnswer call to query knowledgebase (QnA Maker Managed). + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param generate_answer_payload: Post body of the request. + :type generate_answer_payload: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QueryDTO + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: QnASearchResultList or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.QnASearchResultList + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.generate_answer.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(generate_answer_payload, 'QueryDTO') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('QnASearchResultList', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + generate_answer.metadata = {'url': '/knowledgebases/{kbId}/generateAnswer'} + + def train( + self, kb_id, feedback_records=None, custom_headers=None, raw=False, **operation_config): + """Train call to add suggestions to knowledgebase (QnAMaker Managed). + + :param kb_id: Knowledgebase id. + :type kb_id: str + :param feedback_records: List of feedback records. + :type feedback_records: + list[~azure.cognitiveservices.knowledge.qnamaker.preview.models.FeedbackRecordDTO] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + train_payload = models.FeedbackRecordsDTO(feedback_records=feedback_records) + + # Construct URL + url = self.train.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'kbId': self._serialize.url("kb_id", kb_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(train_payload, 'FeedbackRecordsDTO') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + train.metadata = {'url': '/knowledgebases/{kbId}/train'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_operations.py new file mode 100644 index 0000000000000..e9166614a2f68 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_operations.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def get_details( + self, operation_id, custom_headers=None, raw=False, **operation_config): + """Gets details of a specific long running operation. + + :param operation_id: Operation id. + :type operation_id: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Operation or ClientRawResponse if raw=true + :rtype: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.Operation + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_details.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True), + 'operationId': self._serialize.url("operation_id", operation_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + header_dict = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Operation', response) + header_dict = { + 'RetryAfter': 'int', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + get_details.metadata = {'url': '/operations/{operationId}'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_prebuilt_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_prebuilt_operations.py new file mode 100644 index 0000000000000..248058a7d4c75 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/operations/_prebuilt_operations.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class PrebuiltOperations(object): + """PrebuiltOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + + self.config = config + + def generate_answer( + self, prebuilt_generate_answer_payload, string_index_type="TextElements_v8", custom_headers=None, raw=False, **operation_config): + """GenerateAnswer call to query text in documents. + + :param prebuilt_generate_answer_payload: Post body of the request. + :type prebuilt_generate_answer_payload: + ~azure.cognitiveservices.knowledge.qnamaker.preview.models.PrebuiltQuery + :param string_index_type: (Optional) Specifies the method used to + interpret string offsets. Defaults to Text Elements (Graphemes) + according to Unicode v8.0.0. Possible values include: + 'TextElements_v8', 'UnicodeCodePoint', 'Utf16CodeUnit' + :type string_index_type: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: object or ClientRawResponse if raw=true + :rtype: object or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.generate_answer.metadata['url'] + path_format_arguments = { + 'Endpoint': self._serialize.url("self.config.endpoint", self.config.endpoint, 'str', skip_quote=True) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if string_index_type is not None: + query_parameters['stringIndexType'] = self._serialize.query("string_index_type", string_index_type, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if custom_headers: + header_parameters.update(custom_headers) + + # Construct body + body_content = self._serialize.body(prebuilt_generate_answer_payload, 'PrebuiltQuery') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('object', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + generate_answer.metadata = {'url': '/generateAnswer'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/active_learning_settings_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/version.py similarity index 50% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/active_learning_settings_dto_py3.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/version.py index ab33348de262e..aa08d9904ce11 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/authoring/models/active_learning_settings_dto_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/preview/version.py @@ -9,20 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +VERSION = "v5.0-preview.2" - -class ActiveLearningSettingsDTO(Model): - """Active Learning settings of the endpoint. - - :param enable: True/False string providing Active Learning - :type enable: str - """ - - _attribute_map = { - 'enable': {'key': 'enable', 'type': 'str'}, - } - - def __init__(self, *, enable: str=None, **kwargs) -> None: - super(ActiveLearningSettingsDTO, self).__init__(**kwargs) - self.enable = enable diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/__init__.py index d7ead4eb95b05..f283c224f42cf 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/__init__.py @@ -9,10 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from .qn_amaker_runtime_client import QnAMakerRuntimeClient -from .version import VERSION +from ._configuration import QnAMakerRuntimeClientConfiguration +from ._qn_amaker_runtime_client import QnAMakerRuntimeClient +__all__ = ['QnAMakerRuntimeClient', 'QnAMakerRuntimeClientConfiguration'] -__all__ = ['QnAMakerRuntimeClient'] +from .version import VERSION __version__ = VERSION diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/_configuration.py new file mode 100644 index 0000000000000..57d958a26600b --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/_configuration.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest import Configuration + +from .version import VERSION + + +class QnAMakerRuntimeClientConfiguration(Configuration): + """Configuration for QnAMakerRuntimeClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param runtime_endpoint: QnA Maker App Service endpoint (for example: + https://{qnaservice-hostname}.azurewebsites.net). + :type runtime_endpoint: str + :param credentials: Subscription credentials which uniquely identify + client subscription. + :type credentials: None + """ + + def __init__( + self, runtime_endpoint, credentials): + + if runtime_endpoint is None: + raise ValueError("Parameter 'runtime_endpoint' must not be None.") + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + base_url = '{RuntimeEndpoint}/qnamaker' + + super(QnAMakerRuntimeClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-cognitiveservices-knowledge-qnamaker/{}'.format(VERSION)) + + self.runtime_endpoint = runtime_endpoint + self.credentials = credentials diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/qn_amaker_runtime_client.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/_qn_amaker_runtime_client.py similarity index 58% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/qn_amaker_runtime_client.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/_qn_amaker_runtime_client.py index 81acd86f0d79c..6aea45d358c7e 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/qn_amaker_runtime_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/_qn_amaker_runtime_client.py @@ -10,40 +10,11 @@ # -------------------------------------------------------------------------- from msrest.service_client import SDKClient -from msrest import Configuration, Serializer, Deserializer -from .version import VERSION -from .operations.runtime_operations import RuntimeOperations -from . import models - - -class QnAMakerRuntimeClientConfiguration(Configuration): - """Configuration for QnAMakerRuntimeClient - Note that all parameters used to create this instance are saved as instance - attributes. - - :param runtime_endpoint: QnA Maker App Service endpoint (for example: - https://{qnaservice-hostname}.azurewebsites.net). - :type runtime_endpoint: str - :param credentials: Subscription credentials which uniquely identify - client subscription. - :type credentials: None - """ - - def __init__( - self, runtime_endpoint, credentials): +from msrest import Serializer, Deserializer - if runtime_endpoint is None: - raise ValueError("Parameter 'runtime_endpoint' must not be None.") - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - base_url = '{RuntimeEndpoint}/qnamaker' - - super(QnAMakerRuntimeClientConfiguration, self).__init__(base_url) - - self.add_user_agent('azure-cognitiveservices-knowledge-qnamaker/{}'.format(VERSION)) - - self.runtime_endpoint = runtime_endpoint - self.credentials = credentials +from ._configuration import QnAMakerRuntimeClientConfiguration +from .operations import RuntimeOperations +from . import models class QnAMakerRuntimeClient(SDKClient): diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/__init__.py index eabcdb80fb07f..b13daacf93cc5 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/__init__.py @@ -10,65 +10,67 @@ # -------------------------------------------------------------------------- try: - from .metadata_dto_py3 import MetadataDTO - from .qn_adto_context_py3 import QnADTOContext - from .qn_adto_py3 import QnADTO - from .prompt_dto_qna_py3 import PromptDTOQna - from .prompt_dto_py3 import PromptDTO - from .context_dto_py3 import ContextDTO - from .error_response_error_py3 import ErrorResponseError - from .error_response_py3 import ErrorResponse, ErrorResponseException - from .inner_error_model_py3 import InnerErrorModel - from .error_py3 import Error - from .query_dto_context_py3 import QueryDTOContext - from .query_dto_py3 import QueryDTO - from .query_context_dto_py3 import QueryContextDTO - from .qn_asearch_result_context_py3 import QnASearchResultContext - from .qn_asearch_result_py3 import QnASearchResult - from .qn_asearch_result_list_py3 import QnASearchResultList - from .feedback_record_dto_py3 import FeedbackRecordDTO - from .feedback_records_dto_py3 import FeedbackRecordsDTO + from ._models_py3 import ContextDTO + from ._models_py3 import Error + from ._models_py3 import ErrorResponse, ErrorResponseException + from ._models_py3 import ErrorResponseError + from ._models_py3 import FeedbackRecordDTO + from ._models_py3 import FeedbackRecordsDTO + from ._models_py3 import InnerErrorModel + from ._models_py3 import MetadataDTO + from ._models_py3 import PromptDTO + from ._models_py3 import PromptDTOQna + from ._models_py3 import QnADTO + from ._models_py3 import QnADTOContext + from ._models_py3 import QnASearchResult + from ._models_py3 import QnASearchResultContext + from ._models_py3 import QnASearchResultList + from ._models_py3 import QueryContextDTO + from ._models_py3 import QueryDTO + from ._models_py3 import QueryDTOContext except (SyntaxError, ImportError): - from .metadata_dto import MetadataDTO - from .qn_adto_context import QnADTOContext - from .qn_adto import QnADTO - from .prompt_dto_qna import PromptDTOQna - from .prompt_dto import PromptDTO - from .context_dto import ContextDTO - from .error_response_error import ErrorResponseError - from .error_response import ErrorResponse, ErrorResponseException - from .inner_error_model import InnerErrorModel - from .error import Error - from .query_dto_context import QueryDTOContext - from .query_dto import QueryDTO - from .query_context_dto import QueryContextDTO - from .qn_asearch_result_context import QnASearchResultContext - from .qn_asearch_result import QnASearchResult - from .qn_asearch_result_list import QnASearchResultList - from .feedback_record_dto import FeedbackRecordDTO - from .feedback_records_dto import FeedbackRecordsDTO -from .qn_amaker_runtime_client_enums import ( + from ._models import ContextDTO + from ._models import Error + from ._models import ErrorResponse, ErrorResponseException + from ._models import ErrorResponseError + from ._models import FeedbackRecordDTO + from ._models import FeedbackRecordsDTO + from ._models import InnerErrorModel + from ._models import MetadataDTO + from ._models import PromptDTO + from ._models import PromptDTOQna + from ._models import QnADTO + from ._models import QnADTOContext + from ._models import QnASearchResult + from ._models import QnASearchResultContext + from ._models import QnASearchResultList + from ._models import QueryContextDTO + from ._models import QueryDTO + from ._models import QueryDTOContext +from ._qn_amaker_runtime_client_enums import ( ErrorCodeType, + StrictFiltersCompoundOperationType, ) __all__ = [ - 'MetadataDTO', - 'QnADTOContext', - 'QnADTO', - 'PromptDTOQna', - 'PromptDTO', 'ContextDTO', - 'ErrorResponseError', + 'Error', 'ErrorResponse', 'ErrorResponseException', + 'ErrorResponseError', + 'FeedbackRecordDTO', + 'FeedbackRecordsDTO', 'InnerErrorModel', - 'Error', - 'QueryDTOContext', - 'QueryDTO', - 'QueryContextDTO', - 'QnASearchResultContext', + 'MetadataDTO', + 'PromptDTO', + 'PromptDTOQna', + 'QnADTO', + 'QnADTOContext', 'QnASearchResult', + 'QnASearchResultContext', 'QnASearchResultList', - 'FeedbackRecordDTO', - 'FeedbackRecordsDTO', + 'QueryContextDTO', + 'QueryDTO', + 'QueryDTOContext', 'ErrorCodeType', + 'StrictFiltersCompoundOperationType', ] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models.py new file mode 100644 index 0000000000000..e91d24c7835c1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models.py @@ -0,0 +1,600 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ContextDTO(Model): + """Context associated with Qna. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, **kwargs): + super(ContextDTO, self).__init__(**kwargs) + self.is_context_only = kwargs.get('is_context_only', None) + self.prompts = kwargs.get('prompts', None) + + +class Error(Model): + """The error object. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + self.inner_error = kwargs.get('inner_error', None) + + +class ErrorResponse(Model): + """Error response. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param error: The error object. + :type error: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__(self, **kwargs): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ErrorResponseError(Error): + """The error object. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, **kwargs): + super(ErrorResponseError, self).__init__(**kwargs) + + +class FeedbackRecordDTO(Model): + """Active learning feedback record. + + :param user_id: Unique identifier for the user. + :type user_id: str + :param user_question: The suggested question being provided as feedback. + :type user_question: str + :param qna_id: The qnaId for which the suggested question is provided as + feedback. + :type qna_id: int + """ + + _validation = { + 'user_question': {'max_length': 1000}, + } + + _attribute_map = { + 'user_id': {'key': 'userId', 'type': 'str'}, + 'user_question': {'key': 'userQuestion', 'type': 'str'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(FeedbackRecordDTO, self).__init__(**kwargs) + self.user_id = kwargs.get('user_id', None) + self.user_question = kwargs.get('user_question', None) + self.qna_id = kwargs.get('qna_id', None) + + +class FeedbackRecordsDTO(Model): + """Active learning feedback records. + + :param feedback_records: List of feedback records. + :type feedback_records: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.FeedbackRecordDTO] + """ + + _attribute_map = { + 'feedback_records': {'key': 'feedbackRecords', 'type': '[FeedbackRecordDTO]'}, + } + + def __init__(self, **kwargs): + super(FeedbackRecordsDTO, self).__init__(**kwargs) + self.feedback_records = kwargs.get('feedback_records', None) + + +class InnerErrorModel(Model): + """An object containing more specific information about the error. As per + Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param code: A more specific error code than was provided by the + containing error. + :type code: str + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, **kwargs): + super(InnerErrorModel, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.inner_error = kwargs.get('inner_error', None) + + +class MetadataDTO(Model): + """Name - value pair of metadata. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Metadata name. + :type name: str + :param value: Required. Metadata value. + :type value: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'value': {'required': True, 'max_length': 500, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MetadataDTO, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class PromptDTO(Model): + """Prompt for an answer. + + :param display_order: Index of the prompt - used in ordering of the + prompts + :type display_order: int + :param qna_id: Qna id corresponding to the prompt - if QnaId is present, + QnADTO object is ignored. + :type qna_id: int + :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a + PromptDTO object + :type qna: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTOQna + :param display_text: Text displayed to represent a follow up question + prompt + :type display_text: str + """ + + _validation = { + 'display_text': {'max_length': 200}, + } + + _attribute_map = { + 'display_order': {'key': 'displayOrder', 'type': 'int'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, + 'display_text': {'key': 'displayText', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PromptDTO, self).__init__(**kwargs) + self.display_order = kwargs.get('display_order', None) + self.qna_id = kwargs.get('qna_id', None) + self.qna = kwargs.get('qna', None) + self.display_text = kwargs.get('display_text', None) + + +class QnADTO(Model): + """Q-A object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnADTOContext + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + } + + def __init__(self, **kwargs): + super(QnADTO, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.answer = kwargs.get('answer', None) + self.source = kwargs.get('source', None) + self.questions = kwargs.get('questions', None) + self.metadata = kwargs.get('metadata', None) + self.context = kwargs.get('context', None) + + +class PromptDTOQna(QnADTO): + """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnADTOContext + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + } + + def __init__(self, **kwargs): + super(PromptDTOQna, self).__init__(**kwargs) + + +class QnADTOContext(ContextDTO): + """Context of a QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, **kwargs): + super(QnADTOContext, self).__init__(**kwargs) + + +class QnASearchResult(Model): + """Represents Search Result. + + :param questions: List of questions. + :type questions: list[str] + :param answer: Answer. + :type answer: str + :param score: Search result score. + :type score: float + :param id: Id of the QnA result. + :type id: int + :param source: Source of QnA result. + :type source: str + :param metadata: List of metadata. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] + :param context: Context object of the QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnASearchResultContext + """ + + _attribute_map = { + 'questions': {'key': 'questions', 'type': '[str]'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'id': {'key': 'id', 'type': 'int'}, + 'source': {'key': 'source', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnASearchResultContext'}, + } + + def __init__(self, **kwargs): + super(QnASearchResult, self).__init__(**kwargs) + self.questions = kwargs.get('questions', None) + self.answer = kwargs.get('answer', None) + self.score = kwargs.get('score', None) + self.id = kwargs.get('id', None) + self.source = kwargs.get('source', None) + self.metadata = kwargs.get('metadata', None) + self.context = kwargs.get('context', None) + + +class QnASearchResultContext(ContextDTO): + """Context object of the QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, **kwargs): + super(QnASearchResultContext, self).__init__(**kwargs) + + +class QnASearchResultList(Model): + """Represents List of Question Answers. + + :param answers: Represents Search Result list. + :type answers: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnASearchResult] + """ + + _attribute_map = { + 'answers': {'key': 'answers', 'type': '[QnASearchResult]'}, + } + + def __init__(self, **kwargs): + super(QnASearchResultList, self).__init__(**kwargs) + self.answers = kwargs.get('answers', None) + + +class QueryContextDTO(Model): + """Context object with previous QnA's information. + + :param previous_qna_id: Previous QnA Id - qnaId of the top result. + :type previous_qna_id: str + :param previous_user_query: Previous user query. + :type previous_user_query: str + """ + + _attribute_map = { + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(QueryContextDTO, self).__init__(**kwargs) + self.previous_qna_id = kwargs.get('previous_qna_id', None) + self.previous_user_query = kwargs.get('previous_user_query', None) + + +class QueryDTO(Model): + """POST body schema to query the knowledgebase. + + :param qna_id: Exact qnaId to fetch from the knowledgebase, this field + takes priority over question. + :type qna_id: str + :param question: User question to query against the knowledge base. + :type question: str + :param top: Max number of answers to be returned for the question. + :type top: int + :param user_id: Unique identifier for the user. Optional parameter for + telemetry. For more information, refer Analytics and Telemetry. + :type user_id: str + :param is_test: Query against the test index. + :type is_test: bool + :param score_threshold: Threshold for answers returned based on score. + :type score_threshold: float + :param context: Context object with previous QnA's information. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QueryDTOContext + :param ranker_type: Optional field. Set to 'QuestionOnly' for using a + question only Ranker. + :type ranker_type: str + :param strict_filters: Find only answers that contain these metadata. + :type strict_filters: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] + :param strict_filters_compound_operation_type: Optional field. Set to OR + for using OR as Operation for Strict Filters. Possible values include: + 'AND', 'OR' + :type strict_filters_compound_operation_type: str or + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.StrictFiltersCompoundOperationType + """ + + _attribute_map = { + 'qna_id': {'key': 'qnaId', 'type': 'str'}, + 'question': {'key': 'question', 'type': 'str'}, + 'top': {'key': 'top', 'type': 'int'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'is_test': {'key': 'isTest', 'type': 'bool'}, + 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, + 'context': {'key': 'context', 'type': 'QueryDTOContext'}, + 'ranker_type': {'key': 'rankerType', 'type': 'str'}, + 'strict_filters': {'key': 'strictFilters', 'type': '[MetadataDTO]'}, + 'strict_filters_compound_operation_type': {'key': 'strictFiltersCompoundOperationType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(QueryDTO, self).__init__(**kwargs) + self.qna_id = kwargs.get('qna_id', None) + self.question = kwargs.get('question', None) + self.top = kwargs.get('top', None) + self.user_id = kwargs.get('user_id', None) + self.is_test = kwargs.get('is_test', None) + self.score_threshold = kwargs.get('score_threshold', None) + self.context = kwargs.get('context', None) + self.ranker_type = kwargs.get('ranker_type', None) + self.strict_filters = kwargs.get('strict_filters', None) + self.strict_filters_compound_operation_type = kwargs.get('strict_filters_compound_operation_type', None) + + +class QueryDTOContext(QueryContextDTO): + """Context object with previous QnA's information. + + :param previous_qna_id: Previous QnA Id - qnaId of the top result. + :type previous_qna_id: str + :param previous_user_query: Previous user query. + :type previous_user_query: str + """ + + _attribute_map = { + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(QueryDTOContext, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models_py3.py new file mode 100644 index 0000000000000..05e8778398859 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models_py3.py @@ -0,0 +1,600 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class ContextDTO(Model): + """Context associated with Qna. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: + super(ContextDTO, self).__init__(**kwargs) + self.is_context_only = is_context_only + self.prompts = prompts + + +class Error(Model): + """The error object. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + self.inner_error = inner_error + + +class ErrorResponse(Model): + """Error response. As per Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param error: The error object. + :type error: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorResponseError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorResponseError'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ErrorResponseException(HttpOperationError): + """Server responsed with exception of type: 'ErrorResponse'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) + + +class ErrorResponseError(Error): + """The error object. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. 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' + :type code: str or + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorCodeType + :param message: A human-readable representation of the error. + :type message: str + :param target: The target of the error. + :type target: str + :param details: An array of details about specific errors that led to this + reported error. + :type details: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.Error] + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel + """ + + _validation = { + 'code': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[Error]'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: + super(ErrorResponseError, self).__init__(code=code, message=message, target=target, details=details, inner_error=inner_error, **kwargs) + + +class FeedbackRecordDTO(Model): + """Active learning feedback record. + + :param user_id: Unique identifier for the user. + :type user_id: str + :param user_question: The suggested question being provided as feedback. + :type user_question: str + :param qna_id: The qnaId for which the suggested question is provided as + feedback. + :type qna_id: int + """ + + _validation = { + 'user_question': {'max_length': 1000}, + } + + _attribute_map = { + 'user_id': {'key': 'userId', 'type': 'str'}, + 'user_question': {'key': 'userQuestion', 'type': 'str'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + } + + def __init__(self, *, user_id: str=None, user_question: str=None, qna_id: int=None, **kwargs) -> None: + super(FeedbackRecordDTO, self).__init__(**kwargs) + self.user_id = user_id + self.user_question = user_question + self.qna_id = qna_id + + +class FeedbackRecordsDTO(Model): + """Active learning feedback records. + + :param feedback_records: List of feedback records. + :type feedback_records: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.FeedbackRecordDTO] + """ + + _attribute_map = { + 'feedback_records': {'key': 'feedbackRecords', 'type': '[FeedbackRecordDTO]'}, + } + + def __init__(self, *, feedback_records=None, **kwargs) -> None: + super(FeedbackRecordsDTO, self).__init__(**kwargs) + self.feedback_records = feedback_records + + +class InnerErrorModel(Model): + """An object containing more specific information about the error. As per + Microsoft One API guidelines - + https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + + :param code: A more specific error code than was provided by the + containing error. + :type code: str + :param inner_error: An object containing more specific information than + the current object about the error. + :type inner_error: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, + } + + def __init__(self, *, code: str=None, inner_error=None, **kwargs) -> None: + super(InnerErrorModel, self).__init__(**kwargs) + self.code = code + self.inner_error = inner_error + + +class MetadataDTO(Model): + """Name - value pair of metadata. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Metadata name. + :type name: str + :param value: Required. Metadata value. + :type value: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 100, 'min_length': 1}, + 'value': {'required': True, 'max_length': 500, 'min_length': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str, value: str, **kwargs) -> None: + super(MetadataDTO, self).__init__(**kwargs) + self.name = name + self.value = value + + +class PromptDTO(Model): + """Prompt for an answer. + + :param display_order: Index of the prompt - used in ordering of the + prompts + :type display_order: int + :param qna_id: Qna id corresponding to the prompt - if QnaId is present, + QnADTO object is ignored. + :type qna_id: int + :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a + PromptDTO object + :type qna: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTOQna + :param display_text: Text displayed to represent a follow up question + prompt + :type display_text: str + """ + + _validation = { + 'display_text': {'max_length': 200}, + } + + _attribute_map = { + 'display_order': {'key': 'displayOrder', 'type': 'int'}, + 'qna_id': {'key': 'qnaId', 'type': 'int'}, + 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, + 'display_text': {'key': 'displayText', 'type': 'str'}, + } + + def __init__(self, *, display_order: int=None, qna_id: int=None, qna=None, display_text: str=None, **kwargs) -> None: + super(PromptDTO, self).__init__(**kwargs) + self.display_order = display_order + self.qna_id = qna_id + self.qna = qna + self.display_text = display_text + + +class QnADTO(Model): + """Q-A object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnADTOContext + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + } + + def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: + super(QnADTO, self).__init__(**kwargs) + self.id = id + self.answer = answer + self.source = source + self.questions = questions + self.metadata = metadata + self.context = context + + +class PromptDTOQna(QnADTO): + """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. + + All required parameters must be populated in order to send to Azure. + + :param id: Unique id for the Q-A. + :type id: int + :param answer: Required. Answer text + :type answer: str + :param source: Source from which Q-A was indexed. eg. + https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :type source: str + :param questions: Required. List of questions associated with the answer. + :type questions: list[str] + :param metadata: List of metadata associated with the answer. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnADTOContext + """ + + _validation = { + 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, + 'source': {'max_length': 300}, + 'questions': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'questions': {'key': 'questions', 'type': '[str]'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, + } + + def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: + super(PromptDTOQna, self).__init__(id=id, answer=answer, source=source, questions=questions, metadata=metadata, context=context, **kwargs) + + +class QnADTOContext(ContextDTO): + """Context of a QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: + super(QnADTOContext, self).__init__(is_context_only=is_context_only, prompts=prompts, **kwargs) + + +class QnASearchResult(Model): + """Represents Search Result. + + :param questions: List of questions. + :type questions: list[str] + :param answer: Answer. + :type answer: str + :param score: Search result score. + :type score: float + :param id: Id of the QnA result. + :type id: int + :param source: Source of QnA result. + :type source: str + :param metadata: List of metadata. + :type metadata: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] + :param context: Context object of the QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnASearchResultContext + """ + + _attribute_map = { + 'questions': {'key': 'questions', 'type': '[str]'}, + 'answer': {'key': 'answer', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'id': {'key': 'id', 'type': 'int'}, + 'source': {'key': 'source', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnASearchResultContext'}, + } + + def __init__(self, *, questions=None, answer: str=None, score: float=None, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: + super(QnASearchResult, self).__init__(**kwargs) + self.questions = questions + self.answer = answer + self.score = score + self.id = id + self.source = source + self.metadata = metadata + self.context = context + + +class QnASearchResultContext(ContextDTO): + """Context object of the QnA. + + :param is_context_only: To mark if a prompt is relevant only with a + previous question or not. + true - Do not include this QnA as search result for queries without + context + false - ignores context and includes this QnA in search result + :type is_context_only: bool + :param prompts: List of prompts associated with the answer. + :type prompts: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] + """ + + _validation = { + 'prompts': {'max_items': 20}, + } + + _attribute_map = { + 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, + } + + def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: + super(QnASearchResultContext, self).__init__(is_context_only=is_context_only, prompts=prompts, **kwargs) + + +class QnASearchResultList(Model): + """Represents List of Question Answers. + + :param answers: Represents Search Result list. + :type answers: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnASearchResult] + """ + + _attribute_map = { + 'answers': {'key': 'answers', 'type': '[QnASearchResult]'}, + } + + def __init__(self, *, answers=None, **kwargs) -> None: + super(QnASearchResultList, self).__init__(**kwargs) + self.answers = answers + + +class QueryContextDTO(Model): + """Context object with previous QnA's information. + + :param previous_qna_id: Previous QnA Id - qnaId of the top result. + :type previous_qna_id: str + :param previous_user_query: Previous user query. + :type previous_user_query: str + """ + + _attribute_map = { + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, + } + + def __init__(self, *, previous_qna_id: str=None, previous_user_query: str=None, **kwargs) -> None: + super(QueryContextDTO, self).__init__(**kwargs) + self.previous_qna_id = previous_qna_id + self.previous_user_query = previous_user_query + + +class QueryDTO(Model): + """POST body schema to query the knowledgebase. + + :param qna_id: Exact qnaId to fetch from the knowledgebase, this field + takes priority over question. + :type qna_id: str + :param question: User question to query against the knowledge base. + :type question: str + :param top: Max number of answers to be returned for the question. + :type top: int + :param user_id: Unique identifier for the user. Optional parameter for + telemetry. For more information, refer Analytics and Telemetry. + :type user_id: str + :param is_test: Query against the test index. + :type is_test: bool + :param score_threshold: Threshold for answers returned based on score. + :type score_threshold: float + :param context: Context object with previous QnA's information. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QueryDTOContext + :param ranker_type: Optional field. Set to 'QuestionOnly' for using a + question only Ranker. + :type ranker_type: str + :param strict_filters: Find only answers that contain these metadata. + :type strict_filters: + list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] + :param strict_filters_compound_operation_type: Optional field. Set to OR + for using OR as Operation for Strict Filters. Possible values include: + 'AND', 'OR' + :type strict_filters_compound_operation_type: str or + ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.StrictFiltersCompoundOperationType + """ + + _attribute_map = { + 'qna_id': {'key': 'qnaId', 'type': 'str'}, + 'question': {'key': 'question', 'type': 'str'}, + 'top': {'key': 'top', 'type': 'int'}, + 'user_id': {'key': 'userId', 'type': 'str'}, + 'is_test': {'key': 'isTest', 'type': 'bool'}, + 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, + 'context': {'key': 'context', 'type': 'QueryDTOContext'}, + 'ranker_type': {'key': 'rankerType', 'type': 'str'}, + 'strict_filters': {'key': 'strictFilters', 'type': '[MetadataDTO]'}, + 'strict_filters_compound_operation_type': {'key': 'strictFiltersCompoundOperationType', 'type': 'str'}, + } + + def __init__(self, *, qna_id: str=None, question: str=None, top: int=None, user_id: str=None, is_test: bool=None, score_threshold: float=None, context=None, ranker_type: str=None, strict_filters=None, strict_filters_compound_operation_type=None, **kwargs) -> None: + super(QueryDTO, self).__init__(**kwargs) + self.qna_id = qna_id + self.question = question + self.top = top + self.user_id = user_id + self.is_test = is_test + self.score_threshold = score_threshold + self.context = context + self.ranker_type = ranker_type + self.strict_filters = strict_filters + self.strict_filters_compound_operation_type = strict_filters_compound_operation_type + + +class QueryDTOContext(QueryContextDTO): + """Context object with previous QnA's information. + + :param previous_qna_id: Previous QnA Id - qnaId of the top result. + :type previous_qna_id: str + :param previous_user_query: Previous user query. + :type previous_user_query: str + """ + + _attribute_map = { + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, + } + + def __init__(self, *, previous_qna_id: str=None, previous_user_query: str=None, **kwargs) -> None: + super(QueryDTOContext, self).__init__(previous_qna_id=previous_qna_id, previous_user_query=previous_user_query, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_amaker_runtime_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_qn_amaker_runtime_client_enums.py similarity index 91% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_amaker_runtime_client_enums.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_qn_amaker_runtime_client_enums.py index c523cb2902313..4ef7a9d17c482 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_amaker_runtime_client_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_qn_amaker_runtime_client_enums.py @@ -28,3 +28,9 @@ class ErrorCodeType(str, Enum): service_error = "ServiceError" validation_failure = "ValidationFailure" extraction_failure = "ExtractionFailure" + + +class StrictFiltersCompoundOperationType(str, Enum): + + and_enum = "AND" + or_enum = "OR" diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/context_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/context_dto.py deleted file mode 100644 index ec7fafc1a1824..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/context_dto.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ContextDTO(Model): - """Context associated with Qna. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, **kwargs): - super(ContextDTO, self).__init__(**kwargs) - self.is_context_only = kwargs.get('is_context_only', None) - self.prompts = kwargs.get('prompts', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/context_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/context_dto_py3.py deleted file mode 100644 index 2dea33bb90880..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/context_dto_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class ContextDTO(Model): - """Context associated with Qna. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: - super(ContextDTO, self).__init__(**kwargs) - self.is_context_only = is_context_only - self.prompts = prompts diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error.py deleted file mode 100644 index 34b0fec20c982..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Error(Model): - """The error object. As per Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. 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' - :type code: str or - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorCodeType - :param message: A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this - reported error. - :type details: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.Error] - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel - """ - - _validation = { - 'code': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, **kwargs): - super(Error, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - self.inner_error = kwargs.get('inner_error', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_py3.py deleted file mode 100644 index c8924c169865e..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_py3.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class Error(Model): - """The error object. As per Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. 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' - :type code: str or - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorCodeType - :param message: A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this - reported error. - :type details: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.Error] - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel - """ - - _validation = { - 'code': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: - super(Error, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - self.inner_error = inner_error diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response.py deleted file mode 100644 index 528a75681f842..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError - - -class ErrorResponse(Model): - """Error response. As per Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - :param error: The error object. - :type error: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorResponseError - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, - } - - def __init__(self, **kwargs): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_error.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_error.py deleted file mode 100644 index 3a5da8c5163ae..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_error.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .error import Error - - -class ErrorResponseError(Error): - """The error object. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. 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' - :type code: str or - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorCodeType - :param message: A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this - reported error. - :type details: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.Error] - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel - """ - - _validation = { - 'code': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, **kwargs): - super(ErrorResponseError, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_error_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_error_py3.py deleted file mode 100644 index 3a2560b88e62b..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_error_py3.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .error_py3 import Error - - -class ErrorResponseError(Error): - """The error object. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. 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' - :type code: str or - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorCodeType - :param message: A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this - reported error. - :type details: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.Error] - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel - """ - - _validation = { - 'code': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, *, code, message: str=None, target: str=None, details=None, inner_error=None, **kwargs) -> None: - super(ErrorResponseError, self).__init__(code=code, message=message, target=target, details=details, inner_error=inner_error, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_py3.py deleted file mode 100644 index 8f890e423869a..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/error_response_py3.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError - - -class ErrorResponse(Model): - """Error response. As per Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - :param error: The error object. - :type error: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.ErrorResponseError - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseError'}, - } - - def __init__(self, *, error=None, **kwargs) -> None: - super(ErrorResponse, self).__init__(**kwargs) - self.error = error - - -class ErrorResponseException(HttpOperationError): - """Server responsed with exception of type: 'ErrorResponse'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorResponseException, self).__init__(deserialize, response, 'ErrorResponse', *args) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_record_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_record_dto.py deleted file mode 100644 index ed2a7142a20b4..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_record_dto.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class FeedbackRecordDTO(Model): - """Active learning feedback record. - - :param user_id: Unique identifier for the user. - :type user_id: str - :param user_question: The suggested question being provided as feedback. - :type user_question: str - :param qna_id: The qnaId for which the suggested question is provided as - feedback. - :type qna_id: int - """ - - _validation = { - 'user_question': {'max_length': 1000}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'user_question': {'key': 'userQuestion', 'type': 'str'}, - 'qna_id': {'key': 'qnaId', 'type': 'int'}, - } - - def __init__(self, **kwargs): - super(FeedbackRecordDTO, self).__init__(**kwargs) - self.user_id = kwargs.get('user_id', None) - self.user_question = kwargs.get('user_question', None) - self.qna_id = kwargs.get('qna_id', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_record_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_record_dto_py3.py deleted file mode 100644 index 7b06ed84a63fe..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_record_dto_py3.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class FeedbackRecordDTO(Model): - """Active learning feedback record. - - :param user_id: Unique identifier for the user. - :type user_id: str - :param user_question: The suggested question being provided as feedback. - :type user_question: str - :param qna_id: The qnaId for which the suggested question is provided as - feedback. - :type qna_id: int - """ - - _validation = { - 'user_question': {'max_length': 1000}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'user_question': {'key': 'userQuestion', 'type': 'str'}, - 'qna_id': {'key': 'qnaId', 'type': 'int'}, - } - - def __init__(self, *, user_id: str=None, user_question: str=None, qna_id: int=None, **kwargs) -> None: - super(FeedbackRecordDTO, self).__init__(**kwargs) - self.user_id = user_id - self.user_question = user_question - self.qna_id = qna_id diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_records_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_records_dto.py deleted file mode 100644 index 62fd82c1bc4b2..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_records_dto.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class FeedbackRecordsDTO(Model): - """Active learning feedback records. - - :param feedback_records: List of feedback records. - :type feedback_records: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.FeedbackRecordDTO] - """ - - _attribute_map = { - 'feedback_records': {'key': 'feedbackRecords', 'type': '[FeedbackRecordDTO]'}, - } - - def __init__(self, **kwargs): - super(FeedbackRecordsDTO, self).__init__(**kwargs) - self.feedback_records = kwargs.get('feedback_records', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_records_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_records_dto_py3.py deleted file mode 100644 index 0c1ab0a961ad3..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/feedback_records_dto_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class FeedbackRecordsDTO(Model): - """Active learning feedback records. - - :param feedback_records: List of feedback records. - :type feedback_records: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.FeedbackRecordDTO] - """ - - _attribute_map = { - 'feedback_records': {'key': 'feedbackRecords', 'type': '[FeedbackRecordDTO]'}, - } - - def __init__(self, *, feedback_records=None, **kwargs) -> None: - super(FeedbackRecordsDTO, self).__init__(**kwargs) - self.feedback_records = feedback_records diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/inner_error_model.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/inner_error_model.py deleted file mode 100644 index ba0c00c463ac7..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/inner_error_model.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class InnerErrorModel(Model): - """An object containing more specific information about the error. As per - Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - :param code: A more specific error code than was provided by the - containing error. - :type code: str - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, **kwargs): - super(InnerErrorModel, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.inner_error = kwargs.get('inner_error', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/inner_error_model_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/inner_error_model_py3.py deleted file mode 100644 index 4b3fbbcf4db4c..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/inner_error_model_py3.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class InnerErrorModel(Model): - """An object containing more specific information about the error. As per - Microsoft One API guidelines - - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. - - :param code: A more specific error code than was provided by the - containing error. - :type code: str - :param inner_error: An object containing more specific information than - the current object about the error. - :type inner_error: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.InnerErrorModel - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'inner_error': {'key': 'innerError', 'type': 'InnerErrorModel'}, - } - - def __init__(self, *, code: str=None, inner_error=None, **kwargs) -> None: - super(InnerErrorModel, self).__init__(**kwargs) - self.code = code - self.inner_error = inner_error diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/metadata_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/metadata_dto.py deleted file mode 100644 index ad81d7a694a1d..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/metadata_dto.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class MetadataDTO(Model): - """Name - value pair of metadata. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Metadata name. - :type name: str - :param value: Required. Metadata value. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 100, 'min_length': 1}, - 'value': {'required': True, 'max_length': 500, 'min_length': 1}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(MetadataDTO, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.value = kwargs.get('value', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/metadata_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/metadata_dto_py3.py deleted file mode 100644 index da4c1d010f8c4..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/metadata_dto_py3.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class MetadataDTO(Model): - """Name - value pair of metadata. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Metadata name. - :type name: str - :param value: Required. Metadata value. - :type value: str - """ - - _validation = { - 'name': {'required': True, 'max_length': 100, 'min_length': 1}, - 'value': {'required': True, 'max_length': 500, 'min_length': 1}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, *, name: str, value: str, **kwargs) -> None: - super(MetadataDTO, self).__init__(**kwargs) - self.name = name - self.value = value diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto.py deleted file mode 100644 index 4bdd3b6905c7d..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class PromptDTO(Model): - """Prompt for an answer. - - :param display_order: Index of the prompt - used in ordering of the - prompts - :type display_order: int - :param qna_id: Qna id corresponding to the prompt - if QnaId is present, - QnADTO object is ignored. - :type qna_id: int - :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a - PromptDTO object - :type qna: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTOQna - :param display_text: Text displayed to represent a follow up question - prompt - :type display_text: str - """ - - _validation = { - 'display_text': {'max_length': 200}, - } - - _attribute_map = { - 'display_order': {'key': 'displayOrder', 'type': 'int'}, - 'qna_id': {'key': 'qnaId', 'type': 'int'}, - 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, - 'display_text': {'key': 'displayText', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PromptDTO, self).__init__(**kwargs) - self.display_order = kwargs.get('display_order', None) - self.qna_id = kwargs.get('qna_id', None) - self.qna = kwargs.get('qna', None) - self.display_text = kwargs.get('display_text', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_py3.py deleted file mode 100644 index b6be48cd9d729..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_py3.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class PromptDTO(Model): - """Prompt for an answer. - - :param display_order: Index of the prompt - used in ordering of the - prompts - :type display_order: int - :param qna_id: Qna id corresponding to the prompt - if QnaId is present, - QnADTO object is ignored. - :type qna_id: int - :param qna: QnADTO - Either QnaId or QnADTO needs to be present in a - PromptDTO object - :type qna: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTOQna - :param display_text: Text displayed to represent a follow up question - prompt - :type display_text: str - """ - - _validation = { - 'display_text': {'max_length': 200}, - } - - _attribute_map = { - 'display_order': {'key': 'displayOrder', 'type': 'int'}, - 'qna_id': {'key': 'qnaId', 'type': 'int'}, - 'qna': {'key': 'qna', 'type': 'PromptDTOQna'}, - 'display_text': {'key': 'displayText', 'type': 'str'}, - } - - def __init__(self, *, display_order: int=None, qna_id: int=None, qna=None, display_text: str=None, **kwargs) -> None: - super(PromptDTO, self).__init__(**kwargs) - self.display_order = display_order - self.qna_id = qna_id - self.qna = qna - self.display_text = display_text diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_qna.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_qna.py deleted file mode 100644 index 7ada0fe375a0b..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_qna.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .qn_adto import QnADTO - - -class PromptDTOQna(QnADTO): - """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. - - All required parameters must be populated in order to send to Azure. - - :param id: Unique id for the Q-A. - :type id: int - :param answer: Required. Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: Required. List of questions associated with the answer. - :type questions: list[str] - :param metadata: List of metadata associated with the answer. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] - :param context: Context of a QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnADTOContext - """ - - _validation = { - 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, - 'source': {'max_length': 300}, - 'questions': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': '[str]'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnADTOContext'}, - } - - def __init__(self, **kwargs): - super(PromptDTOQna, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_qna_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_qna_py3.py deleted file mode 100644 index 618fa7260f8ce..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/prompt_dto_qna_py3.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .qn_adto_py3 import QnADTO - - -class PromptDTOQna(QnADTO): - """QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object. - - All required parameters must be populated in order to send to Azure. - - :param id: Unique id for the Q-A. - :type id: int - :param answer: Required. Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: Required. List of questions associated with the answer. - :type questions: list[str] - :param metadata: List of metadata associated with the answer. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] - :param context: Context of a QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnADTOContext - """ - - _validation = { - 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, - 'source': {'max_length': 300}, - 'questions': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': '[str]'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnADTOContext'}, - } - - def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: - super(PromptDTOQna, self).__init__(id=id, answer=answer, source=source, questions=questions, metadata=metadata, context=context, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto.py deleted file mode 100644 index 9854cb76eed55..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnADTO(Model): - """Q-A object. - - All required parameters must be populated in order to send to Azure. - - :param id: Unique id for the Q-A. - :type id: int - :param answer: Required. Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: Required. List of questions associated with the answer. - :type questions: list[str] - :param metadata: List of metadata associated with the answer. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] - :param context: Context of a QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnADTOContext - """ - - _validation = { - 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, - 'source': {'max_length': 300}, - 'questions': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': '[str]'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnADTOContext'}, - } - - def __init__(self, **kwargs): - super(QnADTO, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.answer = kwargs.get('answer', None) - self.source = kwargs.get('source', None) - self.questions = kwargs.get('questions', None) - self.metadata = kwargs.get('metadata', None) - self.context = kwargs.get('context', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_context.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_context.py deleted file mode 100644 index 13056894f3aae..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_context.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .context_dto import ContextDTO - - -class QnADTOContext(ContextDTO): - """Context of a QnA. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, **kwargs): - super(QnADTOContext, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_context_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_context_py3.py deleted file mode 100644 index 9b7fa5d4e33ff..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_context_py3.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .context_dto_py3 import ContextDTO - - -class QnADTOContext(ContextDTO): - """Context of a QnA. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: - super(QnADTOContext, self).__init__(is_context_only=is_context_only, prompts=prompts, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_py3.py deleted file mode 100644 index f0967bab95fea..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_adto_py3.py +++ /dev/null @@ -1,59 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnADTO(Model): - """Q-A object. - - All required parameters must be populated in order to send to Azure. - - :param id: Unique id for the Q-A. - :type id: int - :param answer: Required. Answer text - :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs - :type source: str - :param questions: Required. List of questions associated with the answer. - :type questions: list[str] - :param metadata: List of metadata associated with the answer. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] - :param context: Context of a QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnADTOContext - """ - - _validation = { - 'answer': {'required': True, 'max_length': 25000, 'min_length': 1}, - 'source': {'max_length': 300}, - 'questions': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'source': {'key': 'source', 'type': 'str'}, - 'questions': {'key': 'questions', 'type': '[str]'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnADTOContext'}, - } - - def __init__(self, *, answer: str, questions, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: - super(QnADTO, self).__init__(**kwargs) - self.id = id - self.answer = answer - self.source = source - self.questions = questions - self.metadata = metadata - self.context = context diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result.py deleted file mode 100644 index 7964315961b6c..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnASearchResult(Model): - """Represents Search Result. - - :param questions: List of questions. - :type questions: list[str] - :param answer: Answer. - :type answer: str - :param score: Search result score. - :type score: float - :param id: Id of the QnA result. - :type id: int - :param source: Source of QnA result. - :type source: str - :param metadata: List of metadata. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] - :param context: Context object of the QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnASearchResultContext - """ - - _attribute_map = { - 'questions': {'key': 'questions', 'type': '[str]'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'score': {'key': 'score', 'type': 'float'}, - 'id': {'key': 'id', 'type': 'int'}, - 'source': {'key': 'source', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnASearchResultContext'}, - } - - def __init__(self, **kwargs): - super(QnASearchResult, self).__init__(**kwargs) - self.questions = kwargs.get('questions', None) - self.answer = kwargs.get('answer', None) - self.score = kwargs.get('score', None) - self.id = kwargs.get('id', None) - self.source = kwargs.get('source', None) - self.metadata = kwargs.get('metadata', None) - self.context = kwargs.get('context', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_context.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_context.py deleted file mode 100644 index 4a58dc0970408..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_context.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .context_dto import ContextDTO - - -class QnASearchResultContext(ContextDTO): - """Context object of the QnA. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, **kwargs): - super(QnASearchResultContext, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_context_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_context_py3.py deleted file mode 100644 index 635660459e0e0..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_context_py3.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .context_dto_py3 import ContextDTO - - -class QnASearchResultContext(ContextDTO): - """Context object of the QnA. - - :param is_context_only: To mark if a prompt is relevant only with a - previous question or not. - true - Do not include this QnA as search result for queries without - context - false - ignores context and includes this QnA in search result - :type is_context_only: bool - :param prompts: List of prompts associated with the answer. - :type prompts: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.PromptDTO] - """ - - _validation = { - 'prompts': {'max_items': 20}, - } - - _attribute_map = { - 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, - 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, - } - - def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None: - super(QnASearchResultContext, self).__init__(is_context_only=is_context_only, prompts=prompts, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_list.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_list.py deleted file mode 100644 index 202d3fd5dbafb..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_list.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnASearchResultList(Model): - """Represents List of Question Answers. - - :param answers: Represents Search Result list. - :type answers: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnASearchResult] - """ - - _attribute_map = { - 'answers': {'key': 'answers', 'type': '[QnASearchResult]'}, - } - - def __init__(self, **kwargs): - super(QnASearchResultList, self).__init__(**kwargs) - self.answers = kwargs.get('answers', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_list_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_list_py3.py deleted file mode 100644 index ef0a20b5b4951..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_list_py3.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnASearchResultList(Model): - """Represents List of Question Answers. - - :param answers: Represents Search Result list. - :type answers: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnASearchResult] - """ - - _attribute_map = { - 'answers': {'key': 'answers', 'type': '[QnASearchResult]'}, - } - - def __init__(self, *, answers=None, **kwargs) -> None: - super(QnASearchResultList, self).__init__(**kwargs) - self.answers = answers diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_py3.py deleted file mode 100644 index e342f66d11a8f..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/qn_asearch_result_py3.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QnASearchResult(Model): - """Represents Search Result. - - :param questions: List of questions. - :type questions: list[str] - :param answer: Answer. - :type answer: str - :param score: Search result score. - :type score: float - :param id: Id of the QnA result. - :type id: int - :param source: Source of QnA result. - :type source: str - :param metadata: List of metadata. - :type metadata: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] - :param context: Context object of the QnA - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnASearchResultContext - """ - - _attribute_map = { - 'questions': {'key': 'questions', 'type': '[str]'}, - 'answer': {'key': 'answer', 'type': 'str'}, - 'score': {'key': 'score', 'type': 'float'}, - 'id': {'key': 'id', 'type': 'int'}, - 'source': {'key': 'source', 'type': 'str'}, - 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, - 'context': {'key': 'context', 'type': 'QnASearchResultContext'}, - } - - def __init__(self, *, questions=None, answer: str=None, score: float=None, id: int=None, source: str=None, metadata=None, context=None, **kwargs) -> None: - super(QnASearchResult, self).__init__(**kwargs) - self.questions = questions - self.answer = answer - self.score = score - self.id = id - self.source = source - self.metadata = metadata - self.context = context diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_context_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_context_dto.py deleted file mode 100644 index 5a96679211d08..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_context_dto.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QueryContextDTO(Model): - """Context object with previous QnA's information. - - :param previous_qna_id: Previous QnA Id - qnaId of the top result. - :type previous_qna_id: str - :param previous_user_query: Previous user query. - :type previous_user_query: str - """ - - _attribute_map = { - 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, - 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(QueryContextDTO, self).__init__(**kwargs) - self.previous_qna_id = kwargs.get('previous_qna_id', None) - self.previous_user_query = kwargs.get('previous_user_query', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_context_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_context_dto_py3.py deleted file mode 100644 index fe3b7c9b258bc..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_context_dto_py3.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QueryContextDTO(Model): - """Context object with previous QnA's information. - - :param previous_qna_id: Previous QnA Id - qnaId of the top result. - :type previous_qna_id: str - :param previous_user_query: Previous user query. - :type previous_user_query: str - """ - - _attribute_map = { - 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, - 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, - } - - def __init__(self, *, previous_qna_id: str=None, previous_user_query: str=None, **kwargs) -> None: - super(QueryContextDTO, self).__init__(**kwargs) - self.previous_qna_id = previous_qna_id - self.previous_user_query = previous_user_query diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto.py deleted file mode 100644 index 1cc5c118e0afa..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QueryDTO(Model): - """POST body schema to query the knowledgebase. - - :param qna_id: Exact qnaId to fetch from the knowledgebase, this field - takes priority over question. - :type qna_id: str - :param question: User question to query against the knowledge base. - :type question: str - :param top: Max number of answers to be returned for the question. - :type top: int - :param user_id: Unique identifier for the user. - :type user_id: str - :param is_test: Query against the test index. - :type is_test: bool - :param score_threshold: Threshold for answers returned based on score. - :type score_threshold: float - :param context: Context object with previous QnA's information. - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QueryDTOContext - :param ranker_type: Optional field. Set to 'QuestionOnly' for using a - question only Ranker. - :type ranker_type: str - :param strict_filters: Find only answers that contain these metadata. - :type strict_filters: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] - """ - - _attribute_map = { - 'qna_id': {'key': 'qnaId', 'type': 'str'}, - 'question': {'key': 'question', 'type': 'str'}, - 'top': {'key': 'top', 'type': 'int'}, - 'user_id': {'key': 'userId', 'type': 'str'}, - 'is_test': {'key': 'isTest', 'type': 'bool'}, - 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, - 'context': {'key': 'context', 'type': 'QueryDTOContext'}, - 'ranker_type': {'key': 'rankerType', 'type': 'str'}, - 'strict_filters': {'key': 'strictFilters', 'type': '[MetadataDTO]'}, - } - - def __init__(self, **kwargs): - super(QueryDTO, self).__init__(**kwargs) - self.qna_id = kwargs.get('qna_id', None) - self.question = kwargs.get('question', None) - self.top = kwargs.get('top', None) - self.user_id = kwargs.get('user_id', None) - self.is_test = kwargs.get('is_test', None) - self.score_threshold = kwargs.get('score_threshold', None) - self.context = kwargs.get('context', None) - self.ranker_type = kwargs.get('ranker_type', None) - self.strict_filters = kwargs.get('strict_filters', None) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_context.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_context.py deleted file mode 100644 index 3886ef6aab751..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_context.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .query_context_dto import QueryContextDTO - - -class QueryDTOContext(QueryContextDTO): - """Context object with previous QnA's information. - - :param previous_qna_id: Previous QnA Id - qnaId of the top result. - :type previous_qna_id: str - :param previous_user_query: Previous user query. - :type previous_user_query: str - """ - - _attribute_map = { - 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, - 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(QueryDTOContext, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_context_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_context_py3.py deleted file mode 100644 index 82ce5244d40db..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_context_py3.py +++ /dev/null @@ -1,30 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from .query_context_dto_py3 import QueryContextDTO - - -class QueryDTOContext(QueryContextDTO): - """Context object with previous QnA's information. - - :param previous_qna_id: Previous QnA Id - qnaId of the top result. - :type previous_qna_id: str - :param previous_user_query: Previous user query. - :type previous_user_query: str - """ - - _attribute_map = { - 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, - 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, - } - - def __init__(self, *, previous_qna_id: str=None, previous_user_query: str=None, **kwargs) -> None: - super(QueryDTOContext, self).__init__(previous_qna_id=previous_qna_id, previous_user_query=previous_user_query, **kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_py3.py deleted file mode 100644 index 51134861cc4a0..0000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/query_dto_py3.py +++ /dev/null @@ -1,64 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class QueryDTO(Model): - """POST body schema to query the knowledgebase. - - :param qna_id: Exact qnaId to fetch from the knowledgebase, this field - takes priority over question. - :type qna_id: str - :param question: User question to query against the knowledge base. - :type question: str - :param top: Max number of answers to be returned for the question. - :type top: int - :param user_id: Unique identifier for the user. - :type user_id: str - :param is_test: Query against the test index. - :type is_test: bool - :param score_threshold: Threshold for answers returned based on score. - :type score_threshold: float - :param context: Context object with previous QnA's information. - :type context: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QueryDTOContext - :param ranker_type: Optional field. Set to 'QuestionOnly' for using a - question only Ranker. - :type ranker_type: str - :param strict_filters: Find only answers that contain these metadata. - :type strict_filters: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.MetadataDTO] - """ - - _attribute_map = { - 'qna_id': {'key': 'qnaId', 'type': 'str'}, - 'question': {'key': 'question', 'type': 'str'}, - 'top': {'key': 'top', 'type': 'int'}, - 'user_id': {'key': 'userId', 'type': 'str'}, - 'is_test': {'key': 'isTest', 'type': 'bool'}, - 'score_threshold': {'key': 'scoreThreshold', 'type': 'float'}, - 'context': {'key': 'context', 'type': 'QueryDTOContext'}, - 'ranker_type': {'key': 'rankerType', 'type': 'str'}, - 'strict_filters': {'key': 'strictFilters', 'type': '[MetadataDTO]'}, - } - - def __init__(self, *, qna_id: str=None, question: str=None, top: int=None, user_id: str=None, is_test: bool=None, score_threshold: float=None, context=None, ranker_type: str=None, strict_filters=None, **kwargs) -> None: - super(QueryDTO, self).__init__(**kwargs) - self.qna_id = qna_id - self.question = question - self.top = top - self.user_id = user_id - self.is_test = is_test - self.score_threshold = score_threshold - self.context = context - self.ranker_type = ranker_type - self.strict_filters = strict_filters diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/__init__.py index cf82a26634076..712a6199a8da4 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/__init__.py @@ -9,7 +9,7 @@ # regenerated. # -------------------------------------------------------------------------- -from .runtime_operations import RuntimeOperations +from ._runtime_operations import RuntimeOperations __all__ = [ 'RuntimeOperations', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/runtime_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/_runtime_operations.py similarity index 97% rename from sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/runtime_operations.py rename to sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/_runtime_operations.py index 4e2e85a3ac875..13bae6091e508 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/runtime_operations.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/_runtime_operations.py @@ -17,6 +17,8 @@ class RuntimeOperations(object): """RuntimeOperations operations. + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -83,7 +85,6 @@ def generate_answer( raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: deserialized = self._deserialize('QnASearchResultList', response)