Skip to content

Commit b46abc2

Browse files
authored
Fix enum values. (#45093)
* Fix enum values. * update enums * update * patch "is" * update * updates
1 parent 7d3e0df commit b46abc2

6 files changed

Lines changed: 40 additions & 14 deletions

File tree

sdk/search/azure-search-documents/azure/search/documents/indexes/models/_enums.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pylint: disable=line-too-long,useless-suppression,too-many-lines,enum-must-be-uppercase
1+
# pylint: disable=line-too-long,useless-suppression,too-many-lines
22
# coding=utf-8
33
# --------------------------------------------------------------------------
44
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -14,9 +14,11 @@
1414
class AIFoundryModelCatalogName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
1515
"""The name of the embedding model from the Azure AI Foundry Catalog that will be called."""
1616

17-
OPEN_AICLIP_IMAGE_TEXT_EMBEDDINGS_VIT_BASE_PATCH32 = "OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32"
17+
OPEN_AI_CLIP_IMAGE_TEXT_EMBEDDINGS_VIT_BASE_PATCH32 = "OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32"
1818
"""OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32."""
19-
OPEN_AICLIP_IMAGE_TEXT_EMBEDDINGS_VI_T_LARGE_PATCH14336 = "OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336"
19+
OPEN_AI_CLIP_IMAGE_TEXT_EMBEDDINGS_VI_T_LARGE_PATCH14_336 = (
20+
"OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336"
21+
)
2022
"""OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336."""
2123
FACEBOOK_DINO_V2_IMAGE_EMBEDDINGS_VI_T_BASE = "Facebook-DinoV2-Image-Embeddings-ViT-Base"
2224
"""Facebook-DinoV2-Image-Embeddings-ViT-Base."""
@@ -138,7 +140,7 @@ class CharFilterName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
138140
class ChatCompletionExtraParametersBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta):
139141
"""Specifies how 'extraParameters' should be handled by Azure AI Foundry. Defaults to 'error'."""
140142

141-
PASS_THROUGH = "pass-through"
143+
PASS_THROUGH = "passThrough"
142144
"""Passes any extra parameters directly to the model."""
143145
DROP = "drop"
144146
"""Drops all extra parameters."""
@@ -1235,7 +1237,7 @@ class OcrSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta):
12351237
"""Ho (Devanagiri)."""
12361238
HU = "hu"
12371239
"""Hungarian."""
1238-
ISEnum = "is"
1240+
IS_ENUM = "is"
12391241
"""Icelandic."""
12401242
SMN = "smn"
12411243
"""Inari Sami."""
@@ -1736,7 +1738,7 @@ class SplitSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta):
17361738
"""Hungarian."""
17371739
ID = "id"
17381740
"""Indonesian."""
1739-
ISEnum = "is"
1741+
IS_ENUM = "is"
17401742
"""Icelandic."""
17411743
IT = "it"
17421744
"""Italian."""
@@ -2028,7 +2030,7 @@ class TextTranslationSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta)
20282030
"""Hmong Daw."""
20292031
HU = "hu"
20302032
"""Hungarian."""
2031-
ISEnum = "is"
2033+
IS_ENUM = "is"
20322034
"""Icelandic."""
20332035
ID = "id"
20342036
"""Indonesian."""

sdk/search/azure-search-documents/azure/search/documents/indexes/models/_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,7 +1843,7 @@ class ChatCompletionSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.C
18431843
appended to the chat completions call. Follows Azure AI Foundry's extensibility pattern.
18441844
:vartype extra_parameters: dict[str, any]
18451845
:ivar extra_parameters_behavior: How extra parameters are handled by Azure AI Foundry. Default
1846-
is 'error'. Known values are: "pass-through", "drop", and "error".
1846+
is 'error'. Known values are: "passThrough", "drop", and "error".
18471847
:vartype extra_parameters_behavior: str or
18481848
~azure.search.documents.indexes.models.ChatCompletionExtraParametersBehavior
18491849
:ivar response_format: Determines how the LLM should format its response. Defaults to 'text'
@@ -1905,7 +1905,7 @@ class ChatCompletionSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.C
19051905
name="extraParametersBehavior", visibility=["read", "create", "update", "delete", "query"]
19061906
)
19071907
"""How extra parameters are handled by Azure AI Foundry. Default is 'error'. Known values are:
1908-
\"pass-through\", \"drop\", and \"error\"."""
1908+
\"passThrough\", \"drop\", and \"error\"."""
19091909
response_format: Optional["_models.ChatCompletionResponseFormat"] = rest_field(
19101910
name="responseFormat", visibility=["read", "create", "update", "delete", "query"]
19111911
)

