From ab6f3c5c0feab5d3e4326db8a150747ac4e8a2d5 Mon Sep 17 00:00:00 2001 From: antisch Date: Wed, 27 Oct 2021 15:39:46 -0700 Subject: [PATCH 1/9] First GA regen --- .../CHANGELOG.md | 2 +- .../questionanswering/_configuration.py | 2 +- .../ai/language/questionanswering/_patch.py | 28 +- .../_question_answering_client.py | 4 +- .../ai/language/questionanswering/_version.py | 2 +- .../questionanswering/aio/_configuration.py | 2 +- .../aio/_question_answering_client.py | 4 +- .../questionanswering/models/__init__.py | 46 +- .../questionanswering/models/_models.py | 555 ++++++++-------- .../questionanswering/models/_models_py3.py | 618 +++++++++--------- .../_question_answering_client_enums.py | 20 +- 11 files changed, 621 insertions(+), 662 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md index fb5a9e4db1c3..b2cdec3faa0b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0b3 (Unreleased) +## 1.0.0 (Unreleased) ### Features Added diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_configuration.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_configuration.py index 6b3cac6d6fc9..c8394d09e40d 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_configuration.py @@ -47,7 +47,7 @@ def __init__( self.endpoint = endpoint self.credential = credential - self.api_version = "2021-07-15-preview" + self.api_version = "2021-10-01" kwargs.setdefault("sdk_moniker", "ai-language-questionanswering/{}".format(VERSION)) self._configure(**kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py index 3c8363d0e853..8d08b4eb4fdb 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py @@ -20,13 +20,8 @@ def _validate_text_records(records): raise TypeError("Input records cannot be a dict") if not all(isinstance(x, six.string_types) for x in records): - if not all( - isinstance(x, (dict, TextRecord)) - for x in records - ): - raise TypeError( - "Mixing string and dictionary/object record input unsupported." - ) + if not all(isinstance(x, (dict, TextRecord)) for x in records): + raise TypeError("Mixing string and dictionary/object record input unsupported.") request_batch = [] for idx, doc in enumerate(records): @@ -37,6 +32,7 @@ def _validate_text_records(records): request_batch.append(doc) return request_batch + def _get_positional_body(*args, **kwargs): """Verify args and kwargs are valid, and then return the positional body, if users passed it in.""" if len(args) > 1: @@ -48,6 +44,7 @@ def _get_positional_body(*args, **kwargs): ) return args[0] if args else None + def _verify_qna_id_and_question(query_knowledgebase_options): """For query_knowledge_base we require either `question` or `qna_id`.""" try: @@ -57,21 +54,16 @@ def _verify_qna_id_and_question(query_knowledgebase_options): qna_id = query_knowledgebase_options.get("qna_id") or query_knowledgebase_options.get("qnaId") question = query_knowledgebase_options.get("question") if not (qna_id or question): - raise TypeError( - "You need to pass in either `qna_id` or `question`." - ) + raise TypeError("You need to pass in either `qna_id` or `question`.") if qna_id and question: raise TypeError("You can not specify both `qna_id` and `question`.") + def _handle_metadata_filter_conversion(options_input): options = copy.deepcopy(options_input) filters = options.filters if hasattr(options, "filters") else options.get("filters", {}) try: - if ( - filters and - filters.metadata_filter and - filters.metadata_filter.metadata - ): + if filters and filters.metadata_filter and filters.metadata_filter.metadata: metadata_input = filters.metadata_filter.metadata else: metadata_input = None @@ -87,13 +79,9 @@ def _handle_metadata_filter_conversion(options_input): except TypeError: raise ValueError("'metadata' must be a sequence of key-value tuples.") - metadata_modified = [ - {"key": m[0], "value": m[1]} - for m in metadata_input - ] + metadata_modified = [{"key": m[0], "value": m[1]} for m in metadata_input] if in_class: filters.metadata_filter.metadata = metadata_modified else: filters["metadataFilter"]["metadata"] = metadata_modified return options - diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py index 53c04b228d28..69dca9f806e8 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py @@ -25,10 +25,10 @@ class QuestionAnsweringClient(QuestionAnsweringClientOperationsMixin): - """The language service API is a suite of natural language processing (NLP) skills built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and question answering. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. + """The language service API is a suite of natural language processing (NLP) skills built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and question answering. Further documentation can be found in https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview :param endpoint: Supported Cognitive Services endpoint (e.g., - :code:`https://.api.cognitiveservices.azure.com`). + https://.api.cognitiveservices.azure.com). :type endpoint: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_version.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_version.py index 20971492f129..c47f66669f1b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_version.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "1.0.0" diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_configuration.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_configuration.py index ee091c9c9529..1ef4b5faf1ba 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_configuration.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_configuration.py @@ -36,7 +36,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) self.endpoint = endpoint self.credential = credential - self.api_version = "2021-07-15-preview" + self.api_version = "2021-10-01" kwargs.setdefault("sdk_moniker", "ai-language-questionanswering/{}".format(VERSION)) self._configure(**kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_question_answering_client.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_question_answering_client.py index dcc4a2679d9e..600020c18cd8 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_question_answering_client.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/_question_answering_client.py @@ -20,10 +20,10 @@ class QuestionAnsweringClient(QuestionAnsweringClientOperationsMixin): - """The language service API is a suite of natural language processing (NLP) skills built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and question answering. Further documentation can be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview. + """The language service API is a suite of natural language processing (NLP) skills built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and question answering. Further documentation can be found in https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview :param endpoint: Supported Cognitive Services endpoint (e.g., - :code:`https://.api.cognitiveservices.azure.com`). + https://.api.cognitiveservices.azure.com). :type endpoint: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/__init__.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/__init__.py index e7f241830c2f..86f39c6e9b59 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/__init__.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/__init__.py @@ -8,68 +8,64 @@ try: from ._models_py3 import AnswerSpan - from ._models_py3 import AnswerSpanRequest + from ._models_py3 import AnswersFromTextOptions + from ._models_py3 import AnswersFromTextResult + from ._models_py3 import AnswersOptions + from ._models_py3 import AnswersResult from ._models_py3 import Error from ._models_py3 import ErrorResponse from ._models_py3 import InnerErrorModel from ._models_py3 import KnowledgeBaseAnswer + from ._models_py3 import KnowledgeBaseAnswerContext from ._models_py3 import KnowledgeBaseAnswerDialog from ._models_py3 import KnowledgeBaseAnswerPrompt - from ._models_py3 import KnowledgeBaseAnswerRequestContext - from ._models_py3 import KnowledgeBaseAnswers from ._models_py3 import MetadataFilter from ._models_py3 import QueryFilters - from ._models_py3 import QueryKnowledgeBaseOptions - from ._models_py3 import QueryTextOptions + from ._models_py3 import ShortAnswerOptions from ._models_py3 import TextAnswer - from ._models_py3 import TextAnswers - from ._models_py3 import TextRecord + from ._models_py3 import TextDocument except (SyntaxError, ImportError): from ._models import AnswerSpan # type: ignore - from ._models import AnswerSpanRequest # type: ignore + from ._models import AnswersFromTextOptions # type: ignore + from ._models import AnswersFromTextResult # type: ignore + from ._models import AnswersOptions # type: ignore + from ._models import AnswersResult # type: ignore from ._models import Error # type: ignore from ._models import ErrorResponse # type: ignore from ._models import InnerErrorModel # type: ignore from ._models import KnowledgeBaseAnswer # type: ignore + from ._models import KnowledgeBaseAnswerContext # type: ignore from ._models import KnowledgeBaseAnswerDialog # type: ignore from ._models import KnowledgeBaseAnswerPrompt # type: ignore - from ._models import KnowledgeBaseAnswerRequestContext # type: ignore - from ._models import KnowledgeBaseAnswers # type: ignore from ._models import MetadataFilter # type: ignore from ._models import QueryFilters # type: ignore - from ._models import QueryKnowledgeBaseOptions # type: ignore - from ._models import QueryTextOptions # type: ignore + from ._models import ShortAnswerOptions # type: ignore from ._models import TextAnswer # type: ignore - from ._models import TextAnswers # type: ignore - from ._models import TextRecord # type: ignore + from ._models import TextDocument # type: ignore from ._question_answering_client_enums import ( ErrorCode, InnerErrorCode, - LogicalOperationKind, - RankerType, ) __all__ = [ "AnswerSpan", - "AnswerSpanRequest", + "AnswersFromTextOptions", + "AnswersFromTextResult", + "AnswersOptions", + "AnswersResult", "Error", "ErrorResponse", "InnerErrorModel", "KnowledgeBaseAnswer", + "KnowledgeBaseAnswerContext", "KnowledgeBaseAnswerDialog", "KnowledgeBaseAnswerPrompt", - "KnowledgeBaseAnswerRequestContext", - "KnowledgeBaseAnswers", "MetadataFilter", "QueryFilters", - "QueryKnowledgeBaseOptions", - "QueryTextOptions", + "ShortAnswerOptions", "TextAnswer", - "TextAnswers", - "TextRecord", + "TextDocument", "ErrorCode", "InnerErrorCode", - "LogicalOperationKind", - "RankerType", ] diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py index 84ccf8bc1cf3..7ab57888662b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py @@ -10,13 +10,159 @@ import msrest.serialization +class AnswersFromTextOptions(msrest.serialization.Model): + """The question and text record parameters to answer. + + All required parameters must be populated in order to send to Azure. + + :ivar question: Required. User question to query against the given text records. + :vartype question: str + :ivar text_documents: Required. Text records to be searched for given question. + :vartype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :ivar language: Language of the text records. This is BCP-47 representation of a language. For + example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. + :vartype language: str + """ + + _validation = { + "question": {"required": True}, + "text_documents": {"required": True}, + } + + _attribute_map = { + "question": {"key": "question", "type": "str"}, + "text_documents": {"key": "records", "type": "[TextDocument]"}, + "language": {"key": "language", "type": "str"}, + } + + def __init__(self, **kwargs): + """ + :keyword question: Required. User question to query against the given text records. + :paramtype question: str + :keyword text_documents: Required. Text records to be searched for given question. + :paramtype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :keyword language: Language of the text records. This is BCP-47 representation of a language. + For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. + :paramtype language: str + """ + super(AnswersFromTextOptions, self).__init__(**kwargs) + self.question = kwargs["question"] + self.text_documents = kwargs["text_documents"] + self.language = kwargs.get("language", None) + + +class AnswersFromTextResult(msrest.serialization.Model): + """Represents the answer results. + + :ivar answers: Represents the answer results. + :vartype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] + """ + + _attribute_map = { + "answers": {"key": "answers", "type": "[TextAnswer]"}, + } + + def __init__(self, **kwargs): + """ + :keyword answers: Represents the answer results. + :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] + """ + super(AnswersFromTextResult, self).__init__(**kwargs) + self.answers = kwargs.get("answers", None) + + +class AnswersOptions(msrest.serialization.Model): + """Parameters to query a knowledge base. + + :ivar qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + question. + :vartype qna_id: int + :ivar question: User question to query against the knowledge base. + :vartype question: str + :ivar top: Max number of answers to be returned for the question. + :vartype top: int + :ivar user_id: Unique identifier for the user. + :vartype user_id: str + :ivar confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. + :vartype confidence_threshold: float + :ivar context: Context object with previous QnA's information. + :vartype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :ivar ranker_kind: Type of ranker to be used. Possible + values include: "Default", "QuestionOnly". + :vartype ranker_kind: str + :ivar filters: Filter QnAs based on given metadata list and knowledge base sources. + :vartype filters: ~azure.ai.language.questionanswering.models.QueryFilters + :ivar short_answer_options: To configure Answer span prediction feature. + :vartype short_answer_options: ~azure.ai.language.questionanswering.models.ShortAnswerOptions + :ivar include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. + :vartype include_unstructured_sources: bool + """ + + _validation = { + "confidence_threshold": {"maximum": 1, "minimum": 0}, + } + + _attribute_map = { + "qna_id": {"key": "qnaId", "type": "int"}, + "question": {"key": "question", "type": "str"}, + "top": {"key": "top", "type": "int"}, + "user_id": {"key": "userId", "type": "str"}, + "confidence_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, + "context": {"key": "context", "type": "KnowledgeBaseAnswerContext"}, + "ranker_kind": {"key": "rankerType", "type": "str"}, + "filters": {"key": "filters", "type": "QueryFilters"}, + "short_answer_options": {"key": "answerSpanRequest", "type": "ShortAnswerOptions"}, + "include_unstructured_sources": {"key": "includeUnstructuredSources", "type": "bool"}, + } + + def __init__(self, **kwargs): + """ + :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + question. + :paramtype qna_id: int + :keyword question: User question to query against the knowledge base. + :paramtype question: str + :keyword top: Max number of answers to be returned for the question. + :paramtype top: int + :keyword user_id: Unique identifier for the user. + :paramtype user_id: str + :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. + :paramtype confidence_threshold: float + :keyword context: Context object with previous QnA's information. + :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword ranker_kind: Type of ranker to be used. Possible + values include: "Default", "QuestionOnly". + :paramtype ranker_kind: str + :keyword filters: Filter QnAs based on given metadata list and knowledge base sources. + :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters + :keyword short_answer_options: To configure Answer span prediction feature. + :paramtype short_answer_options: ~azure.ai.language.questionanswering.models.ShortAnswerOptions + :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured + Sources. + :paramtype include_unstructured_sources: bool + """ + super(AnswersOptions, 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.confidence_threshold = kwargs.get("confidence_threshold", None) + self.context = kwargs.get("context", None) + self.ranker_kind = kwargs.get("ranker_kind", None) + self.filters = kwargs.get("filters", None) + self.short_answer_options = kwargs.get("short_answer_options", None) + self.include_unstructured_sources = kwargs.get("include_unstructured_sources", None) + + class AnswerSpan(msrest.serialization.Model): """Answer span object of QnA. :ivar text: Predicted text of answer span. :vartype text: str - :ivar confidence_score: Predicted score of answer span, value ranges from 0 to 1. - :vartype confidence_score: float + :ivar confidence: Predicted score of answer span, value ranges from 0 to 1. + :vartype confidence: float :ivar offset: The answer span offset from the start of answer. :vartype offset: int :ivar length: The length of the answer span. @@ -24,12 +170,12 @@ class AnswerSpan(msrest.serialization.Model): """ _validation = { - "confidence_score": {"maximum": 1, "minimum": 0}, + "confidence": {"maximum": 1, "minimum": 0}, } _attribute_map = { "text": {"key": "text", "type": "str"}, - "confidence_score": {"key": "confidenceScore", "type": "float"}, + "confidence": {"key": "confidenceScore", "type": "float"}, "offset": {"key": "offset", "type": "int"}, "length": {"key": "length", "type": "int"}, } @@ -38,8 +184,8 @@ def __init__(self, **kwargs): """ :keyword text: Predicted text of answer span. :paramtype text: str - :keyword confidence_score: Predicted score of answer span, value ranges from 0 to 1. - :paramtype confidence_score: float + :keyword confidence: Predicted score of answer span, value ranges from 0 to 1. + :paramtype confidence: float :keyword offset: The answer span offset from the start of answer. :paramtype offset: int :keyword length: The length of the answer span. @@ -47,50 +193,29 @@ def __init__(self, **kwargs): """ super(AnswerSpan, self).__init__(**kwargs) self.text = kwargs.get("text", None) - self.confidence_score = kwargs.get("confidence_score", None) + self.confidence = kwargs.get("confidence", None) self.offset = kwargs.get("offset", None) self.length = kwargs.get("length", None) -class AnswerSpanRequest(msrest.serialization.Model): - """To configure Answer span prediction feature. +class AnswersResult(msrest.serialization.Model): + """Represents List of Question Answers. - :ivar enable: Enable or disable Answer Span prediction. - :vartype enable: bool - :ivar confidence_score_threshold: Minimum threshold score required to include an answer span, - value ranges from 0 to 1. - :vartype confidence_score_threshold: float - :ivar top_answers_with_span: Number of Top answers to be considered for span prediction from 1 - to 10. - :vartype top_answers_with_span: int + :ivar answers: Represents Answer Result list. + :vartype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] """ - _validation = { - "confidence_score_threshold": {"maximum": 1, "minimum": 0}, - "top_answers_with_span": {"maximum": 10, "minimum": 1}, - } - _attribute_map = { - "enable": {"key": "enable", "type": "bool"}, - "confidence_score_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, - "top_answers_with_span": {"key": "topAnswersWithSpan", "type": "int"}, + "answers": {"key": "answers", "type": "[KnowledgeBaseAnswer]"}, } def __init__(self, **kwargs): """ - :keyword enable: Enable or disable Answer Span prediction. - :paramtype enable: bool - :keyword confidence_score_threshold: Minimum threshold score required to include an answer - span, value ranges from 0 to 1. - :paramtype confidence_score_threshold: float - :keyword top_answers_with_span: Number of Top answers to be considered for span prediction from - 1 to 10. - :paramtype top_answers_with_span: int + :keyword answers: Represents Answer Result list. + :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] """ - super(AnswerSpanRequest, self).__init__(**kwargs) - self.enable = kwargs.get("enable", None) - self.confidence_score_threshold = kwargs.get("confidence_score_threshold", None) - self.top_answers_with_span = kwargs.get("top_answers_with_span", None) + super(AnswersResult, self).__init__(**kwargs) + self.answers = kwargs.get("answers", None) class Error(msrest.serialization.Model): @@ -100,7 +225,9 @@ class Error(msrest.serialization.Model): :ivar code: Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound", - "TooManyRequests", "InternalServerError", "ServiceUnavailable". + "ProjectNotFound", "OperationNotFound", "AzureCognitiveSearchNotFound", + "AzureCognitiveSearchIndexNotFound", "TooManyRequests", "AzureCognitiveSearchThrottling", + "AzureCognitiveSearchIndexLimitReached", "InternalServerError", "ServiceUnavailable". :vartype code: str or ~azure.ai.language.questionanswering.models.ErrorCode :ivar message: Required. A human-readable representation of the error. :vartype message: str @@ -130,7 +257,9 @@ def __init__(self, **kwargs): """ :keyword code: Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound", - "TooManyRequests", "InternalServerError", "ServiceUnavailable". + "ProjectNotFound", "OperationNotFound", "AzureCognitiveSearchNotFound", + "AzureCognitiveSearchIndexNotFound", "TooManyRequests", "AzureCognitiveSearchThrottling", + "AzureCognitiveSearchIndexLimitReached", "InternalServerError", "ServiceUnavailable". :paramtype code: str or ~azure.ai.language.questionanswering.models.ErrorCode :keyword message: Required. A human-readable representation of the error. :paramtype message: str @@ -230,14 +359,14 @@ def __init__(self, **kwargs): class KnowledgeBaseAnswer(msrest.serialization.Model): """Represents knowledge base answer. - :ivar questions: List of questions. + :ivar questions: List of questions associated with the answer. :vartype questions: list[str] - :ivar answer: The Answer. + :ivar answer: Answer text. :vartype answer: str - :ivar confidence_score: Answer confidence score, value ranges from 0 to 1. - :vartype confidence_score: float - :ivar id: ID of the QnA result. - :vartype id: int + :ivar confidence: Answer confidence score, value ranges from 0 to 1. + :vartype confidence: float + :ivar qna_id: ID of the QnA result. + :vartype qna_id: int :ivar source: Source of QnA result. :vartype source: str :ivar metadata: Metadata associated with the answer, useful to categorize or filter question @@ -245,35 +374,35 @@ class KnowledgeBaseAnswer(msrest.serialization.Model): :vartype metadata: dict[str, str] :ivar dialog: Dialog associated with Answer. :vartype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog - :ivar answer_span: Answer span object of QnA with respect to user's question. - :vartype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :ivar short_answer: Answer span object of QnA with respect to user's question. + :vartype short_answer: ~azure.ai.language.questionanswering.models.AnswerSpan """ _validation = { - "confidence_score": {"maximum": 1, "minimum": 0}, + "confidence": {"maximum": 1, "minimum": 0}, } _attribute_map = { "questions": {"key": "questions", "type": "[str]"}, "answer": {"key": "answer", "type": "str"}, - "confidence_score": {"key": "confidenceScore", "type": "float"}, - "id": {"key": "id", "type": "int"}, + "confidence": {"key": "confidenceScore", "type": "float"}, + "qna_id": {"key": "id", "type": "int"}, "source": {"key": "source", "type": "str"}, "metadata": {"key": "metadata", "type": "{str}"}, "dialog": {"key": "dialog", "type": "KnowledgeBaseAnswerDialog"}, - "answer_span": {"key": "answerSpan", "type": "AnswerSpan"}, + "short_answer": {"key": "answerSpan", "type": "AnswerSpan"}, } def __init__(self, **kwargs): """ - :keyword questions: List of questions. + :keyword questions: List of questions associated with the answer. :paramtype questions: list[str] - :keyword answer: The Answer. + :keyword answer: Answer text. :paramtype answer: str - :keyword confidence_score: Answer confidence score, value ranges from 0 to 1. - :paramtype confidence_score: float - :keyword id: ID of the QnA result. - :paramtype id: int + :keyword confidence: Answer confidence score, value ranges from 0 to 1. + :paramtype confidence: float + :keyword qna_id: ID of the QnA result. + :paramtype qna_id: int :keyword source: Source of QnA result. :paramtype source: str :keyword metadata: Metadata associated with the answer, useful to categorize or filter question @@ -281,18 +410,50 @@ def __init__(self, **kwargs): :paramtype metadata: dict[str, str] :keyword dialog: Dialog associated with Answer. :paramtype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog - :keyword answer_span: Answer span object of QnA with respect to user's question. - :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :keyword short_answer: Answer span object of QnA with respect to user's question. + :paramtype short_answer: ~azure.ai.language.questionanswering.models.AnswerSpan """ super(KnowledgeBaseAnswer, self).__init__(**kwargs) self.questions = kwargs.get("questions", None) self.answer = kwargs.get("answer", None) - self.confidence_score = kwargs.get("confidence_score", None) - self.id = kwargs.get("id", None) + self.confidence = kwargs.get("confidence", None) + self.qna_id = kwargs.get("qna_id", None) self.source = kwargs.get("source", None) self.metadata = kwargs.get("metadata", None) self.dialog = kwargs.get("dialog", None) - self.answer_span = kwargs.get("answer_span", None) + self.short_answer = kwargs.get("short_answer", None) + + +class KnowledgeBaseAnswerContext(msrest.serialization.Model): + """Context object with previous QnA's information. + + All required parameters must be populated in order to send to Azure. + + :ivar previous_qna_id: Required. Previous turn top answer result QnA ID. + :vartype previous_qna_id: int + :ivar previous_question: Previous user query. + :vartype previous_question: str + """ + + _validation = { + "previous_qna_id": {"required": True}, + } + + _attribute_map = { + "previous_qna_id": {"key": "previousQnaId", "type": "int"}, + "previous_question": {"key": "previousUserQuery", "type": "str"}, + } + + def __init__(self, **kwargs): + """ + :keyword previous_qna_id: Required. Previous turn top answer result QnA ID. + :paramtype previous_qna_id: int + :keyword previous_question: Previous user query. + :paramtype previous_question: str + """ + super(KnowledgeBaseAnswerContext, self).__init__(**kwargs) + self.previous_qna_id = kwargs["previous_qna_id"] + self.previous_question = kwargs.get("previous_question", None) class KnowledgeBaseAnswerDialog(msrest.serialization.Model): @@ -302,7 +463,7 @@ class KnowledgeBaseAnswerDialog(msrest.serialization.Model): true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. :vartype is_context_only: bool - :ivar prompts: List of 0 to 20 prompts associated with the answer. + :ivar prompts: List of prompts associated with the answer. :vartype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt] """ @@ -321,7 +482,7 @@ def __init__(self, **kwargs): If true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. :paramtype is_context_only: bool - :keyword prompts: List of 0 to 20 prompts associated with the answer. + :keyword prompts: List of prompts associated with the answer. :paramtype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt] """ super(KnowledgeBaseAnswerDialog, self).__init__(**kwargs) @@ -365,58 +526,6 @@ def __init__(self, **kwargs): self.display_text = kwargs.get("display_text", None) -class KnowledgeBaseAnswerRequestContext(msrest.serialization.Model): - """Context object with previous QnA's information. - - All required parameters must be populated in order to send to Azure. - - :ivar previous_qna_id: Required. Previous turn top answer result QnA ID. - :vartype previous_qna_id: int - :ivar previous_user_query: Previous user query. - :vartype previous_user_query: str - """ - - _validation = { - "previous_qna_id": {"required": True}, - } - - _attribute_map = { - "previous_qna_id": {"key": "previousQnaId", "type": "int"}, - "previous_user_query": {"key": "previousUserQuery", "type": "str"}, - } - - def __init__(self, **kwargs): - """ - :keyword previous_qna_id: Required. Previous turn top answer result QnA ID. - :paramtype previous_qna_id: int - :keyword previous_user_query: Previous user query. - :paramtype previous_user_query: str - """ - super(KnowledgeBaseAnswerRequestContext, self).__init__(**kwargs) - self.previous_qna_id = kwargs["previous_qna_id"] - self.previous_user_query = kwargs.get("previous_user_query", None) - - -class KnowledgeBaseAnswers(msrest.serialization.Model): - """Represents List of Question Answers. - - :ivar answers: Represents Answer Result list. - :vartype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] - """ - - _attribute_map = { - "answers": {"key": "answers", "type": "[KnowledgeBaseAnswer]"}, - } - - def __init__(self, **kwargs): - """ - :keyword answers: Represents Answer Result list. - :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] - """ - super(KnowledgeBaseAnswers, self).__init__(**kwargs) - self.answers = kwargs.get("answers", None) - - class MetadataFilter(msrest.serialization.Model): """Find QnAs that are associated with the given list of metadata. @@ -424,8 +533,7 @@ class MetadataFilter(msrest.serialization.Model): :vartype metadata: list[tuple[str, str]] :ivar logical_operation: Operation used to join metadata filters. Possible values include: "AND", "OR". - :vartype logical_operation: str or - ~azure.ai.language.questionanswering.models.LogicalOperationKind + :vartype logical_operation: str """ _attribute_map = { @@ -439,8 +547,7 @@ def __init__(self, **kwargs): :paramtype metadata: list[tuple[str, str]] :keyword logical_operation: Operation used to join metadata filters. Possible values include: "AND", "OR". - :paramtype logical_operation: str or - ~azure.ai.language.questionanswering.models.LogicalOperationKind + :paramtype logical_operation: str """ super(MetadataFilter, self).__init__(**kwargs) self.metadata = kwargs.get("metadata", None) @@ -452,13 +559,12 @@ class QueryFilters(msrest.serialization.Model): :ivar metadata_filter: Find QnAs that are associated with the given list of metadata. :vartype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter - :ivar source_filter: Find QnAs that are associated with the given list of sources in knowledge - base. + :ivar source_filter: Find QnAs that are associated with any of the given list of sources in + knowledge base. :vartype source_filter: list[str] - :ivar logical_operation: Logical operation used to join metadata filters with source filters. + :ivar logical_operation: Logical operation used to join metadata filter with source filter. Possible values include: "AND", "OR". - :vartype logical_operation: str or - ~azure.ai.language.questionanswering.models.LogicalOperationKind + :vartype logical_operation: str """ _attribute_map = { @@ -471,13 +577,12 @@ def __init__(self, **kwargs): """ :keyword metadata_filter: Find QnAs that are associated with the given list of metadata. :paramtype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter - :keyword source_filter: Find QnAs that are associated with the given list of sources in + :keyword source_filter: Find QnAs that are associated with any of the given list of sources in knowledge base. :paramtype source_filter: list[str] - :keyword logical_operation: Logical operation used to join metadata filters with source - filters. Possible values include: "AND", "OR". - :paramtype logical_operation: str or - ~azure.ai.language.questionanswering.models.LogicalOperationKind + :keyword logical_operation: Logical operation used to join metadata filter with source filter. + Possible values include: "AND", "OR". + :paramtype logical_operation: str """ super(QueryFilters, self).__init__(**kwargs) self.metadata_filter = kwargs.get("metadata_filter", None) @@ -485,135 +590,47 @@ def __init__(self, **kwargs): self.logical_operation = kwargs.get("logical_operation", None) -class QueryKnowledgeBaseOptions(msrest.serialization.Model): - """The question parameters to answer using a knowledge base. - - :ivar qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over - question. - :vartype qna_id: int - :ivar question: User question to query against the knowledge base. - :vartype question: str - :ivar top: Max number of answers to be returned for the question. - :vartype top: int - :ivar user_id: Unique identifier for the user. - :vartype user_id: str - :ivar confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to - 1. - :vartype confidence_score_threshold: float - :ivar context: Context object with previous QnA's information. - :vartype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :ivar ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible - values include: "Default", "QuestionOnly". - :vartype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :ivar filters: Filter QnAs based on give metadata list and knowledge base source names. - :vartype filters: ~azure.ai.language.questionanswering.models.QueryFilters - :ivar answer_span_request: To configure Answer span prediction feature. - :vartype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :ivar include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. - :vartype include_unstructured_sources: bool - """ - - _validation = { - "confidence_score_threshold": {"maximum": 1, "minimum": 0}, - } - - _attribute_map = { - "qna_id": {"key": "qnaId", "type": "int"}, - "question": {"key": "question", "type": "str"}, - "top": {"key": "top", "type": "int"}, - "user_id": {"key": "userId", "type": "str"}, - "confidence_score_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, - "context": {"key": "context", "type": "KnowledgeBaseAnswerRequestContext"}, - "ranker_type": {"key": "rankerType", "type": "str"}, - "filters": {"key": "filters", "type": "QueryFilters"}, - "answer_span_request": {"key": "answerSpanRequest", "type": "AnswerSpanRequest"}, - "include_unstructured_sources": {"key": "includeUnstructuredSources", "type": "bool"}, - } - - def __init__(self, **kwargs): - """ - :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over - question. - :paramtype qna_id: int - :keyword question: User question to query against the knowledge base. - :paramtype question: str - :keyword top: Max number of answers to be returned for the question. - :paramtype top: int - :keyword user_id: Unique identifier for the user. - :paramtype user_id: str - :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 - to 1. - :paramtype confidence_score_threshold: float - :keyword context: Context object with previous QnA's information. - :paramtype context: - ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. - Possible values include: "Default", "QuestionOnly". - :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :keyword filters: Filter QnAs based on give metadata list and knowledge base source names. - :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters - :keyword answer_span_request: To configure Answer span prediction feature. - :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured - Sources. - :paramtype include_unstructured_sources: bool - """ - super(QueryKnowledgeBaseOptions, 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.confidence_score_threshold = kwargs.get("confidence_score_threshold", None) - self.context = kwargs.get("context", None) - self.ranker_type = kwargs.get("ranker_type", None) - self.filters = kwargs.get("filters", None) - self.answer_span_request = kwargs.get("answer_span_request", None) - self.include_unstructured_sources = kwargs.get("include_unstructured_sources", None) - +class ShortAnswerOptions(msrest.serialization.Model): + """To configure Answer span prediction feature. -class QueryTextOptions(msrest.serialization.Model): - """The question and text record parameters to answer. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar question: Required. User question to query against the given text records. - :vartype question: str - :ivar records: Required. Text records to be searched for given question. - :vartype records: list[~azure.ai.language.questionanswering.models.TextRecord] - :ivar language: Language of the text records. This is BCP-47 representation of a language. For - example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as - default. - :vartype language: str + :ivar enable: Enable or disable Answer Span prediction. Has constant value: True. + :vartype enable: bool + :ivar confidence_threshold: Minimum threshold score required to include an answer span, value + ranges from 0 to 1. + :vartype confidence_threshold: float + :ivar top: Number of Top answers to be considered for span prediction from 1 to 10. + :vartype top: int """ _validation = { - "question": {"required": True}, - "records": {"required": True}, + "enable": {"required": True, "constant": True}, + "confidence_threshold": {"maximum": 1, "minimum": 0}, + "top": {"maximum": 10, "minimum": 1}, } _attribute_map = { - "question": {"key": "question", "type": "str"}, - "records": {"key": "records", "type": "[TextRecord]"}, - "language": {"key": "language", "type": "str"}, - "string_index_type": {"key": "stringIndexType", "type": "str"}, + "enable": {"key": "enable", "type": "bool"}, + "confidence_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, + "top": {"key": "topAnswersWithSpan", "type": "int"}, } + enable = True + def __init__(self, **kwargs): """ - :keyword question: Required. User question to query against the given text records. - :paramtype question: str - :keyword records: Required. Text records to be searched for given question. - :paramtype records: list[~azure.ai.language.questionanswering.models.TextRecord] - :keyword language: Language of the text records. This is BCP-47 representation of a language. - For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as - default. - :paramtype language: str + :keyword confidence_threshold: Minimum threshold score required to include an answer span, + value ranges from 0 to 1. + :paramtype confidence_threshold: float + :keyword top: Number of Top answers to be considered for span prediction from 1 to 10. + :paramtype top: int """ - super(QueryTextOptions, self).__init__(**kwargs) - self.question = kwargs["question"] - self.records = kwargs["records"] - self.language = kwargs.get("language", None) - self.string_index_type = "UnicodeCodePoint" + super(ShortAnswerOptions, self).__init__(**kwargs) + self.confidence_threshold = kwargs.get("confidence_threshold", None) + self.top = kwargs.get("top", None) class TextAnswer(msrest.serialization.Model): @@ -621,12 +638,12 @@ class TextAnswer(msrest.serialization.Model): :ivar answer: Answer. :vartype answer: str - :ivar confidence_score: answer confidence score, value ranges from 0 to 1. - :vartype confidence_score: float + :ivar confidence: answer confidence score, value ranges from 0 to 1. + :vartype confidence: float :ivar id: record ID. :vartype id: str - :ivar answer_span: Answer span object with respect to user's question. - :vartype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :ivar short_answer: Answer span object with respect to user's question. + :vartype short_answer: ~azure.ai.language.questionanswering.models.AnswerSpan :ivar offset: The sentence offset from the start of the document. :vartype offset: int :ivar length: The length of the sentence. @@ -634,14 +651,14 @@ class TextAnswer(msrest.serialization.Model): """ _validation = { - "confidence_score": {"maximum": 1, "minimum": 0}, + "confidence": {"maximum": 1, "minimum": 0}, } _attribute_map = { "answer": {"key": "answer", "type": "str"}, - "confidence_score": {"key": "confidenceScore", "type": "float"}, + "confidence": {"key": "confidenceScore", "type": "float"}, "id": {"key": "id", "type": "str"}, - "answer_span": {"key": "answerSpan", "type": "AnswerSpan"}, + "short_answer": {"key": "answerSpan", "type": "AnswerSpan"}, "offset": {"key": "offset", "type": "int"}, "length": {"key": "length", "type": "int"}, } @@ -650,12 +667,12 @@ def __init__(self, **kwargs): """ :keyword answer: Answer. :paramtype answer: str - :keyword confidence_score: answer confidence score, value ranges from 0 to 1. - :paramtype confidence_score: float + :keyword confidence: answer confidence score, value ranges from 0 to 1. + :paramtype confidence: float :keyword id: record ID. :paramtype id: str - :keyword answer_span: Answer span object with respect to user's question. - :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :keyword short_answer: Answer span object with respect to user's question. + :paramtype short_answer: ~azure.ai.language.questionanswering.models.AnswerSpan :keyword offset: The sentence offset from the start of the document. :paramtype offset: int :keyword length: The length of the sentence. @@ -663,34 +680,14 @@ def __init__(self, **kwargs): """ super(TextAnswer, self).__init__(**kwargs) self.answer = kwargs.get("answer", None) - self.confidence_score = kwargs.get("confidence_score", None) + self.confidence = kwargs.get("confidence", None) self.id = kwargs.get("id", None) - self.answer_span = kwargs.get("answer_span", None) + self.short_answer = kwargs.get("short_answer", None) self.offset = kwargs.get("offset", None) self.length = kwargs.get("length", None) -class TextAnswers(msrest.serialization.Model): - """Represents the answer results. - - :ivar answers: Represents the answer results. - :vartype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] - """ - - _attribute_map = { - "answers": {"key": "answers", "type": "[TextAnswer]"}, - } - - def __init__(self, **kwargs): - """ - :keyword answers: Represents the answer results. - :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] - """ - super(TextAnswers, self).__init__(**kwargs) - self.answers = kwargs.get("answers", None) - - -class TextRecord(msrest.serialization.Model): +class TextDocument(msrest.serialization.Model): """Represent input text record to be queried. All required parameters must be populated in order to send to Azure. @@ -718,6 +715,6 @@ def __init__(self, **kwargs): :keyword text: Required. Text contents of the record. :paramtype text: str """ - super(TextRecord, self).__init__(**kwargs) + super(TextDocument, self).__init__(**kwargs) self.id = kwargs["id"] self.text = kwargs["text"] diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py index b47059398432..42858666f97f 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py @@ -14,13 +14,175 @@ from ._question_answering_client_enums import * +class AnswersFromTextOptions(msrest.serialization.Model): + """The question and text record parameters to answer. + + All required parameters must be populated in order to send to Azure. + + :ivar question: Required. User question to query against the given text records. + :vartype question: str + :ivar text_documents: Required. Text records to be searched for given question. + :vartype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :ivar language: Language of the text records. This is BCP-47 representation of a language. For + example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. + :vartype language: str + """ + + _validation = { + "question": {"required": True}, + "text_documents": {"required": True}, + } + + _attribute_map = { + "question": {"key": "question", "type": "str"}, + "text_documents": {"key": "records", "type": "[TextDocument]"}, + "language": {"key": "language", "type": "str"}, + } + + def __init__( + self, *, question: str, text_documents: List["TextDocument"], language: Optional[str] = None, **kwargs + ): + """ + :keyword question: Required. User question to query against the given text records. + :paramtype question: str + :keyword text_documents: Required. Text records to be searched for given question. + :paramtype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :keyword language: Language of the text records. This is BCP-47 representation of a language. + For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. + :paramtype language: str + """ + super(AnswersFromTextOptions, self).__init__(**kwargs) + self.question = question + self.text_documents = text_documents + self.language = language + + +class AnswersFromTextResult(msrest.serialization.Model): + """Represents the answer results. + + :ivar answers: Represents the answer results. + :vartype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] + """ + + _attribute_map = { + "answers": {"key": "answers", "type": "[TextAnswer]"}, + } + + def __init__(self, *, answers: Optional[List["TextAnswer"]] = None, **kwargs): + """ + :keyword answers: Represents the answer results. + :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] + """ + super(AnswersFromTextResult, self).__init__(**kwargs) + self.answers = answers + + +class AnswersOptions(msrest.serialization.Model): + """Parameters to query a knowledge base. + + :ivar qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + question. + :vartype qna_id: int + :ivar question: User question to query against the knowledge base. + :vartype question: str + :ivar top: Max number of answers to be returned for the question. + :vartype top: int + :ivar user_id: Unique identifier for the user. + :vartype user_id: str + :ivar confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. + :vartype confidence_threshold: float + :ivar context: Context object with previous QnA's information. + :vartype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :ivar ranker_kind: Type of ranker to be used. Possible + values include: "Default", "QuestionOnly". + :vartype ranker_kind: str + :ivar filters: Filter QnAs based on given metadata list and knowledge base sources. + :vartype filters: ~azure.ai.language.questionanswering.models.QueryFilters + :ivar short_answer_options: To configure Answer span prediction feature. + :vartype short_answer_options: ~azure.ai.language.questionanswering.models.ShortAnswerOptions + :ivar include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. + :vartype include_unstructured_sources: bool + """ + + _validation = { + "confidence_threshold": {"maximum": 1, "minimum": 0}, + } + + _attribute_map = { + "qna_id": {"key": "qnaId", "type": "int"}, + "question": {"key": "question", "type": "str"}, + "top": {"key": "top", "type": "int"}, + "user_id": {"key": "userId", "type": "str"}, + "confidence_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, + "context": {"key": "context", "type": "KnowledgeBaseAnswerContext"}, + "ranker_kind": {"key": "rankerType", "type": "str"}, + "filters": {"key": "filters", "type": "QueryFilters"}, + "short_answer_options": {"key": "answerSpanRequest", "type": "ShortAnswerOptions"}, + "include_unstructured_sources": {"key": "includeUnstructuredSources", "type": "bool"}, + } + + def __init__( + self, + *, + qna_id: Optional[int] = None, + question: Optional[str] = None, + top: Optional[int] = None, + user_id: Optional[str] = None, + confidence_threshold: Optional[float] = None, + context: Optional["KnowledgeBaseAnswerContext"] = None, + ranker_kind: Optional[str] = None, + filters: Optional["QueryFilters"] = None, + short_answer_options: Optional["ShortAnswerOptions"] = None, + include_unstructured_sources: Optional[bool] = None, + **kwargs + ): + """ + :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + question. + :paramtype qna_id: int + :keyword question: User question to query against the knowledge base. + :paramtype question: str + :keyword top: Max number of answers to be returned for the question. + :paramtype top: int + :keyword user_id: Unique identifier for the user. + :paramtype user_id: str + :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. + :paramtype confidence_threshold: float + :keyword context: Context object with previous QnA's information. + :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword ranker_kind: Type of ranker to be used. Possible + values include: "Default", "QuestionOnly". + :paramtype ranker_kind: str + :keyword filters: Filter QnAs based on given metadata list and knowledge base sources. + :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters + :keyword short_answer_options: To configure Answer span prediction feature. + :paramtype short_answer_options: ~azure.ai.language.questionanswering.models.ShortAnswerOptions + :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured + Sources. + :paramtype include_unstructured_sources: bool + """ + super(AnswersOptions, self).__init__(**kwargs) + self.qna_id = qna_id + self.question = question + self.top = top + self.user_id = user_id + self.confidence_threshold = confidence_threshold + self.context = context + self.ranker_kind = ranker_kind + self.filters = filters + self.short_answer_options = short_answer_options + self.include_unstructured_sources = include_unstructured_sources + + class AnswerSpan(msrest.serialization.Model): """Answer span object of QnA. :ivar text: Predicted text of answer span. :vartype text: str - :ivar confidence_score: Predicted score of answer span, value ranges from 0 to 1. - :vartype confidence_score: float + :ivar confidence: Predicted score of answer span, value ranges from 0 to 1. + :vartype confidence: float :ivar offset: The answer span offset from the start of answer. :vartype offset: int :ivar length: The length of the answer span. @@ -28,12 +190,12 @@ class AnswerSpan(msrest.serialization.Model): """ _validation = { - "confidence_score": {"maximum": 1, "minimum": 0}, + "confidence": {"maximum": 1, "minimum": 0}, } _attribute_map = { "text": {"key": "text", "type": "str"}, - "confidence_score": {"key": "confidenceScore", "type": "float"}, + "confidence": {"key": "confidenceScore", "type": "float"}, "offset": {"key": "offset", "type": "int"}, "length": {"key": "length", "type": "int"}, } @@ -42,7 +204,7 @@ def __init__( self, *, text: Optional[str] = None, - confidence_score: Optional[float] = None, + confidence: Optional[float] = None, offset: Optional[int] = None, length: Optional[int] = None, **kwargs @@ -50,8 +212,8 @@ def __init__( """ :keyword text: Predicted text of answer span. :paramtype text: str - :keyword confidence_score: Predicted score of answer span, value ranges from 0 to 1. - :paramtype confidence_score: float + :keyword confidence: Predicted score of answer span, value ranges from 0 to 1. + :paramtype confidence: float :keyword offset: The answer span offset from the start of answer. :paramtype offset: int :keyword length: The length of the answer span. @@ -59,57 +221,29 @@ def __init__( """ super(AnswerSpan, self).__init__(**kwargs) self.text = text - self.confidence_score = confidence_score + self.confidence = confidence self.offset = offset self.length = length -class AnswerSpanRequest(msrest.serialization.Model): - """To configure Answer span prediction feature. +class AnswersResult(msrest.serialization.Model): + """Represents List of Question Answers. - :ivar enable: Enable or disable Answer Span prediction. - :vartype enable: bool - :ivar confidence_score_threshold: Minimum threshold score required to include an answer span, - value ranges from 0 to 1. - :vartype confidence_score_threshold: float - :ivar top_answers_with_span: Number of Top answers to be considered for span prediction from 1 - to 10. - :vartype top_answers_with_span: int + :ivar answers: Represents Answer Result list. + :vartype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] """ - _validation = { - "confidence_score_threshold": {"maximum": 1, "minimum": 0}, - "top_answers_with_span": {"maximum": 10, "minimum": 1}, - } - _attribute_map = { - "enable": {"key": "enable", "type": "bool"}, - "confidence_score_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, - "top_answers_with_span": {"key": "topAnswersWithSpan", "type": "int"}, + "answers": {"key": "answers", "type": "[KnowledgeBaseAnswer]"}, } - def __init__( - self, - *, - enable: Optional[bool] = None, - confidence_score_threshold: Optional[float] = None, - top_answers_with_span: Optional[int] = None, - **kwargs - ): + def __init__(self, *, answers: Optional[List["KnowledgeBaseAnswer"]] = None, **kwargs): """ - :keyword enable: Enable or disable Answer Span prediction. - :paramtype enable: bool - :keyword confidence_score_threshold: Minimum threshold score required to include an answer - span, value ranges from 0 to 1. - :paramtype confidence_score_threshold: float - :keyword top_answers_with_span: Number of Top answers to be considered for span prediction from - 1 to 10. - :paramtype top_answers_with_span: int + :keyword answers: Represents Answer Result list. + :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] """ - super(AnswerSpanRequest, self).__init__(**kwargs) - self.enable = enable - self.confidence_score_threshold = confidence_score_threshold - self.top_answers_with_span = top_answers_with_span + super(AnswersResult, self).__init__(**kwargs) + self.answers = answers class Error(msrest.serialization.Model): @@ -119,7 +253,9 @@ class Error(msrest.serialization.Model): :ivar code: Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound", - "TooManyRequests", "InternalServerError", "ServiceUnavailable". + "ProjectNotFound", "OperationNotFound", "AzureCognitiveSearchNotFound", + "AzureCognitiveSearchIndexNotFound", "TooManyRequests", "AzureCognitiveSearchThrottling", + "AzureCognitiveSearchIndexLimitReached", "InternalServerError", "ServiceUnavailable". :vartype code: str or ~azure.ai.language.questionanswering.models.ErrorCode :ivar message: Required. A human-readable representation of the error. :vartype message: str @@ -158,7 +294,9 @@ def __init__( """ :keyword code: Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound", - "TooManyRequests", "InternalServerError", "ServiceUnavailable". + "ProjectNotFound", "OperationNotFound", "AzureCognitiveSearchNotFound", + "AzureCognitiveSearchIndexNotFound", "TooManyRequests", "AzureCognitiveSearchThrottling", + "AzureCognitiveSearchIndexLimitReached", "InternalServerError", "ServiceUnavailable". :paramtype code: str or ~azure.ai.language.questionanswering.models.ErrorCode :keyword message: Required. A human-readable representation of the error. :paramtype message: str @@ -267,14 +405,14 @@ def __init__( class KnowledgeBaseAnswer(msrest.serialization.Model): """Represents knowledge base answer. - :ivar questions: List of questions. + :ivar questions: List of questions associated with the answer. :vartype questions: list[str] - :ivar answer: The Answer. + :ivar answer: Answer text. :vartype answer: str - :ivar confidence_score: Answer confidence score, value ranges from 0 to 1. - :vartype confidence_score: float - :ivar id: ID of the QnA result. - :vartype id: int + :ivar confidence: Answer confidence score, value ranges from 0 to 1. + :vartype confidence: float + :ivar qna_id: ID of the QnA result. + :vartype qna_id: int :ivar source: Source of QnA result. :vartype source: str :ivar metadata: Metadata associated with the answer, useful to categorize or filter question @@ -282,23 +420,23 @@ class KnowledgeBaseAnswer(msrest.serialization.Model): :vartype metadata: dict[str, str] :ivar dialog: Dialog associated with Answer. :vartype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog - :ivar answer_span: Answer span object of QnA with respect to user's question. - :vartype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :ivar short_answer: Answer span object of QnA with respect to user's question. + :vartype short_answer: ~azure.ai.language.questionanswering.models.AnswerSpan """ _validation = { - "confidence_score": {"maximum": 1, "minimum": 0}, + "confidence": {"maximum": 1, "minimum": 0}, } _attribute_map = { "questions": {"key": "questions", "type": "[str]"}, "answer": {"key": "answer", "type": "str"}, - "confidence_score": {"key": "confidenceScore", "type": "float"}, - "id": {"key": "id", "type": "int"}, + "confidence": {"key": "confidenceScore", "type": "float"}, + "qna_id": {"key": "id", "type": "int"}, "source": {"key": "source", "type": "str"}, "metadata": {"key": "metadata", "type": "{str}"}, "dialog": {"key": "dialog", "type": "KnowledgeBaseAnswerDialog"}, - "answer_span": {"key": "answerSpan", "type": "AnswerSpan"}, + "short_answer": {"key": "answerSpan", "type": "AnswerSpan"}, } def __init__( @@ -306,23 +444,23 @@ def __init__( *, questions: Optional[List[str]] = None, answer: Optional[str] = None, - confidence_score: Optional[float] = None, - id: Optional[int] = None, + confidence: Optional[float] = None, + qna_id: Optional[int] = None, source: Optional[str] = None, metadata: Optional[Dict[str, str]] = None, dialog: Optional["KnowledgeBaseAnswerDialog"] = None, - answer_span: Optional["AnswerSpan"] = None, + short_answer: Optional["AnswerSpan"] = None, **kwargs ): """ - :keyword questions: List of questions. + :keyword questions: List of questions associated with the answer. :paramtype questions: list[str] - :keyword answer: The Answer. + :keyword answer: Answer text. :paramtype answer: str - :keyword confidence_score: Answer confidence score, value ranges from 0 to 1. - :paramtype confidence_score: float - :keyword id: ID of the QnA result. - :paramtype id: int + :keyword confidence: Answer confidence score, value ranges from 0 to 1. + :paramtype confidence: float + :keyword qna_id: ID of the QnA result. + :paramtype qna_id: int :keyword source: Source of QnA result. :paramtype source: str :keyword metadata: Metadata associated with the answer, useful to categorize or filter question @@ -330,18 +468,50 @@ def __init__( :paramtype metadata: dict[str, str] :keyword dialog: Dialog associated with Answer. :paramtype dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog - :keyword answer_span: Answer span object of QnA with respect to user's question. - :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :keyword short_answer: Answer span object of QnA with respect to user's question. + :paramtype short_answer: ~azure.ai.language.questionanswering.models.AnswerSpan """ super(KnowledgeBaseAnswer, self).__init__(**kwargs) self.questions = questions self.answer = answer - self.confidence_score = confidence_score - self.id = id + self.confidence = confidence + self.qna_id = qna_id self.source = source self.metadata = metadata self.dialog = dialog - self.answer_span = answer_span + self.short_answer = short_answer + + +class KnowledgeBaseAnswerContext(msrest.serialization.Model): + """Context object with previous QnA's information. + + All required parameters must be populated in order to send to Azure. + + :ivar previous_qna_id: Required. Previous turn top answer result QnA ID. + :vartype previous_qna_id: int + :ivar previous_question: Previous user query. + :vartype previous_question: str + """ + + _validation = { + "previous_qna_id": {"required": True}, + } + + _attribute_map = { + "previous_qna_id": {"key": "previousQnaId", "type": "int"}, + "previous_question": {"key": "previousUserQuery", "type": "str"}, + } + + def __init__(self, *, previous_qna_id: int, previous_question: Optional[str] = None, **kwargs): + """ + :keyword previous_qna_id: Required. Previous turn top answer result QnA ID. + :paramtype previous_qna_id: int + :keyword previous_question: Previous user query. + :paramtype previous_question: str + """ + super(KnowledgeBaseAnswerContext, self).__init__(**kwargs) + self.previous_qna_id = previous_qna_id + self.previous_question = previous_question class KnowledgeBaseAnswerDialog(msrest.serialization.Model): @@ -351,7 +521,7 @@ class KnowledgeBaseAnswerDialog(msrest.serialization.Model): true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. :vartype is_context_only: bool - :ivar prompts: List of 0 to 20 prompts associated with the answer. + :ivar prompts: List of prompts associated with the answer. :vartype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt] """ @@ -376,7 +546,7 @@ def __init__( If true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. :paramtype is_context_only: bool - :keyword prompts: List of 0 to 20 prompts associated with the answer. + :keyword prompts: List of prompts associated with the answer. :paramtype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt] """ super(KnowledgeBaseAnswerDialog, self).__init__(**kwargs) @@ -427,58 +597,6 @@ def __init__( self.display_text = display_text -class KnowledgeBaseAnswerRequestContext(msrest.serialization.Model): - """Context object with previous QnA's information. - - All required parameters must be populated in order to send to Azure. - - :ivar previous_qna_id: Required. Previous turn top answer result QnA ID. - :vartype previous_qna_id: int - :ivar previous_user_query: Previous user query. - :vartype previous_user_query: str - """ - - _validation = { - "previous_qna_id": {"required": True}, - } - - _attribute_map = { - "previous_qna_id": {"key": "previousQnaId", "type": "int"}, - "previous_user_query": {"key": "previousUserQuery", "type": "str"}, - } - - def __init__(self, *, previous_qna_id: int, previous_user_query: Optional[str] = None, **kwargs): - """ - :keyword previous_qna_id: Required. Previous turn top answer result QnA ID. - :paramtype previous_qna_id: int - :keyword previous_user_query: Previous user query. - :paramtype previous_user_query: str - """ - super(KnowledgeBaseAnswerRequestContext, self).__init__(**kwargs) - self.previous_qna_id = previous_qna_id - self.previous_user_query = previous_user_query - - -class KnowledgeBaseAnswers(msrest.serialization.Model): - """Represents List of Question Answers. - - :ivar answers: Represents Answer Result list. - :vartype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] - """ - - _attribute_map = { - "answers": {"key": "answers", "type": "[KnowledgeBaseAnswer]"}, - } - - def __init__(self, *, answers: Optional[List["KnowledgeBaseAnswer"]] = None, **kwargs): - """ - :keyword answers: Represents Answer Result list. - :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] - """ - super(KnowledgeBaseAnswers, self).__init__(**kwargs) - self.answers = answers - - class MetadataFilter(msrest.serialization.Model): """Find QnAs that are associated with the given list of metadata. @@ -486,8 +604,7 @@ class MetadataFilter(msrest.serialization.Model): :vartype metadata: list[tuple[str, str]] :ivar logical_operation: Operation used to join metadata filters. Possible values include: "AND", "OR". - :vartype logical_operation: str or - ~azure.ai.language.questionanswering.models.LogicalOperationKind + :vartype logical_operation: str """ _attribute_map = { @@ -495,20 +612,13 @@ class MetadataFilter(msrest.serialization.Model): "logical_operation": {"key": "logicalOperation", "type": "str"}, } - def __init__( - self, - *, - metadata: Optional[List[Tuple[str, str]]] = None, - logical_operation: Optional[Union[str, "LogicalOperationKind"]] = None, - **kwargs - ): + def __init__(self, *, metadata: Optional[List[Tuple[str, str]]] = None, logical_operation: Optional[str] = None, **kwargs): """ :keyword metadata: :paramtype metadata: list[tuple[str, str]] :keyword logical_operation: Operation used to join metadata filters. Possible values include: "AND", "OR". - :paramtype logical_operation: str or - ~azure.ai.language.questionanswering.models.LogicalOperationKind + :paramtype logical_operation: str """ super(MetadataFilter, self).__init__(**kwargs) self.metadata = metadata @@ -520,13 +630,12 @@ class QueryFilters(msrest.serialization.Model): :ivar metadata_filter: Find QnAs that are associated with the given list of metadata. :vartype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter - :ivar source_filter: Find QnAs that are associated with the given list of sources in knowledge - base. + :ivar source_filter: Find QnAs that are associated with any of the given list of sources in + knowledge base. :vartype source_filter: list[str] - :ivar logical_operation: Logical operation used to join metadata filters with source filters. + :ivar logical_operation: Logical operation used to join metadata filter with source filter. Possible values include: "AND", "OR". - :vartype logical_operation: str or - ~azure.ai.language.questionanswering.models.LogicalOperationKind + :vartype logical_operation: str """ _attribute_map = { @@ -540,19 +649,18 @@ def __init__( *, metadata_filter: Optional["MetadataFilter"] = None, source_filter: Optional[List[str]] = None, - logical_operation: Optional[Union[str, "LogicalOperationKind"]] = None, + logical_operation: Optional[str] = None, **kwargs ): """ :keyword metadata_filter: Find QnAs that are associated with the given list of metadata. :paramtype metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter - :keyword source_filter: Find QnAs that are associated with the given list of sources in + :keyword source_filter: Find QnAs that are associated with any of the given list of sources in knowledge base. :paramtype source_filter: list[str] - :keyword logical_operation: Logical operation used to join metadata filters with source - filters. Possible values include: "AND", "OR". - :paramtype logical_operation: str or - ~azure.ai.language.questionanswering.models.LogicalOperationKind + :keyword logical_operation: Logical operation used to join metadata filter with source filter. + Possible values include: "AND", "OR". + :paramtype logical_operation: str """ super(QueryFilters, self).__init__(**kwargs) self.metadata_filter = metadata_filter @@ -560,149 +668,47 @@ def __init__( self.logical_operation = logical_operation -class QueryKnowledgeBaseOptions(msrest.serialization.Model): - """The question parameters to answer using a knowledge base. - - :ivar qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over - question. - :vartype qna_id: int - :ivar question: User question to query against the knowledge base. - :vartype question: str - :ivar top: Max number of answers to be returned for the question. - :vartype top: int - :ivar user_id: Unique identifier for the user. - :vartype user_id: str - :ivar confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to - 1. - :vartype confidence_score_threshold: float - :ivar context: Context object with previous QnA's information. - :vartype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :ivar ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible - values include: "Default", "QuestionOnly". - :vartype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :ivar filters: Filter QnAs based on give metadata list and knowledge base source names. - :vartype filters: ~azure.ai.language.questionanswering.models.QueryFilters - :ivar answer_span_request: To configure Answer span prediction feature. - :vartype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :ivar include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. - :vartype include_unstructured_sources: bool - """ - - _validation = { - "confidence_score_threshold": {"maximum": 1, "minimum": 0}, - } - - _attribute_map = { - "qna_id": {"key": "qnaId", "type": "int"}, - "question": {"key": "question", "type": "str"}, - "top": {"key": "top", "type": "int"}, - "user_id": {"key": "userId", "type": "str"}, - "confidence_score_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, - "context": {"key": "context", "type": "KnowledgeBaseAnswerRequestContext"}, - "ranker_type": {"key": "rankerType", "type": "str"}, - "filters": {"key": "filters", "type": "QueryFilters"}, - "answer_span_request": {"key": "answerSpanRequest", "type": "AnswerSpanRequest"}, - "include_unstructured_sources": {"key": "includeUnstructuredSources", "type": "bool"}, - } - - def __init__( - self, - *, - qna_id: Optional[int] = None, - question: Optional[str] = None, - top: Optional[int] = None, - user_id: Optional[str] = None, - confidence_score_threshold: Optional[float] = None, - context: Optional["KnowledgeBaseAnswerRequestContext"] = None, - ranker_type: Optional[Union[str, "RankerType"]] = None, - filters: Optional["QueryFilters"] = None, - answer_span_request: Optional["AnswerSpanRequest"] = None, - include_unstructured_sources: Optional[bool] = None, - **kwargs - ): - """ - :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over - question. - :paramtype qna_id: int - :keyword question: User question to query against the knowledge base. - :paramtype question: str - :keyword top: Max number of answers to be returned for the question. - :paramtype top: int - :keyword user_id: Unique identifier for the user. - :paramtype user_id: str - :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 - to 1. - :paramtype confidence_score_threshold: float - :keyword context: Context object with previous QnA's information. - :paramtype context: - ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. - Possible values include: "Default", "QuestionOnly". - :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :keyword filters: Filter QnAs based on give metadata list and knowledge base source names. - :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters - :keyword answer_span_request: To configure Answer span prediction feature. - :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured - Sources. - :paramtype include_unstructured_sources: bool - """ - super(QueryKnowledgeBaseOptions, self).__init__(**kwargs) - self.qna_id = qna_id - self.question = question - self.top = top - self.user_id = user_id - self.confidence_score_threshold = confidence_score_threshold - self.context = context - self.ranker_type = ranker_type - self.filters = filters - self.answer_span_request = answer_span_request - self.include_unstructured_sources = include_unstructured_sources - +class ShortAnswerOptions(msrest.serialization.Model): + """To configure Answer span prediction feature. -class QueryTextOptions(msrest.serialization.Model): - """The question and text record parameters to answer. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar question: Required. User question to query against the given text records. - :vartype question: str - :ivar records: Required. Text records to be searched for given question. - :vartype records: list[~azure.ai.language.questionanswering.models.TextRecord] - :ivar language: Language of the text records. This is BCP-47 representation of a language. For - example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as - default. - :vartype language: str + :ivar enable: Enable or disable Answer Span prediction. Has constant value: True. + :vartype enable: bool + :ivar confidence_threshold: Minimum threshold score required to include an answer span, value + ranges from 0 to 1. + :vartype confidence_threshold: float + :ivar top: Number of Top answers to be considered for span prediction from 1 to 10. + :vartype top: int """ _validation = { - "question": {"required": True}, - "records": {"required": True}, + "enable": {"required": True, "constant": True}, + "confidence_threshold": {"maximum": 1, "minimum": 0}, + "top": {"maximum": 10, "minimum": 1}, } _attribute_map = { - "question": {"key": "question", "type": "str"}, - "records": {"key": "records", "type": "[TextRecord]"}, - "language": {"key": "language", "type": "str"}, - "string_index_type": {"key": "stringIndexType", "type": "str"}, + "enable": {"key": "enable", "type": "bool"}, + "confidence_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, + "top": {"key": "topAnswersWithSpan", "type": "int"}, } - def __init__(self, *, question: str, records: List["TextRecord"], language: Optional[str] = None, **kwargs): + enable = True + + def __init__(self, *, confidence_threshold: Optional[float] = None, top: Optional[int] = None, **kwargs): """ - :keyword question: Required. User question to query against the given text records. - :paramtype question: str - :keyword records: Required. Text records to be searched for given question. - :paramtype records: list[~azure.ai.language.questionanswering.models.TextRecord] - :keyword language: Language of the text records. This is BCP-47 representation of a language. - For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as - default. - :paramtype language: str + :keyword confidence_threshold: Minimum threshold score required to include an answer span, + value ranges from 0 to 1. + :paramtype confidence_threshold: float + :keyword top: Number of Top answers to be considered for span prediction from 1 to 10. + :paramtype top: int """ - super(QueryTextOptions, self).__init__(**kwargs) - self.question = question - self.records = records - self.language = language - self.string_index_type = "UnicodeCodePoint" + super(ShortAnswerOptions, self).__init__(**kwargs) + self.confidence_threshold = confidence_threshold + self.top = top class TextAnswer(msrest.serialization.Model): @@ -710,12 +716,12 @@ class TextAnswer(msrest.serialization.Model): :ivar answer: Answer. :vartype answer: str - :ivar confidence_score: answer confidence score, value ranges from 0 to 1. - :vartype confidence_score: float + :ivar confidence: answer confidence score, value ranges from 0 to 1. + :vartype confidence: float :ivar id: record ID. :vartype id: str - :ivar answer_span: Answer span object with respect to user's question. - :vartype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :ivar short_answer: Answer span object with respect to user's question. + :vartype short_answer: ~azure.ai.language.questionanswering.models.AnswerSpan :ivar offset: The sentence offset from the start of the document. :vartype offset: int :ivar length: The length of the sentence. @@ -723,14 +729,14 @@ class TextAnswer(msrest.serialization.Model): """ _validation = { - "confidence_score": {"maximum": 1, "minimum": 0}, + "confidence": {"maximum": 1, "minimum": 0}, } _attribute_map = { "answer": {"key": "answer", "type": "str"}, - "confidence_score": {"key": "confidenceScore", "type": "float"}, + "confidence": {"key": "confidenceScore", "type": "float"}, "id": {"key": "id", "type": "str"}, - "answer_span": {"key": "answerSpan", "type": "AnswerSpan"}, + "short_answer": {"key": "answerSpan", "type": "AnswerSpan"}, "offset": {"key": "offset", "type": "int"}, "length": {"key": "length", "type": "int"}, } @@ -739,9 +745,9 @@ def __init__( self, *, answer: Optional[str] = None, - confidence_score: Optional[float] = None, + confidence: Optional[float] = None, id: Optional[str] = None, - answer_span: Optional["AnswerSpan"] = None, + short_answer: Optional["AnswerSpan"] = None, offset: Optional[int] = None, length: Optional[int] = None, **kwargs @@ -749,12 +755,12 @@ def __init__( """ :keyword answer: Answer. :paramtype answer: str - :keyword confidence_score: answer confidence score, value ranges from 0 to 1. - :paramtype confidence_score: float + :keyword confidence: answer confidence score, value ranges from 0 to 1. + :paramtype confidence: float :keyword id: record ID. :paramtype id: str - :keyword answer_span: Answer span object with respect to user's question. - :paramtype answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :keyword short_answer: Answer span object with respect to user's question. + :paramtype short_answer: ~azure.ai.language.questionanswering.models.AnswerSpan :keyword offset: The sentence offset from the start of the document. :paramtype offset: int :keyword length: The length of the sentence. @@ -762,34 +768,14 @@ def __init__( """ super(TextAnswer, self).__init__(**kwargs) self.answer = answer - self.confidence_score = confidence_score + self.confidence = confidence self.id = id - self.answer_span = answer_span + self.short_answer = short_answer self.offset = offset self.length = length -class TextAnswers(msrest.serialization.Model): - """Represents the answer results. - - :ivar answers: Represents the answer results. - :vartype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] - """ - - _attribute_map = { - "answers": {"key": "answers", "type": "[TextAnswer]"}, - } - - def __init__(self, *, answers: Optional[List["TextAnswer"]] = None, **kwargs): - """ - :keyword answers: Represents the answer results. - :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] - """ - super(TextAnswers, self).__init__(**kwargs) - self.answers = answers - - -class TextRecord(msrest.serialization.Model): +class TextDocument(msrest.serialization.Model): """Represent input text record to be queried. All required parameters must be populated in order to send to Azure. @@ -817,6 +803,6 @@ def __init__(self, *, id: str, text: str, **kwargs): :keyword text: Required. Text contents of the record. :paramtype text: str """ - super(TextRecord, self).__init__(**kwargs) + super(TextDocument, self).__init__(**kwargs) self.id = id self.text = text diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_question_answering_client_enums.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_question_answering_client_enums.py index d6c78563d2b6..3440ca287045 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_question_answering_client_enums.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_question_answering_client_enums.py @@ -19,7 +19,13 @@ class ErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNAUTHORIZED = "Unauthorized" FORBIDDEN = "Forbidden" NOT_FOUND = "NotFound" + PROJECT_NOT_FOUND = "ProjectNotFound" + OPERATION_NOT_FOUND = "OperationNotFound" + AZURE_COGNITIVE_SEARCH_NOT_FOUND = "AzureCognitiveSearchNotFound" + AZURE_COGNITIVE_SEARCH_INDEX_NOT_FOUND = "AzureCognitiveSearchIndexNotFound" TOO_MANY_REQUESTS = "TooManyRequests" + AZURE_COGNITIVE_SEARCH_THROTTLING = "AzureCognitiveSearchThrottling" + AZURE_COGNITIVE_SEARCH_INDEX_LIMIT_REACHED = "AzureCognitiveSearchIndexLimitReached" INTERNAL_SERVER_ERROR = "InternalServerError" SERVICE_UNAVAILABLE = "ServiceUnavailable" @@ -33,17 +39,3 @@ class InnerErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AZURE_COGNITIVE_SEARCH_NOT_FOUND = "AzureCognitiveSearchNotFound" AZURE_COGNITIVE_SEARCH_THROTTLING = "AzureCognitiveSearchThrottling" EXTRACTION_FAILURE = "ExtractionFailure" - - -class LogicalOperationKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Set to 'OR' or 'AND' for using corresponding logical operation.""" - - AND_ENUM = "AND" - OR_ENUM = "OR" - - -class RankerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """(Optional) Set to 'QuestionOnly' for using a question only Ranker.""" - - DEFAULT = "Default" - QUESTION_ONLY = "QuestionOnly" From 82f86982b06485feab1dd3fc18a41771719a2386 Mon Sep 17 00:00:00 2001 From: antisch Date: Wed, 27 Oct 2021 17:13:56 -0700 Subject: [PATCH 2/9] Updated operations --- .../aio/operations/_operations.py | 212 ++++++------------ .../operations/_operations.py | 208 ++++++----------- 2 files changed, 140 insertions(+), 280 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py index 72d2d7e68379..24eed1e20877 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py @@ -19,9 +19,10 @@ from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models -from ...operations._operations import build_query_knowledge_base_request, build_query_text_request +from ...operations._operations import build_get_answers_from_text_request, build_get_answers_request from ..._patch import _validate_text_records, _get_positional_body, _verify_qna_id_and_question, _handle_metadata_filter_conversion T = TypeVar("T") @@ -30,31 +31,13 @@ class QuestionAnsweringClientOperationsMixin: @overload - async def query_knowledge_base( - self, - options: "_models.QueryKnowledgeBaseOptions", - *, - project_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.KnowledgeBaseAnswers": - """Answers the specified question using your knowledge base. - - :param options: Positional-only POST body of the request. - :type options: - ~azure.ai.language.questionanswering.models.QueryKnowledgeBaseOptions - :keyword project_name: The name of the project to use. - :paramtype project_name: str - :keyword deployment_name: The name of the specific deployment of the project to use. - :paramtype deployment_name: str - :return: KnowledgeBaseAnswers - :rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers - :raises: ~azure.core.exceptions.HttpResponseError - """ + async def get_answers( + self, options: "_models.AnswersOptions", *, project_name: str, deployment_name: str, **kwargs: Any + ) -> "_models.AnswersResult": ... @overload - async def query_knowledge_base( + async def get_answers( self, *, project_name: str, @@ -63,118 +46,83 @@ async def query_knowledge_base( question: Optional[str] = None, top: Optional[int] = None, user_id: Optional[str] = None, - confidence_score_threshold: Optional[float] = None, - context: Optional["_models.KnowledgeBaseAnswerRequestContext"] = None, - ranker_type: Optional[Union[str, "_models.RankerType"]] = None, + confidence_threshold: Optional[float] = None, + context: Optional["_models.KnowledgeBaseAnswerContext"] = None, + ranker_kind: Optional[str] = None, filters: Optional["_models.QueryFilters"] = None, - answer_span_request: Optional["_models.AnswerSpanRequest"] = None, + short_answer_options: Optional["_models.ShortAnswerOptions"] = None, include_unstructured_sources: Optional[bool] = None, **kwargs: Any - ) -> "_models.KnowledgeBaseAnswers": - """Answers the specified question using your knowledge base. - - :keyword project_name: The name of the project to use. - :paramtype project_name: str - :keyword deployment_name: The name of the specific deployment of the project to use. - :paramtype deployment_name: str - :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over - question. - :paramtype qna_id: int - :keyword question: User question to query against the knowledge base. - :paramtype question: str - :keyword top: Max number of answers to be returned for the question. - :paramtype top: int - :keyword user_id: Unique identifier for the user. - :paramtype user_id: str - :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to - 1. - :paramtype confidence_score_threshold: float - :keyword context: Context object with previous QnA's information. - :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible - values include: "Default", "QuestionOnly". - :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :keyword filters: Filter QnAs based on give metadata list and knowledge base source names. - :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters - :keyword answer_span_request: To configure Answer span prediction feature. - :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. - :paramtype include_unstructured_sources: bool - :rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers - :raises: ~azure.core.exceptions.HttpResponseError - """ + ) -> "_models.AnswersResult": ... - async def query_knowledge_base( - self, - *args, - **kwargs: Any - ) -> "_models.KnowledgeBaseAnswers": + @distributed_trace_async + async def get_answers(self, *args, **kwargs) -> "_models.AnswersResult": """Answers the specified question using your knowledge base. - :param options: POST body of the request. Provide either `options`, OR - individual keyword arguments. If both are provided, only the options object will be used. - :type options: - ~azure.ai.language.questionanswering.models.QueryKnowledgeBaseOptions + :param options: Positional only. POST body of the request. Either provide this + value or individual keyword arguments. + :type options: ~azure.ai.language.questionanswering.models.AnswersOptions :keyword project_name: The name of the project to use. :paramtype project_name: str :keyword deployment_name: The name of the specific deployment of the project to use. :paramtype deployment_name: str - :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over question. + :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + question. :paramtype qna_id: int - :keyword question: User question to query against the knowledge base. Provide either `options`, OR - individual keyword arguments. If both are provided, only the options object will be used. + :keyword question: User question to query against the knowledge base. :paramtype question: str :keyword top: Max number of answers to be returned for the question. :paramtype top: int :keyword user_id: Unique identifier for the user. :paramtype user_id: str - :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to 1. - :paramtype confidence_score_threshold: float + :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. + :paramtype confidence_threshold: float :keyword context: Context object with previous QnA's information. - :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible + :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword ranker_kind: Type of ranker to be used. Possible values include: "Default", "QuestionOnly". - :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :keyword filters: Filter QnAs based on give metadata list and knowledge base source names. + :paramtype ranker_kind: str + :keyword filters: Filter QnAs based on given metadata list and knowledge base sources. :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters - :keyword answer_span_request: To configure Answer span prediction feature. - :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. + :keyword short_answer_options: To configure Answer span prediction feature. + :paramtype short_answer_options: ~azure.ai.language.questionanswering.models.ShortAnswerOptions + :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured + Sources. :paramtype include_unstructured_sources: bool - :return: KnowledgeBaseAnswers - :rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers + :return: AnswersResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersResult :raises: ~azure.core.exceptions.HttpResponseError """ - options = _get_positional_body(*args, **kwargs) or _models.QueryKnowledgeBaseOptions( + options = _get_positional_body(*args, **kwargs) or _models.AnswersOptions( qna_id=kwargs.pop("qna_id", None), question=kwargs.pop("question", None), top=kwargs.pop("top", None), user_id=kwargs.pop("user_id", None), - confidence_score_threshold=kwargs.pop("confidence_score_threshold", None), + confidence_threshold=kwargs.pop("confidence_threshold", None), context=kwargs.pop("context", None), - ranker_type=kwargs.pop("ranker_type", None), + ranker_kind=kwargs.pop("ranker_kind", None), filters=kwargs.pop("filters", None), - answer_span_request=kwargs.pop("answer_span_request", None), + short_answer_options=kwargs.pop("short_answer_options", None), include_unstructured_sources=kwargs.pop("include_unstructured_sources", None) ) _verify_qna_id_and_question(options) options = _handle_metadata_filter_conversion(options) - cls = kwargs.pop("cls", None) # type: ClsType["_models.KnowledgeBaseAnswers"] + cls = kwargs.pop("cls", None) # type: ClsType["_models.AnswersResult"] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] project_name = kwargs.pop("project_name") # type: str deployment_name = kwargs.pop("deployment_name") # type: str - json = self._serialize.body(options, "QueryKnowledgeBaseOptions") + json = self._serialize.body(options, "AnswersOptions") - request = build_query_knowledge_base_request( + request = build_get_answers_request( content_type=content_type, project_name=project_name, deployment_name=deployment_name, json=json, - template_url=self.query_knowledge_base.metadata["url"], + template_url=self.get_answers.metadata["url"], ) path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), @@ -189,94 +137,72 @@ async def query_knowledge_base( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("KnowledgeBaseAnswers", pipeline_response) + deserialized = self._deserialize("AnswersResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - query_knowledge_base.metadata = {"url": "/:query-knowledgebases"} # type: ignore + get_answers.metadata = {"url": "/:query-knowledgebases"} # type: ignore @overload - async def query_text(self, options: "_models.QueryTextOptions", **kwargs: Any) -> "_models.TextAnswers": - """Answers the specified question using the provided text in the body. - - :param options: Positional-only POST body of the request. - :type options: ~azure.ai.language.questionanswering.models.QueryTextOptions - :return: TextAnswers - :rtype: ~azure.ai.language.questionanswering.models.TextAnswers - :raises: ~azure.core.exceptions.HttpResponseError - """ + async def get_answers_from_text( + self, options: "_models.AnswersFromTextOptions", **kwargs: Any + ) -> "_models.AnswersFromTextResult": ... @overload - async def query_text( + async def get_answers_from_text( self, *, question: str, - records: List["_models.TextRecord"], + text_documents: List["_models.TextDocument"], language: Optional[str] = None, **kwargs: Any - ) -> "_models.TextAnswers": - """Answers the specified question using the provided text in the body. - - :keyword question: Required. User question to query against the given text records. - :paramtype question: str - :keyword records: Required. Text records to be searched for given question. - :paramtype records: list[~azure.ai.language.questionanswering.models.TextRecord] - :keyword language: Language of the text records. This is BCP-47 representation of a language. For - example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as - default. - :paramtype language: str - :return: TextAnswers - :rtype: ~azure.ai.language.questionanswering.models.TextAnswers - :raises: ~azure.core.exceptions.HttpResponseError - """ + ) -> "_models.AnswersFromTextResult": ... - async def query_text( - self, *args, **kwargs: Any - ) -> "_models.TextAnswers": + @distributed_trace_async + async def get_answers_from_text(self, *args, **kwargs) -> "_models.AnswersFromTextResult": """Answers the specified question using the provided text in the body. - :param options: POST body of the request. Provide either `options`, OR - individual keyword arguments. If both are provided, only the options object will be used. - :type options: ~azure.ai.language.questionanswering.models.QueryTextOptions - :keyword question: User question to query against the given text records. Provide either `options`, OR + :param options: Positional only. POST body of the request. Provide either `options`, OR individual keyword arguments. If both are provided, only the options object will be used. + :type options: ~azure.ai.language.questionanswering.models.AnswersFromTextOptions + :keyword question: User question to query against the given text records. :paramtype question: str - :keyword records: Text records to be searched for given question. Provide either `options`, OR - individual keyword arguments. If both are provided, only the options object will be used. - :paramtype records: list[~azure.ai.language.questionanswering.models.TextRecord] - :keyword language: Language of the text records. This is BCP-47 representation of a language. For - example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. + :keyword text_documents: Text records to be searched for given question. + :paramtype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :keyword language: Language of the text records. This is BCP-47 representation of a language. + For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. :paramtype language: str - :return: TextAnswers - :rtype: ~azure.ai.language.questionanswering.models.TextAnswers + :return: AnswersFromTextResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersFromTextResult :raises: ~azure.core.exceptions.HttpResponseError """ - options = _get_positional_body(*args, **kwargs) or _models.QueryTextOptions( + options = _get_positional_body(*args, **kwargs) or _models.AnswersFromTextOptions( question=kwargs.pop("question"), - records=kwargs.pop("records"), + text_documents=kwargs.pop("text_documents"), language=kwargs.pop("language", self._default_language), ) try: - options['records'] = _validate_text_records(options['records']) + options['text_documents'] = _validate_text_records(options['text_documents']) except TypeError: - options.records = _validate_text_records(options.records) + options.text_documents = _validate_text_records(options.text_documents) - cls = kwargs.pop("cls", None) # type: ClsType["_models.TextAnswers"] + cls = kwargs.pop("cls", None) # type: ClsType["_models.AnswersFromTextResult"] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - json = self._serialize.body(options, "QueryTextOptions") + json = self._serialize.body(options, "AnswersFromTextOptions") - request = build_query_text_request( + request = build_get_answers_from_text_request( content_type=content_type, json=json, - template_url=self.query_text.metadata["url"], + template_url=self.get_answers_from_text.metadata["url"], ) path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), @@ -291,11 +217,11 @@ async def query_text( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("TextAnswers", pipeline_response) + deserialized = self._deserialize("AnswersFromTextResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - query_text.metadata = {"url": "/:query-text"} # type: ignore + get_answers_from_text.metadata = {"url": "/:query-text"} # type: ignore diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py index 006706b5434b..78a655f0e01e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py @@ -19,6 +19,7 @@ from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from msrest import Serializer from .. import models as _models @@ -34,7 +35,7 @@ _SERIALIZER = Serializer() # fmt: off -def build_query_knowledge_base_request( +def build_get_answers_request( **kwargs # type: Any ): # type: (...) -> HttpRequest @@ -42,7 +43,7 @@ def build_query_knowledge_base_request( project_name = kwargs.pop('project_name') # type: str deployment_name = kwargs.pop('deployment_name') # type: str - api_version = "2021-07-15-preview" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/:query-knowledgebases') @@ -68,13 +69,13 @@ def build_query_knowledge_base_request( ) -def build_query_text_request( +def build_get_answers_from_text_request( **kwargs # type: Any ): # type: (...) -> HttpRequest content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-07-15-preview" + api_version = "2021-10-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/:query-text') @@ -100,139 +101,94 @@ def build_query_text_request( # fmt: on class QuestionAnsweringClientOperationsMixin(object): @overload - def query_knowledge_base( + def get_answers( self, - options, # type: "_models.QueryKnowledgeBaseOptions" + options, # type: "_models.AnswersOptions" **kwargs # type: Any ): - # type: (...) -> "_models.KnowledgeBaseAnswers" - """Answers the specified question using your knowledge base. - - :param options: Positional-only POST body of the request. - :type options: - ~azure.ai.language.questionanswering.models.QueryKnowledgeBaseOptions - :keyword project_name: The name of the project to use. - :paramtype project_name: str - :keyword deployment_name: The name of the specific deployment of the project to use. - :paramtype deployment_name: str - :return: KnowledgeBaseAnswers - :rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers - :raises: ~azure.core.exceptions.HttpResponseError - """ + # type: (...) -> "_models.AnswersResult" pass @overload - def query_knowledge_base( + def get_answers( self, **kwargs # type: Any ): - # type: (...) -> "_models.KnowledgeBaseAnswers" - """Answers the specified question using your knowledge base. - - :keyword project_name: The name of the project to use. - :paramtype project_name: str - :keyword deployment_name: The name of the specific deployment of the project to use. - :paramtype deployment_name: str - :keyword question: User question to query against the knowledge base. - :paramtype question: str - :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over - question. - :paramtype qna_id: int - :keyword top: Max number of answers to be returned for the question. - :paramtype top: int - :keyword user_id: Unique identifier for the user. - :paramtype user_id: str - :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to - 1. - :paramtype confidence_score_threshold: float - :keyword context: Context object with previous QnA's information. - :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible - values include: "Default", "QuestionOnly". - :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :keyword filters: Filter QnAs based on give metadata list and knowledge base source names. - :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters - :keyword answer_span_request: To configure Answer span prediction feature. - :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. - :paramtype include_unstructured_sources: bool - :return: KnowledgeBaseAnswers - :rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers - :raises: ~azure.core.exceptions.HttpResponseError - """ + # type: (...) -> "_models.AnswersResult" pass - def query_knowledge_base( + @distributed_trace + def get_answers( self, - *args, # type: "_models.QueryKnowledgeBaseOptions" + *args, # type: "_models.AnswersOptions" **kwargs # type: Any ): - # type: (...) -> "_models.KnowledgeBaseAnswers" + # type: (...) -> "_models.AnswersResult" """Answers the specified question using your knowledge base. - :param options: POST body of the request. Provide either `options`, OR + :param options: Positional only. POST body of the request. Provide either `options`, OR individual keyword arguments. If both are provided, only the options object will be used. - :type options: - ~azure.ai.language.questionanswering.models.QueryKnowledgeBaseOptions + :type options: ~azure.ai.language.questionanswering.models.AnswersOptions :keyword project_name: The name of the project to use. :paramtype project_name: str :keyword deployment_name: The name of the specific deployment of the project to use. :paramtype deployment_name: str - :keyword question: User question to query against the knowledge base. Provide either `options`, OR - individual keyword arguments. If both are provided, only the options object will be used. - :paramtype question: str - :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over question. + :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + question. :paramtype qna_id: int + :keyword question: User question to query against the knowledge base. + :paramtype question: str :keyword top: Max number of answers to be returned for the question. :paramtype top: int :keyword user_id: Unique identifier for the user. :paramtype user_id: str - :keyword confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to 1. - :paramtype confidence_score_threshold: float + :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. + :paramtype confidence_threshold: float :keyword context: Context object with previous QnA's information. - :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :keyword ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible + :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword ranker_kind: Type of ranker to be used. Possible values include: "Default", "QuestionOnly". - :paramtype ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :keyword filters: Filter QnAs based on give metadata list and knowledge base source names. + :paramtype ranker_kind: str + :keyword filters: Filter QnAs based on given metadata list and knowledge base sources. :paramtype filters: ~azure.ai.language.questionanswering.models.QueryFilters - :keyword answer_span_request: To configure Answer span prediction feature. - :paramtype answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. + :keyword short_answer_options: To configure Answer span prediction feature. + :paramtype short_answer_options: ~azure.ai.language.questionanswering.models.ShortAnswerOptions + :keyword include_unstructured_sources: (Optional) Flag to enable Query over Unstructured + Sources. :paramtype include_unstructured_sources: bool - :return: KnowledgeBaseAnswers - :rtype: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswers + :return: AnswersResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersResult :raises: ~azure.core.exceptions.HttpResponseError """ - options = _get_positional_body(*args, **kwargs) or _models.QueryKnowledgeBaseOptions( + options = _get_positional_body(*args, **kwargs) or _models.AnswersOptions( qna_id=kwargs.pop("qna_id", None), question=kwargs.pop("question", None), top=kwargs.pop("top", None), user_id=kwargs.pop("user_id", None), - confidence_score_threshold=kwargs.pop("confidence_score_threshold", None), + confidence_threshold=kwargs.pop("confidence_threshold", None), context=kwargs.pop("context", None), - ranker_type=kwargs.pop("ranker_type", None), + ranker_kind=kwargs.pop("ranker_kind", None), filters=kwargs.pop("filters", None), - answer_span_request=kwargs.pop("answer_span_request", None), + short_answer_options=kwargs.pop("short_answer_options", None), include_unstructured_sources=kwargs.pop("include_unstructured_sources", None) ) _verify_qna_id_and_question(options) options = _handle_metadata_filter_conversion(options) - cls = kwargs.pop("cls", None) # type: ClsType["_models.KnowledgeBaseAnswers"] + cls = kwargs.pop("cls", None) # type: ClsType["_models.AnswersResult"] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] project_name = kwargs.pop("project_name") # type: str deployment_name = kwargs.pop("deployment_name") # type: str - json = self._serialize.body(options, "QueryKnowledgeBaseOptions") + json = self._serialize.body(options, "AnswersOptions") - request = build_query_knowledge_base_request( + request = build_get_answers_request( content_type=content_type, project_name=project_name, deployment_name=deployment_name, json=json, - template_url=self.query_knowledge_base.metadata["url"], + template_url=self.get_answers.metadata["url"], ) path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), @@ -247,99 +203,77 @@ def query_knowledge_base( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("KnowledgeBaseAnswers", pipeline_response) + deserialized = self._deserialize("AnswersResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - query_knowledge_base.metadata = {"url": "/:query-knowledgebases"} # type: ignore + get_answers.metadata = {"url": "/:query-knowledgebases"} # type: ignore @overload - def query_text( + def get_answers_from_text( self, - options, # type: "_models.QueryTextOptions" + options, # type: "_models.AnswersFromTextOptions" **kwargs # type: Any ): - # type: (...) -> "_models.TextAnswers" - """Answers the specified question using the provided text in the body. - - :param options: Positional-only POST body of the request. - :type options: ~azure.ai.language.questionanswering.models.QueryTextOptions - :return: TextAnswers - :rtype: ~azure.ai.language.questionanswering.models.TextAnswers - :raises: ~azure.core.exceptions.HttpResponseError - """ + # type: (...) -> "_models.AnswersFromTextResult" pass @overload - def query_text( + def get_answers_from_text( self, **kwargs # type: Any ): - # type: (...) -> "_models.TextAnswers" - """Answers the specified question using the provided text in the body. - - :keyword question: Required. User question to query against the given text records. - :paramtype question: str - :keyword records: Required. Text records to be searched for given question. - :paramtype records: list[str or ~azure.ai.language.questionanswering.models.TextRecord] - :keyword language: Language of the text records. This is BCP-47 representation of a language. For - example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as - default. - :paramtype language: str - :return: TextAnswers - :rtype: ~azure.ai.language.questionanswering.models.TextAnswers - :raises: ~azure.core.exceptions.HttpResponseError - """ + # type: (...) -> "_models.AnswersFromTextResult" pass - def query_text( + @distributed_trace + def get_answers_from_text( self, - *args, # type: "_models.QueryTextOptions" + *args, # type: "_models.AnswersFromTextOptions" **kwargs # type: Any ): - # type: (...) -> "_models.TextAnswers" + # type: (...) -> "_models.AnswersFromTextResult" """Answers the specified question using the provided text in the body. - :param options: POST body of the request. Provide either `options`, OR + :param options: Positional only. POST body of the request. Provide either `options`, OR individual keyword arguments. If both are provided, only the options object will be used. - :type options: ~azure.ai.language.questionanswering.models.QueryTextOptions - :keyword question: User question to query against the given text records. Provide either `options`, - OR individual keyword arguments. If both are provided, only the options object will be used. + :type options: ~azure.ai.language.questionanswering.models.AnswersFromTextOptions + :keyword question: User question to query against the given text records. :paramtype question: str - :keyword records: Text records to be searched for given question. Provide either `options`, OR - individual keyword arguments. If both are provided, only the options object will be used. - :paramtype records: list[str or ~azure.ai.language.questionanswering.models.TextRecord] - :keyword language: Language of the text records. This is BCP-47 representation of a language. For - example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. + :keyword text_documents: Text records to be searched for given question. + :paramtype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :keyword language: Language of the text records. This is BCP-47 representation of a language. + For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as + default. :paramtype language: str - :return: TextAnswers - :rtype: ~azure.ai.language.questionanswering.models.TextAnswers + :return: AnswersFromTextResult + :rtype: ~azure.ai.language.questionanswering.models.AnswersFromTextResult :raises: ~azure.core.exceptions.HttpResponseError """ - options = _get_positional_body(*args, **kwargs) or _models.QueryTextOptions( + options = _get_positional_body(*args, **kwargs) or _models.AnswersFromTextOptions( question=kwargs.pop("question"), - records=kwargs.pop("records"), + text_documents=kwargs.pop("text_documents"), language=kwargs.pop("language", self._default_language), ) try: - options['records'] = _validate_text_records(options['records']) + options['text_documents'] = _validate_text_records(options['text_documents']) except TypeError: - options.records = _validate_text_records(options.records) + options.text_documents = _validate_text_records(options.text_documents) - cls = kwargs.pop("cls", None) # type: ClsType["_models.TextAnswers"] + cls = kwargs.pop("cls", None) # type: ClsType["_models.AnswersFromTextResult"] error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {})) content_type = kwargs.pop("content_type", "application/json") # type: Optional[str] - json = self._serialize.body(options, "QueryTextOptions") + json = self._serialize.body(options, "AnswersFromTextOptions") - request = build_query_text_request( + request = build_get_answers_from_text_request( content_type=content_type, json=json, - template_url=self.query_text.metadata["url"], + template_url=self.get_answers_from_text.metadata["url"], ) path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), @@ -354,11 +288,11 @@ def query_text( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize("TextAnswers", pipeline_response) + deserialized = self._deserialize("AnswersFromTextResult", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - query_text.metadata = {"url": "/:query-text"} # type: ignore + get_answers_from_text.metadata = {"url": "/:query-text"} # type: ignore From fd0df788696f2c45da999f75968b4f87dafcf198 Mon Sep 17 00:00:00 2001 From: antisch Date: Wed, 27 Oct 2021 20:36:48 -0700 Subject: [PATCH 3/9] Updated tests --- .../ai/language/questionanswering/_patch.py | 12 +- .../aio/operations/_operations.py | 2 +- .../operations/_operations.py | 2 +- ...nowledgebase.test_query_knowledgebase.yaml | 32 ++--- ...ebase.test_query_knowledgebase_filter.yaml | 10 +- ...uery_knowledgebase_filter_dict_params.yaml | 10 +- ...edgebase.test_query_knowledgebase_llc.yaml | 32 ++--- ...ery_knowledgebase_llc_with_answerspan.yaml | 32 ++--- ...base.test_query_knowledgebase_only_id.yaml | 24 ++-- ...ase.test_query_knowledgebase_overload.yaml | 18 +-- ....test_query_knowledgebase_python_dict.yaml | 24 ++-- ...t_query_knowledgebase_with_answerspan.yaml | 36 +++-- ...t_query_knowledgebase_with_dictparams.yaml | 18 +-- ...est_query_knowledgebase_with_followup.yaml | 20 +-- ...gebase_async.test_query_knowledgebase.yaml | 38 ++--- ...async.test_query_knowledgebase_filter.yaml | 12 +- ...uery_knowledgebase_filter_dict_params.yaml | 12 +- ...se_async.test_query_knowledgebase_llc.yaml | 34 ++--- ...ery_knowledgebase_llc_with_answerspan.yaml | 38 +++-- ...sync.test_query_knowledgebase_only_id.yaml | 26 ++-- ...ync.test_query_knowledgebase_overload.yaml | 20 +-- ....test_query_knowledgebase_python_dict.yaml | 26 ++-- ...t_query_knowledgebase_with_answerspan.yaml | 44 +++--- ...t_query_knowledgebase_with_dictparams.yaml | 20 +-- ...est_query_knowledgebase_with_followup.yaml | 24 ++-- .../test_query_text.test_query_text.yaml | 26 ++-- .../test_query_text.test_query_text_llc.yaml | 14 +- ...t_query_text.test_query_text_overload.yaml | 16 +-- ..._text.test_query_text_with_dictparams.yaml | 20 +-- ...text.test_query_text_with_str_records.yaml | 20 +-- ...test_query_text_async.test_query_text.yaml | 24 ++-- ..._query_text_async.test_query_text_llc.yaml | 22 +-- ...y_text_async.test_query_text_overload.yaml | 22 +-- ...async.test_query_text_with_dictparams.yaml | 22 +-- ...sync.test_query_text_with_str_records.yaml | 22 +-- .../tests/test_query_knowledgebase.py | 133 +++++++++--------- .../tests/test_query_knowledgebase_async.py | 129 ++++++++--------- .../tests/test_query_text.py | 60 ++++---- .../tests/test_query_text_async.py | 60 ++++---- 39 files changed, 555 insertions(+), 601 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py index 8d08b4eb4fdb..8ac829ddd279 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py @@ -6,22 +6,22 @@ import six import copy -from .models import TextRecord +from .models import TextDocument def _validate_text_records(records): if not records: - raise ValueError("Input records can not be empty or None") + raise ValueError("Input documents can not be empty or None") if isinstance(records, six.string_types): - raise TypeError("Input records cannot be a string.") + raise TypeError("Input documents cannot be a string.") if isinstance(records, dict): - raise TypeError("Input records cannot be a dict") + raise TypeError("Input documents cannot be a dict") if not all(isinstance(x, six.string_types) for x in records): - if not all(isinstance(x, (dict, TextRecord)) for x in records): - raise TypeError("Mixing string and dictionary/object record input unsupported.") + if not all(isinstance(x, (dict, TextDocument)) for x in records): + raise TypeError("Mixing string and dictionary/object document input unsupported.") request_batch = [] for idx, doc in enumerate(records): diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py index 24eed1e20877..7f02222b1bd5 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py @@ -188,7 +188,7 @@ async def get_answers_from_text(self, *args, **kwargs) -> "_models.AnswersFromTe language=kwargs.pop("language", self._default_language), ) try: - options['text_documents'] = _validate_text_records(options['text_documents']) + options['records'] = _validate_text_records(options['records']) except TypeError: options.text_documents = _validate_text_records(options.text_documents) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py index 78a655f0e01e..9f4bf486de5b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py @@ -259,7 +259,7 @@ def get_answers_from_text( language=kwargs.pop("language", self._default_language), ) try: - options['text_documents'] = _validate_text_records(options['text_documents']) + options['records'] = _validate_text_records(options['records']) except TypeError: options.text_documents = _validate_text_records(options.text_documents) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase.yaml index 1a5ee269c0f9..754023846058 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase.yaml @@ -14,9 +14,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -67,29 +67,29 @@ interactions: on Surface.com. |\\n| Sensors | Six sensors\u2014 accelerometer, magnetometer, gyro, ambient light sensor, Hall effect, Wi-Fi SAR\u2014let apps do things like track motion and determine location. |\",\n \"confidenceScore\": - 1.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 114,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": - 6,\n \"displayText\": \"Software\"\n },\n {\n - \ \"displayOrder\": 1,\n \"qnaId\": 7,\n \"displayText\": + 115,\n \"displayText\": \"Software\"\n },\n {\n + \ \"displayOrder\": 1,\n \"qnaId\": 116,\n \"displayText\": \"Processor\"\n },\n {\n \"displayOrder\": 2,\n - \ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n + \ \"qnaId\": 117,\n \"displayText\": \"Memory and storage\"\n \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": - 9,\n \"displayText\": \"Sensors\"\n }\n ]\n }\n + 118,\n \"displayText\": \"Sensors\"\n }\n ]\n }\n \ },\n {\n \"questions\": [\n \"Connect monitors, accessories, and other devices\"\n ],\n \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou can connect monitors, accessories, and other devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface Dock (sold separately). With Surface Dock, you can switch between fully connected and fully mobile - with a single connector.\",\n \"confidenceScore\": 0.4067,\n \"id\": - 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + with a single connector.\",\n \"confidenceScore\": 0.5997,\n \"id\": + 173,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": - 0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your + 0,\n \"qnaId\": 174,\n \"displayText\": \"Set up your workspace with Surface Dock\"\n },\n {\n \"displayOrder\": - 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or + 1,\n \"qnaId\": 175,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n \ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n \ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect @@ -99,27 +99,27 @@ interactions: is for video only. Audio will play from your Surface speakers unless you\u2019ve connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) [volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) - on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4511,\n \"id\": 177,\n \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: apim-request-id: - - d0dc208c-60f1-4669-bddb-4522e3949ecf + - 3c370c26-52a7-44e4-a59e-5e9567dd9f2a content-length: - - '7123' + - '7137' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Thu, 30 Sep 2021 15:52:34 GMT + - Thu, 28 Oct 2021 03:30:11 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1273' + - '421' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter.yaml index 9ed6d109b0d5..33f49df89196 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter.yaml @@ -16,9 +16,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b3 Python/3.9.5 (macOS-11.6-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Check @@ -39,7 +39,7 @@ interactions: []\n }\n }\n ]\n}" headers: apim-request-id: - - 4fdc8aef-6dde-4298-aa8b-e9825d04a481 + - 5aeeb4c7-152c-4b8d-bfd4-acbf6c1c2d90 content-length: - '1143' content-type: @@ -47,13 +47,13 @@ interactions: csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Wed, 27 Oct 2021 16:40:37 GMT + - Thu, 28 Oct 2021 03:30:11 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1408' + - '187' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter_dict_params.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter_dict_params.yaml index a10775845cbe..6c9119ef0254 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter_dict_params.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_filter_dict_params.yaml @@ -16,9 +16,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b3 Python/3.9.5 (macOS-11.6-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Check @@ -39,7 +39,7 @@ interactions: []\n }\n }\n ]\n}" headers: apim-request-id: - - 8f48f294-2767-4589-8dfd-4c93163a23be + - 8f7d7edb-0b56-4b37-9009-7199bc538d62 content-length: - '1143' content-type: @@ -47,13 +47,13 @@ interactions: csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Wed, 27 Oct 2021 16:40:37 GMT + - Thu, 28 Oct 2021 03:30:13 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '196' + - '953' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc.yaml index 45d018962798..d5cd6dc40fc2 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc.yaml @@ -14,9 +14,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -67,29 +67,29 @@ interactions: on Surface.com. |\\n| Sensors | Six sensors\u2014 accelerometer, magnetometer, gyro, ambient light sensor, Hall effect, Wi-Fi SAR\u2014let apps do things like track motion and determine location. |\",\n \"confidenceScore\": - 1.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 114,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": - 6,\n \"displayText\": \"Software\"\n },\n {\n - \ \"displayOrder\": 1,\n \"qnaId\": 7,\n \"displayText\": + 115,\n \"displayText\": \"Software\"\n },\n {\n + \ \"displayOrder\": 1,\n \"qnaId\": 116,\n \"displayText\": \"Processor\"\n },\n {\n \"displayOrder\": 2,\n - \ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n + \ \"qnaId\": 117,\n \"displayText\": \"Memory and storage\"\n \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": - 9,\n \"displayText\": \"Sensors\"\n }\n ]\n }\n + 118,\n \"displayText\": \"Sensors\"\n }\n ]\n }\n \ },\n {\n \"questions\": [\n \"Connect monitors, accessories, and other devices\"\n ],\n \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou can connect monitors, accessories, and other devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface Dock (sold separately). With Surface Dock, you can switch between fully connected and fully mobile - with a single connector.\",\n \"confidenceScore\": 0.4067,\n \"id\": - 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + with a single connector.\",\n \"confidenceScore\": 0.5997,\n \"id\": + 173,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": - 0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your + 0,\n \"qnaId\": 174,\n \"displayText\": \"Set up your workspace with Surface Dock\"\n },\n {\n \"displayOrder\": - 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or + 1,\n \"qnaId\": 175,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n \ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n \ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect @@ -99,27 +99,27 @@ interactions: is for video only. Audio will play from your Surface speakers unless you\u2019ve connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) [volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) - on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4511,\n \"id\": 177,\n \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: apim-request-id: - - 020d4cd9-b1fe-49ce-8ce1-e1f95aefbbf3 + - dbf61866-0780-4e75-a44b-a5b5bb6d074f content-length: - - '7123' + - '7137' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Thu, 30 Sep 2021 15:52:34 GMT + - Thu, 28 Oct 2021 03:30:13 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1590' + - '331' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc_with_answerspan.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc_with_answerspan.yaml index 525c23f2acd1..e06029864867 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc_with_answerspan.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_llc_with_answerspan.yaml @@ -15,9 +15,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -68,15 +68,15 @@ interactions: on Surface.com. |\\n| Sensors | Six sensors\u2014 accelerometer, magnetometer, gyro, ambient light sensor, Hall effect, Wi-Fi SAR\u2014let apps do things like track motion and determine location. |\",\n \"confidenceScore\": - 1.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 114,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": - 6,\n \"displayText\": \"Software\"\n },\n {\n - \ \"displayOrder\": 1,\n \"qnaId\": 7,\n \"displayText\": + 115,\n \"displayText\": \"Software\"\n },\n {\n + \ \"displayOrder\": 1,\n \"qnaId\": 116,\n \"displayText\": \"Processor\"\n },\n {\n \"displayOrder\": 2,\n - \ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n + \ \"qnaId\": 117,\n \"displayText\": \"Memory and storage\"\n \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": - 9,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n + 118,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n \ \"answerSpan\": {\n \"text\": \"\\nSurface Pro 4 has the ports you expect in a full-feature laptop.\\n\\nFull-size USB 3.0 port Connect a USB accessory like a mouse, printer, Ethernet adapter, USB drive, or smartphone\",\n @@ -87,14 +87,14 @@ interactions: accessories, and other devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface Dock (sold separately). With Surface Dock, you can switch between fully connected - and fully mobile with a single connector.\",\n \"confidenceScore\": 0.4067,\n - \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + and fully mobile with a single connector.\",\n \"confidenceScore\": 0.5997,\n + \ \"id\": 173,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": - 0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your + 0,\n \"qnaId\": 174,\n \"displayText\": \"Set up your workspace with Surface Dock\"\n },\n {\n \"displayOrder\": - 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or + 1,\n \"qnaId\": 175,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n \ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n \ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect @@ -104,27 +104,27 @@ interactions: is for video only. Audio will play from your Surface speakers unless you\u2019ve connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) [volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) - on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4511,\n \"id\": 177,\n \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: apim-request-id: - - 8ab8a1da-8fd6-4091-80e3-470885a6b2b7 + - 34ced98e-2ff2-427e-9042-22a726e98c7d content-length: - - '7435' + - '7449' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Thu, 30 Sep 2021 15:52:35 GMT + - Thu, 28 Oct 2021 03:30:14 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '2624' + - '565' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_only_id.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_only_id.yaml index e6932c6c456c..cf64b563e7be 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_only_id.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_only_id.yaml @@ -13,37 +13,31 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: - string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Charge - your Surface Pro 4\"\n ],\n \"answer\": \"**Charge your Surface - Pro 4**\\n\\n1. Connect the two parts of the power cord.\\n\\n2. Connect - the power cord securely to the charging port.\\n\\n3. Plug the power supply - into an electrical outlet.\",\n \"confidenceScore\": 1.0,\n \"id\": - 19,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": - {\n \"explicitlytaggedheading\": \"charge your surface pro 4\"\n },\n - \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": - []\n }\n }\n ]\n}" + string: "{\n \"answers\": [\n {\n \"questions\": [],\n \"answer\": + \"No good match found in KB\",\n \"confidenceScore\": 0.0,\n \"id\": + -1,\n \"metadata\": {}\n }\n ]\n}" headers: apim-request-id: - - 4f01bfd0-6d10-4fbd-a02c-81160bc374d2 + - b9ca5848-776e-41d5-9a19-d6b3c6205e2e content-length: - - '583' + - '169' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Thu, 30 Sep 2021 15:52:34 GMT + - Thu, 28 Oct 2021 03:30:15 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1071' + - '199' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_overload.yaml index e3d3aacec340..bb8f6ebe2cba 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_overload.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_overload.yaml @@ -16,43 +16,43 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Make your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor info on how to care for your battery and power supply, conserve power, and make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power) - on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\": - 27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9079,\n \"id\": 136,\n + \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n },\n {\n \"questions\": [\n \"Check the battery level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\": - 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.48469999999999996,\n \"id\": 133,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": []\n }\n }\n ]\n}" headers: apim-request-id: - - f02239ca-4edc-4348-b5d6-b3023765bddb + - 43e45935-1381-4971-8151-874b0066111d content-length: - - '1140' + - '1143' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Thu, 30 Sep 2021 15:52:34 GMT + - Thu, 28 Oct 2021 03:30:16 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '916' + - '456' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_python_dict.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_python_dict.yaml index 041d14502a21..ed28340abf28 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_python_dict.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_python_dict.yaml @@ -13,37 +13,31 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: - string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Charge - your Surface Pro 4\"\n ],\n \"answer\": \"**Charge your Surface - Pro 4**\\n\\n1. Connect the two parts of the power cord.\\n\\n2. Connect - the power cord securely to the charging port.\\n\\n3. Plug the power supply - into an electrical outlet.\",\n \"confidenceScore\": 1.0,\n \"id\": - 19,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": - {\n \"explicitlytaggedheading\": \"charge your surface pro 4\"\n },\n - \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": - []\n }\n }\n ]\n}" + string: "{\n \"answers\": [\n {\n \"questions\": [],\n \"answer\": + \"No good match found in KB\",\n \"confidenceScore\": 0.0,\n \"id\": + -1,\n \"metadata\": {}\n }\n ]\n}" headers: apim-request-id: - - 845c4b78-915e-484c-af56-56ae05539a6e + - 9eadec26-fe1a-4b5e-a130-b94cd5f22527 content-length: - - '583' + - '169' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Thu, 30 Sep 2021 15:52:34 GMT + - Thu, 28 Oct 2021 03:30:17 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1099' + - '128' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_answerspan.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_answerspan.yaml index f90bbb484e56..7dab19144c02 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_answerspan.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_answerspan.yaml @@ -15,9 +15,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -68,15 +68,15 @@ interactions: on Surface.com. |\\n| Sensors | Six sensors\u2014 accelerometer, magnetometer, gyro, ambient light sensor, Hall effect, Wi-Fi SAR\u2014let apps do things like track motion and determine location. |\",\n \"confidenceScore\": - 1.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 114,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": - 6,\n \"displayText\": \"Software\"\n },\n {\n - \ \"displayOrder\": 1,\n \"qnaId\": 7,\n \"displayText\": + 115,\n \"displayText\": \"Software\"\n },\n {\n + \ \"displayOrder\": 1,\n \"qnaId\": 116,\n \"displayText\": \"Processor\"\n },\n {\n \"displayOrder\": 2,\n - \ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n + \ \"qnaId\": 117,\n \"displayText\": \"Memory and storage\"\n \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": - 9,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n + 118,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n \ \"answerSpan\": {\n \"text\": \"\\nSurface Pro 4 has the ports you expect in a full-feature laptop.\\n\\nFull-size USB 3.0 port Connect a USB accessory like a mouse, printer, Ethernet adapter, USB drive, or smartphone\",\n @@ -87,19 +87,15 @@ interactions: accessories, and other devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface Dock (sold separately). With Surface Dock, you can switch between fully connected - and fully mobile with a single connector.\",\n \"confidenceScore\": 0.4067,\n - \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + and fully mobile with a single connector.\",\n \"confidenceScore\": 0.5997,\n + \ \"id\": 173,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": - 0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your + 0,\n \"qnaId\": 174,\n \"displayText\": \"Set up your workspace with Surface Dock\"\n },\n {\n \"displayOrder\": - 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or + 1,\n \"qnaId\": 175,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n - \ },\n \"answerSpan\": {\n \"text\": \"\\nYou can connect - monitors, accessories, and other devices directly to your Surface Pro 4 using - the USB port, Mini DisplayPort, or Bluetooth\",\n \"confidenceScore\": - 0.051399999999999994,\n \"offset\": 53,\n \"length\": 140\n \ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n \ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect it to your Surface using a DisplayPort to Mini DisplayPort cable (sold separately). @@ -108,27 +104,27 @@ interactions: is for video only. Audio will play from your Surface speakers unless you\u2019ve connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) [volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) - on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4511,\n \"id\": 177,\n \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: apim-request-id: - - 33feb3cb-5959-4ca7-97de-8c95847f517e + - 4860b0b2-b82c-4bd5-beec-165667a1ed00 content-length: - - '7719' + - '7449' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Thu, 30 Sep 2021 15:52:34 GMT + - Thu, 28 Oct 2021 03:30:18 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1270' + - '782' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_dictparams.yaml index 459558c35245..6fa8aa0f68b3 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_dictparams.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_dictparams.yaml @@ -16,43 +16,43 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Make your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor info on how to care for your battery and power supply, conserve power, and make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power) - on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\": - 27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9079,\n \"id\": 136,\n + \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n },\n {\n \"questions\": [\n \"Check the battery level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\": - 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.48469999999999996,\n \"id\": 133,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": []\n }\n }\n ]\n}" headers: apim-request-id: - - 1f863859-4839-430b-9e06-3461d04f010e + - 4f358c9a-2895-487e-8f8a-d947c9b90c7c content-length: - - '1140' + - '1143' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Thu, 30 Sep 2021 15:52:35 GMT + - Thu, 28 Oct 2021 03:30:19 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '2626' + - '513' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_followup.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_followup.yaml index 06b078650337..7d066c15fa85 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_followup.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase.test_query_knowledgebase_with_followup.yaml @@ -16,9 +16,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b3 Python/3.9.5 (macOS-11.6-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Make @@ -38,7 +38,7 @@ interactions: \ \"prompts\": []\n }\n }\n ]\n}" headers: apim-request-id: - - cacc3388-c952-4053-b79b-f15d6f22abc6 + - 9dda58f9-b755-4ddd-8a59-13a99672d664 content-length: - '1143' content-type: @@ -46,13 +46,13 @@ interactions: csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Wed, 27 Oct 2021 16:43:49 GMT + - Thu, 28 Oct 2021 03:30:20 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '588' + - '557' status: code: 200 message: OK @@ -74,9 +74,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b3 Python/3.9.5 (macOS-11.6-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Power @@ -103,7 +103,7 @@ interactions: \ \"length\": 19\n }\n }\n ]\n}" headers: apim-request-id: - - 9197f529-107f-437f-9e74-7713dbfaf410 + - 9f3f573f-142d-4250-ad13-ac11e6061447 content-length: - '1594' content-type: @@ -111,13 +111,13 @@ interactions: csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Wed, 27 Oct 2021 16:43:51 GMT + - Thu, 28 Oct 2021 03:30:20 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '541' + - '562' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase.yaml index e522576f82a0..059b82def211 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase.yaml @@ -1,18 +1,18 @@ interactions: - request: body: '{"question": "Ports and connectors", "top": 3, "context": {"previousQnaId": - 4, "previousUserQuery": "Meet Surface Pro 4"}}' + 4}}' headers: Accept: - application/json Content-Length: - - '122' + - '79' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -63,29 +63,29 @@ interactions: on Surface.com. |\\n| Sensors | Six sensors\u2014 accelerometer, magnetometer, gyro, ambient light sensor, Hall effect, Wi-Fi SAR\u2014let apps do things like track motion and determine location. |\",\n \"confidenceScore\": - 1.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 114,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": - 6,\n \"displayText\": \"Software\"\n },\n {\n - \ \"displayOrder\": 1,\n \"qnaId\": 7,\n \"displayText\": + 115,\n \"displayText\": \"Software\"\n },\n {\n + \ \"displayOrder\": 1,\n \"qnaId\": 116,\n \"displayText\": \"Processor\"\n },\n {\n \"displayOrder\": 2,\n - \ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n + \ \"qnaId\": 117,\n \"displayText\": \"Memory and storage\"\n \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": - 9,\n \"displayText\": \"Sensors\"\n }\n ]\n }\n + 118,\n \"displayText\": \"Sensors\"\n }\n ]\n }\n \ },\n {\n \"questions\": [\n \"Connect monitors, accessories, and other devices\"\n ],\n \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou can connect monitors, accessories, and other devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface Dock (sold separately). With Surface Dock, you can switch between fully connected and fully mobile - with a single connector.\",\n \"confidenceScore\": 0.4067,\n \"id\": - 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + with a single connector.\",\n \"confidenceScore\": 0.5997,\n \"id\": + 173,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": - 0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your + 0,\n \"qnaId\": 174,\n \"displayText\": \"Set up your workspace with Surface Dock\"\n },\n {\n \"displayOrder\": - 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or + 1,\n \"qnaId\": 175,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n \ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n \ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect @@ -95,21 +95,21 @@ interactions: is for video only. Audio will play from your Surface speakers unless you\u2019ve connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) [volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) - on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4511,\n \"id\": 177,\n \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: 5971ea57-2aa9-4179-bda9-aba6b937380f - content-length: '7123' + apim-request-id: 6ae5add4-a9d5-4511-8151-bc476de2b9f8 + content-length: '7137' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Thu, 30 Sep 2021 15:52:36 GMT + date: Thu, 28 Oct 2021 03:30:22 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '1153' + x-envoy-upstream-service-time: '315' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter.yaml index 4ae1278faad0..7568f8303ac6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter.yaml @@ -12,9 +12,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b3 Python/3.9.5 (macOS-11.6-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Check @@ -34,16 +34,16 @@ interactions: \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: 90846135-6109-45b9-843e-307da0a9f967 + apim-request-id: 9fd77651-b899-4814-92b9-cec69b7ba85d content-length: '1143' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Wed, 27 Oct 2021 16:40:39 GMT + date: Thu, 28 Oct 2021 03:30:22 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '1045' + x-envoy-upstream-service-time: '169' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter_dict_params.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter_dict_params.yaml index 93bea30de6c5..bef82d757032 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter_dict_params.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_filter_dict_params.yaml @@ -12,9 +12,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b3 Python/3.9.5 (macOS-11.6-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Check @@ -34,16 +34,16 @@ interactions: \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: dde39c7e-32e8-40c7-9db2-32e2aabcfd38 + apim-request-id: f6ed3790-9b25-4674-891f-0359d37633f1 content-length: '1143' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Wed, 27 Oct 2021 16:40:39 GMT + date: Thu, 28 Oct 2021 03:30:23 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '179' + x-envoy-upstream-service-time: '189' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc.yaml index f5d1f2db923a..369bdaa14495 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc.yaml @@ -10,9 +10,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -63,29 +63,29 @@ interactions: on Surface.com. |\\n| Sensors | Six sensors\u2014 accelerometer, magnetometer, gyro, ambient light sensor, Hall effect, Wi-Fi SAR\u2014let apps do things like track motion and determine location. |\",\n \"confidenceScore\": - 1.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 114,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": - 6,\n \"displayText\": \"Software\"\n },\n {\n - \ \"displayOrder\": 1,\n \"qnaId\": 7,\n \"displayText\": + 115,\n \"displayText\": \"Software\"\n },\n {\n + \ \"displayOrder\": 1,\n \"qnaId\": 116,\n \"displayText\": \"Processor\"\n },\n {\n \"displayOrder\": 2,\n - \ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n + \ \"qnaId\": 117,\n \"displayText\": \"Memory and storage\"\n \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": - 9,\n \"displayText\": \"Sensors\"\n }\n ]\n }\n + 118,\n \"displayText\": \"Sensors\"\n }\n ]\n }\n \ },\n {\n \"questions\": [\n \"Connect monitors, accessories, and other devices\"\n ],\n \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou can connect monitors, accessories, and other devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface Dock (sold separately). With Surface Dock, you can switch between fully connected and fully mobile - with a single connector.\",\n \"confidenceScore\": 0.4067,\n \"id\": - 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + with a single connector.\",\n \"confidenceScore\": 0.5997,\n \"id\": + 173,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": - 0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your + 0,\n \"qnaId\": 174,\n \"displayText\": \"Set up your workspace with Surface Dock\"\n },\n {\n \"displayOrder\": - 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or + 1,\n \"qnaId\": 175,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n \ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n \ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect @@ -95,21 +95,21 @@ interactions: is for video only. Audio will play from your Surface speakers unless you\u2019ve connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) [volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) - on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4511,\n \"id\": 177,\n \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: f2cf1974-868f-42c6-b183-ff7f5df0ebe4 - content-length: '7123' + apim-request-id: fcbbefc3-2e1b-478b-a82d-c9661b218841 + content-length: '7137' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Thu, 30 Sep 2021 15:52:35 GMT + date: Thu, 28 Oct 2021 03:30:23 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '519' + x-envoy-upstream-service-time: '327' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc_with_answerspan.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc_with_answerspan.yaml index 862b6d6d3678..30d9397cabef 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc_with_answerspan.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_llc_with_answerspan.yaml @@ -11,9 +11,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -64,15 +64,15 @@ interactions: on Surface.com. |\\n| Sensors | Six sensors\u2014 accelerometer, magnetometer, gyro, ambient light sensor, Hall effect, Wi-Fi SAR\u2014let apps do things like track motion and determine location. |\",\n \"confidenceScore\": - 1.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 114,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": - 6,\n \"displayText\": \"Software\"\n },\n {\n - \ \"displayOrder\": 1,\n \"qnaId\": 7,\n \"displayText\": + 115,\n \"displayText\": \"Software\"\n },\n {\n + \ \"displayOrder\": 1,\n \"qnaId\": 116,\n \"displayText\": \"Processor\"\n },\n {\n \"displayOrder\": 2,\n - \ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n + \ \"qnaId\": 117,\n \"displayText\": \"Memory and storage\"\n \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": - 9,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n + 118,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n \ \"answerSpan\": {\n \"text\": \"\\nSurface Pro 4 has the ports you expect in a full-feature laptop.\\n\\nFull-size USB 3.0 port Connect a USB accessory like a mouse, printer, Ethernet adapter, USB drive, or smartphone\",\n @@ -83,19 +83,15 @@ interactions: accessories, and other devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface Dock (sold separately). With Surface Dock, you can switch between fully connected - and fully mobile with a single connector.\",\n \"confidenceScore\": 0.4067,\n - \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + and fully mobile with a single connector.\",\n \"confidenceScore\": 0.5997,\n + \ \"id\": 173,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": - 0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your + 0,\n \"qnaId\": 174,\n \"displayText\": \"Set up your workspace with Surface Dock\"\n },\n {\n \"displayOrder\": - 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or + 1,\n \"qnaId\": 175,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n - \ },\n \"answerSpan\": {\n \"text\": \"\\nYou can connect - monitors, accessories, and other devices directly to your Surface Pro 4 using - the USB port, Mini DisplayPort, or Bluetooth\",\n \"confidenceScore\": - 0.051399999999999994,\n \"offset\": 53,\n \"length\": 140\n \ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n \ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect it to your Surface using a DisplayPort to Mini DisplayPort cable (sold separately). @@ -104,21 +100,21 @@ interactions: is for video only. Audio will play from your Surface speakers unless you\u2019ve connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) [volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) - on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4511,\n \"id\": 177,\n \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: ec633ba0-764f-4865-8e8b-69ffbc1f74f5 - content-length: '7719' + apim-request-id: ecacf877-02ba-469f-94e4-7b004bcba242 + content-length: '7449' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Thu, 30 Sep 2021 15:52:37 GMT + date: Thu, 28 Oct 2021 03:30:25 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '663' + x-envoy-upstream-service-time: '783' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_only_id.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_only_id.yaml index c46b8b79716e..8ac7179c529f 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_only_id.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_only_id.yaml @@ -9,31 +9,25 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: - string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Charge - your Surface Pro 4\"\n ],\n \"answer\": \"**Charge your Surface - Pro 4**\\n\\n1. Connect the two parts of the power cord.\\n\\n2. Connect - the power cord securely to the charging port.\\n\\n3. Plug the power supply - into an electrical outlet.\",\n \"confidenceScore\": 1.0,\n \"id\": - 19,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": - {\n \"explicitlytaggedheading\": \"charge your surface pro 4\"\n },\n - \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": - []\n }\n }\n ]\n}" + string: "{\n \"answers\": [\n {\n \"questions\": [],\n \"answer\": + \"No good match found in KB\",\n \"confidenceScore\": 0.0,\n \"id\": + -1,\n \"metadata\": {}\n }\n ]\n}" headers: - apim-request-id: 824a47b2-1f4a-4056-8c26-ddba66a21497 - content-length: '583' + apim-request-id: a9b84106-3ca9-434d-8295-4256bafc7d95 + content-length: '169' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Thu, 30 Sep 2021 15:52:35 GMT + date: Thu, 28 Oct 2021 03:30:25 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '879' + x-envoy-upstream-service-time: '129' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_overload.yaml index c4cf69673348..c7e4cece2657 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_overload.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_overload.yaml @@ -12,37 +12,37 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Make your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor info on how to care for your battery and power supply, conserve power, and make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power) - on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\": - 27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9079,\n \"id\": 136,\n + \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n },\n {\n \"questions\": [\n \"Check the battery level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\": - 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.48469999999999996,\n \"id\": 133,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: cd3dad50-3644-4273-afc0-442c50d22419 - content-length: '1140' + apim-request-id: 8b20dc3d-50ea-490c-8cee-4e8efee290fe + content-length: '1143' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Thu, 30 Sep 2021 15:52:35 GMT + date: Thu, 28 Oct 2021 03:30:26 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '1047' + x-envoy-upstream-service-time: '714' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_python_dict.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_python_dict.yaml index 2b3cc394ee2c..5c7983a6fa6b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_python_dict.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_python_dict.yaml @@ -9,31 +9,25 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: - string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Charge - your Surface Pro 4\"\n ],\n \"answer\": \"**Charge your Surface - Pro 4**\\n\\n1. Connect the two parts of the power cord.\\n\\n2. Connect - the power cord securely to the charging port.\\n\\n3. Plug the power supply - into an electrical outlet.\",\n \"confidenceScore\": 1.0,\n \"id\": - 19,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": - {\n \"explicitlytaggedheading\": \"charge your surface pro 4\"\n },\n - \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": - []\n }\n }\n ]\n}" + string: "{\n \"answers\": [\n {\n \"questions\": [],\n \"answer\": + \"No good match found in KB\",\n \"confidenceScore\": 0.0,\n \"id\": + -1,\n \"metadata\": {}\n }\n ]\n}" headers: - apim-request-id: 9980db27-58c1-485e-995a-933a4e41e08c - content-length: '583' + apim-request-id: 2ce68ffe-7056-4574-a8ad-4bbd66c66719 + content-length: '169' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Thu, 30 Sep 2021 15:52:34 GMT + date: Thu, 28 Oct 2021 03:30:27 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '135' + x-envoy-upstream-service-time: '121' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_answerspan.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_answerspan.yaml index 8e6127f52048..20c08f5f5826 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_answerspan.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_answerspan.yaml @@ -1,19 +1,19 @@ interactions: - request: body: '{"question": "Ports and connectors", "top": 3, "context": {"previousQnaId": - 4, "previousUserQuery": "Meet Surface Pro 4"}, "answerSpanRequest": {"enable": - true, "confidenceScoreThreshold": 0.1, "topAnswersWithSpan": 2}}' + 4}, "answerSpanRequest": {"enable": true, "confidenceScoreThreshold": 0.1, "topAnswersWithSpan": + 2}}' headers: Accept: - application/json Content-Length: - - '219' + - '176' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -64,15 +64,15 @@ interactions: on Surface.com. |\\n| Sensors | Six sensors\u2014 accelerometer, magnetometer, gyro, ambient light sensor, Hall effect, Wi-Fi SAR\u2014let apps do things like track motion and determine location. |\",\n \"confidenceScore\": - 1.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 114,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": - 6,\n \"displayText\": \"Software\"\n },\n {\n - \ \"displayOrder\": 1,\n \"qnaId\": 7,\n \"displayText\": + 115,\n \"displayText\": \"Software\"\n },\n {\n + \ \"displayOrder\": 1,\n \"qnaId\": 116,\n \"displayText\": \"Processor\"\n },\n {\n \"displayOrder\": 2,\n - \ \"qnaId\": 8,\n \"displayText\": \"Memory and storage\"\n + \ \"qnaId\": 117,\n \"displayText\": \"Memory and storage\"\n \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": - 9,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n + 118,\n \"displayText\": \"Sensors\"\n }\n ]\n },\n \ \"answerSpan\": {\n \"text\": \"\\nSurface Pro 4 has the ports you expect in a full-feature laptop.\\n\\nFull-size USB 3.0 port Connect a USB accessory like a mouse, printer, Ethernet adapter, USB drive, or smartphone\",\n @@ -83,19 +83,15 @@ interactions: accessories, and other devices directly to your Surface Pro 4 using the USB port, Mini DisplayPort, or Bluetooth. Or, connect everything to a Surface Dock (sold separately). With Surface Dock, you can switch between fully connected - and fully mobile with a single connector.\",\n \"confidenceScore\": 0.4067,\n - \ \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + and fully mobile with a single connector.\",\n \"confidenceScore\": 0.5997,\n + \ \"id\": 173,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": - 0,\n \"qnaId\": 65,\n \"displayText\": \"Set up your + 0,\n \"qnaId\": 174,\n \"displayText\": \"Set up your workspace with Surface Dock\"\n },\n {\n \"displayOrder\": - 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or + 1,\n \"qnaId\": 175,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n - \ },\n \"answerSpan\": {\n \"text\": \"\\nYou can connect - monitors, accessories, and other devices directly to your Surface Pro 4 using - the USB port, Mini DisplayPort, or Bluetooth\",\n \"confidenceScore\": - 0.051399999999999994,\n \"offset\": 53,\n \"length\": 140\n \ }\n },\n {\n \"questions\": [\n \"Projector or monitor.\"\n \ ],\n \"answer\": \"If your monitor has a DisplayPort, you can connect it to your Surface using a DisplayPort to Mini DisplayPort cable (sold separately). @@ -104,21 +100,21 @@ interactions: is for video only. Audio will play from your Surface speakers unless you\u2019ve connected external speakers. For more info about this, see [Surface sound,](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) [volume, and audio accessories](http://www.microsoft.com/surface/support/hardware-and-drivers/sound-volume-and-speakers) - on Surface.com.\",\n \"confidenceScore\": 0.3392,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4511,\n \"id\": 177,\n \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {},\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: db614ffe-6d30-40e1-96a9-f90e41d9dd0d - content-length: '7719' + apim-request-id: cee0eb97-588b-4fd4-9296-9017b117d5c2 + content-length: '7449' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Thu, 30 Sep 2021 15:52:35 GMT + date: Thu, 28 Oct 2021 03:30:27 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '633' + x-envoy-upstream-service-time: '715' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_dictparams.yaml index 513de2a22841..8e73471a5382 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_dictparams.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_dictparams.yaml @@ -12,37 +12,37 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Make your battery last\"\n ],\n \"answer\": \"**Make your battery last**\\n\\nFor info on how to care for your battery and power supply, conserve power, and make your Surface battery last longer, see [Surface battery and power](http://www.microsoft.com/surface/support/hardware-and-drivers/battery-and-power) - on Surface.com.\",\n \"confidenceScore\": 0.9201999999999999,\n \"id\": - 27,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9079,\n \"id\": 136,\n + \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": {\n \"explicitlytaggedheading\": \"make your battery last\"\n },\n \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n },\n {\n \"questions\": [\n \"Check the battery level\"\n ],\n \"answer\": \"**Check the battery level**\\n\\nYou can check the battery level from the lock screen or the desktop:\",\n \"confidenceScore\": - 0.4412,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.48469999999999996,\n \"id\": 133,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"check the battery level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: e780b038-2930-45fc-99b3-35255fff74ec - content-length: '1140' + apim-request-id: 301d9bbc-0b73-4bf8-99e0-1f2a269478d4 + content-length: '1143' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Thu, 30 Sep 2021 15:52:36 GMT + date: Thu, 28 Oct 2021 03:30:28 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '578' + x-envoy-upstream-service-time: '498' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_followup.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_followup.yaml index 48d940f76cd5..a0d367a03a0a 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_followup.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_knowledgebase_async.test_query_knowledgebase_with_followup.yaml @@ -12,9 +12,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b3 Python/3.9.5 (macOS-11.6-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Make @@ -33,18 +33,18 @@ interactions: level\"\n },\n \"dialog\": {\n \"isContextOnly\": false,\n \ \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: 6187c0d0-4bd8-496c-91cd-7dde5702a7b3 + apim-request-id: 363ebd94-3a69-4c77-8850-6dccbe406498 content-length: '1143' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Wed, 27 Oct 2021 16:43:51 GMT + date: Thu, 28 Oct 2021 03:30:29 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '573' + x-envoy-upstream-service-time: '544' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 - request: body: '{"question": "How long it takes to charge Surface?", "top": 3, "userId": "sd53lsY=", "confidenceScoreThreshold": 0.2, "context": {"previousQnaId": 136, @@ -59,9 +59,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b3 Python/3.9.5 (macOS-11.6-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Power @@ -87,16 +87,16 @@ interactions: four hours\",\n \"confidenceScore\": 0.3795,\n \"offset\": 32,\n \ \"length\": 19\n }\n }\n ]\n}" headers: - apim-request-id: f212d9e9-69c3-4e8b-94cd-d1d78097320c + apim-request-id: 535319e1-aef0-4d6a-9487-459f65599282 content-length: '1594' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 - date: Wed, 27 Oct 2021 16:43:52 GMT + date: Thu, 28 Oct 2021 03:30:29 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '576' + x-envoy-upstream-service-time: '605' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml index b1a0f0a77e70..c2fdf089e8b2 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml @@ -93,7 +93,7 @@ interactions: USB 3.1 Always-On, USB 3.1, Headphone/Mic, microSD RAM16GB RAM Upgradable to16GB Size12.1 x 8.3 x .57 inches Touchpad Size4.3 x 2.2 inches USB Ports3 Video Memory2GB Warranty/Supportone-year warranty. Weight2.8 pounds Wi-Fi802.11ac Wi-Fi ModelIntel - Wireless-AC 9560 "}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' + Wireless-AC 9560 "}], "language": "en"}' headers: Accept: - application/json @@ -102,13 +102,13 @@ interactions: Connection: - keep-alive Content-Length: - - '7448' + - '7409' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Battery Life Get an @@ -119,44 +119,44 @@ interactions: Battery Life - Longest Lasting Laptop Batteries Competing laptops like the ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53) outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n - \ \"confidenceScore\": 0.01745828054845333,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.017458291724324226,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\": - 0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": + 0.26247388,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": 1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with 11-plus hours of battery life (on the FHD model), the Envy 13 has a sleek, ultraportable chassis, fast performance, and powerful speakers. Best of all, the Envy 13 starts at a reasonable $799, which is hundreds less than the competition. In many ways, the Envy 13 is what we wanted the new MacBook Air to be.\",\n - \ \"confidenceScore\": 0.00940172653645277,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.009401722811162472,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": - 0.35305238,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": + 0.3530523,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": 4508,\n \"length\": 319\n },\n {\n \"answer\": \"We also recommend the Samsung Notebook 9 Pro, which has a similarly premium design but much better battery life than the 4K Envy. The Microsoft Surface Laptop 2 is another recommended alternative, though you might want to wait a few months for the rumored Surface Laptop 3. Overall, the HP Envy 13 is a fantastic laptop that checks all the right boxes --- as long as you buy the 1080p model.\",\n - \ \"confidenceScore\": 0.007057250943034887,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.0070572528056800365,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": 5391,\n \"length\": 393\n }\n ]\n}" headers: apim-request-id: - - abf593a7-19a1-45a9-b94c-e590f8f3bf5a + - 888507f3-3fba-4bfe-8013-f007a5e24c1c content-length: - - '2146' + - '2148' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9 date: - - Thu, 30 Sep 2021 15:52:33 GMT + - Thu, 28 Oct 2021 03:30:31 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '323' + - '341' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml index 3a55e7c933ba..032a02a1aa14 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml @@ -106,9 +106,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Battery Life Get an @@ -138,25 +138,25 @@ interactions: that checks all the right boxes --- as long as you buy the 1080p model.\",\n \ \"confidenceScore\": 0.007057250943034887,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": - 0.5914322,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": + 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": 5391,\n \"length\": 393\n }\n ]\n}" headers: apim-request-id: - - 63f09596-dbf2-44ac-a8f9-c3de2917c426 + - d1aedf5e-6179-4cc9-9fb6-dad9703e730a content-length: - - '2145' + - '2146' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9 date: - - Thu, 30 Sep 2021 15:52:33 GMT + - Thu, 28 Oct 2021 03:30:32 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '304' + - '352' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml index fb3f72c08da0..0a068df390f8 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml @@ -8,7 +8,7 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' + port on your Surface."}]}' headers: Accept: - application/json @@ -17,20 +17,20 @@ interactions: Connection: - keep-alive Content-Length: - - '707' + - '650' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n - \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"0\",\n \"answerSpan\": + \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\": 0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two @@ -48,7 +48,7 @@ interactions: 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: apim-request-id: - - f0c97e63-de33-41db-bebd-3a34cc810fad + - b03bdeb6-aad3-4a9f-9753-4395ab9adaca content-length: - '1481' content-type: @@ -56,13 +56,13 @@ interactions: csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 date: - - Thu, 30 Sep 2021 15:52:34 GMT + - Thu, 28 Oct 2021 03:30:32 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '255' + - '274' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml index 72d83dc51e68..31c0fc477410 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml @@ -8,7 +8,7 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' + port on your Surface."}], "language": "en"}' headers: Accept: - application/json @@ -17,38 +17,38 @@ interactions: Connection: - keep-alive Content-Length: - - '707' + - '668' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n - \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"1\",\n \"answerSpan\": + \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\": 0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\": - 0.9254359602928162,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\": + 0.9254359006881714,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\": 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming - while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503518134355545,\n + while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n \ \"id\": \"1\",\n \"answerSpan\": {\n \"text\": \"longer\",\n \ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: apim-request-id: - - 00eefdf8-2d1a-4d4b-9d64-6d28ebc6b0a5 + - 99de7390-bcae-472f-be97-eeb9b91254f6 content-length: - '1478' content-type: @@ -56,13 +56,13 @@ interactions: csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 date: - - Thu, 30 Sep 2021 15:52:34 GMT + - Thu, 28 Oct 2021 03:30:33 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '203' + - '272' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml index 906db8907bfc..ec57077a3219 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml @@ -8,7 +8,7 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' + port on your Surface."}], "language": "en"}' headers: Accept: - application/json @@ -17,13 +17,13 @@ interactions: Connection: - keep-alive Content-Length: - - '707' + - '668' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Power and charging. @@ -42,27 +42,27 @@ interactions: 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming - while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503518134355545,\n + while you\u2019re charging it.\",\n \"confidenceScore\": 0.055035144090652466,\n \ \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"longer\",\n - \ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\": + \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: apim-request-id: - - 390cb02b-4245-4719-8556-59acc1863554 + - 5f11c3c3-b3fa-4c5c-9cd0-efd30bd29c28 content-length: - - '1478' + - '1481' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 date: - - Thu, 30 Sep 2021 15:52:34 GMT + - Thu, 28 Oct 2021 03:30:33 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '243' + - '231' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml index 33d966c39351..d7e02a0fb24e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml @@ -93,18 +93,18 @@ interactions: USB 3.1 Always-On, USB 3.1, Headphone/Mic, microSD RAM16GB RAM Upgradable to16GB Size12.1 x 8.3 x .57 inches Touchpad Size4.3 x 2.2 inches USB Ports3 Video Memory2GB Warranty/Supportone-year warranty. Weight2.8 pounds Wi-Fi802.11ac Wi-Fi ModelIntel - Wireless-AC 9560 "}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' + Wireless-AC 9560 "}], "language": "en"}' headers: Accept: - application/json Content-Length: - - '7448' + - '7409' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Battery Life Get an @@ -115,9 +115,9 @@ interactions: Battery Life - Longest Lasting Laptop Batteries Competing laptops like the ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53) outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n - \ \"confidenceScore\": 0.01745828054845333,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.01745828241109848,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\": - 0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": + 0.26247388,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": 1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with 11-plus hours of battery life (on the FHD model), the Envy 13 has a sleek, ultraportable chassis, fast performance, and powerful speakers. Best of all, @@ -132,21 +132,21 @@ interactions: recommended alternative, though you might want to wait a few months for the rumored Surface Laptop 3. Overall, the HP Envy 13 is a fantastic laptop that checks all the right boxes --- as long as you buy the 1080p model.\",\n - \ \"confidenceScore\": 0.007057250943034887,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.0070572528056800365,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": 5391,\n \"length\": 393\n }\n ]\n}" headers: - apim-request-id: 51ce1817-cad9-4c5e-a2b3-4391b42b3211 - content-length: '2146' + apim-request-id: ce811191-0ba3-464d-b745-ceb2b36957f5 + content-length: '2147' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9 - date: Thu, 30 Sep 2021 15:52:35 GMT + date: Thu, 28 Oct 2021 03:30:33 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '292' + x-envoy-upstream-service-time: '262' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml index 0d9cdddeb235..52ed65797d00 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml @@ -102,9 +102,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Battery Life Get an @@ -115,7 +115,7 @@ interactions: Battery Life - Longest Lasting Laptop Batteries Competing laptops like the ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53) outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n - \ \"confidenceScore\": 0.01745828241109848,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.017458291724324226,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\": 0.26247388,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": 1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with @@ -123,30 +123,30 @@ interactions: ultraportable chassis, fast performance, and powerful speakers. Best of all, the Envy 13 starts at a reasonable $799, which is hundreds less than the competition. In many ways, the Envy 13 is what we wanted the new MacBook Air to be.\",\n - \ \"confidenceScore\": 0.009401722811162472,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.00940172653645277,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": - 0.3530523,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": + 0.35305238,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": 4508,\n \"length\": 319\n },\n {\n \"answer\": \"We also recommend the Samsung Notebook 9 Pro, which has a similarly premium design but much better battery life than the 4K Envy. The Microsoft Surface Laptop 2 is another recommended alternative, though you might want to wait a few months for the rumored Surface Laptop 3. Overall, the HP Envy 13 is a fantastic laptop that checks all the right boxes --- as long as you buy the 1080p model.\",\n - \ \"confidenceScore\": 0.007057250943034887,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.0070572528056800365,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": 5391,\n \"length\": 393\n }\n ]\n}" headers: - apim-request-id: bc9b76a5-d8f4-401f-a0d0-1e55341a56d0 - content-length: '2146' + apim-request-id: 0d0a1af6-13ba-4f3c-b0c7-76aef256dd3e + content-length: '2148' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9 - date: Thu, 30 Sep 2021 15:52:36 GMT + date: Thu, 28 Oct 2021 03:30:34 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '186' + x-envoy-upstream-service-time: '233' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml index c606f953a9d7..a6b8d3114b01 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml @@ -8,18 +8,18 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' + port on your Surface."}]}' headers: Accept: - application/json Content-Length: - - '707' + - '650' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Power and charging. @@ -33,26 +33,26 @@ interactions: to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\": - 0.9254360198974609,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": - \"two to four hours\",\n \"confidenceScore\": 0.98562825,\n \"offset\": + 0.9254359602928162,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": + \"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\": 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming - while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n + while you\u2019re charging it.\",\n \"confidenceScore\": 0.055035144090652466,\n \ \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"longer\",\n \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: - apim-request-id: cbb90985-1d4b-4b29-a55e-e2a6bb2ff93b + apim-request-id: 7b0c6b53-869e-433c-a48a-a4f0d89e45e1 content-length: '1481' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 - date: Thu, 30 Sep 2021 15:52:35 GMT + date: Thu, 28 Oct 2021 03:30:35 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '175' + x-envoy-upstream-service-time: '269' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml index 4a8803314774..6cf10a051d24 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml @@ -8,18 +8,18 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' + port on your Surface."}], "language": "en"}' headers: Accept: - application/json Content-Length: - - '707' + - '668' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Power and charging. @@ -38,21 +38,21 @@ interactions: 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming - while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503518134355545,\n + while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n \ \"id\": \"1\",\n \"answerSpan\": {\n \"text\": \"longer\",\n - \ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\": + \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: - apim-request-id: 5bd3db5f-1a20-4d42-8720-772e5f694ccd - content-length: '1478' + apim-request-id: 616a39bf-3762-4f03-a70e-12ef435865b7 + content-length: '1480' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 - date: Thu, 30 Sep 2021 15:52:36 GMT + date: Thu, 28 Oct 2021 03:30:36 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '633' + x-envoy-upstream-service-time: '255' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml index 4b1b34ebaadc..8931c3fd8309 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml @@ -8,51 +8,51 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' + port on your Surface."}], "language": "en"}' headers: Accept: - application/json Content-Length: - - '707' + - '668' Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) + - azsdk-python-ai-language-questionanswering/1.0.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n - \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"0\",\n \"answerSpan\": + \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\": 0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\": - 0.9254360198974609,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": + 0.9254359602928162,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.98562825,\n \"offset\": 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming - while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503518134355545,\n + while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n \ \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"longer\",\n \ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: - apim-request-id: 487b1ad3-a4b7-43d6-86aa-0b04254b2eef + apim-request-id: 5b912989-6654-46da-97cd-7e0c057a21cf content-length: '1479' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 - date: Thu, 30 Sep 2021 15:52:35 GMT + date: Thu, 28 Oct 2021 03:30:36 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '199' + x-envoy-upstream-service-time: '211' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-10-01 version: 1 diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py index 6023eebb5bd2..6dd29c67fa51 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py @@ -14,13 +14,12 @@ ) from azure.ai.language.questionanswering import QuestionAnsweringClient -from azure.ai.language.questionanswering.operations._operations import build_query_text_request, build_query_knowledge_base_request +from azure.ai.language.questionanswering.operations._operations import build_get_answers_request from azure.ai.language.questionanswering.models import ( - QueryKnowledgeBaseOptions, - KnowledgeBaseAnswerRequestContext, - AnswerSpanRequest, + AnswersOptions, + KnowledgeBaseAnswerContext, + ShortAnswerOptions, MetadataFilter, - LogicalOperationKind, QueryFilters, ) @@ -38,7 +37,7 @@ def test_query_knowledgebase_llc(self, qna_account, qna_key, qna_project): "previousQnAId": 4 } } - request = build_query_knowledge_base_request( + request = build_get_answers_request( json=json_content, project_name=qna_project, deployment_name='test' @@ -87,7 +86,7 @@ def test_query_knowledgebase_llc_with_answerspan(self, qna_account, qna_key, qna "topAnswersWithSpan": 1 } } - request = build_query_knowledge_base_request( + request = build_get_answers_request( json=json_content, project_name=qna_project, deployment_name='test' @@ -128,17 +127,17 @@ def test_query_knowledgebase_llc_with_answerspan(self, qna_account, qna_key, qna @GlobalQuestionAnsweringAccountPreparer() def test_query_knowledgebase(self, qna_account, qna_key, qna_project): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) - query_params = QueryKnowledgeBaseOptions( + query_params = AnswersOptions( question="Ports and connectors", top=3, - context=KnowledgeBaseAnswerRequestContext( - previous_user_query="Meet Surface Pro 4", + context=KnowledgeBaseAnswerContext( + previous_question="Meet Surface Pro 4", previous_qna_id=4 ) ) with client: - output = client.query_knowledge_base( + output = client.get_answers( query_params, project_name=qna_project, deployment_name='test' @@ -147,11 +146,11 @@ def test_query_knowledgebase(self, qna_account, qna_key, qna_project): assert output.answers for answer in output.answers: assert answer.answer - assert answer.confidence_score - assert answer.id + assert answer.confidence + assert answer.qna_id assert answer.source assert answer.metadata is not None - assert not answer.answer_span + assert not answer.short_answer assert answer.questions for question in answer.questions: @@ -169,22 +168,21 @@ def test_query_knowledgebase(self, qna_account, qna_key, qna_project): @GlobalQuestionAnsweringAccountPreparer() def test_query_knowledgebase_with_answerspan(self, qna_account, qna_key, qna_project): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) - query_params = QueryKnowledgeBaseOptions( + query_params = AnswersOptions( question="Ports and connectors", top=3, - context=KnowledgeBaseAnswerRequestContext( - previous_user_query="Meet Surface Pro 4", + context=KnowledgeBaseAnswerContext( + previous_question="Meet Surface Pro 4", previous_qna_id=4 ), - answer_span_request=AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.1, - top_answers_with_span=2 + short_answer_options=ShortAnswerOptions( + confidence_threshold=0.1, + top=2 ) ) with client: - output = client.query_knowledge_base( + output = client.get_answers( query_params, project_name=qna_project, deployment_name='test' @@ -193,16 +191,16 @@ def test_query_knowledgebase_with_answerspan(self, qna_account, qna_key, qna_pro assert output.answers for answer in output.answers: assert answer.answer - assert answer.confidence_score - assert answer.id + assert answer.confidence + assert answer.qna_id assert answer.source assert answer.metadata is not None - if answer.answer_span: - assert answer.answer_span.text - assert answer.answer_span.confidence_score - assert answer.answer_span.offset is not None - assert answer.answer_span.length + if answer.short_answer: + assert answer.short_answer.text + assert answer.short_answer.confidence + assert answer.short_answer.offset is not None + assert answer.short_answer.length assert answer.questions for question in answer.questions: @@ -235,14 +233,14 @@ def test_query_knowledgebase_with_dictparams(self, qna_account, qna_key, qna_pro } with client: - output = client.query_knowledge_base( + output = client.get_answers( query_params, project_name=qna_project, deployment_name='test' ) assert len(output.answers) == 2 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 1 assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf" @@ -250,23 +248,22 @@ def test_query_knowledgebase_with_dictparams(self, qna_account, qna_key, qna_pro def test_query_knowledgebase_overload(self, qna_account, qna_key, qna_project): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) with client: - output = client.query_knowledge_base( + output = client.get_answers( project_name=qna_project, deployment_name='test', question="How long should my Surface battery last?", top=3, user_id="sd53lsY=", - confidence_score_threshold=0.2, - answer_span_request=AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + confidence_threshold=0.2, + short_answer_options=ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), include_unstructured_sources=True ) assert len(output.answers) == 2 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 1 assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf" @@ -274,65 +271,63 @@ def test_query_knowledgebase_overload(self, qna_account, qna_key, qna_project): def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna_project): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) with client: - query_params = QueryKnowledgeBaseOptions( + query_params = AnswersOptions( question="How long should my Surface battery last?", top=3, user_id="sd53lsY=", - confidence_score_threshold=0.2, - answer_span_request=AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + confidence_threshold=0.2, + short_answer_options=ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), include_unstructured_sources=True ) - output = client.query_knowledge_base( + output = client.get_answers( query_params, project_name=qna_project, deployment_name='test' ) - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 1 assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf" - query_params = QueryKnowledgeBaseOptions( + query_params = AnswersOptions( question="How long it takes to charge Surface?", top=3, user_id="sd53lsY=", - confidence_score_threshold=0.2, - context=KnowledgeBaseAnswerRequestContext( - previous_user_query="How long should my Surface battery last?", - previous_qna_id=confident_answers[0].id + confidence_threshold=0.2, + context=KnowledgeBaseAnswerContext( + previous_question="How long should my Surface battery last?", + previous_qna_id=confident_answers[0].qna_id ), - answer_span_request=AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + short_answer_options=ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), include_unstructured_sources=True ) - output = client.query_knowledge_base( + output = client.get_answers( query_params, project_name=qna_project, deployment_name='test' ) assert output.answers - confident_answers = [a for a in output.answers if a.confidence_score > 0.5] + confident_answers = [a for a in output.answers if a.confidence > 0.5] assert len(confident_answers) == 1 - assert confident_answers[0].answer_span.text == " two to four hours" + assert confident_answers[0].short_answer.text == " two to four hours" @GlobalQuestionAnsweringAccountPreparer() def test_query_knowledgebase_only_id(self, qna_account, qna_key, qna_project): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) with client: - query_params = QueryKnowledgeBaseOptions( + query_params = AnswersOptions( qna_id=19 ) - output = client.query_knowledge_base( + output = client.get_answers( query_params, project_name=qna_project, deployment_name='test' @@ -346,7 +341,7 @@ def test_query_knowledgebase_python_dict(self, qna_account, qna_key, qna_project with client: query_params = {"qna_id": 19} - output = client.query_knowledge_base( + output = client.get_answers( query_params, project_name=qna_project, deployment_name='test' @@ -357,23 +352,23 @@ def test_query_knowledgebase_python_dict(self, qna_account, qna_key, qna_project def test_query_knowledgebase_overload_positional_and_kwarg(self): with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client: with pytest.raises(TypeError): - client.query_knowledge_base("positional_one", "positional_two") + client.get_answers("positional_one", "positional_two") with pytest.raises(TypeError): - client.query_knowledge_base("positional_options_bag", options="options bag by name") + client.get_answers("positional_options_bag", options="options bag by name") def test_query_knowledgebase_question_or_qna_id(self): with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client: - options = QueryKnowledgeBaseOptions() + options = AnswersOptions() with pytest.raises(TypeError): - client.query_knowledge_base( + client.get_answers( options, project_name="hello", deployment_name='test' ) with pytest.raises(TypeError): - client.query_knowledge_base( + client.get_answers( project_name="hello", deployment_name='test' ) @@ -387,11 +382,11 @@ def test_query_knowledgebase_filter(self, qna_account, qna_key, qna_project): ("explicitlytaggedheading", "check the battery level"), ("explicitlytaggedheading", "make your battery last") ], - logical_operation=LogicalOperationKind.OR_ENUM + logical_operation="OR" ), ) with QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) as client: - response = client.query_knowledge_base( + response = client.get_answers( project_name=qna_project, deployment_name='test', question="Battery life", @@ -418,7 +413,7 @@ def test_query_knowledgebase_filter_dict_params(self, qna_account, qna_key, qna_ }, } with QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) as client: - response = client.query_knowledge_base( + response = client.get_answers( project_name=qna_project, deployment_name='test', question="Battery life", diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py index 7c3b97515aba..75d406fc128a 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py @@ -16,15 +16,14 @@ from asynctestcase import AsyncQuestionAnsweringTest from azure.ai.language.questionanswering.models import ( - QueryKnowledgeBaseOptions, - KnowledgeBaseAnswerRequestContext, - AnswerSpanRequest, + AnswersOptions, + KnowledgeBaseAnswerContext, + ShortAnswerOptions, QueryFilters, MetadataFilter, - LogicalOperationKind, ) from azure.ai.language.questionanswering.aio import QuestionAnsweringClient -from azure.ai.language.questionanswering.operations._operations import build_query_knowledge_base_request, build_query_text_request +from azure.ai.language.questionanswering.operations._operations import build_get_answers_request class QnAKnowledgeBaseTestsAsync(AsyncQuestionAnsweringTest): @@ -40,7 +39,7 @@ async def test_query_knowledgebase_llc(self, qna_account, qna_key, qna_project): "previousQnAId": 4 } } - request = build_query_knowledge_base_request( + request = build_get_answers_request( json=json_content, project_name=qna_project, deployment_name='test' @@ -89,7 +88,7 @@ async def test_query_knowledgebase_llc_with_answerspan(self, qna_account, qna_ke "topAnswersWithSpan": 2 } } - request = build_query_knowledge_base_request( + request = build_get_answers_request( json=json_content, project_name=qna_project, deployment_name='test' @@ -130,17 +129,17 @@ async def test_query_knowledgebase_llc_with_answerspan(self, qna_account, qna_ke @GlobalQuestionAnsweringAccountPreparer() async def test_query_knowledgebase(self, qna_account, qna_key, qna_project): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) - query_params = QueryKnowledgeBaseOptions( + query_params = AnswersOptions( question="Ports and connectors", top=3, - context=KnowledgeBaseAnswerRequestContext( - previous_user_query="Meet Surface Pro 4", + context=KnowledgeBaseAnswerContext( + previous_questiony="Meet Surface Pro 4", previous_qna_id=4 ) ) async with client: - output = await client.query_knowledge_base( + output = await client.get_answers( query_params, project_name=qna_project, deployment_name='test' @@ -149,11 +148,11 @@ async def test_query_knowledgebase(self, qna_account, qna_key, qna_project): assert output.answers for answer in output.answers: assert answer.answer - assert answer.confidence_score - assert answer.id + assert answer.confidence + assert answer.qna_id assert answer.source assert answer.metadata is not None - assert not answer.answer_span + assert not answer.short_answer assert answer.questions for question in answer.questions: @@ -171,22 +170,21 @@ async def test_query_knowledgebase(self, qna_account, qna_key, qna_project): @GlobalQuestionAnsweringAccountPreparer() async def test_query_knowledgebase_with_answerspan(self, qna_account, qna_key, qna_project): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) - query_params = QueryKnowledgeBaseOptions( + query_params = AnswersOptions( question="Ports and connectors", top=3, - context=KnowledgeBaseAnswerRequestContext( + context=KnowledgeBaseAnswerContext( previous_user_query="Meet Surface Pro 4", previous_qna_id=4 ), - answer_span_request=AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.1, - top_answers_with_span=2 + short_answer_options=ShortAnswerOptions( + confidence_threshold=0.1, + top=2 ) ) async with client: - output = await client.query_knowledge_base( + output = await client.get_answers( query_params, project_name=qna_project, deployment_name='test' @@ -195,16 +193,16 @@ async def test_query_knowledgebase_with_answerspan(self, qna_account, qna_key, q assert output.answers for answer in output.answers: assert answer.answer - assert answer.confidence_score - assert answer.id + assert answer.confidence + assert answer.qna_id assert answer.source assert answer.metadata is not None - if answer.answer_span: - assert answer.answer_span.text - assert answer.answer_span.confidence_score - assert answer.answer_span.offset is not None - assert answer.answer_span.length + if answer.short_answer: + assert answer.short_answer.text + assert answer.short_answer.confidence + assert answer.short_answer.offset is not None + assert answer.short_answer.length assert answer.questions for question in answer.questions: @@ -236,14 +234,14 @@ async def test_query_knowledgebase_with_dictparams(self, qna_account, qna_key, q } async with client: - output = await client.query_knowledge_base( + output = await client.get_answers( query_params, project_name=qna_project, deployment_name='test' ) assert len(output.answers) == 2 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 1 assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf" @@ -251,23 +249,22 @@ async def test_query_knowledgebase_with_dictparams(self, qna_account, qna_key, q async def test_query_knowledgebase_overload(self, qna_account, qna_key, qna_project): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) async with client: - output = await client.query_knowledge_base( + output = await client.get_answers( project_name=qna_project, deployment_name='test', question="How long should my Surface battery last?", top=3, user_id="sd53lsY=", - confidence_score_threshold=0.2, - answer_span_request=AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + confidence_threshold=0.2, + short_answer_options=ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), include_unstructured_sources=True ) assert len(output.answers) == 2 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 1 assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf" @@ -275,54 +272,52 @@ async def test_query_knowledgebase_overload(self, qna_account, qna_key, qna_proj async def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna_project): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) async with client: - query_params = QueryKnowledgeBaseOptions( + query_params = AnswersOptions( question="How long should my Surface battery last?", top=3, user_id="sd53lsY=", - confidence_score_threshold=0.2, - answer_span_request=AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + confidence_threshold=0.2, + short_answer_options=ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), include_unstructured_sources=True ) - output = await client.query_knowledge_base( + output = await client.get_answers( query_params, project_name=qna_project, deployment_name='test' ) - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 1 assert confident_answers[0].source == "surface-pro-4-user-guide-EN.pdf" - query_params = QueryKnowledgeBaseOptions( + query_params = AnswersOptions( question="How long it takes to charge Surface?", top=3, user_id="sd53lsY=", - confidence_score_threshold=0.2, - context=KnowledgeBaseAnswerRequestContext( - previous_user_query="How long should my Surface battery last?", - previous_qna_id=confident_answers[0].id + confidence_threshold=0.2, + context=KnowledgeBaseAnswerContext( + previous_question="How long should my Surface battery last?", + previous_qna_id=confident_answers[0].qna_id ), - answer_span_request=AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + short_answer_options=ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), include_unstructured_sources=True ) - output = await client.query_knowledge_base( + output = await client.get_answers( query_params, project_name=qna_project, deployment_name='test' ) assert output.answers - confident_answers = [a for a in output.answers if a.confidence_score > 0.5] + confident_answers = [a for a in output.answers if a.confidence > 0.5] assert len(confident_answers) == 1 - assert confident_answers[0].answer_span.text == " two to four hours" + assert confident_answers[0].short_answer.text == " two to four hours" @GlobalQuestionAnsweringAccountPreparer() async def test_query_knowledgebase_only_id(self, qna_account, qna_key, qna_project): @@ -330,7 +325,7 @@ async def test_query_knowledgebase_only_id(self, qna_account, qna_key, qna_proje async with client: query_params = {"qnaId": 19} - output = await client.query_knowledge_base( + output = await client.get_answers( query_params, project_name=qna_project, deployment_name='test' @@ -344,7 +339,7 @@ async def test_query_knowledgebase_python_dict(self, qna_account, qna_key, qna_p async with client: query_params = {"qna_id": 19} - output = await client.query_knowledge_base( + output = await client.get_answers( query_params, project_name=qna_project, deployment_name='test' @@ -355,23 +350,23 @@ async def test_query_knowledgebase_python_dict(self, qna_account, qna_key, qna_p async def test_query_knowledgebase_overload_positional_and_kwarg(self): async with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client: with pytest.raises(TypeError): - await client.query_knowledge_base("positional_one", "positional_two") + await client.get_answers("positional_one", "positional_two") with pytest.raises(TypeError): - await client.query_knowledge_base("positional_options_bag", options="options bag by name") + await client.get_answers("positional_options_bag", options="options bag by name") async def test_query_knowledgebase_question_or_qna_id(self): async with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client: - options = QueryKnowledgeBaseOptions() + options = AnswersOptions() with pytest.raises(TypeError): - await client.query_knowledge_base( + await client.get_answers( options, project_name="hello", deployment_name='test' ) with pytest.raises(TypeError): - await client.query_knowledge_base( + await client.get_answers( project_name="hello", deployment_name='test' ) @@ -385,11 +380,11 @@ async def test_query_knowledgebase_filter(self, qna_account, qna_key, qna_projec ("explicitlytaggedheading", "check the battery level"), ("explicitlytaggedheading", "make your battery last") ], - logical_operation=LogicalOperationKind.OR_ENUM + logical_operation="OR" ) ) async with QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) as client: - response = await client.query_knowledge_base( + response = await client.get_answers( project_name=qna_project, deployment_name='test', question="Battery life", @@ -417,7 +412,7 @@ async def test_query_knowledgebase_filter_dict_params(self, qna_account, qna_key } async with QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) as client: - response = await client.query_knowledge_base( + response = await client.get_answers( project_name=qna_project, deployment_name='test', question="Battery life", diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text.py index 434141a88a2d..863083bc614c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text.py @@ -15,10 +15,10 @@ ) from azure.ai.language.questionanswering import QuestionAnsweringClient -from azure.ai.language.questionanswering.operations._operations import build_query_text_request, build_query_knowledge_base_request +from azure.ai.language.questionanswering.operations._operations import build_get_answers_from_text_request from azure.ai.language.questionanswering.models import ( - QueryTextOptions, - TextRecord + AnswersFromTextOptions, + TextDocument ) class QnATests(QuestionAnsweringTest): @@ -44,7 +44,7 @@ def test_query_text_llc(self, qna_account, qna_key): ], "language": "en" } - request = build_query_text_request( + request = build_get_answers_from_text_request( json=json_content ) response = client.send_request(request) @@ -67,18 +67,18 @@ def test_query_text_llc(self, qna_account, qna_key): @GlobalQuestionAnsweringAccountPreparer() def test_query_text(self, qna_account, qna_key): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) - params = QueryTextOptions( + params = AnswersFromTextOptions( question="What is the meaning of life?", - records=[ - TextRecord( + text_documents=[ + TextDocument( text="abc Graphics Surprise, surprise -- our 4K ", id="doc1" ), - TextRecord( + TextDocument( text="e graphics card. While the Nvidia GeForce MX250 GPU isn't meant for demanding gaming, it is a step up from integrated graphics as proven by comparing it to the UHD 620 GPU in the FHD model. The MX250-equipped Envy 13 scored a 116,575 on the Ice Storm Unlimited benchmark while the base model scored a 82,270. Upgrading to the discrete graphics gives the Envy 13 better performance than the Notebook 9 Pro (61,662; UHD 620), Surface Laptop 2 (71,647; UHD 620) and the premium laptop average (86,937). While the Nvidia GeForce MX250 GPU isn't meant for demanding gaming, it is a step up from integrated graphics as proven by comparing it to the UHD 620 GPU in the FHD model. We played the racing game Dirt 3 at 92 frames per second on ", id="doc2" ), - TextRecord( + TextDocument( text="Graphics Surprise, surprise -- our 4K Envy 13 came with a discrete graphics card. While the Nvidia GeForce MX250 GPU isn't meant for demanding gaming, it is a step up from integrated graphics as proven by comparing it to the UHD 620 GPU in the FHD model. The MX250-equipped Envy 13 scored a 116,575 on the Ice Storm Unlimited benchmark while the base model scored a 82,270. Upgrading to the discrete graphics gives the Envy 13 better performance than the Notebook 9 Pro (61,662; UHD 620), Surface Laptop 2 (71,647; UHD 620) and the premium laptop average (86,937). While the Nvidia GeForce MX250 GPU isn't meant for demanding gaming, it is a step up from integrated graphics as proven by comparing it to the UHD 620 GPU in the FHD model. We played the racing game Dirt 3 at 92 frames per second on the MX250 model, which is well above our 30-fps playability, the category average (69 fps) and what the Surface Laptop 2 (82 fps) achieved. The ZenBook S UX391UA (45 fps) fell flat on this real-world test but ran better than the base model Envy 13 (31 fps). Audio I had a good ol' time groovin' to the sound of the Envy 13's crisp speakers. HP went all out with the Envy, placing dual speakers on the underside of the chassis along with a third, top-firing driver above the keyboard. Devon Gilfillian's funky jam \"Here and Now\" boomed smooth, soulful tunes throughout my small apartment. The twang of the electric guitar played nicely with the thudding percussion but never overshadowed Gilfillian or the female backup vocals. Bang & Olufsen software comes preinstalled on the Envy 13, with equalizer controls so you can adjust the bass, midrange and treble to your liking. But even out of the box, you'll enjoy great sound without having to bust out your headphones. Battery Life Get an Envy 13 with the 1080p non-touch display if battery life is important to you. The FHD model endured for 11 hours and 11 minutes whereas the 4K model lasted only 4 hours and 36 minutes on our battery test, which involves continuous web browsing over Wi-Fi at 150 nits of brightness. MORE: Laptops with Best Battery Life - Longest Lasting Laptop Batteries Competing laptops like the ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53) outstayed the 4K Envy 13 but powered down long before the 1080p version. Webcam The 720p webcam on the Envy 13 is nothing to write home about. A selfie I snapped in my dimly lit room was covered in a haze of visual noise. My beard and hair were unkempt blobs, while my eyes looked like they were drawn on by a pointillist painter. If there's one positive, it's that the lens captures natural colors and even extracted the different shades of gray in my T-shirt. On the right edge of the Envy 13 is a physical kill switch that cuts the power to the webcam so you can feel reassured that nobody is snooping on you. Heat Leave the lapdesk at home - you don't have to worry about the Envy 13 overheating. After I played a 15-minute, full-HD video in full screen, the touchpad on the HP Envy 13 with a Core i7 CPU rose to only 83 degrees Fahrenheit while the keyboard (87 degrees) and underside (90 degrees) also remained well below our 95-degree comfort threshold. Even the toastiest part of the machine, the lower-left edge on the underside, topped out at 94 degrees. Software and Warranty It's a shame that a laptop with such beautiful hardware ships with such ugly software. Pre-installed on this machine are entirely too many programs that could either be packaged together or omitted altogether. HP provides an app called Audio Switch, which simply lets you switch your audio input/output between the internal speakers and headphones. As the same implies, HP's Command Center is where you can get information about your Envy 13 but also switch the thermal profiles between comfort and performance. Along with support documentation, HP also bundles in a setup program called JumpStart, a program for connecting printers and a redundant system-info app called Event Utility. Also installed on the Envy 13's Windows 10 Home OS are several Microsoft apps, including Simple Solitaire, Candy Crush Friends and Your Phone. Other third-party apps include Booking.com, Netflix and McAfee Security. HP ships the Envy 13 with a one-year warranty. See how HP did on our Tech Support Showdown and Best and Worst Brands ranking. Bottom Line The Envy 13 has cemented its standing as the ultimate laptop for college students or travelers. Along with 11-plus hours of battery life (on the FHD model), the Envy 13 has a sleek, ultraportable chassis, fast performance, and powerful speakers. Best of all, the Envy 13 starts at a reasonable $799, which is hundreds less than the competition. In many ways, the Envy 13 is what we wanted the new MacBook Air to be. The new HP Envy 13 is everything I was hoping the new MacBook Air would be: fast, attractive and affordable. Just be sure to buy the right model. We strongly recommend the 1080p version over the 4K model because it lasts several hours longer on a charge and costs less. In fact, if we were reviewing the 4K model separately, we'd only give it a 3.5 rating. You should also consider the Envy 13 with a 10th Gen CPU, although we haven't gotten the chance to review it yet. If you absolutely need a high-res display, the 4K Envy 13 is one of many good options. We also recommend the Samsung Notebook 9 Pro, which has a similarly premium design but much better battery life than the 4K Envy. The Microsoft Surface Laptop 2 is another recommended alternative, though you might want to wait a few months for the rumored Surface Laptop 3. Overall, the HP Envy 13 is a fantastic laptop that checks all the right boxes --- as long as you buy the 1080p model. Credit: Laptop Mag HP Envy 13 (2019) Specs BluetoothBluetooth 5.0 BrandHP CPUIntel Core i7-8565U Card SlotsmicroSD Company Websitehttps://www8.hp.com/us/en/home.html Display Size13.3 Graphics CardNvidia GeForce MX250 Hard Drive Size512GB Hard Drive TypePCIe NVMe M.2 Highest Available Resolution3840 x 2160 Native Resolution3840 x 2160 Operating SystemWindows 10 Home Ports (excluding USB)USB 3.1 with Type-C, USB 3.1 Always-On, USB 3.1, Headphone/Mic, microSD RAM16GB RAM Upgradable to16GB Size12.1 x 8.3 x .57 inches Touchpad Size4.3 x 2.2 inches USB Ports3 Video Memory2GB Warranty/Supportone-year warranty. Weight2.8 pounds Wi-Fi802.11ac Wi-Fi ModelIntel Wireless-AC 9560 ", id="doc3" ) @@ -86,19 +86,19 @@ def test_query_text(self, qna_account, qna_key): language="en" ) - output = client.query_text(params) + output = client.get_answers_from_text(params) assert output.answers for answer in output.answers: assert answer.answer - assert answer.confidence_score + assert answer.confidence assert answer.id assert answer.offset assert answer.length - assert answer.answer_span - assert answer.answer_span.text - assert answer.answer_span.confidence_score - assert answer.answer_span.offset is not None - assert answer.answer_span.length + assert answer.short_answer + assert answer.short_answer.text + assert answer.short_answer.confidence + assert answer.short_answer.offset is not None + assert answer.short_answer.length @GlobalQuestionAnsweringAccountPreparer() def test_query_text_with_dictparams(self, qna_account, qna_key): @@ -121,11 +121,11 @@ def test_query_text_with_dictparams(self, qna_account, qna_key): } with client: - output = client.query_text(params) + output = client.get_answers_from_text(params) assert len(output.answers) == 3 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 2 - assert confident_answers[0].answer_span.text == "two to four hours" + assert confident_answers[0].short_answer.text == "two to four hours" @GlobalQuestionAnsweringAccountPreparer() @@ -143,11 +143,11 @@ def test_query_text_with_str_records(self, qna_account, qna_key): } with client: - output = client.query_text(params) + output = client.get_answers_from_text(params) assert len(output.answers) == 3 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 2 - assert confident_answers[0].answer_span.text == "two to four hours" + assert confident_answers[0].short_answer.text == "two to four hours" @GlobalQuestionAnsweringAccountPreparer() def test_query_text_overload(self, qna_account, qna_key): @@ -155,9 +155,9 @@ def test_query_text_overload(self, qna_account, qna_key): with client: with pytest.raises(TypeError): - client.query_text( + client.get_answers_from_text( question="How long it takes to charge surface?", - records=[ + text_documents=[ "Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. " + "It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.", { @@ -167,9 +167,9 @@ def test_query_text_overload(self, qna_account, qna_key): } ] ) - output = client.query_text( + output = client.get_answers_from_text( question="How long it takes to charge surface?", - records=[ + text_documents=[ "Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. " + "It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.", "You can use the USB port on your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. "+ @@ -177,13 +177,13 @@ def test_query_text_overload(self, qna_account, qna_key): ] ) assert len(output.answers) == 3 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 2 - assert confident_answers[0].answer_span.text == "two to four hours" + assert confident_answers[0].short_answer.text == "two to four hours" def test_query_text_overload_positional_and_kwarg(self): with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client: with pytest.raises(TypeError): - client.query_text("positional_one", "positional_two") + client.get_answers_from_text("positional_one", "positional_two") with pytest.raises(TypeError): - client.query_text("positional_options_bag", options="options bag by name") + client.get_answers_from_text("positional_options_bag", options="options bag by name") diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text_async.py index b5d6323a64db..829bc32dcd3b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_text_async.py @@ -15,10 +15,10 @@ ) from azure.ai.language.questionanswering.aio import QuestionAnsweringClient -from azure.ai.language.questionanswering.operations._operations import build_query_text_request, build_query_knowledge_base_request +from azure.ai.language.questionanswering.operations._operations import build_get_answers_from_text_request from azure.ai.language.questionanswering.models import ( - QueryTextOptions, - TextRecord + AnswersFromTextOptions, + TextDocument ) class QnATests(QuestionAnsweringTest): @@ -46,7 +46,7 @@ async def test_query_text_llc(self, qna_account, qna_key): ], "language": "en" } - request = build_query_text_request( + request = build_get_answers_from_text_request( json=json_content ) response = await client.send_request(request) @@ -69,18 +69,18 @@ async def test_query_text_llc(self, qna_account, qna_key): @GlobalQuestionAnsweringAccountPreparer() async def test_query_text(self, qna_account, qna_key): client = QuestionAnsweringClient(qna_account, AzureKeyCredential(qna_key)) - params = QueryTextOptions( + params = AnswersFromTextOptions( question="What is the meaning of life?", - records=[ - TextRecord( + text_documents=[ + TextDocument( text="abc Graphics Surprise, surprise -- our 4K ", id="doc1" ), - TextRecord( + TextDocument( text="e graphics card. While the Nvidia GeForce MX250 GPU isn't meant for demanding gaming, it is a step up from integrated graphics as proven by comparing it to the UHD 620 GPU in the FHD model. The MX250-equipped Envy 13 scored a 116,575 on the Ice Storm Unlimited benchmark while the base model scored a 82,270. Upgrading to the discrete graphics gives the Envy 13 better performance than the Notebook 9 Pro (61,662; UHD 620), Surface Laptop 2 (71,647; UHD 620) and the premium laptop average (86,937). While the Nvidia GeForce MX250 GPU isn't meant for demanding gaming, it is a step up from integrated graphics as proven by comparing it to the UHD 620 GPU in the FHD model. We played the racing game Dirt 3 at 92 frames per second on ", id="doc2" ), - TextRecord( + TextDocument( text="Graphics Surprise, surprise -- our 4K Envy 13 came with a discrete graphics card. While the Nvidia GeForce MX250 GPU isn't meant for demanding gaming, it is a step up from integrated graphics as proven by comparing it to the UHD 620 GPU in the FHD model. The MX250-equipped Envy 13 scored a 116,575 on the Ice Storm Unlimited benchmark while the base model scored a 82,270. Upgrading to the discrete graphics gives the Envy 13 better performance than the Notebook 9 Pro (61,662; UHD 620), Surface Laptop 2 (71,647; UHD 620) and the premium laptop average (86,937). While the Nvidia GeForce MX250 GPU isn't meant for demanding gaming, it is a step up from integrated graphics as proven by comparing it to the UHD 620 GPU in the FHD model. We played the racing game Dirt 3 at 92 frames per second on the MX250 model, which is well above our 30-fps playability, the category average (69 fps) and what the Surface Laptop 2 (82 fps) achieved. The ZenBook S UX391UA (45 fps) fell flat on this real-world test but ran better than the base model Envy 13 (31 fps). Audio I had a good ol' time groovin' to the sound of the Envy 13's crisp speakers. HP went all out with the Envy, placing dual speakers on the underside of the chassis along with a third, top-firing driver above the keyboard. Devon Gilfillian's funky jam \"Here and Now\" boomed smooth, soulful tunes throughout my small apartment. The twang of the electric guitar played nicely with the thudding percussion but never overshadowed Gilfillian or the female backup vocals. Bang & Olufsen software comes preinstalled on the Envy 13, with equalizer controls so you can adjust the bass, midrange and treble to your liking. But even out of the box, you'll enjoy great sound without having to bust out your headphones. Battery Life Get an Envy 13 with the 1080p non-touch display if battery life is important to you. The FHD model endured for 11 hours and 11 minutes whereas the 4K model lasted only 4 hours and 36 minutes on our battery test, which involves continuous web browsing over Wi-Fi at 150 nits of brightness. MORE: Laptops with Best Battery Life - Longest Lasting Laptop Batteries Competing laptops like the ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53) outstayed the 4K Envy 13 but powered down long before the 1080p version. Webcam The 720p webcam on the Envy 13 is nothing to write home about. A selfie I snapped in my dimly lit room was covered in a haze of visual noise. My beard and hair were unkempt blobs, while my eyes looked like they were drawn on by a pointillist painter. If there's one positive, it's that the lens captures natural colors and even extracted the different shades of gray in my T-shirt. On the right edge of the Envy 13 is a physical kill switch that cuts the power to the webcam so you can feel reassured that nobody is snooping on you. Heat Leave the lapdesk at home - you don't have to worry about the Envy 13 overheating. After I played a 15-minute, full-HD video in full screen, the touchpad on the HP Envy 13 with a Core i7 CPU rose to only 83 degrees Fahrenheit while the keyboard (87 degrees) and underside (90 degrees) also remained well below our 95-degree comfort threshold. Even the toastiest part of the machine, the lower-left edge on the underside, topped out at 94 degrees. Software and Warranty It's a shame that a laptop with such beautiful hardware ships with such ugly software. Pre-installed on this machine are entirely too many programs that could either be packaged together or omitted altogether. HP provides an app called Audio Switch, which simply lets you switch your audio input/output between the internal speakers and headphones. As the same implies, HP's Command Center is where you can get information about your Envy 13 but also switch the thermal profiles between comfort and performance. Along with support documentation, HP also bundles in a setup program called JumpStart, a program for connecting printers and a redundant system-info app called Event Utility. Also installed on the Envy 13's Windows 10 Home OS are several Microsoft apps, including Simple Solitaire, Candy Crush Friends and Your Phone. Other third-party apps include Booking.com, Netflix and McAfee Security. HP ships the Envy 13 with a one-year warranty. See how HP did on our Tech Support Showdown and Best and Worst Brands ranking. Bottom Line The Envy 13 has cemented its standing as the ultimate laptop for college students or travelers. Along with 11-plus hours of battery life (on the FHD model), the Envy 13 has a sleek, ultraportable chassis, fast performance, and powerful speakers. Best of all, the Envy 13 starts at a reasonable $799, which is hundreds less than the competition. In many ways, the Envy 13 is what we wanted the new MacBook Air to be. The new HP Envy 13 is everything I was hoping the new MacBook Air would be: fast, attractive and affordable. Just be sure to buy the right model. We strongly recommend the 1080p version over the 4K model because it lasts several hours longer on a charge and costs less. In fact, if we were reviewing the 4K model separately, we'd only give it a 3.5 rating. You should also consider the Envy 13 with a 10th Gen CPU, although we haven't gotten the chance to review it yet. If you absolutely need a high-res display, the 4K Envy 13 is one of many good options. We also recommend the Samsung Notebook 9 Pro, which has a similarly premium design but much better battery life than the 4K Envy. The Microsoft Surface Laptop 2 is another recommended alternative, though you might want to wait a few months for the rumored Surface Laptop 3. Overall, the HP Envy 13 is a fantastic laptop that checks all the right boxes --- as long as you buy the 1080p model. Credit: Laptop Mag HP Envy 13 (2019) Specs BluetoothBluetooth 5.0 BrandHP CPUIntel Core i7-8565U Card SlotsmicroSD Company Websitehttps://www8.hp.com/us/en/home.html Display Size13.3 Graphics CardNvidia GeForce MX250 Hard Drive Size512GB Hard Drive TypePCIe NVMe M.2 Highest Available Resolution3840 x 2160 Native Resolution3840 x 2160 Operating SystemWindows 10 Home Ports (excluding USB)USB 3.1 with Type-C, USB 3.1 Always-On, USB 3.1, Headphone/Mic, microSD RAM16GB RAM Upgradable to16GB Size12.1 x 8.3 x .57 inches Touchpad Size4.3 x 2.2 inches USB Ports3 Video Memory2GB Warranty/Supportone-year warranty. Weight2.8 pounds Wi-Fi802.11ac Wi-Fi ModelIntel Wireless-AC 9560 ", id="doc3" ) @@ -88,19 +88,19 @@ async def test_query_text(self, qna_account, qna_key): language="en" ) - output = await client.query_text(params) + output = await client.get_answers_from_text(params) assert output.answers for answer in output.answers: assert answer.answer - assert answer.confidence_score + assert answer.confidence assert answer.id assert answer.offset assert answer.length - assert answer.answer_span - assert answer.answer_span.text - assert answer.answer_span.confidence_score - assert answer.answer_span.offset is not None - assert answer.answer_span.length + assert answer.short_answer + assert answer.short_answer.text + assert answer.short_answer.confidence + assert answer.short_answer.offset is not None + assert answer.short_answer.length @GlobalQuestionAnsweringAccountPreparer() async def test_query_text_with_dictparams(self, qna_account, qna_key): @@ -123,11 +123,11 @@ async def test_query_text_with_dictparams(self, qna_account, qna_key): } async with client: - output = await client.query_text(params) + output = await client.get_answers_from_text(params) assert len(output.answers) == 3 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 2 - assert confident_answers[0].answer_span.text == "two to four hours" + assert confident_answers[0].short_answer.text == "two to four hours" @GlobalQuestionAnsweringAccountPreparer() async def test_query_text_with_str_records(self, qna_account, qna_key): @@ -144,11 +144,11 @@ async def test_query_text_with_str_records(self, qna_account, qna_key): } async with client: - output = await client.query_text(params) + output = await client.get_answers_from_text(params) assert len(output.answers) == 3 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 2 - assert confident_answers[0].answer_span.text == "two to four hours" + assert confident_answers[0].short_answer.text == "two to four hours" @GlobalQuestionAnsweringAccountPreparer() async def test_query_text_overload(self, qna_account, qna_key): @@ -156,9 +156,9 @@ async def test_query_text_overload(self, qna_account, qna_key): async with client: with pytest.raises(TypeError): - await client.query_text( + await client.get_answers_from_text( question="How long it takes to charge surface?", - records=[ + text_documents=[ "Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. " + "It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.", { @@ -168,9 +168,9 @@ async def test_query_text_overload(self, qna_account, qna_key): } ] ) - output = await client.query_text( + output = await client.get_answers_from_text( question="How long it takes to charge surface?", - records=[ + text_documents=[ "Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. " + "It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.", "You can use the USB port on your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. "+ @@ -178,13 +178,13 @@ async def test_query_text_overload(self, qna_account, qna_key): ] ) assert len(output.answers) == 3 - confident_answers = [a for a in output.answers if a.confidence_score > 0.9] + confident_answers = [a for a in output.answers if a.confidence > 0.9] assert len(confident_answers) == 2 - assert confident_answers[0].answer_span.text == "two to four hours" + assert confident_answers[0].short_answer.text == "two to four hours" async def test_query_text_overload_positional_and_kwarg(self): async with QuestionAnsweringClient("http://fake.com", AzureKeyCredential("123")) as client: with pytest.raises(TypeError): - await client.query_text("positional_one", "positional_two") + await client.get_answers_from_text("positional_one", "positional_two") with pytest.raises(TypeError): - await client.query_text("positional_options_bag", options="options bag by name") + await client.get_answers_from_text("positional_options_bag", options="options bag by name") From c9dbb93b61f22a6a880a681aa7eb4a79dac3bffe Mon Sep 17 00:00:00 2001 From: antisch Date: Wed, 27 Oct 2021 21:35:05 -0700 Subject: [PATCH 4/9] Updated samples --- .../README.md | 53 ++++++++----------- .../async_samples/sample_chat_async.py | 51 ++++++++---------- .../sample_query_knowledgebase_async.py | 22 ++++---- .../async_samples/sample_query_text_async.py | 22 +++----- .../samples/sample_chat.py | 52 ++++++++---------- .../samples/sample_query_knowledgebase.py | 22 ++++---- .../samples/sample_query_text.py | 27 ++++------ 7 files changed, 104 insertions(+), 145 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md index 54ac12b9699e..5d0cd0e1fa9d 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md @@ -78,42 +78,36 @@ The following examples show common scenarios using the `client` [created above]( The only input required to ask a question using a knowledge base is just the question itself: ```python -from azure.ai.language.questionanswering import models as qna - -params = qna.QueryKnowledgeBaseOptions( - question="How long should my Surface battery last?" -) - -output = client.query_knowledge_base( - params, +output = client.get_answers( + question="How long should my Surface battery last?", project_name="FAQ", + deployment_name="test" ) for candidate in output.answers: - print("({}) {}".format(candidate.confidence_score, candidate.answer)) + print("({}) {}".format(candidate.confidence, candidate.answer)) print("Source: {}".format(candidate.source)) ``` -You can set additional properties on `QueryKnowledgeBaseOptions` to limit the number of answers, specify a minimum confidence score, and more. +You can set additional keyword options to limit the number of answers, specify a minimum confidence score, and more. ### Ask a follow-up question If your knowledge base is configured for [chit-chat][questionanswering_docs_chat], the answers from the knowledge base may include suggested [prompts for follow-up questions][questionanswering_refdocs_prompts] to initiate a conversation. You can ask a follow-up question by providing the ID of your chosen answer as the context for the continued conversation: ```python -params = qna.models.QueryKnowledgeBaseOptions( - question="How long should charging take?" - context=qna.models.KnowledgeBaseAnswerRequestContext( - previous_qna_id=previous_answer.id - ) -) +from azure.ai.language.questionanswering import models as qna -output = client.query_knowledge_base( - params, - project_name="FAQ" +output = client.get_answers( + question="How long should charging take?", + context=qna.models.KnowledgeBaseAnswerRequestContext( + previous_qna_id=previous_answer.qna_id + ), + project_name="FAQ", + deployment_name="live" ) for candidate in output.answers: - print("({}) {}".format(candidate.confidence_score, candidate.answer)) + print("({}) {}".format(candidate.confidence, candidate.answer)) print("Source: {}".format(candidate.source)) ``` @@ -125,17 +119,13 @@ The above examples can also be run asynchronously using the client in the `aio` ```python from azure.core.credentials import AzureKeyCredential from azure.ai.language.questionanswering.aio import QuestionAnsweringClient -from azure.ai.language.questionanswering import models as qna client = QuestionAnsweringClient(endpoint, credential) -params = qna.QueryKnowledgeBaseOptions( - question="How long should my Surface battery last?" -) - -output = await client.query_knowledge_base( - params, - project_name="FAQ" +output = await client.get_answers( + question="How long should my Surface battery last?", + project_name="FAQ", + deployment_name="production" ) ``` @@ -156,9 +146,10 @@ For example, if you submit a question to a non-existant knowledge base, a `400` from azure.core.exceptions import HttpResponseError try: - client.query_knowledge_base( - params, - project_name="invalid-knowledge-base" + client.get_answers( + question="Why?", + project_name="invalid-knowledge-base", + deployment_name="test" ) except HttpResponseError as error: print("Query failed: {}".format(error.message)) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py index fa80fc5e0c3c..66717206e3e4 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py @@ -35,49 +35,42 @@ async def sample_chit_chat(): client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key)) async with client: - first_question = qna.QueryKnowledgeBaseOptions( - question="How long should my Surface battery last?", + first_question="How long should my Surface battery last?" + output = await client.get_answers( + question=first_question, top=3, - confidence_score_threshold=0.2, + confidence_threshold=0.2, include_unstructured_sources=True, - answer_span_request=qna.AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + short_answer_options=qna.ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), - ) - - output = await client.query_knowledge_base( - first_question, project_name=knowledge_base_project, deployment_name="test" ) - best_candidate = [a for a in output.answers if a.confidence_score > 0.9][0] - print("Q: {}".format(first_question.question)) + best_candidate = [a for a in output.answers if a.confidence > 0.9][0] + print("Q: {}".format(first_question)) print("A: {}".format(best_candidate.answer)) - followup_question = qna.QueryKnowledgeBaseOptions( - question="How long it takes to charge Surface?", + followup_question = "How long it takes to charge Surface?" + + output = await client.get_answers( + question=followup_question, top=3, - confidence_score_threshold=0.2, - context=qna.KnowledgeBaseAnswerRequestContext( - previous_user_query="How long should my Surface battery last?", - previous_qna_id=best_candidate.id + confidence_threshold=0.2, + context=qna.KnowledgeBaseAnswerContext( + previous_question=first_question, + previous_qna_id=best_candidate.qna_id ), - answer_span_request=qna.AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + short_answer_options=qna.ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), - include_unstructured_sources=True - ) - - output = await client.query_knowledge_base( - followup_question, + include_unstructured_sources=True, project_name=knowledge_base_project, deployment_name="test" ) - print("Q: {}".format(followup_question.question)) + print("Q: {}".format(followup_question)) print("A: {}".format(output.answers[0].answer)) # [END chit_chat_async] diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_knowledgebase_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_knowledgebase_async.py index 93a4b946f7ef..126ff39aeea5 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_knowledgebase_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_knowledgebase_async.py @@ -35,25 +35,21 @@ async def sample_query_knowledgebase(): client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key)) async with client: - input = qna.QueryKnowledgeBaseOptions( - question="How long should my Surface battery last?", + question="How long should my Surface battery last?" + output = await client.get_answers( + question=question, top=3, - confidence_score_threshold=0.2, + confidence_threshold=0.2, include_unstructured_sources=True, - answer_span_request=qna.AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + short_answer_options=qna.ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), - ) - - output = await client.query_knowledge_base( - input, project_name=knowledge_base_project, deployment_name="test" ) - best_candidate = [a for a in output.answers if a.confidence_score > 0.9][0] - print("Q: {}".format(input.question)) + best_candidate = [a for a in output.answers if a.confidence > 0.9][0] + print("Q: {}".format(question)) print("A: {}".format(best_candidate.answer)) # [END query_knowledgebase_async] diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_text_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_text_async.py index 8b7df0051fd0..bbc1c0fea7b9 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_text_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_query_text_async.py @@ -32,25 +32,19 @@ async def sample_query_text(): client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key)) async with client: - input = qna.QueryTextOptions( + input = qna.AnswersFromTextOptions( question="How long it takes to charge surface?", - records=[ - qna.TextRecord( - text="Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. " + - "It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.", - id="doc1" - ), - qna.TextRecord( - text="You can use the USB port on your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. " + - "The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB port on your Surface.", - id="doc2" - ) + text_documents=[ + "Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. " + + "It can take longer if you’re using your Surface for power-intensive activities like gaming or video streaming while you’re charging it.", + "You can use the USB port on your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. " + + "The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB port on your Surface.", ] ) - output = await client.query_text(input) + output = await client.get_answers_from_text(input) - best_answer = [a for a in output.answers if a.confidence_score > 0.9][0] + best_answer = [a for a in output.answers if a.confidence > 0.9][0] print("Q: {}".format(input.question)) print("A: {}".format(best_answer.answer)) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py index 033c59be5529..1a231af592c4 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py @@ -33,49 +33,43 @@ def sample_chit_chat(): client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key)) with client: - first_question = qna.QueryKnowledgeBaseOptions( - question="How long should my Surface battery last?", + first_question="How long should my Surface battery last?" + + output = client.get_answers( + question=first_question, top=3, - confidence_score_threshold=0.2, + confidence_threshold=0.2, include_unstructured_sources=True, - answer_span_request=qna.AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + short_answer_options=qna.ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), - ) - - output = client.query_knowledge_base( - first_question, project_name=knowledge_base_project, deployment_name="test" ) - best_candidate = [a for a in output.answers if a.confidence_score > 0.9][0] - print(u"Q: {}".format(first_question.question)) + best_candidate = [a for a in output.answers if a.confidence > 0.9][0] + print(u"Q: {}".format(first_question)) print(u"A: {}".format(best_candidate.answer)) - followup_question = qna.QueryKnowledgeBaseOptions( - question="How long it takes to charge Surface?", + followup_question = "How long it takes to charge Surface?" + + output = client.get_answers( + question=followup_question, top=3, - confidence_score_threshold=0.2, - context=qna.KnowledgeBaseAnswerRequestContext( - previous_user_query="How long should my Surface battery last?", - previous_qna_id=best_candidate.id + confidence_threshold=0.2, + context=qna.KnowledgeBaseAnswerContext( + previous_question=first_question, + previous_qna_id=best_candidate.qna_id ), - answer_span_request=qna.AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + short_answer_options=qna.ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), - include_unstructured_sources=True - ) - - output = client.query_knowledge_base( - followup_question, + include_unstructured_sources=True, project_name=knowledge_base_project, deployment_name="test" ) - print(u"Q: {}".format(followup_question.question)) + print(u"Q: {}".format(followup_question)) print(u"A: {}".format(output.answers[0].answer)) # [END chit_chat] diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_knowledgebase.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_knowledgebase.py index 6bfb59022c0b..d73cbdd807c8 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_knowledgebase.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_knowledgebase.py @@ -33,25 +33,21 @@ def sample_query_knowledgebase(): client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key)) with client: - input = qna.QueryKnowledgeBaseOptions( - question="How long should my Surface battery last?", + question="How long should my Surface battery last?" + output = client.get_answers( + question=question, top=3, - confidence_score_threshold=0.2, + confidence_threshold=0.2, include_unstructured_sources=True, - answer_span_request=qna.AnswerSpanRequest( - enable=True, - confidence_score_threshold=0.2, - top_answers_with_span=1 + short_answer_options=qna.ShortAnswerOptions( + confidence_threshold=0.2, + top=1 ), - ) - - output = client.query_knowledge_base( - input, project_name=knowledge_base_project, deployment_name="test" ) - best_candidate = [a for a in output.answers if a.confidence_score > 0.9][0] - print("Q: {}".format(input.question)) + best_candidate = [a for a in output.answers if a.confidence > 0.9][0] + print("Q: {}".format(question)) print("A: {}".format(best_candidate.answer)) # [END query_knowledgebase] diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_text.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_text.py index 47582b2d106a..f00c1e412a93 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_text.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_query_text.py @@ -31,26 +31,21 @@ def sample_query_text(): client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key)) with client: - input = qna.QueryTextOptions( - question="How long it takes to charge surface?", - records=[ - qna.TextRecord( - text="Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. " + - "It can take longer if you're using your Surface for power-intensive activities like gaming or video streaming while you're charging it.", - id="doc1" - ), - qna.TextRecord( - text="You can use the USB port on your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. " + - "The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB port on your Surface.", - id="doc2" - ) + question="How long it takes to charge surface?" + input = qna.AnswersFromTextOptions( + question=question, + text_documents=[ + "Power and charging. It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. " + + "It can take longer if you're using your Surface for power-intensive activities like gaming or video streaming while you're charging it.", + "You can use the USB port on your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. " + + "The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB port on your Surface.", ] ) - output = client.query_text(input) + output = client.get_answers_from_text(input) - best_answer = [a for a in output.answers if a.confidence_score > 0.9][0] - print(u"Q: {}".format(input.question)) + best_answer = [a for a in output.answers if a.confidence > 0.9][0] + print(u"Q: {}".format(question)) print(u"A: {}".format(best_answer.answer)) # [END query_text] From f5f30a3ca8f3de86df14032551f0a7c0a781712d Mon Sep 17 00:00:00 2001 From: antisch Date: Thu, 28 Oct 2021 07:06:16 -0700 Subject: [PATCH 5/9] Updated changelog --- .../CHANGELOG.md | 27 +++++++++++- .../README.md | 2 +- .../swagger/README.md | 41 ++++++++----------- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md index b2cdec3faa0b..f38be05fafcc 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md @@ -2,13 +2,36 @@ ## 1.0.0 (Unreleased) -### Features Added +* We are now targeting service version `2021-10-01` ### Breaking Changes +* Method `QuestionAnsweringClient.query_knowledge_base` has been renamed to `get_answers` +* Method `QuestionAnsweringClient.query_text` has been renamed to `get_answers_from_text` +* Model `QueryKnowledgeBaseOptions` has been renamed to `AnswersOptions` +* Method kwarg and model property `QueryKnowledgeBaseOptions.confidence_score_threshold` has been renamed to `AnswersOptions.confidence_threshold` +* Method kwarg and model property `QueryKnowledgeBaseOptions.answer_span_request` has been renamed to `AnswersOptions.short_answer_options` +* Method kwarg and model property `QueryKnowledgeBaseOptions.ranker_type` has been renamed to `AnswersOptions.ranker_kind` +* Model `QueryTextOptions` has been renamed to `AnswersFromTextOptions` +* Method kwarg and model property `QueryTextOptions.records` has been renamed to `AnswersFromTextOptions.text_documents` +* Model `AnswerSpanRequest` has been renamed to `ShortAnswerOptions` +* Model property `AnswerSpanRequest.confidence_score_threshold` has been renamed to `ShortAnswerOptions.confidence_threshold` +* Model property `AnswerSpanRequest.top_answers_with_span` has been renamed to `ShortAnswerOptions.top` +* Model `KnowledgeBaseAnswerRequestContext` has been renamed to `KnowledgeBaseAnswerContext` +* Model property `KnowledgeBaseAnswerRequestContext.previous_user_query` has been renamed to `KnowledgeBaseAnswerContext.previous_question` +* Model `TextRecord` has been renamed to `TextDocument` +* Model `KnowledgeBaseAnswers` has been renamed to `AnswersResult` +* Model `TextAnswers` has been renamed to `AnswersFromTextResult` +* Model property `KnowledgeBaseAnswer.answer_span` has been renamed to `KnowledgeBaseAnswer.short_answer` +* Model property `KnowledgeBaseAnswer.id` has been renamed to `KnowledgeBaseAnswer.qna_id` +* Model property `KnowledgeBaseAnswer.confidence_score` has been renamed to `KnowledgeBaseAnswer.confidence` +* Model property `AnswerSpan.confidence_score` has been renamed to `AnswerSpan.confidence` +* Model property `TextAnswer.confidence_score` has been renamed to `TextAnswer.confidence` +* Model property `TextAnswer.answer_span` has been renamed to `TextAnswer.short_answer` + ### Bugs Fixed -### Other Changes +* Fixed formating of `MetadataFilter.metadata` ## 1.0.0b2 (2021-10-06) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md index 5d0cd0e1fa9d..39705959b935 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md @@ -100,7 +100,7 @@ from azure.ai.language.questionanswering import models as qna output = client.get_answers( question="How long should charging take?", - context=qna.models.KnowledgeBaseAnswerRequestContext( + context=qna.models.KnowledgeBaseAnswerContext( previous_qna_id=previous_answer.qna_id ), project_name="FAQ", diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md index 0d32fe429d82..5849ef3d8e2f 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md @@ -20,7 +20,7 @@ autorest ### Settings ```yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/68e7988aba481206f08019d3efb585683d5bc577/specification/cognitiveservices/data-plane/Language/preview/2021-07-15-preview/questionanswering.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/b43c6b9d3f0eed3ecdaa79fc702bc4646b3150ba/specification/cognitiveservices/data-plane/Language/stable/2021-10-01/questionanswering.json output-folder: ../azure/ai/language/questionanswering namespace: azure.ai.language.questionanswering package-name: azure-ai-language-questionanswering @@ -31,31 +31,31 @@ python: true title: QuestionAnsweringClient version-tolerant: true models-mode: msrest -package-version: 1.0.0b2 +package-version: 1.0.0 add-credential: true credential-default-policy-type: AzureKeyCredentialPolicy credential-key-header-name: Ocp-Apim-Subscription-Key black: true ``` -### Rename "QuestionAnsweringKnowledgeBase_Query" -> "QueryKnowledgeBase" +### Rename "QuestionAnsweringKnowledgeBase_Query" -> "GetAnswers" ```yaml directive: - from: swagger-document where: $["paths"]["/:query-knowledgebases"]["post"] transform: > - $["operationId"] = "queryKnowledgeBase"; + $["operationId"] = "getAnswers"; ``` -### Rename "QuestionAnsweringText_Query" -> "QueryText" +### Rename "QuestionAnsweringText_Query" -> "GetAnswersFromText" ```yaml directive: - from: swagger-document where: $["paths"]["/:query-text"]["post"] transform: > - $["operationId"] = "queryText"; + $["operationId"] = "getAnswersFromText"; ``` ### Rename `KnowledgeBasedQueryOptions` -> `Options` @@ -63,7 +63,7 @@ directive: ```yaml directive: - from: swagger-document - where: $["parameters"]["KnowledgeBaseQueryOptions"] + where: $["parameters"]["AnswersOptions"] transform: > $["x-ms-client-name"] = "Options"; ``` @@ -73,39 +73,32 @@ directive: ```yaml directive: - from: swagger-document - where: $["parameters"]["TextQueryOptions"] + where: $["parameters"]["AnswersFromTextOptions"] transform: > $["x-ms-client-name"] = "Options"; ``` -### Rename `KnowledgeBaseQueryOptions` -> `QueryKnowledgeBaseOptions` - -```yaml -directive: - - from: swagger-document - where: $["definitions"]["KnowledgeBaseQueryOptions"] - transform: > - $["x-ms-client-name"] = "QueryKnowledgeBaseOptions"; -``` - -### Rename `TextQueryOptions` -> `QueryTextOptions` +### Delete `StringIndexType` ```yaml directive: - from: swagger-document - where: $["definitions"]["TextQueryOptions"] + where: $["definitions"]["AnswersFromTextOptions"] transform: > - $["x-ms-client-name"] = "QueryTextOptions"; + delete $.properties["stringIndexType"] ``` -### Delete `StringIndexType` +### Delete `RankerKind` and `LogicalOperationKind` enums ```yaml directive: - from: swagger-document - where: $["definitions"]["TextQueryOptions"] + where: $["definitions"] transform: > - delete $.properties["stringIndexType"] + delete $["AnswersOptions"]["properties"]["rankerType"]["x-ms-enum"]; + delete $["AnswersOptions"]["properties"]["rankerType"]["enum"]; + delete $["LogicalOperationKind"]["x-ms-enum"]; + delete $["LogicalOperationKind"]["enum"]; ``` ### Make `MetadataFilter`'s `metadata` property a list of string From 360f4b3fe70146b25ada4e8c454a8b4eb3bc9577 Mon Sep 17 00:00:00 2001 From: antisch Date: Thu, 28 Oct 2021 07:16:31 -0700 Subject: [PATCH 6/9] Fixed some type hints --- .../CHANGELOG.md | 1 + .../aio/operations/_operations.py | 15 ++++++++++----- .../questionanswering/models/_models.py | 6 +++--- .../questionanswering/models/_models_py3.py | 17 ++++++++++++----- .../operations/_operations.py | 19 +++++++++++-------- 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md index f38be05fafcc..0cb5e312f267 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md @@ -28,6 +28,7 @@ * Model property `AnswerSpan.confidence_score` has been renamed to `AnswerSpan.confidence` * Model property `TextAnswer.confidence_score` has been renamed to `TextAnswer.confidence` * Model property `TextAnswer.answer_span` has been renamed to `TextAnswer.short_answer` +* Enums `LogicalOperationKind` and `RankerType` have been removed. ### Bugs Fixed diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py index 7f02222b1bd5..30c2c142bb38 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py @@ -23,7 +23,12 @@ from ... import models as _models from ...operations._operations import build_get_answers_from_text_request, build_get_answers_request -from ..._patch import _validate_text_records, _get_positional_body, _verify_qna_id_and_question, _handle_metadata_filter_conversion +from ..._patch import ( + _validate_text_records, + _get_positional_body, + _verify_qna_id_and_question, + _handle_metadata_filter_conversion, +) T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -104,7 +109,7 @@ async def get_answers(self, *args, **kwargs) -> "_models.AnswersResult": ranker_kind=kwargs.pop("ranker_kind", None), filters=kwargs.pop("filters", None), short_answer_options=kwargs.pop("short_answer_options", None), - include_unstructured_sources=kwargs.pop("include_unstructured_sources", None) + include_unstructured_sources=kwargs.pop("include_unstructured_sources", None), ) _verify_qna_id_and_question(options) options = _handle_metadata_filter_conversion(options) @@ -157,7 +162,7 @@ async def get_answers_from_text( self, *, question: str, - text_documents: List["_models.TextDocument"], + text_documents: List[Union[str, "_models.TextDocument"]], language: Optional[str] = None, **kwargs: Any ) -> "_models.AnswersFromTextResult": @@ -173,7 +178,7 @@ async def get_answers_from_text(self, *args, **kwargs) -> "_models.AnswersFromTe :keyword question: User question to query against the given text records. :paramtype question: str :keyword text_documents: Text records to be searched for given question. - :paramtype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :paramtype text_documents: list[str or ~azure.ai.language.questionanswering.models.TextDocument] :keyword language: Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. @@ -188,7 +193,7 @@ async def get_answers_from_text(self, *args, **kwargs) -> "_models.AnswersFromTe language=kwargs.pop("language", self._default_language), ) try: - options['records'] = _validate_text_records(options['records']) + options["records"] = _validate_text_records(options["records"]) except TypeError: options.text_documents = _validate_text_records(options.text_documents) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py index 7ab57888662b..b1c088cc90b0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py @@ -18,7 +18,7 @@ class AnswersFromTextOptions(msrest.serialization.Model): :ivar question: Required. User question to query against the given text records. :vartype question: str :ivar text_documents: Required. Text records to be searched for given question. - :vartype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :vartype text_documents: list[str or ~azure.ai.language.questionanswering.models.TextDocument] :ivar language: Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. @@ -41,7 +41,7 @@ def __init__(self, **kwargs): :keyword question: Required. User question to query against the given text records. :paramtype question: str :keyword text_documents: Required. Text records to be searched for given question. - :paramtype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :paramtype text_documents: list[str or ~azure.ai.language.questionanswering.models.TextDocument] :keyword language: Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. @@ -580,7 +580,7 @@ def __init__(self, **kwargs): :keyword source_filter: Find QnAs that are associated with any of the given list of sources in knowledge base. :paramtype source_filter: list[str] - :keyword logical_operation: Logical operation used to join metadata filter with source filter. + :keyword logical_operation: Logical operation used to join metadata filter with source filter. Possible values include: "AND", "OR". :paramtype logical_operation: str """ diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py index 42858666f97f..e88d6d2d8cf7 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py @@ -22,7 +22,7 @@ class AnswersFromTextOptions(msrest.serialization.Model): :ivar question: Required. User question to query against the given text records. :vartype question: str :ivar text_documents: Required. Text records to be searched for given question. - :vartype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :vartype text_documents: list[str or ~azure.ai.language.questionanswering.models.TextDocument] :ivar language: Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. @@ -41,13 +41,18 @@ class AnswersFromTextOptions(msrest.serialization.Model): } def __init__( - self, *, question: str, text_documents: List["TextDocument"], language: Optional[str] = None, **kwargs + self, + *, + question: str, + text_documents: List[Union[str, "TextDocument"]], + language: Optional[str] = None, + **kwargs ): """ :keyword question: Required. User question to query against the given text records. :paramtype question: str :keyword text_documents: Required. Text records to be searched for given question. - :paramtype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :paramtype text_documents: list[str or ~azure.ai.language.questionanswering.models.TextDocument] :keyword language: Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. @@ -612,7 +617,9 @@ class MetadataFilter(msrest.serialization.Model): "logical_operation": {"key": "logicalOperation", "type": "str"}, } - def __init__(self, *, metadata: Optional[List[Tuple[str, str]]] = None, logical_operation: Optional[str] = None, **kwargs): + def __init__( + self, *, metadata: Optional[List[Tuple[str, str]]] = None, logical_operation: Optional[str] = None, **kwargs + ): """ :keyword metadata: :paramtype metadata: list[tuple[str, str]] @@ -633,7 +640,7 @@ class QueryFilters(msrest.serialization.Model): :ivar source_filter: Find QnAs that are associated with any of the given list of sources in knowledge base. :vartype source_filter: list[str] - :ivar logical_operation: Logical operation used to join metadata filter with source filter. + :ivar logical_operation: Logical operation used to join metadata filter with source filter. Possible values include: "AND", "OR". :vartype logical_operation: str """ diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py index 9f4bf486de5b..659c0ce307c4 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py @@ -23,7 +23,12 @@ from msrest import Serializer from .. import models as _models -from .._patch import _validate_text_records, _get_positional_body, _verify_qna_id_and_question, _handle_metadata_filter_conversion +from .._patch import ( + _validate_text_records, + _get_positional_body, + _verify_qna_id_and_question, + _handle_metadata_filter_conversion, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -111,8 +116,7 @@ def get_answers( @overload def get_answers( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> "_models.AnswersResult" pass @@ -170,7 +174,7 @@ def get_answers( ranker_kind=kwargs.pop("ranker_kind", None), filters=kwargs.pop("filters", None), short_answer_options=kwargs.pop("short_answer_options", None), - include_unstructured_sources=kwargs.pop("include_unstructured_sources", None) + include_unstructured_sources=kwargs.pop("include_unstructured_sources", None), ) _verify_qna_id_and_question(options) options = _handle_metadata_filter_conversion(options) @@ -223,8 +227,7 @@ def get_answers_from_text( @overload def get_answers_from_text( - self, - **kwargs # type: Any + self, **kwargs # type: Any ): # type: (...) -> "_models.AnswersFromTextResult" pass @@ -244,7 +247,7 @@ def get_answers_from_text( :keyword question: User question to query against the given text records. :paramtype question: str :keyword text_documents: Text records to be searched for given question. - :paramtype text_documents: list[~azure.ai.language.questionanswering.models.TextDocument] + :paramtype text_documents: list[str or ~azure.ai.language.questionanswering.models.TextDocument] :keyword language: Language of the text records. This is BCP-47 representation of a language. For example, use "en" for English; "es" for Spanish etc. If not set, use "en" for English as default. @@ -259,7 +262,7 @@ def get_answers_from_text( language=kwargs.pop("language", self._default_language), ) try: - options['records'] = _validate_text_records(options['records']) + options["records"] = _validate_text_records(options["records"]) except TypeError: options.text_documents = _validate_text_records(options.text_documents) From b8b5851481e5d61fcc1748a1b82f12c9fab8b414 Mon Sep 17 00:00:00 2001 From: antisch Date: Thu, 28 Oct 2021 10:34:11 -0700 Subject: [PATCH 7/9] Review feedback --- .../README.md | 10 ++++----- .../aio/operations/_operations.py | 2 +- .../questionanswering/models/_models.py | 2 ++ .../questionanswering/models/_models_py3.py | 2 ++ .../operations/_operations.py | 2 +- .../setup.py | 2 +- .../swagger/README.md | 2 +- .../test_query_text.test_query_text.yaml | 22 +++++++++---------- .../test_query_text.test_query_text_llc.yaml | 16 +++++++------- ...t_query_text.test_query_text_overload.yaml | 16 +++++++------- ..._text.test_query_text_with_dictparams.yaml | 14 ++++++------ ...text.test_query_text_with_str_records.yaml | 14 ++++++------ ...test_query_text_async.test_query_text.yaml | 16 +++++++------- ..._query_text_async.test_query_text_llc.yaml | 14 ++++++------ ...y_text_async.test_query_text_overload.yaml | 16 +++++++------- ...async.test_query_text_with_dictparams.yaml | 12 +++++----- ...sync.test_query_text_with_str_records.yaml | 16 +++++++------- 17 files changed, 91 insertions(+), 87 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md index 39705959b935..941d947fede6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md @@ -96,11 +96,11 @@ You can set additional keyword options to limit the number of answers, specify a If your knowledge base is configured for [chit-chat][questionanswering_docs_chat], the answers from the knowledge base may include suggested [prompts for follow-up questions][questionanswering_refdocs_prompts] to initiate a conversation. You can ask a follow-up question by providing the ID of your chosen answer as the context for the continued conversation: ```python -from azure.ai.language.questionanswering import models as qna +from azure.ai.language.questionanswering import models output = client.get_answers( question="How long should charging take?", - context=qna.models.KnowledgeBaseAnswerContext( + context=models.KnowledgeBaseAnswerContext( previous_qna_id=previous_answer.qna_id ), project_name="FAQ", @@ -199,15 +199,15 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [azure_core_ref_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md [pip_link]: https://pypi.org/project/pip/ -[questionanswering_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0b1/azure.ai.language.questionanswering.html#azure.ai.language.questionanswering.QuestionAnsweringClient -[questionanswering_refdocs_prompts]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0b1/azure.ai.language.questionanswering.models.html#azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog +[questionanswering_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0/azure.ai.language.questionanswering.html#azure.ai.language.questionanswering.QuestionAnsweringClient +[questionanswering_refdocs_prompts]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0/azure.ai.language.questionanswering.models.html#azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog [questionanswering_client_src]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/ [questionanswering_docs]: https://azure.microsoft.com/services/cognitive-services/qna-maker/ [questionanswering_docs_chat]: https://docs.microsoft.com/azure/cognitive-services/qnamaker/how-to/chit-chat-knowledge-base [questionanswering_docs_demos]: https://azure.microsoft.com/services/cognitive-services/qna-maker/#demo [questionanswering_docs_features]: https://azure.microsoft.com/services/cognitive-services/qna-maker/#features [questionanswering_pypi_package]: https://pypi.org/project/azure-ai-language-questionanswering/ -[questionanswering_refdocs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0b1/azure.ai.language.questionanswering.html +[questionanswering_refdocs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0/azure.ai.language.questionanswering.html [questionanswering_rest_docs]: https://docs.microsoft.com/rest/api/cognitiveservices-qnamaker/ [questionanswering_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/README.md diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py index 30c2c142bb38..e90d5ce2de1d 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py @@ -68,7 +68,7 @@ async def get_answers(self, *args, **kwargs) -> "_models.AnswersResult": :param options: Positional only. POST body of the request. Either provide this value or individual keyword arguments. :type options: ~azure.ai.language.questionanswering.models.AnswersOptions - :keyword project_name: The name of the project to use. + :keyword project_name: The name of the knowledge base project to use. :paramtype project_name: str :keyword deployment_name: The name of the specific deployment of the project to use. :paramtype deployment_name: str diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py index b1c088cc90b0..3b9e1b29260e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py @@ -34,6 +34,7 @@ class AnswersFromTextOptions(msrest.serialization.Model): "question": {"key": "question", "type": "str"}, "text_documents": {"key": "records", "type": "[TextDocument]"}, "language": {"key": "language", "type": "str"}, + "string_index_type": {"key": "stringIndexType", "type": "str"}, } def __init__(self, **kwargs): @@ -51,6 +52,7 @@ def __init__(self, **kwargs): self.question = kwargs["question"] self.text_documents = kwargs["text_documents"] self.language = kwargs.get("language", None) + self.string_index_type = "UnicodeCodePoint" class AnswersFromTextResult(msrest.serialization.Model): diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py index e88d6d2d8cf7..5e9cf1ab13a4 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py @@ -38,6 +38,7 @@ class AnswersFromTextOptions(msrest.serialization.Model): "question": {"key": "question", "type": "str"}, "text_documents": {"key": "records", "type": "[TextDocument]"}, "language": {"key": "language", "type": "str"}, + "string_index_type": {"key": "stringIndexType", "type": "str"}, } def __init__( @@ -62,6 +63,7 @@ def __init__( self.question = question self.text_documents = text_documents self.language = language + self.string_index_type = "UnicodeCodePoint" class AnswersFromTextResult(msrest.serialization.Model): diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py index 659c0ce307c4..1c68135699cc 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py @@ -133,7 +133,7 @@ def get_answers( :param options: Positional only. POST body of the request. Provide either `options`, OR individual keyword arguments. If both are provided, only the options object will be used. :type options: ~azure.ai.language.questionanswering.models.AnswersOptions - :keyword project_name: The name of the project to use. + :keyword project_name: The name of the knowledge base project to use. :paramtype project_name: str :keyword deployment_name: The name of the specific deployment of the project to use. :paramtype deployment_name: str diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py index 43de47ef0e69..2f338c1f28c5 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/setup.py @@ -43,7 +43,7 @@ license='MIT License', # ensure that the development status reflects the status of your package classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", 'Programming Language :: Python', 'Programming Language :: Python :: 2', diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md index 5849ef3d8e2f..bfce53c7edae 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md @@ -20,7 +20,7 @@ autorest ### Settings ```yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/b43c6b9d3f0eed3ecdaa79fc702bc4646b3150ba/specification/cognitiveservices/data-plane/Language/stable/2021-10-01/questionanswering.json +input-file: https://github.com/Azure/azure-rest-api-specs/blob/6d7653ffd37cdc781e16202306567e355b45ebf8/specification/cognitiveservices/data-plane/Language/stable/2021-10-01/questionanswering.json output-folder: ../azure/ai/language/questionanswering namespace: azure.ai.language.questionanswering package-name: azure-ai-language-questionanswering diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml index c2fdf089e8b2..52c088db3424 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text.yaml @@ -93,7 +93,7 @@ interactions: USB 3.1 Always-On, USB 3.1, Headphone/Mic, microSD RAM16GB RAM Upgradable to16GB Size12.1 x 8.3 x .57 inches Touchpad Size4.3 x 2.2 inches USB Ports3 Video Memory2GB Warranty/Supportone-year warranty. Weight2.8 pounds Wi-Fi802.11ac Wi-Fi ModelIntel - Wireless-AC 9560 "}], "language": "en"}' + Wireless-AC 9560 "}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' headers: Accept: - application/json @@ -102,7 +102,7 @@ interactions: Connection: - keep-alive Content-Length: - - '7409' + - '7448' Content-Type: - application/json User-Agent: @@ -119,44 +119,44 @@ interactions: Battery Life - Longest Lasting Laptop Batteries Competing laptops like the ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53) outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n - \ \"confidenceScore\": 0.017458291724324226,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.017458289861679077,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\": - 0.26247388,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": + 0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": 1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with 11-plus hours of battery life (on the FHD model), the Envy 13 has a sleek, ultraportable chassis, fast performance, and powerful speakers. Best of all, the Envy 13 starts at a reasonable $799, which is hundreds less than the competition. In many ways, the Envy 13 is what we wanted the new MacBook Air to be.\",\n - \ \"confidenceScore\": 0.009401722811162472,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.00940172653645277,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": - 0.3530523,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": + 0.35305238,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": 4508,\n \"length\": 319\n },\n {\n \"answer\": \"We also recommend the Samsung Notebook 9 Pro, which has a similarly premium design but much better battery life than the 4K Envy. The Microsoft Surface Laptop 2 is another recommended alternative, though you might want to wait a few months for the rumored Surface Laptop 3. Overall, the HP Envy 13 is a fantastic laptop that checks all the right boxes --- as long as you buy the 1080p model.\",\n - \ \"confidenceScore\": 0.0070572528056800365,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.007057250943034887,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": 5391,\n \"length\": 393\n }\n ]\n}" headers: apim-request-id: - - 888507f3-3fba-4bfe-8013-f007a5e24c1c + - cc590361-bd1a-4ace-b7bc-ce2ee426c476 content-length: - - '2148' + - '2147' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9 date: - - Thu, 28 Oct 2021 03:30:31 GMT + - Thu, 28 Oct 2021 17:25:05 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '341' + - '429' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml index 032a02a1aa14..6664a18f854c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_llc.yaml @@ -119,17 +119,17 @@ interactions: Battery Life - Longest Lasting Laptop Batteries Competing laptops like the ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53) outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n - \ \"confidenceScore\": 0.01745828054845333,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.017458291724324226,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\": - 0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": + 0.26247388,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": 1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with 11-plus hours of battery life (on the FHD model), the Envy 13 has a sleek, ultraportable chassis, fast performance, and powerful speakers. Best of all, the Envy 13 starts at a reasonable $799, which is hundreds less than the competition. In many ways, the Envy 13 is what we wanted the new MacBook Air to be.\",\n - \ \"confidenceScore\": 0.009401722811162472,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.00940172653645277,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": - 0.3530523,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": + 0.35305238,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": 4508,\n \"length\": 319\n },\n {\n \"answer\": \"We also recommend the Samsung Notebook 9 Pro, which has a similarly premium design but much better battery life than the 4K Envy. The Microsoft Surface Laptop 2 is another @@ -142,21 +142,21 @@ interactions: 5391,\n \"length\": 393\n }\n ]\n}" headers: apim-request-id: - - d1aedf5e-6179-4cc9-9fb6-dad9703e730a + - 465fe43a-5e13-4ca5-ad6f-1ae62cae5af3 content-length: - - '2146' + - '2147' content-type: - application/json; charset=utf-8 csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9 date: - - Thu, 28 Oct 2021 03:30:32 GMT + - Thu, 28 Oct 2021 17:25:07 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '352' + - '366' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml index 0a068df390f8..07523c2bc18a 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_overload.yaml @@ -8,7 +8,7 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}]}' + port on your Surface."}], "stringIndexType": "UnicodeCodePoint"}' headers: Accept: - application/json @@ -17,7 +17,7 @@ interactions: Connection: - keep-alive Content-Length: - - '650' + - '689' Content-Type: - application/json User-Agent: @@ -37,18 +37,18 @@ interactions: to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\": - 0.9254360198974609,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": - \"two to four hours\",\n \"confidenceScore\": 0.98562825,\n \"offset\": + 0.9254359006881714,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": + \"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\": 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming - while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n + while you\u2019re charging it.\",\n \"confidenceScore\": 0.055035144090652466,\n \ \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"longer\",\n \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: apim-request-id: - - b03bdeb6-aad3-4a9f-9753-4395ab9adaca + - c88b68ad-b495-4121-a048-7b41d82ddae8 content-length: - '1481' content-type: @@ -56,13 +56,13 @@ interactions: csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 date: - - Thu, 28 Oct 2021 03:30:32 GMT + - Thu, 28 Oct 2021 17:25:07 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '274' + - '241' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml index 31c0fc477410..11f4404aeedf 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_dictparams.yaml @@ -8,7 +8,7 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en"}' + port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' headers: Accept: - application/json @@ -17,7 +17,7 @@ interactions: Connection: - keep-alive Content-Length: - - '668' + - '707' Content-Type: - application/json User-Agent: @@ -37,18 +37,18 @@ interactions: to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\": - 0.9254359006881714,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\": + 0.9254359602928162,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\": 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming - while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n + while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503518134355545,\n \ \"id\": \"1\",\n \"answerSpan\": {\n \"text\": \"longer\",\n \ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: apim-request-id: - - 99de7390-bcae-472f-be97-eeb9b91254f6 + - dd49d00b-e5e4-4a26-8744-74680c9a9382 content-length: - '1478' content-type: @@ -56,13 +56,13 @@ interactions: csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 date: - - Thu, 28 Oct 2021 03:30:33 GMT + - Thu, 28 Oct 2021 17:25:08 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '272' + - '266' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml index ec57077a3219..fe02aa861ea2 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text.test_query_text_with_str_records.yaml @@ -8,7 +8,7 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en"}' + port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' headers: Accept: - application/json @@ -17,7 +17,7 @@ interactions: Connection: - keep-alive Content-Length: - - '668' + - '707' Content-Type: - application/json User-Agent: @@ -30,14 +30,14 @@ interactions: It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n - \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"0\",\n \"answerSpan\": + \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\": 0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\": - 0.9254359602928162,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": + 0.9254359006881714,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\": 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re @@ -48,7 +48,7 @@ interactions: 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: apim-request-id: - - 5f11c3c3-b3fa-4c5c-9cd0-efd30bd29c28 + - c037b02f-0d0e-4d9b-99a9-91ace9bdf6c9 content-length: - '1481' content-type: @@ -56,13 +56,13 @@ interactions: csp-billing-usage: - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 date: - - Thu, 28 Oct 2021 03:30:33 GMT + - Thu, 28 Oct 2021 17:25:09 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '231' + - '256' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml index d7e02a0fb24e..80834a4038fb 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text.yaml @@ -93,12 +93,12 @@ interactions: USB 3.1 Always-On, USB 3.1, Headphone/Mic, microSD RAM16GB RAM Upgradable to16GB Size12.1 x 8.3 x .57 inches Touchpad Size4.3 x 2.2 inches USB Ports3 Video Memory2GB Warranty/Supportone-year warranty. Weight2.8 pounds Wi-Fi802.11ac Wi-Fi ModelIntel - Wireless-AC 9560 "}], "language": "en"}' + Wireless-AC 9560 "}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' headers: Accept: - application/json Content-Length: - - '7409' + - '7448' Content-Type: - application/json User-Agent: @@ -115,9 +115,9 @@ interactions: Battery Life - Longest Lasting Laptop Batteries Competing laptops like the ZenBook S UX391UA (7:05), Surface Laptop 2 (9:22) and Notebook 9 Pro (8:53) outstayed the 4K Envy 13 but powered down long before the 1080p version.\",\n - \ \"confidenceScore\": 0.01745828241109848,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.017458289861679077,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\": - 0.26247388,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": + 0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": 1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with 11-plus hours of battery life (on the FHD model), the Envy 13 has a sleek, ultraportable chassis, fast performance, and powerful speakers. Best of all, @@ -137,14 +137,14 @@ interactions: 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": 5391,\n \"length\": 393\n }\n ]\n}" headers: - apim-request-id: ce811191-0ba3-464d-b745-ceb2b36957f5 - content-length: '2147' + apim-request-id: a33278f1-4b95-4e5c-a3ec-87798e506ce0 + content-length: '2148' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9 - date: Thu, 28 Oct 2021 03:30:33 GMT + date: Thu, 28 Oct 2021 17:25:27 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '262' + x-envoy-upstream-service-time: '355' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml index 52ed65797d00..cb5576f501ea 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_llc.yaml @@ -123,9 +123,9 @@ interactions: ultraportable chassis, fast performance, and powerful speakers. Best of all, the Envy 13 starts at a reasonable $799, which is hundreds less than the competition. In many ways, the Envy 13 is what we wanted the new MacBook Air to be.\",\n - \ \"confidenceScore\": 0.00940172653645277,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.009401722811162472,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": - 0.35305238,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": + 0.3530523,\n \"offset\": 27,\n \"length\": 13\n },\n \"offset\": 4508,\n \"length\": 319\n },\n {\n \"answer\": \"We also recommend the Samsung Notebook 9 Pro, which has a similarly premium design but much better battery life than the 4K Envy. The Microsoft Surface Laptop 2 is another @@ -134,17 +134,17 @@ interactions: that checks all the right boxes --- as long as you buy the 1080p model.\",\n \ \"confidenceScore\": 0.0070572528056800365,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"battery life\",\n \"confidenceScore\": - 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": + 0.5914322,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": 5391,\n \"length\": 393\n }\n ]\n}" headers: - apim-request-id: 0d0a1af6-13ba-4f3c-b0c7-76aef256dd3e - content-length: '2148' + apim-request-id: 773ef25f-ccba-4298-9a56-435e5d58025c + content-length: '2147' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=9 - date: Thu, 28 Oct 2021 03:30:34 GMT + date: Thu, 28 Oct 2021 17:25:28 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '233' + x-envoy-upstream-service-time: '307' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml index a6b8d3114b01..bb9146d904cb 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_overload.yaml @@ -8,12 +8,12 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}]}' + port on your Surface."}], "stringIndexType": "UnicodeCodePoint"}' headers: Accept: - application/json Content-Length: - - '650' + - '689' Content-Type: - application/json User-Agent: @@ -33,24 +33,24 @@ interactions: to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\": - 0.9254359602928162,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": + 0.9254359006881714,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\": 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming - while you\u2019re charging it.\",\n \"confidenceScore\": 0.055035144090652466,\n + while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n \ \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"longer\",\n \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: - apim-request-id: 7b0c6b53-869e-433c-a48a-a4f0d89e45e1 - content-length: '1481' + apim-request-id: 7e917c74-634f-4496-9e2d-5d3e5037332e + content-length: '1480' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 - date: Thu, 28 Oct 2021 03:30:35 GMT + date: Thu, 28 Oct 2021 17:25:28 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '269' + x-envoy-upstream-service-time: '280' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml index 6cf10a051d24..80c4277bc3e6 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_dictparams.yaml @@ -8,12 +8,12 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en"}' + port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' headers: Accept: - application/json Content-Length: - - '668' + - '707' Content-Type: - application/json User-Agent: @@ -26,7 +26,7 @@ interactions: It takes two to four hours to charge the Surface Pro 4 battery fully from an empty state. It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n - \ \"confidenceScore\": 0.9298818707466125,\n \"id\": \"1\",\n \"answerSpan\": + \ \"confidenceScore\": 0.9298818111419678,\n \"id\": \"1\",\n \"answerSpan\": {\n \"text\": \"two to four hours\",\n \"confidenceScore\": 0.98579097,\n \"offset\": 28,\n \"length\": 18\n },\n \"offset\": 0,\n \"length\": 245\n },\n {\n \"answer\": \"It takes two @@ -43,14 +43,14 @@ interactions: \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: - apim-request-id: 616a39bf-3762-4f03-a70e-12ef435865b7 + apim-request-id: 60727ee6-98a6-4af8-aaff-19de3371e467 content-length: '1480' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 - date: Thu, 28 Oct 2021 03:30:36 GMT + date: Thu, 28 Oct 2021 17:25:29 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '255' + x-envoy-upstream-service-time: '309' status: code: 200 message: OK diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml index 8931c3fd8309..d378f7c2e96b 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/recordings/test_query_text_async.test_query_text_with_str_records.yaml @@ -8,12 +8,12 @@ interactions: your Surface Pro 4 power supply to charge other devices, like a phone, while your Surface charges. The USB port on the power supply is only for charging, not for data transfer. If you want to use a USB device, plug it into the USB - port on your Surface."}], "language": "en"}' + port on your Surface."}], "language": "en", "stringIndexType": "UnicodeCodePoint"}' headers: Accept: - application/json Content-Length: - - '668' + - '707' Content-Type: - application/json User-Agent: @@ -34,23 +34,23 @@ interactions: It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\": 0.9254359602928162,\n \"id\": \"0\",\n \"answerSpan\": {\n \"text\": - \"two to four hours\",\n \"confidenceScore\": 0.98562825,\n \"offset\": + \"two to four hours\",\n \"confidenceScore\": 0.9856282,\n \"offset\": 8,\n \"length\": 18\n },\n \"offset\": 20,\n \"length\": 225\n },\n {\n \"answer\": \"It can take longer if you\u2019re using your Surface for power-intensive activities like gaming or video streaming while you\u2019re charging it.\",\n \"confidenceScore\": 0.05503516271710396,\n \ \"id\": \"0\",\n \"answerSpan\": {\n \"text\": \"longer\",\n - \ \"confidenceScore\": 0.624118,\n \"offset\": 11,\n \"length\": + \ \"confidenceScore\": 0.62411773,\n \"offset\": 11,\n \"length\": 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: - apim-request-id: 5b912989-6654-46da-97cd-7e0c057a21cf - content-length: '1479' + apim-request-id: 47b34ca3-e2b1-4940-9a80-d06f031641ab + content-length: '1480' content-type: application/json; charset=utf-8 csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=2 - date: Thu, 28 Oct 2021 03:30:36 GMT + date: Thu, 28 Oct 2021 17:25:30 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '211' + x-envoy-upstream-service-time: '259' status: code: 200 message: OK From 0b130388669ef9fa251802f01358a37441d63ec4 Mon Sep 17 00:00:00 2001 From: antisch Date: Thu, 28 Oct 2021 12:22:06 -0700 Subject: [PATCH 8/9] Fixed URLs --- .../azure-ai-language-questionanswering/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md index 941d947fede6..dc63d9a8526e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md @@ -199,15 +199,15 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [azure_core_ref_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md [pip_link]: https://pypi.org/project/pip/ -[questionanswering_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0/azure.ai.language.questionanswering.html#azure.ai.language.questionanswering.QuestionAnsweringClient -[questionanswering_refdocs_prompts]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0/azure.ai.language.questionanswering.models.html#azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog +[questionanswering_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/latest/azure.ai.language.questionanswering.html#azure.ai.language.questionanswering.QuestionAnsweringClient +[questionanswering_refdocs_prompts]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/latest/azure.ai.language.questionanswering.models.html#azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog [questionanswering_client_src]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/ [questionanswering_docs]: https://azure.microsoft.com/services/cognitive-services/qna-maker/ [questionanswering_docs_chat]: https://docs.microsoft.com/azure/cognitive-services/qnamaker/how-to/chit-chat-knowledge-base [questionanswering_docs_demos]: https://azure.microsoft.com/services/cognitive-services/qna-maker/#demo [questionanswering_docs_features]: https://azure.microsoft.com/services/cognitive-services/qna-maker/#features [questionanswering_pypi_package]: https://pypi.org/project/azure-ai-language-questionanswering/ -[questionanswering_refdocs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0/azure.ai.language.questionanswering.html +[questionanswering_refdocs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/latest/azure.ai.language.questionanswering.html [questionanswering_rest_docs]: https://docs.microsoft.com/rest/api/cognitiveservices-qnamaker/ [questionanswering_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/README.md From a887e7d92da85c6327ba7f960772f887c43393da Mon Sep 17 00:00:00 2001 From: antisch Date: Thu, 28 Oct 2021 12:40:04 -0700 Subject: [PATCH 9/9] Renamed context --- .../CHANGELOG.md | 1 + .../azure-ai-language-questionanswering/README.md | 2 +- .../aio/operations/_operations.py | 8 ++++---- .../language/questionanswering/models/_models.py | 12 ++++++------ .../questionanswering/models/_models_py3.py | 14 +++++++------- .../questionanswering/operations/_operations.py | 6 +++--- .../samples/async_samples/sample_chat_async.py | 2 +- .../samples/sample_chat.py | 2 +- .../swagger/README.md | 2 +- .../tests/test_query_knowledgebase.py | 6 +++--- .../tests/test_query_knowledgebase_async.py | 6 +++--- 11 files changed, 31 insertions(+), 30 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md index 0cb5e312f267..d8e02de2692e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md @@ -12,6 +12,7 @@ * Method kwarg and model property `QueryKnowledgeBaseOptions.confidence_score_threshold` has been renamed to `AnswersOptions.confidence_threshold` * Method kwarg and model property `QueryKnowledgeBaseOptions.answer_span_request` has been renamed to `AnswersOptions.short_answer_options` * Method kwarg and model property `QueryKnowledgeBaseOptions.ranker_type` has been renamed to `AnswersOptions.ranker_kind` +* Method kwarg and model property `QueryKnowledgeBaseOptions.context` has been renamed to `AnswersOptions.answer_context` * Model `QueryTextOptions` has been renamed to `AnswersFromTextOptions` * Method kwarg and model property `QueryTextOptions.records` has been renamed to `AnswersFromTextOptions.text_documents` * Model `AnswerSpanRequest` has been renamed to `ShortAnswerOptions` diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md index dc63d9a8526e..d765e26f5fd5 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md @@ -100,7 +100,7 @@ from azure.ai.language.questionanswering import models output = client.get_answers( question="How long should charging take?", - context=models.KnowledgeBaseAnswerContext( + answer_context=models.KnowledgeBaseAnswerContext( previous_qna_id=previous_answer.qna_id ), project_name="FAQ", diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py index e90d5ce2de1d..ae74f554036a 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py @@ -52,7 +52,7 @@ async def get_answers( top: Optional[int] = None, user_id: Optional[str] = None, confidence_threshold: Optional[float] = None, - context: Optional["_models.KnowledgeBaseAnswerContext"] = None, + answer_context: Optional["_models.KnowledgeBaseAnswerContext"] = None, ranker_kind: Optional[str] = None, filters: Optional["_models.QueryFilters"] = None, short_answer_options: Optional["_models.ShortAnswerOptions"] = None, @@ -83,8 +83,8 @@ async def get_answers(self, *args, **kwargs) -> "_models.AnswersResult": :paramtype user_id: str :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. :paramtype confidence_threshold: float - :keyword context: Context object with previous QnA's information. - :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword answer_context: Context object with previous QnA's information. + :paramtype answer_context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext :keyword ranker_kind: Type of ranker to be used. Possible values include: "Default", "QuestionOnly". :paramtype ranker_kind: str @@ -105,7 +105,7 @@ async def get_answers(self, *args, **kwargs) -> "_models.AnswersResult": top=kwargs.pop("top", None), user_id=kwargs.pop("user_id", None), confidence_threshold=kwargs.pop("confidence_threshold", None), - context=kwargs.pop("context", None), + answer_context=kwargs.pop("answer_context", None), ranker_kind=kwargs.pop("ranker_kind", None), filters=kwargs.pop("filters", None), short_answer_options=kwargs.pop("short_answer_options", None), diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py index 3b9e1b29260e..5439e4e04877 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models.py @@ -89,8 +89,8 @@ class AnswersOptions(msrest.serialization.Model): :vartype user_id: str :ivar confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. :vartype confidence_threshold: float - :ivar context: Context object with previous QnA's information. - :vartype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :ivar answer_context: Context object with previous QnA's information. + :vartype answer_context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext :ivar ranker_kind: Type of ranker to be used. Possible values include: "Default", "QuestionOnly". :vartype ranker_kind: str @@ -112,7 +112,7 @@ class AnswersOptions(msrest.serialization.Model): "top": {"key": "top", "type": "int"}, "user_id": {"key": "userId", "type": "str"}, "confidence_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, - "context": {"key": "context", "type": "KnowledgeBaseAnswerContext"}, + "answer_context": {"key": "context", "type": "KnowledgeBaseAnswerContext"}, "ranker_kind": {"key": "rankerType", "type": "str"}, "filters": {"key": "filters", "type": "QueryFilters"}, "short_answer_options": {"key": "answerSpanRequest", "type": "ShortAnswerOptions"}, @@ -132,8 +132,8 @@ def __init__(self, **kwargs): :paramtype user_id: str :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. :paramtype confidence_threshold: float - :keyword context: Context object with previous QnA's information. - :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword answer_context: Context object with previous QnA's information. + :paramtype answer_context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext :keyword ranker_kind: Type of ranker to be used. Possible values include: "Default", "QuestionOnly". :paramtype ranker_kind: str @@ -151,7 +151,7 @@ def __init__(self, **kwargs): self.top = kwargs.get("top", None) self.user_id = kwargs.get("user_id", None) self.confidence_threshold = kwargs.get("confidence_threshold", None) - self.context = kwargs.get("context", None) + self.answer_context = kwargs.get("answer_context", None) self.ranker_kind = kwargs.get("ranker_kind", None) self.filters = kwargs.get("filters", None) self.short_answer_options = kwargs.get("short_answer_options", None) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py index 5e9cf1ab13a4..aacaf8658532 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/models/_models_py3.py @@ -100,8 +100,8 @@ class AnswersOptions(msrest.serialization.Model): :vartype user_id: str :ivar confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. :vartype confidence_threshold: float - :ivar context: Context object with previous QnA's information. - :vartype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :ivar answer_context: Context object with previous QnA's information. + :vartype answer_context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext :ivar ranker_kind: Type of ranker to be used. Possible values include: "Default", "QuestionOnly". :vartype ranker_kind: str @@ -123,7 +123,7 @@ class AnswersOptions(msrest.serialization.Model): "top": {"key": "top", "type": "int"}, "user_id": {"key": "userId", "type": "str"}, "confidence_threshold": {"key": "confidenceScoreThreshold", "type": "float"}, - "context": {"key": "context", "type": "KnowledgeBaseAnswerContext"}, + "answer_context": {"key": "context", "type": "KnowledgeBaseAnswerContext"}, "ranker_kind": {"key": "rankerType", "type": "str"}, "filters": {"key": "filters", "type": "QueryFilters"}, "short_answer_options": {"key": "answerSpanRequest", "type": "ShortAnswerOptions"}, @@ -138,7 +138,7 @@ def __init__( top: Optional[int] = None, user_id: Optional[str] = None, confidence_threshold: Optional[float] = None, - context: Optional["KnowledgeBaseAnswerContext"] = None, + answer_context: Optional["KnowledgeBaseAnswerContext"] = None, ranker_kind: Optional[str] = None, filters: Optional["QueryFilters"] = None, short_answer_options: Optional["ShortAnswerOptions"] = None, @@ -157,8 +157,8 @@ def __init__( :paramtype user_id: str :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. :paramtype confidence_threshold: float - :keyword context: Context object with previous QnA's information. - :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword answer_context: Context object with previous QnA's information. + :paramtype answer_context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext :keyword ranker_kind: Type of ranker to be used. Possible values include: "Default", "QuestionOnly". :paramtype ranker_kind: str @@ -176,7 +176,7 @@ def __init__( self.top = top self.user_id = user_id self.confidence_threshold = confidence_threshold - self.context = context + self.answer_context = answer_context self.ranker_kind = ranker_kind self.filters = filters self.short_answer_options = short_answer_options diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py index 1c68135699cc..be0a5fa6bbd8 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py @@ -148,8 +148,8 @@ def get_answers( :paramtype user_id: str :keyword confidence_threshold: Minimum threshold score for answers, value ranges from 0 to 1. :paramtype confidence_threshold: float - :keyword context: Context object with previous QnA's information. - :paramtype context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext + :keyword answer_context: Context object with previous QnA's information. + :paramtype answer_context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerContext :keyword ranker_kind: Type of ranker to be used. Possible values include: "Default", "QuestionOnly". :paramtype ranker_kind: str @@ -170,7 +170,7 @@ def get_answers( top=kwargs.pop("top", None), user_id=kwargs.pop("user_id", None), confidence_threshold=kwargs.pop("confidence_threshold", None), - context=kwargs.pop("context", None), + answer_context=kwargs.pop("answer_context", None), ranker_kind=kwargs.pop("ranker_kind", None), filters=kwargs.pop("filters", None), short_answer_options=kwargs.pop("short_answer_options", None), diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py index 66717206e3e4..021bc79d3ca0 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/async_samples/sample_chat_async.py @@ -58,7 +58,7 @@ async def sample_chit_chat(): question=followup_question, top=3, confidence_threshold=0.2, - context=qna.KnowledgeBaseAnswerContext( + answer_context=qna.KnowledgeBaseAnswerContext( previous_question=first_question, previous_qna_id=best_candidate.qna_id ), diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py index 1a231af592c4..74dbd531d002 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/sample_chat.py @@ -57,7 +57,7 @@ def sample_chit_chat(): question=followup_question, top=3, confidence_threshold=0.2, - context=qna.KnowledgeBaseAnswerContext( + answer_context=qna.KnowledgeBaseAnswerContext( previous_question=first_question, previous_qna_id=best_candidate.qna_id ), diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md index bfce53c7edae..2d6142edc499 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md @@ -20,7 +20,7 @@ autorest ### Settings ```yaml -input-file: https://github.com/Azure/azure-rest-api-specs/blob/6d7653ffd37cdc781e16202306567e355b45ebf8/specification/cognitiveservices/data-plane/Language/stable/2021-10-01/questionanswering.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/34a2c0723155d134311419fd997925ce96b85bec/specification/cognitiveservices/data-plane/Language/stable/2021-10-01/questionanswering.json output-folder: ../azure/ai/language/questionanswering namespace: azure.ai.language.questionanswering package-name: azure-ai-language-questionanswering diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py index 6dd29c67fa51..8f627b4915ea 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase.py @@ -130,7 +130,7 @@ def test_query_knowledgebase(self, qna_account, qna_key, qna_project): query_params = AnswersOptions( question="Ports and connectors", top=3, - context=KnowledgeBaseAnswerContext( + answer_context=KnowledgeBaseAnswerContext( previous_question="Meet Surface Pro 4", previous_qna_id=4 ) @@ -171,7 +171,7 @@ def test_query_knowledgebase_with_answerspan(self, qna_account, qna_key, qna_pro query_params = AnswersOptions( question="Ports and connectors", top=3, - context=KnowledgeBaseAnswerContext( + answer_context=KnowledgeBaseAnswerContext( previous_question="Meet Surface Pro 4", previous_qna_id=4 ), @@ -297,7 +297,7 @@ def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna_proje top=3, user_id="sd53lsY=", confidence_threshold=0.2, - context=KnowledgeBaseAnswerContext( + answer_context=KnowledgeBaseAnswerContext( previous_question="How long should my Surface battery last?", previous_qna_id=confident_answers[0].qna_id ), diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py index 75d406fc128a..4dee969204c1 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/test_query_knowledgebase_async.py @@ -132,7 +132,7 @@ async def test_query_knowledgebase(self, qna_account, qna_key, qna_project): query_params = AnswersOptions( question="Ports and connectors", top=3, - context=KnowledgeBaseAnswerContext( + answer_context=KnowledgeBaseAnswerContext( previous_questiony="Meet Surface Pro 4", previous_qna_id=4 ) @@ -173,7 +173,7 @@ async def test_query_knowledgebase_with_answerspan(self, qna_account, qna_key, q query_params = AnswersOptions( question="Ports and connectors", top=3, - context=KnowledgeBaseAnswerContext( + answer_context=KnowledgeBaseAnswerContext( previous_user_query="Meet Surface Pro 4", previous_qna_id=4 ), @@ -298,7 +298,7 @@ async def test_query_knowledgebase_with_followup(self, qna_account, qna_key, qna top=3, user_id="sd53lsY=", confidence_threshold=0.2, - context=KnowledgeBaseAnswerContext( + answer_context=KnowledgeBaseAnswerContext( previous_question="How long should my Surface battery last?", previous_qna_id=confident_answers[0].qna_id ),