diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/__init__.py index b204c1cef2bf..3c80f3606bea 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/__init__.py @@ -16,18 +16,24 @@ 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 @@ -35,6 +41,9 @@ 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 @@ -45,18 +54,24 @@ 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 @@ -64,6 +79,9 @@ 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 @@ -81,18 +99,24 @@ 'UpdateKbOperationDTO', 'UpdateQnaDTOQuestions', 'UpdateQnaDTOMetadata', + 'UpdateQnaDTOContext', 'UpdateQnaDTO', 'UpdateKbContentsDTO', 'UpdateQuestionsDTO', 'MetadataDTO', 'UpdateMetadataDTO', + 'PromptDTOQna', + 'PromptDTO', + 'UpdateContextDTO', 'DeleteKbContentsDTO', + 'QnADTOContext', 'QnADTO', 'FileDTO', 'CreateKbInputDTO', 'QnADocumentsDTO', 'CreateKbDTO', 'ReplaceKbDTO', + 'ContextDTO', 'ErrorResponseError', 'ErrorResponse', 'ErrorResponseException', 'InnerErrorModel', @@ -100,6 +124,9 @@ 'Operation', 'KnowledgebaseDTO', 'KnowledgebasesDTO', + 'EndpointSettingsDTOActiveLearning', + 'EndpointSettingsDTO', + 'ActiveLearningSettingsDTO', 'AlterationsDTO', 'WordAlterationsDTO', 'EndpointKeysDTO', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/active_learning_settings_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/active_learning_settings_dto.py new file mode 100644 index 000000000000..8290efe090a0 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/active_learning_settings_dto.py @@ -0,0 +1,28 @@ +# 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 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) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/active_learning_settings_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/active_learning_settings_dto_py3.py new file mode 100644 index 000000000000..ab33348de262 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/active_learning_settings_dto_py3.py @@ -0,0 +1,28 @@ +# 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 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/models/context_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/context_dto.py new file mode 100644 index 000000000000..b180991fb889 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/context_dto.py @@ -0,0 +1,41 @@ +# 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.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/models/context_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/context_dto_py3.py new file mode 100644 index 000000000000..25d2bf7eed66 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/context_dto_py3.py @@ -0,0 +1,41 @@ +# 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.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/models/endpoint_settings_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/endpoint_settings_dto.py new file mode 100644 index 000000000000..4c26ad25d528 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/endpoint_settings_dto.py @@ -0,0 +1,29 @@ +# 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.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/models/endpoint_settings_dto_active_learning.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/endpoint_settings_dto_active_learning.py new file mode 100644 index 000000000000..1dea50ca111d --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/endpoint_settings_dto_active_learning.py @@ -0,0 +1,27 @@ +# 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/models/endpoint_settings_dto_active_learning_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/endpoint_settings_dto_active_learning_py3.py new file mode 100644 index 000000000000..b7f3f0279eeb --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/endpoint_settings_dto_active_learning_py3.py @@ -0,0 +1,27 @@ +# 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/models/endpoint_settings_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/endpoint_settings_dto_py3.py new file mode 100644 index 000000000000..16f8253dc071 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/endpoint_settings_dto_py3.py @@ -0,0 +1,29 @@ +# 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.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/models/prompt_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto.py new file mode 100644 index 000000000000..461b19fe88c2 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto.py @@ -0,0 +1,48 @@ +# 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.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/models/prompt_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_py3.py new file mode 100644 index 000000000000..1b93663b10ca --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_py3.py @@ -0,0 +1,48 @@ +# 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.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/models/prompt_dto_qna.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_qna.py new file mode 100644 index 000000000000..d812eda50607 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_qna.py @@ -0,0 +1,53 @@ +# 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.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.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/models/prompt_dto_qna_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_qna_py3.py new file mode 100644 index 000000000000..44b7d5c4a5e1 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_qna_py3.py @@ -0,0 +1,53 @@ +# 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.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.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/models/qn_adto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto.py index 41436a02cd6d..d3d3b4ebfc08 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto.py @@ -29,6 +29,9 @@ class QnADTO(Model): :param metadata: List of metadata associated with the answer. :type metadata: list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.models.QnADTOContext """ _validation = { @@ -43,6 +46,7 @@ class QnADTO(Model): 'source': {'key': 'source', 'type': 'str'}, 'questions': {'key': 'questions', 'type': '[str]'}, 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnADTOContext'}, } def __init__(self, **kwargs): @@ -52,3 +56,4 @@ def __init__(self, **kwargs): 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/models/qn_adto_context.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_context.py new file mode 100644 index 000000000000..278155dad5c7 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_context.py @@ -0,0 +1,39 @@ +# 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.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/models/qn_adto_context_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_context_py3.py new file mode 100644 index 000000000000..ca63d16dbfbb --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_context_py3.py @@ -0,0 +1,39 @@ +# 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.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/models/qn_adto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_py3.py index b3e56678a49b..1f7d2ca33da7 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_py3.py @@ -29,6 +29,9 @@ class QnADTO(Model): :param metadata: List of metadata associated with the answer. :type metadata: list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] + :param context: Context of a QnA + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.models.QnADTOContext """ _validation = { @@ -43,12 +46,14 @@ class QnADTO(Model): '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, **kwargs) -> None: + 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/models/update_context_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_context_dto.py new file mode 100644 index 000000000000..b9cf40907e80 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_context_dto.py @@ -0,0 +1,42 @@ +# 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.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/models/update_context_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_context_dto_py3.py new file mode 100644 index 000000000000..85b3fd7eadfe --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_context_dto_py3.py @@ -0,0 +1,42 @@ +# 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.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/models/update_qna_dto.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto.py index 186d111365ae..5976530eafef 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto.py @@ -28,6 +28,9 @@ class UpdateQnaDTO(Model): :param metadata: List of metadata associated with the answer to be updated :type metadata: ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOMetadata + :param context: Context associated with Qna to be updated. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOContext """ _validation = { @@ -41,6 +44,7 @@ class UpdateQnaDTO(Model): 'source': {'key': 'source', 'type': 'str'}, 'questions': {'key': 'questions', 'type': 'UpdateQnaDTOQuestions'}, 'metadata': {'key': 'metadata', 'type': 'UpdateQnaDTOMetadata'}, + 'context': {'key': 'context', 'type': 'UpdateQnaDTOContext'}, } def __init__(self, **kwargs): @@ -50,3 +54,4 @@ def __init__(self, **kwargs): 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/models/update_qna_dto_context.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_context.py new file mode 100644 index 000000000000..44f951409c08 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_context.py @@ -0,0 +1,39 @@ +# 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.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/models/update_qna_dto_context_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_context_py3.py new file mode 100644 index 000000000000..6520f0d0c019 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_context_py3.py @@ -0,0 +1,39 @@ +# 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.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/models/update_qna_dto_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_py3.py index 6ccad503fd2c..22ca2653bfe3 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_py3.py @@ -28,6 +28,9 @@ class UpdateQnaDTO(Model): :param metadata: List of metadata associated with the answer to be updated :type metadata: ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOMetadata + :param context: Context associated with Qna to be updated. + :type context: + ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOContext """ _validation = { @@ -41,12 +44,14 @@ class UpdateQnaDTO(Model): '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, **kwargs) -> None: + 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/operations/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/operations/__init__.py index 4302a4938a28..e89d051424b1 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/operations/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/operations/__init__.py @@ -9,12 +9,14 @@ # 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 __all__ = [ + 'EndpointSettingsOperations', 'EndpointKeysOperations', 'AlterationsOperations', 'KnowledgebaseOperations', diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/operations/endpoint_settings_operations.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/operations/endpoint_settings_operations.py new file mode 100644 index 000000000000..d54e0af12dc3 --- /dev/null +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/operations/endpoint_settings_operations.py @@ -0,0 +1,143 @@ +# 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. + + :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.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.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: str or ClientRawResponse if raw=true + :rtype: str 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['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(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 [200]: + 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) + return client_raw_response + + return deserialized + update_settings.metadata = {'url': '/endpointSettings'} diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/qn_amaker_client.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/qn_amaker_client.py index aef5f6b21336..0cf28b7585f7 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/qn_amaker_client.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/qn_amaker_client.py @@ -12,6 +12,7 @@ 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 @@ -55,6 +56,8 @@ class QnAMakerClient(SDKClient): :ivar config: Configuration for client. :vartype config: QnAMakerClientConfiguration + :ivar endpoint_settings: EndpointSettings operations + :vartype endpoint_settings: azure.cognitiveservices.knowledge.qnamaker.operations.EndpointSettingsOperations :ivar endpoint_keys: EndpointKeys operations :vartype endpoint_keys: azure.cognitiveservices.knowledge.qnamaker.operations.EndpointKeysOperations :ivar alterations: Alterations operations @@ -83,6 +86,8 @@ def __init__( 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( diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py index e0ec669828cb..3faab2cb0b4a 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" +VERSION = "4.0"