sdk/search/azure-search-documents/azure/search/documents/indexes/models/_patch.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
from ._models import KnowledgeBase as _KnowledgeBase
1515
from ._enums import (
1616
LexicalAnalyzerName,
17+
OcrSkillLanguage,
1718
SearchFieldDataType as _SearchFieldDataType,
19+
SplitSkillLanguage,
20+
TextTranslationSkillLanguage,
1821
)
1922
from ...knowledgebases.models import (
2023
KnowledgeRetrievalReasoningEffort,
@@ -159,6 +162,22 @@ def _collection_helper(typ: Any) -> str:
159162
SearchFieldDataType = _SearchFieldDataType
160163
SearchFieldDataType.Collection = staticmethod(_collection_helper) # type: ignore[attr-defined]
161164

165+
# Backward-compatible aliases (old camelCase names -> new UPPER_CASE names)
166+
SearchFieldDataType.String = SearchFieldDataType.STRING # type: ignore[attr-defined]
167+
SearchFieldDataType.Int32 = SearchFieldDataType.INT32 # type: ignore[attr-defined]
168+
SearchFieldDataType.Int64 = SearchFieldDataType.INT64 # type: ignore[attr-defined]
169+
SearchFieldDataType.Single = SearchFieldDataType.SINGLE # type: ignore[attr-defined]
170+
SearchFieldDataType.Double = SearchFieldDataType.DOUBLE # type: ignore[attr-defined]
171+
SearchFieldDataType.Boolean = SearchFieldDataType.BOOLEAN # type: ignore[attr-defined]
172+
SearchFieldDataType.DateTimeOffset = SearchFieldDataType.DATE_TIME_OFFSET # type: ignore[attr-defined]
173+
SearchFieldDataType.GeographyPoint = SearchFieldDataType.GEOGRAPHY_POINT # type: ignore[attr-defined]
174+
SearchFieldDataType.ComplexType = SearchFieldDataType.COMPLEX # type: ignore[attr-defined]
175+
176+
# Backward-compatible alias: IS was renamed to IS_ENUM to avoid conflict with Python keyword
177+
OcrSkillLanguage.IS = OcrSkillLanguage.IS_ENUM # type: ignore[attr-defined]
178+
SplitSkillLanguage.IS = SplitSkillLanguage.IS_ENUM # type: ignore[attr-defined]
179+
TextTranslationSkillLanguage.IS = TextTranslationSkillLanguage.IS_ENUM # type: ignore[attr-defined]
180+
162181

163182
def Collection(typ: Any) -> str:
164183
"""Helper function to create a collection type string.
@@ -426,12 +445,15 @@ def ComplexField(
426445

427446
__all__: list[str] = [
428447
"KnowledgeBase",
448+
"OcrSkillLanguage",
429449
"SearchField",
430450
"SearchFieldDataType",
431451
"SearchIndexerDataSourceConnection",
432452
"SimpleField",
433453
"SearchableField",
434454
"ComplexField",
455+
"SplitSkillLanguage",
456+
"TextTranslationSkillLanguage",
435457
] # Add all objects you want publicly available to users at this package level
436458

437459

sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def build_knowledge_base_retrieval_retrieve_request( # pylint: disable=name-too
5252
accept = _headers.pop("Accept", "application/json;odata.metadata=minimal")
5353

5454
# Construct URL
55-
_url = "/retrieve/{knowledgeBaseName}"
55+
_url = "/knowledgebases('{knowledgeBaseName}')/retrieve"
5656
path_format_arguments = {
5757
"knowledgeBaseName": _SERIALIZER.url("knowledge_base_name", knowledge_base_name, "str"),
5858
}

sdk/search/azure-search-documents/azure/search/documents/models/_enums.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# pylint: disable=enum-must-be-uppercase
2-
# # coding=utf-8
1+
# coding=utf-8
32
# --------------------------------------------------------------------------
43
# Copyright (c) Microsoft Corporation. All rights reserved.
54
# Licensed under the MIT License. See License.txt in the project root for license information.
@@ -322,7 +321,7 @@ class ScoringStatistics(str, Enum, metaclass=CaseInsensitiveEnumMeta):
322321

323322
LOCAL = "local"
324323
"""The scoring statistics will be calculated locally for lower latency."""
325-
GLOBALEnum = "global"
324+
GLOBAL_ENUM = "global"
326325
"""The scoring statistics will be calculated globally for more consistent scoring."""
327326

328327

sdk/search/azure-search-documents/azure/search/documents/models/_patch.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
from ._models import IndexDocumentsBatch as IndexDocumentsBatchGenerated
1515
from ._models import IndexAction
16-
from ._enums import IndexActionType
16+
from ._enums import IndexActionType, ScoringStatistics
1717

18+
# Backward-compatible alias: IS was renamed to IS_ENUM to avoid conflict with Python keyword
19+
ScoringStatistics.Global = ScoringStatistics.GLOBAL_ENUM # type: ignore[attr-defined]
1820

1921
def _flatten_args(args: Tuple[Union[List[Dict[Any, Any]], List[List[Dict[Any, Any]]]], ...]) -> List[Dict]:
2022
"""Flatten variadic arguments into a single list of documents.
@@ -204,6 +206,7 @@ def _extend_batch(self, documents: List[Dict], action_type: str) -> List[IndexAc
204206

205207
__all__: list[str] = [
206208
"IndexDocumentsBatch",
209+
"ScoringStatistics",
207210
] # Add all objects you want publicly available to users at this package level
208211

209212

0 commit comments

Comments
 (0)