From 19a5becb2dc1c03b3bd5dec8756faba53b758324 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 13 Aug 2019 21:19:45 -0700 Subject: [PATCH] Generated from faa8f71aa05aaed68631716cc9ef24451d760b3e (#6722) remove redundent schema reference --- .../knowledge/qnamaker/__init__.py | 6 +- .../knowledge/qnamaker/_configuration.py | 22 +- .../_qn_amaker_runtime_client.py | 2 +- .../knowledge/qnamaker/models/__init__.py | 113 +-- .../knowledge/qnamaker/models/_models.py | 743 ++++------------- .../knowledge/qnamaker/models/_models_py3.py | 757 ++++-------------- .../models/_qn_amaker_client_enums.py | 6 - .../models/_qn_amaker_runtime_client_enums.py | 0 .../knowledge/qnamaker/operations/__init__.py | 12 +- .../operations/_runtime_operations.py | 10 +- .../knowledge/qnamaker/runtime/__init__.py | 19 - .../qnamaker/runtime/_configuration.py | 47 -- .../qnamaker/runtime/models/__init__.py | 74 -- .../qnamaker/runtime/models/_models.py | 585 -------------- .../qnamaker/runtime/models/_models_py3.py | 585 -------------- .../qnamaker/runtime/operations/__init__.py | 16 - .../knowledge/qnamaker/runtime/version.py | 13 - 17 files changed, 322 insertions(+), 2688 deletions(-) rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/{runtime => }/_qn_amaker_runtime_client.py (98%) rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/{runtime => }/models/_qn_amaker_runtime_client_enums.py (100%) rename sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/{runtime => }/operations/_runtime_operations.py (93%) delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/__init__.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/_configuration.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/__init__.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models_py3.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/__init__.py delete mode 100644 sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/version.py diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/__init__.py index fb3872ea774c..f283c224f42c 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/__init__.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/__init__.py @@ -9,9 +9,9 @@ # regenerated. # -------------------------------------------------------------------------- -from ._configuration import QnAMakerClientConfiguration -from ._qn_amaker_client import QnAMakerClient -__all__ = ['QnAMakerClient', 'QnAMakerClientConfiguration'] +from ._configuration import QnAMakerRuntimeClientConfiguration +from ._qn_amaker_runtime_client import QnAMakerRuntimeClient +__all__ = ['QnAMakerRuntimeClient', 'QnAMakerRuntimeClientConfiguration'] from .version import VERSION diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/_configuration.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/_configuration.py index 8a45eb6c340d..57d958a26600 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/_configuration.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/_configuration.py @@ -14,34 +14,34 @@ from .version import VERSION -class QnAMakerClientConfiguration(Configuration): - """Configuration for QnAMakerClient +class QnAMakerRuntimeClientConfiguration(Configuration): + """Configuration for QnAMakerRuntimeClient 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 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, endpoint, credentials): + self, runtime_endpoint, credentials): - if endpoint is None: - raise ValueError("Parameter 'endpoint' must not be None.") + 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 = '{Endpoint}/qnamaker/v4.0' + base_url = '{RuntimeEndpoint}/qnamaker' - super(QnAMakerClientConfiguration, self).__init__(base_url) + 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.endpoint = endpoint + 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/_qn_amaker_runtime_client.py similarity index 98% 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/_qn_amaker_runtime_client.py index 6aea45d358c7..62bf2d97b390 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/_qn_amaker_runtime_client.py @@ -24,7 +24,7 @@ class QnAMakerRuntimeClient(SDKClient): :vartype config: QnAMakerRuntimeClientConfiguration :ivar runtime: Runtime operations - :vartype runtime: azure.cognitiveservices.knowledge.qnamaker.runtime.operations.RuntimeOperations + :vartype runtime: azure.cognitiveservices.knowledge.qnamaker.operations.RuntimeOperations :param runtime_endpoint: QnA Maker App Service endpoint (for example: https://{qnaservice-hostname}.azurewebsites.net). 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 560c37c1dd03..a1181c783561 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 @@ -10,128 +10,65 @@ # -------------------------------------------------------------------------- try: - 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 FeedbackRecordDTO + from ._models_py3 import FeedbackRecordsDTO 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 + 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 ._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 FeedbackRecordDTO + from ._models import FeedbackRecordsDTO 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, + 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, - KnowledgebaseEnvironmentType, - OperationStateType, ) __all__ = [ - 'ActiveLearningSettingsDTO', - 'AlterationsDTO', 'ContextDTO', - 'CreateKbDTO', - 'CreateKbInputDTO', - 'DeleteKbContentsDTO', - 'EndpointKeysDTO', - 'EndpointSettingsDTO', - 'EndpointSettingsDTOActiveLearning', 'Error', 'ErrorResponse', 'ErrorResponseException', 'ErrorResponseError', - 'FileDTO', + 'FeedbackRecordDTO', + 'FeedbackRecordsDTO', 'InnerErrorModel', - 'KnowledgebaseDTO', - 'KnowledgebasesDTO', 'MetadataDTO', - 'Operation', 'PromptDTO', 'PromptDTOQna', - 'QnADocumentsDTO', 'QnADTO', 'QnADTOContext', - 'ReplaceKbDTO', - 'UpdateContextDTO', - 'UpdateKbContentsDTO', - 'UpdateKbOperationDTO', - 'UpdateKbOperationDTOAdd', - 'UpdateKbOperationDTODelete', - 'UpdateKbOperationDTOUpdate', - 'UpdateMetadataDTO', - 'UpdateQnaDTO', - 'UpdateQnaDTOContext', - 'UpdateQnaDTOMetadata', - 'UpdateQnaDTOQuestions', - 'UpdateQuestionsDTO', - 'WordAlterationsDTO', - 'KnowledgebaseEnvironmentType', + 'QnASearchResult', + 'QnASearchResultContext', + 'QnASearchResultList', + 'QueryContextDTO', + 'QueryDTO', + 'QueryDTOContext', 'ErrorCodeType', - 'OperationStateType', - 'EnvironmentType', ] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_models.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_models.py index afb4c2d79be0..346cb8ecbcbf 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_models.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_models.py @@ -13,44 +13,6 @@ 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. @@ -80,150 +42,6 @@ def __init__(self, **kwargs): 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.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.models.FileDTO] - """ - - _validation = { - 'name': {'required': True, '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]'}, - } - - 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) - - -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.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.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 - """ - - _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'}, - } - - 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) - - -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) - - -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. @@ -346,32 +164,50 @@ 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. +class FeedbackRecordDTO(Model): + """Active learning feedback record. - :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 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 = { - 'file_name': {'required': True, 'max_length': 200, 'min_length': 1}, - 'file_uri': {'required': True}, + '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.models.FeedbackRecordDTO] + """ + _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, - 'file_uri': {'key': 'fileUri', 'type': 'str'}, + 'feedback_records': {'key': 'feedbackRecords', 'type': '[FeedbackRecordDTO]'}, } 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) + super(FeedbackRecordsDTO, self).__init__(**kwargs) + self.feedback_records = kwargs.get('feedback_records', None) class InnerErrorModel(Model): @@ -399,76 +235,6 @@ def __init__(self, **kwargs): 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.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. @@ -496,51 +262,6 @@ def __init__(self, **kwargs): 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.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.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. @@ -665,23 +386,6 @@ 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.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. @@ -709,351 +413,172 @@ 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.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.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.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.models.UpdateKbOperationDTOAdd - :param delete: An instance of DeleteKbContentsDTO for delete Operation - :type delete: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateKbOperationDTODelete - :param update: An instance of UpdateKbContentsDTO for Update Operation - :type update: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateKbOperationDTOUpdate - """ - - _attribute_map = { - 'add': {'key': 'add', 'type': 'UpdateKbOperationDTOAdd'}, - 'delete': {'key': 'delete', 'type': 'UpdateKbOperationDTODelete'}, - 'update': {'key': 'update', 'type': 'UpdateKbOperationDTOUpdate'}, - } - - 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) - - -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.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.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.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.models.MetadataDTO] - :param add: List of metadata associated with answer to be added - :type add: - list[~azure.cognitiveservices.knowledge.qnamaker.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. +class QnASearchResult(Model): + """Represents Search Result. - :param id: Unique id for the Q-A - :type id: int - :param answer: Answer text + :param questions: List of questions. + :type questions: list[str] + :param answer: Answer. :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :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 questions: List of questions associated with the answer. - :type questions: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOQuestions - :param metadata: List of metadata associated with the answer to be updated + :param metadata: List of metadata. :type metadata: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOMetadata - :param context: Context associated with Qna to be updated. + list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] + :param context: Context object of the QnA :type context: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOContext + ~azure.cognitiveservices.knowledge.qnamaker.models.QnASearchResultContext """ - _validation = { - 'id': {'maximum': 2147483647, 'minimum': 0}, - 'source': {'max_length': 300}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, + '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'}, - 'questions': {'key': 'questions', 'type': 'UpdateQnaDTOQuestions'}, - 'metadata': {'key': 'metadata', 'type': 'UpdateQnaDTOMetadata'}, - 'context': {'key': 'context', 'type': 'UpdateQnaDTOContext'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnASearchResultContext'}, } def __init__(self, **kwargs): - super(UpdateQnaDTO, self).__init__(**kwargs) - self.id = kwargs.get('id', None) + 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.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. +class QnASearchResultContext(ContextDTO): + """Context object of the QnA. - :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 + :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 = { - 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, - 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, } def __init__(self, **kwargs): - super(UpdateQnaDTOContext, self).__init__(**kwargs) + super(QnASearchResultContext, self).__init__(**kwargs) -class UpdateQnaDTOMetadata(UpdateMetadataDTO): - """List of metadata associated with the answer to be updated. +class QnASearchResultList(Model): + """Represents List of Question Answers. - :param delete: List of Metadata associated with answer to be deleted - :type delete: - list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] - :param add: List of metadata associated with answer to be added - :type add: - list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] + :param answers: Represents Search Result list. + :type answers: + list[~azure.cognitiveservices.knowledge.qnamaker.models.QnASearchResult] """ _attribute_map = { - 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, - 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + 'answers': {'key': 'answers', 'type': '[QnASearchResult]'}, } def __init__(self, **kwargs): - super(UpdateQnaDTOMetadata, self).__init__(**kwargs) + super(QnASearchResultList, self).__init__(**kwargs) + self.answers = kwargs.get('answers', None) -class UpdateQuestionsDTO(Model): - """PATCH Body schema for Update Kb which contains list of questions to be - added and deleted. +class QueryContextDTO(Model): + """Context object with previous QnA's information. - :param add: List of questions to be added - :type add: list[str] - :param delete: List of questions to be deleted. - :type delete: list[str] + :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 = { - 'add': {'key': 'add', 'type': '[str]'}, - 'delete': {'key': 'delete', 'type': '[str]'}, + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, } def __init__(self, **kwargs): - super(UpdateQuestionsDTO, self).__init__(**kwargs) - self.add = kwargs.get('add', None) - self.delete = kwargs.get('delete', None) + 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 UpdateQnaDTOQuestions(UpdateQuestionsDTO): - """List of questions associated with the answer. +class QueryDTO(Model): + """POST body schema to query the knowledgebase. - :param add: List of questions to be added - :type add: list[str] - :param delete: List of questions to be deleted. - :type delete: list[str] + :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.models.QueryDTOContext + :param strict_filters: Find only answers that contain these metadata. + :type strict_filters: + list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] """ _attribute_map = { - 'add': {'key': 'add', 'type': '[str]'}, - 'delete': {'key': 'delete', 'type': '[str]'}, + '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'}, + 'strict_filters': {'key': 'strictFilters', 'type': '[MetadataDTO]'}, } def __init__(self, **kwargs): - super(UpdateQnaDTOQuestions, self).__init__(**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.strict_filters = kwargs.get('strict_filters', None) -class WordAlterationsDTO(Model): - """Collection of word alterations. - All required parameters must be populated in order to send to Azure. +class QueryDTOContext(QueryContextDTO): + """Context object with previous QnA's information. - :param word_alterations: Required. Collection of word alterations. - :type word_alterations: - list[~azure.cognitiveservices.knowledge.qnamaker.models.AlterationsDTO] + :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 """ - _validation = { - 'word_alterations': {'required': True}, - } - _attribute_map = { - 'word_alterations': {'key': 'wordAlterations', 'type': '[AlterationsDTO]'}, + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, } def __init__(self, **kwargs): - super(WordAlterationsDTO, self).__init__(**kwargs) - self.word_alterations = kwargs.get('word_alterations', None) + super(QueryDTOContext, self).__init__(**kwargs) diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_models_py3.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_models_py3.py index d9fcfab5d38c..f030ea4ad389 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_models_py3.py @@ -13,44 +13,6 @@ 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. @@ -80,150 +42,6 @@ def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> Non 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.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.models.FileDTO] - """ - - _validation = { - 'name': {'required': True, '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]'}, - } - - def __init__(self, *, name: str, qna_list=None, urls=None, files=None, **kwargs) -> None: - super(CreateKbDTO, self).__init__(**kwargs) - self.name = name - self.qna_list = qna_list - self.urls = urls - self.files = files - - -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.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.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 - """ - - _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'}, - } - - def __init__(self, *, primary_endpoint_key: str=None, secondary_endpoint_key: str=None, installed_version: str=None, last_stable_version: 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 - - -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 - - -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. @@ -346,32 +164,50 @@ def __init__(self, *, code, message: str=None, target: str=None, details=None, i 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. +class FeedbackRecordDTO(Model): + """Active learning feedback record. - 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 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 = { - 'file_name': {'required': True, 'max_length': 200, 'min_length': 1}, - 'file_uri': {'required': True}, + 'user_question': {'max_length': 1000}, } _attribute_map = { - 'file_name': {'key': 'fileName', 'type': 'str'}, - 'file_uri': {'key': 'fileUri', 'type': 'str'}, + '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.models.FeedbackRecordDTO] + """ + + _attribute_map = { + 'feedback_records': {'key': 'feedbackRecords', 'type': '[FeedbackRecordDTO]'}, } - 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 + def __init__(self, *, feedback_records=None, **kwargs) -> None: + super(FeedbackRecordsDTO, self).__init__(**kwargs) + self.feedback_records = feedback_records class InnerErrorModel(Model): @@ -399,76 +235,6 @@ def __init__(self, *, code: str=None, inner_error=None, **kwargs) -> None: 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.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. @@ -496,51 +262,6 @@ def __init__(self, *, name: str, value: str, **kwargs) -> None: 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.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.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. @@ -665,23 +386,6 @@ def __init__(self, *, answer: str, questions, id: int=None, source: str=None, me 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.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. @@ -709,351 +413,172 @@ def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> Non 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.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.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.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.models.UpdateKbOperationDTOAdd - :param delete: An instance of DeleteKbContentsDTO for delete Operation - :type delete: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateKbOperationDTODelete - :param update: An instance of UpdateKbContentsDTO for Update Operation - :type update: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateKbOperationDTOUpdate - """ - - _attribute_map = { - 'add': {'key': 'add', 'type': 'UpdateKbOperationDTOAdd'}, - 'delete': {'key': 'delete', 'type': 'UpdateKbOperationDTODelete'}, - 'update': {'key': 'update', 'type': 'UpdateKbOperationDTOUpdate'}, - } - - def __init__(self, *, add=None, delete=None, update=None, **kwargs) -> None: - super(UpdateKbOperationDTO, self).__init__(**kwargs) - self.add = add - self.delete = delete - self.update = update - - -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.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.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 QnASearchResult(Model): + """Represents Search Result. -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.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.models.MetadataDTO] - :param add: List of metadata associated with answer to be added - :type add: - list[~azure.cognitiveservices.knowledge.qnamaker.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 + :param questions: List of questions. + :type questions: list[str] + :param answer: Answer. :type answer: str - :param source: Source from which Q-A was indexed. eg. - https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs + :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 questions: List of questions associated with the answer. - :type questions: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOQuestions - :param metadata: List of metadata associated with the answer to be updated + :param metadata: List of metadata. :type metadata: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOMetadata - :param context: Context associated with Qna to be updated. + list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] + :param context: Context object of the QnA :type context: - ~azure.cognitiveservices.knowledge.qnamaker.models.UpdateQnaDTOContext + ~azure.cognitiveservices.knowledge.qnamaker.models.QnASearchResultContext """ - _validation = { - 'id': {'maximum': 2147483647, 'minimum': 0}, - 'source': {'max_length': 300}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'int'}, + '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'}, - 'questions': {'key': 'questions', 'type': 'UpdateQnaDTOQuestions'}, - 'metadata': {'key': 'metadata', 'type': 'UpdateQnaDTOMetadata'}, - 'context': {'key': 'context', 'type': 'UpdateQnaDTOContext'}, + 'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'}, + 'context': {'key': 'context', 'type': 'QnASearchResultContext'}, } - 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 + 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.questions = questions self.metadata = metadata self.context = context -class UpdateQnaDTOContext(UpdateContextDTO): - """Context associated with Qna to be updated. +class QnASearchResultContext(ContextDTO): + """Context object of the QnA. - :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 + :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 = { - 'prompts_to_delete': {'key': 'promptsToDelete', 'type': '[int]'}, - 'prompts_to_add': {'key': 'promptsToAdd', 'type': '[PromptDTO]'}, 'is_context_only': {'key': 'isContextOnly', 'type': 'bool'}, + 'prompts': {'key': 'prompts', 'type': '[PromptDTO]'}, } - 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) + 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 UpdateQnaDTOMetadata(UpdateMetadataDTO): - """List of metadata associated with the answer to be updated. +class QnASearchResultList(Model): + """Represents List of Question Answers. - :param delete: List of Metadata associated with answer to be deleted - :type delete: - list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] - :param add: List of metadata associated with answer to be added - :type add: - list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] + :param answers: Represents Search Result list. + :type answers: + list[~azure.cognitiveservices.knowledge.qnamaker.models.QnASearchResult] """ _attribute_map = { - 'delete': {'key': 'delete', 'type': '[MetadataDTO]'}, - 'add': {'key': 'add', 'type': '[MetadataDTO]'}, + 'answers': {'key': 'answers', 'type': '[QnASearchResult]'}, } - def __init__(self, *, delete=None, add=None, **kwargs) -> None: - super(UpdateQnaDTOMetadata, self).__init__(delete=delete, add=add, **kwargs) + def __init__(self, *, answers=None, **kwargs) -> None: + super(QnASearchResultList, self).__init__(**kwargs) + self.answers = answers -class UpdateQuestionsDTO(Model): - """PATCH Body schema for Update Kb which contains list of questions to be - added and deleted. +class QueryContextDTO(Model): + """Context object with previous QnA's information. - :param add: List of questions to be added - :type add: list[str] - :param delete: List of questions to be deleted. - :type delete: list[str] + :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 = { - 'add': {'key': 'add', 'type': '[str]'}, - 'delete': {'key': 'delete', 'type': '[str]'}, + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, } - def __init__(self, *, add=None, delete=None, **kwargs) -> None: - super(UpdateQuestionsDTO, self).__init__(**kwargs) - self.add = add - self.delete = delete + 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 UpdateQnaDTOQuestions(UpdateQuestionsDTO): - """List of questions associated with the answer. +class QueryDTO(Model): + """POST body schema to query the knowledgebase. - :param add: List of questions to be added - :type add: list[str] - :param delete: List of questions to be deleted. - :type delete: list[str] + :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.models.QueryDTOContext + :param strict_filters: Find only answers that contain these metadata. + :type strict_filters: + list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO] """ _attribute_map = { - 'add': {'key': 'add', 'type': '[str]'}, - 'delete': {'key': 'delete', 'type': '[str]'}, + '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'}, + 'strict_filters': {'key': 'strictFilters', 'type': '[MetadataDTO]'}, } - def __init__(self, *, add=None, delete=None, **kwargs) -> None: - super(UpdateQnaDTOQuestions, self).__init__(add=add, delete=delete, **kwargs) - + 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, 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.strict_filters = strict_filters -class WordAlterationsDTO(Model): - """Collection of word alterations. - All required parameters must be populated in order to send to Azure. +class QueryDTOContext(QueryContextDTO): + """Context object with previous QnA's information. - :param word_alterations: Required. Collection of word alterations. - :type word_alterations: - list[~azure.cognitiveservices.knowledge.qnamaker.models.AlterationsDTO] + :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 """ - _validation = { - 'word_alterations': {'required': True}, - } - _attribute_map = { - 'word_alterations': {'key': 'wordAlterations', 'type': '[AlterationsDTO]'}, + 'previous_qna_id': {'key': 'previousQnaId', 'type': 'str'}, + 'previous_user_query': {'key': 'previousUserQuery', 'type': 'str'}, } - def __init__(self, *, word_alterations, **kwargs) -> None: - super(WordAlterationsDTO, self).__init__(**kwargs) - self.word_alterations = word_alterations + 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/models/_qn_amaker_client_enums.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_qn_amaker_client_enums.py index d7ed140da72c..3d9f996b78b7 100644 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_qn_amaker_client_enums.py +++ b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/models/_qn_amaker_client_enums.py @@ -12,12 +12,6 @@ from enum import Enum -class KnowledgebaseEnvironmentType(str, Enum): - - prod = "Prod" - test = "Test" - - class ErrorCodeType(str, Enum): bad_argument = "BadArgument" 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/models/_qn_amaker_runtime_client_enums.py similarity index 100% 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/models/_qn_amaker_runtime_client_enums.py 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 bdc2419b05d6..712a6199a8da 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,16 +9,8 @@ # 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 ._runtime_operations import RuntimeOperations __all__ = [ - 'EndpointSettingsOperations', - 'EndpointKeysOperations', - 'AlterationsOperations', - 'KnowledgebaseOperations', - 'Operations', + '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/operations/_runtime_operations.py similarity index 93% 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/operations/_runtime_operations.py index 13bae6091e50..0dc3448da41a 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/operations/_runtime_operations.py @@ -43,7 +43,7 @@ def generate_answer( :type kb_id: str :param generate_answer_payload: Post body of the request. :type generate_answer_payload: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QueryDTO + ~azure.cognitiveservices.knowledge.qnamaker.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 @@ -51,10 +51,10 @@ def generate_answer( overrides`. :return: QnASearchResultList or ClientRawResponse if raw=true :rtype: - ~azure.cognitiveservices.knowledge.qnamaker.runtime.models.QnASearchResultList + ~azure.cognitiveservices.knowledge.qnamaker.models.QnASearchResultList or ~msrest.pipeline.ClientRawResponse :raises: - :class:`ErrorResponseException` + :class:`ErrorResponseException` """ # Construct URL url = self.generate_answer.metadata['url'] @@ -103,7 +103,7 @@ def train( :type kb_id: str :param feedback_records: List of feedback records. :type feedback_records: - list[~azure.cognitiveservices.knowledge.qnamaker.runtime.models.FeedbackRecordDTO] + list[~azure.cognitiveservices.knowledge.qnamaker.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 @@ -112,7 +112,7 @@ def train( :return: None or ClientRawResponse if raw=true :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: - :class:`ErrorResponseException` + :class:`ErrorResponseException` """ train_payload = models.FeedbackRecordsDTO(feedback_records=feedback_records) 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 deleted file mode 100644 index f283c224f42c..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/__init__.py +++ /dev/null @@ -1,19 +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 ._configuration import QnAMakerRuntimeClientConfiguration -from ._qn_amaker_runtime_client import QnAMakerRuntimeClient -__all__ = ['QnAMakerRuntimeClient', 'QnAMakerRuntimeClientConfiguration'] - -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 deleted file mode 100644 index 57d958a26600..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/_configuration.py +++ /dev/null @@ -1,47 +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 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/models/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/__init__.py deleted file mode 100644 index a1181c783561..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/__init__.py +++ /dev/null @@ -1,74 +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. -# -------------------------------------------------------------------------- - -try: - 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 ._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, -) - -__all__ = [ - 'ContextDTO', - 'Error', - 'ErrorResponse', 'ErrorResponseException', - 'ErrorResponseError', - 'FeedbackRecordDTO', - 'FeedbackRecordsDTO', - 'InnerErrorModel', - 'MetadataDTO', - 'PromptDTO', - 'PromptDTOQna', - 'QnADTO', - 'QnADTOContext', - 'QnASearchResult', - 'QnASearchResultContext', - 'QnASearchResultList', - 'QueryContextDTO', - 'QueryDTO', - 'QueryDTOContext', - 'ErrorCodeType', -] 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 deleted file mode 100644 index d2b4d5a3b42f..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models.py +++ /dev/null @@ -1,585 +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 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. - :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 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'}, - '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.strict_filters = kwargs.get('strict_filters', 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 deleted file mode 100644 index 6f793089f2ed..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/models/_models_py3.py +++ /dev/null @@ -1,585 +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 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. - :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 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'}, - '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, 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.strict_filters = strict_filters - - -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/operations/__init__.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/__init__.py deleted file mode 100644 index 712a6199a8da..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/operations/__init__.py +++ /dev/null @@ -1,16 +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 ._runtime_operations import RuntimeOperations - -__all__ = [ - 'RuntimeOperations', -] diff --git a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/version.py b/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/version.py deleted file mode 100644 index 3faab2cb0b4a..000000000000 --- a/sdk/cognitiveservices/azure-cognitiveservices-knowledge-qnamaker/azure/cognitiveservices/knowledge/qnamaker/runtime/version.py +++ /dev/null @@ -1,13 +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. -# -------------------------------------------------------------------------- - -VERSION = "4.0" -