From 461412ca3136f406c2dbd3d6d481ec80eef4043d Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 30 Sep 2021 19:32:20 -0400 Subject: [PATCH 1/3] default default_language to None --- .../language/questionanswering/_question_answering_client.py | 3 +-- .../questionanswering/aio/_question_answering_client.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) 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 0ec3d5a66199..96c7eb2e28fc 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 @@ -33,7 +33,6 @@ class QuestionAnsweringClient(QuestionAnsweringClientOperationsMixin): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential :keyword str default_language: Sets the default language to use for all operations. - Defaults to "en". """ def __init__( @@ -51,7 +50,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self._default_language = kwargs.pop("default_language", "en") + self._default_language = kwargs.pop("default_language", None) def send_request( self, 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 c9bc4a2edd2a..a506cabb9960 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 @@ -28,7 +28,6 @@ class QuestionAnsweringClient(QuestionAnsweringClientOperationsMixin): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.AzureKeyCredential :keyword str default_language: Sets the default language to use for all operations. - Defaults to "en". """ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) -> None: @@ -40,7 +39,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any) self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self._default_language = kwargs.pop("default_language", "en") + self._default_language = kwargs.pop("default_language", None) def send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. From d593d9364bba10b0cbfb15a081311f156bf1dc18 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 30 Sep 2021 19:33:50 -0400 Subject: [PATCH 2/3] add check for users specifying both qna_id and question --- .../azure/ai/language/questionanswering/_patch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py index c6d13a81ffd0..44a5cd3f4d5c 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_patch.py @@ -60,3 +60,5 @@ def _verify_qna_id_and_question(query_knowledgebase_options): raise TypeError( "You need to pass in either `qna_id` or `question`." ) + if qna_id and question: + raise TypeError("You can not specify both `qna_id` and `question`.") From 9c657ec6dee85a8a81e2c17a8016355adce4df89 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Thu, 30 Sep 2021 19:35:00 -0400 Subject: [PATCH 3/3] don't wrap lines in changelog --- .../azure-ai-language-questionanswering/CHANGELOG.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md index ec9dd35f032e..15558180c1de 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/CHANGELOG.md @@ -12,16 +12,13 @@ * The filters model `StrictFilters` is renamed to `QueryFilters` * Enum `CompoundOperationKind` is renamed to `LogicalOperationKind` * We have removed the `string_index_type` input to all models and operations. We have also removed the `StringIndexType` enum. -* The type of input `metadata` to `MetadataFilter` has changed from a dictionary of strings to a list of key-value tuples. -For example, the input has changed from `{"key": "value"}` to `[("key", "value")]`. -* The input to the `query_knowledge_base` and `query_text` overloads that take in a positional model for the body should be -considered positional only. +* The type of input `metadata` to `MetadataFilter` has changed from a dictionary of strings to a list of key-value tuples. For example, the input has changed from `{"key": "value"}` to `[("key", "value")]`. +* The input to the `query_knowledge_base` and `query_text` overloads that take in a positional model for the body should be considered positional only. ### Features Added * The method `QuestionAnsweringClient.query_text` now supports a list of records as strings, where the ID value will be automatically populated. -* Added keyword argument `default_language` onto `QuestionAnsweringClient`, which has default value `'en'`. The default language for any operation call will -be this default language value. +* Added keyword argument `default_language` onto `QuestionAnsweringClient`, which has default value `'en'`. The default language for any operation call will be this default language value. ## 1.0.0b1 (2021-07-27)