Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR] cognitiveservices/data-plane/QnAMaker #4951

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions azure-cognitiveservices-knowledge-qnamaker/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
recursive-include tests *.py *.yaml
include *.rst
include azure/__init__.py
include azure/cognitiveservices/__init__.py
Expand Down
21 changes: 1 addition & 20 deletions azure-cognitiveservices-knowledge-qnamaker/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,11 @@ This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7.
For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/azure>`__ bundle package.


Compatibility
=============

**IMPORTANT**: If you have an earlier version of the azure package
(version < 1.0), you should uninstall it before installing this package.

You can check the version using pip:

.. code:: shell

pip freeze

If you see azure==0.11.0 (or any version below 1.0), uninstall it first:

.. code:: shell

pip uninstall azure


Usage
=====

For code examples, see `QnA Maker
<https://github.com/Azure-Samples/cognitive-services-python-sdk-samples/tree/master/samples/knowledge>`__
<https://docs.microsoft.com/python/api/overview/azure/cognitive-services>`__
on docs.microsoft.com.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@
from .update_kb_operation_dto_py3 import UpdateKbOperationDTO
from .update_qna_dto_questions_py3 import UpdateQnaDTOQuestions
from .update_qna_dto_metadata_py3 import UpdateQnaDTOMetadata
from .update_qna_dto_context_py3 import UpdateQnaDTOContext
from .update_qna_dto_py3 import UpdateQnaDTO
from .update_kb_contents_dto_py3 import UpdateKbContentsDTO
from .update_questions_dto_py3 import UpdateQuestionsDTO
from .metadata_dto_py3 import MetadataDTO
from .update_metadata_dto_py3 import UpdateMetadataDTO
from .prompt_dto_qna_py3 import PromptDTOQna
from .prompt_dto_py3 import PromptDTO
from .update_context_dto_py3 import UpdateContextDTO
from .delete_kb_contents_dto_py3 import DeleteKbContentsDTO
from .qn_adto_context_py3 import QnADTOContext
from .qn_adto_py3 import QnADTO
from .file_dto_py3 import FileDTO
from .create_kb_input_dto_py3 import CreateKbInputDTO
from .qn_adocuments_dto_py3 import QnADocumentsDTO
from .create_kb_dto_py3 import CreateKbDTO
from .replace_kb_dto_py3 import ReplaceKbDTO
from .context_dto_py3 import ContextDTO
from .error_response_error_py3 import ErrorResponseError
from .error_response_py3 import ErrorResponse, ErrorResponseException
from .inner_error_model_py3 import InnerErrorModel
Expand All @@ -45,18 +51,24 @@
from .update_kb_operation_dto import UpdateKbOperationDTO
from .update_qna_dto_questions import UpdateQnaDTOQuestions
from .update_qna_dto_metadata import UpdateQnaDTOMetadata
from .update_qna_dto_context import UpdateQnaDTOContext
from .update_qna_dto import UpdateQnaDTO
from .update_kb_contents_dto import UpdateKbContentsDTO
from .update_questions_dto import UpdateQuestionsDTO
from .metadata_dto import MetadataDTO
from .update_metadata_dto import UpdateMetadataDTO
from .prompt_dto_qna import PromptDTOQna
from .prompt_dto import PromptDTO
from .update_context_dto import UpdateContextDTO
from .delete_kb_contents_dto import DeleteKbContentsDTO
from .qn_adto_context import QnADTOContext
from .qn_adto import QnADTO
from .file_dto import FileDTO
from .create_kb_input_dto import CreateKbInputDTO
from .qn_adocuments_dto import QnADocumentsDTO
from .create_kb_dto import CreateKbDTO
from .replace_kb_dto import ReplaceKbDTO
from .context_dto import ContextDTO
from .error_response_error import ErrorResponseError
from .error_response import ErrorResponse, ErrorResponseException
from .inner_error_model import InnerErrorModel
Expand All @@ -81,18 +93,24 @@
'UpdateKbOperationDTO',
'UpdateQnaDTOQuestions',
'UpdateQnaDTOMetadata',
'UpdateQnaDTOContext',
'UpdateQnaDTO',
'UpdateKbContentsDTO',
'UpdateQuestionsDTO',
'MetadataDTO',
'UpdateMetadataDTO',
'PromptDTOQna',
'PromptDTO',
'UpdateContextDTO',
'DeleteKbContentsDTO',
'QnADTOContext',
'QnADTO',
'FileDTO',
'CreateKbInputDTO',
'QnADocumentsDTO',
'CreateKbDTO',
'ReplaceKbDTO',
'ContextDTO',
'ErrorResponseError',
'ErrorResponse', 'ErrorResponseException',
'InnerErrorModel',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ContextDTO(Model):
"""Context associated with Qna.

:param is_context_only: To mark if a prompt is relevant only with a
previous question or not.
true - Do not include this QnA as search result for queries without
context
false - ignores context and includes this QnA in search result
:type is_context_only: bool
:param prompts: List of prompts associated with the answer.
:type prompts:
list[~azure.cognitiveservices.knowledge.qnamaker.models.PromptDTO]
"""

