Skip to content

Commit 843055a

Browse files
authored
Update api version (Azure#36425)
* Some review feedback also applies to preview * update * updates * updates * updates * Update * update * updates * updates * updates * update * update * update * update * Update api version * update * update tests * update
1 parent ad953cd commit 843055a

File tree

66 files changed

+1782
-1470
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1782
-1470
lines changed

sdk/search/azure-search-documents/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@
1414

1515
### Other Changes
1616

17+
- Updated the API version to "2024-09-01-preview"
18+
- Below models were renamed
19+
- `azure.search.documents.indexes.models.SearchIndexerIndexProjections` -> `azure.search.documents.indexes.models.SearchIndexerIndexProjection`
20+
- `azure.search.documents.indexes.models.LineEnding` -> `azure.search.documents.indexes.models.OrcLineEnding`
21+
- `azure.search.documents.indexes.models.ScalarQuantizationCompressionConfiguration` -> `azure.search.documents.indexes.models.ScalarQuantizationCompression`
22+
- `azure.search.documents.indexes.models.VectorSearchCompressionConfiguration` -> `azure.search.documents.indexes.models.VectorSearchCompression`
23+
- `azure.search.documents.indexes.models.VectorSearchCompressionTargetDataType` -> `azure.search.documents.indexes.models.VectorSearchCompressionTarget`
24+
- Below properties were renamed
25+
- `azure.search.documents.indexes.models.AzureMachineLearningVectorizer.name` -> `azure.search.documents.indexes.models.AzureMachineLearningVectorizer.vectorizer_name`
26+
- `azure.search.documents.indexes.models.AzureOpenAIEmbeddingSkill.deployment_id` -> `azure.search.documents.indexes.models.AzureOpenAIEmbeddingSkill.deployment_name`
27+
- `azure.search.documents.indexes.models.AzureOpenAIEmbeddingSkill.resource_uri` -> `azure.search.documents.indexes.models.AzureOpenAIEmbeddingSkill.resource_url`
28+
- `azure.search.documents.indexes.models.AzureOpenAIVectorizer.azure_open_ai_parameters` -> `azure.search.documents.indexes.models.AzureOpenAIVectorizer.parameters`
29+
- `azure.search.documents.indexes.models.AzureOpenAIVectorizer.name` -> `azure.search.documents.indexes.models.AzureOpenAIVectorizer.vectorizer_name`
30+
- `azure.search.documents.indexes.models.SearchIndexerDataUserAssignedIdentity.user_assigned_identity` -> `azure.search.documents.indexes.models.SearchIndexerDataUserAssignedIdentity.resource_id`
31+
- `azure.search.documents.indexes.models.VectorSearchProfile.compression_configuration_name` -> `azure.search.documents.indexes.models.VectorSearchProfile.compression_name`
32+
- `azure.search.documents.indexes.models.VectorSearchProfile.vectorizer` -> `azure.search.documents.indexes.models.VectorSearchProfile.vectorizer_name`
33+
- `azure.search.documents.indexes.models.VectorSearchVectorizer.name` -> `azure.search.documents.indexes.models.VectorSearchVectorizer.vectorizer_name`
34+
1735
## 11.6.0b4 (2024-05-07)
1836

1937
### Features Added

sdk/search/azure-search-documents/README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ exposes operations on these resources through three main client types.
162162
Azure AI Search provides two powerful features: **semantic ranking** and **vector search**.
163163

164164
**Semantic ranking** enhances the quality of search results for text-based queries. By enabling semantic ranking on your search service, you can improve the relevance of search results in two ways:
165-
- It applies secondary ranking to the initial result set, promoting the most semantically relevant results to the top.
166-
- It extracts and returns captions and answers in the response, which can be displayed on a search page to enhance the user's search experience.
165+
166+
* It applies secondary ranking to the initial result set, promoting the most semantically relevant results to the top.
167+
* It extracts and returns captions and answers in the response, which can be displayed on a search page to enhance the user's search experience.
167168

168169
To learn more about semantic ranking, you can refer to the [documentation](https://learn.microsoft.com/azure/search/vector-search-overview).
169170

@@ -184,14 +185,12 @@ that you can [import into your own index from the Azure portal.](https://docs.mi
184185
These are just a few of the basics - please [check out our Samples](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples) for
185186
much more.
186187

187-
188188
* [Querying](#querying)
189189
* [Creating an index](#creating-an-index)
190190
* [Adding documents to your index](#adding-documents-to-your-index)
191191
* [Retrieving a specific document from your index](#retrieving-a-specific-document-from-your-index)
192192
* [Async APIs](#async-apis)
193193

194-
195194
### Querying
196195

197196
Let's start by importing our namespaces.
@@ -226,7 +225,6 @@ for result in results:
226225
print("{}: {})".format(result["hotelId"], result["hotelName"]))
227226
```
228227

229-
230228
### Creating an index
231229

232230
You can use the `SearchIndexClient` to create a search index. Fields can be
@@ -240,6 +238,7 @@ client = SearchIndexClient(service_endpoint, AzureKeyCredential(key))
240238
name = "hotels"
241239
fields = [
242240
SimpleField(name="hotelId", type=SearchFieldDataType.String, key=True),
241+
SimpleField(name="hotelName", type=SearchFieldDataType.String, searchable=True),
243242
SimpleField(name="baseRate", type=SearchFieldDataType.Double),
244243
SearchableField(name="description", type=SearchFieldDataType.String, collection=True),
245244
ComplexField(
@@ -271,10 +270,7 @@ to be aware of.
271270

272271
```python
273272
DOCUMENT = {
274-
"category": "Hotel",
275273
"hotelId": "1000",
276-
"rating": 4.0,
277-
"rooms": [],
278274
"hotelName": "Azure Inn",
279275
}
280276

@@ -289,8 +285,8 @@ print("Upload of new document succeeded: {}".format(result[0].succeeded))
289285

290286
To authenticate in a [National Cloud](https://docs.microsoft.com/azure/active-directory/develop/authentication-national-cloud), you will need to make the following additions to your client configuration:
291287

292-
- Set the `AuthorityHost` in the credential options or via the `AZURE_AUTHORITY_HOST` environment variable
293-
- Set the `audience` in `SearchClient`, `SearchIndexClient`, or `SearchIndexerClient`
288+
* Set the `AuthorityHost` in the credential options or via the `AZURE_AUTHORITY_HOST` environment variable
289+
* Set the `audience` in `SearchClient`, `SearchIndexClient`, or `SearchIndexerClient`
294290

295291
```python
296292
# Create a SearchClient that will authenticate through AAD in the China national cloud.
@@ -325,8 +321,6 @@ result = search_client.get_document(key="23")
325321

326322
print("Details for hotel '23' are:")
327323
print(" Name: {}".format(result["hotelName"]))
328-
print(" Rating: {}".format(result["rating"]))
329-
print(" Category: {}".format(result["category"]))
330324
```
331325

332326
<!-- END SNIPPET -->

sdk/search/azure-search-documents/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/search/azure-search-documents",
5-
"Tag": "python/search/azure-search-documents_5cbab0a8a5"
5+
"Tag": "python/search/azure-search-documents_d9c3f0ef0f"
66
}

sdk/search/azure-search-documents/azure/search/documents/_api_versions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99

1010
class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
11-
#: this is the default version
1211
V2020_06_30 = "2020-06-30"
1312
V2023_11_01 = "2023-11-01"
14-
V2024_05_01_PREVIEW = "2024-05-01-preview"
13+
V2024_07_01 = "2024-07-01"
14+
V2024_09_01_PREVIEW = "2024-09-01-preview"
1515

1616

17-
DEFAULT_VERSION = ApiVersion.V2024_05_01_PREVIEW
17+
DEFAULT_VERSION = ApiVersion.V2024_09_01_PREVIEW

sdk/search/azure-search-documents/azure/search/documents/_generated/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.1, generator: @autorest/python@6.13.12)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.19.0)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66

@@ -21,13 +21,13 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri
2121
:type endpoint: str
2222
:param index_name: The name of the index. Required.
2323
:type index_name: str
24-
:keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding
24+
:keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding
2525
this default value may result in unsupported behavior.
2626
:paramtype api_version: str
2727
"""
2828

2929
def __init__(self, endpoint: str, index_name: str, **kwargs: Any) -> None:
30-
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
30+
api_version: str = kwargs.pop("api_version", "2024-09-01-preview")
3131

3232
if endpoint is None:
3333
raise ValueError("Parameter 'endpoint' must not be None.")

sdk/search/azure-search-documents/azure/search/documents/_generated/_search_index_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.1, generator: @autorest/python@6.13.12)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.19.0)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66

77
from copy import deepcopy
88
from typing import Any
9+
from typing_extensions import Self
910

1011
from azure.core import PipelineClient
1112
from azure.core.pipeline import policies
@@ -26,7 +27,7 @@ class SearchIndexClient: # pylint: disable=client-accepts-api-version-keyword
2627
:type endpoint: str
2728
:param index_name: The name of the index. Required.
2829
:type index_name: str
29-
:keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding
30+
:keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding
3031
this default value may result in unsupported behavior.
3132
:paramtype api_version: str
3233
"""
@@ -91,7 +92,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
9192
def close(self) -> None:
9293
self._client.close()
9394

94-
def __enter__(self) -> "SearchIndexClient":
95+
def __enter__(self) -> Self:
9596
self._client.__enter__()
9697
return self
9798

sdk/search/azure-search-documents/azure/search/documents/_generated/_serialization.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ def _json_attemp(data):
144144
# context otherwise.
145145
_LOGGER.critical("Wasn't XML not JSON, failing")
146146
raise DeserializationError("XML is invalid") from err
147+
elif content_type.startswith("text/"):
148+
return data_as_str
147149
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
148150

149151
@classmethod
@@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data):
14411443
elif isinstance(response, type) and issubclass(response, Enum):
14421444
return self.deserialize_enum(data, response)
14431445

1444-
if data is None:
1446+
if data is None or data is CoreNull:
14451447
return data
14461448
try:
14471449
attributes = response._attribute_map # type: ignore

sdk/search/azure-search-documents/azure/search/documents/_generated/_vendor.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

sdk/search/azure-search-documents/azure/search/documents/_generated/aio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.1, generator: @autorest/python@6.13.12)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.19.0)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66

sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_configuration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.1, generator: @autorest/python@6.13.12)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.19.0)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66

@@ -21,13 +21,13 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri
2121
:type endpoint: str
2222
:param index_name: The name of the index. Required.
2323
:type index_name: str
24-
:keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding
24+
:keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding
2525
this default value may result in unsupported behavior.
2626
:paramtype api_version: str
2727
"""
2828

2929
def __init__(self, endpoint: str, index_name: str, **kwargs: Any) -> None:
30-
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
30+
api_version: str = kwargs.pop("api_version", "2024-09-01-preview")
3131

3232
if endpoint is None:
3333
raise ValueError("Parameter 'endpoint' must not be None.")

0 commit comments

Comments
 (0)