From 418fd9b3c92eb82db6f2b1aa10cb8438c5e9bf3e Mon Sep 17 00:00:00 2001 From: iscai-msft <43154838+iscai-msft@users.noreply.github.com> Date: Thu, 23 Sep 2021 11:26:16 -0400 Subject: [PATCH] [qna] regenerate with 2021-07-15-preview (#20764) --- eng/.docsettings.yml | 1 + .../CHANGELOG.md | 2 + .../questionanswering/_configuration.py | 14 +- .../_question_answering_client.py | 20 +- .../questionanswering/_rest/__init__.py | 19 -- .../_rest/_request_builders.py | 229 --------------- .../_rest/_request_builders_py3.py | 210 -------------- .../ai/language/questionanswering/_version.py | 2 +- .../questionanswering/aio/_configuration.py | 14 +- .../aio/_question_answering_client.py | 20 +- .../aio/operations/__init__.py | 2 +- ...ng_client_operations.py => _operations.py} | 15 +- .../questionanswering/models/_models.py | 268 +++++++++--------- .../questionanswering/models/_models_py3.py | 268 +++++++++--------- .../_question_answering_client_enums.py | 30 +- .../questionanswering/operations/__init__.py | 2 +- ...ng_client_operations.py => _operations.py} | 84 +++++- .../swagger/README.md | 60 ++++ ...nowledgebase.test_query_knowledgebase.yaml | 26 +- ...edgebase.test_query_knowledgebase_llc.yaml | 26 +- ...ery_knowledgebase_llc_with_answerspan.yaml | 22 +- ...base.test_query_knowledgebase_only_id.yaml | 12 +- ...ase.test_query_knowledgebase_overload.yaml | 22 +- ....test_query_knowledgebase_python_dict.yaml | 12 +- ...t_query_knowledgebase_with_answerspan.yaml | 41 ++- ...t_query_knowledgebase_with_dictparams.yaml | 22 +- ...est_query_knowledgebase_with_followup.yaml | 58 ++-- ...gebase_async.test_query_knowledgebase.yaml | 27 +- ...se_async.test_query_knowledgebase_llc.yaml | 27 +- ...ery_knowledgebase_llc_with_answerspan.yaml | 42 ++- ...sync.test_query_knowledgebase_only_id.yaml | 11 +- ...ync.test_query_knowledgebase_overload.yaml | 23 +- ....test_query_knowledgebase_python_dict.yaml | 13 +- ...t_query_knowledgebase_with_answerspan.yaml | 42 ++- ...t_query_knowledgebase_with_dictparams.yaml | 23 +- ...est_query_knowledgebase_with_followup.yaml | 60 ++-- .../test_query_text.test_query_text.yaml | 20 +- .../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 | 30 +- ...text.test_query_text_with_str_records.yaml | 16 +- ...test_query_text_async.test_query_text.yaml | 21 +- ..._query_text_async.test_query_text_llc.yaml | 17 +- ...y_text_async.test_query_text_overload.yaml | 19 +- ...async.test_query_text_with_dictparams.yaml | 33 +-- ...sync.test_query_text_with_str_records.yaml | 21 +- .../tests/test_query_knowledgebase.py | 6 +- .../tests/test_query_knowledgebase_async.py | 6 +- .../tests/test_query_text.py | 2 +- .../tests/test_query_text_async.py | 2 +- 50 files changed, 853 insertions(+), 1141 deletions(-) delete mode 100644 sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/__init__.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/_request_builders.py delete mode 100644 sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/_request_builders_py3.py rename sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/{_question_answering_client_operations.py => _operations.py} (98%) rename sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/{_question_answering_client_operations.py => _operations.py} (86%) create mode 100644 sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 88bc934a04cc..3ed0535fbee3 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -78,6 +78,7 @@ known_content_issues: - ['sdk/servicebus/azure-servicebus/tests/perf_tests/README.md', '#4554'] - ['sdk/servicefabric/azure-servicefabric/README.md', '#4554'] - ['sdk/storage/azure-storage-blob/swagger/README.md', '#4554'] + - ['cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md', '#4554'] - ['sdk/storage/azure-storage-file-datalake/swagger/README.md', '#4554'] - ['sdk/storage/azure-storage-file-share/swagger/README.md', '#4554'] - ['sdk/storage/azure-storage/README.md', '#4554'] diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md index e9f0408f0f86..8df38ca5c8f8 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md @@ -2,6 +2,8 @@ ## 1.0.0b2 (unreleased) +* We are now targeting service version `2021-07-15-preview` + ### Breaking changes * The method `QuestionAnsweringClient.query_knowledgebase` has been renamed to `query_knowledge_base`. 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 f6230facf092..6b3cac6d6fc9 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 @@ -26,28 +26,28 @@ class QuestionAnsweringClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.AzureKeyCredential :param endpoint: Supported Cognitive Services endpoint (e.g., https://:code:``.api.cognitiveservices.azure.com). :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.AzureKeyCredential """ def __init__( self, - credential, # type: AzureKeyCredential endpoint, # type: str + credential, # type: AzureKeyCredential **kwargs # type: Any ): # type: (...) -> None - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(QuestionAnsweringClientConfiguration, self).__init__(**kwargs) - self.credential = credential self.endpoint = endpoint - self.api_version = "2021-05-01-preview" + self.credential = credential + self.api_version = "2021-07-15-preview" 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/_question_answering_client.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py index 3845ead22d0a..9de9e08df077 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 @@ -18,17 +18,17 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any + from typing import Any, Optional from azure.core.credentials import AzureKeyCredential from azure.core.rest import HttpRequest, HttpResponse 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 :code:`https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview`. :param endpoint: Supported Cognitive Services endpoint (e.g., - https://.api.cognitiveservices.azure.com). + https://:code:``.api.cognitiveservices.azure.com). :type endpoint: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential @@ -41,9 +41,9 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None - base_url = "{Endpoint}/language" - self._config = QuestionAnsweringClientConfiguration(credential, endpoint, **kwargs) - self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + _endpoint = "{Endpoint}/language" + self._config = QuestionAnsweringClientConfiguration(endpoint, credential, **kwargs) + self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -57,6 +57,13 @@ def send_request( ): # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart :param request: The network request you want to make. Required. @@ -70,6 +77,7 @@ def send_request( path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, **kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/__init__.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/__init__.py deleted file mode 100644 index bb4c4f612106..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -try: - from ._request_builders_py3 import build_query_knowledge_base_request - from ._request_builders_py3 import build_query_text_request -except (SyntaxError, ImportError): - from ._request_builders import build_query_knowledge_base_request # type: ignore - from ._request_builders import build_query_text_request # type: ignore - -__all__ = [ - "build_query_knowledge_base_request", - "build_query_text_request", -] diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/_request_builders.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/_request_builders.py deleted file mode 100644 index 2d9863dd1c85..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/_request_builders.py +++ /dev/null @@ -1,229 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING - -from azure.core.rest import HttpRequest -from msrest import Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - -_SERIALIZER = Serializer() - -# fmt: off - -def build_query_knowledge_base_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Answers the specified question using your knowledge base. - - Answers the specified question using your knowledge base. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword project_name: The name of the project to use. - :paramtype project_name: str - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. Post body of the request. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). Post body of the request. - :paramtype content: any - :keyword deployment_name: The name of the specific deployment of the project to use. - :paramtype deployment_name: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "answerSpanRequest": { - "confidenceScoreThreshold": "float (optional)", - "enable": "bool (optional)", - "topAnswersWithSpan": "int (optional)" - }, - "confidenceScoreThreshold": "float (optional)", - "context": { - "previousQnaId": "int", - "previousUserQuery": "str (optional)" - }, - "includeUnstructuredSources": "bool (optional)", - "qnaId": "int (optional)", - "question": "str (optional)", - "rankerType": "str (optional)", - "strictFilters": { - "compoundOperation": "str (optional)", - "metadataFilter": { - "compoundOperation": "str (optional)", - "metadata": { - "str": "str (optional)" - } - }, - "sourceFilter": [ - "str (optional)" - ] - }, - "top": "int (optional)", - "userId": "str (optional)" - } - - # response body for status code(s): 200 - response.json() == { - "answers": [ - { - "answer": "str (optional)", - "answerSpan": { - "confidenceScore": "float (optional)", - "length": "int (optional)", - "offset": "int (optional)", - "text": "str (optional)" - }, - "confidenceScore": "float (optional)", - "dialog": { - "isContextOnly": "bool (optional)", - "prompts": [ - { - "displayOrder": "int (optional)", - "displayText": "str (optional)", - "qnaId": "int (optional)" - } - ] - }, - "id": "int (optional)", - "metadata": { - "str": "str (optional)" - }, - "questions": [ - "str (optional)" - ], - "source": "str (optional)" - } - ] - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - project_name = kwargs.pop('project_name') # type: str - deployment_name = kwargs.pop('deployment_name', None) # type: Optional[str] - - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/:query-knowledgebases') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['projectName'] = _SERIALIZER.query("project_name", project_name, 'str') - if deployment_name is not None: - query_parameters['deploymentName'] = _SERIALIZER.query("deployment_name", deployment_name, 'str') - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) - - -def build_query_text_request( - **kwargs # type: Any -): - # type: (...) -> HttpRequest - """Answers the specified question using the provided text in the body. - - Answers the specified question using the provided text in the body. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. Post body of the request. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). Post body of the request. - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "language": "str (optional)", - "question": "str", - "records": [ - { - "id": "str", - "text": "str" - } - ], - "stringIndexType": "str (optional). Default value is \"TextElements_v8\"" - } - - # response body for status code(s): 200 - response.json() == { - "answers": [ - { - "answer": "str (optional)", - "answerSpan": { - "confidenceScore": "float (optional)", - "length": "int (optional)", - "offset": "int (optional)", - "text": "str (optional)" - }, - "confidenceScore": "float (optional)", - "id": "str (optional)", - "length": "int (optional)", - "offset": "int (optional)" - } - ] - } - """ - - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", '/:query-text') - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=url, - params=query_parameters, - headers=header_parameters, - **kwargs - ) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/_request_builders_py3.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/_request_builders_py3.py deleted file mode 100644 index 77bb3c947abe..000000000000 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_rest/_request_builders_py3.py +++ /dev/null @@ -1,210 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Optional - -from azure.core.rest import HttpRequest -from msrest import Serializer - -_SERIALIZER = Serializer() - - -def build_query_knowledge_base_request( - *, project_name: str, json: Any = None, content: Any = None, deployment_name: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - """Answers the specified question using your knowledge base. - - Answers the specified question using your knowledge base. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword project_name: The name of the project to use. - :paramtype project_name: str - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. Post body of the request. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). Post body of the request. - :paramtype content: any - :keyword deployment_name: The name of the specific deployment of the project to use. - :paramtype deployment_name: str - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "answerSpanRequest": { - "confidenceScoreThreshold": "float (optional)", - "enable": "bool (optional)", - "topAnswersWithSpan": "int (optional)" - }, - "confidenceScoreThreshold": "float (optional)", - "context": { - "previousQnaId": "int", - "previousUserQuery": "str (optional)" - }, - "includeUnstructuredSources": "bool (optional)", - "qnaId": "int (optional)", - "question": "str (optional)", - "rankerType": "str (optional)", - "strictFilters": { - "compoundOperation": "str (optional)", - "metadataFilter": { - "compoundOperation": "str (optional)", - "metadata": { - "str": "str (optional)" - } - }, - "sourceFilter": [ - "str (optional)" - ] - }, - "top": "int (optional)", - "userId": "str (optional)" - } - - # response body for status code(s): 200 - response.json() == { - "answers": [ - { - "answer": "str (optional)", - "answerSpan": { - "confidenceScore": "float (optional)", - "length": "int (optional)", - "offset": "int (optional)", - "text": "str (optional)" - }, - "confidenceScore": "float (optional)", - "dialog": { - "isContextOnly": "bool (optional)", - "prompts": [ - { - "displayOrder": "int (optional)", - "displayText": "str (optional)", - "qnaId": "int (optional)" - } - ] - }, - "id": "int (optional)", - "metadata": { - "str": "str (optional)" - }, - "questions": [ - "str (optional)" - ], - "source": "str (optional)" - } - ] - } - """ - - content_type = kwargs.pop("content_type", None) # type: Optional[str] - - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", "/:query-knowledgebases") - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["projectName"] = _SERIALIZER.query("project_name", project_name, "str") - if deployment_name is not None: - query_parameters["deploymentName"] = _SERIALIZER.query("deployment_name", deployment_name, "str") - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest( - method="POST", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs - ) - - -def build_query_text_request(*, json: Any = None, content: Any = None, **kwargs: Any) -> HttpRequest: - """Answers the specified question using the provided text in the body. - - Answers the specified question using the provided text in the body. - - See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder - into your code flow. - - :keyword json: Pass in a JSON-serializable object (usually a dictionary). See the template in - our example to find the input shape. Post body of the request. - :paramtype json: any - :keyword content: Pass in binary content you want in the body of the request (typically bytes, - a byte iterator, or stream input). Post body of the request. - :paramtype content: any - :return: Returns an :class:`~azure.core.rest.HttpRequest` that you will pass to the client's - `send_request` method. See https://aka.ms/azsdk/python/protocol/quickstart for how to - incorporate this response into your code flow. - :rtype: ~azure.core.rest.HttpRequest - - Example: - .. code-block:: python - - # JSON input template you can fill out and use as your body input. - json = { - "language": "str (optional)", - "question": "str", - "records": [ - { - "id": "str", - "text": "str" - } - ], - "stringIndexType": "str (optional). Default value is \"TextElements_v8\"" - } - - # response body for status code(s): 200 - response.json() == { - "answers": [ - { - "answer": "str (optional)", - "answerSpan": { - "confidenceScore": "float (optional)", - "length": "int (optional)", - "offset": "int (optional)", - "text": "str (optional)" - }, - "confidenceScore": "float (optional)", - "id": "str (optional)", - "length": "int (optional)", - "offset": "int (optional)" - } - ] - } - """ - - content_type = kwargs.pop("content_type", None) # type: Optional[str] - - api_version = "2021-05-01-preview" - accept = "application/json" - # Construct URL - url = kwargs.pop("template_url", "/:query-text") - - # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - header_parameters["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - header_parameters["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest( - method="POST", url=url, params=query_parameters, headers=header_parameters, json=json, content=content, **kwargs - ) 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 e5754a47ce68..dfa6ee022f15 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.0b1" +VERSION = "1.0.0b2" 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 b682db120b9a..ee091c9c9529 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 @@ -21,22 +21,22 @@ class QuestionAnsweringClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.AzureKeyCredential :param endpoint: Supported Cognitive Services endpoint (e.g., https://:code:``.api.cognitiveservices.azure.com). :type endpoint: str + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.AzureKeyCredential """ - def __init__(self, credential: AzureKeyCredential, endpoint: str, **kwargs: Any) -> None: - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") + def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") super(QuestionAnsweringClientConfiguration, self).__init__(**kwargs) - self.credential = credential self.endpoint = endpoint - self.api_version = "2021-05-01-preview" + self.credential = credential + self.api_version = "2021-07-15-preview" 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 6185b8aeaa1e..6994f258008f 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 @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable +from typing import Any, Awaitable, Optional from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -20,19 +20,19 @@ 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 :code:`https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview`. :param endpoint: Supported Cognitive Services endpoint (e.g., - https://.api.cognitiveservices.azure.com). + https://:code:``.api.cognitiveservices.azure.com). :type endpoint: str :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential """ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: - base_url = "{Endpoint}/language" - self._config = QuestionAnsweringClientConfiguration(credential, endpoint, **kwargs) - self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + _endpoint = "{Endpoint}/language" + self._config = QuestionAnsweringClientConfiguration(endpoint, credential, **kwargs) + self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -41,6 +41,13 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart :param request: The network request you want to make. Required. @@ -54,6 +61,7 @@ def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHt path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, **kwargs) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/__init__.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/__init__.py index 200be9f1c22e..7dfc3aeb84bb 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/__init__.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._question_answering_client_operations import QuestionAnsweringClientOperationsMixin +from ._operations import QuestionAnsweringClientOperationsMixin __all__ = [ "QuestionAnsweringClientOperationsMixin", diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_question_answering_client_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py similarity index 98% rename from sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_question_answering_client_operations.py rename to sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py index 00d91b45f212..6775164a54ba 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_question_answering_client_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/aio/operations/_operations.py @@ -20,7 +20,8 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest -from ... import models as _models, _rest as rest +from ... import models as _models +from ...operations._operations import build_query_knowledge_base_request, build_query_text_request from ..._patch import _validate_text_records T = TypeVar("T") @@ -173,13 +174,13 @@ async def query_knowledge_base( json = self._serialize.body(knowledge_base_query_options, "KnowledgeBaseQueryOptions") - request = rest.build_query_knowledge_base_request( + request = build_query_knowledge_base_request( content_type=content_type, project_name=project_name, deployment_name=deployment_name, json=json, template_url=self.query_knowledge_base.metadata["url"], - )._to_pipeline_transport_request() + ) path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -192,7 +193,7 @@ async def query_knowledge_base( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize("KnowledgeBaseAnswers", pipeline_response) @@ -299,11 +300,11 @@ async def query_text( json = self._serialize.body(text_query_options, "TextQueryOptions") - request = rest.build_query_text_request( + request = build_query_text_request( content_type=content_type, json=json, template_url=self.query_text.metadata["url"], - )._to_pipeline_transport_request() + ) path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -316,7 +317,7 @@ async def query_text( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize("TextAnswers", pipeline_response) 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 6c8cf32df4db..e16ad163e9fe 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 @@ -13,14 +13,14 @@ class AnswerSpan(msrest.serialization.Model): """Answer span object of QnA. - :param text: Predicted text of answer span. - :type text: str - :param confidence_score: Predicted score of answer span, value ranges from 0 to 1. - :type confidence_score: float - :param offset: The answer span offset from the start of answer. - :type offset: int - :param length: The length of the answer span. - :type length: int + :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 offset: The answer span offset from the start of answer. + :paramtype offset: int + :keyword length: The length of the answer span. + :paramtype length: int """ _validation = { @@ -45,14 +45,14 @@ def __init__(self, **kwargs): class AnswerSpanRequest(msrest.serialization.Model): """To configure Answer span prediction feature. - :param enable: Enable or disable Answer Span prediction. - :type enable: bool - :param confidence_score_threshold: Minimum threshold score required to include an answer span, - value ranges from 0 to 1. - :type confidence_score_threshold: float - :param top_answers_with_span: Number of Top answers to be considered for span prediction from 1 - to 10. - :type top_answers_with_span: int + :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 """ _validation = { @@ -78,19 +78,19 @@ class Error(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. One of a server-defined set of error codes. Possible values include: + :keyword code: Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound", "TooManyRequests", "InternalServerError", "ServiceUnavailable". - :type code: str or ~azure.ai.language.questionanswering.models.ErrorCode - :param message: Required. A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this reported error. - :type details: list[~azure.ai.language.questionanswering.models.Error] - :param innererror: An object containing more specific information than the current object about - the error. - :type innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel + :paramtype code: str or ~azure.ai.language.questionanswering.models.ErrorCode + :keyword message: Required. A human-readable representation of the error. + :paramtype message: str + :keyword target: The target of the error. + :paramtype target: str + :keyword details: An array of details about specific errors that led to this reported error. + :paramtype details: list[~azure.ai.language.questionanswering.models.Error] + :keyword innererror: An object containing more specific information than the current object + about the error. + :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel """ _validation = { @@ -118,8 +118,8 @@ def __init__(self, **kwargs): class ErrorResponse(msrest.serialization.Model): """Error response. - :param error: The error object. - :type error: ~azure.ai.language.questionanswering.models.Error + :keyword error: The error object. + :paramtype error: ~azure.ai.language.questionanswering.models.Error """ _attribute_map = { @@ -136,19 +136,19 @@ class InnerErrorModel(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. One of a server-defined set of error codes. Possible values include: + :keyword code: Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidParameterValue", "KnowledgeBaseNotFound", "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", "ExtractionFailure". - :type code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode - :param message: Required. Error message. - :type message: str - :param details: Error details. - :type details: dict[str, str] - :param target: Error target. - :type target: str - :param innererror: An object containing more specific information than the current object about - the error. - :type innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel + :paramtype code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode + :keyword message: Required. Error message. + :paramtype message: str + :keyword details: Error details. + :paramtype details: dict[str, str] + :keyword target: Error target. + :paramtype target: str + :keyword innererror: An object containing more specific information than the current object + about the error. + :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel """ _validation = { @@ -176,23 +176,23 @@ def __init__(self, **kwargs): class KnowledgeBaseAnswer(msrest.serialization.Model): """Represents knowledge base answer. - :param questions: List of questions. - :type questions: list[str] - :param answer: The Answer. - :type answer: str - :param confidence_score: Answer confidence score, value ranges from 0 to 1. - :type confidence_score: float - :param id: ID of the QnA result. - :type id: int - :param source: Source of QnA result. - :type source: str - :param metadata: Metadata associated with the answer, useful to categorize or filter question + :keyword questions: List of questions. + :paramtype questions: list[str] + :keyword answer: The Answer. + :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 source: Source of QnA result. + :paramtype source: str + :keyword metadata: Metadata associated with the answer, useful to categorize or filter question answers. - :type metadata: dict[str, str] - :param dialog: Dialog associated with Answer. - :type dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog - :param answer_span: Answer span object of QnA with respect to user's question. - :type answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :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 """ _validation = { @@ -225,12 +225,12 @@ def __init__(self, **kwargs): class KnowledgeBaseAnswerDialog(msrest.serialization.Model): """Dialog associated with Answer. - :param is_context_only: To mark if a prompt is relevant only with a previous question or not. + :keyword is_context_only: To mark if a prompt is relevant only with a previous question or not. 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. - :type is_context_only: bool - :param prompts: List of 0 to 20 prompts associated with the answer. - :type prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt] + :paramtype is_context_only: bool + :keyword prompts: List of 0 to 20 prompts associated with the answer. + :paramtype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt] """ _validation = { @@ -251,12 +251,12 @@ def __init__(self, **kwargs): class KnowledgeBaseAnswerPrompt(msrest.serialization.Model): """Prompt for an answer. - :param display_order: Index of the prompt - used in ordering of the prompts. - :type display_order: int - :param qna_id: QnA ID corresponding to the prompt. - :type qna_id: int - :param display_text: Text displayed to represent a follow up question prompt. - :type display_text: str + :keyword display_order: Index of the prompt - used in ordering of the prompts. + :paramtype display_order: int + :keyword qna_id: QnA ID corresponding to the prompt. + :paramtype qna_id: int + :keyword display_text: Text displayed to represent a follow up question prompt. + :paramtype display_text: str """ _validation = { @@ -281,10 +281,10 @@ class KnowledgeBaseAnswerRequestContext(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param previous_qna_id: Required. Previous turn top answer result QnA ID. - :type previous_qna_id: int - :param previous_user_query: Previous user query. - :type previous_user_query: str + :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 """ _validation = { @@ -305,8 +305,8 @@ def __init__(self, **kwargs): class KnowledgeBaseAnswers(msrest.serialization.Model): """Represents List of Question Answers. - :param answers: Represents Answer Result list. - :type answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] + :keyword answers: Represents Answer Result list. + :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] """ _attribute_map = { @@ -321,29 +321,32 @@ def __init__(self, **kwargs): class KnowledgeBaseQueryOptions(msrest.serialization.Model): """The question parameters to answer using a knowledge base. - :param qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over question. - :type qna_id: int - :param question: User question to query against the knowledge base. - :type question: str - :param top: Max number of answers to be returned for the question. - :type top: int - :param user_id: Unique identifier for the user. - :type user_id: str - :param confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to - 1. - :type confidence_score_threshold: float - :param context: Context object with previous QnA's information. - :type context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :param ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible - values include: "Default", "QuestionOnly". - :type ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :param strict_filters: Filter QnAs based on give metadata list and knowledge base source names. - :type strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters - :param answer_span_request: To configure Answer span prediction feature. - :type answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :param include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. - :type include_unstructured_sources: bool + :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 strict_filters: Filter QnAs based on give metadata list and knowledge base source + names. + :paramtype strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters + :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 """ _validation = { @@ -380,11 +383,11 @@ def __init__(self, **kwargs): class MetadataFilter(msrest.serialization.Model): """Find QnAs that are associated with the given list of metadata. - :param metadata: Dictionary of :code:``. - :type metadata: dict[str, str] - :param compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation. + :keyword metadata: Dictionary of :code:``. + :paramtype metadata: dict[str, str] + :keyword compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation. Possible values include: "AND", "OR". - :type compound_operation: str or + :paramtype compound_operation: str or ~azure.ai.language.questionanswering.models.CompoundOperationKind """ @@ -402,14 +405,14 @@ def __init__(self, **kwargs): class StrictFilters(msrest.serialization.Model): """filters over knowledge base. - :param metadata_filter: Find QnAs that are associated with the given list of metadata. - :type metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter - :param source_filter: Find QnAs that are associated with the given list of sources in knowledge - base. - :type source_filter: list[str] - :param compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation. + :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 + knowledge base. + :paramtype source_filter: list[str] + :keyword compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation. Possible values include: "AND", "OR". - :type compound_operation: str or + :paramtype compound_operation: str or ~azure.ai.language.questionanswering.models.CompoundOperationKind """ @@ -429,18 +432,18 @@ def __init__(self, **kwargs): class TextAnswer(msrest.serialization.Model): """Represents answer result. - :param answer: Answer. - :type answer: str - :param confidence_score: answer confidence score, value ranges from 0 to 1. - :type confidence_score: float - :param id: record ID. - :type id: str - :param answer_span: Answer span object with respect to user's question. - :type answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan - :param offset: The sentence offset from the start of the document. - :type offset: int - :param length: The length of the sentence. - :type length: int + :keyword answer: Answer. + :paramtype answer: str + :keyword confidence_score: answer confidence score, value ranges from 0 to 1. + :paramtype confidence_score: 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 offset: The sentence offset from the start of the document. + :paramtype offset: int + :keyword length: The length of the sentence. + :paramtype length: int """ _validation = { @@ -469,8 +472,8 @@ def __init__(self, **kwargs): class TextAnswers(msrest.serialization.Model): """Represents the answer results. - :param answers: Represents the answer results. - :type answers: list[~azure.ai.language.questionanswering.models.TextAnswer] + :keyword answers: Represents the answer results. + :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] """ _attribute_map = { @@ -487,19 +490,20 @@ class TextQueryOptions(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param question: Required. User question to query against the given text records. - :type question: str - :param records: Required. Text records to be searched for given question. - :type records: list[~azure.ai.language.questionanswering.models.TextRecord] - :param 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 + :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. - :type language: str - :param string_index_type: Specifies the method used to interpret string offsets. Defaults to + :paramtype language: str + :keyword string_index_type: Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. Possible values include: "TextElements_v8", "UnicodeCodePoint", "Utf16CodeUnit". Default value: "TextElements_v8". - :type string_index_type: str or ~azure.ai.language.questionanswering.models.StringIndexType + :paramtype string_index_type: str or + ~azure.ai.language.questionanswering.models.StringIndexType """ _validation = { @@ -527,10 +531,10 @@ class TextRecord(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Unique identifier for the text record. - :type id: str - :param text: Required. Text contents of the record. - :type text: str + :keyword id: Required. Unique identifier for the text record. + :paramtype id: str + :keyword text: Required. Text contents of the record. + :paramtype text: str """ _validation = { 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 cc0008ee865e..e7b7507de720 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 @@ -17,14 +17,14 @@ class AnswerSpan(msrest.serialization.Model): """Answer span object of QnA. - :param text: Predicted text of answer span. - :type text: str - :param confidence_score: Predicted score of answer span, value ranges from 0 to 1. - :type confidence_score: float - :param offset: The answer span offset from the start of answer. - :type offset: int - :param length: The length of the answer span. - :type length: int + :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 offset: The answer span offset from the start of answer. + :paramtype offset: int + :keyword length: The length of the answer span. + :paramtype length: int """ _validation = { @@ -57,14 +57,14 @@ def __init__( class AnswerSpanRequest(msrest.serialization.Model): """To configure Answer span prediction feature. - :param enable: Enable or disable Answer Span prediction. - :type enable: bool - :param confidence_score_threshold: Minimum threshold score required to include an answer span, - value ranges from 0 to 1. - :type confidence_score_threshold: float - :param top_answers_with_span: Number of Top answers to be considered for span prediction from 1 - to 10. - :type top_answers_with_span: int + :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 """ _validation = { @@ -97,19 +97,19 @@ class Error(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. One of a server-defined set of error codes. Possible values include: + :keyword code: Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidArgument", "Unauthorized", "Forbidden", "NotFound", "TooManyRequests", "InternalServerError", "ServiceUnavailable". - :type code: str or ~azure.ai.language.questionanswering.models.ErrorCode - :param message: Required. A human-readable representation of the error. - :type message: str - :param target: The target of the error. - :type target: str - :param details: An array of details about specific errors that led to this reported error. - :type details: list[~azure.ai.language.questionanswering.models.Error] - :param innererror: An object containing more specific information than the current object about - the error. - :type innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel + :paramtype code: str or ~azure.ai.language.questionanswering.models.ErrorCode + :keyword message: Required. A human-readable representation of the error. + :paramtype message: str + :keyword target: The target of the error. + :paramtype target: str + :keyword details: An array of details about specific errors that led to this reported error. + :paramtype details: list[~azure.ai.language.questionanswering.models.Error] + :keyword innererror: An object containing more specific information than the current object + about the error. + :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel """ _validation = { @@ -146,8 +146,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Error response. - :param error: The error object. - :type error: ~azure.ai.language.questionanswering.models.Error + :keyword error: The error object. + :paramtype error: ~azure.ai.language.questionanswering.models.Error """ _attribute_map = { @@ -164,19 +164,19 @@ class InnerErrorModel(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. One of a server-defined set of error codes. Possible values include: + :keyword code: Required. One of a server-defined set of error codes. Possible values include: "InvalidRequest", "InvalidParameterValue", "KnowledgeBaseNotFound", "AzureCognitiveSearchNotFound", "AzureCognitiveSearchThrottling", "ExtractionFailure". - :type code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode - :param message: Required. Error message. - :type message: str - :param details: Error details. - :type details: dict[str, str] - :param target: Error target. - :type target: str - :param innererror: An object containing more specific information than the current object about - the error. - :type innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel + :paramtype code: str or ~azure.ai.language.questionanswering.models.InnerErrorCode + :keyword message: Required. Error message. + :paramtype message: str + :keyword details: Error details. + :paramtype details: dict[str, str] + :keyword target: Error target. + :paramtype target: str + :keyword innererror: An object containing more specific information than the current object + about the error. + :paramtype innererror: ~azure.ai.language.questionanswering.models.InnerErrorModel """ _validation = { @@ -213,23 +213,23 @@ def __init__( class KnowledgeBaseAnswer(msrest.serialization.Model): """Represents knowledge base answer. - :param questions: List of questions. - :type questions: list[str] - :param answer: The Answer. - :type answer: str - :param confidence_score: Answer confidence score, value ranges from 0 to 1. - :type confidence_score: float - :param id: ID of the QnA result. - :type id: int - :param source: Source of QnA result. - :type source: str - :param metadata: Metadata associated with the answer, useful to categorize or filter question + :keyword questions: List of questions. + :paramtype questions: list[str] + :keyword answer: The Answer. + :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 source: Source of QnA result. + :paramtype source: str + :keyword metadata: Metadata associated with the answer, useful to categorize or filter question answers. - :type metadata: dict[str, str] - :param dialog: Dialog associated with Answer. - :type dialog: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog - :param answer_span: Answer span object of QnA with respect to user's question. - :type answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan + :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 """ _validation = { @@ -274,12 +274,12 @@ def __init__( class KnowledgeBaseAnswerDialog(msrest.serialization.Model): """Dialog associated with Answer. - :param is_context_only: To mark if a prompt is relevant only with a previous question or not. + :keyword is_context_only: To mark if a prompt is relevant only with a previous question or not. 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. - :type is_context_only: bool - :param prompts: List of 0 to 20 prompts associated with the answer. - :type prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt] + :paramtype is_context_only: bool + :keyword prompts: List of 0 to 20 prompts associated with the answer. + :paramtype prompts: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerPrompt] """ _validation = { @@ -306,12 +306,12 @@ def __init__( class KnowledgeBaseAnswerPrompt(msrest.serialization.Model): """Prompt for an answer. - :param display_order: Index of the prompt - used in ordering of the prompts. - :type display_order: int - :param qna_id: QnA ID corresponding to the prompt. - :type qna_id: int - :param display_text: Text displayed to represent a follow up question prompt. - :type display_text: str + :keyword display_order: Index of the prompt - used in ordering of the prompts. + :paramtype display_order: int + :keyword qna_id: QnA ID corresponding to the prompt. + :paramtype qna_id: int + :keyword display_text: Text displayed to represent a follow up question prompt. + :paramtype display_text: str """ _validation = { @@ -343,10 +343,10 @@ class KnowledgeBaseAnswerRequestContext(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param previous_qna_id: Required. Previous turn top answer result QnA ID. - :type previous_qna_id: int - :param previous_user_query: Previous user query. - :type previous_user_query: str + :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 """ _validation = { @@ -367,8 +367,8 @@ def __init__(self, *, previous_qna_id: int, previous_user_query: Optional[str] = class KnowledgeBaseAnswers(msrest.serialization.Model): """Represents List of Question Answers. - :param answers: Represents Answer Result list. - :type answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] + :keyword answers: Represents Answer Result list. + :paramtype answers: list[~azure.ai.language.questionanswering.models.KnowledgeBaseAnswer] """ _attribute_map = { @@ -383,29 +383,32 @@ def __init__(self, *, answers: Optional[List["KnowledgeBaseAnswer"]] = None, **k class KnowledgeBaseQueryOptions(msrest.serialization.Model): """The question parameters to answer using a knowledge base. - :param qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over + :keyword qna_id: Exact QnA ID to fetch from the knowledge base, this field takes priority over question. - :type qna_id: int - :param question: User question to query against the knowledge base. - :type question: str - :param top: Max number of answers to be returned for the question. - :type top: int - :param user_id: Unique identifier for the user. - :type user_id: str - :param confidence_score_threshold: Minimum threshold score for answers, value ranges from 0 to - 1. - :type confidence_score_threshold: float - :param context: Context object with previous QnA's information. - :type context: ~azure.ai.language.questionanswering.models.KnowledgeBaseAnswerRequestContext - :param ranker_type: (Optional) Set to 'QuestionOnly' for using a question only Ranker. Possible - values include: "Default", "QuestionOnly". - :type ranker_type: str or ~azure.ai.language.questionanswering.models.RankerType - :param strict_filters: Filter QnAs based on give metadata list and knowledge base source names. - :type strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters - :param answer_span_request: To configure Answer span prediction feature. - :type answer_span_request: ~azure.ai.language.questionanswering.models.AnswerSpanRequest - :param include_unstructured_sources: (Optional) Flag to enable Query over Unstructured Sources. - :type include_unstructured_sources: bool + :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 strict_filters: Filter QnAs based on give metadata list and knowledge base source + names. + :paramtype strict_filters: ~azure.ai.language.questionanswering.models.StrictFilters + :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 """ _validation = { @@ -456,11 +459,11 @@ def __init__( class MetadataFilter(msrest.serialization.Model): """Find QnAs that are associated with the given list of metadata. - :param metadata: Dictionary of :code:``. - :type metadata: dict[str, str] - :param compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation. + :keyword metadata: Dictionary of :code:``. + :paramtype metadata: dict[str, str] + :keyword compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation. Possible values include: "AND", "OR". - :type compound_operation: str or + :paramtype compound_operation: str or ~azure.ai.language.questionanswering.models.CompoundOperationKind """ @@ -484,14 +487,14 @@ def __init__( class StrictFilters(msrest.serialization.Model): """filters over knowledge base. - :param metadata_filter: Find QnAs that are associated with the given list of metadata. - :type metadata_filter: ~azure.ai.language.questionanswering.models.MetadataFilter - :param source_filter: Find QnAs that are associated with the given list of sources in knowledge - base. - :type source_filter: list[str] - :param compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation. + :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 + knowledge base. + :paramtype source_filter: list[str] + :keyword compound_operation: (Optional) Set to 'OR' for joining metadata using 'OR' operation. Possible values include: "AND", "OR". - :type compound_operation: str or + :paramtype compound_operation: str or ~azure.ai.language.questionanswering.models.CompoundOperationKind """ @@ -518,18 +521,18 @@ def __init__( class TextAnswer(msrest.serialization.Model): """Represents answer result. - :param answer: Answer. - :type answer: str - :param confidence_score: answer confidence score, value ranges from 0 to 1. - :type confidence_score: float - :param id: record ID. - :type id: str - :param answer_span: Answer span object with respect to user's question. - :type answer_span: ~azure.ai.language.questionanswering.models.AnswerSpan - :param offset: The sentence offset from the start of the document. - :type offset: int - :param length: The length of the sentence. - :type length: int + :keyword answer: Answer. + :paramtype answer: str + :keyword confidence_score: answer confidence score, value ranges from 0 to 1. + :paramtype confidence_score: 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 offset: The sentence offset from the start of the document. + :paramtype offset: int + :keyword length: The length of the sentence. + :paramtype length: int """ _validation = { @@ -568,8 +571,8 @@ def __init__( class TextAnswers(msrest.serialization.Model): """Represents the answer results. - :param answers: Represents the answer results. - :type answers: list[~azure.ai.language.questionanswering.models.TextAnswer] + :keyword answers: Represents the answer results. + :paramtype answers: list[~azure.ai.language.questionanswering.models.TextAnswer] """ _attribute_map = { @@ -586,19 +589,20 @@ class TextQueryOptions(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param question: Required. User question to query against the given text records. - :type question: str - :param records: Required. Text records to be searched for given question. - :type records: list[~azure.ai.language.questionanswering.models.TextRecord] - :param 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 + :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. - :type language: str - :param string_index_type: Specifies the method used to interpret string offsets. Defaults to + :paramtype language: str + :keyword string_index_type: Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. Possible values include: "TextElements_v8", "UnicodeCodePoint", "Utf16CodeUnit". Default value: "TextElements_v8". - :type string_index_type: str or ~azure.ai.language.questionanswering.models.StringIndexType + :paramtype string_index_type: str or + ~azure.ai.language.questionanswering.models.StringIndexType """ _validation = { @@ -634,10 +638,10 @@ class TextRecord(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Unique identifier for the text record. - :type id: str - :param text: Required. Text contents of the record. - :type text: str + :keyword id: Required. Unique identifier for the text record. + :paramtype id: str + :keyword text: Required. Text contents of the record. + :paramtype text: str """ _validation = { 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 1d2dafe470bc..869e123dc112 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 @@ -6,35 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CompoundOperationKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CompoundOperationKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """(Optional) Set to 'OR' for joining metadata using 'OR' operation.""" AND_ENUM = "AND" OR_ENUM = "OR" -class ErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Human-readable error code.""" INVALID_REQUEST = "InvalidRequest" @@ -47,7 +31,7 @@ class ErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE_UNAVAILABLE = "ServiceUnavailable" -class InnerErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InnerErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Human-readable error code.""" INVALID_REQUEST = "InvalidRequest" @@ -58,14 +42,14 @@ class InnerErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): EXTRACTION_FAILURE = "ExtractionFailure" -class RankerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RankerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """(Optional) Set to 'QuestionOnly' for using a question only Ranker.""" DEFAULT = "Default" QUESTION_ONLY = "QuestionOnly" -class StringIndexType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StringIndexType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/__init__.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/__init__.py index 200be9f1c22e..7dfc3aeb84bb 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/__init__.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/__init__.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._question_answering_client_operations import QuestionAnsweringClientOperationsMixin +from ._operations import QuestionAnsweringClientOperationsMixin __all__ = [ "QuestionAnsweringClientOperationsMixin", diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_question_answering_client_operations.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py similarity index 86% rename from sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_question_answering_client_operations.py rename to sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py index 0d415602e1c9..4f8f585e2a7e 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_question_answering_client_operations.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/operations/_operations.py @@ -19,8 +19,9 @@ from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest +from msrest import Serializer -from .. import models as _models, _rest as rest +from .. import models as _models from .._patch import _validate_text_records if TYPE_CHECKING: @@ -30,7 +31,74 @@ T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - +_SERIALIZER = Serializer() +# fmt: off + +def build_query_knowledge_base_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + project_name = kwargs.pop('project_name') # type: str + deployment_name = kwargs.pop('deployment_name', None) # type: Optional[str] + + api_version = "2021-07-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/:query-knowledgebases') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['projectName'] = _SERIALIZER.query("project_name", project_name, 'str') + if deployment_name is not None: + query_parameters['deploymentName'] = _SERIALIZER.query("deployment_name", deployment_name, 'str') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_query_text_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-15-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/:query-text') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class QuestionAnsweringClientOperationsMixin(object): @overload def query_knowledge_base( @@ -164,13 +232,13 @@ def query_knowledge_base( json = self._serialize.body(knowledge_base_query_options, "KnowledgeBaseQueryOptions") - request = rest.build_query_knowledge_base_request( + request = build_query_knowledge_base_request( content_type=content_type, project_name=project_name, deployment_name=deployment_name, json=json, template_url=self.query_knowledge_base.metadata["url"], - )._to_pipeline_transport_request() + ) path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -181,7 +249,7 @@ def query_knowledge_base( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize("KnowledgeBaseAnswers", pipeline_response) @@ -290,11 +358,11 @@ def query_text( json = self._serialize.body(text_query_options, "TextQueryOptions") - request = rest.build_query_text_request( + request = build_query_text_request( content_type=content_type, json=json, template_url=self.query_text.metadata["url"], - )._to_pipeline_transport_request() + ) path_format_arguments = { "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), } @@ -305,7 +373,7 @@ def query_text( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error) deserialized = self._deserialize("TextAnswers", pipeline_response) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md new file mode 100644 index 000000000000..631ff0b2fbb5 --- /dev/null +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/swagger/README.md @@ -0,0 +1,60 @@ +# Azure QnA for Python + +> see https://aka.ms/autorest + +### Setup + +Install Autorest v3 + +```ps +npm install -g autorest +``` + +### Generation + +```ps +cd +autorest +``` + +### Settings + +```yaml +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/feature/cognitiveservices/language/specification/cognitiveservices/data-plane/Language/preview/2021-07-15-preview/questionanswering.json +output-folder: ../azure/ai/language/questionanswering +namespace: azure.ai.language.questionanswering +package-name: azure-ai-language-questionanswering +license-header: MICROSOFT_MIT_NO_VERSION +clear-output-folder: true +no-namespace-folders: true +python: true +title: QuestionAnsweringClient +version-tolerant: true +models-mode: msrest +package-version: 1.0.0b2 +add-credential: true +credential-default-policy-type: AzureKeyCredentialPolicy +credential-key-header-name: Ocp-Apim-Subscription-Key +black: true +``` + +### Rename "QuestionAnsweringKnowledgeBase_Query" -> "QueryKnowledgeBase" + +```yaml +directive: + - from: swagger-document + where: $["paths"]["/:query-knowledgebases"]["post"] + transform: > + $["operationId"] = "queryKnowledgeBase"; +``` + +### Rename "QuestionAnsweringText_Query" -> "QueryText" + +```yaml +directive: + - from: swagger-document + where: $["paths"]["/:query-text"]["post"] + transform: > + $["operationId"] = "queryText"; +``` + 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 e45e18a420ba..afdbe07a2dba 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.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -67,7 +67,7 @@ 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\": - 100.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 5,\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 @@ -82,10 +82,10 @@ interactions: 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\": 46.59,\n \"id\": - 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": - {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and - other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": + with a single connector.\",\n \"confidenceScore\": 0.46380000000000005,\n + \ \"id\": 64,\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 workspace with Surface Dock\"\n },\n {\n \"displayOrder\": @@ -99,25 +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\": 43.97,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\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: - - c8be2440-5d35-438e-9302-7438d5285739 + - af2f063d-0c1a-4be9-8022-4748b0b968f4 content-length: - - '7123' + - '7136' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Fri, 25 Jun 2021 19:41:10 GMT + - Tue, 21 Sep 2021 21:06:29 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1290' + - '1908' 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 0a59e7267dd4..ae90e71dfc59 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.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -67,7 +67,7 @@ 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\": - 100.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 5,\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 @@ -82,10 +82,10 @@ interactions: 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\": 46.59,\n \"id\": - 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": - {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and - other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": + with a single connector.\",\n \"confidenceScore\": 0.46380000000000005,\n + \ \"id\": 64,\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 workspace with Surface Dock\"\n },\n {\n \"displayOrder\": @@ -99,25 +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\": 43.97,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\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: - - 9cb8b0fb-c798-439e-b03e-54abed982534 + - 09599054-e8a3-4df2-a441-897e59381452 content-length: - - '7123' + - '7136' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Fri, 25 Jun 2021 19:41:11 GMT + - Tue, 21 Sep 2021 21:06:30 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1223' + - '493' 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 bf86e56c48e1..08f52c0c598e 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.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -68,7 +68,7 @@ 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\": - 100.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 5,\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 @@ -80,7 +80,7 @@ interactions: \ \"answerSpan\": {\n \"text\": \"**Ports and connectors**\\n\\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 \"confidenceScore\": 1.06,\n \"offset\": + USB drive, or smartphone.\",\n \"confidenceScore\": 0.0106,\n \"offset\": 0,\n \"length\": 206\n }\n },\n {\n \"questions\": [\n \"Connect monitors, accessories, and other devices\"\n ],\n \ \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou @@ -88,7 +88,7 @@ interactions: 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\": - 46.59,\n \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.46380000000000005,\n \"id\": 64,\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\": @@ -104,25 +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\": 43.97,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\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: - - 2eb92f74-cda1-4bdb-a18f-a59b4d7cdf11 + - 7d3e4c75-318d-47ac-a24f-0e6839903f5d content-length: - - '7459' + - '7474' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Fri, 25 Jun 2021 19:41:13 GMT + - Tue, 21 Sep 2021 21:06:32 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '426' + - '902' 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 a95cc66455f2..b82688010904 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,9 +13,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Charge @@ -29,19 +29,21 @@ interactions: []\n }\n }\n ]\n}" headers: apim-request-id: - - 2d116c69-e644-4b11-b005-0d4d5cd13bbc + - e03a4af6-be5a-4515-a848-981ca32279a2 content-length: - '583' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Wed, 30 Jun 2021 15:15:46 GMT + - Tue, 21 Sep 2021 21:06:33 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '223' + - '337' 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 0519019043d5..e848833ab31d 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,48 +16,50 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview 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.9292,\n \"id\": 27,\n - \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\": + 27,\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.3583,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.3069,\n \"id\": 24,\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 \"questions\": [\n \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery status appears at the right side of the taskbar. Select the battery icon for info about the charging and battery status, including the percent remaining. - \u272A\",\n \"confidenceScore\": 0.2229,\n \"id\": 26,\n \"source\": + \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\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: - - 6364fbb3-83b7-4d3d-815c-6663f41e1ae4 + - 8740053b-e4fa-4394-ba6c-28d0b064703c content-length: - - '1609' + - '1621' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Tue, 13 Jul 2021 17:24:02 GMT + - Tue, 21 Sep 2021 21:06:35 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '384' + - '395' 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 b7d2902a0989..3235745609d1 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,9 +13,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Charge @@ -29,19 +29,21 @@ interactions: []\n }\n }\n ]\n}" headers: apim-request-id: - - 236db4d3-6b6a-4a54-b4a7-a85776b45d72 + - 713fabed-16c6-4c14-858e-099bcfa4cbfc content-length: - '583' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Thu, 15 Jul 2021 22:08:29 GMT + - Tue, 21 Sep 2021 21:06:36 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1056' + - '153' 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 3b4ba3a32f81..7815ea378e3d 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.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -68,7 +68,7 @@ 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\": - 100.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 5,\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 @@ -80,7 +80,7 @@ interactions: \ \"answerSpan\": {\n \"text\": \"**Ports and connectors**\\n\\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 \"confidenceScore\": 1.06,\n \"offset\": + USB drive, or smartphone.\",\n \"confidenceScore\": 0.0106,\n \"offset\": 0,\n \"length\": 206\n }\n },\n {\n \"questions\": [\n \"Connect monitors, accessories, and other devices\"\n ],\n \ \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou @@ -88,7 +88,7 @@ interactions: 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\": - 46.59,\n \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.46380000000000005,\n \"id\": 64,\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\": @@ -96,38 +96,35 @@ interactions: workspace with Surface Dock\"\n },\n {\n \"displayOrder\": 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n - \ },\n \"answerSpan\": {\n \"text\": \"**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.\",\n \"confidenceScore\": 6.97,\n \"offset\": - 0,\n \"length\": 194\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). If your monitor doesn\u2019t - have a DisplayPort or HDMI port, use a VGA cable and the Mini DisplayPort - to VGA Adapter.\\n\\nNote: A VGA adapter or cable 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) + \ }\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). + If your monitor doesn\u2019t have a DisplayPort or HDMI port, use a VGA cable + and the Mini DisplayPort to VGA Adapter.\\n\\nNote: A VGA adapter or cable + 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\": 43.97,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\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: - - e9f17bfa-0949-4d3b-90a2-cc77348ec62a + - 0eb4c00c-dd83-45be-8d96-aba3077392c2 content-length: - - '7781' + - '7474' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Fri, 25 Jun 2021 19:41:13 GMT + - Tue, 21 Sep 2021 21:06:37 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '346' + - '342' 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 a7fcb080edda..9992a6c804fe 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,48 +16,50 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview 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.9292,\n \"id\": 27,\n - \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\": + 27,\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.3583,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.3069,\n \"id\": 24,\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 \"questions\": [\n \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery status appears at the right side of the taskbar. Select the battery icon for info about the charging and battery status, including the percent remaining. - \u272A\",\n \"confidenceScore\": 0.2229,\n \"id\": 26,\n \"source\": + \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\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: - - 967bb864-5081-4f3e-9b98-c3861626ed3f + - 5b72cd45-d5b9-492c-ad05-7172c2ae070d content-length: - - '1609' + - '1621' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Wed, 30 Jun 2021 15:36:56 GMT + - Tue, 21 Sep 2021 21:06:38 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1397' + - '365' 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 184ac4a01b84..72af1ce6d157 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,48 +16,50 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview 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.9292,\n \"id\": 27,\n - \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\": + 27,\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.3583,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.3069,\n \"id\": 24,\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 \"questions\": [\n \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery status appears at the right side of the taskbar. Select the battery icon for info about the charging and battery status, including the percent remaining. - \u272A\",\n \"confidenceScore\": 0.2229,\n \"id\": 26,\n \"source\": + \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\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: - - 7e3a11a9-79ea-41fc-8963-db475c64f5af + - 555d76da-0f60-4c4c-8a93-2f3e263ca9c0 content-length: - - '1609' + - '1621' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Wed, 30 Jun 2021 15:14:31 GMT + - Tue, 21 Sep 2021 21:06:39 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1075' + - '322' status: code: 200 message: OK @@ -79,9 +81,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Power @@ -93,7 +95,7 @@ interactions: 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.\",\n \"confidenceScore\": - 0.6545000000000001,\n \"id\": 23,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.6517000000000001,\n \"id\": 23,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"power and charging\"\n \ },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": 24,\n @@ -104,31 +106,33 @@ interactions: \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": 27,\n \"displayText\": \"Make your battery last\"\n }\n \ ]\n },\n \"answerSpan\": {\n \"text\": \"two to four - hours\",\n \"confidenceScore\": 30.86,\n \"offset\": 33,\n \"length\": - 18\n }\n },\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\": 0.31989999999999996,\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}" + hours\",\n \"confidenceScore\": 0.3086,\n \"offset\": 33,\n + \ \"length\": 18\n }\n },\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\": 0.30260000000000004,\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}" headers: apim-request-id: - - 94119467-33a8-4222-b270-0deb60b671eb + - 9ef0bd69-7736-4ed5-8c21-879df23aaa47 content-length: - - '2177' + - '2178' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 date: - - Wed, 30 Jun 2021 15:14:31 GMT + - Tue, 21 Sep 2021 21:06:41 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '867' + - '1046' 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 303f9048d446..bf7d70f91563 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 @@ -10,9 +10,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -63,7 +63,7 @@ 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\": - 100.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 5,\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 @@ -78,10 +78,10 @@ interactions: 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\": 46.59,\n \"id\": - 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": - {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and - other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": + with a single connector.\",\n \"confidenceScore\": 0.46380000000000005,\n + \ \"id\": 64,\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 workspace with Surface Dock\"\n },\n {\n \"displayOrder\": @@ -95,20 +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\": 43.97,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\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: 6ac46b21-848e-4ba3-9bee-57780f0a6f97 - content-length: '7123' + apim-request-id: ef43aa6b-709e-4d07-a1ca-c4cf33586fc6 + content-length: '7136' content-type: application/json; charset=utf-8 - date: Fri, 25 Jun 2021 19:41:14 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:43 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '267' + x-envoy-upstream-service-time: '284' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview 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 7358da834cbe..0de1a13a3c4b 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.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -63,7 +63,7 @@ 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\": - 100.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 5,\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 @@ -78,10 +78,10 @@ interactions: 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\": 46.59,\n \"id\": - 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": - {\n \"explicitlytaggedheading\": \"connect monitors, accessories, and - other devices\"\n },\n \"dialog\": {\n \"isContextOnly\": + with a single connector.\",\n \"confidenceScore\": 0.46380000000000005,\n + \ \"id\": 64,\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 workspace with Surface Dock\"\n },\n {\n \"displayOrder\": @@ -95,20 +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\": 43.97,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\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: 2cd167a8-d3e3-4d78-974e-616149e71052 - content-length: '7123' + apim-request-id: 1833a5eb-5934-4f16-abab-46148ceb44a1 + content-length: '7136' content-type: application/json; charset=utf-8 - date: Fri, 25 Jun 2021 19:41:15 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:46 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '252' + x-envoy-upstream-service-time: '276' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview 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 f7d93b4a9d2d..cc075a6d8e6f 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.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -64,7 +64,7 @@ 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\": - 100.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 5,\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 @@ -76,7 +76,7 @@ interactions: \ \"answerSpan\": {\n \"text\": \"**Ports and connectors**\\n\\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 \"confidenceScore\": 1.06,\n \"offset\": + USB drive, or smartphone.\",\n \"confidenceScore\": 0.0106,\n \"offset\": 0,\n \"length\": 206\n }\n },\n {\n \"questions\": [\n \"Connect monitors, accessories, and other devices\"\n ],\n \ \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou @@ -84,7 +84,7 @@ interactions: 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\": - 46.59,\n \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.46380000000000005,\n \"id\": 64,\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\": @@ -92,33 +92,29 @@ interactions: workspace with Surface Dock\"\n },\n {\n \"displayOrder\": 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n - \ },\n \"answerSpan\": {\n \"text\": \"**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.\",\n \"confidenceScore\": 6.97,\n \"offset\": - 0,\n \"length\": 194\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). If your monitor doesn\u2019t - have a DisplayPort or HDMI port, use a VGA cable and the Mini DisplayPort - to VGA Adapter.\\n\\nNote: A VGA adapter or cable 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) + \ }\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). + If your monitor doesn\u2019t have a DisplayPort or HDMI port, use a VGA cable + and the Mini DisplayPort to VGA Adapter.\\n\\nNote: A VGA adapter or cable + 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\": 43.97,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\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: f0f3fc36-d981-4b26-a366-e77ba518a1bb - content-length: '7781' + apim-request-id: 3dbc4527-4e20-44b3-abbe-d380ea18ef2c + content-length: '7474' content-type: application/json; charset=utf-8 - date: Fri, 25 Jun 2021 19:41:16 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:47 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '388' + x-envoy-upstream-service-time: '300' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview 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 397adfac6cea..7f4f92ee521c 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,9 +9,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Charge @@ -24,15 +24,16 @@ interactions: \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: 82923f05-3c9f-416f-9855-2fbefa6085dc + apim-request-id: 24be7932-f7a1-4019-8472-32c2551d1d6e content-length: '583' content-type: application/json; charset=utf-8 - date: Wed, 30 Jun 2021 15:15:47 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:49 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff x-envoy-upstream-service-time: '132' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview 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 b4617b51ea19..a258665e5354 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,43 +12,44 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview 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.9292,\n \"id\": 27,\n - \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\": + 27,\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.3583,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.3069,\n \"id\": 24,\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 \"questions\": [\n \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery status appears at the right side of the taskbar. Select the battery icon for info about the charging and battery status, including the percent remaining. - \u272A\",\n \"confidenceScore\": 0.2229,\n \"id\": 26,\n \"source\": + \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\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: 96655173-855c-4e32-bff0-4025625ad191 - content-length: '1609' + apim-request-id: 8aa31a73-6acd-4f7a-85c2-dcecc522ae32 + content-length: '1621' content-type: application/json; charset=utf-8 - date: Tue, 13 Jul 2021 17:24:11 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:50 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '314' + x-envoy-upstream-service-time: '328' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview 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 ecb0fec0b682..84d90331cb91 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,9 +9,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Charge @@ -24,15 +24,16 @@ interactions: \ \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": []\n }\n }\n ]\n}" headers: - apim-request-id: 527dd21e-90c2-4419-8e21-6704202b7098 + apim-request-id: c6c85372-bf1f-4f8c-98ce-8de52137882a content-length: '583' content-type: application/json; charset=utf-8 - date: Thu, 15 Jul 2021 22:08:30 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:51 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '812' + x-envoy-upstream-service-time: '139' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview 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 453c320799f8..df113eda18b8 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 @@ -11,9 +11,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Ports @@ -64,7 +64,7 @@ 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\": - 100.0,\n \"id\": 5,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 1.0,\n \"id\": 5,\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 @@ -76,7 +76,7 @@ interactions: \ \"answerSpan\": {\n \"text\": \"**Ports and connectors**\\n\\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 \"confidenceScore\": 1.06,\n \"offset\": + USB drive, or smartphone.\",\n \"confidenceScore\": 0.0106,\n \"offset\": 0,\n \"length\": 206\n }\n },\n {\n \"questions\": [\n \"Connect monitors, accessories, and other devices\"\n ],\n \ \"answer\": \"**Connect monitors, accessories, and other devices**\\n\\nYou @@ -84,7 +84,7 @@ interactions: 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\": - 46.59,\n \"id\": 64,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.46380000000000005,\n \"id\": 64,\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\": @@ -92,33 +92,29 @@ interactions: workspace with Surface Dock\"\n },\n {\n \"displayOrder\": 1,\n \"qnaId\": 66,\n \"displayText\": \"Connect or project to a monitor, screen, or other display\"\n }\n ]\n - \ },\n \"answerSpan\": {\n \"text\": \"**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.\",\n \"confidenceScore\": 6.97,\n \"offset\": - 0,\n \"length\": 194\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). If your monitor doesn\u2019t - have a DisplayPort or HDMI port, use a VGA cable and the Mini DisplayPort - to VGA Adapter.\\n\\nNote: A VGA adapter or cable 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) + \ }\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). + If your monitor doesn\u2019t have a DisplayPort or HDMI port, use a VGA cable + and the Mini DisplayPort to VGA Adapter.\\n\\nNote: A VGA adapter or cable + 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\": 43.97,\n \"id\": 68,\n + on Surface.com.\",\n \"confidenceScore\": 0.4307,\n \"id\": 68,\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: 375616dd-f630-4153-9fae-7f9790285734 - content-length: '7781' + apim-request-id: f107eb5a-8eb0-4d0c-8630-bf8a6e8ed463 + content-length: '7474' content-type: application/json; charset=utf-8 - date: Fri, 25 Jun 2021 19:41:17 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:51 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '343' + x-envoy-upstream-service-time: '325' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview 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 0f45d6180d45..1f36421fa211 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,43 +12,44 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview 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.9292,\n \"id\": 27,\n - \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\": + 27,\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.3583,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.3069,\n \"id\": 24,\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 \"questions\": [\n \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery status appears at the right side of the taskbar. Select the battery icon for info about the charging and battery status, including the percent remaining. - \u272A\",\n \"confidenceScore\": 0.2229,\n \"id\": 26,\n \"source\": + \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\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: d3136678-d454-41f9-b064-ebf1b207e82b - content-length: '1609' + apim-request-id: acaef643-3f2d-4397-aca0-2c4bcc8bb7a2 + content-length: '1621' content-type: application/json; charset=utf-8 - date: Wed, 30 Jun 2021 15:36:56 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:53 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '949' + x-envoy-upstream-service-time: '250' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview 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 f52047a64514..69a285e55600 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,45 +12,46 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview 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.9292,\n \"id\": 27,\n - \ \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \"metadata\": + on Surface.com.\",\n \"confidenceScore\": 0.9290999999999999,\n \"id\": + 27,\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.3583,\n \"id\": 24,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.3069,\n \"id\": 24,\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 \"questions\": [\n \ \"Desktop taskbar.\"\n ],\n \"answer\": \"**Desktop taskbar.**\\n\\nBattery status appears at the right side of the taskbar. Select the battery icon for info about the charging and battery status, including the percent remaining. - \u272A\",\n \"confidenceScore\": 0.2229,\n \"id\": 26,\n \"source\": + \u272A\",\n \"confidenceScore\": 0.2548,\n \"id\": 26,\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: 7cd6d31a-771e-4cdb-a6be-7a1504295914 - content-length: '1609' + apim-request-id: 5a7bbcf4-75f5-4eeb-a994-b8bcd5d2907f + content-length: '1621' content-type: application/json; charset=utf-8 - date: Wed, 30 Jun 2021 15:14:34 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:53 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '970' + x-envoy-upstream-service-time: '251' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview - request: body: '{"question": "How long it takes to charge Surface?", "top": 3, "userId": "sd53lsY=", "confidenceScoreThreshold": 0.2, "context": {"previousQnaId": 27, @@ -65,9 +66,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=test-project&deploymentName=test&api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"questions\": [\n \"Power @@ -79,7 +80,7 @@ interactions: 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.\",\n \"confidenceScore\": - 0.6545000000000001,\n \"id\": 23,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n + 0.6517000000000001,\n \"id\": 23,\n \"source\": \"surface-pro-4-user-guide-EN.pdf\",\n \ \"metadata\": {\n \"explicitlytaggedheading\": \"power and charging\"\n \ },\n \"dialog\": {\n \"isContextOnly\": false,\n \"prompts\": [\n {\n \"displayOrder\": 0,\n \"qnaId\": 24,\n @@ -90,26 +91,27 @@ interactions: \ },\n {\n \"displayOrder\": 3,\n \"qnaId\": 27,\n \"displayText\": \"Make your battery last\"\n }\n \ ]\n },\n \"answerSpan\": {\n \"text\": \"two to four - hours\",\n \"confidenceScore\": 30.86,\n \"offset\": 33,\n \"length\": - 18\n }\n },\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\": 0.31989999999999996,\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}" + hours\",\n \"confidenceScore\": 0.3086,\n \"offset\": 33,\n + \ \"length\": 18\n }\n },\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\": 0.30260000000000004,\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}" headers: - apim-request-id: db4190a2-426a-4932-8d83-dd14b10f4b37 - content-length: '2177' + apim-request-id: 33ee27bc-abd8-493e-9ffb-ac0259f68ad7 + content-length: '2178' content-type: application/json; charset=utf-8 - date: Wed, 30 Jun 2021 15:14:35 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTransaction=1 + date: Tue, 21 Sep 2021 21:06:53 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '1060' + x-envoy-upstream-service-time: '338' 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-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-knowledgebases?projectName=190a9e13-8ede-4e4b-a8fd-c4d7f2aeab6c&deploymentName=test&api-version=2021-07-15-preview 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 0b344818fda5..31912fc7ddc9 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 @@ -106,9 +106,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Battery Life Get an @@ -119,7 +119,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.01745828054845333,\n \"id\": \"doc3\",\n + \ \"confidenceScore\": 0.017458289861679077,\n \"id\": \"doc3\",\n \ \"answerSpan\": {\n \"text\": \"Battery Life\",\n \"confidenceScore\": 0.26247412,\n \"offset\": 0,\n \"length\": 12\n },\n \"offset\": 1779,\n \"length\": 555\n },\n {\n \"answer\": \"Along with @@ -127,9 +127,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 @@ -138,23 +138,25 @@ 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: - - b7473b1a-9903-42a4-897f-d095ddfc68f8 + - 8606d2ff-3166-4f3d-bc8c-b89815b47dfa content-length: - '2147' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Fri, 25 Jun 2021 19:41:18 GMT + - Tue, 21 Sep 2021 21:06:55 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '322' + - '733' 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 7d7c2b48a8e8..17cc1c469747 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.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Battery Life Get an @@ -138,23 +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.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: - - eae82c61-0d7f-4130-8c21-680060b8a75d + - 77da498d-0205-4cdb-a4ea-034ac73ea176 content-length: - - '2147' + - '2146' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Fri, 25 Jun 2021 19:41:19 GMT + - Tue, 21 Sep 2021 21:06:56 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '287' + - '474' 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 bae034dbea31..e4628e088f8f 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 @@ -21,23 +21,23 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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 @@ -48,19 +48,21 @@ interactions: 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: apim-request-id: - - 0859996e-48ab-42f9-9d67-04d21bc14fba + - 16114d30-1c1d-48e1-a023-4d4507a0d97a content-length: - '1479' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Fri, 06 Aug 2021 18:14:29 GMT + - Tue, 21 Sep 2021 21:06:57 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '1084' + - '425' 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 6d243459afcd..4679ebd184a1 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 @@ -1,14 +1,14 @@ interactions: - request: - body: '{"question": "How long it takes to charge surface?", "records": [{"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\u2019re using your - Surface for power-intensive activities like gaming or video streaming while - you\u2019re charging it.", "id": "1"}, {"text": "You can use the USB port on + body: '{"question": "How long it takes to charge surface?", "records": [{"id": + "1", "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\u2019re using + your Surface for power-intensive activities like gaming or video streaming while + you\u2019re charging it."}, {"id": "2", "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": "2"}], "language": "en"}' + port on your Surface."}], "language": "en"}' headers: Accept: - application/json @@ -21,46 +21,48 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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.9254360198974609,\n \"id\": \"1\",\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\": \"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: - - f38bdca7-e368-46b0-a09a-c469b36540bf + - 6be5c655-0bad-49d5-ba56-38ba2a890866 content-length: - '1479' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Wed, 30 Jun 2021 15:07:14 GMT + - Tue, 21 Sep 2021 21:06:57 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '315' + - '271' 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 1f40ef745ff9..60c095f1d278 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 @@ -21,23 +21,23 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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.9298818111419678,\n \"id\": \"0\",\n \"answerSpan\": + \ \"confidenceScore\": 0.9298818707466125,\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 @@ -48,19 +48,21 @@ interactions: 7\n },\n \"offset\": 110,\n \"length\": 135\n }\n ]\n}" headers: apim-request-id: - - c103d09b-72cd-489c-8d4a-e077a5526e70 + - 49bbe0b7-74a9-416e-9a82-fffdcca416fd content-length: - '1479' content-type: - application/json; charset=utf-8 + csp-billing-usage: + - CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 date: - - Fri, 06 Aug 2021 18:18:43 GMT + - Tue, 21 Sep 2021 21:06:58 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '491' + - '314' 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 7beb994811cf..15245c82e840 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 @@ -102,9 +102,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Battery Life Get an @@ -115,17 +115,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.017458289861679077,\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 @@ -137,15 +137,16 @@ interactions: 0.5914322,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": 5391,\n \"length\": 393\n }\n ]\n}" headers: - apim-request-id: f7d22644-9f95-4e63-a16c-e111f73bc24d + apim-request-id: 6509de25-150a-4b5d-852b-deec6ec8cf2c content-length: '2147' content-type: application/json; charset=utf-8 - date: Fri, 25 Jun 2021 19:41:19 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 + date: Tue, 21 Sep 2021 21:07:00 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '284' + x-envoy-upstream-service-time: '217' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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 8f3d6b71ab91..cd71362f8393 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.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Battery Life Get an @@ -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 @@ -137,15 +137,16 @@ interactions: 0.59143245,\n \"offset\": 98,\n \"length\": 13\n },\n \"offset\": 5391,\n \"length\": 393\n }\n ]\n}" headers: - apim-request-id: ba49fbf2-8c63-4ae1-b5d6-2b2ec86d8776 + apim-request-id: f3ab3c91-1bfb-4c45-a752-ca79c3e0a987 content-length: '2147' content-type: application/json; charset=utf-8 - date: Fri, 25 Jun 2021 19:41:20 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 + date: Tue, 21 Sep 2021 21:07:00 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '272' + x-envoy-upstream-service-time: '318' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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 564793648d31..15d4d99520d4 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 @@ -17,16 +17,16 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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 @@ -40,18 +40,19 @@ interactions: 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: 05642021-6f95-4a4c-a641-9dd5f3a6762f - content-length: '1479' + apim-request-id: 5f3c0c70-7d76-41fe-84fe-39b61be4f30c + content-length: '1481' content-type: application/json; charset=utf-8 - date: Fri, 06 Aug 2021 18:14:30 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 + date: Tue, 21 Sep 2021 21:07:01 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '862' + x-envoy-upstream-service-time: '210' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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 56e6e56f50d3..99885d8fbc99 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 @@ -1,14 +1,14 @@ interactions: - request: - body: '{"question": "How long it takes to charge surface?", "records": [{"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\u2019re using your - Surface for power-intensive activities like gaming or video streaming while - you\u2019re charging it.", "id": "1"}, {"text": "You can use the USB port on + body: '{"question": "How long it takes to charge surface?", "records": [{"id": + "1", "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\u2019re using + your Surface for power-intensive activities like gaming or video streaming while + you\u2019re charging it."}, {"id": "2", "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": "2"}], "language": "en"}' + port on your Surface."}], "language": "en"}' headers: Accept: - application/json @@ -17,9 +17,9 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview response: body: string: "{\n \"answers\": [\n {\n \"answer\": \"Power and charging. @@ -33,25 +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.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.055035144090652466,\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: fc0cf99e-2f1a-4cf1-8234-4d40c42eaca7 - content-length: '1478' + apim-request-id: 75d29f93-387d-42b6-92e9-d454c3b09683 + content-length: '1481' content-type: application/json; charset=utf-8 - date: Wed, 30 Jun 2021 15:07:15 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 + date: Tue, 21 Sep 2021 21:07:01 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '362' + x-envoy-upstream-service-time: '228' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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 f95eec132700..a80212f864c3 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 @@ -17,16 +17,16 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-ai-language-questionanswering/1.0.0b1 Python/3.7.4 (Windows-10-10.0.19041-SP0) + - azsdk-python-ai-language-questionanswering/1.0.0b2 Python/3.9.5 (macOS-11.5.2-x86_64-i386-64bit) method: POST - uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + uri: https://test-resource.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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 @@ -38,20 +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.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: 0b3e9e81-ead6-45fa-83ab-9c04b41a14cf - content-length: '1479' + apim-request-id: 829dce06-09a4-4da9-9118-91a11be1b3e1 + content-length: '1482' content-type: application/json; charset=utf-8 - date: Fri, 06 Aug 2021 18:18:44 GMT + csp-billing-usage: CognitiveServices.TextAnalytics.QuestionAnsweringTextRecords=1 + date: Tue, 21 Sep 2021 21:07:02 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '376' + x-envoy-upstream-service-time: '178' status: code: 200 message: OK - url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-05-01-preview + url: https://wuppe.api.cognitive.microsoft.com/language/:query-text?api-version=2021-07-15-preview 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 260340e20756..dd279adccf87 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,7 +14,7 @@ ) from azure.ai.language.questionanswering import QuestionAnsweringClient -from azure.ai.language.questionanswering._rest import * +from azure.ai.language.questionanswering.operations._operations import build_query_text_request, build_query_knowledge_base_request from azure.ai.language.questionanswering.models import ( KnowledgeBaseQueryOptions, KnowledgeBaseAnswerRequestContext, @@ -54,7 +54,7 @@ def test_query_knowledgebase_llc(self, qna_account, qna_key, qna_project): assert answer.get('source') assert answer.get('metadata') is not None assert not answer.get('answerSpan') - + assert answer.get('questions') for question in answer['questions']: assert question @@ -108,7 +108,7 @@ def test_query_knowledgebase_llc_with_answerspan(self, qna_account, qna_key, qna assert answer['answerSpan'].get('confidenceScore') assert answer['answerSpan'].get('offset') is not None assert answer['answerSpan'].get('length') - + assert answer.get('questions') for question in answer['questions']: assert question 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 32ea2bab5e7f..fda1d6cb265d 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 @@ -21,7 +21,7 @@ AnswerSpanRequest, ) from azure.ai.language.questionanswering.aio import QuestionAnsweringClient -from azure.ai.language.questionanswering._rest import * +from azure.ai.language.questionanswering.operations._operations import build_query_knowledge_base_request, build_query_text_request class QnAKnowledgeBaseTestsAsync(AsyncQuestionAnsweringTest): @@ -110,7 +110,7 @@ async def test_query_knowledgebase_llc_with_answerspan(self, qna_account, qna_ke assert answer['answerSpan'].get('confidenceScore') assert answer['answerSpan'].get('offset') is not None assert answer['answerSpan'].get('length') - + assert answer.get('questions') for question in answer['questions']: assert question @@ -332,7 +332,7 @@ async def test_query_knowledgebase_only_id(self, qna_account, qna_key, qna_proje project_name=qna_project, deployment_name='test' ) - + assert len(output.answers) == 1 @GlobalQuestionAnsweringAccountPreparer() 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 2bfc61fd58b8..db55ce2867c1 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,7 +15,7 @@ ) from azure.ai.language.questionanswering import QuestionAnsweringClient -from azure.ai.language.questionanswering._rest import * +from azure.ai.language.questionanswering.operations._operations import build_query_text_request, build_query_knowledge_base_request from azure.ai.language.questionanswering.models import ( TextQueryOptions, TextRecord 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 1eee19633ec7..a4fb8d110dfc 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,7 +15,7 @@ ) from azure.ai.language.questionanswering.aio import QuestionAnsweringClient -from azure.ai.language.questionanswering._rest import * +from azure.ai.language.questionanswering.operations._operations import build_query_text_request, build_query_knowledge_base_request from azure.ai.language.questionanswering.models import ( TextQueryOptions, TextRecord