From 5364cc0b6bb7334725c7e5e2f3b9bc6ea23a5448 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Fri, 27 Mar 2026 09:40:49 -0700 Subject: [PATCH 1/3] baseline --- .../azure/search/documents/_client.py | 6 +- .../azure/search/documents/_configuration.py | 6 +- .../documents/_operations/_operations.py | 62 ++-- .../search/documents/_utils/model_base.py | 17 +- .../azure/search/documents/_validation.py | 66 ++++ .../azure/search/documents/aio/_client.py | 6 +- .../search/documents/aio/_configuration.py | 6 +- .../documents/aio/_operations/_operations.py | 33 +- .../azure/search/documents/indexes/_client.py | 12 +- .../documents/indexes/_configuration.py | 12 +- .../indexes/_operations/_operations.py | 286 ++++++++++++------ .../documents/indexes/_utils/model_base.py | 17 +- .../search/documents/indexes/aio/_client.py | 12 +- .../documents/indexes/aio/_configuration.py | 12 +- .../indexes/aio/_operations/_operations.py | 130 +++++--- .../documents/indexes/models/__init__.py | 6 + .../search/documents/indexes/models/_enums.py | 105 +++++++ .../documents/indexes/models/_models.py | 35 ++- .../documents/knowledgebases/_client.py | 6 +- .../knowledgebases/_configuration.py | 6 +- .../knowledgebases/_operations/_operations.py | 6 +- .../knowledgebases/_utils/model_base.py | 17 +- .../documents/knowledgebases/aio/_client.py | 6 +- .../knowledgebases/aio/_configuration.py | 6 +- .../aio/_operations/_operations.py | 3 +- .../azure/search/documents/models/__init__.py | 4 +- .../azure-search-documents/tests/conftest.py | 1 + 27 files changed, 648 insertions(+), 236 deletions(-) create mode 100644 sdk/search/azure-search-documents/azure/search/documents/_validation.py diff --git a/sdk/search/azure-search-documents/azure/search/documents/_client.py b/sdk/search/azure-search-documents/azure/search/documents/_client.py index f96d7ea85bb4..438b32d58cae 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_client.py @@ -26,7 +26,7 @@ class SearchClient(_SearchClientOperationsMixin): """SearchClient. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. @@ -35,8 +35,8 @@ class SearchClient(_SearchClientOperationsMixin): :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/_configuration.py index dfe36d2d3450..aa9539937c22 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_configuration.py @@ -23,7 +23,7 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. @@ -32,8 +32,8 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/_operations/_operations.py index b2a620ff97e0..a60afb0e2ffa 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_operations/_operations.py @@ -61,7 +61,8 @@ def build_search_get_document_count_request(index_name: str, **kwargs: Any) -> H _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -185,7 +186,8 @@ def build_search_search_get_request( # pylint: disable=too-many-locals,too-many _params["semanticFields"] = _SERIALIZER.query("semantic_fields", semantic_fields, "[str]", div=",") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if query_source_authorization is not None: _headers["x-ms-query-source-authorization"] = _SERIALIZER.header( "query_source_authorization", query_source_authorization, "str" @@ -222,7 +224,8 @@ def build_search_search_post_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if query_source_authorization is not None: _headers["x-ms-query-source-authorization"] = _SERIALIZER.header( "query_source_authorization", query_source_authorization, "str" @@ -265,7 +268,8 @@ def build_search_get_document_request( _params["$select"] = _SERIALIZER.query("selected_fields", selected_fields, "[str]", div=",") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if query_source_authorization is not None: _headers["x-ms-query-source-authorization"] = _SERIALIZER.header( "query_source_authorization", query_source_authorization, "str" @@ -330,7 +334,8 @@ def build_search_suggest_get_request( _params["$top"] = _SERIALIZER.query("top", top, "int") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -355,7 +360,8 @@ def build_search_suggest_post_request(index_name: str, **kwargs: Any) -> HttpReq _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -382,7 +388,8 @@ def build_search_index_request(index_name: str, **kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -394,7 +401,7 @@ def build_search_autocomplete_get_request( *, search_text: str, suggester_name: str, - autocomplete_mode: Optional[Union[str, _models1.AutocompleteMode]] = None, + autocomplete_mode: Optional[Union[str, _models1._enums.AutocompleteMode]] = None, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, @@ -440,7 +447,8 @@ def build_search_autocomplete_get_request( _params["$top"] = _SERIALIZER.query("top", top, "int") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -465,7 +473,8 @@ def build_search_autocomplete_post_request(index_name: str, **kwargs: Any) -> Ht _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -508,6 +517,7 @@ def get_document_count(self, **kwargs: Any) -> int: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -532,7 +542,7 @@ def get_document_count(self, **kwargs: Any) -> int: response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(int, response.text()) @@ -792,6 +802,7 @@ def _search_get( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -813,7 +824,7 @@ def _search_get( # pylint: disable=too-many-locals raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchDocumentsResult, response.json()) @@ -1152,6 +1163,7 @@ def _search_post( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1173,7 +1185,7 @@ def _search_post( # pylint: disable=too-many-locals raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchDocumentsResult, response.json()) @@ -1238,6 +1250,7 @@ def get_document( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1259,7 +1272,7 @@ def get_document( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.LookupDocument, response.json()) @@ -1370,6 +1383,7 @@ def _suggest_get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1391,7 +1405,7 @@ def _suggest_get( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models1._models.SuggestDocumentsResult, response.json() # pylint: disable=protected-access @@ -1552,6 +1566,7 @@ def _suggest_post( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1573,7 +1588,7 @@ def _suggest_post( # pylint: disable=too-many-locals raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models1._models.SuggestDocumentsResult, response.json() # pylint: disable=protected-access @@ -1644,6 +1659,7 @@ def _index( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1665,7 +1681,7 @@ def _index( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models1._models.IndexDocumentsResult, response.json() # pylint: disable=protected-access @@ -1682,7 +1698,7 @@ def _autocomplete_get( *, search_text: str, suggester_name: str, - autocomplete_mode: Optional[Union[str, _models1.AutocompleteMode]] = None, + autocomplete_mode: Optional[Union[str, _models1._enums.AutocompleteMode]] = None, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, @@ -1768,6 +1784,7 @@ def _autocomplete_get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1789,7 +1806,7 @@ def _autocomplete_get( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models1._models.AutocompleteResult, response.json() # pylint: disable=protected-access @@ -1807,7 +1824,7 @@ def _autocomplete_post( search_text: str, suggester_name: str, content_type: str = "application/json", - autocomplete_mode: Optional[Union[str, _models1.AutocompleteMode]] = None, + autocomplete_mode: Optional[Union[str, _models1._enums.AutocompleteMode]] = None, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, @@ -1833,7 +1850,7 @@ def _autocomplete_post( # pylint: disable=too-many-locals *, search_text: str = _Unset, suggester_name: str = _Unset, - autocomplete_mode: Optional[Union[str, _models1.AutocompleteMode]] = None, + autocomplete_mode: Optional[Union[str, _models1._enums.AutocompleteMode]] = None, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, @@ -1940,6 +1957,7 @@ def _autocomplete_post( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1961,7 +1979,7 @@ def _autocomplete_post( # pylint: disable=too-many-locals raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models1._models.AutocompleteResult, response.json() # pylint: disable=protected-access diff --git a/sdk/search/azure-search-documents/azure/search/documents/_utils/model_base.py b/sdk/search/azure-search-documents/azure/search/documents/_utils/model_base.py index c402af2afc63..7b7f8ba67b53 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_utils/model_base.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_utils/model_base.py @@ -515,6 +515,8 @@ def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: return self._data.setdefault(key, default) def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data try: other_model = self.__class__(other) except Exception: @@ -628,6 +630,9 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if len(items) > 0: existed_attr_keys.append(xml_name) dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = [] continue # text element is primitive type @@ -889,6 +894,8 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur # is it optional? try: if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True if len(annotation.__args__) <= 2: # pyright: ignore if_obj_deserializer = _get_deserialize_callable_from_annotation( next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore @@ -981,16 +988,20 @@ def _deserialize_with_callable( return float(value.text) if value.text else None if deserializer is bool: return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None if deserializer is None: return value if deserializer in [int, float, bool]: return deserializer(value) if isinstance(deserializer, CaseInsensitiveEnumMeta): try: - return deserializer(value) + return deserializer(value.text if isinstance(value, ET.Element) else value) except ValueError: # for unknown value, return raw value - return value + return value.text if isinstance(value, ET.Element) else value if isinstance(deserializer, type) and issubclass(deserializer, Model): return deserializer._deserialize(value, []) return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) @@ -1043,6 +1054,7 @@ def _failsafe_deserialize_xml( return None +# pylint: disable=too-many-instance-attributes class _RestField: def __init__( self, @@ -1062,6 +1074,7 @@ def __init__( self._is_discriminator = is_discriminator self._visibility = visibility self._is_model = False + self._is_optional = False self._default = default self._format = format self._is_multipart_file_input = is_multipart_file_input diff --git a/sdk/search/azure-search-documents/azure/search/documents/_validation.py b/sdk/search/azure-search-documents/azure/search/documents/_validation.py new file mode 100644 index 000000000000..f5af3a4eb8a2 --- /dev/null +++ b/sdk/search/azure-search-documents/azure/search/documents/_validation.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if _index_with_default(method_added_on) > _index_with_default(client_api_version): + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py index e2aa4dc24ac6..f5bf1c7ed3c2 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py @@ -26,7 +26,7 @@ class SearchClient(_SearchClientOperationsMixin): """SearchClient. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. @@ -35,8 +35,8 @@ class SearchClient(_SearchClientOperationsMixin): :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py index 5063e52eb2c9..01f7c26be476 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py @@ -23,7 +23,7 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. @@ -32,8 +32,8 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_operations.py index 276109af4530..a3cddd5a2209 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_operations.py @@ -85,6 +85,7 @@ async def get_document_count(self, **kwargs: Any) -> int: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -109,7 +110,7 @@ async def get_document_count(self, **kwargs: Any) -> int: response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(int, response.text()) @@ -369,6 +370,7 @@ async def _search_get( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -390,7 +392,7 @@ async def _search_get( # pylint: disable=too-many-locals raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchDocumentsResult, response.json()) @@ -729,6 +731,7 @@ async def _search_post( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -750,7 +753,7 @@ async def _search_post( # pylint: disable=too-many-locals raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchDocumentsResult, response.json()) @@ -815,6 +818,7 @@ async def get_document( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -836,7 +840,7 @@ async def get_document( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.LookupDocument, response.json()) @@ -947,6 +951,7 @@ async def _suggest_get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -968,7 +973,7 @@ async def _suggest_get( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models2._models.SuggestDocumentsResult, response.json() # pylint: disable=protected-access @@ -1129,6 +1134,7 @@ async def _suggest_post( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1150,7 +1156,7 @@ async def _suggest_post( # pylint: disable=too-many-locals raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models2._models.SuggestDocumentsResult, response.json() # pylint: disable=protected-access @@ -1221,6 +1227,7 @@ async def _index( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1242,7 +1249,7 @@ async def _index( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models2._models.IndexDocumentsResult, response.json() # pylint: disable=protected-access @@ -1259,7 +1266,7 @@ async def _autocomplete_get( *, search_text: str, suggester_name: str, - autocomplete_mode: Optional[Union[str, _models2.AutocompleteMode]] = None, + autocomplete_mode: Optional[Union[str, _models2._enums.AutocompleteMode]] = None, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, @@ -1345,6 +1352,7 @@ async def _autocomplete_get( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1366,7 +1374,7 @@ async def _autocomplete_get( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models2._models.AutocompleteResult, response.json() # pylint: disable=protected-access @@ -1384,7 +1392,7 @@ async def _autocomplete_post( search_text: str, suggester_name: str, content_type: str = "application/json", - autocomplete_mode: Optional[Union[str, _models2.AutocompleteMode]] = None, + autocomplete_mode: Optional[Union[str, _models2._enums.AutocompleteMode]] = None, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, @@ -1410,7 +1418,7 @@ async def _autocomplete_post( # pylint: disable=too-many-locals *, search_text: str = _Unset, suggester_name: str = _Unset, - autocomplete_mode: Optional[Union[str, _models2.AutocompleteMode]] = None, + autocomplete_mode: Optional[Union[str, _models2._enums.AutocompleteMode]] = None, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, @@ -1517,6 +1525,7 @@ async def _autocomplete_post( # pylint: disable=too-many-locals } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1538,7 +1547,7 @@ async def _autocomplete_post( # pylint: disable=too-many-locals raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models2._models.AutocompleteResult, response.json() # pylint: disable=protected-access diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py index 4a3b1a14824f..070d9fe2e86e 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py @@ -26,15 +26,15 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): """SearchIndexClient. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ @@ -105,15 +105,15 @@ def __exit__(self, *exc_details: Any) -> None: class SearchIndexerClient(_SearchIndexerClientOperationsMixin): """SearchIndexerClient. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py index ccbce6e25376..e998644f0311 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py @@ -23,15 +23,15 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ @@ -78,15 +78,15 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py index 379ceb21d9d2..b411b2c838a7 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py @@ -69,7 +69,8 @@ def build_search_index_create_or_update_synonym_map_request( # pylint: disable= _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") _headers["Prefer"] = _SERIALIZER.header("prefer", prefer, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -104,7 +105,8 @@ def build_search_index_delete_synonym_map_request( # pylint: disable=name-too-l _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -136,7 +138,8 @@ def build_search_index_get_synonym_map_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -159,7 +162,8 @@ def build_search_index_get_synonym_maps_request( # pylint: disable=name-too-lon _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -179,7 +183,8 @@ def build_search_index_create_synonym_map_request(**kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -216,7 +221,8 @@ def build_search_index_create_or_update_index_request( # pylint: disable=name-t _params["allowIndexDowntime"] = _SERIALIZER.query("allow_index_downtime", allow_index_downtime, "bool") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") _headers["Prefer"] = _SERIALIZER.header("prefer", prefer, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -251,7 +257,8 @@ def build_search_index_delete_index_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -281,7 +288,8 @@ def build_search_index_get_index_request(name: str, **kwargs: Any) -> HttpReques _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -300,7 +308,8 @@ def build_search_index_list_indexes_request(**kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -323,7 +332,8 @@ def build_search_index_list_indexes_with_selected_properties_request( # pylint: _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -343,7 +353,8 @@ def build_search_index_create_index_request(**kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -371,7 +382,8 @@ def build_search_index_get_index_statistics_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -396,7 +408,8 @@ def build_search_index_analyze_text_request(name: str, **kwargs: Any) -> HttpReq _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -426,7 +439,8 @@ def build_search_index_create_or_update_alias_request( # pylint: disable=name-t _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") _headers["Prefer"] = _SERIALIZER.header("prefer", prefer, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -461,7 +475,8 @@ def build_search_index_delete_alias_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -491,7 +506,8 @@ def build_search_index_get_alias_request(name: str, **kwargs: Any) -> HttpReques _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -510,7 +526,8 @@ def build_search_index_list_aliases_request(**kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -530,7 +547,8 @@ def build_search_index_create_alias_request(**kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -560,7 +578,8 @@ def build_search_index_create_or_update_knowledge_base_request( # pylint: disab _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") _headers["Prefer"] = _SERIALIZER.header("prefer", prefer, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -595,7 +614,8 @@ def build_search_index_delete_knowledge_base_request( # pylint: disable=name-to _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -627,7 +647,8 @@ def build_search_index_get_knowledge_base_request( # pylint: disable=name-too-l _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -646,7 +667,8 @@ def build_search_index_list_knowledge_bases_request(**kwargs: Any) -> HttpReques _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -666,7 +688,8 @@ def build_search_index_create_knowledge_base_request(**kwargs: Any) -> HttpReque _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -696,7 +719,8 @@ def build_search_index_create_or_update_knowledge_source_request( # pylint: dis _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") _headers["Prefer"] = _SERIALIZER.header("prefer", prefer, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -731,7 +755,8 @@ def build_search_index_delete_knowledge_source_request( # pylint: disable=name- _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -763,7 +788,8 @@ def build_search_index_get_knowledge_source_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -782,7 +808,8 @@ def build_search_index_list_knowledge_sources_request(**kwargs: Any) -> HttpRequ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -802,7 +829,8 @@ def build_search_index_create_knowledge_source_request(**kwargs: Any) -> HttpReq _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -830,7 +858,8 @@ def build_search_index_get_knowledge_source_status_request( # pylint: disable=n _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -849,7 +878,8 @@ def build_search_index_get_service_statistics_request(**kwargs: Any) -> HttpRequ _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -868,7 +898,8 @@ def build_search_index_list_index_stats_summary_request(**kwargs: Any) -> HttpRe _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -905,7 +936,8 @@ def build_search_indexer_create_or_update_data_source_connection_request( # pyl ) # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") _headers["Prefer"] = _SERIALIZER.header("prefer", prefer, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -940,7 +972,8 @@ def build_search_indexer_delete_data_source_connection_request( # pylint: disab _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -972,7 +1005,8 @@ def build_search_indexer_get_data_source_connection_request( # pylint: disable= _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -995,7 +1029,8 @@ def build_search_indexer_get_data_source_connections_request( # pylint: disable _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -1017,7 +1052,8 @@ def build_search_indexer_create_data_source_connection_request( # pylint: disab _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -1045,7 +1081,8 @@ def build_search_indexer_reset_indexer_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -1070,7 +1107,8 @@ def build_search_indexer_resync_request(name: str, **kwargs: Any) -> HttpRequest _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -1101,7 +1139,8 @@ def build_search_indexer_reset_documents_request( # pylint: disable=name-too-lo _params["overwrite"] = _SERIALIZER.query("overwrite", overwrite, "bool") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -1127,7 +1166,8 @@ def build_search_indexer_run_indexer_request(name: str, **kwargs: Any) -> HttpRe _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -1169,7 +1209,8 @@ def build_search_indexer_create_or_update_indexer_request( # pylint: disable=na ) # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") _headers["Prefer"] = _SERIALIZER.header("prefer", prefer, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -1204,7 +1245,8 @@ def build_search_indexer_delete_indexer_request( # pylint: disable=name-too-lon _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -1234,7 +1276,8 @@ def build_search_indexer_get_indexer_request(name: str, **kwargs: Any) -> HttpRe _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -1257,7 +1300,8 @@ def build_search_indexer_get_indexers_request( # pylint: disable=name-too-long _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -1277,7 +1321,8 @@ def build_search_indexer_create_indexer_request(**kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -1305,7 +1350,8 @@ def build_search_indexer_get_indexer_status_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -1347,7 +1393,8 @@ def build_search_indexer_create_or_update_skillset_request( # pylint: disable=n ) # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") _headers["Prefer"] = _SERIALIZER.header("prefer", prefer, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -1382,7 +1429,8 @@ def build_search_indexer_delete_skillset_request( # pylint: disable=name-too-lo _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if_match = prep_if_match(etag, match_condition) if if_match is not None: _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") @@ -1412,7 +1460,8 @@ def build_search_indexer_get_skillset_request(name: str, **kwargs: Any) -> HttpR _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -1435,7 +1484,8 @@ def build_search_indexer_get_skillsets_request( # pylint: disable=name-too-long _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -1455,7 +1505,8 @@ def build_search_indexer_create_skillset_request(**kwargs: Any) -> HttpRequest: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -1482,7 +1533,8 @@ def build_search_indexer_reset_skills_request(name: str, **kwargs: Any) -> HttpR _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -1597,6 +1649,7 @@ def _create_or_update_synonym_map( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1618,7 +1671,7 @@ def _create_or_update_synonym_map( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SynonymMap, response.json()) @@ -1728,6 +1781,7 @@ def get_synonym_map(self, name: str, **kwargs: Any) -> _models1.SynonymMap: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1749,7 +1803,7 @@ def get_synonym_map(self, name: str, **kwargs: Any) -> _models1.SynonymMap: raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SynonymMap, response.json()) @@ -1796,6 +1850,7 @@ def _get_synonym_maps( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1817,7 +1872,7 @@ def _get_synonym_maps( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models1._models.ListSynonymMapsResult, response.json() # pylint: disable=protected-access @@ -1922,6 +1977,7 @@ def create_synonym_map( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1943,7 +1999,7 @@ def create_synonym_map( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SynonymMap, response.json()) @@ -2067,6 +2123,7 @@ def _create_or_update_index( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2088,7 +2145,7 @@ def _create_or_update_index( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndex, response.json()) @@ -2200,6 +2257,7 @@ def get_index(self, name: str, **kwargs: Any) -> _models1.SearchIndex: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2221,7 +2279,7 @@ def get_index(self, name: str, **kwargs: Any) -> _models1.SearchIndex: raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndex, response.json()) @@ -2290,7 +2348,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models1.SearchIndex], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models1.SearchIndex], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) @@ -2383,9 +2444,11 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - # pylint: disable=protected-access deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models1._models.SearchIndexResponse], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models1._models.SearchIndexResponse], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) @@ -2503,6 +2566,7 @@ def create_index(self, index: Union[_models1.SearchIndex, JSON, IO[bytes]], **kw } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2524,7 +2588,7 @@ def create_index(self, index: Union[_models1.SearchIndex, JSON, IO[bytes]], **kw raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndex, response.json()) @@ -2568,6 +2632,7 @@ def _get_index_statistics(self, name: str, **kwargs: Any) -> _models1.GetIndexSt } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2589,7 +2654,7 @@ def _get_index_statistics(self, name: str, **kwargs: Any) -> _models1.GetIndexSt raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.GetIndexStatisticsResult, response.json()) @@ -2660,6 +2725,7 @@ def _analyze_text( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2681,7 +2747,7 @@ def _analyze_text( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.AnalyzeResult, response.json()) @@ -2794,6 +2860,7 @@ def _create_or_update_alias( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2815,7 +2882,7 @@ def _create_or_update_alias( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchAlias, response.json()) @@ -2926,6 +2993,7 @@ def get_alias(self, name: str, **kwargs: Any) -> _models1.SearchAlias: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2947,7 +3015,7 @@ def get_alias(self, name: str, **kwargs: Any) -> _models1.SearchAlias: raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchAlias, response.json()) @@ -3016,7 +3084,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models1.SearchAlias], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models1.SearchAlias], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) @@ -3134,6 +3205,7 @@ def create_alias(self, alias: Union[_models1.SearchAlias, JSON, IO[bytes]], **kw } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3155,7 +3227,7 @@ def create_alias(self, alias: Union[_models1.SearchAlias, JSON, IO[bytes]], **kw raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchAlias, response.json()) @@ -3268,6 +3340,7 @@ def _create_or_update_knowledge_base( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3289,7 +3362,7 @@ def _create_or_update_knowledge_base( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.KnowledgeBase, response.json()) @@ -3399,6 +3472,7 @@ def get_knowledge_base(self, name: str, **kwargs: Any) -> _models1.KnowledgeBase } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3420,7 +3494,7 @@ def get_knowledge_base(self, name: str, **kwargs: Any) -> _models1.KnowledgeBase raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.KnowledgeBase, response.json()) @@ -3489,7 +3563,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models1.KnowledgeBase], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models1.KnowledgeBase], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) @@ -3609,6 +3686,7 @@ def create_knowledge_base( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3630,7 +3708,7 @@ def create_knowledge_base( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.KnowledgeBase, response.json()) @@ -3744,6 +3822,7 @@ def _create_or_update_knowledge_source( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3765,7 +3844,7 @@ def _create_or_update_knowledge_source( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.KnowledgeSource, response.json()) @@ -3875,6 +3954,7 @@ def get_knowledge_source(self, name: str, **kwargs: Any) -> _models1.KnowledgeSo } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3896,7 +3976,7 @@ def get_knowledge_source(self, name: str, **kwargs: Any) -> _models1.KnowledgeSo raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.KnowledgeSource, response.json()) @@ -3965,7 +4045,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models1.KnowledgeSource], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models1.KnowledgeSource], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) @@ -4086,6 +4169,7 @@ def create_knowledge_source( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4107,7 +4191,7 @@ def create_knowledge_source( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.KnowledgeSource, response.json()) @@ -4150,6 +4234,7 @@ def get_knowledge_source_status(self, name: str, **kwargs: Any) -> _knowledgebas } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4171,7 +4256,7 @@ def get_knowledge_source_status(self, name: str, **kwargs: Any) -> _knowledgebas raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_knowledgebases_models3.KnowledgeSourceStatus, response.json()) @@ -4211,6 +4296,7 @@ def get_service_statistics(self, **kwargs: Any) -> _models1.SearchServiceStatist } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4232,7 +4318,7 @@ def get_service_statistics(self, **kwargs: Any) -> _models1.SearchServiceStatist raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchServiceStatistics, response.json()) @@ -4302,7 +4388,10 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models1.IndexStatisticsSummary], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models1.IndexStatisticsSummary], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) @@ -4447,6 +4536,7 @@ def _create_or_update_data_source_connection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4468,7 +4558,7 @@ def _create_or_update_data_source_connection( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexerDataSourceConnection, response.json()) @@ -4579,6 +4669,7 @@ def get_data_source_connection(self, name: str, **kwargs: Any) -> _models1.Searc } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4600,7 +4691,7 @@ def get_data_source_connection(self, name: str, **kwargs: Any) -> _models1.Searc raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexerDataSourceConnection, response.json()) @@ -4647,6 +4738,7 @@ def _get_data_source_connections( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4668,7 +4760,7 @@ def _get_data_source_connections( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models1._models.ListDataSourcesResult, response.json() # pylint: disable=protected-access @@ -4783,6 +4875,7 @@ def create_data_source_connection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4804,7 +4897,7 @@ def create_data_source_connection( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexerDataSourceConnection, response.json()) @@ -5237,6 +5330,7 @@ def _create_or_update_indexer( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5258,7 +5352,7 @@ def _create_or_update_indexer( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexer, response.json()) @@ -5368,6 +5462,7 @@ def get_indexer(self, name: str, **kwargs: Any) -> _models1.SearchIndexer: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5389,7 +5484,7 @@ def get_indexer(self, name: str, **kwargs: Any) -> _models1.SearchIndexer: raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexer, response.json()) @@ -5436,6 +5531,7 @@ def _get_indexers( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5457,7 +5553,7 @@ def _get_indexers( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models1._models.ListIndexersResult, response.json() # pylint: disable=protected-access @@ -5562,6 +5658,7 @@ def create_indexer( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5583,7 +5680,7 @@ def create_indexer( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexer, response.json()) @@ -5626,6 +5723,7 @@ def get_indexer_status(self, name: str, **kwargs: Any) -> _models1.SearchIndexer } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5647,7 +5745,7 @@ def get_indexer_status(self, name: str, **kwargs: Any) -> _models1.SearchIndexer raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexerStatus, response.json()) @@ -5777,6 +5875,7 @@ def _create_or_update_skillset( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5798,7 +5897,7 @@ def _create_or_update_skillset( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexerSkillset, response.json()) @@ -5908,6 +6007,7 @@ def get_skillset(self, name: str, **kwargs: Any) -> _models1.SearchIndexerSkills } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5929,7 +6029,7 @@ def get_skillset(self, name: str, **kwargs: Any) -> _models1.SearchIndexerSkills raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexerSkillset, response.json()) @@ -5976,6 +6076,7 @@ def _get_skillsets( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -5997,7 +6098,7 @@ def _get_skillsets( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models1._models.ListSkillsetsResult, response.json() # pylint: disable=protected-access @@ -6106,6 +6207,7 @@ def create_skillset( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -6127,7 +6229,7 @@ def create_skillset( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.SearchIndexerSkillset, response.json()) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/model_base.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/model_base.py index c402af2afc63..7b7f8ba67b53 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/model_base.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/model_base.py @@ -515,6 +515,8 @@ def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: return self._data.setdefault(key, default) def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data try: other_model = self.__class__(other) except Exception: @@ -628,6 +630,9 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if len(items) > 0: existed_attr_keys.append(xml_name) dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = [] continue # text element is primitive type @@ -889,6 +894,8 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur # is it optional? try: if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True if len(annotation.__args__) <= 2: # pyright: ignore if_obj_deserializer = _get_deserialize_callable_from_annotation( next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore @@ -981,16 +988,20 @@ def _deserialize_with_callable( return float(value.text) if value.text else None if deserializer is bool: return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None if deserializer is None: return value if deserializer in [int, float, bool]: return deserializer(value) if isinstance(deserializer, CaseInsensitiveEnumMeta): try: - return deserializer(value) + return deserializer(value.text if isinstance(value, ET.Element) else value) except ValueError: # for unknown value, return raw value - return value + return value.text if isinstance(value, ET.Element) else value if isinstance(deserializer, type) and issubclass(deserializer, Model): return deserializer._deserialize(value, []) return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) @@ -1043,6 +1054,7 @@ def _failsafe_deserialize_xml( return None +# pylint: disable=too-many-instance-attributes class _RestField: def __init__( self, @@ -1062,6 +1074,7 @@ def __init__( self._is_discriminator = is_discriminator self._visibility = visibility self._is_model = False + self._is_optional = False self._default = default self._format = format self._is_multipart_file_input = is_multipart_file_input diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py index abfade0135cc..04eca72b9818 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py @@ -26,15 +26,15 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): """SearchIndexClient. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ @@ -109,15 +109,15 @@ async def __aexit__(self, *exc_details: Any) -> None: class SearchIndexerClient(_SearchIndexerClientOperationsMixin): """SearchIndexerClient. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py index ecf97247abc0..8a4bd8ddec24 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py @@ -23,15 +23,15 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ @@ -80,15 +80,15 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py index fe204de37c42..7e6b5ae9c581 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py @@ -205,6 +205,7 @@ async def _create_or_update_synonym_map( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -226,7 +227,7 @@ async def _create_or_update_synonym_map( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SynonymMap, response.json()) @@ -336,6 +337,7 @@ async def get_synonym_map(self, name: str, **kwargs: Any) -> _models2.SynonymMap } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -357,7 +359,7 @@ async def get_synonym_map(self, name: str, **kwargs: Any) -> _models2.SynonymMap raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SynonymMap, response.json()) @@ -404,6 +406,7 @@ async def _get_synonym_maps( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -425,7 +428,7 @@ async def _get_synonym_maps( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models2._models.ListSynonymMapsResult, response.json() # pylint: disable=protected-access @@ -530,6 +533,7 @@ async def create_synonym_map( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -551,7 +555,7 @@ async def create_synonym_map( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SynonymMap, response.json()) @@ -675,6 +679,7 @@ async def _create_or_update_index( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -696,7 +701,7 @@ async def _create_or_update_index( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndex, response.json()) @@ -808,6 +813,7 @@ async def get_index(self, name: str, **kwargs: Any) -> _models2.SearchIndex: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -829,7 +835,7 @@ async def get_index(self, name: str, **kwargs: Any) -> _models2.SearchIndex: raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndex, response.json()) @@ -899,7 +905,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2.SearchIndex], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models2.SearchIndex], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) @@ -992,9 +1001,11 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - # pylint: disable=protected-access deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2._models.SearchIndexResponse], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models2._models.SearchIndexResponse], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) @@ -1114,6 +1125,7 @@ async def create_index( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1135,7 +1147,7 @@ async def create_index( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndex, response.json()) @@ -1179,6 +1191,7 @@ async def _get_index_statistics(self, name: str, **kwargs: Any) -> _models2.GetI } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1200,7 +1213,7 @@ async def _get_index_statistics(self, name: str, **kwargs: Any) -> _models2.GetI raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.GetIndexStatisticsResult, response.json()) @@ -1271,6 +1284,7 @@ async def _analyze_text( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1292,7 +1306,7 @@ async def _analyze_text( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.AnalyzeResult, response.json()) @@ -1405,6 +1419,7 @@ async def _create_or_update_alias( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1426,7 +1441,7 @@ async def _create_or_update_alias( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchAlias, response.json()) @@ -1537,6 +1552,7 @@ async def get_alias(self, name: str, **kwargs: Any) -> _models2.SearchAlias: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1558,7 +1574,7 @@ async def get_alias(self, name: str, **kwargs: Any) -> _models2.SearchAlias: raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchAlias, response.json()) @@ -1628,7 +1644,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2.SearchAlias], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models2.SearchAlias], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) @@ -1748,6 +1767,7 @@ async def create_alias( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1769,7 +1789,7 @@ async def create_alias( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchAlias, response.json()) @@ -1882,6 +1902,7 @@ async def _create_or_update_knowledge_base( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -1903,7 +1924,7 @@ async def _create_or_update_knowledge_base( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.KnowledgeBase, response.json()) @@ -2013,6 +2034,7 @@ async def get_knowledge_base(self, name: str, **kwargs: Any) -> _models2.Knowled } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2034,7 +2056,7 @@ async def get_knowledge_base(self, name: str, **kwargs: Any) -> _models2.Knowled raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.KnowledgeBase, response.json()) @@ -2104,7 +2126,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2.KnowledgeBase], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models2.KnowledgeBase], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) @@ -2224,6 +2249,7 @@ async def create_knowledge_base( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2245,7 +2271,7 @@ async def create_knowledge_base( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.KnowledgeBase, response.json()) @@ -2359,6 +2385,7 @@ async def _create_or_update_knowledge_source( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2380,7 +2407,7 @@ async def _create_or_update_knowledge_source( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.KnowledgeSource, response.json()) @@ -2490,6 +2517,7 @@ async def get_knowledge_source(self, name: str, **kwargs: Any) -> _models2.Knowl } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2511,7 +2539,7 @@ async def get_knowledge_source(self, name: str, **kwargs: Any) -> _models2.Knowl raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.KnowledgeSource, response.json()) @@ -2581,7 +2609,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2.KnowledgeSource], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models2.KnowledgeSource], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) @@ -2702,6 +2733,7 @@ async def create_knowledge_source( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2723,7 +2755,7 @@ async def create_knowledge_source( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.KnowledgeSource, response.json()) @@ -2768,6 +2800,7 @@ async def get_knowledge_source_status( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2789,7 +2822,7 @@ async def get_knowledge_source_status( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_knowledgebases_models4.KnowledgeSourceStatus, response.json()) @@ -2829,6 +2862,7 @@ async def get_service_statistics(self, **kwargs: Any) -> _models2.SearchServiceS } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -2850,7 +2884,7 @@ async def get_service_statistics(self, **kwargs: Any) -> _models2.SearchServiceS raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchServiceStatistics, response.json()) @@ -2920,7 +2954,10 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(list[_models2.IndexStatisticsSummary], deserialized.get("value", [])) + list_of_elem = _deserialize( + list[_models2.IndexStatisticsSummary], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) @@ -3065,6 +3102,7 @@ async def _create_or_update_data_source_connection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3086,7 +3124,7 @@ async def _create_or_update_data_source_connection( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexerDataSourceConnection, response.json()) @@ -3197,6 +3235,7 @@ async def get_data_source_connection(self, name: str, **kwargs: Any) -> _models2 } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3218,7 +3257,7 @@ async def get_data_source_connection(self, name: str, **kwargs: Any) -> _models2 raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexerDataSourceConnection, response.json()) @@ -3265,6 +3304,7 @@ async def _get_data_source_connections( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3286,7 +3326,7 @@ async def _get_data_source_connections( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models2._models.ListDataSourcesResult, response.json() # pylint: disable=protected-access @@ -3401,6 +3441,7 @@ async def create_data_source_connection( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3422,7 +3463,7 @@ async def create_data_source_connection( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexerDataSourceConnection, response.json()) @@ -3855,6 +3896,7 @@ async def _create_or_update_indexer( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -3876,7 +3918,7 @@ async def _create_or_update_indexer( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexer, response.json()) @@ -3986,6 +4028,7 @@ async def get_indexer(self, name: str, **kwargs: Any) -> _models2.SearchIndexer: } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4007,7 +4050,7 @@ async def get_indexer(self, name: str, **kwargs: Any) -> _models2.SearchIndexer: raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexer, response.json()) @@ -4054,6 +4097,7 @@ async def _get_indexers( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4075,7 +4119,7 @@ async def _get_indexers( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models2._models.ListIndexersResult, response.json() # pylint: disable=protected-access @@ -4180,6 +4224,7 @@ async def create_indexer( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4201,7 +4246,7 @@ async def create_indexer( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexer, response.json()) @@ -4244,6 +4289,7 @@ async def get_indexer_status(self, name: str, **kwargs: Any) -> _models2.SearchI } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4265,7 +4311,7 @@ async def get_indexer_status(self, name: str, **kwargs: Any) -> _models2.SearchI raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexerStatus, response.json()) @@ -4395,6 +4441,7 @@ async def _create_or_update_skillset( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4416,7 +4463,7 @@ async def _create_or_update_skillset( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexerSkillset, response.json()) @@ -4526,6 +4573,7 @@ async def get_skillset(self, name: str, **kwargs: Any) -> _models2.SearchIndexer } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4547,7 +4595,7 @@ async def get_skillset(self, name: str, **kwargs: Any) -> _models2.SearchIndexer raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexerSkillset, response.json()) @@ -4594,6 +4642,7 @@ async def _get_skillsets( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4615,7 +4664,7 @@ async def _get_skillsets( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize( _models2._models.ListSkillsetsResult, response.json() # pylint: disable=protected-access @@ -4724,6 +4773,7 @@ async def create_skillset( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -4745,7 +4795,7 @@ async def create_skillset( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.SearchIndexerSkillset, response.json()) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py index bebb2d41130c..c5ebdd7abfcc 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py @@ -244,6 +244,8 @@ DocumentIntelligenceLayoutSkillOutputFormat, DocumentIntelligenceLayoutSkillOutputMode, EdgeNGramTokenFilterSide, + EntityCategory, + EntityRecognitionSkillLanguage, ImageAnalysisSkillLanguage, ImageDetail, IndexProjectionMode, @@ -280,6 +282,7 @@ SearchFieldDataType, SearchIndexPermissionFilterOption, SearchIndexerDataSourceType, + SentimentSkillLanguage, SnowballTokenFilterLanguage, SplitSkillEncoderModelName, SplitSkillLanguage, @@ -531,6 +534,8 @@ "DocumentIntelligenceLayoutSkillOutputFormat", "DocumentIntelligenceLayoutSkillOutputMode", "EdgeNGramTokenFilterSide", + "EntityCategory", + "EntityRecognitionSkillLanguage", "ImageAnalysisSkillLanguage", "ImageDetail", "IndexProjectionMode", @@ -567,6 +572,7 @@ "SearchFieldDataType", "SearchIndexPermissionFilterOption", "SearchIndexerDataSourceType", + "SentimentSkillLanguage", "SnowballTokenFilterLanguage", "SplitSkillEncoderModelName", "SplitSkillLanguage", diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_enums.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_enums.py index 21854d91bec5..7dfd795db096 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_enums.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_enums.py @@ -281,6 +281,76 @@ class EdgeNGramTokenFilterSide(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies that the n-gram should be generated from the back of the input.""" +class EntityCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A string indicating what entity categories to return.""" + + LOCATION = "location" + """Entities describing a physical location.""" + ORGANIZATION = "organization" + """Entities describing an organization.""" + PERSON = "person" + """Entities describing a person.""" + QUANTITY = "quantity" + """Entities describing a quantity.""" + DATETIME = "datetime" + """Entities describing a date and time.""" + URL = "url" + """Entities describing a URL.""" + EMAIL = "email" + """Entities describing an email address.""" + + +class EntityRecognitionSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The language codes supported for input text by EntityRecognitionSkill.""" + + AR = "ar" + """Arabic.""" + CS = "cs" + """Czech.""" + ZH_HANS = "zh-Hans" + """Chinese-Simplified.""" + ZH_HANT = "zh-Hant" + """Chinese-Traditional.""" + DA = "da" + """Danish.""" + NL = "nl" + """Dutch.""" + EN = "en" + """English.""" + FI = "fi" + """Finnish.""" + FR = "fr" + """French.""" + DE = "de" + """German.""" + EL = "el" + """Greek.""" + HU = "hu" + """Hungarian.""" + IT = "it" + """Italian.""" + JA = "ja" + """Japanese.""" + KO = "ko" + """Korean.""" + NO = "no" + """Norwegian (Bokmaal).""" + PL = "pl" + """Polish.""" + PT_PT = "pt-PT" + """Portuguese (Portugal).""" + PT_BR = "pt-BR" + """Portuguese (Brazil).""" + RU = "ru" + """Russian.""" + ES = "es" + """Spanish.""" + SV = "sv" + """Swedish.""" + TR = "tr" + """Turkish.""" + + class ImageAnalysisSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The language codes supported for input by ImageAnalysisSkill.""" @@ -1638,6 +1708,41 @@ class SearchIndexPermissionFilterOption(str, Enum, metaclass=CaseInsensitiveEnum """disabled.""" +class SentimentSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The language codes supported for input text by SentimentSkill.""" + + DA = "da" + """Danish.""" + NL = "nl" + """Dutch.""" + EN = "en" + """English.""" + FI = "fi" + """Finnish.""" + FR = "fr" + """French.""" + DE = "de" + """German.""" + EL = "el" + """Greek.""" + IT = "it" + """Italian.""" + NO = "no" + """Norwegian (Bokmaal).""" + PL = "pl" + """Polish.""" + PT_PT = "pt-PT" + """Portuguese (Portugal).""" + RU = "ru" + """Russian.""" + ES = "es" + """Spanish.""" + SV = "sv" + """Swedish.""" + TR = "tr" + """Turkish.""" + + class SnowballTokenFilterLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The language to use for a Snowball token filter.""" diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py index bcfd8a516667..147939be2b89 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py @@ -3870,9 +3870,12 @@ class EntityRecognitionSkillV3(SearchIndexerSkill, discriminator="#Microsoft.Ski be consumed as an input by another skill. Required. :vartype outputs: list[~azure.search.documents.indexes.models.OutputFieldMappingEntry] :ivar categories: A list of entity categories that should be extracted. - :vartype categories: list[str] + :vartype categories: list[str or ~azure.search.documents.indexes.models.EntityCategory] :ivar default_language_code: A value indicating which language code to use. Default is ``en``. - :vartype default_language_code: str + Known values are: "ar", "cs", "zh-Hans", "zh-Hant", "da", "nl", "en", "fi", "fr", "de", "el", + "hu", "it", "ja", "ko", "no", "pl", "pt-PT", "pt-BR", "ru", "es", "sv", and "tr". + :vartype default_language_code: str or + ~azure.search.documents.indexes.models.EntityRecognitionSkillLanguage :ivar minimum_precision: A value between 0 and 1 that be used to only include entities whose confidence score is greater than the value specified. If not set (default), or if explicitly set to null, all entities will be included. @@ -3886,12 +3889,17 @@ class EntityRecognitionSkillV3(SearchIndexerSkill, discriminator="#Microsoft.Ski :vartype odata_type: str """ - categories: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + categories: Optional[list[Union[str, "_models.EntityCategory"]]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """A list of entity categories that should be extracted.""" - default_language_code: Optional[str] = rest_field( + default_language_code: Optional[Union[str, "_models.EntityRecognitionSkillLanguage"]] = rest_field( name="defaultLanguageCode", visibility=["read", "create", "update", "delete", "query"] ) - """A value indicating which language code to use. Default is ``en``.""" + """A value indicating which language code to use. Default is ``en``. Known values are: \"ar\", + \"cs\", \"zh-Hans\", \"zh-Hant\", \"da\", \"nl\", \"en\", \"fi\", \"fr\", \"de\", \"el\", + \"hu\", \"it\", \"ja\", \"ko\", \"no\", \"pl\", \"pt-PT\", \"pt-BR\", \"ru\", \"es\", \"sv\", + and \"tr\".""" minimum_precision: Optional[float] = rest_field( name="minimumPrecision", visibility=["read", "create", "update", "delete", "query"] ) @@ -3917,8 +3925,8 @@ def __init__( name: Optional[str] = None, description: Optional[str] = None, context: Optional[str] = None, - categories: Optional[list[str]] = None, - default_language_code: Optional[str] = None, + categories: Optional[list[Union[str, "_models.EntityCategory"]]] = None, + default_language_code: Optional[Union[str, "_models.EntityRecognitionSkillLanguage"]] = None, minimum_precision: Optional[float] = None, model_version: Optional[str] = None, ) -> None: ... @@ -10331,7 +10339,10 @@ class SentimentSkillV3(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text be consumed as an input by another skill. Required. :vartype outputs: list[~azure.search.documents.indexes.models.OutputFieldMappingEntry] :ivar default_language_code: A value indicating which language code to use. Default is ``en``. - :vartype default_language_code: str + Known values are: "da", "nl", "en", "fi", "fr", "de", "el", "it", "no", "pl", "pt-PT", "ru", + "es", "sv", and "tr". + :vartype default_language_code: str or + ~azure.search.documents.indexes.models.SentimentSkillLanguage :ivar include_opinion_mining: If set to true, the skill output will include information from Text Analytics for opinion mining, namely targets (nouns or verbs) and their associated assessment (adjective) in the text. Default is false. @@ -10345,10 +10356,12 @@ class SentimentSkillV3(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text :vartype odata_type: str """ - default_language_code: Optional[str] = rest_field( + default_language_code: Optional[Union[str, "_models.SentimentSkillLanguage"]] = rest_field( name="defaultLanguageCode", visibility=["read", "create", "update", "delete", "query"] ) - """A value indicating which language code to use. Default is ``en``.""" + """A value indicating which language code to use. Default is ``en``. Known values are: \"da\", + \"nl\", \"en\", \"fi\", \"fr\", \"de\", \"el\", \"it\", \"no\", \"pl\", \"pt-PT\", \"ru\", + \"es\", \"sv\", and \"tr\".""" include_opinion_mining: Optional[bool] = rest_field( name="includeOpinionMining", visibility=["read", "create", "update", "delete", "query"] ) @@ -10374,7 +10387,7 @@ def __init__( name: Optional[str] = None, description: Optional[str] = None, context: Optional[str] = None, - default_language_code: Optional[str] = None, + default_language_code: Optional[Union[str, "_models.SentimentSkillLanguage"]] = None, include_opinion_mining: Optional[bool] = None, model_version: Optional[str] = None, ) -> None: ... diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py index dc6edd562aa6..420c42561463 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py @@ -26,15 +26,15 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin): """KnowledgeBaseRetrievalClient. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py index f7ab40eddeb8..3daf7d8bf593 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py @@ -23,15 +23,15 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_operations.py index a583552685b7..691d2c5f4716 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_operations.py @@ -63,7 +63,8 @@ def build_knowledge_base_retrieval_retrieve_request( # pylint: disable=name-too _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") if query_source_authorization is not None: _headers["x-ms-query-source-authorization"] = _SERIALIZER.header( "query_source_authorization", query_source_authorization, "str" @@ -228,6 +229,7 @@ def retrieve( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -249,7 +251,7 @@ def retrieve( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models1.KnowledgeBaseRetrievalResponse, response.json()) diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/model_base.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/model_base.py index c402af2afc63..7b7f8ba67b53 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/model_base.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/model_base.py @@ -515,6 +515,8 @@ def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: return self._data.setdefault(key, default) def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data try: other_model = self.__class__(other) except Exception: @@ -628,6 +630,9 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if len(items) > 0: existed_attr_keys.append(xml_name) dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = [] continue # text element is primitive type @@ -889,6 +894,8 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur # is it optional? try: if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True if len(annotation.__args__) <= 2: # pyright: ignore if_obj_deserializer = _get_deserialize_callable_from_annotation( next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore @@ -981,16 +988,20 @@ def _deserialize_with_callable( return float(value.text) if value.text else None if deserializer is bool: return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None if deserializer is None: return value if deserializer in [int, float, bool]: return deserializer(value) if isinstance(deserializer, CaseInsensitiveEnumMeta): try: - return deserializer(value) + return deserializer(value.text if isinstance(value, ET.Element) else value) except ValueError: # for unknown value, return raw value - return value + return value.text if isinstance(value, ET.Element) else value if isinstance(deserializer, type) and issubclass(deserializer, Model): return deserializer._deserialize(value, []) return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) @@ -1043,6 +1054,7 @@ def _failsafe_deserialize_xml( return None +# pylint: disable=too-many-instance-attributes class _RestField: def __init__( self, @@ -1062,6 +1074,7 @@ def __init__( self._is_discriminator = is_discriminator self._visibility = visibility self._is_model = False + self._is_optional = False self._default = default self._format = format self._is_multipart_file_input = is_multipart_file_input diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py index 3e7834244a6a..bc1d25302652 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py @@ -26,15 +26,15 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin): """KnowledgeBaseRetrievalClient. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py index 81dada9e9ccb..671eedc81fbd 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py @@ -23,15 +23,15 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: Service host. Required. + :param endpoint: The endpoint URL of the search service. Required. :type endpoint: str :param credential: Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required. :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview" and None. Default value is "2025-11-01-preview". Note that overriding this - default value may result in unsupported behavior. + "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_operations/_operations.py index 4ebadf1ddfc9..ade4b66a5598 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_operations/_operations.py @@ -193,6 +193,7 @@ async def retrieve( } _request.url = self._client.format_url(_request.url, **path_format_arguments) + _decompress = kwargs.pop("decompress", True) _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access _request, stream=_stream, **kwargs @@ -214,7 +215,7 @@ async def retrieve( raise HttpResponseError(response=response, model=error) if _stream: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: deserialized = _deserialize(_models2.KnowledgeBaseRetrievalResponse, response.json()) diff --git a/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py index 78fd13d0ebcd..fee90ee27d4a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py @@ -53,8 +53,8 @@ ) from ._enums import ( # type: ignore - AutocompleteMode, HybridCountAndFacetMode, + AutocompleteMode, IndexActionType, QueryAnswerType, QueryCaptionType, @@ -80,6 +80,7 @@ __all__ = [ "AutocompleteItem", + "AutocompleteMode", "DebugInfo", "DocumentDebugInfo", "ErrorAdditionalInfo", @@ -115,7 +116,6 @@ "VectorizableTextQuery", "VectorizedQuery", "VectorsDebugInfo", - "AutocompleteMode", "HybridCountAndFacetMode", "IndexActionType", "QueryAnswerType", diff --git a/sdk/search/azure-search-documents/tests/conftest.py b/sdk/search/azure-search-documents/tests/conftest.py index a761582cd729..bedf8b84d11c 100644 --- a/sdk/search/azure-search-documents/tests/conftest.py +++ b/sdk/search/azure-search-documents/tests/conftest.py @@ -11,6 +11,7 @@ add_general_regex_sanitizer, ) + @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): add_remove_header_sanitizer(headers="api-key") From c1399c9c51ce0bcbb6418cd7e850d5406cc052cb Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Fri, 27 Mar 2026 13:07:45 -0700 Subject: [PATCH 2/3] mock search update --- .../azure/search/documents/_client.py | 2 +- .../azure/search/documents/_configuration.py | 4 +- .../documents/_operations/_operations.py | 48 ++-- .../search/documents/_operations/_patch.py | 31 ++- .../azure/search/documents/_patch.py | 5 +- .../azure/search/documents/aio/_client.py | 2 +- .../search/documents/aio/_configuration.py | 4 +- .../documents/aio/_operations/_operations.py | 30 ++- .../documents/aio/_operations/_patch.py | 25 +- .../azure/search/documents/indexes/_client.py | 4 +- .../documents/indexes/_configuration.py | 8 +- .../indexes/_operations/_operations.py | 216 +++++++++++++----- .../search/documents/indexes/aio/_client.py | 4 +- .../documents/indexes/aio/_configuration.py | 8 +- .../indexes/aio/_operations/_operations.py | 87 +++++++ .../documents/indexes/models/__init__.py | 8 + .../search/documents/indexes/models/_enums.py | 19 ++ .../documents/indexes/models/_models.py | 173 ++++++++++++-- .../search/documents/indexes/models/_patch.py | 1 + .../documents/knowledgebases/_client.py | 2 +- .../knowledgebases/_configuration.py | 4 +- .../knowledgebases/_operations/_operations.py | 2 +- .../documents/knowledgebases/aio/_client.py | 2 +- .../knowledgebases/aio/_configuration.py | 4 +- .../azure/search/documents/models/__init__.py | 8 +- .../azure/search/documents/models/_enums.py | 14 ++ .../azure/search/documents/models/_models.py | 92 +++++++- 27 files changed, 678 insertions(+), 129 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/_client.py b/sdk/search/azure-search-documents/azure/search/documents/_client.py index 438b32d58cae..8db5c60f68dd 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_client.py @@ -35,7 +35,7 @@ class SearchClient(_SearchClientOperationsMixin): :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/_configuration.py index aa9539937c22..13fad1111791 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_configuration.py @@ -32,7 +32,7 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -40,7 +40,7 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], index_name: str, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-01-preview") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/search/azure-search-documents/azure/search/documents/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/_operations/_operations.py index a60afb0e2ffa..bfd1de571d5e 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_operations/_operations.py @@ -46,7 +46,7 @@ def build_search_get_document_count_request(index_name: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -107,7 +107,7 @@ def build_search_search_get_request( # pylint: disable=too-many-locals,too-many _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -209,7 +209,7 @@ def build_search_search_post_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -250,7 +250,7 @@ def build_search_get_document_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -299,7 +299,7 @@ def build_search_suggest_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -345,7 +345,7 @@ def build_search_suggest_post_request(index_name: str, **kwargs: Any) -> HttpReq _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -373,7 +373,7 @@ def build_search_index_request(index_name: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -414,7 +414,7 @@ def build_search_autocomplete_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -458,7 +458,7 @@ def build_search_autocomplete_post_request(index_name: str, **kwargs: Any) -> Ht _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -682,8 +682,8 @@ def _search_get( # pylint: disable=too-many-locals should be used for semantic ranking, captions, highlights, and answers. Default value is None. :paramtype semantic_configuration: str :keyword semantic_error_handling: Allows the user to choose whether a semantic call should fail - completely, or to return partial results (default). Known values are: "partial" and "fail". - Default value is None. + completely, or to return partial results (default). Known values are: "partial", "fail", and + "bestEffort". Default value is None. :paramtype semantic_error_handling: str or ~azure.search.documents.models.SemanticErrorMode :keyword semantic_max_wait_in_milliseconds: Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing before the request fails. Default @@ -873,6 +873,8 @@ def _search_post( # pylint: disable=too-many-locals vector_queries: Optional[list[_models1.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models1.VectorFilterMode]] = None, hybrid_search: Optional[_models1.HybridSearch] = None, + relevance_score_mode: Optional[Union[str, _models1.RelevanceScoreMode]] = None, + query_insights_enabled: Optional[bool] = None, **kwargs: Any ) -> _models1.SearchDocumentsResult: ... @overload @@ -936,6 +938,8 @@ def _search_post( # pylint: disable=too-many-locals vector_queries: Optional[list[_models1.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models1.VectorFilterMode]] = None, hybrid_search: Optional[_models1.HybridSearch] = None, + relevance_score_mode: Optional[Union[str, _models1.RelevanceScoreMode]] = None, + query_insights_enabled: Optional[bool] = None, **kwargs: Any ) -> _models1.SearchDocumentsResult: """Searches for documents in the index. @@ -1053,7 +1057,7 @@ def _search_post( # pylint: disable=too-many-locals :paramtype semantic_configuration_name: str :keyword semantic_error_handling: Allows the user to choose whether a semantic call should fail completely (default / current behavior), or to return partial results. Known values are: - "partial" and "fail". Default value is None. + "partial", "fail", and "bestEffort". Default value is None. :paramtype semantic_error_handling: str or ~azure.search.documents.models.SemanticErrorMode :keyword semantic_max_wait_in_milliseconds: Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing before the request fails. Default @@ -1086,6 +1090,12 @@ def _search_post( # pylint: disable=too-many-locals :keyword hybrid_search: The query parameters to configure hybrid search behaviors. Default value is None. :paramtype hybrid_search: ~azure.search.documents.models.HybridSearch + :keyword relevance_score_mode: Specifies the relevance scoring mode to use when ranking + results. Known values are: "classic", "enhanced", and "learned". Default value is None. + :paramtype relevance_score_mode: str or ~azure.search.documents.models.RelevanceScoreMode + :keyword query_insights_enabled: A value indicating whether to include query performance + insights in the response. Default value is None. + :paramtype query_insights_enabled: bool :return: SearchDocumentsResult. The SearchDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models.SearchDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1118,9 +1128,11 @@ def _search_post( # pylint: disable=too-many-locals "hybridSearch": hybrid_search, "minimumCoverage": minimum_coverage, "orderby": order_by, + "queryInsightsEnabled": query_insights_enabled, "queryLanguage": query_language, "queryRewrites": query_rewrites, "queryType": query_type, + "relevanceScoreMode": relevance_score_mode, "scoringParameters": scoring_parameters, "scoringProfile": scoring_profile, "scoringStatistics": scoring_statistics, @@ -1421,7 +1433,6 @@ def _suggest_post( self, *, search_text: str, - suggester_name: str, content_type: str = "application/json", filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, @@ -1431,6 +1442,7 @@ def _suggest_post( order_by: Optional[list[str]] = None, search_fields: Optional[list[str]] = None, select: Optional[list[str]] = None, + suggester_name: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> _models1._models.SuggestDocumentsResult: ... @@ -1449,7 +1461,6 @@ def _suggest_post( # pylint: disable=too-many-locals body: Union[JSON, IO[bytes]] = _Unset, *, search_text: str = _Unset, - suggester_name: str = _Unset, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, @@ -1458,6 +1469,7 @@ def _suggest_post( # pylint: disable=too-many-locals order_by: Optional[list[str]] = None, search_fields: Optional[list[str]] = None, select: Optional[list[str]] = None, + suggester_name: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> _models1._models.SuggestDocumentsResult: @@ -1468,9 +1480,6 @@ def _suggest_post( # pylint: disable=too-many-locals :keyword search_text: The search text to use to suggest documents. Must be at least 1 character, and no more than 100 characters. Required. :paramtype search_text: str - :keyword suggester_name: The name of the suggester as specified in the suggesters collection - that's part of the index definition. Required. - :paramtype suggester_name: str :keyword filter: An OData expression that filters the documents considered for suggestions. Default value is None. :paramtype filter: str @@ -1506,6 +1515,9 @@ def _suggest_post( # pylint: disable=too-many-locals :keyword select: The comma-separated list of fields to retrieve. If unspecified, only the key field will be included in the results. Default value is None. :paramtype select: list[str] + :keyword suggester_name: The name of the suggester as specified in the suggesters collection + that's part of the index definition. Default value is None. + :paramtype suggester_name: str :keyword top: The number of suggestions to retrieve. This must be a value between 1 and 100. The default is 5. Default value is None. :paramtype top: int @@ -1530,8 +1542,6 @@ def _suggest_post( # pylint: disable=too-many-locals if body is _Unset: if search_text is _Unset: raise TypeError("missing required argument: search_text") - if suggester_name is _Unset: - raise TypeError("missing required argument: suggester_name") body = { "filter": filter, "fuzzy": use_fuzzy_matching, diff --git a/sdk/search/azure-search-documents/azure/search/documents/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/_operations/_patch.py index 95ae9f41edb2..6be85cc9507b 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_operations/_patch.py @@ -126,6 +126,8 @@ def _build_search_request( query_rewrites_count: Optional[int] = None, debug: Optional[Union[str, _models.QueryDebugMode]] = None, hybrid_search: Optional[_models.HybridSearch] = None, + relevance_score_mode: Optional[Union[str, _models.RelevanceScoreMode]] = None, + query_insights_enabled: Optional[bool] = None, ) -> _models.SearchRequest: # pylint:disable=too-many-locals """Build a SearchRequest from search parameters. @@ -176,6 +178,8 @@ def _build_search_request( :keyword int query_rewrites_count: The maximum number of query rewrites to apply. :keyword debug: The debug mode for the search query. :keyword hybrid_search: The hybrid search configuration for the search query. + :keyword relevance_score_mode: The relevance scoring mode to use when ranking results. + :keyword bool query_insights_enabled: A value indicating whether to include query performance insights. :return: SearchRequest :rtype: ~azure.search.documents.models.SearchRequest """ @@ -240,6 +244,8 @@ def _build_search_request( query_rewrites=rewrites, debug=debug, hybrid_search=hybrid_search, + relevance_score_mode=relevance_score_mode, + query_insights_enabled=query_insights_enabled, ) @@ -256,7 +262,7 @@ def __init__(self, client, initial_request: _models.SearchRequest, kwargs, conti self._initial_request = initial_request self._kwargs = kwargs self._facets: Optional[Dict[str, List[Dict[str, Any]]]] = None - self._api_version = kwargs.get("api_version", "2025-11-01-preview") + self._api_version = kwargs.get("api_version", "2026-05-01-preview") def _get_next_cb(self, continuation_token): if continuation_token is None: @@ -306,6 +312,12 @@ def get_debug_info(self) -> Optional[_models.DebugInfo]: response = cast(_models.SearchDocumentsResult, self._response) return response.debug_info + @_ensure_response + def get_query_insights(self) -> Optional[_models.QueryInsights]: + self.continuation_token = None + response = cast(_models.SearchDocumentsResult, self._response) + return response.query_insights + class SearchItemPaged(ItemPaged[ReturnType]): """A pageable list of search results.""" @@ -368,6 +380,14 @@ def get_debug_info(self) -> _models.DebugInfo: """ return cast(_models.DebugInfo, self._first_iterator_instance().get_debug_info()) + def get_query_insights(self) -> Optional[_models.QueryInsights]: + """Return query performance insights. Only populated when query_insights_enabled is True. + + :return: query insights + :rtype: ~azure.search.documents.models.QueryInsights or None + """ + return cast(Optional[_models.QueryInsights], self._first_iterator_instance().get_query_insights()) + class _SearchClientOperationsMixin(_SearchClientOperationsMixinGenerated): """SearchClient operations mixin customizations.""" @@ -567,6 +587,8 @@ def search( hybrid_search: Optional[_models.HybridSearch] = None, query_source_authorization: Optional[str] = None, enable_elevated_read: Optional[bool] = None, + relevance_score_mode: Optional[Union[str, _models.RelevanceScoreMode]] = None, + query_insights_enabled: Optional[bool] = None, **kwargs: Any, ) -> SearchItemPaged[Dict]: # pylint:disable=too-many-locals @@ -706,6 +728,11 @@ def search( :keyword enable_elevated_read: A value that enables elevated read that bypass document level permission checks for the query operation. Default value is None. :paramtype enable_elevated_read: bool + :keyword relevance_score_mode: Specifies the relevance scoring mode to use when ranking results. + Known values are: "classic", "enhanced", and "learned". + :paramtype relevance_score_mode: str or ~azure.search.documents.models.RelevanceScoreMode + :keyword bool query_insights_enabled: A value indicating whether to include query performance + insights in the response. :return: List of search results. :rtype: SearchItemPaged[dict] @@ -775,6 +802,8 @@ def search( query_rewrites_count=query_rewrites_count, debug=debug, hybrid_search=hybrid_search, + relevance_score_mode=relevance_score_mode, + query_insights_enabled=query_insights_enabled, ) # Create kwargs for the search_post call diff --git a/sdk/search/azure-search-documents/azure/search/documents/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/_patch.py index 32228f20cf50..3f0619d991bc 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_patch.py @@ -41,9 +41,10 @@ class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): V2024_07_01 = "2024-07-01" V2025_09_01 = "2025-09-01" V2025_11_01_PREVIEW = "2025-11-01-preview" + V2026_05_01_PREVIEW = "2026-05-01-preview" -DEFAULT_VERSION = ApiVersion.V2025_11_01_PREVIEW +DEFAULT_VERSION = ApiVersion.V2026_05_01_PREVIEW class SearchClient(_SearchClient): @@ -58,7 +59,7 @@ class SearchClient(_SearchClient): :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Default value is - "2025-11-01-preview". Note that overriding this default value may result in unsupported + "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py index f5bf1c7ed3c2..0c9271c6af74 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_client.py @@ -35,7 +35,7 @@ class SearchClient(_SearchClientOperationsMixin): :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py index 01f7c26be476..f76517b9b88f 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_configuration.py @@ -32,7 +32,7 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -44,7 +44,7 @@ def __init__( index_name: str, **kwargs: Any, ) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-01-preview") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_operations.py index a3cddd5a2209..e1ddd94dc31e 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_operations.py @@ -250,8 +250,8 @@ async def _search_get( # pylint: disable=too-many-locals should be used for semantic ranking, captions, highlights, and answers. Default value is None. :paramtype semantic_configuration: str :keyword semantic_error_handling: Allows the user to choose whether a semantic call should fail - completely, or to return partial results (default). Known values are: "partial" and "fail". - Default value is None. + completely, or to return partial results (default). Known values are: "partial", "fail", and + "bestEffort". Default value is None. :paramtype semantic_error_handling: str or ~azure.search.documents.models.SemanticErrorMode :keyword semantic_max_wait_in_milliseconds: Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing before the request fails. Default @@ -441,6 +441,8 @@ async def _search_post( # pylint: disable=too-many-locals vector_queries: Optional[list[_models2.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models2.VectorFilterMode]] = None, hybrid_search: Optional[_models2.HybridSearch] = None, + relevance_score_mode: Optional[Union[str, _models2.RelevanceScoreMode]] = None, + query_insights_enabled: Optional[bool] = None, **kwargs: Any ) -> _models2.SearchDocumentsResult: ... @overload @@ -504,6 +506,8 @@ async def _search_post( # pylint: disable=too-many-locals vector_queries: Optional[list[_models2.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models2.VectorFilterMode]] = None, hybrid_search: Optional[_models2.HybridSearch] = None, + relevance_score_mode: Optional[Union[str, _models2.RelevanceScoreMode]] = None, + query_insights_enabled: Optional[bool] = None, **kwargs: Any ) -> _models2.SearchDocumentsResult: """Searches for documents in the index. @@ -621,7 +625,7 @@ async def _search_post( # pylint: disable=too-many-locals :paramtype semantic_configuration_name: str :keyword semantic_error_handling: Allows the user to choose whether a semantic call should fail completely (default / current behavior), or to return partial results. Known values are: - "partial" and "fail". Default value is None. + "partial", "fail", and "bestEffort". Default value is None. :paramtype semantic_error_handling: str or ~azure.search.documents.models.SemanticErrorMode :keyword semantic_max_wait_in_milliseconds: Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing before the request fails. Default @@ -654,6 +658,12 @@ async def _search_post( # pylint: disable=too-many-locals :keyword hybrid_search: The query parameters to configure hybrid search behaviors. Default value is None. :paramtype hybrid_search: ~azure.search.documents.models.HybridSearch + :keyword relevance_score_mode: Specifies the relevance scoring mode to use when ranking + results. Known values are: "classic", "enhanced", and "learned". Default value is None. + :paramtype relevance_score_mode: str or ~azure.search.documents.models.RelevanceScoreMode + :keyword query_insights_enabled: A value indicating whether to include query performance + insights in the response. Default value is None. + :paramtype query_insights_enabled: bool :return: SearchDocumentsResult. The SearchDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models.SearchDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: @@ -686,9 +696,11 @@ async def _search_post( # pylint: disable=too-many-locals "hybridSearch": hybrid_search, "minimumCoverage": minimum_coverage, "orderby": order_by, + "queryInsightsEnabled": query_insights_enabled, "queryLanguage": query_language, "queryRewrites": query_rewrites, "queryType": query_type, + "relevanceScoreMode": relevance_score_mode, "scoringParameters": scoring_parameters, "scoringProfile": scoring_profile, "scoringStatistics": scoring_statistics, @@ -989,7 +1001,6 @@ async def _suggest_post( self, *, search_text: str, - suggester_name: str, content_type: str = "application/json", filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, @@ -999,6 +1010,7 @@ async def _suggest_post( order_by: Optional[list[str]] = None, search_fields: Optional[list[str]] = None, select: Optional[list[str]] = None, + suggester_name: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> _models2._models.SuggestDocumentsResult: ... @@ -1017,7 +1029,6 @@ async def _suggest_post( # pylint: disable=too-many-locals body: Union[JSON, IO[bytes]] = _Unset, *, search_text: str = _Unset, - suggester_name: str = _Unset, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, @@ -1026,6 +1037,7 @@ async def _suggest_post( # pylint: disable=too-many-locals order_by: Optional[list[str]] = None, search_fields: Optional[list[str]] = None, select: Optional[list[str]] = None, + suggester_name: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> _models2._models.SuggestDocumentsResult: @@ -1036,9 +1048,6 @@ async def _suggest_post( # pylint: disable=too-many-locals :keyword search_text: The search text to use to suggest documents. Must be at least 1 character, and no more than 100 characters. Required. :paramtype search_text: str - :keyword suggester_name: The name of the suggester as specified in the suggesters collection - that's part of the index definition. Required. - :paramtype suggester_name: str :keyword filter: An OData expression that filters the documents considered for suggestions. Default value is None. :paramtype filter: str @@ -1074,6 +1083,9 @@ async def _suggest_post( # pylint: disable=too-many-locals :keyword select: The comma-separated list of fields to retrieve. If unspecified, only the key field will be included in the results. Default value is None. :paramtype select: list[str] + :keyword suggester_name: The name of the suggester as specified in the suggesters collection + that's part of the index definition. Default value is None. + :paramtype suggester_name: str :keyword top: The number of suggestions to retrieve. This must be a value between 1 and 100. The default is 5. Default value is None. :paramtype top: int @@ -1098,8 +1110,6 @@ async def _suggest_post( # pylint: disable=too-many-locals if body is _Unset: if search_text is _Unset: raise TypeError("missing required argument: search_text") - if suggester_name is _Unset: - raise TypeError("missing required argument: suggester_name") body = { "filter": filter, "fuzzy": use_fuzzy_matching, diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_patch.py index 64c5eaf33932..33cfa64ee4f4 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_patch.py @@ -54,7 +54,7 @@ def __init__(self, client, initial_request: _models.SearchRequest, kwargs, conti self._initial_request = initial_request self._kwargs = kwargs self._facets: Optional[Dict[str, List[Dict[str, Any]]]] = None - self._api_version = kwargs.get("api_version", "2025-11-01-preview") + self._api_version = kwargs.get("api_version", "2026-05-01-preview") async def _get_next_cb(self, continuation_token): if continuation_token is None: @@ -106,6 +106,12 @@ async def get_debug_info(self) -> Optional[_models.DebugInfo]: response = cast(_models.SearchDocumentsResult, self._response) return response.debug_info + @_ensure_response + async def get_query_insights(self) -> Optional[_models.QueryInsights]: + self.continuation_token = None + response = cast(_models.SearchDocumentsResult, self._response) + return response.query_insights + class AsyncSearchItemPaged(AsyncItemPaged[ReturnType]): """An async pageable list of search results.""" @@ -176,6 +182,14 @@ async def get_debug_info(self) -> _models.DebugInfo: """ return cast(_models.DebugInfo, await self._first_iterator_instance().get_debug_info()) + async def get_query_insights(self) -> Optional[_models.QueryInsights]: + """Return query performance insights. Only populated when query_insights_enabled is True. + + :return: query insights + :rtype: ~azure.search.documents.models.QueryInsights or None + """ + return cast(Optional[_models.QueryInsights], await self._first_iterator_instance().get_query_insights()) + class _SearchClientOperationsMixin(_SearchClientOperationsMixinGenerated): """Async SearchClient operations mixin customizations.""" @@ -374,6 +388,8 @@ async def search( hybrid_search: Optional[_models.HybridSearch] = None, query_source_authorization: Optional[str] = None, enable_elevated_read: Optional[bool] = None, + relevance_score_mode: Optional[Union[str, _models.RelevanceScoreMode]] = None, + query_insights_enabled: Optional[bool] = None, **kwargs: Any, ) -> AsyncSearchItemPaged[Dict]: # pylint:disable=too-many-locals @@ -513,6 +529,11 @@ async def search( :keyword enable_elevated_read: A value that enables elevated read that bypass document level permission checks for the query operation. Default value is None. :paramtype enable_elevated_read: bool + :keyword relevance_score_mode: Specifies the relevance scoring mode to use when ranking results. + Known values are: "classic", "enhanced", and "learned". + :paramtype relevance_score_mode: str or ~azure.search.documents.models.RelevanceScoreMode + :keyword bool query_insights_enabled: A value indicating whether to include query performance + insights in the response. :return: A list of documents (dicts) matching the specified search criteria. :return: List of search results. :rtype: AsyncSearchItemPaged[dict] @@ -583,6 +604,8 @@ async def search( query_rewrites_count=query_rewrites_count, debug=debug, hybrid_search=hybrid_search, + relevance_score_mode=relevance_score_mode, + query_insights_enabled=query_insights_enabled, ) # Create kwargs for the search_post call diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py index 070d9fe2e86e..f03893069315 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_client.py @@ -33,7 +33,7 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -112,7 +112,7 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py index e998644f0311..7c1756d62618 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_configuration.py @@ -30,13 +30,13 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-01-preview") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -85,13 +85,13 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-01-preview") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py index b411b2c838a7..09e7cbdb3c01 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping +import datetime from io import IOBase import json from typing import Any, Callable, IO, Literal, Optional, TypeVar, Union, overload @@ -35,6 +36,7 @@ from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Serializer from ..._utils.utils import ClientMixinABC, prep_if_match, prep_if_none_match +from ..._validation import api_version_validation from ...knowledgebases import models as _knowledgebases_models3 from .._configuration import SearchIndexClientConfiguration, SearchIndexerClientConfiguration @@ -54,7 +56,7 @@ def build_search_index_create_or_update_synonym_map_request( # pylint: disable= prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -90,7 +92,7 @@ def build_search_index_delete_synonym_map_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -123,7 +125,7 @@ def build_search_index_get_synonym_map_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -150,7 +152,7 @@ def build_search_index_get_synonym_maps_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -173,7 +175,7 @@ def build_search_index_create_synonym_map_request(**kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -204,7 +206,7 @@ def build_search_index_create_or_update_index_request( # pylint: disable=name-t prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -242,7 +244,7 @@ def build_search_index_delete_index_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -273,7 +275,7 @@ def build_search_index_get_index_request(name: str, **kwargs: Any) -> HttpReques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -298,7 +300,7 @@ def build_search_index_list_indexes_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -320,7 +322,7 @@ def build_search_index_list_indexes_with_selected_properties_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -343,7 +345,7 @@ def build_search_index_create_index_request(**kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -367,7 +369,7 @@ def build_search_index_get_index_statistics_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -393,7 +395,7 @@ def build_search_index_analyze_text_request(name: str, **kwargs: Any) -> HttpReq _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -424,7 +426,7 @@ def build_search_index_create_or_update_alias_request( # pylint: disable=name-t prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -460,7 +462,7 @@ def build_search_index_delete_alias_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -491,7 +493,7 @@ def build_search_index_get_alias_request(name: str, **kwargs: Any) -> HttpReques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -516,7 +518,7 @@ def build_search_index_list_aliases_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -537,7 +539,7 @@ def build_search_index_create_alias_request(**kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -563,7 +565,7 @@ def build_search_index_create_or_update_knowledge_base_request( # pylint: disab prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -599,7 +601,7 @@ def build_search_index_delete_knowledge_base_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -632,7 +634,7 @@ def build_search_index_get_knowledge_base_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -657,7 +659,7 @@ def build_search_index_list_knowledge_bases_request(**kwargs: Any) -> HttpReques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -678,7 +680,7 @@ def build_search_index_create_knowledge_base_request(**kwargs: Any) -> HttpReque _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -704,7 +706,7 @@ def build_search_index_create_or_update_knowledge_source_request( # pylint: dis prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -740,7 +742,7 @@ def build_search_index_delete_knowledge_source_request( # pylint: disable=name- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -773,7 +775,7 @@ def build_search_index_get_knowledge_source_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -798,7 +800,7 @@ def build_search_index_list_knowledge_sources_request(**kwargs: Any) -> HttpRequ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -819,7 +821,7 @@ def build_search_index_create_knowledge_source_request(**kwargs: Any) -> HttpReq _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -843,7 +845,7 @@ def build_search_index_get_knowledge_source_status_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -868,7 +870,7 @@ def build_search_index_get_service_statistics_request(**kwargs: Any) -> HttpRequ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -888,7 +890,7 @@ def build_search_index_list_index_stats_summary_request(**kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -904,6 +906,32 @@ def build_search_index_list_index_stats_summary_request(**kwargs: Any) -> HttpRe return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_search_index_get_usage_metrics_request( # pylint: disable=name-too-long + *, start_date: Optional[datetime.datetime] = None, end_date: Optional[datetime.datetime] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") + + # Construct URL + _url = "/usagemetrics" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if start_date is not None: + _params["startDate"] = _SERIALIZER.query("start_date", start_date, "iso-8601") + if end_date is not None: + _params["endDate"] = _SERIALIZER.query("end_date", end_date, "iso-8601") + + # Construct headers + if accept is not None: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_search_indexer_create_or_update_data_source_connection_request( # pylint: disable=name-too-long name: str, *, @@ -917,7 +945,7 @@ def build_search_indexer_create_or_update_data_source_connection_request( # pyl prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -957,7 +985,7 @@ def build_search_indexer_delete_data_source_connection_request( # pylint: disab _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -990,7 +1018,7 @@ def build_search_indexer_get_data_source_connection_request( # pylint: disable= _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1017,7 +1045,7 @@ def build_search_indexer_get_data_source_connections_request( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1042,7 +1070,7 @@ def build_search_indexer_create_data_source_connection_request( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1066,7 +1094,7 @@ def build_search_indexer_reset_indexer_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1092,7 +1120,7 @@ def build_search_indexer_resync_request(name: str, **kwargs: Any) -> HttpRequest _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1122,7 +1150,7 @@ def build_search_indexer_reset_documents_request( # pylint: disable=name-too-lo _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1151,7 +1179,7 @@ def build_search_indexer_run_indexer_request(name: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1186,7 +1214,7 @@ def build_search_indexer_create_or_update_indexer_request( # pylint: disable=na prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1230,7 +1258,7 @@ def build_search_indexer_delete_indexer_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1261,7 +1289,7 @@ def build_search_indexer_get_indexer_request(name: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1288,7 +1316,7 @@ def build_search_indexer_get_indexers_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1311,7 +1339,7 @@ def build_search_indexer_create_indexer_request(**kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1335,7 +1363,7 @@ def build_search_indexer_get_indexer_status_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1370,7 +1398,7 @@ def build_search_indexer_create_or_update_skillset_request( # pylint: disable=n prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1414,7 +1442,7 @@ def build_search_indexer_delete_skillset_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1445,7 +1473,7 @@ def build_search_indexer_get_skillset_request(name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1472,7 +1500,7 @@ def build_search_indexer_get_skillsets_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1495,7 +1523,7 @@ def build_search_indexer_create_skillset_request(**kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1518,7 +1546,7 @@ def build_search_indexer_reset_skills_request(name: str, **kwargs: Any) -> HttpR _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -4417,6 +4445,90 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + @distributed_trace + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={ + "2026-05-01-preview": ["api_version", "accept", "start_date", "end_date", "client_request_id"] + }, + api_versions_list=["2026-05-01-preview"], + ) + def get_usage_metrics( + self, + *, + start_date: Optional[datetime.datetime] = None, + end_date: Optional[datetime.datetime] = None, + **kwargs: Any, + ) -> _models1.SearchServiceUsageMetrics: + """Gets usage metrics for the search service including query counts and latency. + + :keyword start_date: The start date for the metrics collection period in ISO 8601 format. + Default value is None. + :paramtype start_date: ~datetime.datetime + :keyword end_date: The end date for the metrics collection period in ISO 8601 format. Default + value is None. + :paramtype end_date: ~datetime.datetime + :return: SearchServiceUsageMetrics. The SearchServiceUsageMetrics is compatible with + MutableMapping + :rtype: ~azure.search.documents.indexes.models.SearchServiceUsageMetrics + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models1.SearchServiceUsageMetrics] = kwargs.pop("cls", None) + + _request = build_search_index_get_usage_metrics_request( + start_date=start_date, + end_date=end_date, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models2.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models1.SearchServiceUsageMetrics, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + class _SearchIndexerClientOperationsMixin( # pylint: disable=too-many-public-methods ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], SearchIndexerClientConfiguration] diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py index 04eca72b9818..78e71a744af2 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_client.py @@ -33,7 +33,7 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -116,7 +116,7 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py index 8a4bd8ddec24..fdfd0c820779 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_configuration.py @@ -30,7 +30,7 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -38,7 +38,7 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-01-preview") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -87,7 +87,7 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -95,7 +95,7 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-01-preview") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py index 7e6b5ae9c581..757bf800e051 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_operations.py @@ -7,6 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping +import datetime from io import IOBase import json from typing import Any, Callable, IO, Literal, Optional, TypeVar, Union, overload @@ -35,6 +36,7 @@ from .... import models as _models3 from ...._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ...._utils.utils import ClientMixinABC +from ...._validation import api_version_validation from ....knowledgebases import models as _knowledgebases_models4 from ..._operations._operations import ( build_search_index_analyze_text_request, @@ -62,6 +64,7 @@ build_search_index_get_service_statistics_request, build_search_index_get_synonym_map_request, build_search_index_get_synonym_maps_request, + build_search_index_get_usage_metrics_request, build_search_index_list_aliases_request, build_search_index_list_index_stats_summary_request, build_search_index_list_indexes_request, @@ -2983,6 +2986,90 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @distributed_trace_async + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={ + "2026-05-01-preview": ["api_version", "accept", "start_date", "end_date", "client_request_id"] + }, + api_versions_list=["2026-05-01-preview"], + ) + async def get_usage_metrics( + self, + *, + start_date: Optional[datetime.datetime] = None, + end_date: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> _models2.SearchServiceUsageMetrics: + """Gets usage metrics for the search service including query counts and latency. + + :keyword start_date: The start date for the metrics collection period in ISO 8601 format. + Default value is None. + :paramtype start_date: ~datetime.datetime + :keyword end_date: The end date for the metrics collection period in ISO 8601 format. Default + value is None. + :paramtype end_date: ~datetime.datetime + :return: SearchServiceUsageMetrics. The SearchServiceUsageMetrics is compatible with + MutableMapping + :rtype: ~azure.search.documents.indexes.models.SearchServiceUsageMetrics + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models2.SearchServiceUsageMetrics] = kwargs.pop("cls", None) + + _request = build_search_index_get_usage_metrics_request( + start_date=start_date, + end_date=end_date, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models3.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models2.SearchServiceUsageMetrics, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + class _SearchIndexerClientOperationsMixin( # pylint: disable=too-many-public-methods ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], SearchIndexerClientConfiguration] diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py index c5ebdd7abfcc..f38afc4b0880 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py @@ -84,7 +84,9 @@ HnswAlgorithmConfiguration, HnswParameters, ImageAnalysisSkill, + IndexAnalyticsConfiguration, IndexStatisticsSummary, + IndexUsageMetrics, IndexedOneLakeKnowledgeSource, IndexedOneLakeKnowledgeSourceParameters, IndexedSharePointKnowledgeSource, @@ -178,6 +180,7 @@ SearchServiceCounters, SearchServiceLimits, SearchServiceStatistics, + SearchServiceUsageMetrics, SearchSuggester, SemanticConfiguration, SemanticField, @@ -248,6 +251,7 @@ EntityRecognitionSkillLanguage, ImageAnalysisSkillLanguage, ImageDetail, + IndexAnalyticsMode, IndexProjectionMode, IndexedSharePointContainerName, IndexerExecutionEnvironment, @@ -377,7 +381,9 @@ "HnswAlgorithmConfiguration", "HnswParameters", "ImageAnalysisSkill", + "IndexAnalyticsConfiguration", "IndexStatisticsSummary", + "IndexUsageMetrics", "IndexedOneLakeKnowledgeSource", "IndexedOneLakeKnowledgeSourceParameters", "IndexedSharePointKnowledgeSource", @@ -471,6 +477,7 @@ "SearchServiceCounters", "SearchServiceLimits", "SearchServiceStatistics", + "SearchServiceUsageMetrics", "SearchSuggester", "SemanticConfiguration", "SemanticField", @@ -538,6 +545,7 @@ "EntityRecognitionSkillLanguage", "ImageAnalysisSkillLanguage", "ImageDetail", + "IndexAnalyticsMode", "IndexProjectionMode", "IndexedSharePointContainerName", "IndexerExecutionEnvironment", diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_enums.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_enums.py index 7dfd795db096..6eea834b58f2 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_enums.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_enums.py @@ -469,6 +469,17 @@ class ImageDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Details recognized as landmarks.""" +class IndexAnalyticsMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode for index analytics collection.""" + + DISABLED = "disabled" + """Analytics collection is disabled.""" + BASIC = "basic" + """Only basic analytics are collected, such as query counts and latency.""" + DETAILED = "detailed" + """Full analytics including query patterns and performance breakdowns are collected.""" + + class IndexedSharePointContainerName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies which SharePoint libraries to access.""" @@ -1676,6 +1687,9 @@ class SearchFieldDataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): BYTE = "Edm.Byte" """Indicates that a field contains a 8-bit unsigned integer. This is only valid when used with Collection(Edm.Byte).""" + DECIMAL = "Edm.Decimal" + """Indicates that a field contains a fixed-precision decimal number. This is only valid when used + with Collection(Edm.Decimal).""" class SearchIndexerDataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1697,6 +1711,8 @@ class SearchIndexerDataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates a Microsoft Fabric OneLake datasource.""" SHARE_POINT = "sharepoint" """Indicates a SharePoint datasource.""" + COSMOS_DB_MONGO_DB = "cosmosdb-mongodb" + """Indicates an Azure Cosmos DB for MongoDB datasource.""" class SearchIndexPermissionFilterOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -2421,6 +2437,9 @@ class VectorSearchAlgorithmMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): HAMMING = "hamming" """Only applicable to bit-packed binary data types. Determines dissimilarity by counting differing positions in binary vectors. The fewer differences, the closer the similarity.""" + MANHATTAN = "manhattan" + """Computes the sum of absolute differences between vector components. Also known as L1 distance. + The smaller the value, the closer the similarity.""" class VectorSearchCompressionKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py index 147939be2b89..aabaf2f0d7f9 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py @@ -4027,7 +4027,7 @@ class ExhaustiveKnnParameters(_Model): """Contains the parameters specific to exhaustive KNN algorithm. :ivar metric: The similarity metric to use for vector comparisons. Known values are: "cosine", - "euclidean", "dotProduct", and "hamming". + "euclidean", "dotProduct", "hamming", and "manhattan". :vartype metric: str or ~azure.search.documents.indexes.models.VectorSearchAlgorithmMetric """ @@ -4035,7 +4035,7 @@ class ExhaustiveKnnParameters(_Model): visibility=["read", "create", "update", "delete", "query"] ) """The similarity metric to use for vector comparisons. Known values are: \"cosine\", - \"euclidean\", \"dotProduct\", and \"hamming\".""" + \"euclidean\", \"dotProduct\", \"hamming\", and \"manhattan\".""" @overload def __init__( @@ -4339,7 +4339,7 @@ class HnswParameters(_Model): slower search. At a certain point, increasing this parameter leads to diminishing returns. :vartype ef_search: int :ivar metric: The similarity metric to use for vector comparisons. Known values are: "cosine", - "euclidean", "dotProduct", and "hamming". + "euclidean", "dotProduct", "hamming", and "manhattan". :vartype metric: str or ~azure.search.documents.indexes.models.VectorSearchAlgorithmMetric """ @@ -4362,7 +4362,7 @@ class HnswParameters(_Model): visibility=["read", "create", "update", "delete", "query"] ) """The similarity metric to use for vector comparisons. Known values are: \"cosine\", - \"euclidean\", \"dotProduct\", and \"hamming\".""" + \"euclidean\", \"dotProduct\", \"hamming\", and \"manhattan\".""" @overload def __init__( @@ -4468,6 +4468,69 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Vision.ImageAnalysisSkill" # type: ignore +class IndexAnalyticsConfiguration(_Model): + """Configuration for index-level analytics and query performance monitoring. + + :ivar mode: The analytics collection mode for the index. Default is 'disabled'. Known values + are: "disabled", "basic", and "detailed". + :vartype mode: str or ~azure.search.documents.indexes.models.IndexAnalyticsMode + :ivar retention_period: The retention period for analytics data in ISO 8601 duration format. + Default is P30D (30 days). + :vartype retention_period: ~datetime.timedelta + :ivar include_vector_metrics: A value indicating whether to include vector search metrics in + analytics. + :vartype include_vector_metrics: bool + :ivar slow_query_threshold_count: The maximum number of slow queries to retain for analysis. + :vartype slow_query_threshold_count: int + :ivar slow_query_latency_threshold_ms: The latency threshold in milliseconds above which a + query is considered slow. + :vartype slow_query_latency_threshold_ms: int + """ + + mode: Optional[Union[str, "_models.IndexAnalyticsMode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The analytics collection mode for the index. Default is 'disabled'. Known values are: + \"disabled\", \"basic\", and \"detailed\".""" + retention_period: Optional[datetime.timedelta] = rest_field( + name="retentionPeriod", visibility=["read", "create", "update", "delete", "query"] + ) + """The retention period for analytics data in ISO 8601 duration format. Default is P30D (30 days).""" + include_vector_metrics: Optional[bool] = rest_field( + name="includeVectorMetrics", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether to include vector search metrics in analytics.""" + slow_query_threshold_count: Optional[int] = rest_field( + name="slowQueryThresholdCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of slow queries to retain for analysis.""" + slow_query_latency_threshold_ms: Optional[int] = rest_field( + name="slowQueryLatencyThresholdMs", visibility=["read", "create", "update", "delete", "query"] + ) + """The latency threshold in milliseconds above which a query is considered slow.""" + + @overload + def __init__( + self, + *, + mode: Optional[Union[str, "_models.IndexAnalyticsMode"]] = None, + retention_period: Optional[datetime.timedelta] = None, + include_vector_metrics: Optional[bool] = None, + slow_query_threshold_count: Optional[int] = None, + slow_query_latency_threshold_ms: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class IndexedOneLakeKnowledgeSource(KnowledgeSource, discriminator="indexedOneLake"): """Configuration for OneLake knowledge source. @@ -5261,6 +5324,31 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class IndexUsageMetrics(_Model): + """Per-index usage metrics. + + :ivar index_name: The name of the index. Required. + :vartype index_name: str + :ivar query_count: The number of queries targeting this index. Required. + :vartype query_count: int + :ivar average_latency_ms: The average latency in milliseconds for queries targeting this index. + Required. + :vartype average_latency_ms: float + :ivar documents_processed: The number of documents indexed in the current billing period. + Required. + :vartype documents_processed: int + """ + + index_name: str = rest_field(name="indexName", visibility=["read"]) + """The name of the index. Required.""" + query_count: int = rest_field(name="queryCount", visibility=["read"]) + """The number of queries targeting this index. Required.""" + average_latency_ms: float = rest_field(name="averageLatencyMs", visibility=["read"]) + """The average latency in milliseconds for queries targeting this index. Required.""" + documents_processed: int = rest_field(name="documentsProcessed", visibility=["read"]) + """The number of documents indexed in the current billing period. Required.""" + + class InputFieldMappingEntry(_Model): """Input field mapping for a skill. @@ -7620,10 +7708,10 @@ class ScoringProfile(_Model): :vartype text_weights: ~azure.search.documents.indexes.models.TextWeights :ivar functions: The collection of functions that influence the scoring of documents. :vartype functions: list[~azure.search.documents.indexes.models.ScoringFunction] - :ivar function_aggregation: A value indicating how the results of individual scoring functions - should be combined. Defaults to "Sum". Ignored if there are no scoring functions. Known values - are: "sum", "average", "minimum", "maximum", "firstMatching", and "product". - :vartype function_aggregation: str or + :ivar score_function_aggregation: A value indicating how the results of individual scoring + functions should be combined. Defaults to "Sum". Ignored if there are no scoring functions. + Known values are: "sum", "average", "minimum", "maximum", "firstMatching", and "product". + :vartype score_function_aggregation: str or ~azure.search.documents.indexes.models.ScoringFunctionAggregation """ @@ -7637,8 +7725,8 @@ class ScoringProfile(_Model): visibility=["read", "create", "update", "delete", "query"] ) """The collection of functions that influence the scoring of documents.""" - function_aggregation: Optional[Union[str, "_models.ScoringFunctionAggregation"]] = rest_field( - name="functionAggregation", visibility=["read", "create", "update", "delete", "query"] + score_function_aggregation: Optional[Union[str, "_models.ScoringFunctionAggregation"]] = rest_field( + name="scoreFunctionAggregation", visibility=["read", "create", "update", "delete", "query"] ) """A value indicating how the results of individual scoring functions should be combined. Defaults to \"Sum\". Ignored if there are no scoring functions. Known values are: \"sum\", \"average\", @@ -7651,7 +7739,7 @@ def __init__( name: str, text_weights: Optional["_models.TextWeights"] = None, functions: Optional[list["_models.ScoringFunction"]] = None, - function_aggregation: Optional[Union[str, "_models.ScoringFunctionAggregation"]] = None, + score_function_aggregation: Optional[Union[str, "_models.ScoringFunctionAggregation"]] = None, ) -> None: ... @overload @@ -7714,7 +7802,8 @@ class SearchField(_Model): :vartype name: str :ivar type: The data type of the field. Required. Known values are: "Edm.String", "Edm.Int32", "Edm.Int64", "Edm.Double", "Edm.Boolean", "Edm.DateTimeOffset", "Edm.GeographyPoint", - "Edm.ComplexType", "Edm.Single", "Edm.Half", "Edm.Int16", "Edm.SByte", and "Edm.Byte". + "Edm.ComplexType", "Edm.Single", "Edm.Half", "Edm.Int16", "Edm.SByte", "Edm.Byte", and + "Edm.Decimal". :vartype type: str or ~azure.search.documents.indexes.models.SearchFieldDataType :ivar key: A value indicating whether the field uniquely identifies documents in the index. Exactly one top-level field in each index must be chosen as the key field and it must be of @@ -7879,8 +7968,8 @@ class SearchField(_Model): ) """The data type of the field. Required. Known values are: \"Edm.String\", \"Edm.Int32\", \"Edm.Int64\", \"Edm.Double\", \"Edm.Boolean\", \"Edm.DateTimeOffset\", \"Edm.GeographyPoint\", - \"Edm.ComplexType\", \"Edm.Single\", \"Edm.Half\", \"Edm.Int16\", \"Edm.SByte\", and - \"Edm.Byte\".""" + \"Edm.ComplexType\", \"Edm.Single\", \"Edm.Half\", \"Edm.Int16\", \"Edm.SByte\", \"Edm.Byte\", + and \"Edm.Decimal\".""" key: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """A value indicating whether the field uniquely identifies documents in the index. Exactly one top-level field in each index must be chosen as the key field and it must be of type @@ -8151,6 +8240,10 @@ class SearchIndex(_Model): ~azure.search.documents.indexes.models.SearchIndexPermissionFilterOption :ivar purview_enabled: A value indicating whether Purview is enabled for the index. :vartype purview_enabled: bool + :ivar analytics_configuration: Configuration for index-level analytics and query performance + monitoring. + :vartype analytics_configuration: + ~azure.search.documents.indexes.models.IndexAnalyticsConfiguration :ivar e_tag: The ETag of the index. :vartype e_tag: str """ @@ -8232,6 +8325,10 @@ class SearchIndex(_Model): name="purviewEnabled", visibility=["read", "create", "update", "delete", "query"] ) """A value indicating whether Purview is enabled for the index.""" + analytics_configuration: Optional["_models.IndexAnalyticsConfiguration"] = rest_field( + name="analyticsConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration for index-level analytics and query performance monitoring.""" e_tag: Optional[str] = rest_field(name="@odata.etag", visibility=["read", "create", "update", "delete", "query"]) """The ETag of the index.""" @@ -8257,6 +8354,7 @@ def __init__( vector_search: Optional["_models.VectorSearch"] = None, permission_filter_option: Optional[Union[str, "_models.SearchIndexPermissionFilterOption"]] = None, purview_enabled: Optional[bool] = None, + analytics_configuration: Optional["_models.IndexAnalyticsConfiguration"] = None, e_tag: Optional[str] = None, ) -> None: ... @@ -8569,7 +8667,8 @@ class SearchIndexerDataSourceConnection(_Model): :ivar description: The description of the datasource. :vartype description: str :ivar type: The type of the datasource. Required. Known values are: "azuresql", "cosmosdb", - "azureblob", "azuretable", "mysql", "adlsgen2", "onelake", and "sharepoint". + "azureblob", "azuretable", "mysql", "adlsgen2", "onelake", "sharepoint", and + "cosmosdb-mongodb". :vartype type: str or ~azure.search.documents.indexes.models.SearchIndexerDataSourceType :ivar sub_type: A specific type of the data source, in case the resource is capable of different modalities. For example, 'MongoDb' for certain 'cosmosDb' accounts. @@ -8613,7 +8712,8 @@ class SearchIndexerDataSourceConnection(_Model): visibility=["read", "create", "update", "delete", "query"] ) """The type of the datasource. Required. Known values are: \"azuresql\", \"cosmosdb\", - \"azureblob\", \"azuretable\", \"mysql\", \"adlsgen2\", \"onelake\", and \"sharepoint\".""" + \"azureblob\", \"azuretable\", \"mysql\", \"adlsgen2\", \"onelake\", \"sharepoint\", and + \"cosmosdb-mongodb\".""" sub_type: Optional[str] = rest_field(name="subType", visibility=["read"]) """A specific type of the data source, in case the resource is capable of different modalities. For example, 'MongoDb' for certain 'cosmosDb' accounts.""" @@ -9913,6 +10013,8 @@ class SearchServiceCounters(_Model): :ivar vector_index_size_counter: Total memory consumption of all vector indexes within the service, in bytes. Required. :vartype vector_index_size_counter: ~azure.search.documents.indexes.models.ResourceCounter + :ivar knowledge_sources_count: Total number of knowledge sources. + :vartype knowledge_sources_count: ~azure.search.documents.indexes.models.ResourceCounter """ alias_counter: "_models.ResourceCounter" = rest_field( @@ -9951,6 +10053,10 @@ class SearchServiceCounters(_Model): name="vectorIndexSize", visibility=["read", "create", "update", "delete", "query"] ) """Total memory consumption of all vector indexes within the service, in bytes. Required.""" + knowledge_sources_count: Optional["_models.ResourceCounter"] = rest_field( + name="knowledgeSourcesCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Total number of knowledge sources.""" @overload def __init__( @@ -9965,6 +10071,7 @@ def __init__( synonym_map_counter: "_models.ResourceCounter", skillset_counter: "_models.ResourceCounter", vector_index_size_counter: "_models.ResourceCounter", + knowledge_sources_count: Optional["_models.ResourceCounter"] = None, ) -> None: ... @overload @@ -10089,6 +10196,40 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class SearchServiceUsageMetrics(_Model): + """Response from a usage metrics request for the search service. + + :ivar total_queries: The total number of queries processed in the current billing period. + Required. + :vartype total_queries: int + :ivar throttled_queries: The total number of throttled queries in the current billing period. + Required. + :vartype throttled_queries: int + :ivar average_latency_ms: The average query latency in milliseconds over the current billing + period. Required. + :vartype average_latency_ms: float + :ivar p95_latency_ms: The 95th percentile query latency in milliseconds. Required. + :vartype p95_latency_ms: float + :ivar last_updated: The timestamp of the most recent metrics aggregation. Required. + :vartype last_updated: ~datetime.datetime + :ivar index_metrics: Per-index usage breakdown. + :vartype index_metrics: list[~azure.search.documents.indexes.models.IndexUsageMetrics] + """ + + total_queries: int = rest_field(name="totalQueries", visibility=["read"]) + """The total number of queries processed in the current billing period. Required.""" + throttled_queries: int = rest_field(name="throttledQueries", visibility=["read"]) + """The total number of throttled queries in the current billing period. Required.""" + average_latency_ms: float = rest_field(name="averageLatencyMs", visibility=["read"]) + """The average query latency in milliseconds over the current billing period. Required.""" + p95_latency_ms: float = rest_field(name="p95LatencyMs", visibility=["read"]) + """The 95th percentile query latency in milliseconds. Required.""" + last_updated: datetime.datetime = rest_field(name="lastUpdated", visibility=["read"], format="rfc3339") + """The timestamp of the most recent metrics aggregation. Required.""" + index_metrics: Optional[list["_models.IndexUsageMetrics"]] = rest_field(name="indexMetrics", visibility=["read"]) + """Per-index usage breakdown.""" + + class SearchSuggester(_Model): """Defines how the Suggest API should apply to a group of fields in the index. diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_patch.py index 3d78f011e728..89fe089eecac 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/_patch.py @@ -172,6 +172,7 @@ def _collection_helper(typ: Any) -> str: SearchFieldDataType.DateTimeOffset = SearchFieldDataType.DATE_TIME_OFFSET # type: ignore[attr-defined] SearchFieldDataType.GeographyPoint = SearchFieldDataType.GEOGRAPHY_POINT # type: ignore[attr-defined] SearchFieldDataType.ComplexType = SearchFieldDataType.COMPLEX # type: ignore[attr-defined] +SearchFieldDataType.Decimal = SearchFieldDataType.DECIMAL # type: ignore[attr-defined] # Backward-compatible alias: IS was renamed to IS_ENUM to avoid conflict with Python keyword OcrSkillLanguage.IS = OcrSkillLanguage.IS_ENUM # type: ignore[attr-defined] diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py index 420c42561463..42c4d680b99d 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_client.py @@ -33,7 +33,7 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin) :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py index 3daf7d8bf593..45e36abe505a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_configuration.py @@ -30,13 +30,13 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-01-preview") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_operations.py index 691d2c5f4716..ba06593416d1 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_operations.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_operations.py @@ -48,7 +48,7 @@ def build_knowledge_base_retrieval_retrieve_request( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py index bc1d25302652..c22af2652ba7 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_client.py @@ -33,7 +33,7 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin) :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py index 671eedc81fbd..6d8a4225fd7f 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_configuration.py @@ -30,7 +30,7 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2025-11-01-preview". Default value is "2025-11-01-preview". Note that overriding this default + "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -38,7 +38,7 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins def __init__( self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-11-01-preview") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py index fee90ee27d4a..926e6c249473 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py @@ -28,6 +28,8 @@ LookupDocument, QueryAnswerResult, QueryCaptionResult, + QueryInsights, + QueryInsightsBreakdown, QueryResultDocumentInnerHit, QueryResultDocumentRerankerInput, QueryResultDocumentSemanticField, @@ -53,8 +55,8 @@ ) from ._enums import ( # type: ignore - HybridCountAndFacetMode, AutocompleteMode, + HybridCountAndFacetMode, IndexActionType, QueryAnswerType, QueryCaptionType, @@ -63,6 +65,7 @@ QueryRewritesType, QuerySpellerType, QueryType, + RelevanceScoreMode, ScoringStatistics, SearchMode, SemanticErrorMode, @@ -94,6 +97,8 @@ "LookupDocument", "QueryAnswerResult", "QueryCaptionResult", + "QueryInsights", + "QueryInsightsBreakdown", "QueryResultDocumentInnerHit", "QueryResultDocumentRerankerInput", "QueryResultDocumentSemanticField", @@ -125,6 +130,7 @@ "QueryRewritesType", "QuerySpellerType", "QueryType", + "RelevanceScoreMode", "ScoringStatistics", "SearchMode", "SemanticErrorMode", diff --git a/sdk/search/azure-search-documents/azure/search/documents/models/_enums.py b/sdk/search/azure-search-documents/azure/search/documents/models/_enums.py index 8d0896878044..b106893090cf 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/models/_enums.py +++ b/sdk/search/azure-search-documents/azure/search/documents/models/_enums.py @@ -312,6 +312,17 @@ class QueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): on the Web corpus.""" +class RelevanceScoreMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines the relevance score calculation mode for search results.""" + + CLASSIC = "classic" + """Classic BM25 scoring. This is the default.""" + ENHANCED = "enhanced" + """Enhanced scoring that incorporates freshness and proximity signals.""" + LEARNED = "learned" + """Experimental scoring using a learned model for improved relevance.""" + + class ScoringStatistics(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value that specifies whether we want to calculate scoring statistics (such as document frequency) globally for more consistent scoring, or locally, for lower latency. The default is @@ -347,6 +358,9 @@ class SemanticErrorMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAIL = "fail" """If there is an exception during the semantic processing step, the query will fail and return the appropriate HTTP code depending on the error.""" + BEST_EFFORT = "bestEffort" + """Provides a best-effort semantic processing result, falling back to BM25 ranking if semantic + ranking is unavailable.""" class SemanticErrorReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/search/azure-search-documents/azure/search/documents/models/_models.py b/sdk/search/azure-search-documents/azure/search/documents/models/_models.py index aea242bf9ed1..233b23df3da0 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/models/_models.py +++ b/sdk/search/azure-search-documents/azure/search/documents/models/_models.py @@ -408,6 +408,70 @@ class QueryCaptionResult(_Model): """Same text passage as in the Text property with highlighted phrases most relevant to the query.""" +class QueryInsights(_Model): + """Performance and diagnostic insights for a query execution. + + :ivar total_time_ms: Total query execution time in milliseconds. Required. + :vartype total_time_ms: float + :ivar text_match_time_ms: Time spent in the text matching phase in milliseconds. + :vartype text_match_time_ms: float + :ivar vector_search_time_ms: Time spent in vector search in milliseconds, if applicable. + :vartype vector_search_time_ms: float + :ivar semantic_ranking_time_ms: Time spent in semantic ranking in milliseconds, if applicable. + :vartype semantic_ranking_time_ms: float + :ivar shards_queried: The number of index shards that participated in serving this query. + Required. + :vartype shards_queried: int + :ivar relevance_score_mode: The relevance score mode that was used for this query. Known values + are: "classic", "enhanced", and "learned". + :vartype relevance_score_mode: str or ~azure.search.documents.models.RelevanceScoreMode + :ivar breakdown: Detailed performance breakdown per query phase. + :vartype breakdown: ~azure.search.documents.models.QueryInsightsBreakdown + """ + + total_time_ms: float = rest_field(name="totalTimeMs", visibility=["read"]) + """Total query execution time in milliseconds. Required.""" + text_match_time_ms: Optional[float] = rest_field(name="textMatchTimeMs", visibility=["read"]) + """Time spent in the text matching phase in milliseconds.""" + vector_search_time_ms: Optional[float] = rest_field(name="vectorSearchTimeMs", visibility=["read"]) + """Time spent in vector search in milliseconds, if applicable.""" + semantic_ranking_time_ms: Optional[float] = rest_field(name="semanticRankingTimeMs", visibility=["read"]) + """Time spent in semantic ranking in milliseconds, if applicable.""" + shards_queried: int = rest_field(name="shardsQueried", visibility=["read"]) + """The number of index shards that participated in serving this query. Required.""" + relevance_score_mode: Optional[Union[str, "_models.RelevanceScoreMode"]] = rest_field( + name="relevanceScoreMode", visibility=["read"] + ) + """The relevance score mode that was used for this query. Known values are: \"classic\", + \"enhanced\", and \"learned\".""" + breakdown: Optional["_models.QueryInsightsBreakdown"] = rest_field(visibility=["read"]) + """Detailed performance breakdown per query phase.""" + + +class QueryInsightsBreakdown(_Model): + """Detailed performance breakdown for each phase of query execution. + + :ivar query_parsing_ms: Time spent parsing and analyzing the query in milliseconds. Required. + :vartype query_parsing_ms: float + :ivar index_lookup_ms: Time spent in the inverted index lookup phase in milliseconds. Required. + :vartype index_lookup_ms: float + :ivar scoring_ms: Time spent scoring and ranking documents in milliseconds. Required. + :vartype scoring_ms: float + :ivar field_retrieval_ms: Time spent loading and projecting stored fields in milliseconds. + Required. + :vartype field_retrieval_ms: float + """ + + query_parsing_ms: float = rest_field(name="queryParsingMs", visibility=["read"]) + """Time spent parsing and analyzing the query in milliseconds. Required.""" + index_lookup_ms: float = rest_field(name="indexLookupMs", visibility=["read"]) + """Time spent in the inverted index lookup phase in milliseconds. Required.""" + scoring_ms: float = rest_field(name="scoringMs", visibility=["read"]) + """Time spent scoring and ranking documents in milliseconds. Required.""" + field_retrieval_ms: float = rest_field(name="fieldRetrievalMs", visibility=["read"]) + """Time spent loading and projecting stored fields in milliseconds. Required.""" + + class QueryResultDocumentInnerHit(_Model): """Detailed scoring information for an individual element of a complex collection. @@ -561,6 +625,9 @@ class SearchDocumentsResult(_Model): documents. "originalQueryOnly" :vartype semantic_query_rewrites_result_type: str or ~azure.search.documents.models.SemanticQueryRewritesResultType + :ivar query_insights: Performance and diagnostic insights for this query execution. Only + populated when queryInsightsMode is enabled. + :vartype query_insights: ~azure.search.documents.models.QueryInsights """ count: Optional[int] = rest_field(name="@odata.count", visibility=["read"]) @@ -605,6 +672,9 @@ class SearchDocumentsResult(_Model): name="@search.semanticQueryRewritesResultType", visibility=["read"] ) """Type of query rewrite that was used to retrieve documents. \"originalQueryOnly\"""" + query_insights: Optional["_models.QueryInsights"] = rest_field(name="@search.queryInsights", visibility=["read"]) + """Performance and diagnostic insights for this query execution. Only populated when + queryInsightsMode is enabled.""" class SearchRequest(_Model): @@ -710,7 +780,7 @@ class SearchRequest(_Model): :vartype semantic_configuration_name: str :ivar semantic_error_handling: Allows the user to choose whether a semantic call should fail completely (default / current behavior), or to return partial results. Known values are: - "partial" and "fail". + "partial", "fail", and "bestEffort". :vartype semantic_error_handling: str or ~azure.search.documents.models.SemanticErrorMode :ivar semantic_max_wait_in_milliseconds: Allows the user to set an upper bound on the amount of time it takes for semantic enrichment to finish processing before the request fails. @@ -739,6 +809,12 @@ class SearchRequest(_Model): :vartype vector_filter_mode: str or ~azure.search.documents.models.VectorFilterMode :ivar hybrid_search: The query parameters to configure hybrid search behaviors. :vartype hybrid_search: ~azure.search.documents.models.HybridSearch + :ivar relevance_score_mode: Specifies the relevance scoring mode to use when ranking results. + Known values are: "classic", "enhanced", and "learned". + :vartype relevance_score_mode: str or ~azure.search.documents.models.RelevanceScoreMode + :ivar query_insights_enabled: A value indicating whether to include query performance insights + in the response. + :vartype query_insights_enabled: bool """ include_total_count: Optional[bool] = rest_field( @@ -874,7 +950,8 @@ class SearchRequest(_Model): name="semanticErrorHandling", visibility=["read", "create", "update", "delete", "query"] ) """Allows the user to choose whether a semantic call should fail completely (default / current - behavior), or to return partial results. Known values are: \"partial\" and \"fail\".""" + behavior), or to return partial results. Known values are: \"partial\", \"fail\", and + \"bestEffort\".""" semantic_max_wait_in_milliseconds: Optional[int] = rest_field( name="semanticMaxWaitInMilliseconds", visibility=["read", "create", "update", "delete", "query"] ) @@ -919,6 +996,15 @@ class SearchRequest(_Model): name="hybridSearch", visibility=["read", "create", "update", "delete", "query"] ) """The query parameters to configure hybrid search behaviors.""" + relevance_score_mode: Optional[Union[str, "_models.RelevanceScoreMode"]] = rest_field( + name="relevanceScoreMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the relevance scoring mode to use when ranking results. Known values are: + \"classic\", \"enhanced\", and \"learned\".""" + query_insights_enabled: Optional[bool] = rest_field( + name="queryInsightsEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether to include query performance insights in the response.""" @overload def __init__( # pylint: disable=too-many-locals @@ -957,6 +1043,8 @@ def __init__( # pylint: disable=too-many-locals vector_queries: Optional[list["_models.VectorQuery"]] = None, vector_filter_mode: Optional[Union[str, "_models.VectorFilterMode"]] = None, hybrid_search: Optional["_models.HybridSearch"] = None, + relevance_score_mode: Optional[Union[str, "_models.RelevanceScoreMode"]] = None, + query_insights_enabled: Optional[bool] = None, ) -> None: ... @overload From ddc8b02f6e354231fd517fbb45f75ec1d5c62be2 Mon Sep 17 00:00:00 2001 From: Xiang Yan Date: Fri, 27 Mar 2026 14:16:15 -0700 Subject: [PATCH 3/3] update --- .../azure/search/documents/_operations/_patch.py | 2 +- .../azure/search/documents/_validation.py | 2 +- .../azure/search/documents/aio/_operations/_patch.py | 2 +- .../azure/search/documents/models/__init__.py | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/sdk/search/azure-search-documents/azure/search/documents/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/_operations/_patch.py index 6be85cc9507b..b62822c3cd2a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_operations/_patch.py @@ -821,7 +821,7 @@ def autocomplete( search_text: str, suggester_name: str, *, - mode: Optional[Union[str, _models.AutocompleteMode]] = None, + mode: Optional[Union[str, _models._enums.AutocompleteMode]] = None, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, diff --git a/sdk/search/azure-search-documents/azure/search/documents/_validation.py b/sdk/search/azure-search-documents/azure/search/documents/_validation.py index f5af3a4eb8a2..d1a6ed12ab19 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_validation.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_validation.py @@ -23,7 +23,7 @@ def _index_with_default(value: str, default: int = -1) -> int: :rtype: int """ try: - return api_versions_list.index(value) + return int(api_versions_list.index(value)) except ValueError: return default diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_patch.py index 33cfa64ee4f4..c88cb3476e71 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_patch.py @@ -623,7 +623,7 @@ async def autocomplete( search_text: str, suggester_name: str, *, - mode: Optional[Union[str, _models.AutocompleteMode]] = None, + mode: Optional[Union[str, _models._enums.AutocompleteMode]] = None, filter: Optional[str] = None, use_fuzzy_matching: Optional[bool] = None, highlight_post_tag: Optional[str] = None, diff --git a/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py index 926e6c249473..4c42257b2e57 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/models/__init__.py @@ -55,7 +55,6 @@ ) from ._enums import ( # type: ignore - AutocompleteMode, HybridCountAndFacetMode, IndexActionType, QueryAnswerType, @@ -83,7 +82,6 @@ __all__ = [ "AutocompleteItem", - "AutocompleteMode", "DebugInfo", "DocumentDebugInfo", "ErrorAdditionalInfo",