diff --git a/azure-cognitiveservices-knowledge-qnamaker/MANIFEST.in b/azure-cognitiveservices-knowledge-qnamaker/MANIFEST.in index 401979355337..a897ca8dfdbd 100644 --- a/azure-cognitiveservices-knowledge-qnamaker/MANIFEST.in +++ b/azure-cognitiveservices-knowledge-qnamaker/MANIFEST.in @@ -1,3 +1,4 @@ +recursive-include tests *.py *.yaml include *.rst include azure/__init__.py include azure/cognitiveservices/__init__.py diff --git a/azure-cognitiveservices-knowledge-qnamaker/README.rst b/azure-cognitiveservices-knowledge-qnamaker/README.rst index 0b2b47aad629..53e6fe10520b 100644 --- a/azure-cognitiveservices-knowledge-qnamaker/README.rst +++ b/azure-cognitiveservices-knowledge-qnamaker/README.rst @@ -8,30 +8,11 @@ This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== For code examples, see `QnA Maker -`__ +`__ on docs.microsoft.com. diff --git a/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/__init__.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/__init__.py index b204c1cef2bf..f75a09b157b1 100644 --- a/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/__init__.py +++ b/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 @@ -45,18 +51,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 @@ -81,18 +93,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', diff --git a/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/context_dto.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/context_dto.py new file mode 100644 index 000000000000..b180991fb889 --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/context_dto_py3.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/context_dto_py3.py new file mode 100644 index 000000000000..25d2bf7eed66 --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto.py new file mode 100644 index 000000000000..461b19fe88c2 --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_py3.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_py3.py new file mode 100644 index 000000000000..1b93663b10ca --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_qna.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_qna.py new file mode 100644 index 000000000000..d812eda50607 --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_qna_py3.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/prompt_dto_qna_py3.py new file mode 100644 index 000000000000..44b7d5c4a5e1 --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto.py index 41436a02cd6d..d3d3b4ebfc08 100644 --- a/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto.py +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_context.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_context.py new file mode 100644 index 000000000000..278155dad5c7 --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_context_py3.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_context_py3.py new file mode 100644 index 000000000000..ca63d16dbfbb --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_py3.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_py3.py index b3e56678a49b..1f7d2ca33da7 100644 --- a/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/qn_adto_py3.py +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_context_dto.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_context_dto.py new file mode 100644 index 000000000000..b9cf40907e80 --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_context_dto_py3.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_context_dto_py3.py new file mode 100644 index 000000000000..85b3fd7eadfe --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto.py index 186d111365ae..5976530eafef 100644 --- a/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto.py +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_context.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_context.py new file mode 100644 index 000000000000..44f951409c08 --- /dev/null +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_context_py3.py b/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/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_py3.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_py3.py index 6ccad503fd2c..22ca2653bfe3 100644 --- a/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/update_qna_dto_py3.py +++ b/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/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py index e0ec669828cb..3faab2cb0b4a 100644 --- a/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py +++ b/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.1.0" +VERSION = "4.0" diff --git a/azure-cognitiveservices-knowledge-qnamaker/setup.py b/azure-cognitiveservices-knowledge-qnamaker/setup.py index b52e46be2187..8eacf30501c9 100644 --- a/azure-cognitiveservices-knowledge-qnamaker/setup.py +++ b/azure-cognitiveservices-knowledge-qnamaker/setup.py @@ -53,6 +53,7 @@ version=version, description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), long_description=readme + '\n\n' + history, + long_description_content_type='text/x-rst', license='MIT License', author='Microsoft Corporation', author_email='azpysdkhelp@microsoft.com',