_validation = {
'prompts': {'max_items': 20},
}

_attribute_map = {
'is_context_only': {'key': 'isContextOnly', 'type': 'bool'},
'prompts': {'key': 'prompts', 'type': '[PromptDTO]'},
}

def __init__(self, **kwargs):
super(ContextDTO, self).__init__(**kwargs)
self.is_context_only = kwargs.get('is_context_only', None)
self.prompts = kwargs.get('prompts', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ContextDTO(Model):
"""Context associated with Qna.

:param is_context_only: To mark if a prompt is relevant only with a
previous question or not.
true - Do not include this QnA as search result for queries without
context
false - ignores context and includes this QnA in search result
:type is_context_only: bool
:param prompts: List of prompts associated with the answer.
:type prompts:
list[~azure.cognitiveservices.knowledge.qnamaker.models.PromptDTO]
"""

_validation = {
'prompts': {'max_items': 20},
}

_attribute_map = {
'is_context_only': {'key': 'isContextOnly', 'type': 'bool'},
'prompts': {'key': 'prompts', 'type': '[PromptDTO]'},
}

def __init__(self, *, is_context_only: bool=None, prompts=None, **kwargs) -> None:
super(ContextDTO, self).__init__(**kwargs)
self.is_context_only = is_context_only
self.prompts = prompts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class PromptDTO(Model):
"""Prompt for an answer.

:param display_order: Index of the prompt - used in ordering of the
prompts
:type display_order: int
:param qna_id: Qna id corresponding to the prompt - if QnaId is present,
QnADTO object is ignored.
:type qna_id: int
:param qna: QnADTO - Either QnaId or QnADTO needs to be present in a
PromptDTO object
:type qna: ~azure.cognitiveservices.knowledge.qnamaker.models.PromptDTOQna
:param display_text: Text displayed to represent a follow up question
prompt
:type display_text: str
"""

_validation = {
'display_text': {'max_length': 200},
}

_attribute_map = {
'display_order': {'key': 'displayOrder', 'type': 'int'},
'qna_id': {'key': 'qnaId', 'type': 'int'},
'qna': {'key': 'qna', 'type': 'PromptDTOQna'},
'display_text': {'key': 'displayText', 'type': 'str'},
}

def __init__(self, **kwargs):
super(PromptDTO, self).__init__(**kwargs)
self.display_order = kwargs.get('display_order', None)
self.qna_id = kwargs.get('qna_id', None)
self.qna = kwargs.get('qna', None)
self.display_text = kwargs.get('display_text', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class PromptDTO(Model):
"""Prompt for an answer.

:param display_order: Index of the prompt - used in ordering of the
prompts
:type display_order: int
:param qna_id: Qna id corresponding to the prompt - if QnaId is present,
QnADTO object is ignored.
:type qna_id: int
:param qna: QnADTO - Either QnaId or QnADTO needs to be present in a
PromptDTO object
:type qna: ~azure.cognitiveservices.knowledge.qnamaker.models.PromptDTOQna
:param display_text: Text displayed to represent a follow up question
prompt
:type display_text: str
"""

_validation = {
'display_text': {'max_length': 200},
}

_attribute_map = {
'display_order': {'key': 'displayOrder', 'type': 'int'},
'qna_id': {'key': 'qnaId', 'type': 'int'},
'qna': {'key': 'qna', 'type': 'PromptDTOQna'},
'display_text': {'key': 'displayText', 'type': 'str'},
}

def __init__(self, *, display_order: int=None, qna_id: int=None, qna=None, display_text: str=None, **kwargs) -> None:
super(PromptDTO, self).__init__(**kwargs)
self.display_order = display_order
self.qna_id = qna_id
self.qna = qna
self.display_text = display_text
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .qn_adto import QnADTO


class PromptDTOQna(QnADTO):
"""QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object.

All required parameters must be populated in order to send to Azure.

:param id: Unique id for the Q-A.
:type id: int
:param answer: Required. Answer text
:type answer: str
:param source: Source from which Q-A was indexed. eg.
https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs
:type source: str
:param questions: Required. List of questions associated with the answer.
:type questions: list[str]
:param metadata: List of metadata associated with the answer.
:type metadata:
list[~azure.cognitiveservices.knowledge.qnamaker.models.MetadataDTO]
:param context: Context of a QnA
:type context:
~azure.cognitiveservices.knowledge.qnamaker.models.QnADTOContext
"""

_validation = {
'answer': {'required': True, 'max_length': 25000, 'min_length': 1},
'source': {'max_length': 300},
'questions': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'int'},
'answer': {'key': 'answer', 'type': 'str'},
'source': {'key': 'source', 'type': 'str'},
'questions': {'key': 'questions', 'type': '[str]'},
'metadata': {'key': 'metadata', 'type': '[MetadataDTO]'},
'context': {'key': 'context', 'type': 'QnADTOContext'},
}

def __init__(self, **kwargs):
super(PromptDTOQna, self).__init__(**kwargs)
Loading