From 91edac98b20b2e0694ed41b6a5d18e5ee6fb8c81 Mon Sep 17 00:00:00 2001 From: Zixin Yao Date: Sun, 10 May 2026 19:26:41 -0700 Subject: [PATCH 1/5] Regenerate azure-search-documents for 2026-05-01-preview Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../azure-search-documents/_metadata.json | 4 +- .../apiview-properties.json | 99 +- .../azure/search/documents/_client.py | 6 +- .../azure/search/documents/_configuration.py | 8 +- .../documents/_operations/_operations.py | 215 +- .../search/documents/_utils/model_base.py | 6 +- .../azure/search/documents/_validation.py | 66 + .../azure/search/documents/aio/_client.py | 6 +- .../search/documents/aio/_configuration.py | 8 +- .../documents/aio/_operations/_operations.py | 149 +- .../azure/search/documents/indexes/_client.py | 12 +- .../documents/indexes/_configuration.py | 16 +- .../indexes/_operations/_operations.py | 798 ++++- .../documents/indexes/_utils/model_base.py | 6 +- .../search/documents/indexes/aio/_client.py | 12 +- .../documents/indexes/aio/_configuration.py | 16 +- .../indexes/aio/_operations/_operations.py | 524 ++- .../documents/indexes/models/__init__.py | 108 + .../search/documents/indexes/models/_enums.py | 170 + .../documents/indexes/models/_models.py | 3090 ++++++++++++++--- .../documents/knowledgebases/_client.py | 6 +- .../knowledgebases/_configuration.py | 8 +- .../knowledgebases/_operations/_operations.py | 53 +- .../knowledgebases/_utils/model_base.py | 6 +- .../documents/knowledgebases/aio/_client.py | 6 +- .../knowledgebases/aio/_configuration.py | 8 +- .../aio/_operations/_operations.py | 45 +- .../knowledgebases/models/__init__.py | 38 + .../documents/knowledgebases/models/_enums.py | 37 + .../knowledgebases/models/_models.py | 1199 ++++++- .../azure/search/documents/models/__init__.py | 20 + .../azure/search/documents/models/_enums.py | 221 ++ .../azure/search/documents/models/_models.py | 520 ++- .../azure-search-documents/pyproject.toml | 2 +- .../azure-search-documents/search/__init__.py | 1 + .../search/models/__init__.py | 32 + .../search/models/_enums.py | 19 + .../search/models/_models.py | 57 + .../search/models/_patch.py | 21 + .../tests/_search_helpers.py | 15 +- .../tests/_search_helpers_async.py | 12 +- ...test_search_client_index_documents_live.py | 8 +- ...earch_client_index_documents_live_async.py | 4 +- .../tests/test_search_client_search_live.py | 5 +- .../test_search_client_search_live_async.py | 9 +- ..._search_index_client_indexes_live_async.py | 4 +- ...ient_knowledge_base_configurations_live.py | 4 +- ...ch_index_client_synonym_maps_live_async.py | 8 +- ...search_indexer_client_data_sources_live.py | 5 +- ..._indexer_client_data_sources_live_async.py | 5 +- .../test_search_indexing_buffered_sender.py | 11 +- ...t_search_indexing_buffered_sender_async.py | 3 +- ...st_search_indexing_buffered_sender_live.py | 4 +- .../azure-search-documents/tsp-location.yaml | 4 +- 54 files changed, 7078 insertions(+), 641 deletions(-) create mode 100644 sdk/search/azure-search-documents/azure/search/documents/_validation.py create mode 100644 sdk/search/azure-search-documents/search/__init__.py create mode 100644 sdk/search/azure-search-documents/search/models/__init__.py create mode 100644 sdk/search/azure-search-documents/search/models/_enums.py create mode 100644 sdk/search/azure-search-documents/search/models/_models.py create mode 100644 sdk/search/azure-search-documents/search/models/_patch.py diff --git a/sdk/search/azure-search-documents/_metadata.json b/sdk/search/azure-search-documents/_metadata.json index c934444e45c6..b41f4dc8e881 100644 --- a/sdk/search/azure-search-documents/_metadata.json +++ b/sdk/search/azure-search-documents/_metadata.json @@ -1,6 +1,6 @@ { - "apiVersion": "2026-04-01", + "apiVersion": "2026-05-01-preview", "apiVersions": { - "Search": "2026-04-01" + "Search": "2026-05-01-preview" } } \ No newline at end of file diff --git a/sdk/search/azure-search-documents/apiview-properties.json b/sdk/search/azure-search-documents/apiview-properties.json index 30e0289a20c5..3475ab3a100e 100644 --- a/sdk/search/azure-search-documents/apiview-properties.json +++ b/sdk/search/azure-search-documents/apiview-properties.json @@ -5,11 +5,15 @@ "azure.search.documents.indexes.models.CognitiveServicesAccount": "Search.CognitiveServicesAccount", "azure.search.documents.indexes.models.AIServicesAccountIdentity": "Search.AIServicesAccountIdentity", "azure.search.documents.indexes.models.AIServicesAccountKey": "Search.AIServicesAccountKey", + "azure.search.documents.indexes.models.AIServicesVisionParameters": "Search.AIServicesVisionParameters", + "azure.search.documents.indexes.models.VectorSearchVectorizer": "Search.VectorSearchVectorizer", + "azure.search.documents.indexes.models.AIServicesVisionVectorizer": "Search.AIServicesVisionVectorizer", "azure.search.documents.indexes.models.AnalyzedTokenInfo": "Search.AnalyzedTokenInfo", "azure.search.documents.indexes.models.AnalyzeResult": "Search.AnalyzeResult", "azure.search.documents.indexes.models.AnalyzeTextOptions": "Search.AnalyzeRequest", "azure.search.documents.indexes.models.TokenFilter": "Search.TokenFilter", "azure.search.documents.indexes.models.AsciiFoldingTokenFilter": "Search.AsciiFoldingTokenFilter", + "azure.search.documents.knowledgebases.models.AssetStore": "Search.AssetStore", "azure.search.documents.models.AutocompleteItem": "Search.AutocompleteItem", "azure.search.documents.indexes.models.AzureActiveDirectoryApplicationCredentials": "Search.AzureActiveDirectoryApplicationCredentials", "azure.search.documents.indexes.models.KnowledgeSource": "Search.KnowledgeSource", @@ -18,10 +22,11 @@ "azure.search.documents.knowledgebases.models.KnowledgeSourceParams": "Search.KnowledgeSourceParams", "azure.search.documents.knowledgebases.models.AzureBlobKnowledgeSourceParams": "Search.AzureBlobKnowledgeSourceParams", "azure.search.documents.indexes.models.AzureMachineLearningParameters": "Search.AMLParameters", - "azure.search.documents.indexes.models.VectorSearchVectorizer": "Search.VectorSearchVectorizer", - "azure.search.documents.indexes.models.AzureMachineLearningVectorizer": "Search.AMLVectorizer", "azure.search.documents.indexes.models.SearchIndexerSkill": "Search.SearchIndexerSkill", + "azure.search.documents.indexes.models.AzureMachineLearningSkill": "Search.AzureMachineLearningSkill", + "azure.search.documents.indexes.models.AzureMachineLearningVectorizer": "Search.AMLVectorizer", "azure.search.documents.indexes.models.AzureOpenAIEmbeddingSkill": "Search.AzureOpenAIEmbeddingSkill", + "azure.search.documents.indexes.models.AzureOpenAITokenizerParameters": "Search.AzureOpenAITokenizerParameters", "azure.search.documents.indexes.models.AzureOpenAIVectorizer": "Search.AzureOpenAIVectorizer", "azure.search.documents.indexes.models.AzureOpenAIVectorizerParameters": "Search.AzureOpenAIVectorizerParameters", "azure.search.documents.indexes.models.VectorSearchCompression": "Search.VectorSearchCompression", @@ -42,6 +47,7 @@ "azure.search.documents.indexes.models.CommonGramTokenFilter": "Search.CommonGramTokenFilter", "azure.search.documents.knowledgebases.models.CompletedSynchronizationState": "Search.CompletedSynchronizationState", "azure.search.documents.indexes.models.ConditionalSkill": "Search.ConditionalSkill", + "azure.search.documents.indexes.models.ContentColumnMapping": "Search.ContentColumnMapping", "azure.search.documents.indexes.models.ContentUnderstandingSkill": "Search.ContentUnderstandingSkill", "azure.search.documents.indexes.models.ContentUnderstandingSkillChunkingProperties": "Search.ContentUnderstandingSkillChunkingProperties", "azure.search.documents.indexes.models.CorsOptions": "Search.CorsOptions", @@ -70,6 +76,7 @@ "azure.search.documents.indexes.models.EdgeNGramTokenFilterV2": "Search.EdgeNGramTokenFilterV2", "azure.search.documents.indexes.models.EdgeNGramTokenizer": "Search.EdgeNGramTokenizer", "azure.search.documents.indexes.models.ElisionTokenFilter": "Search.ElisionTokenFilter", + "azure.search.documents.indexes.models.EmbeddingColumnMapping": "Search.EmbeddingColumnMapping", "azure.search.documents.indexes.models.EntityLinkingSkill": "Search.EntityLinkingSkill", "azure.search.documents.indexes.models.EntityRecognitionSkillV3": "Search.EntityRecognitionSkillV3", "azure.search.documents.models.ErrorAdditionalInfo": "Search.ErrorAdditionalInfo", @@ -78,9 +85,18 @@ "azure.search.documents.indexes.models.VectorSearchAlgorithmConfiguration": "Search.VectorSearchAlgorithmConfiguration", "azure.search.documents.indexes.models.ExhaustiveKnnAlgorithmConfiguration": "Search.ExhaustiveKnnAlgorithmConfiguration", "azure.search.documents.indexes.models.ExhaustiveKnnParameters": "Search.ExhaustiveKnnParameters", + "azure.search.documents.indexes.models.FabricDataAgentKnowledgeSource": "Search.FabricDataAgentKnowledgeSource", + "azure.search.documents.indexes.models.FabricDataAgentKnowledgeSourceParameters": "Search.FabricDataAgentKnowledgeSourceParameters", + "azure.search.documents.knowledgebases.models.FabricDataAgentKnowledgeSourceParams": "Search.FabricDataAgentKnowledgeSourceParams", + "azure.search.documents.indexes.models.FabricOntologyKnowledgeSource": "Search.FabricOntologyKnowledgeSource", + "azure.search.documents.indexes.models.FabricOntologyKnowledgeSourceParameters": "Search.FabricOntologyKnowledgeSourceParameters", + "azure.search.documents.knowledgebases.models.FabricOntologyKnowledgeSourceParams": "Search.FabricOntologyKnowledgeSourceParams", "azure.search.documents.models.FacetResult": "Search.FacetResult", "azure.search.documents.indexes.models.FieldMapping": "Search.FieldMapping", "azure.search.documents.indexes.models.FieldMappingFunction": "Search.FieldMappingFunction", + "azure.search.documents.indexes.models.FileKnowledgeSource": "Search.FileKnowledgeSource", + "azure.search.documents.indexes.models.FileKnowledgeSourceParameters": "Search.FileKnowledgeSourceParameters", + "azure.search.documents.knowledgebases.models.FreshnessPolicy": "Search.FreshnessPolicy", "azure.search.documents.indexes.models.FreshnessScoringFunction": "Search.FreshnessScoringFunction", "azure.search.documents.indexes.models.FreshnessScoringParameters": "Search.FreshnessScoringParameters", "azure.search.documents.indexes.models.GetIndexStatisticsResult": "Search.GetIndexStatisticsResult", @@ -93,12 +109,20 @@ "azure.search.documents.indexes.models.IndexedOneLakeKnowledgeSource": "Search.IndexedOneLakeKnowledgeSource", "azure.search.documents.indexes.models.IndexedOneLakeKnowledgeSourceParameters": "Search.IndexedOneLakeKnowledgeSourceParameters", "azure.search.documents.knowledgebases.models.IndexedOneLakeKnowledgeSourceParams": "Search.IndexedOneLakeKnowledgeSourceParams", + "azure.search.documents.indexes.models.IndexedSharePointKnowledgeSource": "Search.IndexedSharePointKnowledgeSource", + "azure.search.documents.indexes.models.IndexedSharePointKnowledgeSourceParameters": "Search.IndexedSharePointKnowledgeSourceParameters", + "azure.search.documents.knowledgebases.models.IndexedSharePointKnowledgeSourceParams": "Search.IndexedSharePointKnowledgeSourceParams", + "azure.search.documents.indexes.models.IndexedSqlKnowledgeSource": "Search.IndexedSqlKnowledgeSource", + "azure.search.documents.indexes.models.IndexedSqlKnowledgeSourceParameters": "Search.IndexedSqlKnowledgeSourceParameters", + "azure.search.documents.indexes.models.IndexerCurrentState": "Search.IndexerCurrentState", "azure.search.documents.indexes.models.IndexerExecutionResult": "Search.IndexerExecutionResult", "azure.search.documents.indexes.models.IndexerResyncBody": "Search.IndexerResyncBody", + "azure.search.documents.indexes.models.IndexerRuntime": "Search.IndexerRuntime", "azure.search.documents.indexes.models.IndexingParameters": "Search.IndexingParameters", "azure.search.documents.indexes.models.IndexingParametersConfiguration": "Search.IndexingParametersConfiguration", "azure.search.documents.models.IndexingResult": "Search.IndexingResult", "azure.search.documents.indexes.models.IndexingSchedule": "Search.IndexingSchedule", + "azure.search.documents.indexes.models.IndexStatisticsSummary": "Search.IndexStatisticsSummary", "azure.search.documents.indexes.models.InputFieldMappingEntry": "Search.InputFieldMappingEntry", "azure.search.documents.indexes.models.KeepTokenFilter": "Search.KeepTokenFilter", "azure.search.documents.indexes.models.KeyPhraseExtractionSkill": "Search.KeyPhraseExtractionSkill", @@ -114,19 +138,28 @@ "azure.search.documents.indexes.models.KnowledgeBaseAzureOpenAIModel": "Search.KnowledgeBaseAzureOpenAIModel", "azure.search.documents.knowledgebases.models.KnowledgeBaseErrorAdditionalInfo": "Search.KnowledgeBaseErrorAdditionalInfo", "azure.search.documents.knowledgebases.models.KnowledgeBaseErrorDetail": "Search.KnowledgeBaseErrorDetail", + "azure.search.documents.knowledgebases.models.KnowledgeBaseFabricDataAgentReference": "Search.KnowledgeBaseFabricDataAgentReference", + "azure.search.documents.knowledgebases.models.KnowledgeBaseFabricOntologyReference": "Search.KnowledgeBaseFabricOntologyReference", "azure.search.documents.knowledgebases.models.KnowledgeBaseImageContent": "Search.KnowledgeBaseImageContent", "azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedOneLakeReference": "Search.KnowledgeBaseIndexedOneLakeReference", + "azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedSharePointReference": "Search.KnowledgeBaseIndexedSharePointReference", "azure.search.documents.knowledgebases.models.KnowledgeBaseMessage": "Search.KnowledgeBaseMessage", "azure.search.documents.knowledgebases.models.KnowledgeBaseMessageContent": "Search.KnowledgeBaseMessageContent", "azure.search.documents.knowledgebases.models.KnowledgeBaseMessageImageContent": "Search.KnowledgeBaseMessageImageContent", "azure.search.documents.knowledgebases.models.KnowledgeBaseMessageTextContent": "Search.KnowledgeBaseMessageTextContent", + "azure.search.documents.knowledgebases.models.KnowledgeBaseModelAnswerSynthesisActivityRecord": "Search.KnowledgeBaseModelAnswerSynthesisActivityRecord", + "azure.search.documents.knowledgebases.models.KnowledgeBaseModelQueryPlanningActivityRecord": "Search.KnowledgeBaseModelQueryPlanningActivityRecord", "azure.search.documents.knowledgebases.models.KnowledgeBaseModelWebSummarizationActivityRecord": "Search.KnowledgeBaseModelWebSummarizationActivityRecord", + "azure.search.documents.knowledgebases.models.KnowledgeBaseRemoteSharePointReference": "Search.KnowledgeBaseRemoteSharePointReference", "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest": "Search.KnowledgeBaseRetrievalRequest", "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse": "Search.KnowledgeBaseRetrievalResponse", "azure.search.documents.knowledgebases.models.KnowledgeBaseSearchIndexReference": "Search.KnowledgeBaseSearchIndexReference", "azure.search.documents.knowledgebases.models.KnowledgeBaseWebReference": "Search.KnowledgeBaseWebReference", + "azure.search.documents.knowledgebases.models.KnowledgeBaseWorkIQReference": "Search.KnowledgeBaseWorkIQReference", "azure.search.documents.knowledgebases.models.KnowledgeRetrievalIntent": "Search.KnowledgeRetrievalIntent", "azure.search.documents.knowledgebases.models.KnowledgeRetrievalReasoningEffort": "Search.KnowledgeRetrievalReasoningEffort", + "azure.search.documents.knowledgebases.models.KnowledgeRetrievalLowReasoningEffort": "Search.KnowledgeRetrievalLowReasoningEffort", + "azure.search.documents.knowledgebases.models.KnowledgeRetrievalMediumReasoningEffort": "Search.KnowledgeRetrievalMediumReasoningEffort", "azure.search.documents.knowledgebases.models.KnowledgeRetrievalMinimalReasoningEffort": "Search.KnowledgeRetrievalMinimalReasoningEffort", "azure.search.documents.knowledgebases.models.KnowledgeRetrievalSemanticIntent": "Search.KnowledgeRetrievalSemanticIntent", "azure.search.documents.knowledgebases.models.KnowledgeSourceVectorizer": "Search.KnowledgeSourceVectorizer", @@ -146,6 +179,22 @@ "azure.search.documents.indexes.models.MagnitudeScoringFunction": "Search.MagnitudeScoringFunction", "azure.search.documents.indexes.models.MagnitudeScoringParameters": "Search.MagnitudeScoringParameters", "azure.search.documents.indexes.models.MappingCharFilter": "Search.MappingCharFilter", + "azure.search.documents.indexes.models.McpServerAuthentication": "Search.McpServerAuthentication", + "azure.search.documents.indexes.models.McpServerOutputParsing": "Search.McpServerOutputParsing", + "azure.search.documents.indexes.models.McpServerAutoOutputParsing": "Search.McpServerAutoOutputParsing", + "azure.search.documents.indexes.models.McpServerFoundryConnectionAuthentication": "Search.McpServerFoundryConnectionAuthentication", + "azure.search.documents.indexes.models.McpServerFoundryConnectionParameters": "Search.McpServerFoundryConnectionParameters", + "azure.search.documents.indexes.models.McpServerHeaders": "Search.McpServerHeaders", + "azure.search.documents.indexes.models.McpServerJsonOutputParsing": "Search.McpServerJsonOutputParsing", + "azure.search.documents.indexes.models.McpServerKnowledgeSource": "Search.McpServerKnowledgeSource", + "azure.search.documents.indexes.models.McpServerKnowledgeSourceParameters": "Search.McpServerKnowledgeSourceParameters", + "azure.search.documents.indexes.models.McpServerNoneOutputParsing": "Search.McpServerNoneOutputParsing", + "azure.search.documents.indexes.models.McpServerOutputParsingJsonParameters": "Search.McpServerOutputParsingJsonParameters", + "azure.search.documents.indexes.models.McpServerOutputParsingSplitParameters": "Search.McpServerOutputParsingSplitParameters", + "azure.search.documents.indexes.models.McpServerSplitOutputParsing": "Search.McpServerSplitOutputParsing", + "azure.search.documents.indexes.models.McpServerStoredHeadersAuthentication": "Search.McpServerStoredHeadersAuthentication", + "azure.search.documents.indexes.models.McpServerStoredHeadersParameters": "Search.McpServerStoredHeadersParameters", + "azure.search.documents.indexes.models.McpServerTool": "Search.McpServerTool", "azure.search.documents.indexes.models.MergeSkill": "Search.MergeSkill", "azure.search.documents.indexes.models.MicrosoftLanguageStemmingTokenizer": "Search.MicrosoftLanguageStemmingTokenizer", "azure.search.documents.indexes.models.MicrosoftLanguageTokenizer": "Search.MicrosoftLanguageTokenizer", @@ -163,9 +212,16 @@ "azure.search.documents.indexes.models.PatternTokenizer": "Search.PatternTokenizer", "azure.search.documents.indexes.models.PhoneticTokenFilter": "Search.PhoneticTokenFilter", "azure.search.documents.indexes.models.PIIDetectionSkill": "Search.PIIDetectionSkill", + "azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo": "Search.PurviewSensitivityLabelInfo", "azure.search.documents.models.QueryAnswerResult": "Search.QueryAnswerResult", "azure.search.documents.models.QueryCaptionResult": "Search.QueryCaptionResult", + "azure.search.documents.models.QueryResultDocumentInnerHit": "Search.QueryResultDocumentInnerHit", + "azure.search.documents.models.QueryResultDocumentRerankerInput": "Search.QueryResultDocumentRerankerInput", + "azure.search.documents.models.QueryResultDocumentSemanticField": "Search.QueryResultDocumentSemanticField", "azure.search.documents.models.QueryResultDocumentSubscores": "Search.QueryResultDocumentSubscores", + "azure.search.documents.indexes.models.RemoteSharePointKnowledgeSource": "Search.RemoteSharePointKnowledgeSource", + "azure.search.documents.indexes.models.RemoteSharePointKnowledgeSourceParameters": "Search.RemoteSharePointKnowledgeSourceParameters", + "azure.search.documents.knowledgebases.models.RemoteSharePointKnowledgeSourceParams": "Search.RemoteSharePointKnowledgeSourceParams", "azure.search.documents.indexes.models.RescoringOptions": "Search.RescoringOptions", "azure.search.documents.indexes.models.ResourceCounter": "Search.ResourceCounter", "azure.search.documents.indexes.models.ScalarQuantizationCompression": "Search.ScalarQuantizationCompression", @@ -175,6 +231,7 @@ "azure.search.documents.indexes.models.SearchField": "Search.SearchField", "azure.search.documents.indexes.models.SearchIndex": "Search.SearchIndex", "azure.search.documents.indexes.models.SearchIndexer": "Search.SearchIndexer", + "azure.search.documents.indexes.models.SearchIndexerCache": "Search.SearchIndexerCache", "azure.search.documents.indexes.models.SearchIndexerDataContainer": "Search.SearchIndexerDataContainer", "azure.search.documents.indexes.models.SearchIndexerDataIdentity": "Search.SearchIndexerDataIdentity", "azure.search.documents.indexes.models.SearchIndexerDataNoneIdentity": "Search.SearchIndexerDataNoneIdentity", @@ -189,6 +246,7 @@ "azure.search.documents.indexes.models.SearchIndexerKnowledgeStoreBlobProjectionSelector": "Search.SearchIndexerKnowledgeStoreBlobProjectionSelector", "azure.search.documents.indexes.models.SearchIndexerKnowledgeStoreFileProjectionSelector": "Search.SearchIndexerKnowledgeStoreFileProjectionSelector", "azure.search.documents.indexes.models.SearchIndexerKnowledgeStoreObjectProjectionSelector": "Search.SearchIndexerKnowledgeStoreObjectProjectionSelector", + "azure.search.documents.indexes.models.SearchIndexerKnowledgeStoreParameters": "Search.SearchIndexerKnowledgeStoreParameters", "azure.search.documents.indexes.models.SearchIndexerKnowledgeStoreProjection": "Search.SearchIndexerKnowledgeStoreProjection", "azure.search.documents.indexes.models.SearchIndexerKnowledgeStoreTableProjectionSelector": "Search.SearchIndexerKnowledgeStoreTableProjectionSelector", "azure.search.documents.indexes.models.SearchIndexerLimits": "Search.SearchIndexerLimits", @@ -201,16 +259,21 @@ "azure.search.documents.knowledgebases.models.SearchIndexKnowledgeSourceParams": "Search.SearchIndexKnowledgeSourceParams", "azure.search.documents.indexes.models.SearchResourceEncryptionKey": "Search.SearchResourceEncryptionKey", "azure.search.documents.models.SearchResult": "Search.SearchResult", + "azure.search.documents.models.VectorThreshold": "Search.VectorThreshold", + "azure.search.documents.models.SearchScoreThreshold": "Search.SearchScoreThreshold", "azure.search.documents.indexes.models.SearchServiceCounters": "Search.SearchServiceCounters", "azure.search.documents.indexes.models.SearchServiceLimits": "Search.SearchServiceLimits", "azure.search.documents.indexes.models.SearchServiceStatistics": "Search.SearchServiceStatistics", "azure.search.documents.indexes.models.SearchSuggester": "Search.SearchSuggester", "azure.search.documents.indexes.models.SemanticConfiguration": "Search.SemanticConfiguration", + "azure.search.documents.models.SemanticDebugInfo": "Search.SemanticDebugInfo", "azure.search.documents.indexes.models.SemanticField": "Search.SemanticField", "azure.search.documents.indexes.models.SemanticPrioritizedFields": "Search.SemanticPrioritizedFields", "azure.search.documents.indexes.models.SemanticSearch": "Search.SemanticSearch", "azure.search.documents.indexes.models.SentimentSkillV3": "Search.SentimentSkillV3", + "azure.search.documents.indexes.models.ServiceIndexersRuntime": "Search.ServiceIndexersRuntime", "azure.search.documents.indexes.models.ShaperSkill": "Search.ShaperSkill", + "search.models.SharePointConnectorAppRegistration": "Search.SharePointConnectorAppRegistration", "azure.search.documents.indexes.models.ShingleTokenFilter": "Search.ShingleTokenFilter", "azure.search.documents.models.SingleVectorFieldResult": "Search.SingleVectorFieldResult", "azure.search.documents.indexes.models.SkillNames": "Search.SkillNames", @@ -242,6 +305,8 @@ "azure.search.documents.models.VectorsDebugInfo": "Search.VectorsDebugInfo", "azure.search.documents.indexes.models.VectorSearch": "Search.VectorSearch", "azure.search.documents.indexes.models.VectorSearchProfile": "Search.VectorSearchProfile", + "azure.search.documents.models.VectorSimilarityThreshold": "Search.VectorSimilarityThreshold", + "azure.search.documents.indexes.models.VisionVectorizeSkill": "Search.VisionVectorizeSkill", "azure.search.documents.indexes.models.WebApiHttpHeaders": "Search.WebApiHttpHeaders", "azure.search.documents.indexes.models.WebApiSkill": "Search.WebApiSkill", "azure.search.documents.indexes.models.WebApiVectorizer": "Search.WebApiVectorizer", @@ -252,6 +317,9 @@ "azure.search.documents.indexes.models.WebKnowledgeSourceParameters": "Search.WebKnowledgeSourceParameters", "azure.search.documents.knowledgebases.models.WebKnowledgeSourceParams": "Search.WebKnowledgeSourceParams", "azure.search.documents.indexes.models.WordDelimiterTokenFilter": "Search.WordDelimiterTokenFilter", + "azure.search.documents.knowledgebases.models.WorkIQAttribution": "Search.WorkIQAttribution", + "azure.search.documents.indexes.models.WorkIQKnowledgeSource": "Search.WorkIQKnowledgeSource", + "azure.search.documents.knowledgebases.models.WorkIQKnowledgeSourceParams": "Search.WorkIQKnowledgeSourceParams", "azure.search.documents.models.QueryType": "Search.QueryType", "azure.search.documents.models.ScoringStatistics": "Search.ScoringStatistics", "azure.search.documents.models.QueryDebugMode": "Search.QueryDebugMode", @@ -259,13 +327,17 @@ "azure.search.documents.models.SemanticErrorMode": "Search.SemanticErrorMode", "azure.search.documents.models.QueryAnswerType": "Search.QueryAnswerType", "azure.search.documents.models.QueryCaptionType": "Search.QueryCaptionType", + "azure.search.documents.models.QueryRewritesType": "Search.QueryRewritesType", + "azure.search.documents.models.VectorThresholdKind": "Search.VectorThresholdKind", "azure.search.documents.models.VectorQueryKind": "Search.VectorQueryKind", "azure.search.documents.models.VectorFilterMode": "Search.VectorFilterMode", + "azure.search.documents.models.SemanticFieldState": "Search.SemanticFieldState", "azure.search.documents.models.SemanticErrorReason": "Search.SemanticErrorReason", "azure.search.documents.models.SemanticSearchResultsType": "Search.SemanticSearchResultsType", "azure.search.documents.models.IndexActionType": "Search.IndexActionType", "azure.search.documents.models.AutocompleteMode": "Search.AutocompleteMode", "azure.search.documents.models.SearchFieldDataType": "Search.SearchFieldDataType", + "azure.search.documents.models.PermissionFilter": "Search.PermissionFilter", "azure.search.documents.models.LexicalAnalyzerName": "Search.LexicalAnalyzerName", "azure.search.documents.models.LexicalNormalizerName": "Search.LexicalNormalizerName", "azure.search.documents.models.VectorEncodingFormat": "Search.VectorEncodingFormat", @@ -293,11 +365,23 @@ "azure.search.documents.models.VectorSearchCompressionRescoreStorageMethod": "Search.VectorSearchCompressionRescoreStorageMethod", "azure.search.documents.models.VectorSearchCompressionKind": "Search.VectorSearchCompressionKind", "azure.search.documents.models.VectorSearchCompressionTarget": "Search.VectorSearchCompressionTarget", + "azure.search.documents.models.SearchIndexPermissionFilterOption": "Search.SearchIndexPermissionFilterOption", "azure.search.documents.models.KnowledgeBaseModelKind": "Search.KnowledgeBaseModelKind", + "azure.search.documents.models.KnowledgeRetrievalReasoningEffortKind": "Search.KnowledgeRetrievalReasoningEffortKind", + "azure.search.documents.models.KnowledgeRetrievalOutputMode": "Search.KnowledgeRetrievalOutputMode", "azure.search.documents.models.KnowledgeSourceKind": "Search.KnowledgeSourceKind", + "azure.search.documents.models.KnowledgeSourceIngestionPermissionOption": "Search.KnowledgeSourceIngestionPermissionOption", "azure.search.documents.models.KnowledgeSourceContentExtractionMode": "Search.KnowledgeSourceContentExtractionMode", + "azure.search.documents.models.IndexedSharePointContainerName": "Search.IndexedSharePointContainerName", + "azure.search.documents.models.McpServerAuthenticationKind": "Search.McpServerAuthenticationKind", + "azure.search.documents.models.McpServerOutputParsingKind": "Search.McpServerOutputParsingKind", + "azure.search.documents.models.TextSplitMode": "Search.TextSplitMode", + "azure.search.documents.models.SplitSkillLanguage": "Search.SplitSkillLanguage", + "azure.search.documents.models.McpServerToolInclusionMode": "Search.McpServerToolInclusionMode", "azure.search.documents.models.KnowledgeSourceSynchronizationStatus": "Search.KnowledgeSourceSynchronizationStatus", "azure.search.documents.models.SearchIndexerDataSourceType": "Search.SearchIndexerDataSourceType", + "azure.search.documents.models.IndexerPermissionOption": "Search.IndexerPermissionOption", + "azure.search.documents.models.IndexerResyncOption": "Search.IndexerResyncOption", "azure.search.documents.models.BlobIndexerParsingMode": "Search.BlobIndexerParsingMode", "azure.search.documents.models.MarkdownParsingSubmode": "Search.MarkdownParsingSubmode", "azure.search.documents.models.MarkdownHeaderDepth": "Search.MarkdownHeaderDepth", @@ -307,18 +391,21 @@ "azure.search.documents.models.IndexerExecutionEnvironment": "Search.IndexerExecutionEnvironment", "azure.search.documents.models.IndexerStatus": "Search.IndexerStatus", "azure.search.documents.models.IndexerExecutionStatus": "Search.IndexerExecutionStatus", + "azure.search.documents.models.IndexerExecutionStatusDetail": "Search.IndexerExecutionStatusDetail", + "azure.search.documents.models.IndexingMode": "Search.IndexingMode", "azure.search.documents.models.ChatCompletionExtraParametersBehavior": "Search.ChatCompletionExtraParametersBehavior", "azure.search.documents.models.ChatCompletionResponseFormatType": "Search.ChatCompletionResponseFormatType", "azure.search.documents.models.CustomEntityLookupSkillLanguage": "Search.CustomEntityLookupSkillLanguage", "azure.search.documents.models.KeyPhraseExtractionSkillLanguage": "Search.KeyPhraseExtractionSkillLanguage", "azure.search.documents.models.PIIDetectionSkillMaskingMode": "Search.PIIDetectionSkillMaskingMode", - "azure.search.documents.models.SplitSkillLanguage": "Search.SplitSkillLanguage", - "azure.search.documents.models.TextSplitMode": "Search.TextSplitMode", + "azure.search.documents.models.SplitSkillUnit": "Search.SplitSkillUnit", + "azure.search.documents.models.SplitSkillEncoderModelName": "Search.SplitSkillEncoderModelName", "azure.search.documents.models.TextTranslationSkillLanguage": "Search.TextTranslationSkillLanguage", "azure.search.documents.models.EntityCategory": "Search.EntityCategory", "azure.search.documents.models.EntityRecognitionSkillLanguage": "Search.EntityRecognitionSkillLanguage", "azure.search.documents.models.SentimentSkillLanguage": "Search.SentimentSkillLanguage", "azure.search.documents.models.ContentUnderstandingSkillExtractionOptions": "Search.ContentUnderstandingSkillExtractionOptions", + "azure.search.documents.models.ContentUnderstandingSkillChunkingMethod": "Search.ContentUnderstandingSkillChunkingMethod", "azure.search.documents.models.ContentUnderstandingSkillChunkingUnit": "Search.ContentUnderstandingSkillChunkingUnit", "azure.search.documents.models.DocumentIntelligenceLayoutSkillOutputFormat": "Search.DocumentIntelligenceLayoutSkillOutputFormat", "azure.search.documents.models.DocumentIntelligenceLayoutSkillOutputMode": "Search.DocumentIntelligenceLayoutSkillOutputMode", @@ -333,10 +420,8 @@ "azure.search.documents.models.IndexProjectionMode": "Search.IndexProjectionMode", "azure.search.documents.models.KnowledgeBaseMessageContentType": "Search.KnowledgeBaseMessageContentType", "azure.search.documents.models.KnowledgeBaseActivityRecordType": "Search.KnowledgeBaseActivityRecordType", - "azure.search.documents.models.KnowledgeRetrievalReasoningEffortKind": "Search.KnowledgeRetrievalReasoningEffortKind", "azure.search.documents.models.KnowledgeBaseReferenceType": "Search.KnowledgeBaseReferenceType", "azure.search.documents.models.KnowledgeRetrievalIntentType": "Search.KnowledgeRetrievalIntentType", - "azure.search.documents.models.IndexerResyncOption": "Search.IndexerResyncOption", "azure.search.documents.SearchClient.get_document_count": "Customizations.SearchClient.count", "azure.search.documents.aio.SearchClient.get_document_count": "Customizations.SearchClient.count", "azure.search.documents.SearchClient.get_document": "Customizations.SearchClient.get", @@ -371,6 +456,8 @@ "azure.search.documents.aio.SearchIndexClient.get_knowledge_source_status": "Customizations.SearchIndexClient.getKnowledgeSourceStatus", "azure.search.documents.SearchIndexClient.get_service_statistics": "Customizations.SearchIndexClient.getServiceStatistics", "azure.search.documents.aio.SearchIndexClient.get_service_statistics": "Customizations.SearchIndexClient.getServiceStatistics", + "azure.search.documents.SearchIndexClient.list_index_stats_summary": "Customizations.SearchIndexClient.getIndexStatsSummary", + "azure.search.documents.aio.SearchIndexClient.list_index_stats_summary": "Customizations.SearchIndexClient.getIndexStatsSummary", "azure.search.documents.SearchIndexerClient.get_data_source_connection": "Customizations.SearchIndexerClient.getDataSource", "azure.search.documents.aio.SearchIndexerClient.get_data_source_connection": "Customizations.SearchIndexerClient.getDataSource", "azure.search.documents.SearchIndexerClient.create_data_source_connection": "Customizations.SearchIndexerClient.createDataSource", 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 c5cc9a2b81bb..8db5c60f68dd 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_client.py @@ -34,9 +34,9 @@ class SearchClient(_SearchClientOperationsMixin): ~azure.core.credentials.TokenCredential :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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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 3ea0dae262d0..13fad1111791 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_configuration.py @@ -31,16 +31,16 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes ~azure.core.credentials.TokenCredential :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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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"], index_name: str, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2026-04-01") + 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 dbd5421f2a00..815c222495a8 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from io import IOBase import json from typing import Any, Callable, IO, Optional, TypeVar, Union, overload @@ -32,6 +32,7 @@ from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Serializer from .._utils.utils import ClientMixinABC +from .._validation import api_version_validation JSON = MutableMapping[str, Any] _Unset: Any = object() @@ -46,7 +47,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", "2026-04-01")) + 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 @@ -70,6 +71,8 @@ def build_search_get_document_count_request(index_name: str, **kwargs: Any) -> H def build_search_search_get_request( # pylint: disable=too-many-locals,too-many-statements,too-many-branches index_name: str, *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, search_text: Optional[str] = None, include_total_result_count: Optional[bool] = None, facets: Optional[list[str]] = None, @@ -95,13 +98,17 @@ def build_search_search_get_request( # pylint: disable=too-many-locals,too-many answers: Optional[Union[str, _models1.QueryAnswerType]] = None, captions: Optional[Union[str, _models1.QueryCaptionType]] = None, semantic_query: Optional[str] = None, + query_rewrites: Optional[Union[str, _models1.QueryRewritesType]] = None, debug: Optional[Union[str, _models1.QueryDebugMode]] = None, + query_language: Optional[Union[str, _models1._enums.QueryLanguage]] = None, + speller: Optional[Union[str, _models1._enums.QuerySpellerType]] = None, + semantic_fields: Optional[list[str]] = 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-04-01")) + 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 @@ -168,22 +175,42 @@ def build_search_search_get_request( # pylint: disable=too-many-locals,too-many _params["captions"] = _SERIALIZER.query("captions", captions, "str") if semantic_query is not None: _params["semanticQuery"] = _SERIALIZER.query("semantic_query", semantic_query, "str") + if query_rewrites is not None: + _params["queryRewrites"] = _SERIALIZER.query("query_rewrites", query_rewrites, "str") if debug is not None: _params["debug"] = _SERIALIZER.query("debug", debug, "str") + if query_language is not None: + _params["queryLanguage"] = _SERIALIZER.query("query_language", query_language, "str") + if speller is not None: + _params["speller"] = _SERIALIZER.query("speller", speller, "str") + if semantic_fields is not None: + _params["semanticFields"] = _SERIALIZER.query("semantic_fields", semantic_fields, "[str]", div=",") # Construct headers 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" + ) + if enable_elevated_read is not None: + _headers["x-ms-enable-elevated-read"] = _SERIALIZER.header("enable_elevated_read", enable_elevated_read, "bool") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_search_search_post_request(index_name: str, **kwargs: Any) -> HttpRequest: +def build_search_search_post_request( + index_name: str, + *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _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", "2026-04-01")) + 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 @@ -200,6 +227,12 @@ def build_search_search_post_request(index_name: str, **kwargs: Any) -> HttpRequ # Construct headers 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" + ) + if enable_elevated_read is not None: + _headers["x-ms-enable-elevated-read"] = _SERIALIZER.header("enable_elevated_read", enable_elevated_read, "bool") if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -207,12 +240,18 @@ def build_search_search_post_request(index_name: str, **kwargs: Any) -> HttpRequ def build_search_get_document_request( - key: str, index_name: str, *, selected_fields: Optional[list[str]] = None, **kwargs: Any + key: str, + index_name: str, + *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, + selected_fields: Optional[list[str]] = 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-04-01")) + 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 @@ -232,6 +271,12 @@ def build_search_get_document_request( # Construct headers 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" + ) + if enable_elevated_read is not None: + _headers["x-ms-enable-elevated-read"] = _SERIALIZER.header("enable_elevated_read", enable_elevated_read, "bool") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -255,7 +300,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", "2026-04-01")) + 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 @@ -301,7 +346,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", "2026-04-01")) + 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 @@ -329,7 +374,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", "2026-04-01")) + 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 @@ -370,7 +415,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", "2026-04-01")) + 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 +459,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", "2026-04-01")) + 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 @@ -508,9 +553,24 @@ def get_document_count(self, **kwargs: Any) -> int: return deserialized # type: ignore @distributed_trace + @api_version_validation( + params_added_on={ + "2026-05-01-preview": [ + "query_source_authorization", + "enable_elevated_read", + "query_rewrites", + "query_language", + "speller", + "semantic_fields", + ] + }, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) def _search_get( # pylint: disable=too-many-locals self, *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, search_text: Optional[str] = None, include_total_result_count: Optional[bool] = None, facets: Optional[list[str]] = None, @@ -536,11 +596,22 @@ def _search_get( # pylint: disable=too-many-locals answers: Optional[Union[str, _models1.QueryAnswerType]] = None, captions: Optional[Union[str, _models1.QueryCaptionType]] = None, semantic_query: Optional[str] = None, + query_rewrites: Optional[Union[str, _models1.QueryRewritesType]] = None, debug: Optional[Union[str, _models1.QueryDebugMode]] = None, + query_language: Optional[Union[str, _models1._enums.QueryLanguage]] = None, + speller: Optional[Union[str, _models1._enums.QuerySpellerType]] = None, + semantic_fields: Optional[list[str]] = None, **kwargs: Any ) -> _models1._models.SearchDocumentsResult: """Searches for documents in the index. + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str + :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 search_text: A full-text search query expression; Use "*" or omit this parameter to match all documents. Default value is None. :paramtype search_text: str @@ -658,10 +729,33 @@ def _search_get( # pylint: disable=too-many-locals is a need to use different queries between the base retrieval and ranking phase, and the L2 semantic phase. Default value is None. :paramtype semantic_query: str + :keyword query_rewrites: When QueryRewrites is set to ``generative``, the query terms are sent + to a generate model which will produce 10 (default) rewrites to help increase the recall of the + request. The requested count can be configured by appending the pipe character ``|`` followed + by the ``count-`` option, such as ``generative|count-3``. Defaults to + ``None``. This parameter is only valid if the query type is ``semantic``. Known values are: + "none" and "generative". Default value is None. + :paramtype query_rewrites: str or ~azure.search.documents.models.QueryRewritesType :keyword debug: Enables a debugging tool that can be used to further explore your search results. Known values are: "disabled", "semantic", "vector", "queryRewrites", "innerHits", and "all". Default value is None. :paramtype debug: str or ~azure.search.documents.models.QueryDebugMode + :keyword query_language: The language of the query. Known values are: "none", "en-us", "en-gb", + "en-in", "en-ca", "en-au", "fr-fr", "fr-ca", "de-de", "es-es", "es-mx", "zh-cn", "zh-tw", + "pt-br", "pt-pt", "it-it", "ja-jp", "ko-kr", "ru-ru", "cs-cz", "nl-be", "nl-nl", "hu-hu", + "pl-pl", "sv-se", "tr-tr", "hi-in", "ar-sa", "ar-eg", "ar-ma", "ar-kw", "ar-jo", "da-dk", + "no-no", "bg-bg", "hr-hr", "hr-ba", "ms-my", "ms-bn", "sl-sl", "ta-in", "vi-vn", "el-gr", + "ro-ro", "is-is", "id-id", "th-th", "lt-lt", "uk-ua", "lv-lv", "et-ee", "ca-es", "fi-fi", + "sr-ba", "sr-me", "sr-rs", "sk-sk", "nb-no", "hy-am", "bn-in", "eu-es", "gl-es", "gu-in", + "he-il", "ga-ie", "kn-in", "ml-in", "mr-in", "fa-ae", "pa-in", "te-in", and "ur-pk". Default + value is None. + :paramtype query_language: str or ~azure.search.documents.models.QueryLanguage + :keyword speller: Improve search recall by spell-correcting individual search query terms. + Known values are: "none" and "lexicon". Default value is None. + :paramtype speller: str or ~azure.search.documents.models.QuerySpellerType + :keyword semantic_fields: The list of field names used for semantic ranking. Default value is + None. + :paramtype semantic_fields: list[str] :return: SearchDocumentsResult. The SearchDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models._models.SearchDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: @@ -681,6 +775,8 @@ def _search_get( # pylint: disable=too-many-locals _request = build_search_search_get_request( index_name=self._config.index_name, + query_source_authorization=query_source_authorization, + enable_elevated_read=enable_elevated_read, search_text=search_text, include_total_result_count=include_total_result_count, facets=facets, @@ -706,7 +802,11 @@ def _search_get( # pylint: disable=too-many-locals answers=answers, captions=captions, semantic_query=semantic_query, + query_rewrites=query_rewrites, debug=debug, + query_language=query_language, + speller=speller, + semantic_fields=semantic_fields, api_version=self._config.api_version, headers=_headers, params=_params, @@ -753,6 +853,8 @@ def _search_get( # pylint: disable=too-many-locals def _search_post( # pylint: disable=too-many-locals self, *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, content_type: str = "application/json", include_total_count: Optional[bool] = None, facets: Optional[list[str]] = None, @@ -771,6 +873,8 @@ def _search_post( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, _models1.SearchMode]] = None, + query_language: Optional[Union[str, _models1._enums.QueryLanguage]] = None, + query_speller: Optional[Union[str, _models1._enums.QuerySpellerType]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -780,24 +884,45 @@ def _search_post( # pylint: disable=too-many-locals semantic_query: Optional[str] = None, answers: Optional[Union[str, _models1.QueryAnswerType]] = None, captions: Optional[Union[str, _models1.QueryCaptionType]] = None, + query_rewrites: Optional[Union[str, _models1.QueryRewritesType]] = None, + semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list[_models1.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models1.VectorFilterMode]] = None, + hybrid_search: Optional[_models1._models.HybridSearch] = None, **kwargs: Any ) -> _models1._models.SearchDocumentsResult: ... @overload def _search_post( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + body: JSON, + *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models1._models.SearchDocumentsResult: ... @overload def _search_post( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + body: IO[bytes], + *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models1._models.SearchDocumentsResult: ... @distributed_trace + @api_version_validation( + params_added_on={"2026-05-01-preview": ["query_source_authorization", "enable_elevated_read"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) def _search_post( # pylint: disable=too-many-locals self, body: Union[JSON, IO[bytes]] = _Unset, *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, include_total_count: Optional[bool] = None, facets: Optional[list[str]] = None, filter: Optional[str] = None, @@ -815,6 +940,8 @@ def _search_post( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, _models1.SearchMode]] = None, + query_language: Optional[Union[str, _models1._enums.QueryLanguage]] = None, + query_speller: Optional[Union[str, _models1._enums.QuerySpellerType]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -824,14 +951,24 @@ def _search_post( # pylint: disable=too-many-locals semantic_query: Optional[str] = None, answers: Optional[Union[str, _models1.QueryAnswerType]] = None, captions: Optional[Union[str, _models1.QueryCaptionType]] = None, + query_rewrites: Optional[Union[str, _models1.QueryRewritesType]] = None, + semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list[_models1.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models1.VectorFilterMode]] = None, + hybrid_search: Optional[_models1._models.HybridSearch] = None, **kwargs: Any ) -> _models1._models.SearchDocumentsResult: """Searches for documents in the index. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str + :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 include_total_count: A value that specifies whether to fetch the total count of results. Default is false. Setting this value to true may have a performance impact. Note that the count returned is an approximation. Default value is None. @@ -905,6 +1042,19 @@ def _search_post( # pylint: disable=too-many-locals matched in order to count the document as a match. Known values are: "any" and "all". Default value is None. :paramtype search_mode: str or ~azure.search.documents.models.SearchMode + :keyword query_language: A value that specifies the language of the search query. Known values + are: "none", "en-us", "en-gb", "en-in", "en-ca", "en-au", "fr-fr", "fr-ca", "de-de", "es-es", + "es-mx", "zh-cn", "zh-tw", "pt-br", "pt-pt", "it-it", "ja-jp", "ko-kr", "ru-ru", "cs-cz", + "nl-be", "nl-nl", "hu-hu", "pl-pl", "sv-se", "tr-tr", "hi-in", "ar-sa", "ar-eg", "ar-ma", + "ar-kw", "ar-jo", "da-dk", "no-no", "bg-bg", "hr-hr", "hr-ba", "ms-my", "ms-bn", "sl-sl", + "ta-in", "vi-vn", "el-gr", "ro-ro", "is-is", "id-id", "th-th", "lt-lt", "uk-ua", "lv-lv", + "et-ee", "ca-es", "fi-fi", "sr-ba", "sr-me", "sr-rs", "sk-sk", "nb-no", "hy-am", "bn-in", + "eu-es", "gl-es", "gu-in", "he-il", "ga-ie", "kn-in", "ml-in", "mr-in", "fa-ae", "pa-in", + "te-in", and "ur-pk". Default value is None. + :paramtype query_language: str or ~azure.search.documents.models.QueryLanguage + :keyword query_speller: A value that specifies the type of the speller to use to spell-correct + individual search query terms. Known values are: "none" and "lexicon". Default value is None. + :paramtype query_speller: str or ~azure.search.documents.models.QuerySpellerType :keyword select: The comma-separated list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema are included. Default value is None. :paramtype select: list[str] @@ -940,6 +1090,12 @@ def _search_post( # pylint: disable=too-many-locals :keyword captions: A value that specifies whether captions should be returned as part of the search response. Known values are: "none" and "extractive". Default value is None. :paramtype captions: str or ~azure.search.documents.models.QueryCaptionType + :keyword query_rewrites: A value that specifies whether query rewrites should be generated to + augment the search query. Known values are: "none" and "generative". Default value is None. + :paramtype query_rewrites: str or ~azure.search.documents.models.QueryRewritesType + :keyword semantic_fields: The comma-separated list of field names used for semantic ranking. + Default value is None. + :paramtype semantic_fields: list[str] :keyword vector_queries: The query parameters for vector and hybrid search queries. Default value is None. :paramtype vector_queries: list[~azure.search.documents.models.VectorQuery] @@ -947,6 +1103,9 @@ def _search_post( # pylint: disable=too-many-locals vector search is performed. Default is 'preFilter' for new indexes. Known values are: "postFilter", "preFilter", and "strictPostFilter". Default value is None. :paramtype vector_filter_mode: str or ~azure.search.documents.models.VectorFilterMode + :keyword hybrid_search: The query parameters to configure hybrid search behaviors. Default + value is None. + :paramtype hybrid_search: ~azure.search.documents.models._models.HybridSearch :return: SearchDocumentsResult. The SearchDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models._models.SearchDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: @@ -976,8 +1135,11 @@ def _search_post( # pylint: disable=too-many-locals "highlight": highlight_fields, "highlightPostTag": highlight_post_tag, "highlightPreTag": highlight_pre_tag, + "hybridSearch": hybrid_search, "minimumCoverage": minimum_coverage, "orderby": order_by, + "queryLanguage": query_language, + "queryRewrites": query_rewrites, "queryType": query_type, "scoringParameters": scoring_parameters, "scoringProfile": scoring_profile, @@ -988,10 +1150,12 @@ def _search_post( # pylint: disable=too-many-locals "select": select, "semanticConfiguration": semantic_configuration_name, "semanticErrorHandling": semantic_error_handling, + "semanticFields": semantic_fields, "semanticMaxWaitInMilliseconds": semantic_max_wait_in_milliseconds, "semanticQuery": semantic_query, "sessionId": session_id, "skip": skip, + "speller": query_speller, "top": top, "vectorFilterMode": vector_filter_mode, "vectorQueries": vector_queries, @@ -1006,6 +1170,8 @@ def _search_post( # pylint: disable=too-many-locals _request = build_search_search_post_request( index_name=self._config.index_name, + query_source_authorization=query_source_authorization, + enable_elevated_read=enable_elevated_read, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -1051,13 +1217,30 @@ def _search_post( # pylint: disable=too-many-locals return deserialized # type: ignore @distributed_trace + @api_version_validation( + params_added_on={"2026-05-01-preview": ["query_source_authorization", "enable_elevated_read"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) def get_document( - self, key: str, *, selected_fields: Optional[list[str]] = None, **kwargs: Any + self, + key: str, + *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, + selected_fields: Optional[list[str]] = None, + **kwargs: Any ) -> _models1.LookupDocument: """Retrieves a document from the index. :param key: The key of the document to retrieve. Required. :type key: str + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str + :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 selected_fields: List of field names to retrieve for the document; Any field not retrieved will be missing from the returned document. Default value is None. :paramtype selected_fields: list[str] @@ -1081,6 +1264,8 @@ def get_document( _request = build_search_get_document_request( key=key, index_name=self._config.index_name, + query_source_authorization=query_source_authorization, + enable_elevated_read=enable_elevated_read, selected_fields=selected_fields, api_version=self._config.api_version, headers=_headers, 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 da7d731af565..db24930fdca9 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 @@ -22,7 +22,7 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -600,7 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: for rest_field in self._attr_to_rest_field.values() if rest_field._default is not _UNSET } - if args: # pylint: disable=too-many-nested-blocks + if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) else: @@ -710,7 +710,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint: disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: 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 0ad3c296ac7d..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 @@ -34,9 +34,9 @@ class SearchClient(_SearchClientOperationsMixin): ~azure.core.credentials_async.AsyncTokenCredential :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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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 b5126bda675f..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 @@ -31,9 +31,9 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes ~azure.core.credentials_async.AsyncTokenCredential :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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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", "2026-04-01") + 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 adf0bea3c777..04e85b9b0d7b 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from io import IOBase import json from typing import Any, Callable, IO, Optional, TypeVar, Union, overload @@ -41,6 +41,7 @@ ) from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.utils import ClientMixinABC +from ..._validation import api_version_validation from .._configuration import SearchClientConfiguration JSON = MutableMapping[str, Any] @@ -120,9 +121,24 @@ async def get_document_count(self, **kwargs: Any) -> int: return deserialized # type: ignore @distributed_trace_async + @api_version_validation( + params_added_on={ + "2026-05-01-preview": [ + "query_source_authorization", + "enable_elevated_read", + "query_rewrites", + "query_language", + "speller", + "semantic_fields", + ] + }, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) async def _search_get( # pylint: disable=too-many-locals self, *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, search_text: Optional[str] = None, include_total_result_count: Optional[bool] = None, facets: Optional[list[str]] = None, @@ -148,11 +164,22 @@ async def _search_get( # pylint: disable=too-many-locals answers: Optional[Union[str, _models2.QueryAnswerType]] = None, captions: Optional[Union[str, _models2.QueryCaptionType]] = None, semantic_query: Optional[str] = None, + query_rewrites: Optional[Union[str, _models2.QueryRewritesType]] = None, debug: Optional[Union[str, _models2.QueryDebugMode]] = None, + query_language: Optional[Union[str, _models2._enums.QueryLanguage]] = None, + speller: Optional[Union[str, _models2._enums.QuerySpellerType]] = None, + semantic_fields: Optional[list[str]] = None, **kwargs: Any ) -> _models2._models.SearchDocumentsResult: """Searches for documents in the index. + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str + :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 search_text: A full-text search query expression; Use "*" or omit this parameter to match all documents. Default value is None. :paramtype search_text: str @@ -270,10 +297,33 @@ async def _search_get( # pylint: disable=too-many-locals is a need to use different queries between the base retrieval and ranking phase, and the L2 semantic phase. Default value is None. :paramtype semantic_query: str + :keyword query_rewrites: When QueryRewrites is set to ``generative``, the query terms are sent + to a generate model which will produce 10 (default) rewrites to help increase the recall of the + request. The requested count can be configured by appending the pipe character ``|`` followed + by the ``count-`` option, such as ``generative|count-3``. Defaults to + ``None``. This parameter is only valid if the query type is ``semantic``. Known values are: + "none" and "generative". Default value is None. + :paramtype query_rewrites: str or ~azure.search.documents.models.QueryRewritesType :keyword debug: Enables a debugging tool that can be used to further explore your search results. Known values are: "disabled", "semantic", "vector", "queryRewrites", "innerHits", and "all". Default value is None. :paramtype debug: str or ~azure.search.documents.models.QueryDebugMode + :keyword query_language: The language of the query. Known values are: "none", "en-us", "en-gb", + "en-in", "en-ca", "en-au", "fr-fr", "fr-ca", "de-de", "es-es", "es-mx", "zh-cn", "zh-tw", + "pt-br", "pt-pt", "it-it", "ja-jp", "ko-kr", "ru-ru", "cs-cz", "nl-be", "nl-nl", "hu-hu", + "pl-pl", "sv-se", "tr-tr", "hi-in", "ar-sa", "ar-eg", "ar-ma", "ar-kw", "ar-jo", "da-dk", + "no-no", "bg-bg", "hr-hr", "hr-ba", "ms-my", "ms-bn", "sl-sl", "ta-in", "vi-vn", "el-gr", + "ro-ro", "is-is", "id-id", "th-th", "lt-lt", "uk-ua", "lv-lv", "et-ee", "ca-es", "fi-fi", + "sr-ba", "sr-me", "sr-rs", "sk-sk", "nb-no", "hy-am", "bn-in", "eu-es", "gl-es", "gu-in", + "he-il", "ga-ie", "kn-in", "ml-in", "mr-in", "fa-ae", "pa-in", "te-in", and "ur-pk". Default + value is None. + :paramtype query_language: str or ~azure.search.documents.models.QueryLanguage + :keyword speller: Improve search recall by spell-correcting individual search query terms. + Known values are: "none" and "lexicon". Default value is None. + :paramtype speller: str or ~azure.search.documents.models.QuerySpellerType + :keyword semantic_fields: The list of field names used for semantic ranking. Default value is + None. + :paramtype semantic_fields: list[str] :return: SearchDocumentsResult. The SearchDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models._models.SearchDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: @@ -293,6 +343,8 @@ async def _search_get( # pylint: disable=too-many-locals _request = build_search_search_get_request( index_name=self._config.index_name, + query_source_authorization=query_source_authorization, + enable_elevated_read=enable_elevated_read, search_text=search_text, include_total_result_count=include_total_result_count, facets=facets, @@ -318,7 +370,11 @@ async def _search_get( # pylint: disable=too-many-locals answers=answers, captions=captions, semantic_query=semantic_query, + query_rewrites=query_rewrites, debug=debug, + query_language=query_language, + speller=speller, + semantic_fields=semantic_fields, api_version=self._config.api_version, headers=_headers, params=_params, @@ -365,6 +421,8 @@ async def _search_get( # pylint: disable=too-many-locals async def _search_post( # pylint: disable=too-many-locals self, *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, content_type: str = "application/json", include_total_count: Optional[bool] = None, facets: Optional[list[str]] = None, @@ -383,6 +441,8 @@ async def _search_post( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, _models2.SearchMode]] = None, + query_language: Optional[Union[str, _models2._enums.QueryLanguage]] = None, + query_speller: Optional[Union[str, _models2._enums.QuerySpellerType]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -392,24 +452,45 @@ async def _search_post( # pylint: disable=too-many-locals semantic_query: Optional[str] = None, answers: Optional[Union[str, _models2.QueryAnswerType]] = None, captions: Optional[Union[str, _models2.QueryCaptionType]] = None, + query_rewrites: Optional[Union[str, _models2.QueryRewritesType]] = None, + semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list[_models2.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models2.VectorFilterMode]] = None, + hybrid_search: Optional[_models2._models.HybridSearch] = None, **kwargs: Any ) -> _models2._models.SearchDocumentsResult: ... @overload async def _search_post( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + body: JSON, + *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models2._models.SearchDocumentsResult: ... @overload async def _search_post( - self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + body: IO[bytes], + *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models2._models.SearchDocumentsResult: ... @distributed_trace_async + @api_version_validation( + params_added_on={"2026-05-01-preview": ["query_source_authorization", "enable_elevated_read"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) async def _search_post( # pylint: disable=too-many-locals self, body: Union[JSON, IO[bytes]] = _Unset, *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, include_total_count: Optional[bool] = None, facets: Optional[list[str]] = None, filter: Optional[str] = None, @@ -427,6 +508,8 @@ async def _search_post( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, _models2.SearchMode]] = None, + query_language: Optional[Union[str, _models2._enums.QueryLanguage]] = None, + query_speller: Optional[Union[str, _models2._enums.QuerySpellerType]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -436,14 +519,24 @@ async def _search_post( # pylint: disable=too-many-locals semantic_query: Optional[str] = None, answers: Optional[Union[str, _models2.QueryAnswerType]] = None, captions: Optional[Union[str, _models2.QueryCaptionType]] = None, + query_rewrites: Optional[Union[str, _models2.QueryRewritesType]] = None, + semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list[_models2.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models2.VectorFilterMode]] = None, + hybrid_search: Optional[_models2._models.HybridSearch] = None, **kwargs: Any ) -> _models2._models.SearchDocumentsResult: """Searches for documents in the index. :param body: Is either a JSON type or a IO[bytes] type. Required. :type body: JSON or IO[bytes] + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str + :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 include_total_count: A value that specifies whether to fetch the total count of results. Default is false. Setting this value to true may have a performance impact. Note that the count returned is an approximation. Default value is None. @@ -517,6 +610,19 @@ async def _search_post( # pylint: disable=too-many-locals matched in order to count the document as a match. Known values are: "any" and "all". Default value is None. :paramtype search_mode: str or ~azure.search.documents.models.SearchMode + :keyword query_language: A value that specifies the language of the search query. Known values + are: "none", "en-us", "en-gb", "en-in", "en-ca", "en-au", "fr-fr", "fr-ca", "de-de", "es-es", + "es-mx", "zh-cn", "zh-tw", "pt-br", "pt-pt", "it-it", "ja-jp", "ko-kr", "ru-ru", "cs-cz", + "nl-be", "nl-nl", "hu-hu", "pl-pl", "sv-se", "tr-tr", "hi-in", "ar-sa", "ar-eg", "ar-ma", + "ar-kw", "ar-jo", "da-dk", "no-no", "bg-bg", "hr-hr", "hr-ba", "ms-my", "ms-bn", "sl-sl", + "ta-in", "vi-vn", "el-gr", "ro-ro", "is-is", "id-id", "th-th", "lt-lt", "uk-ua", "lv-lv", + "et-ee", "ca-es", "fi-fi", "sr-ba", "sr-me", "sr-rs", "sk-sk", "nb-no", "hy-am", "bn-in", + "eu-es", "gl-es", "gu-in", "he-il", "ga-ie", "kn-in", "ml-in", "mr-in", "fa-ae", "pa-in", + "te-in", and "ur-pk". Default value is None. + :paramtype query_language: str or ~azure.search.documents.models.QueryLanguage + :keyword query_speller: A value that specifies the type of the speller to use to spell-correct + individual search query terms. Known values are: "none" and "lexicon". Default value is None. + :paramtype query_speller: str or ~azure.search.documents.models.QuerySpellerType :keyword select: The comma-separated list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema are included. Default value is None. :paramtype select: list[str] @@ -552,6 +658,12 @@ async def _search_post( # pylint: disable=too-many-locals :keyword captions: A value that specifies whether captions should be returned as part of the search response. Known values are: "none" and "extractive". Default value is None. :paramtype captions: str or ~azure.search.documents.models.QueryCaptionType + :keyword query_rewrites: A value that specifies whether query rewrites should be generated to + augment the search query. Known values are: "none" and "generative". Default value is None. + :paramtype query_rewrites: str or ~azure.search.documents.models.QueryRewritesType + :keyword semantic_fields: The comma-separated list of field names used for semantic ranking. + Default value is None. + :paramtype semantic_fields: list[str] :keyword vector_queries: The query parameters for vector and hybrid search queries. Default value is None. :paramtype vector_queries: list[~azure.search.documents.models.VectorQuery] @@ -559,6 +671,9 @@ async def _search_post( # pylint: disable=too-many-locals vector search is performed. Default is 'preFilter' for new indexes. Known values are: "postFilter", "preFilter", and "strictPostFilter". Default value is None. :paramtype vector_filter_mode: str or ~azure.search.documents.models.VectorFilterMode + :keyword hybrid_search: The query parameters to configure hybrid search behaviors. Default + value is None. + :paramtype hybrid_search: ~azure.search.documents.models._models.HybridSearch :return: SearchDocumentsResult. The SearchDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models._models.SearchDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: @@ -588,8 +703,11 @@ async def _search_post( # pylint: disable=too-many-locals "highlight": highlight_fields, "highlightPostTag": highlight_post_tag, "highlightPreTag": highlight_pre_tag, + "hybridSearch": hybrid_search, "minimumCoverage": minimum_coverage, "orderby": order_by, + "queryLanguage": query_language, + "queryRewrites": query_rewrites, "queryType": query_type, "scoringParameters": scoring_parameters, "scoringProfile": scoring_profile, @@ -600,10 +718,12 @@ async def _search_post( # pylint: disable=too-many-locals "select": select, "semanticConfiguration": semantic_configuration_name, "semanticErrorHandling": semantic_error_handling, + "semanticFields": semantic_fields, "semanticMaxWaitInMilliseconds": semantic_max_wait_in_milliseconds, "semanticQuery": semantic_query, "sessionId": session_id, "skip": skip, + "speller": query_speller, "top": top, "vectorFilterMode": vector_filter_mode, "vectorQueries": vector_queries, @@ -618,6 +738,8 @@ async def _search_post( # pylint: disable=too-many-locals _request = build_search_search_post_request( index_name=self._config.index_name, + query_source_authorization=query_source_authorization, + enable_elevated_read=enable_elevated_read, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -663,13 +785,30 @@ async def _search_post( # pylint: disable=too-many-locals return deserialized # type: ignore @distributed_trace_async + @api_version_validation( + params_added_on={"2026-05-01-preview": ["query_source_authorization", "enable_elevated_read"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) async def get_document( - self, key: str, *, selected_fields: Optional[list[str]] = None, **kwargs: Any + self, + key: str, + *, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, + selected_fields: Optional[list[str]] = None, + **kwargs: Any ) -> _models2.LookupDocument: """Retrieves a document from the index. :param key: The key of the document to retrieve. Required. :type key: str + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str + :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 selected_fields: List of field names to retrieve for the document; Any field not retrieved will be missing from the returned document. Default value is None. :paramtype selected_fields: list[str] @@ -693,6 +832,8 @@ async def get_document( _request = build_search_get_document_request( key=key, index_name=self._config.index_name, + query_source_authorization=query_source_authorization, + enable_elevated_read=enable_elevated_read, selected_fields=selected_fields, api_version=self._config.api_version, headers=_headers, 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 10ea1490ae1b..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 @@ -32,9 +32,9 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): 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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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 """ @@ -111,9 +111,9 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin): 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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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 77b8c6458a1a..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 @@ -29,14 +29,14 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri 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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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", "2026-04-01") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -84,14 +84,14 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att 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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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", "2026-04-01") + 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 6d991dd232df..c1f60e96e76f 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from io import IOBase import json from typing import Any, Callable, IO, Literal, Optional, TypeVar, Union, overload @@ -35,6 +35,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 +55,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", "2026-04-01")) + 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 +91,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", "2026-04-01")) + 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 +124,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", "2026-04-01")) + 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 +151,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", "2026-04-01")) + 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 +174,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", "2026-04-01")) + 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 +205,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", "2026-04-01")) + 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 +243,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", "2026-04-01")) + 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 +274,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", "2026-04-01")) + 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 @@ -294,11 +295,13 @@ def build_search_index_get_index_request(name: str, **kwargs: Any) -> HttpReques return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_search_index_list_indexes_request(**kwargs: Any) -> HttpRequest: +def build_search_index_list_indexes_request( + *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = 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-04-01")) + 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 @@ -306,6 +309,12 @@ def build_search_index_list_indexes_request(**kwargs: Any) -> HttpRequest: # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if count is not None: + _params["$count"] = _SERIALIZER.query("count", count, "bool") # Construct headers if accept is not None: @@ -315,12 +324,17 @@ def build_search_index_list_indexes_request(**kwargs: Any) -> HttpRequest: def build_search_index_list_indexes_with_selected_properties_request( # pylint: disable=name-too-long - *, select: Optional[list[str]] = None, **kwargs: Any + *, + select: Optional[list[str]] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + count: Optional[bool] = 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-04-01")) + 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 @@ -330,6 +344,12 @@ def build_search_index_list_indexes_with_selected_properties_request( # pylint: _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if select is not None: _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if count is not None: + _params["$count"] = _SERIALIZER.query("count", count, "bool") # Construct headers if accept is not None: @@ -343,7 +363,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", "2026-04-01")) + 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 +387,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", "2026-04-01")) + 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 +413,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", "2026-04-01")) + 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 +444,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", "2026-04-01")) + 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 +480,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", "2026-04-01")) + 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 +511,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", "2026-04-01")) + 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 +536,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", "2026-04-01")) + 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 +557,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", "2026-04-01")) + 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 +583,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", "2026-04-01")) + 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 +619,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", "2026-04-01")) + 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 +652,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", "2026-04-01")) + 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 +677,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", "2026-04-01")) + 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 +698,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", "2026-04-01")) + 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 +724,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", "2026-04-01")) + 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 +760,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", "2026-04-01")) + 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 +793,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", "2026-04-01")) + 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 +818,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", "2026-04-01")) + 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 +839,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", "2026-04-01")) + 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 +863,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", "2026-04-01")) + 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 +888,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", "2026-04-01")) + 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 @@ -884,15 +904,48 @@ def build_search_index_get_service_statistics_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_search_index_list_index_stats_summary_request( # pylint: disable=name-too-long + *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = 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 = "/indexstats" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "int") + if count is not None: + _params["$count"] = _SERIALIZER.query("count", count, "bool") + + # 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, *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any + name: str, + *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 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", "2026-04-01")) + 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 @@ -905,6 +958,10 @@ def build_search_indexer_create_or_update_data_source_connection_request( # pyl # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_indexer_reset_requirement_for_cache is not None: + _params["ignoreResetRequirements"] = _SERIALIZER.query( + "skip_indexer_reset_requirement_for_cache", skip_indexer_reset_requirement_for_cache, "bool" + ) # Construct headers if accept is not None: @@ -928,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", "2026-04-01")) + 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 @@ -961,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", "2026-04-01")) + 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 @@ -988,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", "2026-04-01")) + 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 @@ -1013,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", "2026-04-01")) + 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 @@ -1037,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", "2026-04-01")) + 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 @@ -1058,11 +1115,71 @@ def build_search_indexer_reset_indexer_request( # pylint: disable=name-too-long return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_search_indexer_resync_request(name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _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", "2026-05-01-preview")) + accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") + + # Construct URL + _url = "/indexers('{indexerName}')/search.resync" + path_format_arguments = { + "indexerName": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + 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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_search_indexer_reset_documents_request( # pylint: disable=name-too-long + name: str, *, overwrite: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _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", "2026-05-01-preview")) + accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") + + # Construct URL + _url = "/indexers('{indexerName}')/search.resetdocs" + path_format_arguments = { + "indexerName": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if overwrite is not None: + _params["overwrite"] = _SERIALIZER.query("overwrite", overwrite, "bool") + + # Construct headers + 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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_search_indexer_run_indexer_request(name: str, **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-04-01")) + 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 @@ -1084,14 +1201,20 @@ def build_search_indexer_run_indexer_request(name: str, **kwargs: Any) -> HttpRe def build_search_indexer_create_or_update_indexer_request( # pylint: disable=name-too-long - name: str, *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any + name: str, + *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 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", "2026-04-01")) + 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 @@ -1104,6 +1227,14 @@ def build_search_indexer_create_or_update_indexer_request( # pylint: disable=na # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_indexer_reset_requirement_for_cache is not None: + _params["ignoreResetRequirements"] = _SERIALIZER.query( + "skip_indexer_reset_requirement_for_cache", skip_indexer_reset_requirement_for_cache, "bool" + ) + if disable_cache_reprocessing_change_detection is not None: + _params["disableCacheReprocessingChangeDetection"] = _SERIALIZER.query( + "disable_cache_reprocessing_change_detection", disable_cache_reprocessing_change_detection, "bool" + ) # Construct headers if accept is not None: @@ -1127,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", "2026-04-01")) + 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 @@ -1158,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", "2026-04-01")) + 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 @@ -1185,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", "2026-04-01")) + 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 @@ -1208,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", "2026-04-01")) + 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 @@ -1232,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", "2026-04-01")) + 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 @@ -1254,14 +1385,20 @@ def build_search_indexer_get_indexer_status_request( # pylint: disable=name-too def build_search_indexer_create_or_update_skillset_request( # pylint: disable=name-too-long - name: str, *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any + name: str, + *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, + etag: Optional[str] = None, + match_condition: Optional[MatchConditions] = None, + **kwargs: Any, ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 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", "2026-04-01")) + 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 @@ -1274,6 +1411,14 @@ def build_search_indexer_create_or_update_skillset_request( # pylint: disable=n # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip_indexer_reset_requirement_for_cache is not None: + _params["ignoreResetRequirements"] = _SERIALIZER.query( + "skip_indexer_reset_requirement_for_cache", skip_indexer_reset_requirement_for_cache, "bool" + ) + if disable_cache_reprocessing_change_detection is not None: + _params["disableCacheReprocessingChangeDetection"] = _SERIALIZER.query( + "disable_cache_reprocessing_change_detection", disable_cache_reprocessing_change_detection, "bool" + ) # Construct headers if accept is not None: @@ -1297,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", "2026-04-01")) + 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 @@ -1328,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", "2026-04-01")) + 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 @@ -1355,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", "2026-04-01")) + 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 @@ -1378,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", "2026-04-01")) + 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 @@ -1396,6 +1541,34 @@ def build_search_indexer_create_skillset_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_search_indexer_reset_skills_request(name: str, **kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _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", "2026-05-01-preview")) + accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") + + # Construct URL + _url = "/skillsets('{skillsetName}')/search.resetskills" + path_format_arguments = { + "skillsetName": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + 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") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class _SearchIndexClientOperationsMixin( # pylint: disable=too-many-public-methods ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], SearchIndexClientConfiguration] ): @@ -2144,9 +2317,23 @@ def get_index(self, name: str, **kwargs: Any) -> _models1.SearchIndex: return deserialized # type: ignore @distributed_trace - def _list_indexes(self, **kwargs: Any) -> ItemPaged["_models1.SearchIndex"]: + @api_version_validation( + params_added_on={"2026-05-01-preview": ["top", "skip", "count"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) + def _list_indexes( + self, *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None, **kwargs: Any + ) -> ItemPaged["_models1.SearchIndex"]: """Lists all indexes available for a search service. + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool :return: An iterator like instance of SearchIndex :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex] :raises ~azure.core.exceptions.HttpResponseError: @@ -2168,6 +2355,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_indexes_request( + top=top, + skip=skip, + count=count, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2209,7 +2399,7 @@ def extract_data(pipeline_response): ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.get("@odata.nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -2233,8 +2423,18 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace + @api_version_validation( + params_added_on={"2026-05-01-preview": ["top", "skip", "count"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) def _list_indexes_with_selected_properties( - self, *, select: Optional[list[str]] = None, **kwargs: Any + self, + *, + select: Optional[list[str]] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + count: Optional[bool] = None, + **kwargs: Any, ) -> ItemPaged["_models1._models.SearchIndexResponse"]: """Lists all indexes available for a search service. @@ -2242,6 +2442,14 @@ def _list_indexes_with_selected_properties( list of JSON property names, or '*' for all properties. The default is all properties. Default value is None. :paramtype select: list[str] + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool :return: An iterator like instance of SearchIndexResponse :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models._models.SearchIndexResponse] @@ -2265,6 +2473,9 @@ def prepare_request(next_link=None): _request = build_search_index_list_indexes_with_selected_properties_request( select=select, + top=top, + skip=skip, + count=count, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2301,12 +2512,12 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - list[_models1._models.SearchIndexResponse], # pylint: disable=protected-access + list[_models1._models.SearchIndexResponse], deserialized.get("value", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.get("@odata.nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -4182,8 +4393,116 @@ def get_service_statistics(self, **kwargs: Any) -> _models1.SearchServiceStatist return deserialized # type: ignore + @distributed_trace + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={"2026-05-01-preview": ["api_version", "accept", "top", "skip", "count", "client_request_id"]}, + api_versions_list=["2026-05-01-preview"], + ) + def list_index_stats_summary( + self, *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None, **kwargs: Any + ) -> ItemPaged["_models1.IndexStatisticsSummary"]: + """Retrieves a summary of statistics for all indexes in the search service. + + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool + :return: An iterator like instance of IndexStatisticsSummary + :rtype: + ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.IndexStatisticsSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models1.IndexStatisticsSummary]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_search_index_list_index_stats_summary_request( + top=top, + skip=skip, + count=count, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_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) -class _SearchIndexerClientOperationsMixin( + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models1.IndexStatisticsSummary], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _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]: + 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) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class _SearchIndexerClientOperationsMixin( # pylint: disable=too-many-public-methods ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], SearchIndexerClientConfiguration] ): @@ -4193,6 +4512,7 @@ def _create_or_update_data_source_connection( name: str, data_source: _models1.SearchIndexerDataSourceConnection, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -4204,6 +4524,7 @@ def _create_or_update_data_source_connection( name: str, data_source: JSON, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -4215,6 +4536,7 @@ def _create_or_update_data_source_connection( name: str, data_source: IO[bytes], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -4222,11 +4544,16 @@ def _create_or_update_data_source_connection( ) -> _models1.SearchIndexerDataSourceConnection: ... @distributed_trace + @api_version_validation( + params_added_on={"2026-05-01-preview": ["skip_indexer_reset_requirement_for_cache"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) def _create_or_update_data_source_connection( self, name: str, data_source: Union[_models1.SearchIndexerDataSourceConnection, JSON, IO[bytes]], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any, @@ -4239,6 +4566,9 @@ def _create_or_update_data_source_connection( following types: SearchIndexerDataSourceConnection, JSON, IO[bytes] Required. :type data_source: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or JSON or IO[bytes] + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default + value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -4279,6 +4609,7 @@ def _create_or_update_data_source_connection( _request = build_search_indexer_create_or_update_data_source_connection_request( name=name, + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, etag=etag, match_condition=match_condition, prefer=prefer, @@ -4715,6 +5046,218 @@ def reset_indexer(self, name: str, **kwargs: Any) -> None: # pylint: disable=in if cls: return cls(pipeline_response, None, {}) # type: ignore + @overload + def _resync( + self, + name: str, + indexer_resync: _models1.IndexerResyncBody, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: ... + @overload + def _resync( + self, name: str, indexer_resync: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + @overload + def _resync( + self, name: str, indexer_resync: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + + @distributed_trace + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={"2026-05-01-preview": ["api_version", "accept", "client_request_id", "name", "content_type"]}, + api_versions_list=["2026-05-01-preview"], + ) + def _resync( # pylint: disable=inconsistent-return-statements + self, name: str, indexer_resync: Union[_models1.IndexerResyncBody, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """Resync selective options from the datasource to be re-ingested by the indexer.". + + :param name: The name of the indexer. Required. + :type name: str + :param indexer_resync: The definition of the indexer resync options. Is one of the following + types: IndexerResyncBody, JSON, IO[bytes] Required. + :type indexer_resync: ~azure.search.documents.indexes.models.IndexerResyncBody or JSON or + IO[bytes] + :return: None + :rtype: None + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(indexer_resync, (IOBase, bytes)): + _content = indexer_resync + else: + _content = json.dumps(indexer_resync, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_search_indexer_resync_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + 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) + + _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 [204]: + 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 cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def _reset_documents( + self, + name: str, + keys_or_ids: Optional[_models1.DocumentKeysOrIds] = None, + *, + overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: ... + @overload + def _reset_documents( + self, + name: str, + keys_or_ids: Optional[JSON] = None, + *, + overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: ... + @overload + def _reset_documents( + self, + name: str, + keys_or_ids: Optional[IO[bytes]] = None, + *, + overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: ... + + @distributed_trace + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={ + "2026-05-01-preview": ["api_version", "accept", "overwrite", "client_request_id", "name", "content_type"] + }, + api_versions_list=["2026-05-01-preview"], + ) + def _reset_documents( # pylint: disable=inconsistent-return-statements + self, + name: str, + keys_or_ids: Optional[Union[_models1.DocumentKeysOrIds, JSON, IO[bytes]]] = None, + *, + overwrite: Optional[bool] = None, + **kwargs: Any, + ) -> None: + """Resets specific documents in the datasource to be selectively re-ingested by the indexer. + + :param name: The name of the indexer. Required. + :type name: str + :param keys_or_ids: The keys or ids of the documents to be re-ingested. If keys are provided, + the document key field must be specified in the indexer configuration. If ids are provided, the + document key field is ignored. Is one of the following types: DocumentKeysOrIds, JSON, + IO[bytes] Default value is None. + :type keys_or_ids: ~azure.search.documents.indexes.models.DocumentKeysOrIds or JSON or + IO[bytes] + :keyword overwrite: If false, keys or ids will be appended to existing ones. If true, only the + keys or ids in this payload will be queued to be re-ingested. Default value is None. + :paramtype overwrite: bool + :return: None + :rtype: None + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if keys_or_ids else None + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if keys_or_ids else None + _content = None + if isinstance(keys_or_ids, (IOBase, bytes)): + _content = keys_or_ids + else: + if keys_or_ids is not None: + _content = json.dumps(keys_or_ids, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_search_indexer_reset_documents_request( + name=name, + overwrite=overwrite, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + 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) + + _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 [204]: + 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 cls: + return cls(pipeline_response, None, {}) # type: ignore + @distributed_trace def run_indexer(self, name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Runs an indexer on-demand. @@ -4773,6 +5316,8 @@ def _create_or_update_indexer( name: str, indexer: _models1.SearchIndexer, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -4784,6 +5329,8 @@ def _create_or_update_indexer( name: str, indexer: JSON, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -4795,6 +5342,8 @@ def _create_or_update_indexer( name: str, indexer: IO[bytes], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -4802,11 +5351,22 @@ def _create_or_update_indexer( ) -> _models1.SearchIndexer: ... @distributed_trace + @api_version_validation( + params_added_on={ + "2026-05-01-preview": [ + "skip_indexer_reset_requirement_for_cache", + "disable_cache_reprocessing_change_detection", + ] + }, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) def _create_or_update_indexer( self, name: str, indexer: Union[_models1.SearchIndexer, JSON, IO[bytes]], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any, @@ -4818,6 +5378,12 @@ def _create_or_update_indexer( :param indexer: The definition of the indexer to create or update. Is one of the following types: SearchIndexer, JSON, IO[bytes] Required. :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or JSON or IO[bytes] + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default + value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool + :keyword disable_cache_reprocessing_change_detection: Disables cache reprocessing change + detection. Default value is None. + :paramtype disable_cache_reprocessing_change_detection: bool :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -4857,6 +5423,8 @@ def _create_or_update_indexer( _request = build_search_indexer_create_or_update_indexer_request( name=name, + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, + disable_cache_reprocessing_change_detection=disable_cache_reprocessing_change_detection, etag=etag, match_condition=match_condition, prefer=prefer, @@ -5301,6 +5869,8 @@ def _create_or_update_skillset( name: str, skillset: _models1.SearchIndexerSkillset, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -5312,6 +5882,8 @@ def _create_or_update_skillset( name: str, skillset: JSON, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -5323,6 +5895,8 @@ def _create_or_update_skillset( name: str, skillset: IO[bytes], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -5330,11 +5904,22 @@ def _create_or_update_skillset( ) -> _models1.SearchIndexerSkillset: ... @distributed_trace + @api_version_validation( + params_added_on={ + "2026-05-01-preview": [ + "skip_indexer_reset_requirement_for_cache", + "disable_cache_reprocessing_change_detection", + ] + }, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) def _create_or_update_skillset( self, name: str, skillset: Union[_models1.SearchIndexerSkillset, JSON, IO[bytes]], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any, @@ -5347,6 +5932,12 @@ def _create_or_update_skillset( service. Is one of the following types: SearchIndexerSkillset, JSON, IO[bytes] Required. :type skillset: ~azure.search.documents.indexes.models.SearchIndexerSkillset or JSON or IO[bytes] + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default + value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool + :keyword disable_cache_reprocessing_change_detection: Disables cache reprocessing change + detection. Default value is None. + :paramtype disable_cache_reprocessing_change_detection: bool :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -5386,6 +5977,8 @@ def _create_or_update_skillset( _request = build_search_indexer_create_or_update_skillset_request( name=name, + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, + disable_cache_reprocessing_change_detection=disable_cache_reprocessing_change_detection, etag=etag, match_condition=match_condition, prefer=prefer, @@ -5762,3 +6355,88 @@ def create_skillset( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + @overload + def _reset_skills( + self, name: str, skill_names: _models1.SkillNames, *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + @overload + def _reset_skills( + self, name: str, skill_names: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + @overload + def _reset_skills( + self, name: str, skill_names: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + + @distributed_trace + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={"2026-05-01-preview": ["api_version", "accept", "client_request_id", "name", "content_type"]}, + api_versions_list=["2026-05-01-preview"], + ) + def _reset_skills( # pylint: disable=inconsistent-return-statements + self, name: str, skill_names: Union[_models1.SkillNames, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """Reset an existing skillset in a search service. + + :param name: The name of the skillset. Required. + :type name: str + :param skill_names: The names of the skills to reset. If not specified, all skills in the + skillset will be reset. Is one of the following types: SkillNames, JSON, IO[bytes] Required. + :type skill_names: ~azure.search.documents.indexes.models.SkillNames or JSON or IO[bytes] + :return: None + :rtype: None + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(skill_names, (IOBase, bytes)): + _content = skill_names + else: + _content = json.dumps(skill_names, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_search_indexer_reset_skills_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + 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) + + _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 [204]: + 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 cls: + return cls(pipeline_response, None, {}) # type: ignore 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 da7d731af565..db24930fdca9 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 @@ -22,7 +22,7 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -600,7 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: for rest_field in self._attr_to_rest_field.values() if rest_field._default is not _UNSET } - if args: # pylint: disable=too-many-nested-blocks + if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) else: @@ -710,7 +710,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint: disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: 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 fcc17e7cb7bb..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 @@ -32,9 +32,9 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): 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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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 """ @@ -115,9 +115,9 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin): 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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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 84f6749422c0..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 @@ -29,16 +29,16 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri 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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2026-04-01") + api_version: str = kwargs.pop("api_version", "2026-05-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -86,16 +86,16 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att 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 "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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, "AsyncTokenCredential"], **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2026-04-01") + 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 2283f5c07552..8dd72cbb87d1 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from io import IOBase import json from typing import Any, Callable, IO, Literal, Optional, TypeVar, Union, overload @@ -35,6 +35,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, @@ -63,6 +64,7 @@ build_search_index_get_synonym_map_request, build_search_index_get_synonym_maps_request, build_search_index_list_aliases_request, + build_search_index_list_index_stats_summary_request, build_search_index_list_indexes_request, build_search_index_list_indexes_with_selected_properties_request, build_search_index_list_knowledge_bases_request, @@ -83,7 +85,10 @@ build_search_indexer_get_indexers_request, build_search_indexer_get_skillset_request, build_search_indexer_get_skillsets_request, + build_search_indexer_reset_documents_request, build_search_indexer_reset_indexer_request, + build_search_indexer_reset_skills_request, + build_search_indexer_resync_request, build_search_indexer_run_indexer_request, ) from .._configuration import SearchIndexClientConfiguration, SearchIndexerClientConfiguration @@ -841,9 +846,23 @@ async def get_index(self, name: str, **kwargs: Any) -> _models2.SearchIndex: return deserialized # type: ignore @distributed_trace - def _list_indexes(self, **kwargs: Any) -> AsyncItemPaged["_models2.SearchIndex"]: + @api_version_validation( + params_added_on={"2026-05-01-preview": ["top", "skip", "count"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) + def _list_indexes( + self, *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None, **kwargs: Any + ) -> AsyncItemPaged["_models2.SearchIndex"]: """Lists all indexes available for a search service. + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool :return: An iterator like instance of SearchIndex :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndex] @@ -866,6 +885,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_indexes_request( + top=top, + skip=skip, + count=count, api_version=self._config.api_version, headers=_headers, params=_params, @@ -907,7 +929,7 @@ async def extract_data(pipeline_response): ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.get("@odata.nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -931,8 +953,18 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace + @api_version_validation( + params_added_on={"2026-05-01-preview": ["top", "skip", "count"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) def _list_indexes_with_selected_properties( - self, *, select: Optional[list[str]] = None, **kwargs: Any + self, + *, + select: Optional[list[str]] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + count: Optional[bool] = None, + **kwargs: Any ) -> AsyncItemPaged["_models2._models.SearchIndexResponse"]: """Lists all indexes available for a search service. @@ -940,6 +972,14 @@ def _list_indexes_with_selected_properties( list of JSON property names, or '*' for all properties. The default is all properties. Default value is None. :paramtype select: list[str] + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool :return: An iterator like instance of SearchIndexResponse :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models._models.SearchIndexResponse] @@ -963,6 +1003,9 @@ def prepare_request(next_link=None): _request = build_search_index_list_indexes_with_selected_properties_request( select=select, + top=top, + skip=skip, + count=count, api_version=self._config.api_version, headers=_headers, params=_params, @@ -999,12 +1042,12 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - list[_models2._models.SearchIndexResponse], # pylint: disable=protected-access + list[_models2._models.SearchIndexResponse], deserialized.get("value", []), ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.get("@odata.nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -2889,8 +2932,116 @@ async def get_service_statistics(self, **kwargs: Any) -> _models2.SearchServiceS return deserialized # type: ignore + @distributed_trace + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={"2026-05-01-preview": ["api_version", "accept", "top", "skip", "count", "client_request_id"]}, + api_versions_list=["2026-05-01-preview"], + ) + def list_index_stats_summary( + self, *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None, **kwargs: Any + ) -> AsyncItemPaged["_models2.IndexStatisticsSummary"]: + """Retrieves a summary of statistics for all indexes in the search service. + + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool + :return: An iterator like instance of IndexStatisticsSummary + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.IndexStatisticsSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models2.IndexStatisticsSummary]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_search_index_list_index_stats_summary_request( + top=top, + skip=skip, + count=count, + 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) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_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) + + return _request -class _SearchIndexerClientOperationsMixin( + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models2.IndexStatisticsSummary], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _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]: + 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) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class _SearchIndexerClientOperationsMixin( # pylint: disable=too-many-public-methods ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], SearchIndexerClientConfiguration] ): @@ -2900,6 +3051,7 @@ async def _create_or_update_data_source_connection( name: str, data_source: _models2.SearchIndexerDataSourceConnection, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -2911,6 +3063,7 @@ async def _create_or_update_data_source_connection( name: str, data_source: JSON, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -2922,6 +3075,7 @@ async def _create_or_update_data_source_connection( name: str, data_source: IO[bytes], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -2929,11 +3083,16 @@ async def _create_or_update_data_source_connection( ) -> _models2.SearchIndexerDataSourceConnection: ... @distributed_trace_async + @api_version_validation( + params_added_on={"2026-05-01-preview": ["skip_indexer_reset_requirement_for_cache"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) async def _create_or_update_data_source_connection( self, name: str, data_source: Union[_models2.SearchIndexerDataSourceConnection, JSON, IO[bytes]], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -2946,6 +3105,9 @@ async def _create_or_update_data_source_connection( following types: SearchIndexerDataSourceConnection, JSON, IO[bytes] Required. :type data_source: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or JSON or IO[bytes] + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default + value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -2986,6 +3148,7 @@ async def _create_or_update_data_source_connection( _request = build_search_indexer_create_or_update_data_source_connection_request( name=name, + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, etag=etag, match_condition=match_condition, prefer=prefer, @@ -3422,6 +3585,218 @@ async def reset_indexer(self, name: str, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore + @overload + async def _resync( + self, + name: str, + indexer_resync: _models2.IndexerResyncBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + @overload + async def _resync( + self, name: str, indexer_resync: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + @overload + async def _resync( + self, name: str, indexer_resync: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={"2026-05-01-preview": ["api_version", "accept", "client_request_id", "name", "content_type"]}, + api_versions_list=["2026-05-01-preview"], + ) + async def _resync( + self, name: str, indexer_resync: Union[_models2.IndexerResyncBody, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """Resync selective options from the datasource to be re-ingested by the indexer.". + + :param name: The name of the indexer. Required. + :type name: str + :param indexer_resync: The definition of the indexer resync options. Is one of the following + types: IndexerResyncBody, JSON, IO[bytes] Required. + :type indexer_resync: ~azure.search.documents.indexes.models.IndexerResyncBody or JSON or + IO[bytes] + :return: None + :rtype: None + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(indexer_resync, (IOBase, bytes)): + _content = indexer_resync + else: + _content = json.dumps(indexer_resync, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_search_indexer_resync_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + 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) + + _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 [204]: + 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 cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def _reset_documents( + self, + name: str, + keys_or_ids: Optional[_models2.DocumentKeysOrIds] = None, + *, + overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + @overload + async def _reset_documents( + self, + name: str, + keys_or_ids: Optional[JSON] = None, + *, + overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + @overload + async def _reset_documents( + self, + name: str, + keys_or_ids: Optional[IO[bytes]] = None, + *, + overwrite: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={ + "2026-05-01-preview": ["api_version", "accept", "overwrite", "client_request_id", "name", "content_type"] + }, + api_versions_list=["2026-05-01-preview"], + ) + async def _reset_documents( + self, + name: str, + keys_or_ids: Optional[Union[_models2.DocumentKeysOrIds, JSON, IO[bytes]]] = None, + *, + overwrite: Optional[bool] = None, + **kwargs: Any + ) -> None: + """Resets specific documents in the datasource to be selectively re-ingested by the indexer. + + :param name: The name of the indexer. Required. + :type name: str + :param keys_or_ids: The keys or ids of the documents to be re-ingested. If keys are provided, + the document key field must be specified in the indexer configuration. If ids are provided, the + document key field is ignored. Is one of the following types: DocumentKeysOrIds, JSON, + IO[bytes] Default value is None. + :type keys_or_ids: ~azure.search.documents.indexes.models.DocumentKeysOrIds or JSON or + IO[bytes] + :keyword overwrite: If false, keys or ids will be appended to existing ones. If true, only the + keys or ids in this payload will be queued to be re-ingested. Default value is None. + :paramtype overwrite: bool + :return: None + :rtype: None + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if keys_or_ids else None + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if keys_or_ids else None + _content = None + if isinstance(keys_or_ids, (IOBase, bytes)): + _content = keys_or_ids + else: + if keys_or_ids is not None: + _content = json.dumps(keys_or_ids, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_search_indexer_reset_documents_request( + name=name, + overwrite=overwrite, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + 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) + + _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 [204]: + 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 cls: + return cls(pipeline_response, None, {}) # type: ignore + @distributed_trace_async async def run_indexer(self, name: str, **kwargs: Any) -> None: """Runs an indexer on-demand. @@ -3480,6 +3855,8 @@ async def _create_or_update_indexer( name: str, indexer: _models2.SearchIndexer, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -3491,6 +3868,8 @@ async def _create_or_update_indexer( name: str, indexer: JSON, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -3502,6 +3881,8 @@ async def _create_or_update_indexer( name: str, indexer: IO[bytes], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -3509,11 +3890,22 @@ async def _create_or_update_indexer( ) -> _models2.SearchIndexer: ... @distributed_trace_async + @api_version_validation( + params_added_on={ + "2026-05-01-preview": [ + "skip_indexer_reset_requirement_for_cache", + "disable_cache_reprocessing_change_detection", + ] + }, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) async def _create_or_update_indexer( self, name: str, indexer: Union[_models2.SearchIndexer, JSON, IO[bytes]], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -3525,6 +3917,12 @@ async def _create_or_update_indexer( :param indexer: The definition of the indexer to create or update. Is one of the following types: SearchIndexer, JSON, IO[bytes] Required. :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or JSON or IO[bytes] + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default + value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool + :keyword disable_cache_reprocessing_change_detection: Disables cache reprocessing change + detection. Default value is None. + :paramtype disable_cache_reprocessing_change_detection: bool :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -3564,6 +3962,8 @@ async def _create_or_update_indexer( _request = build_search_indexer_create_or_update_indexer_request( name=name, + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, + disable_cache_reprocessing_change_detection=disable_cache_reprocessing_change_detection, etag=etag, match_condition=match_condition, prefer=prefer, @@ -4008,6 +4408,8 @@ async def _create_or_update_skillset( name: str, skillset: _models2.SearchIndexerSkillset, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -4019,6 +4421,8 @@ async def _create_or_update_skillset( name: str, skillset: JSON, *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -4030,6 +4434,8 @@ async def _create_or_update_skillset( name: str, skillset: IO[bytes], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, content_type: str = "application/json", etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -4037,11 +4443,22 @@ async def _create_or_update_skillset( ) -> _models2.SearchIndexerSkillset: ... @distributed_trace_async + @api_version_validation( + params_added_on={ + "2026-05-01-preview": [ + "skip_indexer_reset_requirement_for_cache", + "disable_cache_reprocessing_change_detection", + ] + }, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) async def _create_or_update_skillset( self, name: str, skillset: Union[_models2.SearchIndexerSkillset, JSON, IO[bytes]], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, **kwargs: Any @@ -4054,6 +4471,12 @@ async def _create_or_update_skillset( service. Is one of the following types: SearchIndexerSkillset, JSON, IO[bytes] Required. :type skillset: ~azure.search.documents.indexes.models.SearchIndexerSkillset or JSON or IO[bytes] + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default + value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool + :keyword disable_cache_reprocessing_change_detection: Disables cache reprocessing change + detection. Default value is None. + :paramtype disable_cache_reprocessing_change_detection: bool :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -4093,6 +4516,8 @@ async def _create_or_update_skillset( _request = build_search_indexer_create_or_update_skillset_request( name=name, + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, + disable_cache_reprocessing_change_detection=disable_cache_reprocessing_change_detection, etag=etag, match_condition=match_condition, prefer=prefer, @@ -4469,3 +4894,88 @@ async def create_skillset( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + @overload + async def _reset_skills( + self, name: str, skill_names: _models2.SkillNames, *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + @overload + async def _reset_skills( + self, name: str, skill_names: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + @overload + async def _reset_skills( + self, name: str, skill_names: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> None: ... + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-05-01-preview", + params_added_on={"2026-05-01-preview": ["api_version", "accept", "client_request_id", "name", "content_type"]}, + api_versions_list=["2026-05-01-preview"], + ) + async def _reset_skills( + self, name: str, skill_names: Union[_models2.SkillNames, JSON, IO[bytes]], **kwargs: Any + ) -> None: + """Reset an existing skillset in a search service. + + :param name: The name of the skillset. Required. + :type name: str + :param skill_names: The names of the skills to reset. If not specified, all skills in the + skillset will be reset. Is one of the following types: SkillNames, JSON, IO[bytes] Required. + :type skill_names: ~azure.search.documents.indexes.models.SkillNames or JSON or IO[bytes] + :return: None + :rtype: None + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(skill_names, (IOBase, bytes)): + _content = skill_names + else: + _content = json.dumps(skill_names, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_search_indexer_reset_skills_request( + name=name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + 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) + + _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 [204]: + 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 cls: + return cls(pipeline_response, None, {}) # type: ignore 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 c6104b6cd9a8..a2655c90133a 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 @@ -16,6 +16,8 @@ from ._models import ( # type: ignore AIServicesAccountIdentity, AIServicesAccountKey, + AIServicesVisionParameters, + AIServicesVisionVectorizer, AnalyzeResult, AnalyzeTextOptions, AnalyzedTokenInfo, @@ -24,8 +26,10 @@ AzureBlobKnowledgeSource, AzureBlobKnowledgeSourceParameters, AzureMachineLearningParameters, + AzureMachineLearningSkill, AzureMachineLearningVectorizer, AzureOpenAIEmbeddingSkill, + AzureOpenAITokenizerParameters, AzureOpenAIVectorizer, AzureOpenAIVectorizerParameters, BM25SimilarityAlgorithm, @@ -43,6 +47,7 @@ CognitiveServicesAccountKey, CommonGramTokenFilter, ConditionalSkill, + ContentColumnMapping, ContentUnderstandingSkill, ContentUnderstandingSkillChunkingProperties, CorsOptions, @@ -67,12 +72,19 @@ EdgeNGramTokenFilterV2, EdgeNGramTokenizer, ElisionTokenFilter, + EmbeddingColumnMapping, EntityLinkingSkill, EntityRecognitionSkillV3, ExhaustiveKnnAlgorithmConfiguration, ExhaustiveKnnParameters, + FabricDataAgentKnowledgeSource, + FabricDataAgentKnowledgeSourceParameters, + FabricOntologyKnowledgeSource, + FabricOntologyKnowledgeSourceParameters, FieldMapping, FieldMappingFunction, + FileKnowledgeSource, + FileKnowledgeSourceParameters, FreshnessScoringFunction, FreshnessScoringParameters, GetIndexStatisticsResult, @@ -80,10 +92,17 @@ HnswAlgorithmConfiguration, HnswParameters, ImageAnalysisSkill, + IndexStatisticsSummary, IndexedOneLakeKnowledgeSource, IndexedOneLakeKnowledgeSourceParameters, + IndexedSharePointKnowledgeSource, + IndexedSharePointKnowledgeSourceParameters, + IndexedSqlKnowledgeSource, + IndexedSqlKnowledgeSourceParameters, + IndexerCurrentState, IndexerExecutionResult, IndexerResyncBody, + IndexerRuntime, IndexingParameters, IndexingParametersConfiguration, IndexingSchedule, @@ -110,6 +129,22 @@ MagnitudeScoringFunction, MagnitudeScoringParameters, MappingCharFilter, + McpServerAuthentication, + McpServerAutoOutputParsing, + McpServerFoundryConnectionAuthentication, + McpServerFoundryConnectionParameters, + McpServerHeaders, + McpServerJsonOutputParsing, + McpServerKnowledgeSource, + McpServerKnowledgeSourceParameters, + McpServerNoneOutputParsing, + McpServerOutputParsing, + McpServerOutputParsingJsonParameters, + McpServerOutputParsingSplitParameters, + McpServerSplitOutputParsing, + McpServerStoredHeadersAuthentication, + McpServerStoredHeadersParameters, + McpServerTool, MergeSkill, MicrosoftLanguageStemmingTokenizer, MicrosoftLanguageTokenizer, @@ -127,6 +162,8 @@ PatternReplaceTokenFilter, PatternTokenizer, PhoneticTokenFilter, + RemoteSharePointKnowledgeSource, + RemoteSharePointKnowledgeSourceParameters, RescoringOptions, ResourceCounter, ScalarQuantizationCompression, @@ -140,6 +177,7 @@ SearchIndexKnowledgeSource, SearchIndexKnowledgeSourceParameters, SearchIndexer, + SearchIndexerCache, SearchIndexerDataContainer, SearchIndexerDataIdentity, SearchIndexerDataNoneIdentity, @@ -153,6 +191,7 @@ SearchIndexerKnowledgeStoreBlobProjectionSelector, SearchIndexerKnowledgeStoreFileProjectionSelector, SearchIndexerKnowledgeStoreObjectProjectionSelector, + SearchIndexerKnowledgeStoreParameters, SearchIndexerKnowledgeStoreProjection, SearchIndexerKnowledgeStoreProjectionSelector, SearchIndexerKnowledgeStoreTableProjectionSelector, @@ -171,6 +210,7 @@ SemanticPrioritizedFields, SemanticSearch, SentimentSkillV3, + ServiceIndexersRuntime, ShaperSkill, ShingleTokenFilter, SimilarityAlgorithm, @@ -198,6 +238,7 @@ VectorSearchCompression, VectorSearchProfile, VectorSearchVectorizer, + VisionVectorizeSkill, WebApiHttpHeaders, WebApiSkill, WebApiVectorizer, @@ -207,6 +248,7 @@ WebKnowledgeSourceDomains, WebKnowledgeSourceParameters, WordDelimiterTokenFilter, + WorkIQKnowledgeSource, ) from ._enums import ( # type: ignore @@ -234,13 +276,18 @@ ImageAnalysisSkillLanguage, ImageDetail, IndexProjectionMode, + IndexedSharePointContainerName, IndexerExecutionEnvironment, IndexerExecutionStatus, + IndexerExecutionStatusDetail, + IndexerPermissionOption, IndexerResyncOption, IndexerStatus, + IndexingMode, KeyPhraseExtractionSkillLanguage, KnowledgeBaseModelKind, KnowledgeSourceContentExtractionMode, + KnowledgeSourceIngestionPermissionOption, KnowledgeSourceKind, KnowledgeSourceSynchronizationStatus, LexicalAnalyzerName, @@ -248,21 +295,28 @@ LexicalTokenizerName, MarkdownHeaderDepth, MarkdownParsingSubmode, + McpServerAuthenticationKind, + McpServerOutputParsingKind, + McpServerToolInclusionMode, MicrosoftStemmingTokenizerLanguage, MicrosoftTokenizerLanguage, OcrLineEnding, OcrSkillLanguage, PIIDetectionSkillMaskingMode, + PermissionFilter, PhoneticEncoder, RankingOrder, RegexFlags, ScoringFunctionAggregation, ScoringFunctionInterpolation, SearchFieldDataType, + SearchIndexPermissionFilterOption, SearchIndexerDataSourceType, SentimentSkillLanguage, SnowballTokenFilterLanguage, + SplitSkillEncoderModelName, SplitSkillLanguage, + SplitSkillUnit, StemmerTokenFilterLanguage, StopwordsList, TextSplitMode, @@ -285,6 +339,8 @@ __all__ = [ "AIServicesAccountIdentity", "AIServicesAccountKey", + "AIServicesVisionParameters", + "AIServicesVisionVectorizer", "AnalyzeResult", "AnalyzeTextOptions", "AnalyzedTokenInfo", @@ -293,8 +349,10 @@ "AzureBlobKnowledgeSource", "AzureBlobKnowledgeSourceParameters", "AzureMachineLearningParameters", + "AzureMachineLearningSkill", "AzureMachineLearningVectorizer", "AzureOpenAIEmbeddingSkill", + "AzureOpenAITokenizerParameters", "AzureOpenAIVectorizer", "AzureOpenAIVectorizerParameters", "BM25SimilarityAlgorithm", @@ -312,6 +370,7 @@ "CognitiveServicesAccountKey", "CommonGramTokenFilter", "ConditionalSkill", + "ContentColumnMapping", "ContentUnderstandingSkill", "ContentUnderstandingSkillChunkingProperties", "CorsOptions", @@ -336,12 +395,19 @@ "EdgeNGramTokenFilterV2", "EdgeNGramTokenizer", "ElisionTokenFilter", + "EmbeddingColumnMapping", "EntityLinkingSkill", "EntityRecognitionSkillV3", "ExhaustiveKnnAlgorithmConfiguration", "ExhaustiveKnnParameters", + "FabricDataAgentKnowledgeSource", + "FabricDataAgentKnowledgeSourceParameters", + "FabricOntologyKnowledgeSource", + "FabricOntologyKnowledgeSourceParameters", "FieldMapping", "FieldMappingFunction", + "FileKnowledgeSource", + "FileKnowledgeSourceParameters", "FreshnessScoringFunction", "FreshnessScoringParameters", "GetIndexStatisticsResult", @@ -349,10 +415,17 @@ "HnswAlgorithmConfiguration", "HnswParameters", "ImageAnalysisSkill", + "IndexStatisticsSummary", "IndexedOneLakeKnowledgeSource", "IndexedOneLakeKnowledgeSourceParameters", + "IndexedSharePointKnowledgeSource", + "IndexedSharePointKnowledgeSourceParameters", + "IndexedSqlKnowledgeSource", + "IndexedSqlKnowledgeSourceParameters", + "IndexerCurrentState", "IndexerExecutionResult", "IndexerResyncBody", + "IndexerRuntime", "IndexingParameters", "IndexingParametersConfiguration", "IndexingSchedule", @@ -379,6 +452,22 @@ "MagnitudeScoringFunction", "MagnitudeScoringParameters", "MappingCharFilter", + "McpServerAuthentication", + "McpServerAutoOutputParsing", + "McpServerFoundryConnectionAuthentication", + "McpServerFoundryConnectionParameters", + "McpServerHeaders", + "McpServerJsonOutputParsing", + "McpServerKnowledgeSource", + "McpServerKnowledgeSourceParameters", + "McpServerNoneOutputParsing", + "McpServerOutputParsing", + "McpServerOutputParsingJsonParameters", + "McpServerOutputParsingSplitParameters", + "McpServerSplitOutputParsing", + "McpServerStoredHeadersAuthentication", + "McpServerStoredHeadersParameters", + "McpServerTool", "MergeSkill", "MicrosoftLanguageStemmingTokenizer", "MicrosoftLanguageTokenizer", @@ -396,6 +485,8 @@ "PatternReplaceTokenFilter", "PatternTokenizer", "PhoneticTokenFilter", + "RemoteSharePointKnowledgeSource", + "RemoteSharePointKnowledgeSourceParameters", "RescoringOptions", "ResourceCounter", "ScalarQuantizationCompression", @@ -409,6 +500,7 @@ "SearchIndexKnowledgeSource", "SearchIndexKnowledgeSourceParameters", "SearchIndexer", + "SearchIndexerCache", "SearchIndexerDataContainer", "SearchIndexerDataIdentity", "SearchIndexerDataNoneIdentity", @@ -422,6 +514,7 @@ "SearchIndexerKnowledgeStoreBlobProjectionSelector", "SearchIndexerKnowledgeStoreFileProjectionSelector", "SearchIndexerKnowledgeStoreObjectProjectionSelector", + "SearchIndexerKnowledgeStoreParameters", "SearchIndexerKnowledgeStoreProjection", "SearchIndexerKnowledgeStoreProjectionSelector", "SearchIndexerKnowledgeStoreTableProjectionSelector", @@ -440,6 +533,7 @@ "SemanticPrioritizedFields", "SemanticSearch", "SentimentSkillV3", + "ServiceIndexersRuntime", "ShaperSkill", "ShingleTokenFilter", "SimilarityAlgorithm", @@ -467,6 +561,7 @@ "VectorSearchCompression", "VectorSearchProfile", "VectorSearchVectorizer", + "VisionVectorizeSkill", "WebApiHttpHeaders", "WebApiSkill", "WebApiVectorizer", @@ -476,6 +571,7 @@ "WebKnowledgeSourceDomains", "WebKnowledgeSourceParameters", "WordDelimiterTokenFilter", + "WorkIQKnowledgeSource", "AIFoundryModelCatalogName", "AzureOpenAIModelName", "BlobIndexerDataToExtract", @@ -500,13 +596,18 @@ "ImageAnalysisSkillLanguage", "ImageDetail", "IndexProjectionMode", + "IndexedSharePointContainerName", "IndexerExecutionEnvironment", "IndexerExecutionStatus", + "IndexerExecutionStatusDetail", + "IndexerPermissionOption", "IndexerResyncOption", "IndexerStatus", + "IndexingMode", "KeyPhraseExtractionSkillLanguage", "KnowledgeBaseModelKind", "KnowledgeSourceContentExtractionMode", + "KnowledgeSourceIngestionPermissionOption", "KnowledgeSourceKind", "KnowledgeSourceSynchronizationStatus", "LexicalAnalyzerName", @@ -514,21 +615,28 @@ "LexicalTokenizerName", "MarkdownHeaderDepth", "MarkdownParsingSubmode", + "McpServerAuthenticationKind", + "McpServerOutputParsingKind", + "McpServerToolInclusionMode", "MicrosoftStemmingTokenizerLanguage", "MicrosoftTokenizerLanguage", "OcrLineEnding", "OcrSkillLanguage", "PIIDetectionSkillMaskingMode", + "PermissionFilter", "PhoneticEncoder", "RankingOrder", "RegexFlags", "ScoringFunctionAggregation", "ScoringFunctionInterpolation", "SearchFieldDataType", + "SearchIndexPermissionFilterOption", "SearchIndexerDataSourceType", "SentimentSkillLanguage", "SnowballTokenFilterLanguage", + "SplitSkillEncoderModelName", "SplitSkillLanguage", + "SplitSkillUnit", "StemmerTokenFilterLanguage", "StopwordsList", "TextSplitMode", 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 638772ae0408..43bc00076004 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 @@ -39,10 +39,28 @@ class AzureOpenAIModelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """TextEmbedding3Large model.""" TEXT_EMBEDDING3_SMALL = "text-embedding-3-small" """TextEmbedding3Small model.""" + GPT4_O = "gpt-4o" + """Gpt4o model.""" + GPT4_O_MINI = "gpt-4o-mini" + """Gpt4oMini model.""" + GPT41 = "gpt-4.1" + """Gpt41 model.""" + GPT41_MINI = "gpt-4.1-mini" + """Gpt41Mini model.""" + GPT41_NANO = "gpt-4.1-nano" + """Gpt41Nano model.""" + GPT5 = "gpt-5" + """Gpt5 model.""" GPT_5_MINI = "gpt-5-mini" """Gpt5Mini model.""" GPT_5_NANO = "gpt-5-nano" """Gpt5Nano model.""" + GPT51 = "gpt-5.1" + """Gpt51 model.""" + GPT52 = "gpt-5.2" + """Gpt52 model.""" + GPT54 = "gpt-5.4" + """Gpt54 model.""" GPT_5_4_MINI = "gpt-5.4-mini" """Gpt54Mini model.""" GPT_5_4_NANO = "gpt-5.4-nano" @@ -167,6 +185,8 @@ class ContentUnderstandingSkillChunkingUnit(str, Enum, metaclass=CaseInsensitive CHARACTERS = "characters" """Specifies chunk by characters.""" + TOKENS = "tokens" + """Specifies chunk by tokens.""" class ContentUnderstandingSkillExtractionOptions( # pylint: disable=name-too-long @@ -459,6 +479,17 @@ class ImageDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Details recognized as landmarks.""" +class IndexedSharePointContainerName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies which SharePoint libraries to access.""" + + DEFAULT_SITE_LIBRARY = "defaultSiteLibrary" + """Index content from the site's default document library.""" + ALL_SITE_LIBRARIES = "allSiteLibraries" + """Index content from every document library in the site.""" + USE_QUERY = "useQuery" + """Use a query to filter SharePoint content.""" + + class IndexerExecutionEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the environment in which the indexer should execute.""" @@ -485,6 +516,26 @@ class IndexerExecutionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indexer has been reset.""" +class IndexerExecutionStatusDetail(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Details the status of an individual indexer execution.""" + + RESET_DOCS = "resetDocs" + """Indicates that the reset that occurred was for a call to ResetDocs.""" + RESYNC = "resync" + """Indicates to selectively resync based on option(s) from data source.""" + + +class IndexerPermissionOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Options with various types of permission data to index.""" + + USER_IDS = "userIds" + """Indexer to ingest ACL userIds from data source to index.""" + GROUP_IDS = "groupIds" + """Indexer to ingest ACL groupIds from data source to index.""" + RBAC_SCOPE = "rbacScope" + """Indexer to ingest Azure RBAC scope from data source to index.""" + + class IndexerResyncOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Options with various types of permission data to index.""" @@ -504,6 +555,18 @@ class IndexerStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates that the indexer is running normally.""" +class IndexingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Represents the mode the indexer is executing in.""" + + INDEXING_ALL_DOCS = "indexingAllDocs" + """The indexer is indexing all documents in the datasource.""" + INDEXING_RESET_DOCS = "indexingResetDocs" + """The indexer is indexing selective, reset documents in the datasource. The documents being + indexed are defined on indexer status.""" + INDEXING_RESYNC = "indexingResync" + """The indexer is resyncing and indexing selective option(s) from the datasource.""" + + class IndexProjectionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines behavior of the index projections in relation to the rest of the indexer.""" @@ -567,6 +630,19 @@ class KnowledgeSourceContentExtractionMode(str, Enum, metaclass=CaseInsensitiveE """Performs the full default content extraction pipeline.""" +class KnowledgeSourceIngestionPermissionOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Permission types to ingest together with document content.""" + + USER_IDS = "userIds" + """Ingest explicit user identifiers alongside document content.""" + GROUP_IDS = "groupIds" + """Ingest group identifiers alongside document content.""" + RBAC_SCOPE = "rbacScope" + """Ingest RBAC scope information alongside document content.""" + SENSITIVITY_LABELS = "sensitivityLabels" + """Ingest Microsoft Purview sensitivity labels alongside document content.""" + + class KnowledgeSourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of the knowledge source.""" @@ -574,10 +650,27 @@ class KnowledgeSourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A knowledge source that reads data from a Search Index.""" AZURE_BLOB = "azureBlob" """A knowledge source that read and ingest data from Azure Blob Storage to a Search Index.""" + INDEXED_SHARE_POINT = "indexedSharePoint" + """A knowledge source that reads data from indexed SharePoint.""" INDEXED_ONELAKE = "indexedOneLake" """A knowledge source that reads data from indexed OneLake.""" + INDEXED_SQL = "indexedSql" + """A knowledge source that retrieves and ingests data from Azure SQL Database or SQL Managed + Instance to a Search Index.""" WEB = "web" """A knowledge source that reads data from the web.""" + REMOTE_SHARE_POINT = "remoteSharePoint" + """A knowledge source that reads data from remote SharePoint.""" + WORK_IQ = "workIQ" + """A knowledge source that reads data from work IQ.""" + FILE = "file" + """A knowledge source that supports direct file upload and indexing.""" + MCP_SERVER = "mcpServer" + """A knowledge source backed by an MCP (Model Context Protocol) server.""" + FABRIC_DATA_AGENT = "fabricDataAgent" + """A knowledge source that retrieves data from a Fabric Data Agent.""" + FABRIC_ONTOLOGY = "fabricOntology" + """A knowledge source that retrieves data from Microsoft Fabric Ontology ontologies.""" class KnowledgeSourceSynchronizationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -909,6 +1002,39 @@ class MarkdownParsingSubmode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates that each markdown file will be parsed into a single search document.""" +class McpServerAuthenticationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of authentication for an MCP server.""" + + FOUNDRY_CONNECTION = "foundryConnection" + """Authenticate using an Azure AI Foundry connection.""" + STORED_HEADERS = "storedHeaders" + """Authenticate using stored HTTP headers.""" + + +class McpServerOutputParsingKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of output parsing for an MCP server tool.""" + + AUTO = "auto" + """Automatically detect the output format and parse accordingly.""" + JSON = "json" + """Parse the output as a JSON document using the configured JSON parameters.""" + SPLIT = "split" + """Split the output into pages using the configured split parameters.""" + NONE = "none" + """Treat the output as a single block without any parsing.""" + + +class McpServerToolInclusionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Controls how parsed MCP tool results are integrated into the final result set.""" + + RERANKED = "reranked" + """Tool results go through the reranking and aggregation pipeline alongside results from other + knowledge sources.""" + ALWAYS = "always" + """Tool results bypass reranking and are always included in the agent context. This is the default + behavior.""" + + class MicrosoftStemmingTokenizerLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Lists the languages supported by the Microsoft language stemming tokenizer.""" @@ -1453,6 +1579,17 @@ class OcrSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Unknown (All).""" +class PermissionFilter(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating whether the field should be used as a permission filter.""" + + USER_IDS = "userIds" + """Field represents user IDs that should be used to filter document access on queries.""" + GROUP_IDS = "groupIds" + """Field represents group IDs that should be used to filter document access on queries.""" + RBAC_SCOPE = "rbacScope" + """Field represents an RBAC scope that should be used to filter document access on queries.""" + + class PhoneticEncoder(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Identifies the type of phonetic encoder to use with a PhoneticTokenFilter.""" @@ -1620,6 +1757,15 @@ class SearchIndexerDataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates a SharePoint datasource.""" +class SearchIndexPermissionFilterOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating whether permission filtering is enabled for the index.""" + + ENABLED = "enabled" + """Permission filtering is enabled for the index.""" + DISABLED = "disabled" + """Permission filtering is disabled for the index.""" + + class SentimentSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The language codes supported for input text by SentimentSkill.""" @@ -1707,6 +1853,21 @@ class SnowballTokenFilterLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Selects the Lucene Snowball stemming tokenizer for Turkish.""" +class SplitSkillEncoderModelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating which tokenizer to use.""" + + R50_K_BASE = "r50k_base" + """Refers to a base model trained with a 50,000 token vocabulary, often used in general natural + language processing tasks.""" + P50_K_BASE = "p50k_base" + """A base model with a 50,000 token vocabulary, optimized for prompt-based tasks.""" + P50_K_EDIT = "p50k_edit" + """Similar to p50k_base but fine-tuned for editing or rephrasing tasks with a 50,000 token + vocabulary.""" + CL100_K_BASE = "cl100k_base" + """A base model with a 100,000 token vocabulary.""" + + class SplitSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The language codes supported for input text by SplitSkill.""" @@ -1778,6 +1939,15 @@ class SplitSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Chinese (Simplified).""" +class SplitSkillUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value indicating which unit to use.""" + + CHARACTERS = "characters" + """The length will be measured by character.""" + AZURE_OPEN_AI_TOKENS = "azureOpenAITokens" + """The length will be measured by an AzureOpenAI tokenizer from the tiktoken library.""" + + class StemmerTokenFilterLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The language to use for a stemmer 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 18f60d29bcf3..32842f01c046 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 @@ -15,6 +15,8 @@ from ._enums import ( KnowledgeBaseModelKind, KnowledgeSourceKind, + McpServerAuthenticationKind, + McpServerOutputParsingKind, VectorSearchAlgorithmKind, VectorSearchCompressionKind, VectorSearchVectorizerKind, @@ -22,6 +24,7 @@ if TYPE_CHECKING: from .. import models as _models + from ......search import models as _search_models6 from ...knowledgebases import models as _knowledgebases_models3 @@ -161,6 +164,145 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.AIServicesByKey" # type: ignore +class AIServicesVisionParameters(_Model): + """Specifies the AI Services Vision parameters for vectorizing a query image or text. + + :ivar model_version: The version of the model to use when calling the AI Services Vision + service. It will default to the latest available when not specified. Required. + :vartype model_version: str + :ivar resource_uri: The resource URI of the AI Services resource. Required. + :vartype resource_uri: str + :ivar api_key: API key of the designated AI Services resource. + :vartype api_key: str + :ivar auth_identity: The user-assigned managed identity used for outbound connections. If an + authResourceId is provided and it's not specified, the system-assigned managed identity is + used. On updates to the index, if the identity is unspecified, the value remains unchanged. If + set to "none", the value of this property is cleared. + :vartype auth_identity: ~azure.search.documents.indexes.models.SearchIndexerDataIdentity + """ + + model_version: str = rest_field(name="modelVersion", visibility=["read", "create", "update", "delete", "query"]) + """The version of the model to use when calling the AI Services Vision service. It will default to + the latest available when not specified. Required.""" + resource_uri: str = rest_field(name="resourceUri", visibility=["read", "create", "update", "delete", "query"]) + """The resource URI of the AI Services resource. Required.""" + api_key: Optional[str] = rest_field(name="apiKey", visibility=["read", "create", "update", "delete", "query"]) + """API key of the designated AI Services resource.""" + auth_identity: Optional["_models.SearchIndexerDataIdentity"] = rest_field( + name="authIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The user-assigned managed identity used for outbound connections. If an authResourceId is + provided and it's not specified, the system-assigned managed identity is used. On updates to + the index, if the identity is unspecified, the value remains unchanged. If set to \"none\", the + value of this property is cleared.""" + + @overload + def __init__( + self, + *, + model_version: str, + resource_uri: str, + api_key: Optional[str] = None, + auth_identity: Optional["_models.SearchIndexerDataIdentity"] = 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 VectorSearchVectorizer(_Model): + """Specifies the vectorization method to be used during query time. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AIServicesVisionVectorizer, AzureMachineLearningVectorizer, AzureOpenAIVectorizer, + WebApiVectorizer + + :ivar vectorizer_name: The name to associate with this particular vectorization method. + Required. + :vartype vectorizer_name: str + :ivar kind: Type of VectorSearchVectorizer. Required. Known values are: "azureOpenAI", + "customWebApi", "aiServicesVision", and "aml". + :vartype kind: str or ~azure.search.documents.indexes.models.VectorSearchVectorizerKind + """ + + __mapping__: dict[str, _Model] = {} + vectorizer_name: str = rest_field(name="name", visibility=["read", "create", "update", "delete", "query"]) + """The name to associate with this particular vectorization method. Required.""" + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """Type of VectorSearchVectorizer. Required. Known values are: \"azureOpenAI\", \"customWebApi\", + \"aiServicesVision\", and \"aml\".""" + + @overload + def __init__( + self, + *, + vectorizer_name: str, + kind: str, + ) -> 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 AIServicesVisionVectorizer(VectorSearchVectorizer, discriminator="aiServicesVision"): + """Clears the identity property of a datasource. + + :ivar vectorizer_name: The name to associate with this particular vectorization method. + Required. + :vartype vectorizer_name: str + :ivar ai_services_vision_parameters: Contains the parameters specific to AI Services Vision + embedding vectorization. + :vartype ai_services_vision_parameters: + ~azure.search.documents.indexes.models.AIServicesVisionParameters + :ivar kind: The name of the kind of vectorization method being configured for use with vector + search. Required. Generate embeddings for an image or text input at query time using the Azure + AI Services Vision Vectorize API. + :vartype kind: str or ~azure.search.documents.indexes.models.AI_SERVICES_VISION + """ + + ai_services_vision_parameters: Optional["_models.AIServicesVisionParameters"] = rest_field( + name="aiServicesVisionParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains the parameters specific to AI Services Vision embedding vectorization.""" + kind: Literal[VectorSearchVectorizerKind.AI_SERVICES_VISION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The name of the kind of vectorization method being configured for use with vector search. + Required. Generate embeddings for an image or text input at query time using the Azure AI + Services Vision Vectorize API.""" + + @overload + def __init__( + self, + *, + vectorizer_name: str, + ai_services_vision_parameters: Optional["_models.AIServicesVisionParameters"] = 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) + self.kind = VectorSearchVectorizerKind.AI_SERVICES_VISION # type: ignore + + class AnalyzedTokenInfo(_Model): """Information about a token returned by an analyzer. @@ -471,15 +613,18 @@ class KnowledgeSource(_Model): """Represents a knowledge source definition. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBlobKnowledgeSource, IndexedOneLakeKnowledgeSource, SearchIndexKnowledgeSource, - WebKnowledgeSource + AzureBlobKnowledgeSource, FabricDataAgentKnowledgeSource, FabricOntologyKnowledgeSource, + FileKnowledgeSource, IndexedOneLakeKnowledgeSource, IndexedSharePointKnowledgeSource, + IndexedSqlKnowledgeSource, McpServerKnowledgeSource, RemoteSharePointKnowledgeSource, + SearchIndexKnowledgeSource, WebKnowledgeSource, WorkIQKnowledgeSource :ivar name: The name of the knowledge source. Required. :vartype name: str :ivar description: Optional user-defined description. :vartype description: str :ivar kind: The type of the knowledge source. Required. Known values are: "searchIndex", - "azureBlob", "indexedOneLake", and "web". + "azureBlob", "indexedSharePoint", "indexedOneLake", "indexedSql", "web", "remoteSharePoint", + "workIQ", "file", "mcpServer", "fabricDataAgent", and "fabricOntology". :vartype kind: str or ~azure.search.documents.indexes.models.KnowledgeSourceKind :ivar e_tag: The ETag of the knowledge source. :vartype e_tag: str @@ -501,7 +646,8 @@ class KnowledgeSource(_Model): """Optional user-defined description.""" kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) """The type of the knowledge source. Required. Known values are: \"searchIndex\", \"azureBlob\", - \"indexedOneLake\", and \"web\".""" + \"indexedSharePoint\", \"indexedOneLake\", \"indexedSql\", \"web\", \"remoteSharePoint\", + \"workIQ\", \"file\", \"mcpServer\", \"fabricDataAgent\", and \"fabricOntology\".""" e_tag: Optional[str] = rest_field(name="@odata.etag", visibility=["read", "create", "update", "delete", "query"]) """The ETag of the knowledge source.""" encryption_key: Optional["_models.SearchResourceEncryptionKey"] = rest_field( @@ -734,99 +880,16 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VectorSearchVectorizer(_Model): - """Specifies the vectorization method to be used during query time. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureMachineLearningVectorizer, AzureOpenAIVectorizer, WebApiVectorizer - - :ivar vectorizer_name: The name to associate with this particular vectorization method. - Required. - :vartype vectorizer_name: str - :ivar kind: Type of VectorSearchVectorizer. Required. Known values are: "azureOpenAI", - "customWebApi", "aiServicesVision", and "aml". - :vartype kind: str or ~azure.search.documents.indexes.models.VectorSearchVectorizerKind - """ - - __mapping__: dict[str, _Model] = {} - vectorizer_name: str = rest_field(name="name", visibility=["read", "create", "update", "delete", "query"]) - """The name to associate with this particular vectorization method. Required.""" - kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """Type of VectorSearchVectorizer. Required. Known values are: \"azureOpenAI\", \"customWebApi\", - \"aiServicesVision\", and \"aml\".""" - - @overload - def __init__( - self, - *, - vectorizer_name: str, - kind: str, - ) -> 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 AzureMachineLearningVectorizer(VectorSearchVectorizer, discriminator="aml"): - """Specifies an Azure Machine Learning endpoint deployed via the Azure AI Foundry Model Catalog - for generating the vector embedding of a query string. - - :ivar vectorizer_name: The name to associate with this particular vectorization method. - Required. - :vartype vectorizer_name: str - :ivar aml_parameters: Specifies the properties of the AML vectorizer. - :vartype aml_parameters: ~azure.search.documents.indexes.models.AzureMachineLearningParameters - :ivar kind: The name of the kind of vectorization method being configured for use with vector - search. Required. Generate embeddings using an Azure Machine Learning endpoint deployed via the - Azure AI Foundry Model Catalog at query time. - :vartype kind: str or ~azure.search.documents.indexes.models.AML - """ - - aml_parameters: Optional["_models.AzureMachineLearningParameters"] = rest_field( - name="amlParameters", visibility=["read", "create", "update", "delete", "query"] - ) - """Specifies the properties of the AML vectorizer.""" - kind: Literal[VectorSearchVectorizerKind.AML] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """The name of the kind of vectorization method being configured for use with vector search. - Required. Generate embeddings using an Azure Machine Learning endpoint deployed via the Azure - AI Foundry Model Catalog at query time.""" - - @overload - def __init__( - self, - *, - vectorizer_name: str, - aml_parameters: Optional["_models.AzureMachineLearningParameters"] = 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) - self.kind = VectorSearchVectorizerKind.AML # type: ignore - - class SearchIndexerSkill(_Model): """Base type for skills. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ChatCompletionSkill, WebApiSkill, AzureOpenAIEmbeddingSkill, CustomEntityLookupSkill, - KeyPhraseExtractionSkill, LanguageDetectionSkill, MergeSkill, PIIDetectionSkill, SplitSkill, - TextTranslationSkill, EntityLinkingSkill, EntityRecognitionSkillV3, SentimentSkillV3, - ConditionalSkill, ContentUnderstandingSkill, DocumentExtractionSkill, - DocumentIntelligenceLayoutSkill, ShaperSkill, ImageAnalysisSkill, OcrSkill + AzureMachineLearningSkill, ChatCompletionSkill, WebApiSkill, AzureOpenAIEmbeddingSkill, + CustomEntityLookupSkill, KeyPhraseExtractionSkill, LanguageDetectionSkill, MergeSkill, + PIIDetectionSkill, SplitSkill, TextTranslationSkill, EntityLinkingSkill, + EntityRecognitionSkillV3, SentimentSkillV3, ConditionalSkill, ContentUnderstandingSkill, + DocumentExtractionSkill, DocumentIntelligenceLayoutSkill, ShaperSkill, ImageAnalysisSkill, + OcrSkill, VisionVectorizeSkill :ivar odata_type: The discriminator for derived types. Required. Default value is None. :vartype odata_type: str @@ -894,9 +957,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AzureOpenAIEmbeddingSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill"): - """Allows you to generate a vector embedding for a given text input using the Azure OpenAI - resource. +class AzureMachineLearningSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Custom.AmlSkill"): + """The AML skill allows you to extend AI enrichment with a custom Azure Machine Learning (AML) + model. Once an AML model is trained and deployed, an AML skill integrates it into AI + enrichment. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill with no name defined will be given a default name of its 1-based index in the skills array, @@ -914,52 +978,60 @@ class AzureOpenAIEmbeddingSkill(SearchIndexerSkill, discriminator="#Microsoft.Sk :ivar outputs: The output of a skill is either a field in a search index, or a value that can be consumed as an input by another skill. Required. :vartype outputs: list[~azure.search.documents.indexes.models.OutputFieldMappingEntry] - :ivar resource_url: The resource URI of the Azure OpenAI resource. - :vartype resource_url: str - :ivar deployment_name: ID of the Azure OpenAI model deployment on the designated resource. - :vartype deployment_name: str - :ivar api_key: API key of the designated Azure OpenAI resource. - :vartype api_key: str - :ivar auth_identity: The user-assigned managed identity used for outbound connections. - :vartype auth_identity: ~azure.search.documents.indexes.models.SearchIndexerDataIdentity - :ivar model_name: The name of the embedding model that is deployed at the provided deploymentId - path. Known values are: "text-embedding-ada-002", "text-embedding-3-large", - "text-embedding-3-small", "gpt-5-mini", "gpt-5-nano", "gpt-5.4-mini", and "gpt-5.4-nano". - :vartype model_name: str or ~azure.search.documents.indexes.models.AzureOpenAIModelName - :ivar dimensions: The number of dimensions the resulting output embeddings should have. Only - supported in text-embedding-3 and later models. - :vartype dimensions: int + :ivar scoring_uri: (Required for no authentication or key authentication) The scoring URI of + the AML service to which the JSON payload will be sent. Only the https URI scheme is allowed. + :vartype scoring_uri: str + :ivar authentication_key: (Required for key authentication) The key for the AML service. + :vartype authentication_key: str + :ivar resource_id: (Required for token authentication). The Azure Resource Manager resource ID + of the AML service. It should be in the format + subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.MachineLearningServices/workspaces/{workspace-name}/services/{service_name}. + :vartype resource_id: str + :ivar timeout: (Optional) When specified, indicates the timeout for the http client making the + API call. + :vartype timeout: ~datetime.timedelta + :ivar region: (Optional for token authentication). The region the AML service is deployed in. + :vartype region: str + :ivar degree_of_parallelism: (Optional) When specified, indicates the number of calls the + indexer will make in parallel to the endpoint you have provided. You can decrease this value if + your endpoint is failing under too high of a request load, or raise it if your endpoint is able + to accept more requests and you would like an increase in the performance of the indexer. If + not set, a default value of 5 is used. The degreeOfParallelism can be set to a maximum of 10 + and a minimum of 1. + :vartype degree_of_parallelism: int :ivar odata_type: A URI fragment specifying the type of skill. Required. Default value is - "#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill". + "#Microsoft.Skills.Custom.AmlSkill". :vartype odata_type: str """ - resource_url: Optional[str] = rest_field( - name="resourceUri", visibility=["read", "create", "update", "delete", "query"] - ) - """The resource URI of the Azure OpenAI resource.""" - deployment_name: Optional[str] = rest_field( - name="deploymentId", visibility=["read", "create", "update", "delete", "query"] + scoring_uri: Optional[str] = rest_field(name="uri", visibility=["read", "create", "update", "delete", "query"]) + """(Required for no authentication or key authentication) The scoring URI of the AML service to + which the JSON payload will be sent. Only the https URI scheme is allowed.""" + authentication_key: Optional[str] = rest_field( + name="key", visibility=["read", "create", "update", "delete", "query"] ) - """ID of the Azure OpenAI model deployment on the designated resource.""" - api_key: Optional[str] = rest_field(name="apiKey", visibility=["read", "create", "update", "delete", "query"]) - """API key of the designated Azure OpenAI resource.""" - auth_identity: Optional["_models.SearchIndexerDataIdentity"] = rest_field( - name="authIdentity", visibility=["read", "create", "update", "delete", "query"] + """(Required for key authentication) The key for the AML service.""" + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] ) - """The user-assigned managed identity used for outbound connections.""" - model_name: Optional[Union[str, "_models.AzureOpenAIModelName"]] = rest_field( - name="modelName", visibility=["read", "create", "update", "delete", "query"] + """(Required for token authentication). The Azure Resource Manager resource ID of the AML service. + It should be in the format + subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.MachineLearningServices/workspaces/{workspace-name}/services/{service_name}.""" + timeout: Optional[datetime.timedelta] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """(Optional) When specified, indicates the timeout for the http client making the API call.""" + region: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """(Optional for token authentication). The region the AML service is deployed in.""" + degree_of_parallelism: Optional[int] = rest_field( + name="degreeOfParallelism", visibility=["read", "create", "update", "delete", "query"] ) - """The name of the embedding model that is deployed at the provided deploymentId path. Known - values are: \"text-embedding-ada-002\", \"text-embedding-3-large\", \"text-embedding-3-small\", - \"gpt-5-mini\", \"gpt-5-nano\", \"gpt-5.4-mini\", and \"gpt-5.4-nano\".""" - dimensions: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The number of dimensions the resulting output embeddings should have. Only supported in - text-embedding-3 and later models.""" - odata_type: Literal["#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """(Optional) When specified, indicates the number of calls the indexer will make in parallel to + the endpoint you have provided. You can decrease this value if your endpoint is failing under + too high of a request load, or raise it if your endpoint is able to accept more requests and + you would like an increase in the performance of the indexer. If not set, a default value of 5 + is used. The degreeOfParallelism can be set to a maximum of 10 and a minimum of 1.""" + odata_type: Literal["#Microsoft.Skills.Custom.AmlSkill"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """A URI fragment specifying the type of skill. Required. Default value is - \"#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill\".""" + \"#Microsoft.Skills.Custom.AmlSkill\".""" @overload def __init__( @@ -970,8 +1042,152 @@ def __init__( name: Optional[str] = None, description: Optional[str] = None, context: Optional[str] = None, - resource_url: Optional[str] = None, - deployment_name: Optional[str] = None, + scoring_uri: Optional[str] = None, + authentication_key: Optional[str] = None, + resource_id: Optional[str] = None, + timeout: Optional[datetime.timedelta] = None, + region: Optional[str] = None, + degree_of_parallelism: 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) + self.odata_type = "#Microsoft.Skills.Custom.AmlSkill" # type: ignore + + +class AzureMachineLearningVectorizer(VectorSearchVectorizer, discriminator="aml"): + """Specifies an Azure Machine Learning endpoint deployed via the Azure AI Foundry Model Catalog + for generating the vector embedding of a query string. + + :ivar vectorizer_name: The name to associate with this particular vectorization method. + Required. + :vartype vectorizer_name: str + :ivar aml_parameters: Specifies the properties of the AML vectorizer. + :vartype aml_parameters: ~azure.search.documents.indexes.models.AzureMachineLearningParameters + :ivar kind: The name of the kind of vectorization method being configured for use with vector + search. Required. Generate embeddings using an Azure Machine Learning endpoint deployed via the + Azure AI Foundry Model Catalog at query time. + :vartype kind: str or ~azure.search.documents.indexes.models.AML + """ + + aml_parameters: Optional["_models.AzureMachineLearningParameters"] = rest_field( + name="amlParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the properties of the AML vectorizer.""" + kind: Literal[VectorSearchVectorizerKind.AML] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The name of the kind of vectorization method being configured for use with vector search. + Required. Generate embeddings using an Azure Machine Learning endpoint deployed via the Azure + AI Foundry Model Catalog at query time.""" + + @overload + def __init__( + self, + *, + vectorizer_name: str, + aml_parameters: Optional["_models.AzureMachineLearningParameters"] = 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) + self.kind = VectorSearchVectorizerKind.AML # type: ignore + + +class AzureOpenAIEmbeddingSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill"): + """Allows you to generate a vector embedding for a given text input using the Azure OpenAI + resource. + + :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill + with no name defined will be given a default name of its 1-based index in the skills array, + prefixed with the character '#'. + :vartype name: str + :ivar description: The description of the skill which describes the inputs, outputs, and usage + of the skill. + :vartype description: str + :ivar context: Represents the level at which operations take place, such as the document root + or document content (for example, /document or /document/content). The default is /document. + :vartype context: str + :ivar inputs: Inputs of the skills could be a column in the source data set, or the output of + an upstream skill. Required. + :vartype inputs: list[~azure.search.documents.indexes.models.InputFieldMappingEntry] + :ivar outputs: The output of a skill is either a field in a search index, or a value that can + be consumed as an input by another skill. Required. + :vartype outputs: list[~azure.search.documents.indexes.models.OutputFieldMappingEntry] + :ivar resource_url: The resource URI of the Azure OpenAI resource. + :vartype resource_url: str + :ivar deployment_name: ID of the Azure OpenAI model deployment on the designated resource. + :vartype deployment_name: str + :ivar api_key: API key of the designated Azure OpenAI resource. + :vartype api_key: str + :ivar auth_identity: The user-assigned managed identity used for outbound connections. + :vartype auth_identity: ~azure.search.documents.indexes.models.SearchIndexerDataIdentity + :ivar model_name: The name of the embedding model that is deployed at the provided deploymentId + path. Known values are: "text-embedding-ada-002", "text-embedding-3-large", + "text-embedding-3-small", "gpt-4o", "gpt-4o-mini", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", + "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5.1", "gpt-5.2", "gpt-5.4", "gpt-5.4-mini", and + "gpt-5.4-nano". + :vartype model_name: str or ~azure.search.documents.indexes.models.AzureOpenAIModelName + :ivar dimensions: The number of dimensions the resulting output embeddings should have. Only + supported in text-embedding-3 and later models. + :vartype dimensions: int + :ivar odata_type: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill". + :vartype odata_type: str + """ + + resource_url: Optional[str] = rest_field( + name="resourceUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource URI of the Azure OpenAI resource.""" + deployment_name: Optional[str] = rest_field( + name="deploymentId", visibility=["read", "create", "update", "delete", "query"] + ) + """ID of the Azure OpenAI model deployment on the designated resource.""" + api_key: Optional[str] = rest_field(name="apiKey", visibility=["read", "create", "update", "delete", "query"]) + """API key of the designated Azure OpenAI resource.""" + auth_identity: Optional["_models.SearchIndexerDataIdentity"] = rest_field( + name="authIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The user-assigned managed identity used for outbound connections.""" + model_name: Optional[Union[str, "_models.AzureOpenAIModelName"]] = rest_field( + name="modelName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the embedding model that is deployed at the provided deploymentId path. Known + values are: \"text-embedding-ada-002\", \"text-embedding-3-large\", \"text-embedding-3-small\", + \"gpt-4o\", \"gpt-4o-mini\", \"gpt-4.1\", \"gpt-4.1-mini\", \"gpt-4.1-nano\", \"gpt-5\", + \"gpt-5-mini\", \"gpt-5-nano\", \"gpt-5.1\", \"gpt-5.2\", \"gpt-5.4\", \"gpt-5.4-mini\", and + \"gpt-5.4-nano\".""" + dimensions: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of dimensions the resulting output embeddings should have. Only supported in + text-embedding-3 and later models.""" + odata_type: Literal["#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """A URI fragment specifying the type of skill. Required. Default value is + \"#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill\".""" + + @overload + def __init__( + self, + *, + inputs: list["_models.InputFieldMappingEntry"], + outputs: list["_models.OutputFieldMappingEntry"], + name: Optional[str] = None, + description: Optional[str] = None, + context: Optional[str] = None, + resource_url: Optional[str] = None, + deployment_name: Optional[str] = None, api_key: Optional[str] = None, auth_identity: Optional["_models.SearchIndexerDataIdentity"] = None, model_name: Optional[Union[str, "_models.AzureOpenAIModelName"]] = None, @@ -990,6 +1206,51 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill" # type: ignore +class AzureOpenAITokenizerParameters(_Model): + """Azure OpenAI Tokenizer parameters. + + :ivar encoder_model_name: Only applies if the unit is set to azureOpenAITokens. Options include + 'R50k_base', 'P50k_base', 'P50k_edit' and 'CL100k_base'. The default value is 'CL100k_base'. + Known values are: "r50k_base", "p50k_base", "p50k_edit", and "cl100k_base". + :vartype encoder_model_name: str or + ~azure.search.documents.indexes.models.SplitSkillEncoderModelName + :ivar allowed_special_tokens: (Optional) Only applies if the unit is set to azureOpenAITokens. + This parameter defines a collection of special tokens that are permitted within the + tokenization process. + :vartype allowed_special_tokens: list[str] + """ + + encoder_model_name: Optional[Union[str, "_models.SplitSkillEncoderModelName"]] = rest_field( + name="encoderModelName", visibility=["read", "create", "update", "delete", "query"] + ) + """Only applies if the unit is set to azureOpenAITokens. Options include 'R50k_base', 'P50k_base', + 'P50k_edit' and 'CL100k_base'. The default value is 'CL100k_base'. Known values are: + \"r50k_base\", \"p50k_base\", \"p50k_edit\", and \"cl100k_base\".""" + allowed_special_tokens: Optional[list[str]] = rest_field( + name="allowedSpecialTokens", visibility=["read", "create", "update", "delete", "query"] + ) + """(Optional) Only applies if the unit is set to azureOpenAITokens. This parameter defines a + collection of special tokens that are permitted within the tokenization process.""" + + @overload + def __init__( + self, + *, + encoder_model_name: Optional[Union[str, "_models.SplitSkillEncoderModelName"]] = None, + allowed_special_tokens: Optional[list[str]] = 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 AzureOpenAIVectorizer(VectorSearchVectorizer, discriminator="azureOpenAI"): """Specifies the Azure OpenAI resource used to vectorize a query string. @@ -1044,7 +1305,9 @@ class AzureOpenAIVectorizerParameters(_Model): :vartype auth_identity: ~azure.search.documents.indexes.models.SearchIndexerDataIdentity :ivar model_name: The name of the embedding model that is deployed at the provided deploymentId path. Known values are: "text-embedding-ada-002", "text-embedding-3-large", - "text-embedding-3-small", "gpt-5-mini", "gpt-5-nano", "gpt-5.4-mini", and "gpt-5.4-nano". + "text-embedding-3-small", "gpt-4o", "gpt-4o-mini", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", + "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5.1", "gpt-5.2", "gpt-5.4", "gpt-5.4-mini", and + "gpt-5.4-nano". :vartype model_name: str or ~azure.search.documents.indexes.models.AzureOpenAIModelName """ @@ -1067,7 +1330,9 @@ class AzureOpenAIVectorizerParameters(_Model): ) """The name of the embedding model that is deployed at the provided deploymentId path. Known values are: \"text-embedding-ada-002\", \"text-embedding-3-large\", \"text-embedding-3-small\", - \"gpt-5-mini\", \"gpt-5-nano\", \"gpt-5.4-mini\", and \"gpt-5.4-nano\".""" + \"gpt-4o\", \"gpt-4o-mini\", \"gpt-4.1\", \"gpt-4.1-mini\", \"gpt-4.1-nano\", \"gpt-5\", + \"gpt-5-mini\", \"gpt-5-nano\", \"gpt-5.1\", \"gpt-5.2\", \"gpt-5.4\", \"gpt-5.4-mini\", and + \"gpt-5.4-nano\".""" @overload def __init__( @@ -1975,6 +2240,46 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Util.ConditionalSkill" # type: ignore +class ContentColumnMapping(_Model): + """Maps a SQL column to a search index field. + + :ivar name: Target index field name. Required. + :vartype name: str + :ivar source_field: SQL column name. Required. + :vartype source_field: str + :ivar search_field_type: Azure AI Search field type (e.g., Edm.String, Edm.Int32). Required. + :vartype search_field_type: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Target index field name. Required.""" + source_field: str = rest_field(name="sourceField", visibility=["read", "create", "update", "delete", "query"]) + """SQL column name. Required.""" + search_field_type: str = rest_field( + name="searchFieldType", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure AI Search field type (e.g., Edm.String, Edm.Int32). Required.""" + + @overload + def __init__( + self, + *, + name: str, + source_field: str, + search_field_type: str, + ) -> 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 ContentUnderstandingSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.ContentUnderstandingSkill"): """A skill that leverages Azure AI Content Understanding to process and extract structured insights from documents, enabling enriched, searchable content for enhanced document indexing @@ -2048,7 +2353,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ContentUnderstandingSkillChunkingProperties(_Model): # pylint: disable=name-too-long """Controls the cardinality for chunking the content. - :ivar unit: The unit of the chunk. "characters" + :ivar method: The chunking strategy. 'fixedSize' (default) or 'semantic'. Known values are: + "fixedSize" and "semantic". + :vartype method: str or ~search.models.ContentUnderstandingSkillChunkingMethod + :ivar unit: The unit of the chunk. Known values are: "characters" and "tokens". :vartype unit: str or ~azure.search.documents.indexes.models.ContentUnderstandingSkillChunkingUnit :ivar maximum_length: The maximum chunk length in characters. Default is 500. @@ -2057,10 +2365,15 @@ class ContentUnderstandingSkillChunkingProperties(_Model): # pylint: disable=na :vartype overlap_length: int """ + method: Optional[Union[str, "_search_models6.ContentUnderstandingSkillChunkingMethod"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The chunking strategy. 'fixedSize' (default) or 'semantic'. Known values are: \"fixedSize\" and + \"semantic\".""" unit: Optional[Union[str, "_models.ContentUnderstandingSkillChunkingUnit"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The unit of the chunk. \"characters\"""" + """The unit of the chunk. Known values are: \"characters\" and \"tokens\".""" maximum_length: Optional[int] = rest_field( name="maximumLength", visibility=["read", "create", "update", "delete", "query"] ) @@ -2074,6 +2387,7 @@ class ContentUnderstandingSkillChunkingProperties(_Model): # pylint: disable=na def __init__( self, *, + method: Optional[Union[str, "_search_models6.ContentUnderstandingSkillChunkingMethod"]] = None, unit: Optional[Union[str, "_models.ContentUnderstandingSkillChunkingUnit"]] = None, maximum_length: Optional[int] = None, overlap_length: Optional[int] = None, @@ -3469,6 +3783,39 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.ElisionTokenFilter" # type: ignore +class EmbeddingColumnMapping(_Model): + """Maps a SQL column to a vector field for embedding. + + :ivar name: Target vector field name in the search index. Required. + :vartype name: str + :ivar source_field: SQL column used as input for embedding generation. Required. + :vartype source_field: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Target vector field name in the search index. Required.""" + source_field: str = rest_field(name="sourceField", visibility=["read", "create", "update", "delete", "query"]) + """SQL column used as input for embedding generation. Required.""" + + @overload + def __init__( + self, + *, + name: str, + source_field: str, + ) -> 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 EntityLinkingSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.V3.EntityLinkingSkill"): """Using the Text Analytics API, extracts linked entities from text. @@ -3754,41 +4101,223 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FieldMapping(_Model): - """Defines a mapping between a field in a data source and a target field in an index. +class FabricDataAgentKnowledgeSource(KnowledgeSource, discriminator="fabricDataAgent"): + """Configuration for Fabric Data Agent knowledge source. - :ivar source_field_name: The name of the field in the data source. Required. - :vartype source_field_name: str - :ivar target_field_name: The name of the target field in the index. Same as the source field - name by default. - :vartype target_field_name: str - :ivar mapping_function: A function to apply to each source field value before indexing. - :vartype mapping_function: ~azure.search.documents.indexes.models.FieldMappingFunction + :ivar name: The name of the knowledge source. Required. + :vartype name: str + :ivar description: Optional user-defined description. + :vartype description: str + :ivar e_tag: The ETag of the knowledge source. + :vartype e_tag: str + :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your knowledge source + definition when you want full assurance that no one, not even Microsoft, can decrypt them. Once + you have encrypted your knowledge source definition, it will always remain encrypted. The + search service will ignore attempts to set this property to null. You can change this property + as needed if you want to rotate your encryption key; Your knowledge source definition will be + unaffected. Encryption with customer-managed keys is not available for free search services, + and is only available for paid services created on or after January 1, 2019. + :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar kind: The discriminator value. Required. A knowledge source that retrieves data from a + Fabric Data Agent. + :vartype kind: str or ~azure.search.documents.indexes.models.FABRIC_DATA_AGENT + :ivar fabric_data_agent_parameters: The parameters for the Fabric Data Agent knowledge source. + Required. + :vartype fabric_data_agent_parameters: + ~azure.search.documents.indexes.models.FabricDataAgentKnowledgeSourceParameters """ - source_field_name: str = rest_field( - name="sourceFieldName", visibility=["read", "create", "update", "delete", "query"] - ) - """The name of the field in the data source. Required.""" - target_field_name: Optional[str] = rest_field( - name="targetFieldName", visibility=["read", "create", "update", "delete", "query"] - ) - """The name of the target field in the index. Same as the source field name by default.""" - mapping_function: Optional["_models.FieldMappingFunction"] = rest_field( - name="mappingFunction", visibility=["read", "create", "update", "delete", "query"] + kind: Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. A knowledge source that retrieves data from a Fabric Data + Agent.""" + fabric_data_agent_parameters: "_models.FabricDataAgentKnowledgeSourceParameters" = rest_field( + name="fabricDataAgentParameters", visibility=["read", "create", "update", "delete", "query"] ) - """A function to apply to each source field value before indexing.""" + """The parameters for the Fabric Data Agent knowledge source. Required.""" @overload def __init__( self, *, - source_field_name: str, - target_field_name: Optional[str] = None, - mapping_function: Optional["_models.FieldMappingFunction"] = None, - ) -> None: ... - - @overload + name: str, + fabric_data_agent_parameters: "_models.FabricDataAgentKnowledgeSourceParameters", + description: Optional[str] = None, + e_tag: Optional[str] = None, + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = 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) + self.kind = KnowledgeSourceKind.FABRIC_DATA_AGENT # type: ignore + + +class FabricDataAgentKnowledgeSourceParameters(_Model): + """Parameters for Fabric Data Agent knowledge source. + + :ivar workspace_id: Fabric workspace ID. Required. + :vartype workspace_id: str + :ivar data_agent_id: Specifies which Fabric Data Agent to access. Required. + :vartype data_agent_id: str + """ + + workspace_id: str = rest_field(name="workspaceId", visibility=["read", "create", "update", "delete", "query"]) + """Fabric workspace ID. Required.""" + data_agent_id: str = rest_field(name="dataAgentId", visibility=["read", "create", "update", "delete", "query"]) + """Specifies which Fabric Data Agent to access. Required.""" + + @overload + def __init__( + self, + *, + workspace_id: str, + data_agent_id: str, + ) -> 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 FabricOntologyKnowledgeSource(KnowledgeSource, discriminator="fabricOntology"): + """Configuration for Fabric Ontology knowledge source. + + :ivar name: The name of the knowledge source. Required. + :vartype name: str + :ivar description: Optional user-defined description. + :vartype description: str + :ivar e_tag: The ETag of the knowledge source. + :vartype e_tag: str + :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your knowledge source + definition when you want full assurance that no one, not even Microsoft, can decrypt them. Once + you have encrypted your knowledge source definition, it will always remain encrypted. The + search service will ignore attempts to set this property to null. You can change this property + as needed if you want to rotate your encryption key; Your knowledge source definition will be + unaffected. Encryption with customer-managed keys is not available for free search services, + and is only available for paid services created on or after January 1, 2019. + :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar kind: The discriminator value. Required. A knowledge source that retrieves data from + Microsoft Fabric Ontology ontologies. + :vartype kind: str or ~azure.search.documents.indexes.models.FABRIC_ONTOLOGY + :ivar fabric_ontology_parameters: The parameters for the Fabric Ontology knowledge source. + Required. + :vartype fabric_ontology_parameters: + ~azure.search.documents.indexes.models.FabricOntologyKnowledgeSourceParameters + """ + + kind: Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. A knowledge source that retrieves data from Microsoft Fabric + Ontology ontologies.""" + fabric_ontology_parameters: "_models.FabricOntologyKnowledgeSourceParameters" = rest_field( + name="fabricOntologyParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters for the Fabric Ontology knowledge source. Required.""" + + @overload + def __init__( + self, + *, + name: str, + fabric_ontology_parameters: "_models.FabricOntologyKnowledgeSourceParameters", + description: Optional[str] = None, + e_tag: Optional[str] = None, + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = 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) + self.kind = KnowledgeSourceKind.FABRIC_ONTOLOGY # type: ignore + + +class FabricOntologyKnowledgeSourceParameters(_Model): + """Parameters for Fabric Ontology knowledge source. + + :ivar workspace_id: The Fabric workspace ID containing the ontology. Required. + :vartype workspace_id: str + :ivar ontology_id: The ID of the ontology to use from the Fabric workspace. Required. + :vartype ontology_id: str + """ + + workspace_id: str = rest_field(name="workspaceId", visibility=["read", "create", "update", "delete", "query"]) + """The Fabric workspace ID containing the ontology. Required.""" + ontology_id: str = rest_field(name="ontologyId", visibility=["read", "create", "update", "delete", "query"]) + """The ID of the ontology to use from the Fabric workspace. Required.""" + + @overload + def __init__( + self, + *, + workspace_id: str, + ontology_id: str, + ) -> 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 FieldMapping(_Model): + """Defines a mapping between a field in a data source and a target field in an index. + + :ivar source_field_name: The name of the field in the data source. Required. + :vartype source_field_name: str + :ivar target_field_name: The name of the target field in the index. Same as the source field + name by default. + :vartype target_field_name: str + :ivar mapping_function: A function to apply to each source field value before indexing. + :vartype mapping_function: ~azure.search.documents.indexes.models.FieldMappingFunction + """ + + source_field_name: str = rest_field( + name="sourceFieldName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the field in the data source. Required.""" + target_field_name: Optional[str] = rest_field( + name="targetFieldName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the target field in the index. Same as the source field name by default.""" + mapping_function: Optional["_models.FieldMappingFunction"] = rest_field( + name="mappingFunction", visibility=["read", "create", "update", "delete", "query"] + ) + """A function to apply to each source field value before indexing.""" + + @overload + def __init__( + self, + *, + source_field_name: str, + target_field_name: Optional[str] = None, + mapping_function: Optional["_models.FieldMappingFunction"] = None, + ) -> None: ... + + @overload def __init__(self, mapping: Mapping[str, Any]) -> None: """ :param mapping: raw JSON to initialize the model. @@ -3834,6 +4363,97 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class FileKnowledgeSource(KnowledgeSource, discriminator="file"): + """Configuration for File knowledge source that supports direct file upload and indexing. + + :ivar name: The name of the knowledge source. Required. + :vartype name: str + :ivar description: Optional user-defined description. + :vartype description: str + :ivar e_tag: The ETag of the knowledge source. + :vartype e_tag: str + :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your knowledge source + definition when you want full assurance that no one, not even Microsoft, can decrypt them. Once + you have encrypted your knowledge source definition, it will always remain encrypted. The + search service will ignore attempts to set this property to null. You can change this property + as needed if you want to rotate your encryption key; Your knowledge source definition will be + unaffected. Encryption with customer-managed keys is not available for free search services, + and is only available for paid services created on or after January 1, 2019. + :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar kind: Required. A knowledge source that supports direct file upload and indexing. + :vartype kind: str or ~azure.search.documents.indexes.models.FILE + :ivar file_parameters: The parameters for the File knowledge source. Required. + :vartype file_parameters: ~azure.search.documents.indexes.models.FileKnowledgeSourceParameters + """ + + kind: Literal[KnowledgeSourceKind.FILE] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. A knowledge source that supports direct file upload and indexing.""" + file_parameters: "_models.FileKnowledgeSourceParameters" = rest_field( + name="fileParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters for the File knowledge source. Required.""" + + @overload + def __init__( + self, + *, + name: str, + file_parameters: "_models.FileKnowledgeSourceParameters", + description: Optional[str] = None, + e_tag: Optional[str] = None, + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = 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) + self.kind = KnowledgeSourceKind.FILE # type: ignore + + +class FileKnowledgeSourceParameters(_Model): + """Parameters for File knowledge source. + + :ivar ingestion_parameters: Consolidates all general ingestion settings. Only 'minimal' content + extraction mode and embeddingModel are supported for file knowledge sources. + :vartype ingestion_parameters: + ~azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters + :ivar created_resources: Resources created by the file knowledge source. + :vartype created_resources: ~azure.search.documents.indexes.models.CreatedResources + """ + + ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = rest_field( + name="ingestionParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Consolidates all general ingestion settings. Only 'minimal' content extraction mode and + embeddingModel are supported for file knowledge sources.""" + created_resources: Optional["_models.CreatedResources"] = rest_field(name="createdResources", visibility=["read"]) + """Resources created by the file knowledge source.""" + + @overload + def __init__( + self, + *, + ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = 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 FreshnessScoringFunction(ScoringFunction, discriminator="freshness"): """Defines a function that boosts scores based on the value of a date-time field. @@ -4276,44 +4896,372 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexerExecutionResult(_Model): - """Represents the result of an individual indexer execution. +class IndexedSharePointKnowledgeSource(KnowledgeSource, discriminator="indexedSharePoint"): + """Configuration for SharePoint knowledge source. - :ivar status: The outcome of this indexer execution. Required. Known values are: - "transientFailure", "success", "inProgress", and "reset". - :vartype status: str or ~azure.search.documents.indexes.models.IndexerExecutionStatus - :ivar error_message: The error message indicating the top-level error, if any. - :vartype error_message: str - :ivar start_time: The start time of this indexer execution. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of this indexer execution, if the execution has already completed. - :vartype end_time: ~datetime.datetime - :ivar errors: The item-level indexing errors. Required. - :vartype errors: list[~azure.search.documents.indexes.models.SearchIndexerError] - :ivar warnings: The item-level indexing warnings. Required. - :vartype warnings: list[~azure.search.documents.indexes.models.SearchIndexerWarning] - :ivar item_count: The number of items that were processed during this indexer execution. This - includes both successfully processed items and items where indexing was attempted but failed. - Required. - :vartype item_count: int - :ivar failed_item_count: The number of items that failed to be indexed during this indexer - execution. Required. - :vartype failed_item_count: int - :ivar initial_tracking_state: Change tracking state with which an indexer execution started. - :vartype initial_tracking_state: str - :ivar final_tracking_state: Change tracking state with which an indexer execution finished. - :vartype final_tracking_state: str + :ivar name: The name of the knowledge source. Required. + :vartype name: str + :ivar description: Optional user-defined description. + :vartype description: str + :ivar e_tag: The ETag of the knowledge source. + :vartype e_tag: str + :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your knowledge source + definition when you want full assurance that no one, not even Microsoft, can decrypt them. Once + you have encrypted your knowledge source definition, it will always remain encrypted. The + search service will ignore attempts to set this property to null. You can change this property + as needed if you want to rotate your encryption key; Your knowledge source definition will be + unaffected. Encryption with customer-managed keys is not available for free search services, + and is only available for paid services created on or after January 1, 2019. + :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar kind: Required. A knowledge source that reads data from indexed SharePoint. + :vartype kind: str or ~azure.search.documents.indexes.models.INDEXED_SHARE_POINT + :ivar indexed_share_point_parameters: The parameters for the knowledge source. Required. + :vartype indexed_share_point_parameters: + ~azure.search.documents.indexes.models.IndexedSharePointKnowledgeSourceParameters """ - status: Union[str, "_models.IndexerExecutionStatus"] = rest_field(visibility=["read"]) - """The outcome of this indexer execution. Required. Known values are: \"transientFailure\", - \"success\", \"inProgress\", and \"reset\".""" - error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"]) - """The error message indicating the top-level error, if any.""" - start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") - """The start time of this indexer execution.""" - end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") - """The end time of this indexer execution, if the execution has already completed.""" + kind: Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. A knowledge source that reads data from indexed SharePoint.""" + indexed_share_point_parameters: "_models.IndexedSharePointKnowledgeSourceParameters" = rest_field( + name="indexedSharePointParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters for the knowledge source. Required.""" + + @overload + def __init__( + self, + *, + name: str, + indexed_share_point_parameters: "_models.IndexedSharePointKnowledgeSourceParameters", + description: Optional[str] = None, + e_tag: Optional[str] = None, + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = 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) + self.kind = KnowledgeSourceKind.INDEXED_SHARE_POINT # type: ignore + + +class IndexedSharePointKnowledgeSourceParameters(_Model): # pylint: disable=name-too-long + """Parameters for SharePoint knowledge source. + + :ivar connection_string: SharePoint connection string with format: + SharePointOnlineEndpoint=[SharePoint site url];ApplicationId=[Azure AD App + ID];ApplicationSecret=[Azure AD App client secret];TenantId=[SharePoint site tenant id]. + Required. + :vartype connection_string: str + :ivar container_name: Specifies which SharePoint libraries to access. Required. Known values + are: "defaultSiteLibrary", "allSiteLibraries", and "useQuery". + :vartype container_name: str or + ~azure.search.documents.indexes.models.IndexedSharePointContainerName + :ivar query: Optional query to filter SharePoint content. + :vartype query: str + :ivar ingestion_parameters: Consolidates all general ingestion settings. + :vartype ingestion_parameters: + ~azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters + :ivar created_resources: Resources created by the knowledge source. + :vartype created_resources: ~azure.search.documents.indexes.models.CreatedResources + """ + + connection_string: str = rest_field( + name="connectionString", visibility=["read", "create", "update", "delete", "query"] + ) + """SharePoint connection string with format: SharePointOnlineEndpoint=[SharePoint site + url];ApplicationId=[Azure AD App ID];ApplicationSecret=[Azure AD App client + secret];TenantId=[SharePoint site tenant id]. Required.""" + container_name: Union[str, "_models.IndexedSharePointContainerName"] = rest_field( + name="containerName", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies which SharePoint libraries to access. Required. Known values are: + \"defaultSiteLibrary\", \"allSiteLibraries\", and \"useQuery\".""" + query: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional query to filter SharePoint content.""" + ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = rest_field( + name="ingestionParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Consolidates all general ingestion settings.""" + created_resources: Optional["_models.CreatedResources"] = rest_field(name="createdResources", visibility=["read"]) + """Resources created by the knowledge source.""" + + @overload + def __init__( + self, + *, + connection_string: str, + container_name: Union[str, "_models.IndexedSharePointContainerName"], + query: Optional[str] = None, + ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = 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 IndexedSqlKnowledgeSource(KnowledgeSource, discriminator="indexedSql"): + """Configuration for indexed SQL knowledge source. + + :ivar name: The name of the knowledge source. Required. + :vartype name: str + :ivar description: Optional user-defined description. + :vartype description: str + :ivar e_tag: The ETag of the knowledge source. + :vartype e_tag: str + :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your knowledge source + definition when you want full assurance that no one, not even Microsoft, can decrypt them. Once + you have encrypted your knowledge source definition, it will always remain encrypted. The + search service will ignore attempts to set this property to null. You can change this property + as needed if you want to rotate your encryption key; Your knowledge source definition will be + unaffected. Encryption with customer-managed keys is not available for free search services, + and is only available for paid services created on or after January 1, 2019. + :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar kind: The discriminator value. Required. A knowledge source that retrieves and ingests + data from Azure SQL Database or SQL Managed Instance to a Search Index. + :vartype kind: str or ~azure.search.documents.indexes.models.INDEXED_SQL + :ivar indexed_sql_parameters: The parameters for the SQL knowledge source. Required. + :vartype indexed_sql_parameters: + ~azure.search.documents.indexes.models.IndexedSqlKnowledgeSourceParameters + """ + + kind: Literal[KnowledgeSourceKind.INDEXED_SQL] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. A knowledge source that retrieves and ingests data from + Azure SQL Database or SQL Managed Instance to a Search Index.""" + indexed_sql_parameters: "_models.IndexedSqlKnowledgeSourceParameters" = rest_field( + name="indexedSqlParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters for the SQL knowledge source. Required.""" + + @overload + def __init__( + self, + *, + name: str, + indexed_sql_parameters: "_models.IndexedSqlKnowledgeSourceParameters", + description: Optional[str] = None, + e_tag: Optional[str] = None, + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = 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) + self.kind = KnowledgeSourceKind.INDEXED_SQL # type: ignore + + +class IndexedSqlKnowledgeSourceParameters(_Model): + """Parameters for indexed SQL knowledge source. + + :ivar connection_string: The connection string for the Azure SQL Database or SQL Managed + Instance. Required. + :vartype connection_string: str + :ivar table_or_view: The name of the table or view to index. Can be schema-qualified (e.g., + 'dbo.MyTable'). Required. + :vartype table_or_view: str + :ivar high_water_mark_column_name: Optional column name for high water mark change detection. + If provided, uses HighWaterMarkChangeDetectionPolicy. + :vartype high_water_mark_column_name: str + :ivar content_columns: Optional column mappings for content fields. If omitted, all columns are + auto-discovered. + :vartype content_columns: list[~azure.search.documents.indexes.models.ContentColumnMapping] + :ivar embedding_columns: Optional column mappings for embedding vector fields. If omitted, no + vector fields are created. + :vartype embedding_columns: list[~azure.search.documents.indexes.models.EmbeddingColumnMapping] + :ivar ingestion_parameters: Consolidates all general ingestion settings including embedding + model, schedule, and identity. + :vartype ingestion_parameters: + ~azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters + :ivar created_resources: Resources created by the knowledge source. + :vartype created_resources: ~azure.search.documents.indexes.models.CreatedResources + """ + + connection_string: str = rest_field( + name="connectionString", visibility=["read", "create", "update", "delete", "query"] + ) + """The connection string for the Azure SQL Database or SQL Managed Instance. Required.""" + table_or_view: str = rest_field(name="tableOrView", visibility=["read", "create", "update", "delete", "query"]) + """The name of the table or view to index. Can be schema-qualified (e.g., 'dbo.MyTable'). + Required.""" + high_water_mark_column_name: Optional[str] = rest_field( + name="highWaterMarkColumnName", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional column name for high water mark change detection. If provided, uses + HighWaterMarkChangeDetectionPolicy.""" + content_columns: Optional[list["_models.ContentColumnMapping"]] = rest_field( + name="contentColumns", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional column mappings for content fields. If omitted, all columns are auto-discovered.""" + embedding_columns: Optional[list["_models.EmbeddingColumnMapping"]] = rest_field( + name="embeddingColumns", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional column mappings for embedding vector fields. If omitted, no vector fields are created.""" + ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = rest_field( + name="ingestionParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Consolidates all general ingestion settings including embedding model, schedule, and identity.""" + created_resources: Optional["_models.CreatedResources"] = rest_field(name="createdResources", visibility=["read"]) + """Resources created by the knowledge source.""" + + @overload + def __init__( + self, + *, + connection_string: str, + table_or_view: str, + high_water_mark_column_name: Optional[str] = None, + content_columns: Optional[list["_models.ContentColumnMapping"]] = None, + embedding_columns: Optional[list["_models.EmbeddingColumnMapping"]] = None, + ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = 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 IndexerCurrentState(_Model): + """Represents all of the state that defines and dictates the indexer's current execution. + + :ivar mode: The mode the indexer is running in. Known values are: "indexingAllDocs", + "indexingResetDocs", and "indexingResync". + :vartype mode: str or ~azure.search.documents.indexes.models.IndexingMode + :ivar all_docs_initial_tracking_state: Change tracking state used when indexing starts on all + documents in the datasource. + :vartype all_docs_initial_tracking_state: str + :ivar all_docs_final_tracking_state: Change tracking state value when indexing finishes on all + documents in the datasource. + :vartype all_docs_final_tracking_state: str + :ivar reset_docs_initial_tracking_state: Change tracking state used when indexing starts on + select, reset documents in the datasource. + :vartype reset_docs_initial_tracking_state: str + :ivar reset_docs_final_tracking_state: Change tracking state value when indexing finishes on + select, reset documents in the datasource. + :vartype reset_docs_final_tracking_state: str + :ivar resync_initial_tracking_state: Change tracking state used when indexing starts on + selective options from the datasource. + :vartype resync_initial_tracking_state: str + :ivar resync_final_tracking_state: Change tracking state value when indexing finishes on + selective options from the datasource. + :vartype resync_final_tracking_state: str + :ivar reset_document_keys: The list of document keys that have been reset. The document key is + the document's unique identifier for the data in the search index. The indexer will prioritize + selectively re-ingesting these keys. + :vartype reset_document_keys: list[str] + :ivar reset_datasource_document_ids: The list of datasource document ids that have been reset. + The datasource document id is the unique identifier for the data in the datasource. The indexer + will prioritize selectively re-ingesting these ids. + :vartype reset_datasource_document_ids: list[str] + """ + + mode: Optional[Union[str, "_models.IndexingMode"]] = rest_field(visibility=["read"]) + """The mode the indexer is running in. Known values are: \"indexingAllDocs\", + \"indexingResetDocs\", and \"indexingResync\".""" + all_docs_initial_tracking_state: Optional[str] = rest_field(name="allDocsInitialTrackingState", visibility=["read"]) + """Change tracking state used when indexing starts on all documents in the datasource.""" + all_docs_final_tracking_state: Optional[str] = rest_field(name="allDocsFinalTrackingState", visibility=["read"]) + """Change tracking state value when indexing finishes on all documents in the datasource.""" + reset_docs_initial_tracking_state: Optional[str] = rest_field( + name="resetDocsInitialTrackingState", visibility=["read"] + ) + """Change tracking state used when indexing starts on select, reset documents in the datasource.""" + reset_docs_final_tracking_state: Optional[str] = rest_field(name="resetDocsFinalTrackingState", visibility=["read"]) + """Change tracking state value when indexing finishes on select, reset documents in the + datasource.""" + resync_initial_tracking_state: Optional[str] = rest_field(name="resyncInitialTrackingState", visibility=["read"]) + """Change tracking state used when indexing starts on selective options from the datasource.""" + resync_final_tracking_state: Optional[str] = rest_field(name="resyncFinalTrackingState", visibility=["read"]) + """Change tracking state value when indexing finishes on selective options from the datasource.""" + reset_document_keys: Optional[list[str]] = rest_field(name="resetDocumentKeys", visibility=["read"]) + """The list of document keys that have been reset. The document key is the document's unique + identifier for the data in the search index. The indexer will prioritize selectively + re-ingesting these keys.""" + reset_datasource_document_ids: Optional[list[str]] = rest_field( + name="resetDatasourceDocumentIds", visibility=["read"] + ) + """The list of datasource document ids that have been reset. The datasource document id is the + unique identifier for the data in the datasource. The indexer will prioritize selectively + re-ingesting these ids.""" + + +class IndexerExecutionResult(_Model): + """Represents the result of an individual indexer execution. + + :ivar status: The outcome of this indexer execution. Required. Known values are: + "transientFailure", "success", "inProgress", and "reset". + :vartype status: str or ~azure.search.documents.indexes.models.IndexerExecutionStatus + :ivar status_detail: The outcome of this indexer execution. Known values are: "resetDocs" and + "resync". + :vartype status_detail: str or + ~azure.search.documents.indexes.models.IndexerExecutionStatusDetail + :ivar mode: The mode the indexer is running in. Known values are: "indexingAllDocs", + "indexingResetDocs", and "indexingResync". + :vartype mode: str or ~azure.search.documents.indexes.models.IndexingMode + :ivar error_message: The error message indicating the top-level error, if any. + :vartype error_message: str + :ivar start_time: The start time of this indexer execution. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of this indexer execution, if the execution has already completed. + :vartype end_time: ~datetime.datetime + :ivar errors: The item-level indexing errors. Required. + :vartype errors: list[~azure.search.documents.indexes.models.SearchIndexerError] + :ivar warnings: The item-level indexing warnings. Required. + :vartype warnings: list[~azure.search.documents.indexes.models.SearchIndexerWarning] + :ivar item_count: The number of items that were processed during this indexer execution. This + includes both successfully processed items and items where indexing was attempted but failed. + Required. + :vartype item_count: int + :ivar failed_item_count: The number of items that failed to be indexed during this indexer + execution. Required. + :vartype failed_item_count: int + :ivar initial_tracking_state: Change tracking state with which an indexer execution started. + :vartype initial_tracking_state: str + :ivar final_tracking_state: Change tracking state with which an indexer execution finished. + :vartype final_tracking_state: str + """ + + status: Union[str, "_models.IndexerExecutionStatus"] = rest_field(visibility=["read"]) + """The outcome of this indexer execution. Required. Known values are: \"transientFailure\", + \"success\", \"inProgress\", and \"reset\".""" + status_detail: Optional[Union[str, "_models.IndexerExecutionStatusDetail"]] = rest_field( + name="statusDetail", visibility=["read"] + ) + """The outcome of this indexer execution. Known values are: \"resetDocs\" and \"resync\".""" + mode: Optional[Union[str, "_models.IndexingMode"]] = rest_field(visibility=["read"]) + """The mode the indexer is running in. Known values are: \"indexingAllDocs\", + \"indexingResetDocs\", and \"indexingResync\".""" + error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"]) + """The error message indicating the top-level error, if any.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The start time of this indexer execution.""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """The end time of this indexer execution, if the execution has already completed.""" errors: list["_models.SearchIndexerError"] = rest_field(visibility=["read"]) """The item-level indexing errors. Required.""" warnings: list["_models.SearchIndexerWarning"] = rest_field(visibility=["read"]) @@ -4359,6 +5307,61 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class IndexerRuntime(_Model): + """Represents the indexer's cumulative runtime consumption in the service. + + :ivar used_seconds: Cumulative runtime of the indexer from the beginningTime to endingTime, in + seconds. Required. + :vartype used_seconds: int + :ivar remaining_seconds: Cumulative runtime remaining for all indexers in the service from the + beginningTime to endingTime, in seconds. + :vartype remaining_seconds: int + :ivar beginning_time: Beginning UTC time of the 24-hour period considered for indexer runtime + usage (inclusive). Required. + :vartype beginning_time: ~datetime.datetime + :ivar ending_time: End UTC time of the 24-hour period considered for indexer runtime usage + (inclusive). Required. + :vartype ending_time: ~datetime.datetime + """ + + used_seconds: int = rest_field(name="usedSeconds", visibility=["read", "create", "update", "delete", "query"]) + """Cumulative runtime of the indexer from the beginningTime to endingTime, in seconds. Required.""" + remaining_seconds: Optional[int] = rest_field( + name="remainingSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """Cumulative runtime remaining for all indexers in the service from the beginningTime to + endingTime, in seconds.""" + beginning_time: datetime.datetime = rest_field( + name="beginningTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Beginning UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + Required.""" + ending_time: datetime.datetime = rest_field( + name="endingTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """End UTC time of the 24-hour period considered for indexer runtime usage (inclusive). Required.""" + + @overload + def __init__( + self, + *, + used_seconds: int, + beginning_time: datetime.datetime, + ending_time: datetime.datetime, + remaining_seconds: 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 IndexingParameters(_Model): """Represents parameters for indexer execution. @@ -4668,36 +5671,78 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class InputFieldMappingEntry(_Model): - """Input field mapping for a skill. +class IndexStatisticsSummary(_Model): + """Statistics for a given index. Statistics are collected periodically and are not guaranteed to + always be up-to-date. - :ivar name: The name of the input. Required. + :ivar name: The name of the index. Required. :vartype name: str - :ivar source: The source of the input. - :vartype source: str - :ivar source_context: The source context used for selecting recursive inputs. - :vartype source_context: str - :ivar inputs: The recursive inputs used when creating a complex type. - :vartype inputs: list[~azure.search.documents.indexes.models.InputFieldMappingEntry] + :ivar document_count: The number of documents in the index. Required. + :vartype document_count: int + :ivar storage_size: The amount of storage in bytes consumed by the index. Required. + :vartype storage_size: int + :ivar vector_index_size: The amount of memory in bytes consumed by vectors in the index. + Required. + :vartype vector_index_size: int """ name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the input. Required.""" - source: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The source of the input.""" - source_context: Optional[str] = rest_field( - name="sourceContext", visibility=["read", "create", "update", "delete", "query"] - ) - """The source context used for selecting recursive inputs.""" - inputs: Optional[list["_models.InputFieldMappingEntry"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The recursive inputs used when creating a complex type.""" - - @overload - def __init__( - self, - *, + """The name of the index. Required.""" + document_count: int = rest_field(name="documentCount", visibility=["read"]) + """The number of documents in the index. Required.""" + storage_size: int = rest_field(name="storageSize", visibility=["read"]) + """The amount of storage in bytes consumed by the index. Required.""" + vector_index_size: int = rest_field(name="vectorIndexSize", visibility=["read"]) + """The amount of memory in bytes consumed by vectors in the index. Required.""" + + @overload + def __init__( + self, + *, + name: str, + ) -> 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 InputFieldMappingEntry(_Model): + """Input field mapping for a skill. + + :ivar name: The name of the input. Required. + :vartype name: str + :ivar source: The source of the input. + :vartype source: str + :ivar source_context: The source context used for selecting recursive inputs. + :vartype source_context: str + :ivar inputs: The recursive inputs used when creating a complex type. + :vartype inputs: list[~azure.search.documents.indexes.models.InputFieldMappingEntry] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the input. Required.""" + source: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The source of the input.""" + source_context: Optional[str] = rest_field( + name="sourceContext", visibility=["read", "create", "update", "delete", "query"] + ) + """The source context used for selecting recursive inputs.""" + inputs: Optional[list["_models.InputFieldMappingEntry"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The recursive inputs used when creating a complex type.""" + + @overload + def __init__( + self, + *, name: str, source: Optional[str] = None, source_context: Optional[str] = None, @@ -4992,12 +6037,28 @@ class KnowledgeBase(_Model): list[~azure.search.documents.indexes.models.KnowledgeSourceReference] :ivar models: Contains configuration options on how to connect to AI models. :vartype models: list[~azure.search.documents.indexes.models.KnowledgeBaseModel] + :ivar retrieval_reasoning_effort: The retrieval reasoning effort configuration. + :vartype retrieval_reasoning_effort: + ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalReasoningEffort + :ivar output_mode: The output mode for the knowledge base. Known values are: "extractiveData" + and "answerSynthesis". + :vartype output_mode: str or + ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalOutputMode :ivar e_tag: The ETag of the knowledge base. :vartype e_tag: str :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey :ivar description: The description of the knowledge base. :vartype description: str + :ivar retrieval_instructions: Instructions considered by the knowledge base when developing + query plan. + :vartype retrieval_instructions: str + :ivar answer_instructions: Instructions considered by the knowledge base when generating + answers. + :vartype answer_instructions: str + :ivar cors_options: Options to control Cross-Origin Resource Sharing (CORS) for the knowledge + base. + :vartype cors_options: ~azure.search.documents.indexes.models.CorsOptions """ name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -5010,6 +6071,15 @@ class KnowledgeBase(_Model): visibility=["read", "create", "update", "delete", "query"] ) """Contains configuration options on how to connect to AI models.""" + retrieval_reasoning_effort: Optional["_knowledgebases_models3.KnowledgeRetrievalReasoningEffort"] = rest_field( + name="retrievalReasoningEffort", visibility=["read", "create", "update", "delete", "query"] + ) + """The retrieval reasoning effort configuration.""" + output_mode: Optional[Union[str, "_knowledgebases_models3.KnowledgeRetrievalOutputMode"]] = rest_field( + name="outputMode", visibility=["read", "create", "update", "delete", "query"] + ) + """The output mode for the knowledge base. Known values are: \"extractiveData\" and + \"answerSynthesis\".""" e_tag: Optional[str] = rest_field(name="@odata.etag", visibility=["read", "create", "update", "delete", "query"]) """The ETag of the knowledge base.""" encryption_key: Optional["_models.SearchResourceEncryptionKey"] = rest_field( @@ -5018,6 +6088,18 @@ class KnowledgeBase(_Model): """A description of an encryption key that you create in Azure Key Vault.""" description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The description of the knowledge base.""" + retrieval_instructions: Optional[str] = rest_field( + name="retrievalInstructions", visibility=["read", "create", "update", "delete", "query"] + ) + """Instructions considered by the knowledge base when developing query plan.""" + answer_instructions: Optional[str] = rest_field( + name="answerInstructions", visibility=["read", "create", "update", "delete", "query"] + ) + """Instructions considered by the knowledge base when generating answers.""" + cors_options: Optional["_models.CorsOptions"] = rest_field( + name="corsOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """Options to control Cross-Origin Resource Sharing (CORS) for the knowledge base.""" @overload def __init__( @@ -5026,9 +6108,14 @@ def __init__( name: str, knowledge_sources: list["_models.KnowledgeSourceReference"], models: Optional[list["_models.KnowledgeBaseModel"]] = None, + retrieval_reasoning_effort: Optional["_knowledgebases_models3.KnowledgeRetrievalReasoningEffort"] = None, + output_mode: Optional[Union[str, "_knowledgebases_models3.KnowledgeRetrievalOutputMode"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, description: Optional[str] = None, + retrieval_instructions: Optional[str] = None, + answer_instructions: Optional[str] = None, + cors_options: Optional["_models.CorsOptions"] = None, ) -> None: ... @overload @@ -5115,16 +6202,37 @@ class KnowledgeSourceReference(_Model): :ivar name: The name of the knowledge source. Required. :vartype name: str + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source. When true, images extracted during ingestion are delivered to downstream + models at query time. + :vartype enable_image_serving: bool + :ivar enable_freshness: Indicates whether freshness-aware retrieval should be enabled for this + knowledge source. When true, a freshness scoring profile is applied during retrieval to bias + results toward newer documents. + :vartype enable_freshness: bool """ name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the knowledge source. Required.""" + enable_image_serving: Optional[bool] = rest_field( + name="enableImageServing", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether image serving should be enabled for this knowledge source. When true, images + extracted during ingestion are delivered to downstream models at query time.""" + enable_freshness: Optional[bool] = rest_field( + name="enableFreshness", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether freshness-aware retrieval should be enabled for this knowledge source. When + true, a freshness scoring profile is applied during retrieval to bias results toward newer + documents.""" @overload def __init__( self, *, name: str, + enable_image_serving: Optional[bool] = None, + enable_freshness: Optional[bool] = None, ) -> None: ... @overload @@ -5407,39 +6515,661 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.odata_type = "#Microsoft.Azure.Search.StandardAnalyzer" # type: ignore + self.odata_type = "#Microsoft.Azure.Search.StandardAnalyzer" # type: ignore + + +class LuceneStandardTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.StandardTokenizer"): + """Breaks text following the Unicode Text Segmentation rules. This tokenizer is implemented using + Apache Lucene. + + :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or + underscores, can only start and end with alphanumeric characters, and is limited to 128 + characters. Required. + :vartype name: str + :ivar max_token_length: The maximum token length. Default is 255. Tokens longer than the + maximum length are split. + :vartype max_token_length: int + :ivar odata_type: A URI fragment specifying the type of tokenizer. Required. Default value is + "#Microsoft.Azure.Search.StandardTokenizer". + :vartype odata_type: str + """ + + max_token_length: Optional[int] = rest_field( + name="maxTokenLength", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum token length. Default is 255. Tokens longer than the maximum length are split.""" + odata_type: Literal["#Microsoft.Azure.Search.StandardTokenizer"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """A URI fragment specifying the type of tokenizer. Required. Default value is + \"#Microsoft.Azure.Search.StandardTokenizer\".""" + + @overload + def __init__( + self, + *, + name: str, + max_token_length: 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) + self.odata_type = "#Microsoft.Azure.Search.StandardTokenizer" # type: ignore + + +class LuceneStandardTokenizerV2(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.StandardTokenizerV2"): + """Breaks text following the Unicode Text Segmentation rules. This tokenizer is implemented using + Apache Lucene. + + :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or + underscores, can only start and end with alphanumeric characters, and is limited to 128 + characters. Required. + :vartype name: str + :ivar max_token_length: The maximum token length. Default is 255. Tokens longer than the + maximum length are split. The maximum token length that can be used is 300 characters. + :vartype max_token_length: int + :ivar odata_type: A URI fragment specifying the type of tokenizer. Required. Default value is + "#Microsoft.Azure.Search.StandardTokenizerV2". + :vartype odata_type: str + """ + + max_token_length: Optional[int] = rest_field( + name="maxTokenLength", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum token length. Default is 255. Tokens longer than the maximum length are split. The + maximum token length that can be used is 300 characters.""" + odata_type: Literal["#Microsoft.Azure.Search.StandardTokenizerV2"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """A URI fragment specifying the type of tokenizer. Required. Default value is + \"#Microsoft.Azure.Search.StandardTokenizerV2\".""" + + @overload + def __init__( + self, + *, + name: str, + max_token_length: 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) + self.odata_type = "#Microsoft.Azure.Search.StandardTokenizerV2" # type: ignore + + +class MagnitudeScoringFunction(ScoringFunction, discriminator="magnitude"): + """Defines a function that boosts scores based on the magnitude of a numeric field. + + :ivar field_name: The name of the field used as input to the scoring function. Required. + :vartype field_name: str + :ivar boost: A multiplier for the raw score. Must be a positive number not equal to 1.0. + Required. + :vartype boost: float + :ivar interpolation: A value indicating how boosting will be interpolated across document + scores; defaults to "Linear". Known values are: "linear", "constant", "quadratic", and + "logarithmic". + :vartype interpolation: str or + ~azure.search.documents.indexes.models.ScoringFunctionInterpolation + :ivar parameters: Parameter values for the magnitude scoring function. Required. + :vartype parameters: ~azure.search.documents.indexes.models.MagnitudeScoringParameters + :ivar type: Indicates the type of function to use. Valid values include magnitude, freshness, + distance, and tag. The function type must be lower case. Required. Default value is + "magnitude". + :vartype type: str + """ + + parameters: "_models.MagnitudeScoringParameters" = rest_field( + name="magnitude", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameter values for the magnitude scoring function. Required.""" + type: Literal["magnitude"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Indicates the type of function to use. Valid values include magnitude, freshness, distance, and + tag. The function type must be lower case. Required. Default value is \"magnitude\".""" + + @overload + def __init__( + self, + *, + field_name: str, + boost: float, + parameters: "_models.MagnitudeScoringParameters", + interpolation: Optional[Union[str, "_models.ScoringFunctionInterpolation"]] = 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) + self.type = "magnitude" # type: ignore + + +class MagnitudeScoringParameters(_Model): + """Provides parameter values to a magnitude scoring function. + + :ivar boosting_range_start: The field value at which boosting starts. Required. + :vartype boosting_range_start: float + :ivar boosting_range_end: The field value at which boosting ends. Required. + :vartype boosting_range_end: float + :ivar should_boost_beyond_range_by_constant: A value indicating whether to apply a constant + boost for field values beyond the range end value; default is false. + :vartype should_boost_beyond_range_by_constant: bool + """ + + boosting_range_start: float = rest_field( + name="boostingRangeStart", visibility=["read", "create", "update", "delete", "query"] + ) + """The field value at which boosting starts. Required.""" + boosting_range_end: float = rest_field( + name="boostingRangeEnd", visibility=["read", "create", "update", "delete", "query"] + ) + """The field value at which boosting ends. Required.""" + should_boost_beyond_range_by_constant: Optional[bool] = rest_field( + name="constantBoostBeyondRange", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether to apply a constant boost for field values beyond the range end + value; default is false.""" + + @overload + def __init__( + self, + *, + boosting_range_start: float, + boosting_range_end: float, + should_boost_beyond_range_by_constant: Optional[bool] = 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 MappingCharFilter(CharFilter, discriminator="#Microsoft.Azure.Search.MappingCharFilter"): + """A character filter that applies mappings defined with the mappings option. Matching is greedy + (longest pattern matching at a given point wins). Replacement is allowed to be the empty + string. This character filter is implemented using Apache Lucene. + + :ivar name: The name of the char filter. It must only contain letters, digits, spaces, dashes + or underscores, can only start and end with alphanumeric characters, and is limited to 128 + characters. Required. + :vartype name: str + :ivar mappings: A list of mappings of the following format: "a=>b" (all occurrences of the + character "a" will be replaced with character "b"). Required. + :vartype mappings: list[str] + :ivar odata_type: A URI fragment specifying the type of char filter. Required. Default value is + "#Microsoft.Azure.Search.MappingCharFilter". + :vartype odata_type: str + """ + + mappings: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A list of mappings of the following format: \"a=>b\" (all occurrences of the character \"a\" + will be replaced with character \"b\"). Required.""" + odata_type: Literal["#Microsoft.Azure.Search.MappingCharFilter"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """A URI fragment specifying the type of char filter. Required. Default value is + \"#Microsoft.Azure.Search.MappingCharFilter\".""" + + @overload + def __init__( + self, + *, + name: str, + mappings: list[str], + ) -> 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) + self.odata_type = "#Microsoft.Azure.Search.MappingCharFilter" # type: ignore + + +class McpServerAuthentication(_Model): + """Authentication configuration for an MCP server knowledge source. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + McpServerFoundryConnectionAuthentication, McpServerStoredHeadersAuthentication + + :ivar kind: The kind of authentication to use. Required. Known values are: "foundryConnection" + and "storedHeaders". + :vartype kind: str or ~azure.search.documents.indexes.models.McpServerAuthenticationKind + """ + + __mapping__: dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """The kind of authentication to use. Required. Known values are: \"foundryConnection\" and + \"storedHeaders\".""" + + @overload + def __init__( + self, + *, + kind: str, + ) -> 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 McpServerOutputParsing(_Model): + """Output parsing configuration for an MCP server tool. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + McpServerAutoOutputParsing, McpServerJsonOutputParsing, McpServerNoneOutputParsing, + McpServerSplitOutputParsing + + :ivar kind: The kind of output parsing to apply. Required. Known values are: "auto", "json", + "split", and "none". + :vartype kind: str or ~azure.search.documents.indexes.models.McpServerOutputParsingKind + """ + + __mapping__: dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """The kind of output parsing to apply. Required. Known values are: \"auto\", \"json\", \"split\", + and \"none\".""" + + @overload + def __init__( + self, + *, + kind: str, + ) -> 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 McpServerAutoOutputParsing(McpServerOutputParsing, discriminator="auto"): + """Automatically detect the output format and parse accordingly. + + :ivar kind: The discriminator value. Required. Automatically detect the output format and parse + accordingly. + :vartype kind: str or ~azure.search.documents.indexes.models.AUTO + """ + + kind: Literal[McpServerOutputParsingKind.AUTO] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Automatically detect the output format and parse + accordingly.""" + + @overload + def __init__( + self, + ) -> 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) + self.kind = McpServerOutputParsingKind.AUTO # type: ignore + + +class McpServerFoundryConnectionAuthentication(McpServerAuthentication, discriminator="foundryConnection"): + """Authentication using an Azure AI Foundry connection. + + :ivar kind: The discriminator value. Required. Authenticate using an Azure AI Foundry + connection. + :vartype kind: str or ~azure.search.documents.indexes.models.FOUNDRY_CONNECTION + :ivar foundry_connection_parameters: Parameters for Foundry connection authentication. + Required. + :vartype foundry_connection_parameters: + ~azure.search.documents.indexes.models.McpServerFoundryConnectionParameters + """ + + kind: Literal[McpServerAuthenticationKind.FOUNDRY_CONNECTION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Authenticate using an Azure AI Foundry connection.""" + foundry_connection_parameters: "_models.McpServerFoundryConnectionParameters" = rest_field( + name="foundryConnectionParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters for Foundry connection authentication. Required.""" + + @overload + def __init__( + self, + *, + foundry_connection_parameters: "_models.McpServerFoundryConnectionParameters", + ) -> 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) + self.kind = McpServerAuthenticationKind.FOUNDRY_CONNECTION # type: ignore + + +class McpServerFoundryConnectionParameters(_Model): + """Parameters for Foundry connection authentication. + + :ivar connection_id: The Azure AI Foundry connection identifier. + :vartype connection_id: str + """ + + connection_id: Optional[str] = rest_field( + name="connectionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Azure AI Foundry connection identifier.""" + + @overload + def __init__( + self, + *, + connection_id: Optional[str] = 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 McpServerHeaders(_Model): + """A dictionary of HTTP header names and values.""" + + +class McpServerJsonOutputParsing(McpServerOutputParsing, discriminator="json"): + """Parse the output as a JSON document using the configured JSON parameters. + + :ivar kind: The discriminator value. Required. Parse the output as a JSON document using the + configured JSON parameters. + :vartype kind: str or ~azure.search.documents.indexes.models.JSON + :ivar json_parameters: Parameters for JSON output parsing. Required when kind is 'json'. + Required. + :vartype json_parameters: + ~azure.search.documents.indexes.models.McpServerOutputParsingJsonParameters + """ + + kind: Literal[McpServerOutputParsingKind.JSON] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Parse the output as a JSON document using the configured + JSON parameters.""" + json_parameters: "_models.McpServerOutputParsingJsonParameters" = rest_field( + name="jsonParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters for JSON output parsing. Required when kind is 'json'. Required.""" + + @overload + def __init__( + self, + *, + json_parameters: "_models.McpServerOutputParsingJsonParameters", + ) -> 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) + self.kind = McpServerOutputParsingKind.JSON # type: ignore + + +class McpServerKnowledgeSource(KnowledgeSource, discriminator="mcpServer"): + """Configuration for a knowledge source backed by an MCP (Model Context Protocol) server. + + :ivar name: The name of the knowledge source. Required. + :vartype name: str + :ivar description: Optional user-defined description. + :vartype description: str + :ivar e_tag: The ETag of the knowledge source. + :vartype e_tag: str + :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your knowledge source + definition when you want full assurance that no one, not even Microsoft, can decrypt them. Once + you have encrypted your knowledge source definition, it will always remain encrypted. The + search service will ignore attempts to set this property to null. You can change this property + as needed if you want to rotate your encryption key; Your knowledge source definition will be + unaffected. Encryption with customer-managed keys is not available for free search services, + and is only available for paid services created on or after January 1, 2019. + :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar kind: The discriminator value. Required. A knowledge source backed by an MCP (Model + Context Protocol) server. + :vartype kind: str or ~azure.search.documents.indexes.models.MCP_SERVER + :ivar mcp_server_parameters: The parameters for the MCP server knowledge source. Required. + :vartype mcp_server_parameters: + ~azure.search.documents.indexes.models.McpServerKnowledgeSourceParameters + """ + + kind: Literal[KnowledgeSourceKind.MCP_SERVER] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. A knowledge source backed by an MCP (Model Context Protocol) + server.""" + mcp_server_parameters: "_models.McpServerKnowledgeSourceParameters" = rest_field( + name="mcpServerParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters for the MCP server knowledge source. Required.""" + + @overload + def __init__( + self, + *, + name: str, + mcp_server_parameters: "_models.McpServerKnowledgeSourceParameters", + description: Optional[str] = None, + e_tag: Optional[str] = None, + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = 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) + self.kind = KnowledgeSourceKind.MCP_SERVER # type: ignore + + +class McpServerKnowledgeSourceParameters(_Model): + """Parameters for an MCP server knowledge source. + + :ivar server_url: The URL of the MCP server endpoint. Required. + :vartype server_url: str + :ivar authentication: The authentication configuration for the MCP server. + :vartype authentication: ~azure.search.documents.indexes.models.McpServerAuthentication + :ivar tools: The list of tools to invoke on the MCP server. Required. + :vartype tools: list[~azure.search.documents.indexes.models.McpServerTool] + """ + + server_url: str = rest_field(name="serverURL", visibility=["read", "create", "update", "delete", "query"]) + """The URL of the MCP server endpoint. Required.""" + authentication: Optional["_models.McpServerAuthentication"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The authentication configuration for the MCP server.""" + tools: list["_models.McpServerTool"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of tools to invoke on the MCP server. Required.""" + + @overload + def __init__( + self, + *, + server_url: str, + tools: list["_models.McpServerTool"], + authentication: Optional["_models.McpServerAuthentication"] = 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 McpServerNoneOutputParsing(McpServerOutputParsing, discriminator="none"): + """Treat the output as a single block without any parsing. + + :ivar kind: The discriminator value. Required. Treat the output as a single block without any + parsing. + :vartype kind: str or ~azure.search.documents.indexes.models.NONE + """ + + kind: Literal[McpServerOutputParsingKind.NONE] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Treat the output as a single block without any parsing.""" + + @overload + def __init__( + self, + ) -> 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) + self.kind = McpServerOutputParsingKind.NONE # type: ignore + + +class McpServerOutputParsingJsonParameters(_Model): + """Parameters for JSON output parsing. + + :ivar documents_path: The JSON path to the array of documents in the tool output. Required. + :vartype documents_path: str + :ivar include_context: Whether to include surrounding context from the JSON output alongside + extracted documents. + :vartype include_context: bool + """ + + documents_path: str = rest_field(name="documentsPath", visibility=["read", "create", "update", "delete", "query"]) + """The JSON path to the array of documents in the tool output. Required.""" + include_context: Optional[bool] = rest_field( + name="includeContext", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether to include surrounding context from the JSON output alongside extracted documents.""" + + @overload + def __init__( + self, + *, + documents_path: str, + include_context: Optional[bool] = 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 LuceneStandardTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.StandardTokenizer"): - """Breaks text following the Unicode Text Segmentation rules. This tokenizer is implemented using - Apache Lucene. +class McpServerOutputParsingSplitParameters(_Model): + """Parameters for split output parsing. - :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or - underscores, can only start and end with alphanumeric characters, and is limited to 128 - characters. Required. - :vartype name: str - :ivar max_token_length: The maximum token length. Default is 255. Tokens longer than the - maximum length are split. - :vartype max_token_length: int - :ivar odata_type: A URI fragment specifying the type of tokenizer. Required. Default value is - "#Microsoft.Azure.Search.StandardTokenizer". - :vartype odata_type: str + :ivar text_split_mode: The text split mode to use. Known values are: "pages" and "sentences". + :vartype text_split_mode: str or ~azure.search.documents.indexes.models.TextSplitMode + :ivar maximum_page_length: The maximum number of characters per page. + :vartype maximum_page_length: int + :ivar page_overlap_length: The number of characters to overlap between pages. + :vartype page_overlap_length: int + :ivar maximum_pages_to_take: The maximum number of pages to take from the output. + :vartype maximum_pages_to_take: int + :ivar default_language_code: A value indicating which language code to use. Default is ``en``. + Known values are: "am", "bs", "cs", "da", "de", "en", "es", "et", "fi", "fr", "he", "hi", "hr", + "hu", "id", "is", "it", "ja", "ko", "lv", "nb", "nl", "pl", "pt", "pt-br", "ru", "sk", "sl", + "sr", "sv", "tr", "ur", and "zh". + :vartype default_language_code: str or + ~azure.search.documents.indexes.models.SplitSkillLanguage """ - max_token_length: Optional[int] = rest_field( - name="maxTokenLength", visibility=["read", "create", "update", "delete", "query"] + text_split_mode: Optional[Union[str, "_models.TextSplitMode"]] = rest_field( + name="textSplitMode", visibility=["read", "create", "update", "delete", "query"] ) - """The maximum token length. Default is 255. Tokens longer than the maximum length are split.""" - odata_type: Literal["#Microsoft.Azure.Search.StandardTokenizer"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """A URI fragment specifying the type of tokenizer. Required. Default value is - \"#Microsoft.Azure.Search.StandardTokenizer\".""" + """The text split mode to use. Known values are: \"pages\" and \"sentences\".""" + maximum_page_length: Optional[int] = rest_field( + name="maximumPageLength", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of characters per page.""" + page_overlap_length: Optional[int] = rest_field( + name="pageOverlapLength", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of characters to overlap between pages.""" + maximum_pages_to_take: Optional[int] = rest_field( + name="maximumPagesToTake", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of pages to take from the output.""" + default_language_code: Optional[Union[str, "_models.SplitSkillLanguage"]] = rest_field( + name="defaultLanguageCode", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating which language code to use. Default is ``en``. Known values are: \"am\", + \"bs\", \"cs\", \"da\", \"de\", \"en\", \"es\", \"et\", \"fi\", \"fr\", \"he\", \"hi\", \"hr\", + \"hu\", \"id\", \"is\", \"it\", \"ja\", \"ko\", \"lv\", \"nb\", \"nl\", \"pl\", \"pt\", + \"pt-br\", \"ru\", \"sk\", \"sl\", \"sr\", \"sv\", \"tr\", \"ur\", and \"zh\".""" @overload def __init__( self, *, - name: str, - max_token_length: Optional[int] = None, + text_split_mode: Optional[Union[str, "_models.TextSplitMode"]] = None, + maximum_page_length: Optional[int] = None, + page_overlap_length: Optional[int] = None, + maximum_pages_to_take: Optional[int] = None, + default_language_code: Optional[Union[str, "_models.SplitSkillLanguage"]] = None, ) -> None: ... @overload @@ -5451,40 +7181,32 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.odata_type = "#Microsoft.Azure.Search.StandardTokenizer" # type: ignore -class LuceneStandardTokenizerV2(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.StandardTokenizerV2"): - """Breaks text following the Unicode Text Segmentation rules. This tokenizer is implemented using - Apache Lucene. +class McpServerSplitOutputParsing(McpServerOutputParsing, discriminator="split"): + """Split the output into pages using the configured split parameters. - :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or - underscores, can only start and end with alphanumeric characters, and is limited to 128 - characters. Required. - :vartype name: str - :ivar max_token_length: The maximum token length. Default is 255. Tokens longer than the - maximum length are split. The maximum token length that can be used is 300 characters. - :vartype max_token_length: int - :ivar odata_type: A URI fragment specifying the type of tokenizer. Required. Default value is - "#Microsoft.Azure.Search.StandardTokenizerV2". - :vartype odata_type: str + :ivar kind: The discriminator value. Required. Split the output into pages using the configured + split parameters. + :vartype kind: str or ~azure.search.documents.indexes.models.SPLIT + :ivar split_parameters: Parameters for split output parsing. + :vartype split_parameters: + ~azure.search.documents.indexes.models.McpServerOutputParsingSplitParameters """ - max_token_length: Optional[int] = rest_field( - name="maxTokenLength", visibility=["read", "create", "update", "delete", "query"] + kind: Literal[McpServerOutputParsingKind.SPLIT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Split the output into pages using the configured split + parameters.""" + split_parameters: Optional["_models.McpServerOutputParsingSplitParameters"] = rest_field( + name="splitParameters", visibility=["read", "create", "update", "delete", "query"] ) - """The maximum token length. Default is 255. Tokens longer than the maximum length are split. The - maximum token length that can be used is 300 characters.""" - odata_type: Literal["#Microsoft.Azure.Search.StandardTokenizerV2"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """A URI fragment specifying the type of tokenizer. Required. Default value is - \"#Microsoft.Azure.Search.StandardTokenizerV2\".""" + """Parameters for split output parsing.""" @overload def __init__( self, *, - name: str, - max_token_length: Optional[int] = None, + split_parameters: Optional["_models.McpServerOutputParsingSplitParameters"] = None, ) -> None: ... @overload @@ -5496,46 +7218,31 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.odata_type = "#Microsoft.Azure.Search.StandardTokenizerV2" # type: ignore + self.kind = McpServerOutputParsingKind.SPLIT # type: ignore -class MagnitudeScoringFunction(ScoringFunction, discriminator="magnitude"): - """Defines a function that boosts scores based on the magnitude of a numeric field. +class McpServerStoredHeadersAuthentication(McpServerAuthentication, discriminator="storedHeaders"): + """Authentication using stored HTTP headers. - :ivar field_name: The name of the field used as input to the scoring function. Required. - :vartype field_name: str - :ivar boost: A multiplier for the raw score. Must be a positive number not equal to 1.0. - Required. - :vartype boost: float - :ivar interpolation: A value indicating how boosting will be interpolated across document - scores; defaults to "Linear". Known values are: "linear", "constant", "quadratic", and - "logarithmic". - :vartype interpolation: str or - ~azure.search.documents.indexes.models.ScoringFunctionInterpolation - :ivar parameters: Parameter values for the magnitude scoring function. Required. - :vartype parameters: ~azure.search.documents.indexes.models.MagnitudeScoringParameters - :ivar type: Indicates the type of function to use. Valid values include magnitude, freshness, - distance, and tag. The function type must be lower case. Required. Default value is - "magnitude". - :vartype type: str + :ivar kind: The discriminator value. Required. Authenticate using stored HTTP headers. + :vartype kind: str or ~azure.search.documents.indexes.models.STORED_HEADERS + :ivar stored_headers_parameters: Parameters for stored headers authentication. Required. + :vartype stored_headers_parameters: + ~azure.search.documents.indexes.models.McpServerStoredHeadersParameters """ - parameters: "_models.MagnitudeScoringParameters" = rest_field( - name="magnitude", visibility=["read", "create", "update", "delete", "query"] + kind: Literal[McpServerAuthenticationKind.STORED_HEADERS] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Authenticate using stored HTTP headers.""" + stored_headers_parameters: "_models.McpServerStoredHeadersParameters" = rest_field( + name="storedHeadersParameters", visibility=["read", "create", "update", "delete", "query"] ) - """Parameter values for the magnitude scoring function. Required.""" - type: Literal["magnitude"] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Indicates the type of function to use. Valid values include magnitude, freshness, distance, and - tag. The function type must be lower case. Required. Default value is \"magnitude\".""" + """Parameters for stored headers authentication. Required.""" @overload def __init__( self, *, - field_name: str, - boost: float, - parameters: "_models.MagnitudeScoringParameters", - interpolation: Optional[Union[str, "_models.ScoringFunctionInterpolation"]] = None, + stored_headers_parameters: "_models.McpServerStoredHeadersParameters", ) -> None: ... @overload @@ -5547,42 +7254,26 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = "magnitude" # type: ignore + self.kind = McpServerAuthenticationKind.STORED_HEADERS # type: ignore -class MagnitudeScoringParameters(_Model): - """Provides parameter values to a magnitude scoring function. +class McpServerStoredHeadersParameters(_Model): + """Parameters for stored headers authentication. - :ivar boosting_range_start: The field value at which boosting starts. Required. - :vartype boosting_range_start: float - :ivar boosting_range_end: The field value at which boosting ends. Required. - :vartype boosting_range_end: float - :ivar should_boost_beyond_range_by_constant: A value indicating whether to apply a constant - boost for field values beyond the range end value; default is false. - :vartype should_boost_beyond_range_by_constant: bool + :ivar headers: The stored HTTP headers to include in MCP server requests. + :vartype headers: ~azure.search.documents.indexes.models.McpServerHeaders """ - boosting_range_start: float = rest_field( - name="boostingRangeStart", visibility=["read", "create", "update", "delete", "query"] - ) - """The field value at which boosting starts. Required.""" - boosting_range_end: float = rest_field( - name="boostingRangeEnd", visibility=["read", "create", "update", "delete", "query"] - ) - """The field value at which boosting ends. Required.""" - should_boost_beyond_range_by_constant: Optional[bool] = rest_field( - name="constantBoostBeyondRange", visibility=["read", "create", "update", "delete", "query"] + headers: Optional["_models.McpServerHeaders"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """A value indicating whether to apply a constant boost for field values beyond the range end - value; default is false.""" + """The stored HTTP headers to include in MCP server requests.""" @overload def __init__( self, *, - boosting_range_start: float, - boosting_range_end: float, - should_boost_beyond_range_by_constant: Optional[bool] = None, + headers: Optional["_models.McpServerHeaders"] = None, ) -> None: ... @overload @@ -5596,36 +7287,47 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MappingCharFilter(CharFilter, discriminator="#Microsoft.Azure.Search.MappingCharFilter"): - """A character filter that applies mappings defined with the mappings option. Matching is greedy - (longest pattern matching at a given point wins). Replacement is allowed to be the empty - string. This character filter is implemented using Apache Lucene. +class McpServerTool(_Model): + """Represents a single tool within an MCP server knowledge source. - :ivar name: The name of the char filter. It must only contain letters, digits, spaces, dashes - or underscores, can only start and end with alphanumeric characters, and is limited to 128 - characters. Required. + :ivar name: The name of the MCP tool to invoke. :vartype name: str - :ivar mappings: A list of mappings of the following format: "a=>b" (all occurrences of the - character "a" will be replaced with character "b"). Required. - :vartype mappings: list[str] - :ivar odata_type: A URI fragment specifying the type of char filter. Required. Default value is - "#Microsoft.Azure.Search.MappingCharFilter". - :vartype odata_type: str + :ivar output_parsing: Optional configuration for parsing the tool's output. + :vartype output_parsing: ~azure.search.documents.indexes.models.McpServerOutputParsing + :ivar inclusion_mode: Controls how the parsed results from this tool are integrated into the + final result set. Defaults to 'always' when not specified. Known values are: "reranked" and + "always". + :vartype inclusion_mode: str or + ~azure.search.documents.indexes.models.McpServerToolInclusionMode + :ivar max_output_tokens: Optional post-parsing token cap for this tool's output. Must be + greater than 0 when specified. + :vartype max_output_tokens: int """ - mappings: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """A list of mappings of the following format: \"a=>b\" (all occurrences of the character \"a\" - will be replaced with character \"b\"). Required.""" - odata_type: Literal["#Microsoft.Azure.Search.MappingCharFilter"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """A URI fragment specifying the type of char filter. Required. Default value is - \"#Microsoft.Azure.Search.MappingCharFilter\".""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the MCP tool to invoke.""" + output_parsing: Optional["_models.McpServerOutputParsing"] = rest_field( + name="outputParsing", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional configuration for parsing the tool's output.""" + inclusion_mode: Optional[Union[str, "_models.McpServerToolInclusionMode"]] = rest_field( + name="inclusionMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Controls how the parsed results from this tool are integrated into the final result set. + Defaults to 'always' when not specified. Known values are: \"reranked\" and \"always\".""" + max_output_tokens: Optional[int] = rest_field( + name="maxOutputTokens", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional post-parsing token cap for this tool's output. Must be greater than 0 when specified.""" @overload def __init__( self, *, - name: str, - mappings: list[str], + name: Optional[str] = None, + output_parsing: Optional["_models.McpServerOutputParsing"] = None, + inclusion_mode: Optional[Union[str, "_models.McpServerToolInclusionMode"]] = None, + max_output_tokens: Optional[int] = None, ) -> None: ... @overload @@ -5637,7 +7339,6 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.odata_type = "#Microsoft.Azure.Search.MappingCharFilter" # type: ignore class MergeSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.MergeSkill"): @@ -6629,59 +8330,166 @@ class PIIDetectionSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Tex :vartype odata_type: str """ - default_language_code: Optional[str] = rest_field( - name="defaultLanguageCode", visibility=["read", "create", "update", "delete", "query"] - ) - """A value indicating which language code to use. Default is ``en``.""" - minimum_precision: Optional[float] = rest_field( - name="minimumPrecision", visibility=["read", "create", "update", "delete", "query"] - ) - """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.""" - masking_mode: Optional[Union[str, "_models.PIIDetectionSkillMaskingMode"]] = rest_field( - name="maskingMode", visibility=["read", "create", "update", "delete", "query"] - ) - """A parameter that provides various ways to mask the personal information detected in the input - text. Default is 'none'. Known values are: \"none\" and \"replace\".""" - mask: Optional[str] = rest_field( - name="maskingCharacter", visibility=["read", "create", "update", "delete", "query"] + default_language_code: Optional[str] = rest_field( + name="defaultLanguageCode", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating which language code to use. Default is ``en``.""" + minimum_precision: Optional[float] = rest_field( + name="minimumPrecision", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + masking_mode: Optional[Union[str, "_models.PIIDetectionSkillMaskingMode"]] = rest_field( + name="maskingMode", visibility=["read", "create", "update", "delete", "query"] + ) + """A parameter that provides various ways to mask the personal information detected in the input + text. Default is 'none'. Known values are: \"none\" and \"replace\".""" + mask: Optional[str] = rest_field( + name="maskingCharacter", visibility=["read", "create", "update", "delete", "query"] + ) + """The character used to mask the text if the maskingMode parameter is set to replace. Default is + '*'.""" + model_version: Optional[str] = rest_field( + name="modelVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The version of the model to use when calling the Text Analytics service. It will default to the + latest available when not specified. We recommend you do not specify this value unless + absolutely necessary.""" + pii_categories: Optional[list[str]] = rest_field( + name="piiCategories", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of PII entity categories that should be extracted and masked.""" + domain: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """If specified, will set the PII domain to include only a subset of the entity categories. + Possible values include: 'phi', 'none'. Default is 'none'.""" + odata_type: Literal["#Microsoft.Skills.Text.PIIDetectionSkill"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """A URI fragment specifying the type of skill. Required. Default value is + \"#Microsoft.Skills.Text.PIIDetectionSkill\".""" + + @overload + def __init__( + self, + *, + inputs: list["_models.InputFieldMappingEntry"], + outputs: list["_models.OutputFieldMappingEntry"], + name: Optional[str] = None, + description: Optional[str] = None, + context: Optional[str] = None, + default_language_code: Optional[str] = None, + minimum_precision: Optional[float] = None, + masking_mode: Optional[Union[str, "_models.PIIDetectionSkillMaskingMode"]] = None, + mask: Optional[str] = None, + model_version: Optional[str] = None, + pii_categories: Optional[list[str]] = None, + domain: Optional[str] = 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) + self.odata_type = "#Microsoft.Skills.Text.PIIDetectionSkill" # type: ignore + + +class RemoteSharePointKnowledgeSource(KnowledgeSource, discriminator="remoteSharePoint"): + """Configuration for remote SharePoint knowledge source. + + :ivar name: The name of the knowledge source. Required. + :vartype name: str + :ivar description: Optional user-defined description. + :vartype description: str + :ivar e_tag: The ETag of the knowledge source. + :vartype e_tag: str + :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your knowledge source + definition when you want full assurance that no one, not even Microsoft, can decrypt them. Once + you have encrypted your knowledge source definition, it will always remain encrypted. The + search service will ignore attempts to set this property to null. You can change this property + as needed if you want to rotate your encryption key; Your knowledge source definition will be + unaffected. Encryption with customer-managed keys is not available for free search services, + and is only available for paid services created on or after January 1, 2019. + :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar kind: Required. A knowledge source that reads data from remote SharePoint. + :vartype kind: str or ~azure.search.documents.indexes.models.REMOTE_SHARE_POINT + :ivar remote_share_point_parameters: The parameters for the remote SharePoint knowledge source. + :vartype remote_share_point_parameters: + ~azure.search.documents.indexes.models.RemoteSharePointKnowledgeSourceParameters + """ + + kind: Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. A knowledge source that reads data from remote SharePoint.""" + remote_share_point_parameters: Optional["_models.RemoteSharePointKnowledgeSourceParameters"] = rest_field( + name="remoteSharePointParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters for the remote SharePoint knowledge source.""" + + @overload + def __init__( + self, + *, + name: str, + description: Optional[str] = None, + e_tag: Optional[str] = None, + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, + remote_share_point_parameters: Optional["_models.RemoteSharePointKnowledgeSourceParameters"] = 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) + self.kind = KnowledgeSourceKind.REMOTE_SHARE_POINT # type: ignore + + +class RemoteSharePointKnowledgeSourceParameters(_Model): # pylint: disable=name-too-long + """Parameters for remote SharePoint knowledge source. + + :ivar filter_expression: Keyword Query Language (KQL) expression with queryable SharePoint + properties and attributes to scope the retrieval before the query runs. + :vartype filter_expression: str + :ivar resource_metadata: A list of metadata fields to be returned for each item in the + response. Only retrievable metadata properties can be included in this list. By default, no + metadata is returned. + :vartype resource_metadata: list[str] + :ivar container_type_id: Container ID for SharePoint Embedded connection. When this is null, it + will use SharePoint Online. + :vartype container_type_id: str + """ + + filter_expression: Optional[str] = rest_field( + name="filterExpression", visibility=["read", "create", "update", "delete", "query"] ) - """The character used to mask the text if the maskingMode parameter is set to replace. Default is - '*'.""" - model_version: Optional[str] = rest_field( - name="modelVersion", visibility=["read", "create", "update", "delete", "query"] + """Keyword Query Language (KQL) expression with queryable SharePoint properties and attributes to + scope the retrieval before the query runs.""" + resource_metadata: Optional[list[str]] = rest_field( + name="resourceMetadata", visibility=["read", "create", "update", "delete", "query"] ) - """The version of the model to use when calling the Text Analytics service. It will default to the - latest available when not specified. We recommend you do not specify this value unless - absolutely necessary.""" - pii_categories: Optional[list[str]] = rest_field( - name="piiCategories", visibility=["read", "create", "update", "delete", "query"] + """A list of metadata fields to be returned for each item in the response. Only retrievable + metadata properties can be included in this list. By default, no metadata is returned.""" + container_type_id: Optional[str] = rest_field( + name="containerTypeId", visibility=["read", "create", "update", "delete", "query"] ) - """A list of PII entity categories that should be extracted and masked.""" - domain: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """If specified, will set the PII domain to include only a subset of the entity categories. - Possible values include: 'phi', 'none'. Default is 'none'.""" - odata_type: Literal["#Microsoft.Skills.Text.PIIDetectionSkill"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """A URI fragment specifying the type of skill. Required. Default value is - \"#Microsoft.Skills.Text.PIIDetectionSkill\".""" + """Container ID for SharePoint Embedded connection. When this is null, it will use SharePoint + Online.""" @overload def __init__( self, *, - inputs: list["_models.InputFieldMappingEntry"], - outputs: list["_models.OutputFieldMappingEntry"], - name: Optional[str] = None, - description: Optional[str] = None, - context: Optional[str] = None, - default_language_code: Optional[str] = None, - minimum_precision: Optional[float] = None, - masking_mode: Optional[Union[str, "_models.PIIDetectionSkillMaskingMode"]] = None, - mask: Optional[str] = None, - model_version: Optional[str] = None, - pii_categories: Optional[list[str]] = None, - domain: Optional[str] = None, + filter_expression: Optional[str] = None, + resource_metadata: Optional[list[str]] = None, + container_type_id: Optional[str] = None, ) -> None: ... @overload @@ -6693,7 +8501,6 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.odata_type = "#Microsoft.Skills.Text.PIIDetectionSkill" # type: ignore class RescoringOptions(_Model): @@ -7040,6 +8847,22 @@ class SearchField(_Model): Collection(Edm.GeographyPoint) cannot be facetable. Default is true for all other simple fields. :vartype facetable: bool + :ivar permission_filter: A value indicating whether the field should be used as a permission + filter. Known values are: "userIds", "groupIds", and "rbacScope". + :vartype permission_filter: str or ~azure.search.documents.indexes.models.PermissionFilter + :ivar sensitivity_label_id: A value indicating whether the field should be used for sensitivity + label ID filtering. This enables document-level filtering based on Microsoft Purview + sensitivity label IDs. + :vartype sensitivity_label_id: bool + :ivar sensitivity_label_name: A value indicating whether the field contains the name of a + Microsoft Purview sensitivity label applied to the document. + :vartype sensitivity_label_name: bool + :ivar source_document_id: A value indicating whether the field contains the source document + identifier used for Purview audit tracking. + :vartype source_document_id: bool + :ivar sharepoint_site_url: A value indicating whether the field contains a SharePoint site URL + used for SharePoint group-based filtering. + :vartype sharepoint_site_url: bool :ivar analyzer_name: The name of the analyzer to use for the field. This option can be used only with searchable fields and it can't be set together with either searchAnalyzer or indexAnalyzer. Once the analyzer is chosen, it cannot be changed for the field. Must be null @@ -7198,6 +9021,31 @@ class SearchField(_Model): property must be null for complex fields. Fields of type Edm.GeographyPoint or Collection(Edm.GeographyPoint) cannot be facetable. Default is true for all other simple fields.""" + permission_filter: Optional[Union[str, "_models.PermissionFilter"]] = rest_field( + name="permissionFilter", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the field should be used as a permission filter. Known values are: + \"userIds\", \"groupIds\", and \"rbacScope\".""" + sensitivity_label_id: Optional[bool] = rest_field( + name="sensitivityLabelId", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the field should be used for sensitivity label ID filtering. This + enables document-level filtering based on Microsoft Purview sensitivity label IDs.""" + sensitivity_label_name: Optional[bool] = rest_field( + name="sensitivityLabelName", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the field contains the name of a Microsoft Purview sensitivity label + applied to the document.""" + source_document_id: Optional[bool] = rest_field( + name="sourceDocumentId", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the field contains the source document identifier used for Purview + audit tracking.""" + sharepoint_site_url: Optional[bool] = rest_field( + name="sharepointSiteUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether the field contains a SharePoint site URL used for SharePoint + group-based filtering.""" analyzer_name: Optional[Union[str, "_models.LexicalAnalyzerName"]] = rest_field( name="analyzer", visibility=["read", "create", "update", "delete", "query"] ) @@ -7324,6 +9172,11 @@ def __init__( filterable: Optional[bool] = None, sortable: Optional[bool] = None, facetable: Optional[bool] = None, + permission_filter: Optional[Union[str, "_models.PermissionFilter"]] = None, + sensitivity_label_id: Optional[bool] = None, + sensitivity_label_name: Optional[bool] = None, + source_document_id: Optional[bool] = None, + sharepoint_site_url: Optional[bool] = None, analyzer_name: Optional[Union[str, "_models.LexicalAnalyzerName"]] = None, search_analyzer_name: Optional[Union[str, "_models.LexicalAnalyzerName"]] = None, index_analyzer_name: Optional[Union[str, "_models.LexicalAnalyzerName"]] = None, @@ -7395,6 +9248,17 @@ class SearchIndex(_Model): :vartype semantic_search: ~azure.search.documents.indexes.models.SemanticSearch :ivar vector_search: Contains configuration options related to vector search. :vartype vector_search: ~azure.search.documents.indexes.models.VectorSearch + :ivar permission_filter_option: A value indicating whether permission filtering is enabled for + the index. Known values are: "enabled" and "disabled". + :vartype permission_filter_option: str or + ~azure.search.documents.indexes.models.SearchIndexPermissionFilterOption + :ivar purview_enabled: A value indicating whether Purview is enabled for the index. + :vartype purview_enabled: bool + :ivar share_point_connector_app_registration: Configures a SharePoint connector app + registration for the index, enabling document-level permissions from SharePoint. If provided, + the applicationId and federatedCredentialId properties are required. + :vartype share_point_connector_app_registration: + ~search.models.SharePointConnectorAppRegistration :ivar e_tag: The ETag of the index. :vartype e_tag: str """ @@ -7467,6 +9331,21 @@ class SearchIndex(_Model): name="vectorSearch", visibility=["read", "create", "update", "delete", "query"] ) """Contains configuration options related to vector search.""" + permission_filter_option: Optional[Union[str, "_models.SearchIndexPermissionFilterOption"]] = rest_field( + name="permissionFilterOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether permission filtering is enabled for the index. Known values are: + \"enabled\" and \"disabled\".""" + purview_enabled: Optional[bool] = rest_field( + name="purviewEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether Purview is enabled for the index.""" + share_point_connector_app_registration: Optional["_search_models6.SharePointConnectorAppRegistration"] = rest_field( + name="sharePointConnectorAppRegistration", visibility=["read", "create", "update", "delete", "query"] + ) + """Configures a SharePoint connector app registration for the index, enabling document-level + permissions from SharePoint. If provided, the applicationId and federatedCredentialId + properties are required.""" e_tag: Optional[str] = rest_field(name="@odata.etag", visibility=["read", "create", "update", "delete", "query"]) """The ETag of the index.""" @@ -7490,6 +9369,9 @@ def __init__( similarity: Optional["_models.SimilarityAlgorithm"] = None, semantic_search: Optional["_models.SemanticSearch"] = None, vector_search: Optional["_models.VectorSearch"] = None, + permission_filter_option: Optional[Union[str, "_models.SearchIndexPermissionFilterOption"]] = None, + purview_enabled: Optional[bool] = None, + share_point_connector_app_registration: Optional["_search_models6.SharePointConnectorAppRegistration"] = None, e_tag: Optional[str] = None, ) -> None: ... @@ -7542,6 +9424,9 @@ class SearchIndexer(_Model): keys is not available for free search services, and is only available for paid services created on or after January 1, 2019. :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar cache: Adds caching to an enrichment pipeline to allow for incremental modification steps + without having to rebuild the index every time. + :vartype cache: ~azure.search.documents.indexes.models.SearchIndexerCache """ name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -7595,6 +9480,11 @@ class SearchIndexer(_Model): indexer execution status) will be unaffected. Encryption with customer-managed keys is not available for free search services, and is only available for paid services created on or after January 1, 2019.""" + cache: Optional["_models.SearchIndexerCache"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Adds caching to an enrichment pipeline to allow for incremental modification steps without + having to rebuild the index every time.""" @overload def __init__( @@ -7612,6 +9502,65 @@ def __init__( is_disabled: Optional[bool] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, + cache: Optional["_models.SearchIndexerCache"] = 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 SearchIndexerCache(_Model): + """The type of the cache. + + :ivar id: A guid for the SearchIndexerCache. + :vartype id: str + :ivar storage_connection_string: The connection string to the storage account where the cache + data will be persisted. + :vartype storage_connection_string: str + :ivar enable_reprocessing: Specifies whether incremental reprocessing is enabled. + :vartype enable_reprocessing: bool + :ivar identity: The user-assigned managed identity used for connections to the enrichment + cache. If the connection string indicates an identity (ResourceId) and it's not specified, the + system-assigned managed identity is used. On updates to the indexer, if the identity is + unspecified, the value remains unchanged. If set to "none", the value of this property is + cleared. + :vartype identity: ~azure.search.documents.indexes.models.SearchIndexerDataIdentity + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A guid for the SearchIndexerCache.""" + storage_connection_string: Optional[str] = rest_field( + name="storageConnectionString", visibility=["read", "create", "update", "delete", "query"] + ) + """The connection string to the storage account where the cache data will be persisted.""" + enable_reprocessing: Optional[bool] = rest_field( + name="enableReprocessing", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether incremental reprocessing is enabled.""" + identity: Optional["_models.SearchIndexerDataIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The user-assigned managed identity used for connections to the enrichment cache. If the + connection string indicates an identity (ResourceId) and it's not specified, the + system-assigned managed identity is used. On updates to the indexer, if the identity is + unspecified, the value remains unchanged. If set to \"none\", the value of this property is + cleared.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + storage_connection_string: Optional[str] = None, + enable_reprocessing: Optional[bool] = None, + identity: Optional["_models.SearchIndexerDataIdentity"] = None, ) -> None: ... @overload @@ -7737,6 +9686,9 @@ class SearchIndexerDataSourceConnection(_Model): :ivar type: The type of the datasource. Required. Known values are: "azuresql", "cosmosdb", "azureblob", "azuretable", "mysql", "adlsgen2", "onelake", and "sharepoint". :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. + :vartype sub_type: str :ivar credentials: Credentials for the datasource. Required. :vartype credentials: ~azure.search.documents.indexes.models.DataSourceCredentials :ivar container: The data container for the datasource. Required. @@ -7746,6 +9698,9 @@ class SearchIndexerDataSourceConnection(_Model): not specified, the value remains unchanged. If "none" is specified, the value of this property is cleared. :vartype identity: ~azure.search.documents.indexes.models.SearchIndexerDataIdentity + :ivar indexer_permission_options: Ingestion options with various types of permission data. + :vartype indexer_permission_options: list[str or + ~azure.search.documents.indexes.models.IndexerPermissionOption] :ivar data_change_detection_policy: The data change detection policy for the datasource. :vartype data_change_detection_policy: ~azure.search.documents.indexes.models.DataChangeDetectionPolicy @@ -7774,6 +9729,9 @@ class SearchIndexerDataSourceConnection(_Model): ) """The type of the datasource. Required. Known values are: \"azuresql\", \"cosmosdb\", \"azureblob\", \"azuretable\", \"mysql\", \"adlsgen2\", \"onelake\", and \"sharepoint\".""" + 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.""" credentials: "_models.DataSourceCredentials" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -7788,6 +9746,10 @@ class SearchIndexerDataSourceConnection(_Model): """An explicit managed identity to use for this datasource. If not specified and the connection string is a managed identity, the system-assigned managed identity is used. If not specified, the value remains unchanged. If \"none\" is specified, the value of this property is cleared.""" + indexer_permission_options: Optional[list[Union[str, "_models.IndexerPermissionOption"]]] = rest_field( + name="indexerPermissionOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """Ingestion options with various types of permission data.""" data_change_detection_policy: Optional["_models.DataChangeDetectionPolicy"] = rest_field( name="dataChangeDetectionPolicy", visibility=["read", "create", "update", "delete", "query"] ) @@ -7822,6 +9784,7 @@ def __init__( container: "_models.SearchIndexerDataContainer", description: Optional[str] = None, identity: Optional["_models.SearchIndexerDataIdentity"] = None, + indexer_permission_options: Optional[list[Union[str, "_models.IndexerPermissionOption"]]] = None, data_change_detection_policy: Optional["_models.DataChangeDetectionPolicy"] = None, data_deletion_detection_policy: Optional["_models.DataDeletionDetectionPolicy"] = None, e_tag: Optional[str] = None, @@ -7870,6 +9833,10 @@ class SearchIndexerDataUserAssignedIdentity( :ivar odata_type: A URI fragment specifying the type of identity. Required. Default value is "#Microsoft.Azure.Search.DataUserAssignedIdentity". :vartype odata_type: str + :ivar federated_identity_client_id: Multi-tenant User-Assigned Managed Identity Support: The + client id of the multi-tentant App that has been configured to federate with the user-assigned + managed identity. + :vartype federated_identity_client_id: str """ resource_id: str = rest_field( @@ -7881,12 +9848,18 @@ class SearchIndexerDataUserAssignedIdentity( odata_type: Literal["#Microsoft.Azure.Search.DataUserAssignedIdentity"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """A URI fragment specifying the type of identity. Required. Default value is \"#Microsoft.Azure.Search.DataUserAssignedIdentity\".""" + federated_identity_client_id: Optional[str] = rest_field( + name="federatedIdentityClientId", visibility=["read", "create", "update", "delete", "query"] + ) + """Multi-tenant User-Assigned Managed Identity Support: The client id of the multi-tentant App + that has been configured to federate with the user-assigned managed identity.""" @overload def __init__( self, *, resource_id: str, + federated_identity_client_id: Optional[str] = None, ) -> None: ... @overload @@ -8090,6 +10063,10 @@ class SearchIndexerKnowledgeStore(_Model): to the indexer, if the identity is unspecified, the value remains unchanged. If set to "none", the value of this property is cleared. :vartype identity: ~azure.search.documents.indexes.models.SearchIndexerDataIdentity + :ivar parameters: A dictionary of knowledge store-specific configuration properties. Each name + is the name of a specific property. Each value must be of a primitive type. + :vartype parameters: + ~azure.search.documents.indexes.models.SearchIndexerKnowledgeStoreParameters """ storage_connection_string: str = rest_field( @@ -8108,6 +10085,11 @@ class SearchIndexerKnowledgeStore(_Model): specified, the system-assigned managed identity is used. On updates to the indexer, if the identity is unspecified, the value remains unchanged. If set to \"none\", the value of this property is cleared.""" + parameters: Optional["_models.SearchIndexerKnowledgeStoreParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A dictionary of knowledge store-specific configuration properties. Each name is the name of a + specific property. Each value must be of a primitive type.""" @overload def __init__( @@ -8116,6 +10098,7 @@ def __init__( storage_connection_string: str, projections: list["_models.SearchIndexerKnowledgeStoreProjection"], identity: Optional["_models.SearchIndexerDataIdentity"] = None, + parameters: Optional["_models.SearchIndexerKnowledgeStoreParameters"] = None, ) -> None: ... @overload @@ -8316,6 +10299,38 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class SearchIndexerKnowledgeStoreParameters(_Model): + """A dictionary of knowledge store-specific configuration properties. Each name is the name of a + specific property. Each value must be of a primitive type. + + :ivar synthesize_generated_key_name: Whether or not projections should synthesize a generated + key name if one isn't already present. + :vartype synthesize_generated_key_name: bool + """ + + synthesize_generated_key_name: Optional[bool] = rest_field( + name="synthesizeGeneratedKeyName", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether or not projections should synthesize a generated key name if one isn't already present.""" + + @overload + def __init__( + self, + *, + synthesize_generated_key_name: Optional[bool] = 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 SearchIndexerKnowledgeStoreProjection(_Model): """Container object for various projection selectors. @@ -8532,6 +10547,9 @@ class SearchIndexerStatus(_Model): :ivar status: Overall indexer status. Required. Known values are: "unknown", "error", and "running". :vartype status: str or ~azure.search.documents.indexes.models.IndexerStatus + :ivar runtime: Snapshot of the indexer's cumulative runtime consumption for the service over + the current UTC period. Required. + :vartype runtime: ~azure.search.documents.indexes.models.IndexerRuntime :ivar last_result: The result of the most recent or an in-progress indexer execution. :vartype last_result: ~azure.search.documents.indexes.models.IndexerExecutionResult :ivar execution_history: History of the recent indexer executions, sorted in reverse @@ -8539,18 +10557,26 @@ class SearchIndexerStatus(_Model): :vartype execution_history: list[~azure.search.documents.indexes.models.IndexerExecutionResult] :ivar limits: The execution limits for the indexer. Required. :vartype limits: ~azure.search.documents.indexes.models.SearchIndexerLimits + :ivar current_state: All of the state that defines and dictates the indexer's current + execution. + :vartype current_state: ~azure.search.documents.indexes.models.IndexerCurrentState """ name: str = rest_field(visibility=["read"]) """The name of the indexer. Required.""" status: Union[str, "_models.IndexerStatus"] = rest_field(visibility=["read"]) """Overall indexer status. Required. Known values are: \"unknown\", \"error\", and \"running\".""" + runtime: "_models.IndexerRuntime" = rest_field(visibility=["read"]) + """Snapshot of the indexer's cumulative runtime consumption for the service over the current UTC + period. Required.""" last_result: Optional["_models.IndexerExecutionResult"] = rest_field(name="lastResult", visibility=["read"]) """The result of the most recent or an in-progress indexer execution.""" execution_history: list["_models.IndexerExecutionResult"] = rest_field(name="executionHistory", visibility=["read"]) """History of the recent indexer executions, sorted in reverse chronological order. Required.""" limits: "_models.SearchIndexerLimits" = rest_field(visibility=["read"]) """The execution limits for the indexer. Required.""" + current_state: Optional["_models.IndexerCurrentState"] = rest_field(name="currentState", visibility=["read"]) + """All of the state that defines and dictates the indexer's current execution.""" class SearchIndexerWarning(_Model): @@ -8683,6 +10709,9 @@ class SearchIndexKnowledgeSourceParameters(_Model): :ivar semantic_configuration_name: Used to specify a different semantic configuration on the target search index other than the default one. :vartype semantic_configuration_name: str + :ivar base_filter: A default filter condition applied to the index at retrieval time (e.g., + 'State eq VA'). Can be overridden at query time via knowledge source runtime parameters. + :vartype base_filter: str """ search_index_name: str = rest_field( @@ -8702,6 +10731,11 @@ class SearchIndexKnowledgeSourceParameters(_Model): ) """Used to specify a different semantic configuration on the target search index other than the default one.""" + base_filter: Optional[str] = rest_field( + name="baseFilter", visibility=["read", "create", "update", "delete", "query"] + ) + """A default filter condition applied to the index at retrieval time (e.g., 'State eq VA'). Can be + overridden at query time via knowledge source runtime parameters.""" @overload def __init__( @@ -8711,6 +10745,7 @@ def __init__( source_data_fields: Optional[list["_models.SearchIndexFieldReference"]] = None, search_fields: Optional[list["_models.SearchIndexFieldReference"]] = None, semantic_configuration_name: Optional[str] = None, + base_filter: Optional[str] = None, ) -> None: ... @overload @@ -8773,6 +10808,12 @@ class SearchIndexResponse(_Model): :vartype semantic_search: ~azure.search.documents.indexes.models.SemanticSearch :ivar vector_search: Contains configuration options related to vector search. :vartype vector_search: ~azure.search.documents.indexes.models.VectorSearch + :ivar permission_filter_option: A value indicating whether permission filtering is enabled for + the index. Known values are: "enabled" and "disabled". + :vartype permission_filter_option: str or + ~azure.search.documents.indexes.models.SearchIndexPermissionFilterOption + :ivar purview_enabled: A value indicating whether Purview is enabled for the index. + :vartype purview_enabled: bool :ivar e_tag: The ETag of the index. :vartype e_tag: str """ @@ -8847,6 +10888,15 @@ class SearchIndexResponse(_Model): name="vectorSearch", visibility=["read", "create", "update", "delete", "query"] ) """Contains configuration options related to vector search.""" + permission_filter_option: Optional[Union[str, "_models.SearchIndexPermissionFilterOption"]] = rest_field( + name="permissionFilterOption", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether permission filtering is enabled for the index. Known values are: + \"enabled\" and \"disabled\".""" + purview_enabled: Optional[bool] = rest_field( + name="purviewEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """A value indicating whether Purview is enabled for the index.""" e_tag: Optional[str] = rest_field(name="@odata.etag", visibility=["read", "create", "update", "delete", "query"]) """The ETag of the index.""" @@ -8870,6 +10920,8 @@ def __init__( similarity: Optional["_models.SimilarityAlgorithm"] = None, semantic_search: Optional["_models.SemanticSearch"] = None, vector_search: Optional["_models.VectorSearch"] = None, + permission_filter_option: Optional[Union[str, "_models.SearchIndexPermissionFilterOption"]] = None, + purview_enabled: Optional[bool] = None, e_tag: Optional[str] = None, ) -> None: ... @@ -8907,6 +10959,9 @@ class SearchResourceEncryptionKey(_Model): update to the resource, if the explicit identity is unspecified, it remains unchanged. If "none" is specified, the value of this property is cleared. :vartype identity: ~azure.search.documents.indexes.models.SearchIndexerDataIdentity + :ivar is_service_level_key: An optional value indicating whether this key is a service-level + key. Default is false. + :vartype is_service_level_key: bool """ key_name: str = rest_field(name="keyVaultKeyName", visibility=["read", "create", "update", "delete", "query"]) @@ -8931,6 +10986,10 @@ class SearchResourceEncryptionKey(_Model): credentials property is null, the system-assigned managed identity is used. On update to the resource, if the explicit identity is unspecified, it remains unchanged. If \"none\" is specified, the value of this property is cleared.""" + is_service_level_key: Optional[bool] = rest_field( + name="isServiceLevelKey", visibility=["read", "create", "update", "delete", "query"] + ) + """An optional value indicating whether this key is a service-level key. Default is false.""" __flattened_items = ["application_id", "application_secret"] @@ -8943,6 +11002,7 @@ def __init__( key_version: Optional[str] = None, access_credentials: Optional["_models.AzureActiveDirectoryApplicationCredentials"] = None, identity: Optional["_models.SearchIndexerDataIdentity"] = None, + is_service_level_key: Optional[bool] = None, ) -> None: ... @overload @@ -8996,6 +11056,10 @@ 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_base_counter: Total number of knowledge bases. Required. + :vartype knowledge_base_counter: ~azure.search.documents.indexes.models.ResourceCounter + :ivar knowledge_source_counter: Total number of knowledge sources. Required. + :vartype knowledge_source_counter: ~azure.search.documents.indexes.models.ResourceCounter """ alias_counter: "_models.ResourceCounter" = rest_field( @@ -9034,6 +11098,14 @@ 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_base_counter: "_models.ResourceCounter" = rest_field( + name="knowledgeBasesCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Total number of knowledge bases. Required.""" + knowledge_source_counter: "_models.ResourceCounter" = rest_field( + name="knowledgeSourcesCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Total number of knowledge sources. Required.""" @overload def __init__( @@ -9048,6 +11120,8 @@ def __init__( synonym_map_counter: "_models.ResourceCounter", skillset_counter: "_models.ResourceCounter", vector_index_size_counter: "_models.ResourceCounter", + knowledge_base_counter: "_models.ResourceCounter", + knowledge_source_counter: "_models.ResourceCounter", ) -> None: ... @overload @@ -9139,12 +11213,18 @@ class SearchServiceStatistics(_Model): :vartype counters: ~azure.search.documents.indexes.models.SearchServiceCounters :ivar limits: Service level general limits. Required. :vartype limits: ~azure.search.documents.indexes.models.SearchServiceLimits + :ivar indexers_runtime: Service level indexer runtime consumption. Required. + :vartype indexers_runtime: ~azure.search.documents.indexes.models.ServiceIndexersRuntime """ counters: "_models.SearchServiceCounters" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Service level resource counters. Required.""" limits: "_models.SearchServiceLimits" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Service level general limits. Required.""" + indexers_runtime: "_models.ServiceIndexersRuntime" = rest_field( + name="indexersRuntime", visibility=["read", "create", "update", "delete", "query"] + ) + """Service level indexer runtime consumption. Required.""" @overload def __init__( @@ -9152,6 +11232,7 @@ def __init__( *, counters: "_models.SearchServiceCounters", limits: "_models.SearchServiceLimits", + indexers_runtime: "_models.ServiceIndexersRuntime", ) -> None: ... @overload @@ -9223,6 +11304,9 @@ class SemanticConfiguration(_Model): :ivar ranking_order: Specifies the score type to be used for the sort order of the search results. Known values are: "BoostedRerankerScore" and "RerankerScore". :vartype ranking_order: str or ~azure.search.documents.indexes.models.RankingOrder + :ivar flighting_opt_in: Determines which semantic or query rewrite models to use during model + flighting/upgrades. + :vartype flighting_opt_in: bool """ name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -9238,6 +11322,10 @@ class SemanticConfiguration(_Model): ) """Specifies the score type to be used for the sort order of the search results. Known values are: \"BoostedRerankerScore\" and \"RerankerScore\".""" + flighting_opt_in: Optional[bool] = rest_field( + name="flightingOptIn", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines which semantic or query rewrite models to use during model flighting/upgrades.""" @overload def __init__( @@ -9246,6 +11334,7 @@ def __init__( name: str, prioritized_fields: "_models.SemanticPrioritizedFields", ranking_order: Optional[Union[str, "_models.RankingOrder"]] = None, + flighting_opt_in: Optional[bool] = None, ) -> None: ... @overload @@ -9472,6 +11561,62 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.V3.SentimentSkill" # type: ignore +class ServiceIndexersRuntime(_Model): + """Represents service-level indexer runtime counters. + + :ivar used_seconds: Cumulative runtime of all indexers in the service from the beginningTime to + endingTime, in seconds. Required. + :vartype used_seconds: int + :ivar remaining_seconds: Cumulative runtime remaining for all indexers in the service from the + beginningTime to endingTime, in seconds. + :vartype remaining_seconds: int + :ivar beginning_time: Beginning UTC time of the 24-hour period considered for indexer runtime + usage (inclusive). Required. + :vartype beginning_time: ~datetime.datetime + :ivar ending_time: End UTC time of the 24-hour period considered for indexer runtime usage + (inclusive). Required. + :vartype ending_time: ~datetime.datetime + """ + + used_seconds: int = rest_field(name="usedSeconds", visibility=["read", "create", "update", "delete", "query"]) + """Cumulative runtime of all indexers in the service from the beginningTime to endingTime, in + seconds. Required.""" + remaining_seconds: Optional[int] = rest_field( + name="remainingSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """Cumulative runtime remaining for all indexers in the service from the beginningTime to + endingTime, in seconds.""" + beginning_time: datetime.datetime = rest_field( + name="beginningTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Beginning UTC time of the 24-hour period considered for indexer runtime usage (inclusive). + Required.""" + ending_time: datetime.datetime = rest_field( + name="endingTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """End UTC time of the 24-hour period considered for indexer runtime usage (inclusive). Required.""" + + @overload + def __init__( + self, + *, + used_seconds: int, + beginning_time: datetime.datetime, + ending_time: datetime.datetime, + remaining_seconds: 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 ShaperSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.ShaperSkill"): """A skill for reshaping the outputs. It creates a complex type to support composite fields (also known as multipart fields). @@ -9778,6 +11923,16 @@ class SplitSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.Split 'maximumPagesToTake' pages, in order to improve performance when only a few initial pages are needed from each document. :vartype maximum_pages_to_take: int + :ivar unit: Only applies if textSplitMode is set to pages. There are two possible values. The + choice of the values will decide the length (maximumPageLength and pageOverlapLength) + measurement. The default is 'characters', which means the length will be measured by character. + Known values are: "characters" and "azureOpenAITokens". + :vartype unit: str or ~azure.search.documents.indexes.models.SplitSkillUnit + :ivar azure_open_ai_tokenizer_parameters: Only applies if the unit is set to azureOpenAITokens. + If specified, the splitSkill will use these parameters when performing the tokenization. The + parameters are a valid 'encoderModelName' and an optional 'allowedSpecialTokens' property. + :vartype azure_open_ai_tokenizer_parameters: + ~azure.search.documents.indexes.models.AzureOpenAITokenizerParameters :ivar odata_type: A URI fragment specifying the type of skill. Required. Default value is "#Microsoft.Skills.Text.SplitSkill". :vartype odata_type: str @@ -9809,6 +11964,19 @@ class SplitSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.Split """Only applicable when textSplitMode is set to 'pages'. If specified, the SplitSkill will discontinue splitting after processing the first 'maximumPagesToTake' pages, in order to improve performance when only a few initial pages are needed from each document.""" + unit: Optional[Union[str, "_models.SplitSkillUnit"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Only applies if textSplitMode is set to pages. There are two possible values. The choice of the + values will decide the length (maximumPageLength and pageOverlapLength) measurement. The + default is 'characters', which means the length will be measured by character. Known values + are: \"characters\" and \"azureOpenAITokens\".""" + azure_open_ai_tokenizer_parameters: Optional["_models.AzureOpenAITokenizerParameters"] = rest_field( + name="azureOpenAITokenizerParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Only applies if the unit is set to azureOpenAITokens. If specified, the splitSkill will use + these parameters when performing the tokenization. The parameters are a valid + 'encoderModelName' and an optional 'allowedSpecialTokens' property.""" odata_type: Literal["#Microsoft.Skills.Text.SplitSkill"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """A URI fragment specifying the type of skill. Required. Default value is \"#Microsoft.Skills.Text.SplitSkill\".""" @@ -9827,6 +11995,8 @@ def __init__( maximum_page_length: Optional[int] = None, page_overlap_length: Optional[int] = None, maximum_pages_to_take: Optional[int] = None, + unit: Optional[Union[str, "_models.SplitSkillUnit"]] = None, + azure_open_ai_tokenizer_parameters: Optional["_models.AzureOpenAITokenizerParameters"] = None, ) -> None: ... @overload @@ -10710,6 +12880,65 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class VisionVectorizeSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Vision.VectorizeSkill"): + """Allows you to generate a vector embedding for a given image or text input using the Azure AI + Services Vision Vectorize API. + + :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill + with no name defined will be given a default name of its 1-based index in the skills array, + prefixed with the character '#'. + :vartype name: str + :ivar description: The description of the skill which describes the inputs, outputs, and usage + of the skill. + :vartype description: str + :ivar context: Represents the level at which operations take place, such as the document root + or document content (for example, /document or /document/content). The default is /document. + :vartype context: str + :ivar inputs: Inputs of the skills could be a column in the source data set, or the output of + an upstream skill. Required. + :vartype inputs: list[~azure.search.documents.indexes.models.InputFieldMappingEntry] + :ivar outputs: The output of a skill is either a field in a search index, or a value that can + be consumed as an input by another skill. Required. + :vartype outputs: list[~azure.search.documents.indexes.models.OutputFieldMappingEntry] + :ivar model_version: The version of the model to use when calling the AI Services Vision + service. It will default to the latest available when not specified. Required. + :vartype model_version: str + :ivar odata_type: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Vision.VectorizeSkill". + :vartype odata_type: str + """ + + model_version: str = rest_field(name="modelVersion", visibility=["read", "create", "update", "delete", "query"]) + """The version of the model to use when calling the AI Services Vision service. It will default to + the latest available when not specified. Required.""" + odata_type: Literal["#Microsoft.Skills.Vision.VectorizeSkill"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """A URI fragment specifying the type of skill. Required. Default value is + \"#Microsoft.Skills.Vision.VectorizeSkill\".""" + + @overload + def __init__( + self, + *, + inputs: list["_models.InputFieldMappingEntry"], + outputs: list["_models.OutputFieldMappingEntry"], + model_version: str, + name: Optional[str] = None, + description: Optional[str] = None, + context: Optional[str] = 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) + self.odata_type = "#Microsoft.Skills.Vision.VectorizeSkill" # type: ignore + + class WebApiHttpHeaders(_Model): """A dictionary of http request headers.""" @@ -11084,18 +13313,46 @@ class WebKnowledgeSourceParameters(_Model): :ivar domains: Domain allow/block configuration for web results. :vartype domains: ~azure.search.documents.indexes.models.WebKnowledgeSourceDomains + :ivar language: The default language for web results. Can be overridden at query time via + knowledge source runtime parameters. + :vartype language: str + :ivar market: The default market for web results. Can be overridden at query time via knowledge + source runtime parameters. + :vartype market: str + :ivar count: The default number of web results to return. Can be overridden at query time via + knowledge source runtime parameters. + :vartype count: int + :ivar freshness: The default freshness filter for web results. Can be overridden at query time + via knowledge source runtime parameters. + :vartype freshness: str """ domains: Optional["_models.WebKnowledgeSourceDomains"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """Domain allow/block configuration for web results.""" + language: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The default language for web results. Can be overridden at query time via knowledge source + runtime parameters.""" + market: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The default market for web results. Can be overridden at query time via knowledge source + runtime parameters.""" + count: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The default number of web results to return. Can be overridden at query time via knowledge + source runtime parameters.""" + freshness: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The default freshness filter for web results. Can be overridden at query time via knowledge + source runtime parameters.""" @overload def __init__( self, *, domains: Optional["_models.WebKnowledgeSourceDomains"] = None, + language: Optional[str] = None, + market: Optional[str] = None, + count: Optional[int] = None, + freshness: Optional[str] = None, ) -> None: ... @overload @@ -11230,3 +13487,50 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.odata_type = "#Microsoft.Azure.Search.WordDelimiterTokenFilter" # type: ignore + + +class WorkIQKnowledgeSource(KnowledgeSource, discriminator="workIQ"): + """Configuration for WorkIQ knowledge source. + + :ivar name: The name of the knowledge source. Required. + :vartype name: str + :ivar description: Optional user-defined description. + :vartype description: str + :ivar e_tag: The ETag of the knowledge source. + :vartype e_tag: str + :ivar encryption_key: A description of an encryption key that you create in Azure Key Vault. + This key is used to provide an additional level of encryption-at-rest for your knowledge source + definition when you want full assurance that no one, not even Microsoft, can decrypt them. Once + you have encrypted your knowledge source definition, it will always remain encrypted. The + search service will ignore attempts to set this property to null. You can change this property + as needed if you want to rotate your encryption key; Your knowledge source definition will be + unaffected. Encryption with customer-managed keys is not available for free search services, + and is only available for paid services created on or after January 1, 2019. + :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey + :ivar kind: Required. A knowledge source that reads data from work IQ. + :vartype kind: str or ~azure.search.documents.indexes.models.WORK_IQ + """ + + kind: Literal[KnowledgeSourceKind.WORK_IQ] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. A knowledge source that reads data from work IQ.""" + + @overload + def __init__( + self, + *, + name: str, + description: Optional[str] = None, + e_tag: Optional[str] = None, + encryption_key: Optional["_models.SearchResourceEncryptionKey"] = 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) + self.kind = KnowledgeSourceKind.WORK_IQ # type: ignore 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 61e97ba3123c..7a5b0521fe82 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 @@ -34,9 +34,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin) ~azure.core.credentials.TokenCredential :param knowledge_base_name: The name of the knowledge base. Required. :type knowledge_base_name: str - :keyword api_version: The API version to use for this operation. Known values are "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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 603eff3f2efe..1d5627362187 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 @@ -31,9 +31,9 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins ~azure.core.credentials.TokenCredential :param knowledge_base_name: The name of the knowledge base. Required. :type knowledge_base_name: str - :keyword api_version: The API version to use for this operation. Known values are "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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__( knowledge_base_name: str, **kwargs: Any, ) -> None: - api_version: str = kwargs.pop("api_version", "2026-04-01") + 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 539027df674a..8d4903b5128c 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 @@ -5,7 +5,7 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from io import IOBase import json from typing import Any, Callable, IO, Optional, TypeVar, Union, overload @@ -31,6 +31,7 @@ from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Serializer from ..._utils.utils import ClientMixinABC +from ..._validation import api_version_validation from .._configuration import KnowledgeBaseRetrievalClientConfiguration JSON = MutableMapping[str, Any] @@ -42,13 +43,13 @@ def build_knowledge_base_retrieval_retrieve_request( # pylint: disable=name-too-long - knowledge_base_name: str, **kwargs: Any + knowledge_base_name: str, *, query_source_authorization: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _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", "2026-04-01")) + 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 @@ -65,6 +66,10 @@ def build_knowledge_base_retrieval_retrieve_request( # pylint: disable=name-too # Construct headers 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" + ) if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -80,6 +85,7 @@ def retrieve( self, retrieval_request: _models1.KnowledgeBaseRetrievalRequest, *, + query_source_authorization: Optional[str] = None, content_type: str = "application/json", **kwargs: Any ) -> _models1.KnowledgeBaseRetrievalResponse: @@ -88,6 +94,10 @@ def retrieve( :param retrieval_request: The retrieval request to process. Required. :type retrieval_request: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -99,12 +109,21 @@ def retrieve( @overload def retrieve( - self, retrieval_request: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + retrieval_request: JSON, + *, + query_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models1.KnowledgeBaseRetrievalResponse: """KnowledgeBase retrieves relevant data from backing stores. :param retrieval_request: The retrieval request to process. Required. :type retrieval_request: JSON + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -116,12 +135,21 @@ def retrieve( @overload def retrieve( - self, retrieval_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + retrieval_request: IO[bytes], + *, + query_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models1.KnowledgeBaseRetrievalResponse: """KnowledgeBase retrieves relevant data from backing stores. :param retrieval_request: The retrieval request to process. Required. :type retrieval_request: IO[bytes] + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -132,8 +160,16 @@ def retrieve( """ @distributed_trace + @api_version_validation( + params_added_on={"2026-05-01-preview": ["query_source_authorization"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) def retrieve( - self, retrieval_request: Union[_models1.KnowledgeBaseRetrievalRequest, JSON, IO[bytes]], **kwargs: Any + self, + retrieval_request: Union[_models1.KnowledgeBaseRetrievalRequest, JSON, IO[bytes]], + *, + query_source_authorization: Optional[str] = None, + **kwargs: Any ) -> _models1.KnowledgeBaseRetrievalResponse: """KnowledgeBase retrieves relevant data from backing stores. @@ -142,6 +178,10 @@ def retrieve( :type retrieval_request: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest or JSON or IO[bytes] + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str :return: KnowledgeBaseRetrievalResponse. The KnowledgeBaseRetrievalResponse is compatible with MutableMapping :rtype: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse @@ -170,6 +210,7 @@ def retrieve( _request = build_knowledge_base_retrieval_retrieve_request( knowledge_base_name=self._config.knowledge_base_name, + query_source_authorization=query_source_authorization, content_type=content_type, api_version=self._config.api_version, content=_content, 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 da7d731af565..db24930fdca9 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 @@ -22,7 +22,7 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -600,7 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: for rest_field in self._attr_to_rest_field.values() if rest_field._default is not _UNSET } - if args: # pylint: disable=too-many-nested-blocks + if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) else: @@ -710,7 +710,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint: disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: 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 14d6b3443dbb..9fe2a69c6523 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 @@ -34,9 +34,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin) ~azure.core.credentials_async.AsyncTokenCredential :param knowledge_base_name: The name of the knowledge base. Required. :type knowledge_base_name: str - :keyword api_version: The API version to use for this operation. Known values are "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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 f7cb269c047f..f9295f2485eb 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 @@ -31,9 +31,9 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins ~azure.core.credentials_async.AsyncTokenCredential :param knowledge_base_name: The name of the knowledge base. Required. :type knowledge_base_name: str - :keyword api_version: The API version to use for this operation. Known values are "2026-04-01". - Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "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__( knowledge_base_name: str, **kwargs: Any, ) -> None: - api_version: str = kwargs.pop("api_version", "2026-04-01") + 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/aio/_operations/_operations.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_operations/_operations.py index db31fdc21cc7..2e656fd4c4da 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 @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping # pylint: disable=import-error +from collections.abc import MutableMapping from io import IOBase import json from typing import Any, Callable, IO, Optional, TypeVar, Union, overload @@ -31,6 +31,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 ..._operations._operations import build_knowledge_base_retrieval_retrieve_request from .._configuration import KnowledgeBaseRetrievalClientConfiguration @@ -48,6 +49,7 @@ async def retrieve( self, retrieval_request: _models2.KnowledgeBaseRetrievalRequest, *, + query_source_authorization: Optional[str] = None, content_type: str = "application/json", **kwargs: Any ) -> _models2.KnowledgeBaseRetrievalResponse: @@ -56,6 +58,10 @@ async def retrieve( :param retrieval_request: The retrieval request to process. Required. :type retrieval_request: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -67,12 +73,21 @@ async def retrieve( @overload async def retrieve( - self, retrieval_request: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + retrieval_request: JSON, + *, + query_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models2.KnowledgeBaseRetrievalResponse: """KnowledgeBase retrieves relevant data from backing stores. :param retrieval_request: The retrieval request to process. Required. :type retrieval_request: JSON + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -84,12 +99,21 @@ async def retrieve( @overload async def retrieve( - self, retrieval_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + retrieval_request: IO[bytes], + *, + query_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any ) -> _models2.KnowledgeBaseRetrievalResponse: """KnowledgeBase retrieves relevant data from backing stores. :param retrieval_request: The retrieval request to process. Required. :type retrieval_request: IO[bytes] + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str @@ -100,8 +124,16 @@ async def retrieve( """ @distributed_trace_async + @api_version_validation( + params_added_on={"2026-05-01-preview": ["query_source_authorization"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + ) async def retrieve( - self, retrieval_request: Union[_models2.KnowledgeBaseRetrievalRequest, JSON, IO[bytes]], **kwargs: Any + self, + retrieval_request: Union[_models2.KnowledgeBaseRetrievalRequest, JSON, IO[bytes]], + *, + query_source_authorization: Optional[str] = None, + **kwargs: Any ) -> _models2.KnowledgeBaseRetrievalResponse: """KnowledgeBase retrieves relevant data from backing stores. @@ -110,6 +142,10 @@ async def retrieve( :type retrieval_request: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest or JSON or IO[bytes] + :keyword query_source_authorization: Token identifying the user for which the query is being + executed. This token is used to enforce security restrictions on documents. Default value is + None. + :paramtype query_source_authorization: str :return: KnowledgeBaseRetrievalResponse. The KnowledgeBaseRetrievalResponse is compatible with MutableMapping :rtype: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse @@ -138,6 +174,7 @@ async def retrieve( _request = build_knowledge_base_retrieval_retrieve_request( knowledge_base_name=self._config.knowledge_base_name, + query_source_authorization=query_source_authorization, content_type=content_type, api_version=self._config.api_version, content=_content, diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/__init__.py index 5f662e0ba6a5..88301dec7091 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/__init__.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/__init__.py @@ -15,27 +15,41 @@ from ._models import ( # type: ignore AIServices, + AssetStore, AzureBlobKnowledgeSourceParams, CompletedSynchronizationState, + FabricDataAgentKnowledgeSourceParams, + FabricOntologyKnowledgeSourceParams, + FreshnessPolicy, IndexedOneLakeKnowledgeSourceParams, + IndexedSharePointKnowledgeSourceParams, KnowledgeBaseActivityRecord, KnowledgeBaseAgenticReasoningActivityRecord, KnowledgeBaseAzureBlobReference, KnowledgeBaseErrorAdditionalInfo, KnowledgeBaseErrorDetail, + KnowledgeBaseFabricDataAgentReference, + KnowledgeBaseFabricOntologyReference, KnowledgeBaseImageContent, KnowledgeBaseIndexedOneLakeReference, + KnowledgeBaseIndexedSharePointReference, KnowledgeBaseMessage, KnowledgeBaseMessageContent, KnowledgeBaseMessageImageContent, KnowledgeBaseMessageTextContent, + KnowledgeBaseModelAnswerSynthesisActivityRecord, + KnowledgeBaseModelQueryPlanningActivityRecord, KnowledgeBaseModelWebSummarizationActivityRecord, KnowledgeBaseReference, + KnowledgeBaseRemoteSharePointReference, KnowledgeBaseRetrievalRequest, KnowledgeBaseRetrievalResponse, KnowledgeBaseSearchIndexReference, KnowledgeBaseWebReference, + KnowledgeBaseWorkIQReference, KnowledgeRetrievalIntent, + KnowledgeRetrievalLowReasoningEffort, + KnowledgeRetrievalMediumReasoningEffort, KnowledgeRetrievalMinimalReasoningEffort, KnowledgeRetrievalReasoningEffort, KnowledgeRetrievalSemanticIntent, @@ -46,9 +60,13 @@ KnowledgeSourceStatus, KnowledgeSourceSynchronizationError, KnowledgeSourceVectorizer, + PurviewSensitivityLabelInfo, + RemoteSharePointKnowledgeSourceParams, SearchIndexKnowledgeSourceParams, SynchronizationState, WebKnowledgeSourceParams, + WorkIQAttribution, + WorkIQKnowledgeSourceParams, ) from ._enums import ( # type: ignore @@ -56,6 +74,7 @@ KnowledgeBaseMessageContentType, KnowledgeBaseReferenceType, KnowledgeRetrievalIntentType, + KnowledgeRetrievalOutputMode, KnowledgeRetrievalReasoningEffortKind, ) from ._patch import __all__ as _patch_all @@ -64,27 +83,41 @@ __all__ = [ "AIServices", + "AssetStore", "AzureBlobKnowledgeSourceParams", "CompletedSynchronizationState", + "FabricDataAgentKnowledgeSourceParams", + "FabricOntologyKnowledgeSourceParams", + "FreshnessPolicy", "IndexedOneLakeKnowledgeSourceParams", + "IndexedSharePointKnowledgeSourceParams", "KnowledgeBaseActivityRecord", "KnowledgeBaseAgenticReasoningActivityRecord", "KnowledgeBaseAzureBlobReference", "KnowledgeBaseErrorAdditionalInfo", "KnowledgeBaseErrorDetail", + "KnowledgeBaseFabricDataAgentReference", + "KnowledgeBaseFabricOntologyReference", "KnowledgeBaseImageContent", "KnowledgeBaseIndexedOneLakeReference", + "KnowledgeBaseIndexedSharePointReference", "KnowledgeBaseMessage", "KnowledgeBaseMessageContent", "KnowledgeBaseMessageImageContent", "KnowledgeBaseMessageTextContent", + "KnowledgeBaseModelAnswerSynthesisActivityRecord", + "KnowledgeBaseModelQueryPlanningActivityRecord", "KnowledgeBaseModelWebSummarizationActivityRecord", "KnowledgeBaseReference", + "KnowledgeBaseRemoteSharePointReference", "KnowledgeBaseRetrievalRequest", "KnowledgeBaseRetrievalResponse", "KnowledgeBaseSearchIndexReference", "KnowledgeBaseWebReference", + "KnowledgeBaseWorkIQReference", "KnowledgeRetrievalIntent", + "KnowledgeRetrievalLowReasoningEffort", + "KnowledgeRetrievalMediumReasoningEffort", "KnowledgeRetrievalMinimalReasoningEffort", "KnowledgeRetrievalReasoningEffort", "KnowledgeRetrievalSemanticIntent", @@ -95,13 +128,18 @@ "KnowledgeSourceStatus", "KnowledgeSourceSynchronizationError", "KnowledgeSourceVectorizer", + "PurviewSensitivityLabelInfo", + "RemoteSharePointKnowledgeSourceParams", "SearchIndexKnowledgeSourceParams", "SynchronizationState", "WebKnowledgeSourceParams", + "WorkIQAttribution", + "WorkIQKnowledgeSourceParams", "KnowledgeBaseActivityRecordType", "KnowledgeBaseMessageContentType", "KnowledgeBaseReferenceType", "KnowledgeRetrievalIntentType", + "KnowledgeRetrievalOutputMode", "KnowledgeRetrievalReasoningEffortKind", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_enums.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_enums.py index 675f16e9c296..a7fa84d2a9ff 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_enums.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_enums.py @@ -17,10 +17,24 @@ class KnowledgeBaseActivityRecordType(str, Enum, metaclass=CaseInsensitiveEnumMe """Search index retrieval activity.""" AZURE_BLOB = "azureBlob" """Azure Blob retrieval activity.""" + INDEXED_SHARE_POINT = "indexedSharePoint" + """Indexed SharePoint retrieval activity.""" INDEXED_ONELAKE = "indexedOneLake" """Indexed OneLake retrieval activity.""" WEB = "web" """Web retrieval activity.""" + REMOTE_SHARE_POINT = "remoteSharePoint" + """Remote SharePoint retrieval activity.""" + WORK_IQ = "workIQ" + """WorkIQ retrieval activity.""" + FABRIC_DATA_AGENT = "fabricDataAgent" + """Fabric Data Agent retrieval activity.""" + FABRIC_ONTOLOGY = "fabricOntology" + """Fabric Ontology retrieval activity.""" + MODEL_QUERY_PLANNING = "modelQueryPlanning" + """LLM query planning activity.""" + MODEL_ANSWER_SYNTHESIS = "modelAnswerSynthesis" + """LLM answer synthesis activity.""" MODEL_WEB_SUMMARIZATION = "modelWebSummarization" """LLM web summarization activity.""" AGENTIC_REASONING = "agenticReasoning" @@ -43,10 +57,20 @@ class KnowledgeBaseReferenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Search index document reference.""" AZURE_BLOB = "azureBlob" """Azure Blob document reference.""" + INDEXED_SHARE_POINT = "indexedSharePoint" + """Indexed SharePoint document reference.""" INDEXED_ONELAKE = "indexedOneLake" """Indexed OneLake document reference.""" WEB = "web" """Web document reference.""" + REMOTE_SHARE_POINT = "remoteSharePoint" + """Remote SharePoint document reference.""" + WORK_IQ = "workIQ" + """Work IQ document reference.""" + FABRIC_DATA_AGENT = "fabricDataAgent" + """Fabric Data Agent document reference.""" + FABRIC_ONTOLOGY = "fabricOntology" + """Fabric Ontology document reference.""" class KnowledgeRetrievalIntentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -56,8 +80,21 @@ class KnowledgeRetrievalIntentType(str, Enum, metaclass=CaseInsensitiveEnumMeta) """A natural language semantic query intent.""" +class KnowledgeRetrievalOutputMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The output configuration for this retrieval.""" + + EXTRACTIVE_DATA = "extractiveData" + """Return data from the knowledge sources directly without generative alteration.""" + ANSWER_SYNTHESIS = "answerSynthesis" + """Synthesize an answer for the response payload.""" + + class KnowledgeRetrievalReasoningEffortKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The amount of effort to use during retrieval.""" MINIMAL = "minimal" """Does not perform any source selections, query planning, or iterative search.""" + LOW = "low" + """Use low reasoning during retrieval.""" + MEDIUM = "medium" + """Use a moderate amount of reasoning during retrieval.""" diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_models.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_models.py index e33e0af1bd1a..1cde2c637a42 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_models.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_models.py @@ -59,12 +59,51 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class AssetStore(_Model): + """Configuration for an asset store used to store extracted assets such as images. + + :ivar connection_string: The connection string for the asset store. Required. + :vartype connection_string: str + :ivar container_name: The name of the blob container within the asset store where extracted + assets (for example, images) are stored. Required. + :vartype container_name: str + """ + + connection_string: str = rest_field( + name="connectionString", visibility=["read", "create", "update", "delete", "query"] + ) + """The connection string for the asset store. Required.""" + container_name: str = rest_field(name="containerName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the blob container within the asset store where extracted assets (for example, + images) are stored. Required.""" + + @overload + def __init__( + self, + *, + connection_string: str, + container_name: str, + ) -> 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 KnowledgeSourceParams(_Model): """Base type for knowledge source runtime parameters. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBlobKnowledgeSourceParams, IndexedOneLakeKnowledgeSourceParams, - SearchIndexKnowledgeSourceParams, WebKnowledgeSourceParams + AzureBlobKnowledgeSourceParams, FabricDataAgentKnowledgeSourceParams, + FabricOntologyKnowledgeSourceParams, IndexedOneLakeKnowledgeSourceParams, + IndexedSharePointKnowledgeSourceParams, RemoteSharePointKnowledgeSourceParams, + SearchIndexKnowledgeSourceParams, WebKnowledgeSourceParams, WorkIQKnowledgeSourceParams :ivar knowledge_source_name: The name of the index the params apply to. Required. :vartype knowledge_source_name: str @@ -74,12 +113,26 @@ class KnowledgeSourceParams(_Model): :ivar include_reference_source_data: Indicates whether references should include the structured data obtained during retrieval in their payload. :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be included in the response. :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int :ivar kind: The type of the knowledge source. Required. Known values are: "searchIndex", - "azureBlob", "indexedOneLake", and "web". + "azureBlob", "indexedSharePoint", "indexedOneLake", "indexedSql", "web", "remoteSharePoint", + "workIQ", "file", "mcpServer", "fabricDataAgent", and "fabricOntology". :vartype kind: str or ~azure.search.documents.indexes.models.KnowledgeSourceKind + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool """ __mapping__: dict[str, _Model] = {} @@ -96,13 +149,33 @@ class KnowledgeSourceParams(_Model): ) """Indicates whether references should include the structured data obtained during retrieval in their payload.""" + always_query_source: Optional[bool] = rest_field( + name="alwaysQuerySource", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + fail_on_error: Optional[bool] = rest_field( + name="failOnError", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" reranker_threshold: Optional[float] = rest_field( name="rerankerThreshold", visibility=["read", "create", "update", "delete", "query"] ) """The reranker threshold all retrieved documents must meet to be included in the response.""" + max_output_documents: Optional[int] = rest_field( + name="maxOutputDocuments", visibility=["read", "create", "update", "delete", "query"] + ) + """Limits the maximum number of documents returned from this knowledge source.""" kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) """The type of the knowledge source. Required. Known values are: \"searchIndex\", \"azureBlob\", - \"indexedOneLake\", and \"web\".""" + \"indexedSharePoint\", \"indexedOneLake\", \"indexedSql\", \"web\", \"remoteSharePoint\", + \"workIQ\", \"file\", \"mcpServer\", \"fabricDataAgent\", and \"fabricOntology\".""" + enable_image_serving: Optional[bool] = rest_field( + name="enableImageServing", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether image serving should be enabled for this knowledge source at retrieval time. + When true, images extracted during ingestion are delivered to downstream models.""" @overload def __init__( @@ -112,7 +185,11 @@ def __init__( kind: str, include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = None, ) -> None: ... @overload @@ -137,9 +214,22 @@ class AzureBlobKnowledgeSourceParams(KnowledgeSourceParams, discriminator="azure :ivar include_reference_source_data: Indicates whether references should include the structured data obtained during retrieval in their payload. :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be included in the response. :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool :ivar kind: The discriminator value. Required. A knowledge source that read and ingest data from Azure Blob Storage to a Search Index. :vartype kind: str or ~azure.search.documents.indexes.models.AZURE_BLOB @@ -156,7 +246,11 @@ def __init__( knowledge_source_name: str, include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = None, ) -> None: ... @overload @@ -229,6 +323,163 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class FabricDataAgentKnowledgeSourceParams(KnowledgeSourceParams, discriminator="fabricDataAgent"): + """Specifies runtime parameters for a Fabric Data Agent knowledge source. + + :ivar knowledge_source_name: The name of the index the params apply to. Required. + :vartype knowledge_source_name: str + :ivar include_references: Indicates whether references should be included for data retrieved + from this source. + :vartype include_references: bool + :ivar include_reference_source_data: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool + :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool + :ivar kind: The discriminator value. Required. A knowledge source that retrieves data from a + Fabric Data Agent. + :vartype kind: str or ~azure.search.documents.indexes.models.FABRIC_DATA_AGENT + """ + + kind: Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. A knowledge source that retrieves data from a Fabric Data + Agent.""" + + @overload + def __init__( + self, + *, + knowledge_source_name: str, + include_references: Optional[bool] = None, + include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, + reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = 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) + self.kind = KnowledgeSourceKind.FABRIC_DATA_AGENT # type: ignore + + +class FabricOntologyKnowledgeSourceParams(KnowledgeSourceParams, discriminator="fabricOntology"): + """Specifies runtime parameters for a Fabric Ontology knowledge source. + + :ivar knowledge_source_name: The name of the index the params apply to. Required. + :vartype knowledge_source_name: str + :ivar include_references: Indicates whether references should be included for data retrieved + from this source. + :vartype include_references: bool + :ivar include_reference_source_data: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool + :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool + :ivar kind: The discriminator value. Required. A knowledge source that retrieves data from + Microsoft Fabric Ontology ontologies. + :vartype kind: str or ~azure.search.documents.indexes.models.FABRIC_ONTOLOGY + """ + + kind: Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. A knowledge source that retrieves data from Microsoft Fabric + Ontology ontologies.""" + + @overload + def __init__( + self, + *, + knowledge_source_name: str, + include_references: Optional[bool] = None, + include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, + reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = 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) + self.kind = KnowledgeSourceKind.FABRIC_ONTOLOGY # type: ignore + + +class FreshnessPolicy(_Model): + """Configuration for freshness-aware retrieval. When set, newer documents receive a ranking boost + during retrieval. + + :ivar boosting_duration: ISO 8601 duration for the freshness boosting window (e.g. 'P90D' for + 90 days). Documents newer than this duration receive a ranking boost during retrieval. + :vartype boosting_duration: str + """ + + boosting_duration: Optional[str] = rest_field( + name="boostingDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """ISO 8601 duration for the freshness boosting window (e.g. 'P90D' for 90 days). Documents newer + than this duration receive a ranking boost during retrieval.""" + + @overload + def __init__( + self, + *, + boosting_duration: Optional[str] = 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 IndexedOneLakeKnowledgeSourceParams(KnowledgeSourceParams, discriminator="indexedOneLake"): """Specifies runtime parameters for a indexed OneLake knowledge source. @@ -240,9 +491,22 @@ class IndexedOneLakeKnowledgeSourceParams(KnowledgeSourceParams, discriminator=" :ivar include_reference_source_data: Indicates whether references should include the structured data obtained during retrieval in their payload. :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be included in the response. :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool :ivar kind: The discriminator value. Required. A knowledge source that reads data from indexed OneLake. :vartype kind: str or ~azure.search.documents.indexes.models.INDEXED_ONELAKE @@ -258,7 +522,11 @@ def __init__( knowledge_source_name: str, include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = None, ) -> None: ... @overload @@ -273,17 +541,81 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.INDEXED_ONELAKE # type: ignore +class IndexedSharePointKnowledgeSourceParams(KnowledgeSourceParams, discriminator="indexedSharePoint"): + """Specifies runtime parameters for a indexed SharePoint knowledge source. + + :ivar knowledge_source_name: The name of the index the params apply to. Required. + :vartype knowledge_source_name: str + :ivar include_references: Indicates whether references should be included for data retrieved + from this source. + :vartype include_references: bool + :ivar include_reference_source_data: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool + :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool + :ivar kind: The discriminator value. Required. A knowledge source that reads data from indexed + SharePoint. + :vartype kind: str or ~azure.search.documents.indexes.models.INDEXED_SHARE_POINT + """ + + kind: Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. A knowledge source that reads data from indexed SharePoint.""" + + @overload + def __init__( + self, + *, + knowledge_source_name: str, + include_references: Optional[bool] = None, + include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, + reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = 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) + self.kind = KnowledgeSourceKind.INDEXED_SHARE_POINT # type: ignore + + class KnowledgeBaseActivityRecord(_Model): """Base type for activity records. Tracks execution details, timing, and errors for knowledge base operations. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - KnowledgeBaseAgenticReasoningActivityRecord, KnowledgeBaseModelWebSummarizationActivityRecord + KnowledgeBaseAgenticReasoningActivityRecord, KnowledgeBaseModelAnswerSynthesisActivityRecord, + KnowledgeBaseModelQueryPlanningActivityRecord, KnowledgeBaseModelWebSummarizationActivityRecord :ivar id: The ID of the activity record. Required. :vartype id: int :ivar type: The type of the activity record. Required. Known values are: "searchIndex", - "azureBlob", "indexedOneLake", "web", "modelWebSummarization", and "agenticReasoning". + "azureBlob", "indexedSharePoint", "indexedOneLake", "web", "remoteSharePoint", "workIQ", + "fabricDataAgent", "fabricOntology", "modelQueryPlanning", "modelAnswerSynthesis", + "modelWebSummarization", and "agenticReasoning". :vartype type: str or ~azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecordType :ivar elapsed_ms: The elapsed time in milliseconds for the retrieval activity. @@ -291,6 +623,10 @@ class KnowledgeBaseActivityRecord(_Model): :ivar error: The error detail explaining why the operation failed. This property is only included when the activity does not succeed. :vartype error: ~azure.search.documents.knowledgebases.models.KnowledgeBaseErrorDetail + :ivar warning: A warning message surfacing potential configuration issues observed during the + activity, such as documents dropped due to score thresholding, token limit truncation, or + timeout conditions. + :vartype warning: str """ __mapping__: dict[str, _Model] = {} @@ -298,7 +634,9 @@ class KnowledgeBaseActivityRecord(_Model): """The ID of the activity record. Required.""" type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) """The type of the activity record. Required. Known values are: \"searchIndex\", \"azureBlob\", - \"indexedOneLake\", \"web\", \"modelWebSummarization\", and \"agenticReasoning\".""" + \"indexedSharePoint\", \"indexedOneLake\", \"web\", \"remoteSharePoint\", \"workIQ\", + \"fabricDataAgent\", \"fabricOntology\", \"modelQueryPlanning\", \"modelAnswerSynthesis\", + \"modelWebSummarization\", and \"agenticReasoning\".""" elapsed_ms: Optional[int] = rest_field(name="elapsedMs", visibility=["read", "create", "update", "delete", "query"]) """The elapsed time in milliseconds for the retrieval activity.""" error: Optional["_models.KnowledgeBaseErrorDetail"] = rest_field( @@ -306,6 +644,9 @@ class KnowledgeBaseActivityRecord(_Model): ) """The error detail explaining why the operation failed. This property is only included when the activity does not succeed.""" + warning: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A warning message surfacing potential configuration issues observed during the activity, such + as documents dropped due to score thresholding, token limit truncation, or timeout conditions.""" @overload def __init__( @@ -315,6 +656,7 @@ def __init__( type: str, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, + warning: Optional[str] = None, ) -> None: ... @overload @@ -340,6 +682,10 @@ class KnowledgeBaseAgenticReasoningActivityRecord( :ivar error: The error detail explaining why the operation failed. This property is only included when the activity does not succeed. :vartype error: ~azure.search.documents.knowledgebases.models.KnowledgeBaseErrorDetail + :ivar warning: A warning message surfacing potential configuration issues observed during the + activity, such as documents dropped due to score thresholding, token limit truncation, or + timeout conditions. + :vartype warning: str :ivar type: The discriminator value. Required. Agentic reasoning activity. :vartype type: str or ~azure.search.documents.knowledgebases.models.AGENTIC_REASONING :ivar reasoning_tokens: The number of input tokens for agentic reasoning. @@ -367,6 +713,7 @@ def __init__( id: int, # pylint: disable=redefined-builtin elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, + warning: Optional[str] = None, reasoning_tokens: Optional[int] = None, retrieval_reasoning_effort: Optional["_models.KnowledgeRetrievalReasoningEffort"] = None, ) -> None: ... @@ -387,11 +734,14 @@ class KnowledgeBaseReference(_Model): """Base type for references. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - KnowledgeBaseAzureBlobReference, KnowledgeBaseIndexedOneLakeReference, - KnowledgeBaseSearchIndexReference, KnowledgeBaseWebReference + KnowledgeBaseAzureBlobReference, KnowledgeBaseFabricDataAgentReference, + KnowledgeBaseFabricOntologyReference, KnowledgeBaseIndexedOneLakeReference, + KnowledgeBaseIndexedSharePointReference, KnowledgeBaseRemoteSharePointReference, + KnowledgeBaseSearchIndexReference, KnowledgeBaseWebReference, KnowledgeBaseWorkIQReference :ivar type: The type of the reference. Required. Known values are: "searchIndex", "azureBlob", - "indexedOneLake", and "web". + "indexedSharePoint", "indexedOneLake", "web", "remoteSharePoint", "workIQ", "fabricDataAgent", + and "fabricOntology". :vartype type: str or ~azure.search.documents.knowledgebases.models.KnowledgeBaseReferenceType :ivar id: The ID of the reference. Required. :vartype id: str @@ -406,7 +756,8 @@ class KnowledgeBaseReference(_Model): __mapping__: dict[str, _Model] = {} type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) """The type of the reference. Required. Known values are: \"searchIndex\", \"azureBlob\", - \"indexedOneLake\", and \"web\".""" + \"indexedSharePoint\", \"indexedOneLake\", \"web\", \"remoteSharePoint\", \"workIQ\", + \"fabricDataAgent\", and \"fabricOntology\".""" id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The ID of the reference. Required.""" activity_source: int = rest_field(name="activitySource", visibility=["read", "create", "update", "delete", "query"]) @@ -457,12 +808,19 @@ class KnowledgeBaseAzureBlobReference(KnowledgeBaseReference, discriminator="azu :vartype type: str or ~azure.search.documents.knowledgebases.models.AZURE_BLOB :ivar blob_url: The blob URL for the reference. :vartype blob_url: str + :ivar search_sensitivity_label_info: The sensitivity label information for the reference. + :vartype search_sensitivity_label_info: + ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo """ type: Literal[KnowledgeBaseReferenceType.AZURE_BLOB] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The discriminator value. Required. Azure Blob document reference.""" blob_url: Optional[str] = rest_field(name="blobUrl", visibility=["read", "create", "update", "delete", "query"]) """The blob URL for the reference.""" + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = rest_field( + name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The sensitivity label information for the reference.""" @overload def __init__( @@ -473,6 +831,7 @@ def __init__( source_data: Optional[dict[str, Any]] = None, reranker_score: Optional[float] = None, blob_url: Optional[str] = None, + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = None, ) -> None: ... @overload @@ -532,6 +891,114 @@ class KnowledgeBaseErrorDetail(_Model): """The error additional info.""" +class KnowledgeBaseFabricDataAgentReference(KnowledgeBaseReference, discriminator="fabricDataAgent"): + """Represents a Fabric Data Agent document reference. + + :ivar id: The ID of the reference. Required. + :vartype id: str + :ivar activity_source: The source activity ID for the reference. Required. + :vartype activity_source: int + :ivar source_data: The source data for the reference. + :vartype source_data: dict[str, any] + :ivar reranker_score: The reranker score for the document reference. + :vartype reranker_score: float + :ivar type: The discriminator value. Required. Fabric Data Agent document reference. + :vartype type: str or ~azure.search.documents.knowledgebases.models.FABRIC_DATA_AGENT + :ivar workspace_id: The Fabric workspace ID. + :vartype workspace_id: str + :ivar data_agent_id: The Fabric Data Agent ID. + :vartype data_agent_id: str + """ + + type: Literal[KnowledgeBaseReferenceType.FABRIC_DATA_AGENT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Fabric Data Agent document reference.""" + workspace_id: Optional[str] = rest_field( + name="workspaceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Fabric workspace ID.""" + data_agent_id: Optional[str] = rest_field( + name="dataAgentId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Fabric Data Agent ID.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + activity_source: int, + source_data: Optional[dict[str, Any]] = None, + reranker_score: Optional[float] = None, + workspace_id: Optional[str] = None, + data_agent_id: Optional[str] = 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) + self.type = KnowledgeBaseReferenceType.FABRIC_DATA_AGENT # type: ignore + + +class KnowledgeBaseFabricOntologyReference(KnowledgeBaseReference, discriminator="fabricOntology"): + """Represents a Fabric Ontology document reference. + + :ivar id: The ID of the reference. Required. + :vartype id: str + :ivar activity_source: The source activity ID for the reference. Required. + :vartype activity_source: int + :ivar source_data: The source data for the reference. + :vartype source_data: dict[str, any] + :ivar reranker_score: The reranker score for the document reference. + :vartype reranker_score: float + :ivar type: The discriminator value. Required. Fabric Ontology document reference. + :vartype type: str or ~azure.search.documents.knowledgebases.models.FABRIC_ONTOLOGY + :ivar workspace_id: The Fabric workspace ID. + :vartype workspace_id: str + :ivar ontology_id: The ontology ID within the workspace. + :vartype ontology_id: str + """ + + type: Literal[KnowledgeBaseReferenceType.FABRIC_ONTOLOGY] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Fabric Ontology document reference.""" + workspace_id: Optional[str] = rest_field( + name="workspaceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The Fabric workspace ID.""" + ontology_id: Optional[str] = rest_field( + name="ontologyId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ontology ID within the workspace.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + activity_source: int, + source_data: Optional[dict[str, Any]] = None, + reranker_score: Optional[float] = None, + workspace_id: Optional[str] = None, + ontology_id: Optional[str] = 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) + self.type = KnowledgeBaseReferenceType.FABRIC_ONTOLOGY # type: ignore + + class KnowledgeBaseImageContent(_Model): """Image content. @@ -575,12 +1042,19 @@ class KnowledgeBaseIndexedOneLakeReference(KnowledgeBaseReference, discriminator :vartype type: str or ~azure.search.documents.knowledgebases.models.INDEXED_ONELAKE :ivar doc_url: The document URL for the reference. :vartype doc_url: str + :ivar search_sensitivity_label_info: The sensitivity label information for the reference. + :vartype search_sensitivity_label_info: + ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo """ type: Literal[KnowledgeBaseReferenceType.INDEXED_ONELAKE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The discriminator value. Required. Indexed OneLake document reference.""" doc_url: Optional[str] = rest_field(name="docUrl", visibility=["read", "create", "update", "delete", "query"]) """The document URL for the reference.""" + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = rest_field( + name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The sensitivity label information for the reference.""" @overload def __init__( @@ -591,6 +1065,7 @@ def __init__( source_data: Optional[dict[str, Any]] = None, reranker_score: Optional[float] = None, doc_url: Optional[str] = None, + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = None, ) -> None: ... @overload @@ -605,6 +1080,59 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.INDEXED_ONELAKE # type: ignore +class KnowledgeBaseIndexedSharePointReference(KnowledgeBaseReference, discriminator="indexedSharePoint"): + """Represents an indexed SharePoint document reference. + + :ivar id: The ID of the reference. Required. + :vartype id: str + :ivar activity_source: The source activity ID for the reference. Required. + :vartype activity_source: int + :ivar source_data: The source data for the reference. + :vartype source_data: dict[str, any] + :ivar reranker_score: The reranker score for the document reference. + :vartype reranker_score: float + :ivar type: The discriminator value. Required. Indexed SharePoint document reference. + :vartype type: str or ~azure.search.documents.knowledgebases.models.INDEXED_SHARE_POINT + :ivar doc_url: The document URL for the reference. + :vartype doc_url: str + :ivar search_sensitivity_label_info: The sensitivity label information for the reference. + :vartype search_sensitivity_label_info: + ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo + """ + + type: Literal[KnowledgeBaseReferenceType.INDEXED_SHARE_POINT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Indexed SharePoint document reference.""" + doc_url: Optional[str] = rest_field(name="docUrl", visibility=["read", "create", "update", "delete", "query"]) + """The document URL for the reference.""" + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = rest_field( + name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The sensitivity label information for the reference.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + activity_source: int, + source_data: Optional[dict[str, Any]] = None, + reranker_score: Optional[float] = None, + doc_url: Optional[str] = None, + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = 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) + self.type = KnowledgeBaseReferenceType.INDEXED_SHARE_POINT # type: ignore + + class KnowledgeBaseMessage(_Model): """The natural language message style object. @@ -725,7 +1253,135 @@ class KnowledgeBaseMessageTextContent(KnowledgeBaseMessageContent, discriminator def __init__( self, *, - text: str, + text: str, + ) -> 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) + self.type = KnowledgeBaseMessageContentType.TEXT # type: ignore + + +class KnowledgeBaseModelAnswerSynthesisActivityRecord( + KnowledgeBaseActivityRecord, discriminator="modelAnswerSynthesis" +): # pylint: disable=name-too-long + """Represents an LLM answer synthesis activity record. + + :ivar id: The ID of the activity record. Required. + :vartype id: int + :ivar elapsed_ms: The elapsed time in milliseconds for the retrieval activity. + :vartype elapsed_ms: int + :ivar error: The error detail explaining why the operation failed. This property is only + included when the activity does not succeed. + :vartype error: ~azure.search.documents.knowledgebases.models.KnowledgeBaseErrorDetail + :ivar warning: A warning message surfacing potential configuration issues observed during the + activity, such as documents dropped due to score thresholding, token limit truncation, or + timeout conditions. + :vartype warning: str + :ivar type: The discriminator value. Required. LLM answer synthesis activity. + :vartype type: str or ~azure.search.documents.knowledgebases.models.MODEL_ANSWER_SYNTHESIS + :ivar input_tokens: The number of input tokens for the LLM answer synthesis activity. + :vartype input_tokens: int + :ivar output_tokens: The number of output tokens for the LLM answer synthesis activity. + :vartype output_tokens: int + :ivar model_name: The name of the model used for the LLM answer synthesis activity. + :vartype model_name: str + """ + + type: Literal[KnowledgeBaseActivityRecordType.MODEL_ANSWER_SYNTHESIS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. LLM answer synthesis activity.""" + input_tokens: Optional[int] = rest_field( + name="inputTokens", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of input tokens for the LLM answer synthesis activity.""" + output_tokens: Optional[int] = rest_field( + name="outputTokens", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of output tokens for the LLM answer synthesis activity.""" + model_name: Optional[str] = rest_field(name="modelName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the model used for the LLM answer synthesis activity.""" + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + elapsed_ms: Optional[int] = None, + error: Optional["_models.KnowledgeBaseErrorDetail"] = None, + warning: Optional[str] = None, + input_tokens: Optional[int] = None, + output_tokens: Optional[int] = None, + model_name: Optional[str] = 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) + self.type = KnowledgeBaseActivityRecordType.MODEL_ANSWER_SYNTHESIS # type: ignore + + +class KnowledgeBaseModelQueryPlanningActivityRecord( + KnowledgeBaseActivityRecord, discriminator="modelQueryPlanning" +): # pylint: disable=name-too-long + """Represents an LLM query planning activity record. + + :ivar id: The ID of the activity record. Required. + :vartype id: int + :ivar elapsed_ms: The elapsed time in milliseconds for the retrieval activity. + :vartype elapsed_ms: int + :ivar error: The error detail explaining why the operation failed. This property is only + included when the activity does not succeed. + :vartype error: ~azure.search.documents.knowledgebases.models.KnowledgeBaseErrorDetail + :ivar warning: A warning message surfacing potential configuration issues observed during the + activity, such as documents dropped due to score thresholding, token limit truncation, or + timeout conditions. + :vartype warning: str + :ivar type: The discriminator value. Required. LLM query planning activity. + :vartype type: str or ~azure.search.documents.knowledgebases.models.MODEL_QUERY_PLANNING + :ivar input_tokens: The number of input tokens for the LLM query planning activity. + :vartype input_tokens: int + :ivar output_tokens: The number of output tokens for the LLM query planning activity. + :vartype output_tokens: int + :ivar model_name: The name of the model used for the LLM query planning activity. + :vartype model_name: str + """ + + type: Literal[KnowledgeBaseActivityRecordType.MODEL_QUERY_PLANNING] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. LLM query planning activity.""" + input_tokens: Optional[int] = rest_field( + name="inputTokens", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of input tokens for the LLM query planning activity.""" + output_tokens: Optional[int] = rest_field( + name="outputTokens", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of output tokens for the LLM query planning activity.""" + model_name: Optional[str] = rest_field(name="modelName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the model used for the LLM query planning activity.""" + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + elapsed_ms: Optional[int] = None, + error: Optional["_models.KnowledgeBaseErrorDetail"] = None, + warning: Optional[str] = None, + input_tokens: Optional[int] = None, + output_tokens: Optional[int] = None, + model_name: Optional[str] = None, ) -> None: ... @overload @@ -737,7 +1393,7 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = KnowledgeBaseMessageContentType.TEXT # type: ignore + self.type = KnowledgeBaseActivityRecordType.MODEL_QUERY_PLANNING # type: ignore class KnowledgeBaseModelWebSummarizationActivityRecord( @@ -752,12 +1408,18 @@ class KnowledgeBaseModelWebSummarizationActivityRecord( :ivar error: The error detail explaining why the operation failed. This property is only included when the activity does not succeed. :vartype error: ~azure.search.documents.knowledgebases.models.KnowledgeBaseErrorDetail + :ivar warning: A warning message surfacing potential configuration issues observed during the + activity, such as documents dropped due to score thresholding, token limit truncation, or + timeout conditions. + :vartype warning: str :ivar type: The discriminator value. Required. LLM web summarization activity. :vartype type: str or ~azure.search.documents.knowledgebases.models.MODEL_WEB_SUMMARIZATION :ivar input_tokens_count: The number of input tokens for the LLM web summarization activity. :vartype input_tokens_count: int :ivar output_tokens_count: The number of output tokens for the LLM web summarization activity. :vartype output_tokens_count: int + :ivar model_name: The name of the model used for the LLM web summarization activity. + :vartype model_name: str """ type: Literal[KnowledgeBaseActivityRecordType.MODEL_WEB_SUMMARIZATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -770,6 +1432,8 @@ class KnowledgeBaseModelWebSummarizationActivityRecord( name="outputTokens", visibility=["read", "create", "update", "delete", "query"] ) """The number of output tokens for the LLM web summarization activity.""" + model_name: Optional[str] = rest_field(name="modelName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the model used for the LLM web summarization activity.""" @overload def __init__( @@ -778,8 +1442,10 @@ def __init__( id: int, # pylint: disable=redefined-builtin elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, + warning: Optional[str] = None, input_tokens_count: Optional[int] = None, output_tokens_count: Optional[int] = None, + model_name: Optional[str] = None, ) -> None: ... @overload @@ -794,22 +1460,92 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.MODEL_WEB_SUMMARIZATION # type: ignore +class KnowledgeBaseRemoteSharePointReference(KnowledgeBaseReference, discriminator="remoteSharePoint"): + """Represents a remote SharePoint document reference. + + :ivar id: The ID of the reference. Required. + :vartype id: str + :ivar activity_source: The source activity ID for the reference. Required. + :vartype activity_source: int + :ivar source_data: The source data for the reference. + :vartype source_data: dict[str, any] + :ivar reranker_score: The reranker score for the document reference. + :vartype reranker_score: float + :ivar type: The discriminator value. Required. Remote SharePoint document reference. + :vartype type: str or ~azure.search.documents.knowledgebases.models.REMOTE_SHARE_POINT + :ivar web_url: The url the reference data originated from. + :vartype web_url: str + :ivar search_sensitivity_label_info: The sensitivity label information for the reference. + :vartype search_sensitivity_label_info: + ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo + """ + + type: Literal[KnowledgeBaseReferenceType.REMOTE_SHARE_POINT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Remote SharePoint document reference.""" + web_url: Optional[str] = rest_field(name="webUrl", visibility=["read", "create", "update", "delete", "query"]) + """The url the reference data originated from.""" + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = rest_field( + name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The sensitivity label information for the reference.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + activity_source: int, + source_data: Optional[dict[str, Any]] = None, + reranker_score: Optional[float] = None, + web_url: Optional[str] = None, + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = 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) + self.type = KnowledgeBaseReferenceType.REMOTE_SHARE_POINT # type: ignore + + class KnowledgeBaseRetrievalRequest(_Model): """The input contract for the retrieval request. + :ivar messages: A list of chat message style input. + :vartype messages: list[~azure.search.documents.knowledgebases.models.KnowledgeBaseMessage] :ivar intents: A list of intended queries to execute without model query planning. :vartype intents: list[~azure.search.documents.knowledgebases.models.KnowledgeRetrievalIntent] :ivar max_runtime_in_seconds: The maximum runtime in seconds. :vartype max_runtime_in_seconds: int + :ivar max_output_size: Limits the maximum size of the content in the output. + :vartype max_output_size: int + :ivar max_output_documents: Limits the maximum number of documents in the output. + :vartype max_output_documents: int :ivar max_output_size_in_tokens: Limits the maximum size of the content in the output. :vartype max_output_size_in_tokens: int + :ivar retrieval_reasoning_effort: The retrieval reasoning effort configuration. + :vartype retrieval_reasoning_effort: + ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalReasoningEffort :ivar include_activity: Indicates retrieval results should include activity information. :vartype include_activity: bool + :ivar output_mode: The output configuration for this retrieval. Known values are: + "extractiveData" and "answerSynthesis". + :vartype output_mode: str or + ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalOutputMode :ivar knowledge_source_params: A list of runtime parameters for the knowledge sources. :vartype knowledge_source_params: list[~azure.search.documents.knowledgebases.models.KnowledgeSourceParams] """ + messages: Optional[list["_models.KnowledgeBaseMessage"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A list of chat message style input.""" intents: Optional[list["_models.KnowledgeRetrievalIntent"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -818,14 +1554,31 @@ class KnowledgeBaseRetrievalRequest(_Model): name="maxRuntimeInSeconds", visibility=["read", "create", "update", "delete", "query"] ) """The maximum runtime in seconds.""" + max_output_size: Optional[int] = rest_field( + name="maxOutputSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Limits the maximum size of the content in the output.""" + max_output_documents: Optional[int] = rest_field( + name="maxOutputDocuments", visibility=["read", "create", "update", "delete", "query"] + ) + """Limits the maximum number of documents in the output.""" max_output_size_in_tokens: Optional[int] = rest_field( name="maxOutputSizeInTokens", visibility=["read", "create", "update", "delete", "query"] ) """Limits the maximum size of the content in the output.""" + retrieval_reasoning_effort: Optional["_models.KnowledgeRetrievalReasoningEffort"] = rest_field( + name="retrievalReasoningEffort", visibility=["read", "create", "update", "delete", "query"] + ) + """The retrieval reasoning effort configuration.""" include_activity: Optional[bool] = rest_field( name="includeActivity", visibility=["read", "create", "update", "delete", "query"] ) """Indicates retrieval results should include activity information.""" + output_mode: Optional[Union[str, "_models.KnowledgeRetrievalOutputMode"]] = rest_field( + name="outputMode", visibility=["read", "create", "update", "delete", "query"] + ) + """The output configuration for this retrieval. Known values are: \"extractiveData\" and + \"answerSynthesis\".""" knowledge_source_params: Optional[list["_models.KnowledgeSourceParams"]] = rest_field( name="knowledgeSourceParams", visibility=["read", "create", "update", "delete", "query"] ) @@ -835,10 +1588,15 @@ class KnowledgeBaseRetrievalRequest(_Model): def __init__( self, *, + messages: Optional[list["_models.KnowledgeBaseMessage"]] = None, intents: Optional[list["_models.KnowledgeRetrievalIntent"]] = None, max_runtime_in_seconds: Optional[int] = None, + max_output_size: Optional[int] = None, + max_output_documents: Optional[int] = None, max_output_size_in_tokens: Optional[int] = None, + retrieval_reasoning_effort: Optional["_models.KnowledgeRetrievalReasoningEffort"] = None, include_activity: Optional[bool] = None, + output_mode: Optional[Union[str, "_models.KnowledgeRetrievalOutputMode"]] = None, knowledge_source_params: Optional[list["_models.KnowledgeSourceParams"]] = None, ) -> None: ... @@ -863,6 +1621,10 @@ class KnowledgeBaseRetrievalResponse(_Model): list[~azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecord] :ivar references: The references for the retrieval data used in the response. :vartype references: list[~azure.search.documents.knowledgebases.models.KnowledgeBaseReference] + :ivar response_sensitivity_label_info: The sensitivity label information for the overall + response. + :vartype response_sensitivity_label_info: + ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo """ response: Optional[list["_models.KnowledgeBaseMessage"]] = rest_field( @@ -877,6 +1639,10 @@ class KnowledgeBaseRetrievalResponse(_Model): visibility=["read", "create", "update", "delete", "query"] ) """The references for the retrieval data used in the response.""" + response_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = rest_field( + name="responseSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The sensitivity label information for the overall response.""" @overload def __init__( @@ -885,6 +1651,7 @@ def __init__( response: Optional[list["_models.KnowledgeBaseMessage"]] = None, activity: Optional[list["_models.KnowledgeBaseActivityRecord"]] = None, references: Optional[list["_models.KnowledgeBaseReference"]] = None, + response_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = None, ) -> None: ... @overload @@ -913,12 +1680,19 @@ class KnowledgeBaseSearchIndexReference(KnowledgeBaseReference, discriminator="s :vartype type: str or ~azure.search.documents.knowledgebases.models.SEARCH_INDEX :ivar doc_key: The document key for the reference. :vartype doc_key: str + :ivar search_sensitivity_label_info: The sensitivity label information for the reference. + :vartype search_sensitivity_label_info: + ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo """ type: Literal[KnowledgeBaseReferenceType.SEARCH_INDEX] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The discriminator value. Required. Search index document reference.""" doc_key: Optional[str] = rest_field(name="docKey", visibility=["read", "create", "update", "delete", "query"]) """The document key for the reference.""" + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = rest_field( + name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """The sensitivity label information for the reference.""" @overload def __init__( @@ -929,6 +1703,7 @@ def __init__( source_data: Optional[dict[str, Any]] = None, reranker_score: Optional[float] = None, doc_key: Optional[str] = None, + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = None, ) -> None: ... @overload @@ -993,6 +1768,53 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.WEB # type: ignore +class KnowledgeBaseWorkIQReference(KnowledgeBaseReference, discriminator="workIQ"): + """Represents a WorkIQ document reference. + + :ivar id: The ID of the reference. Required. + :vartype id: str + :ivar activity_source: The source activity ID for the reference. Required. + :vartype activity_source: int + :ivar source_data: The source data for the reference. + :vartype source_data: dict[str, any] + :ivar reranker_score: The reranker score for the document reference. + :vartype reranker_score: float + :ivar type: The discriminator value. Required. Work IQ document reference. + :vartype type: str or ~azure.search.documents.knowledgebases.models.WORK_IQ + :ivar attributions: The attributions for the reference. + :vartype attributions: list[~azure.search.documents.knowledgebases.models.WorkIQAttribution] + """ + + type: Literal[KnowledgeBaseReferenceType.WORK_IQ] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Work IQ document reference.""" + attributions: Optional[list["_models.WorkIQAttribution"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The attributions for the reference.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + activity_source: int, + source_data: Optional[dict[str, Any]] = None, + reranker_score: Optional[float] = None, + attributions: Optional[list["_models.WorkIQAttribution"]] = 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) + self.type = KnowledgeBaseReferenceType.WORK_IQ # type: ignore + + class KnowledgeRetrievalIntent(_Model): """An intended query to execute without model query planning. @@ -1030,16 +1852,18 @@ class KnowledgeRetrievalReasoningEffort(_Model): """Base type for reasoning effort. You probably want to use the sub-classes and not this class directly. Known sub-classes are: + KnowledgeRetrievalLowReasoningEffort, KnowledgeRetrievalMediumReasoningEffort, KnowledgeRetrievalMinimalReasoningEffort - :ivar kind: The kind of reasoning effort. Required. "minimal" + :ivar kind: The kind of reasoning effort. Required. Known values are: "minimal", "low", and + "medium". :vartype kind: str or ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalReasoningEffortKind """ __mapping__: dict[str, _Model] = {} kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """The kind of reasoning effort. Required. \"minimal\"""" + """The kind of reasoning effort. Required. Known values are: \"minimal\", \"low\", and \"medium\".""" @overload def __init__( @@ -1059,6 +1883,61 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class KnowledgeRetrievalLowReasoningEffort(KnowledgeRetrievalReasoningEffort, discriminator="low"): + """Run knowledge retrieval with low reasoning effort. + + :ivar kind: The discriminator value. Required. Use low reasoning during retrieval. + :vartype kind: str or ~azure.search.documents.knowledgebases.models.LOW + """ + + kind: Literal[KnowledgeRetrievalReasoningEffortKind.LOW] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Use low reasoning during retrieval.""" + + @overload + def __init__( + self, + ) -> 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) + self.kind = KnowledgeRetrievalReasoningEffortKind.LOW # type: ignore + + +class KnowledgeRetrievalMediumReasoningEffort(KnowledgeRetrievalReasoningEffort, discriminator="medium"): + """Run knowledge retrieval with medium reasoning effort. + + :ivar kind: The discriminator value. Required. Use a moderate amount of reasoning during + retrieval. + :vartype kind: str or ~azure.search.documents.knowledgebases.models.MEDIUM + """ + + kind: Literal[KnowledgeRetrievalReasoningEffortKind.MEDIUM] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Use a moderate amount of reasoning during retrieval.""" + + @overload + def __init__( + self, + ) -> 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) + self.kind = KnowledgeRetrievalReasoningEffortKind.MEDIUM # type: ignore + + class KnowledgeRetrievalMinimalReasoningEffort(KnowledgeRetrievalReasoningEffort, discriminator="minimal"): """Run knowledge retrieval with minimal reasoning effort. @@ -1212,12 +2091,21 @@ class KnowledgeSourceIngestionParameters(_Model): :vartype disable_image_verbalization: bool :ivar ingestion_schedule: Optional schedule for data ingestion. :vartype ingestion_schedule: ~azure.search.documents.indexes.models.IndexingSchedule + :ivar ingestion_permission_options: Optional list of permission types to ingest together with + document content. If specified, it will set the indexer permission options for the data source. + :vartype ingestion_permission_options: list[str or + ~azure.search.documents.indexes.models.KnowledgeSourceIngestionPermissionOption] :ivar content_extraction_mode: Optional content extraction mode. Default is 'minimal'. Known values are: "minimal" and "standard". :vartype content_extraction_mode: str or ~azure.search.documents.indexes.models.KnowledgeSourceContentExtractionMode :ivar ai_services: Optional AI Services configuration for content processing. :vartype ai_services: ~azure.search.documents.knowledgebases.models.AIServices + :ivar asset_store: Optional asset store configuration for storing extracted assets such as + images. + :vartype asset_store: ~azure.search.documents.knowledgebases.models.AssetStore + :ivar freshness_policy: Optional freshness policy for biasing retrieval toward newer documents. + :vartype freshness_policy: ~azure.search.documents.knowledgebases.models.FreshnessPolicy """ identity: Optional["_indexes_models3.SearchIndexerDataIdentity"] = rest_field( @@ -1240,6 +2128,11 @@ class KnowledgeSourceIngestionParameters(_Model): name="ingestionSchedule", visibility=["read", "create", "update", "delete", "query"] ) """Optional schedule for data ingestion.""" + ingestion_permission_options: Optional[ + list[Union[str, "_indexes_models3.KnowledgeSourceIngestionPermissionOption"]] + ] = rest_field(name="ingestionPermissionOptions", visibility=["read", "create", "update", "delete", "query"]) + """Optional list of permission types to ingest together with document content. If specified, it + will set the indexer permission options for the data source.""" content_extraction_mode: Optional[Union[str, "_indexes_models3.KnowledgeSourceContentExtractionMode"]] = rest_field( name="contentExtractionMode", visibility=["read", "create", "update", "delete", "query"] ) @@ -1249,6 +2142,14 @@ class KnowledgeSourceIngestionParameters(_Model): name="aiServices", visibility=["read", "create", "update", "delete", "query"] ) """Optional AI Services configuration for content processing.""" + asset_store: Optional["_models.AssetStore"] = rest_field( + name="assetStore", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional asset store configuration for storing extracted assets such as images.""" + freshness_policy: Optional["_models.FreshnessPolicy"] = rest_field( + name="freshnessPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional freshness policy for biasing retrieval toward newer documents.""" @overload def __init__( @@ -1259,8 +2160,13 @@ def __init__( chat_completion_model: Optional["_indexes_models3.KnowledgeBaseModel"] = None, disable_image_verbalization: Optional[bool] = None, ingestion_schedule: Optional["_indexes_models3.IndexingSchedule"] = None, + ingestion_permission_options: Optional[ + list[Union[str, "_indexes_models3.KnowledgeSourceIngestionPermissionOption"]] + ] = None, content_extraction_mode: Optional[Union[str, "_indexes_models3.KnowledgeSourceContentExtractionMode"]] = None, ai_services: Optional["_models.AIServices"] = None, + asset_store: Optional["_models.AssetStore"] = None, + freshness_policy: Optional["_models.FreshnessPolicy"] = None, ) -> None: ... @overload @@ -1324,7 +2230,9 @@ class KnowledgeSourceStatus(_Model): """Represents the status and synchronization history of a knowledge source. :ivar kind: Identifies the Knowledge Source kind directly from the Status response. Known - values are: "searchIndex", "azureBlob", "indexedOneLake", and "web". + values are: "searchIndex", "azureBlob", "indexedSharePoint", "indexedOneLake", "indexedSql", + "web", "remoteSharePoint", "workIQ", "file", "mcpServer", "fabricDataAgent", and + "fabricOntology". :vartype kind: str or ~azure.search.documents.indexes.models.KnowledgeSourceKind :ivar synchronization_status: The current synchronization status. Required. Known values are: "creating", "active", and "deleting". @@ -1350,7 +2258,9 @@ class KnowledgeSourceStatus(_Model): visibility=["read", "create", "update", "delete", "query"] ) """Identifies the Knowledge Source kind directly from the Status response. Known values are: - \"searchIndex\", \"azureBlob\", \"indexedOneLake\", and \"web\".""" + \"searchIndex\", \"azureBlob\", \"indexedSharePoint\", \"indexedOneLake\", \"indexedSql\", + \"web\", \"remoteSharePoint\", \"workIQ\", \"file\", \"mcpServer\", \"fabricDataAgent\", and + \"fabricOntology\".""" synchronization_status: Union[str, "_indexes_models3.KnowledgeSourceSynchronizationStatus"] = rest_field( name="synchronizationStatus", visibility=["read", "create", "update", "delete", "query"] ) @@ -1455,6 +2365,137 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class PurviewSensitivityLabelInfo(_Model): + """Information about the sensitivity label applied to a document. + + :ivar display_name: The display name for the sensitivity label. + :vartype display_name: str + :ivar sensitivity_label_id: The ID of the sensitivity label. + :vartype sensitivity_label_id: str + :ivar tool_tip: The tooltip that should be displayed for the label in a UI. + :vartype tool_tip: str + :ivar priority: The priority in which the sensitivity label is applied. + :vartype priority: int + :ivar color: The color that the UI should display for the label, if configured. + :vartype color: str + :ivar is_encrypted: Indicates whether the sensitivity label enforces encryption. + :vartype is_encrypted: bool + """ + + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """The display name for the sensitivity label.""" + sensitivity_label_id: Optional[str] = rest_field( + name="sensitivityLabelId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ID of the sensitivity label.""" + tool_tip: Optional[str] = rest_field(name="toolTip", visibility=["read", "create", "update", "delete", "query"]) + """The tooltip that should be displayed for the label in a UI.""" + priority: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The priority in which the sensitivity label is applied.""" + color: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The color that the UI should display for the label, if configured.""" + is_encrypted: Optional[bool] = rest_field( + name="isEncrypted", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the sensitivity label enforces encryption.""" + + @overload + def __init__( + self, + *, + display_name: Optional[str] = None, + sensitivity_label_id: Optional[str] = None, + tool_tip: Optional[str] = None, + priority: Optional[int] = None, + color: Optional[str] = None, + is_encrypted: Optional[bool] = 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 RemoteSharePointKnowledgeSourceParams(KnowledgeSourceParams, discriminator="remoteSharePoint"): + """Specifies runtime parameters for a remote SharePoint knowledge source. + + :ivar knowledge_source_name: The name of the index the params apply to. Required. + :vartype knowledge_source_name: str + :ivar include_references: Indicates whether references should be included for data retrieved + from this source. + :vartype include_references: bool + :ivar include_reference_source_data: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool + :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool + :ivar kind: The discriminator value. Required. A knowledge source that reads data from remote + SharePoint. + :vartype kind: str or ~azure.search.documents.indexes.models.REMOTE_SHARE_POINT + :ivar filter_expression_add_on: A filter condition applied to the SharePoint data source. It + must be specified in the Keyword Query Language syntax. It will be combined as a conjunction + with the filter expression specified in the knowledge source definition. + :vartype filter_expression_add_on: str + """ + + kind: Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. A knowledge source that reads data from remote SharePoint.""" + filter_expression_add_on: Optional[str] = rest_field( + name="filterExpressionAddOn", visibility=["read", "create", "update", "delete", "query"] + ) + """A filter condition applied to the SharePoint data source. It must be specified in the Keyword + Query Language syntax. It will be combined as a conjunction with the filter expression + specified in the knowledge source definition.""" + + @overload + def __init__( + self, + *, + knowledge_source_name: str, + include_references: Optional[bool] = None, + include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, + reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = None, + filter_expression_add_on: Optional[str] = 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) + self.kind = KnowledgeSourceKind.REMOTE_SHARE_POINT # type: ignore + + class SearchIndexKnowledgeSourceParams(KnowledgeSourceParams, discriminator="searchIndex"): """Specifies runtime parameters for a search index knowledge source. @@ -1466,9 +2507,22 @@ class SearchIndexKnowledgeSourceParams(KnowledgeSourceParams, discriminator="sea :ivar include_reference_source_data: Indicates whether references should include the structured data obtained during retrieval in their payload. :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be included in the response. :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool :ivar kind: The discriminator value. Required. A knowledge source that reads data from a Search Index. :vartype kind: str or ~azure.search.documents.indexes.models.SEARCH_INDEX @@ -1490,7 +2544,11 @@ def __init__( knowledge_source_name: str, include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = None, filter_add_on: Optional[str] = None, ) -> None: ... @@ -1578,9 +2636,22 @@ class WebKnowledgeSourceParams(KnowledgeSourceParams, discriminator="web"): :ivar include_reference_source_data: Indicates whether references should include the structured data obtained during retrieval in their payload. :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be included in the response. :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool :ivar kind: The discriminator value. Required. A knowledge source that reads data from the web. :vartype kind: str or ~azure.search.documents.indexes.models.WEB :ivar language: The language of the web results. @@ -1611,7 +2682,11 @@ def __init__( knowledge_source_name: str, include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = None, language: Optional[str] = None, market: Optional[str] = None, count: Optional[int] = None, @@ -1628,3 +2703,93 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.kind = KnowledgeSourceKind.WEB # type: ignore + + +class WorkIQAttribution(_Model): + """Attribution information for a WorkIQ reference. + + :ivar see_more_web_url: The URL for the attribution. + :vartype see_more_web_url: str + """ + + see_more_web_url: Optional[str] = rest_field( + name="seeMoreWebUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """The URL for the attribution.""" + + @overload + def __init__( + self, + *, + see_more_web_url: Optional[str] = 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 WorkIQKnowledgeSourceParams(KnowledgeSourceParams, discriminator="workIQ"): + """Specifies runtime parameters for a WorkIQ knowledge source. + + :ivar knowledge_source_name: The name of the index the params apply to. Required. + :vartype knowledge_source_name: str + :ivar include_references: Indicates whether references should be included for data retrieved + from this source. + :vartype include_references: bool + :ivar include_reference_source_data: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype include_reference_source_data: bool + :ivar always_query_source: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype always_query_source: bool + :ivar fail_on_error: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype fail_on_error: bool + :ivar reranker_threshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype reranker_threshold: float + :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge + source. + :vartype max_output_documents: int + :ivar enable_image_serving: Indicates whether image serving should be enabled for this + knowledge source at retrieval time. When true, images extracted during ingestion are delivered + to downstream models. + :vartype enable_image_serving: bool + :ivar kind: The discriminator value. Required. A knowledge source that reads data from work IQ. + :vartype kind: str or ~azure.search.documents.indexes.models.WORK_IQ + """ + + kind: Literal[KnowledgeSourceKind.WORK_IQ] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. A knowledge source that reads data from work IQ.""" + + @overload + def __init__( + self, + *, + knowledge_source_name: str, + include_references: Optional[bool] = None, + include_reference_source_data: Optional[bool] = None, + always_query_source: Optional[bool] = None, + fail_on_error: Optional[bool] = None, + reranker_threshold: Optional[float] = None, + max_output_documents: Optional[int] = None, + enable_image_serving: Optional[bool] = 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) + self.kind = KnowledgeSourceKind.WORK_IQ # type: ignore 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 3445685e3c69..cdd0632ef1bf 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 @@ -26,12 +26,19 @@ LookupDocument, QueryAnswerResult, QueryCaptionResult, + QueryResultDocumentInnerHit, + QueryResultDocumentRerankerInput, + QueryResultDocumentSemanticField, QueryResultDocumentSubscores, SearchResult, + SearchScoreThreshold, + SemanticDebugInfo, SingleVectorFieldResult, SuggestResult, TextResult, VectorQuery, + VectorSimilarityThreshold, + VectorThreshold, VectorizableImageBinaryQuery, VectorizableImageUrlQuery, VectorizableTextQuery, @@ -45,14 +52,17 @@ QueryAnswerType, QueryCaptionType, QueryDebugMode, + QueryRewritesType, QueryType, ScoringStatistics, SearchMode, SemanticErrorMode, SemanticErrorReason, + SemanticFieldState, SemanticSearchResultsType, VectorFilterMode, VectorQueryKind, + VectorThresholdKind, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -71,12 +81,19 @@ "LookupDocument", "QueryAnswerResult", "QueryCaptionResult", + "QueryResultDocumentInnerHit", + "QueryResultDocumentRerankerInput", + "QueryResultDocumentSemanticField", "QueryResultDocumentSubscores", "SearchResult", + "SearchScoreThreshold", + "SemanticDebugInfo", "SingleVectorFieldResult", "SuggestResult", "TextResult", "VectorQuery", + "VectorSimilarityThreshold", + "VectorThreshold", "VectorizableImageBinaryQuery", "VectorizableImageUrlQuery", "VectorizableTextQuery", @@ -87,14 +104,17 @@ "QueryAnswerType", "QueryCaptionType", "QueryDebugMode", + "QueryRewritesType", "QueryType", "ScoringStatistics", "SearchMode", "SemanticErrorMode", "SemanticErrorReason", + "SemanticFieldState", "SemanticSearchResultsType", "VectorFilterMode", "VectorQueryKind", + "VectorThresholdKind", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 b28ea43a2725..6aa2bc79fcae 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 @@ -28,6 +28,21 @@ class AutocompleteMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): terms could include 'washington medicaid' and 'washington medical'.""" +class HybridCountAndFacetMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Determines whether the count and facets should includes all documents that matched the search + query, or only the documents that are retrieved within the 'maxTextRecallSize' window. The + default value is 'countAllResults'. + """ + + COUNT_RETRIEVABLE_RESULTS = "countRetrievableResults" + """Only include documents that were matched within the 'maxTextRecallSize' retrieval window when + computing 'count' and 'facets'.""" + COUNT_ALL_RESULTS = "countAllResults" + """Include all documents that were matched by the search query when computing 'count' and + 'facets', regardless of whether or not those documents are within the 'maxTextRecallSize' + retrieval window.""" + + class IndexActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation to perform on a document in an indexing batch.""" @@ -105,6 +120,179 @@ class QueryDebugMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Turn on all debug options.""" +class QueryLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The language of the query.""" + + NONE = "none" + """Query language not specified.""" + EN_US = "en-us" + """Query language value for English (United States).""" + EN_GB = "en-gb" + """Query language value for English (Great Britain).""" + EN_IN = "en-in" + """Query language value for English (India).""" + EN_CA = "en-ca" + """Query language value for English (Canada).""" + EN_AU = "en-au" + """Query language value for English (Australia).""" + FR_FR = "fr-fr" + """Query language value for French (France).""" + FR_CA = "fr-ca" + """Query language value for French (Canada).""" + DE_DE = "de-de" + """Query language value for German (Germany).""" + ES_ES = "es-es" + """Query language value for Spanish (Spain).""" + ES_MX = "es-mx" + """Query language value for Spanish (Mexico).""" + ZH_CN = "zh-cn" + """Query language value for Chinese (China).""" + ZH_TW = "zh-tw" + """Query language value for Chinese (Taiwan).""" + PT_BR = "pt-br" + """Query language value for Portuguese (Brazil).""" + PT_PT = "pt-pt" + """Query language value for Portuguese (Portugal).""" + IT_IT = "it-it" + """Query language value for Italian (Italy).""" + JA_JP = "ja-jp" + """Query language value for Japanese (Japan).""" + KO_KR = "ko-kr" + """Query language value for Korean (Korea).""" + RU_RU = "ru-ru" + """Query language value for Russian (Russia).""" + CS_CZ = "cs-cz" + """Query language value for Czech (Czech Republic).""" + NL_BE = "nl-be" + """Query language value for Dutch (Belgium).""" + NL_NL = "nl-nl" + """Query language value for Dutch (Netherlands).""" + HU_HU = "hu-hu" + """Query language value for Hungarian (Hungary).""" + PL_PL = "pl-pl" + """Query language value for Polish (Poland).""" + SV_SE = "sv-se" + """Query language value for Swedish (Sweden).""" + TR_TR = "tr-tr" + """Query language value for Turkish (Turkey).""" + HI_IN = "hi-in" + """Query language value for Hindi (India).""" + AR_SA = "ar-sa" + """Query language value for Arabic (Saudi Arabia).""" + AR_EG = "ar-eg" + """Query language value for Arabic (Egypt).""" + AR_MA = "ar-ma" + """Query language value for Arabic (Morocco).""" + AR_KW = "ar-kw" + """Query language value for Arabic (Kuwait).""" + AR_JO = "ar-jo" + """Query language value for Arabic (Jordan).""" + DA_DK = "da-dk" + """Query language value for Danish (Denmark).""" + NO_NO = "no-no" + """Query language value for Norwegian (Norway).""" + BG_BG = "bg-bg" + """Query language value for Bulgarian (Bulgaria).""" + HR_HR = "hr-hr" + """Query language value for Croatian (Croatia).""" + HR_BA = "hr-ba" + """Query language value for Croatian (Bosnia and Herzegovina).""" + MS_MY = "ms-my" + """Query language value for Malay (Malaysia).""" + MS_BN = "ms-bn" + """Query language value for Malay (Brunei Darussalam).""" + SL_SL = "sl-sl" + """Query language value for Slovenian (Slovenia).""" + TA_IN = "ta-in" + """Query language value for Tamil (India).""" + VI_VN = "vi-vn" + """Query language value for Vietnamese (Viet Nam).""" + EL_GR = "el-gr" + """Query language value for Greek (Greece).""" + RO_RO = "ro-ro" + """Query language value for Romanian (Romania).""" + IS_IS = "is-is" + """Query language value for Icelandic (Iceland).""" + ID_ID = "id-id" + """Query language value for Indonesian (Indonesia).""" + TH_TH = "th-th" + """Query language value for Thai (Thailand).""" + LT_LT = "lt-lt" + """Query language value for Lithuanian (Lithuania).""" + UK_UA = "uk-ua" + """Query language value for Ukrainian (Ukraine).""" + LV_LV = "lv-lv" + """Query language value for Latvian (Latvia).""" + ET_EE = "et-ee" + """Query language value for Estonian (Estonia).""" + CA_ES = "ca-es" + """Query language value for Catalan.""" + FI_FI = "fi-fi" + """Query language value for Finnish (Finland).""" + SR_BA = "sr-ba" + """Query language value for Serbian (Bosnia and Herzegovina).""" + SR_ME = "sr-me" + """Query language value for Serbian (Montenegro).""" + SR_RS = "sr-rs" + """Query language value for Serbian (Serbia).""" + SK_SK = "sk-sk" + """Query language value for Slovak (Slovakia).""" + NB_NO = "nb-no" + """Query language value for Norwegian (Norway).""" + HY_AM = "hy-am" + """Query language value for Armenian (Armenia).""" + BN_IN = "bn-in" + """Query language value for Bengali (India).""" + EU_ES = "eu-es" + """Query language value for Basque.""" + GL_ES = "gl-es" + """Query language value for Galician.""" + GU_IN = "gu-in" + """Query language value for Gujarati (India).""" + HE_IL = "he-il" + """Query language value for Hebrew (Israel).""" + GA_IE = "ga-ie" + """Query language value for Irish (Ireland).""" + KN_IN = "kn-in" + """Query language value for Kannada (India).""" + ML_IN = "ml-in" + """Query language value for Malayalam (India).""" + MR_IN = "mr-in" + """Query language value for Marathi (India).""" + FA_AE = "fa-ae" + """Query language value for Persian (U.A.E.).""" + PA_IN = "pa-in" + """Query language value for Punjabi (India).""" + TE_IN = "te-in" + """Query language value for Telugu (India).""" + UR_PK = "ur-pk" + """Query language value for Urdu (Pakistan).""" + + +class QueryRewritesType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This parameter is only valid if the query type is ``semantic``. When QueryRewrites is set to + ``generative``, the query terms are sent to a generate model which will produce 10 (default) + rewrites to help increase the recall of the request. The requested count can be configured by + appending the pipe character ``|`` followed by the ``count-`` option, such + as ``generative|count-3``. Defaults to ``None``. + """ + + NONE = "none" + """Do not generate additional query rewrites for this query.""" + GENERATIVE = "generative" + """Generate alternative query terms to increase the recall of a search request.""" + + +class QuerySpellerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Improve search recall by spell-correcting individual search query terms.""" + + NONE = "none" + """Speller not enabled.""" + LEXICON = "lexicon" + """Speller corrects individual query terms using a static lexicon for the language specified by + the queryLanguage parameter.""" + + class QueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the syntax of the search query. The default is 'simple'. Use 'full' if your query uses the Lucene query syntax and 'semantic' if query syntax is not needed. @@ -173,6 +361,25 @@ class SemanticErrorReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """At least one step of the semantic process failed.""" +class SemanticFieldState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The way the field was used for the semantic enrichment process.""" + + USED = "used" + """The field was fully used for semantic enrichment.""" + UNUSED = "unused" + """The field was not used for semantic enrichment.""" + PARTIAL = "partial" + """The field was partially used for semantic enrichment.""" + + +class SemanticQueryRewritesResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of query rewrite that was used for this request.""" + + ORIGINAL_QUERY_ONLY = "originalQueryOnly" + """Query rewrites were not successfully generated for this request. Only the original query was + used to retrieve the results.""" + + class SemanticSearchResultsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of partial response that was returned for a semantic ranking request.""" @@ -209,3 +416,17 @@ class VectorQueryKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): IMAGE_BINARY = "imageBinary" """Vector query where a base 64 encoded binary of an image that needs to be vectorized is provided.""" + + +class VectorThresholdKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of threshold used to filter vector queries.""" + + VECTOR_SIMILARITY = "vectorSimilarity" + """The results of the vector query will be filtered based on the vector similarity metric. Note + this is the canonical definition of similarity metric, not the 'distance' version. The + threshold direction (larger or smaller) will be chosen automatically according to the metric + used by the field.""" + SEARCH_SCORE = "searchScore" + """The results of the vector query will filter based on the '@search.score' value. Note this is + the @search.score returned as part of the search response. The threshold direction will be + chosen for higher @search.score.""" 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 e41c0387b65c..6e23ea09d117 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 @@ -11,7 +11,7 @@ from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload from .._utils.model_base import Model as _Model, rest_discriminator, rest_field -from ._enums import VectorQueryKind +from ._enums import VectorQueryKind, VectorThresholdKind if TYPE_CHECKING: from .. import models as _models @@ -50,18 +50,40 @@ class AutocompleteResult(_Model): class DebugInfo(_Model): - """Contains debugging information that can be used to further explore your search results.""" + """Contains debugging information that can be used to further explore your search results. + + :ivar query_rewrites: Contains debugging information specific to query rewrites. + :vartype query_rewrites: ~azure.search.documents.models._models.QueryRewritesDebugInfo + """ + + query_rewrites: Optional["_models._models.QueryRewritesDebugInfo"] = rest_field( + name="queryRewrites", visibility=["read"] + ) + """Contains debugging information specific to query rewrites.""" class DocumentDebugInfo(_Model): """Contains debugging information that can be used to further explore your search results. + :ivar semantic: Contains debugging information specific to semantic ranking requests. + :vartype semantic: ~azure.search.documents.models.SemanticDebugInfo :ivar vectors: Contains debugging information specific to vector and hybrid search. :vartype vectors: ~azure.search.documents.models.VectorsDebugInfo + :ivar inner_hits: Contains debugging information specific to vectors matched within a + collection of complex types. + :vartype inner_hits: dict[str, + list[~azure.search.documents.models.QueryResultDocumentInnerHit]] """ + semantic: Optional["_models.SemanticDebugInfo"] = rest_field(visibility=["read"]) + """Contains debugging information specific to semantic ranking requests.""" vectors: Optional["_models.VectorsDebugInfo"] = rest_field(visibility=["read"]) """Contains debugging information specific to vector and hybrid search.""" + inner_hits: Optional[dict[str, list["_models.QueryResultDocumentInnerHit"]]] = rest_field( + name="innerHits", visibility=["read"] + ) + """Contains debugging information specific to vectors matched within a collection of complex + types.""" class ErrorAdditionalInfo(_Model): @@ -144,10 +166,89 @@ class FacetResult(_Model): :ivar count: The approximate count of documents falling within the bucket described by this facet. :vartype count: int + :ivar avg: The resulting total avg for the facet when a avg metric is requested. + :vartype avg: float + :ivar min: The resulting total min for the facet when a min metric is requested. + :vartype min: float + :ivar max: The resulting total max for the facet when a max metric is requested. + :vartype max: float + :ivar sum: The resulting total sum for the facet when a sum metric is requested. + :vartype sum: float + :ivar cardinality: The resulting total cardinality for the facet when a cardinality metric is + requested. + :vartype cardinality: int + :ivar facets: The nested facet query results for the search operation, organized as a + collection of buckets for each faceted field; null if the query did not contain any nested + facets. + :vartype facets: dict[str, list[~azure.search.documents.models.FacetResult]] """ count: Optional[int] = rest_field(visibility=["read"]) """The approximate count of documents falling within the bucket described by this facet.""" + avg: Optional[float] = rest_field(visibility=["read"]) + """The resulting total avg for the facet when a avg metric is requested.""" + min: Optional[float] = rest_field(visibility=["read"]) + """The resulting total min for the facet when a min metric is requested.""" + max: Optional[float] = rest_field(visibility=["read"]) + """The resulting total max for the facet when a max metric is requested.""" + sum: Optional[float] = rest_field(visibility=["read"]) + """The resulting total sum for the facet when a sum metric is requested.""" + cardinality: Optional[int] = rest_field(visibility=["read"]) + """The resulting total cardinality for the facet when a cardinality metric is requested.""" + facets: Optional[dict[str, list["_models.FacetResult"]]] = rest_field(name="@search.facets", visibility=["read"]) + """The nested facet query results for the search operation, organized as a collection of buckets + for each faceted field; null if the query did not contain any nested facets.""" + + +class HybridSearch(_Model): + """The query parameters to configure hybrid search behaviors. + + :ivar max_text_recall_size: Determines the maximum number of documents to be retrieved by the + text query portion of a hybrid search request. Those documents will be combined with the + documents matching the vector queries to produce a single final list of results. Choosing a + larger maxTextRecallSize value will allow retrieving and paging through more documents (using + the top and skip parameters), at the cost of higher resource utilization and higher latency. + The value needs to be between 1 and 10,000. Default is 1000. + :vartype max_text_recall_size: int + :ivar count_and_facet_mode: Determines whether the count and facets should includes all + documents that matched the search query, or only the documents that are retrieved within the + 'maxTextRecallSize' window. Known values are: "countRetrievableResults" and "countAllResults". + :vartype count_and_facet_mode: str or ~azure.search.documents.models.HybridCountAndFacetMode + """ + + max_text_recall_size: Optional[int] = rest_field( + name="maxTextRecallSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines the maximum number of documents to be retrieved by the text query portion of a + hybrid search request. Those documents will be combined with the documents matching the vector + queries to produce a single final list of results. Choosing a larger maxTextRecallSize value + will allow retrieving and paging through more documents (using the top and skip parameters), at + the cost of higher resource utilization and higher latency. The value needs to be between 1 and + 10,000. Default is 1000.""" + count_and_facet_mode: Optional[Union[str, "_models._enums.HybridCountAndFacetMode"]] = rest_field( + name="countAndFacetMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines whether the count and facets should includes all documents that matched the search + query, or only the documents that are retrieved within the 'maxTextRecallSize' window. Known + values are: \"countRetrievableResults\" and \"countAllResults\".""" + + @overload + def __init__( + self, + *, + max_text_recall_size: Optional[int] = None, + count_and_facet_mode: Optional[Union[str, "_models._enums.HybridCountAndFacetMode"]] = 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 IndexAction(_Model): @@ -309,6 +410,64 @@ class QueryCaptionResult(_Model): """Same text passage as in the Text property with highlighted phrases most relevant to the query.""" +class QueryResultDocumentInnerHit(_Model): + """Detailed scoring information for an individual element of a complex collection. + + :ivar ordinal: Position of this specific matching element within it's original collection. + Position starts at 0. + :vartype ordinal: int + :ivar vectors: Detailed scoring information for an individual element of a complex collection + that matched a vector query. + :vartype vectors: list[dict[str, ~azure.search.documents.models.SingleVectorFieldResult]] + """ + + ordinal: Optional[int] = rest_field(visibility=["read"]) + """Position of this specific matching element within it's original collection. Position starts at + 0.""" + vectors: Optional[list[dict[str, "_models.SingleVectorFieldResult"]]] = rest_field(visibility=["read"]) + """Detailed scoring information for an individual element of a complex collection that matched a + vector query.""" + + +class QueryResultDocumentRerankerInput(_Model): + """The raw concatenated strings that were sent to the semantic enrichment process. + + :ivar title: The raw string for the title field that was used for semantic enrichment. + :vartype title: str + :ivar content: The raw concatenated strings for the content fields that were used for semantic + enrichment. + :vartype content: str + :ivar keywords: The raw concatenated strings for the keyword fields that were used for semantic + enrichment. + :vartype keywords: str + """ + + title: Optional[str] = rest_field(visibility=["read"]) + """The raw string for the title field that was used for semantic enrichment.""" + content: Optional[str] = rest_field(visibility=["read"]) + """The raw concatenated strings for the content fields that were used for semantic enrichment.""" + keywords: Optional[str] = rest_field(visibility=["read"]) + """The raw concatenated strings for the keyword fields that were used for semantic enrichment.""" + + +class QueryResultDocumentSemanticField(_Model): + """Description of fields that were sent to the semantic enrichment process, as well as how they + were used. + + :ivar name: The name of the field that was sent to the semantic enrichment process. + :vartype name: str + :ivar state: The way the field was used for the semantic enrichment process (fully used, + partially used, or unused). Known values are: "used", "unused", and "partial". + :vartype state: str or ~azure.search.documents.models.SemanticFieldState + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the field that was sent to the semantic enrichment process.""" + state: Optional[Union[str, "_models.SemanticFieldState"]] = rest_field(visibility=["read"]) + """The way the field was used for the semantic enrichment process (fully used, partially used, or + unused). Known values are: \"used\", \"unused\", and \"partial\".""" + + class QueryResultDocumentSubscores(_Model): """The breakdown of subscores between the text and vector query components of the search query for this document. Each vector query is shown as a separate object in the same order they were @@ -330,6 +489,38 @@ class QueryResultDocumentSubscores(_Model): """The BM25 or Classic score for the text portion of the query.""" +class QueryRewritesDebugInfo(_Model): + """Contains debugging information specific to query rewrites. + + :ivar text: List of query rewrites generated for the text query. + :vartype text: ~azure.search.documents.models._models.QueryRewritesValuesDebugInfo + :ivar vectors: List of query rewrites generated for the vectorizable text queries. + :vartype vectors: list[~azure.search.documents.models._models.QueryRewritesValuesDebugInfo] + """ + + text: Optional["_models._models.QueryRewritesValuesDebugInfo"] = rest_field(visibility=["read"]) + """List of query rewrites generated for the text query.""" + vectors: Optional[list["_models._models.QueryRewritesValuesDebugInfo"]] = rest_field(visibility=["read"]) + """List of query rewrites generated for the vectorizable text queries.""" + + +class QueryRewritesValuesDebugInfo(_Model): + """Contains debugging information specific to query rewrites. + + :ivar input_query: The input text to the generative query rewriting model. There may be cases + where the user query and the input to the generative model are not identical. + :vartype input_query: str + :ivar rewrites: List of query rewrites. + :vartype rewrites: list[str] + """ + + input_query: Optional[str] = rest_field(name="inputQuery", visibility=["read"]) + """The input text to the generative query rewriting model. There may be cases where the user query + and the input to the generative model are not identical.""" + rewrites: Optional[list[str]] = rest_field(visibility=["read"]) + """List of query rewrites.""" + + class SearchDocumentsResult(_Model): """Response containing search results from an index. @@ -347,6 +538,8 @@ class SearchDocumentsResult(_Model): :ivar answers: The answers query results for the search operation; null if the answers query parameter was not specified or set to 'none'. :vartype answers: list[~azure.search.documents.models.QueryAnswerResult] + :ivar debug_info: Debug information that applies to the search results as a whole. + :vartype debug_info: ~azure.search.documents.models._models.DebugInfo :ivar next_page_parameters: Continuation JSON payload returned when the query can't return all the requested results in a single response. You can use this JSON along with. :vartype next_page_parameters: ~azure.search.documents.models._models.SearchRequest @@ -366,6 +559,10 @@ class SearchDocumentsResult(_Model): ranking request. Known values are: "baseResults" and "rerankedResults". :vartype semantic_partial_response_type: str or ~azure.search.documents.models.SemanticSearchResultsType + :ivar semantic_query_rewrites_result_type: Type of query rewrite that was used to retrieve + documents. "originalQueryOnly" + :vartype semantic_query_rewrites_result_type: str or + ~azure.search.documents.models.SemanticQueryRewritesResultType """ count: Optional[int] = rest_field(name="@odata.count", visibility=["read"]) @@ -382,6 +579,8 @@ class SearchDocumentsResult(_Model): answers: Optional[list["_models.QueryAnswerResult"]] = rest_field(name="@search.answers", visibility=["read"]) """The answers query results for the search operation; null if the answers query parameter was not specified or set to 'none'.""" + debug_info: Optional["_models._models.DebugInfo"] = rest_field(name="@search.debug", visibility=["read"]) + """Debug information that applies to the search results as a whole.""" next_page_parameters: Optional["_models._models.SearchRequest"] = rest_field( name="@search.nextPageParameters", visibility=["read"] ) @@ -404,6 +603,10 @@ class SearchDocumentsResult(_Model): ) """Type of partial response that was returned for a semantic ranking request. Known values are: \"baseResults\" and \"rerankedResults\".""" + semantic_query_rewrites_result_type: Optional[Union[str, "_models._enums.SemanticQueryRewritesResultType"]] = ( + rest_field(name="@search.semanticQueryRewritesResultType", visibility=["read"]) + ) + """Type of query rewrite that was used to retrieve documents. \"originalQueryOnly\"""" class SearchRequest(_Model): @@ -479,6 +682,19 @@ class SearchRequest(_Model): :ivar search_mode: A value that specifies whether any or all of the search terms must be matched in order to count the document as a match. Known values are: "any" and "all". :vartype search_mode: str or ~azure.search.documents.models.SearchMode + :ivar query_language: A value that specifies the language of the search query. Known values + are: "none", "en-us", "en-gb", "en-in", "en-ca", "en-au", "fr-fr", "fr-ca", "de-de", "es-es", + "es-mx", "zh-cn", "zh-tw", "pt-br", "pt-pt", "it-it", "ja-jp", "ko-kr", "ru-ru", "cs-cz", + "nl-be", "nl-nl", "hu-hu", "pl-pl", "sv-se", "tr-tr", "hi-in", "ar-sa", "ar-eg", "ar-ma", + "ar-kw", "ar-jo", "da-dk", "no-no", "bg-bg", "hr-hr", "hr-ba", "ms-my", "ms-bn", "sl-sl", + "ta-in", "vi-vn", "el-gr", "ro-ro", "is-is", "id-id", "th-th", "lt-lt", "uk-ua", "lv-lv", + "et-ee", "ca-es", "fi-fi", "sr-ba", "sr-me", "sr-rs", "sk-sk", "nb-no", "hy-am", "bn-in", + "eu-es", "gl-es", "gu-in", "he-il", "ga-ie", "kn-in", "ml-in", "mr-in", "fa-ae", "pa-in", + "te-in", and "ur-pk". + :vartype query_language: str or ~azure.search.documents.models.QueryLanguage + :ivar query_speller: A value that specifies the type of the speller to use to spell-correct + individual search query terms. Known values are: "none" and "lexicon". + :vartype query_speller: str or ~azure.search.documents.models.QuerySpellerType :ivar select: The comma-separated list of fields to retrieve. If unspecified, all fields marked as retrievable in the schema are included. :vartype select: list[str] @@ -512,12 +728,19 @@ class SearchRequest(_Model): :ivar captions: A value that specifies whether captions should be returned as part of the search response. Known values are: "none" and "extractive". :vartype captions: str or ~azure.search.documents.models.QueryCaptionType + :ivar query_rewrites: A value that specifies whether query rewrites should be generated to + augment the search query. Known values are: "none" and "generative". + :vartype query_rewrites: str or ~azure.search.documents.models.QueryRewritesType + :ivar semantic_fields: The comma-separated list of field names used for semantic ranking. + :vartype semantic_fields: list[str] :ivar vector_queries: The query parameters for vector and hybrid search queries. :vartype vector_queries: list[~azure.search.documents.models.VectorQuery] :ivar vector_filter_mode: Determines whether or not filters are applied before or after the vector search is performed. Default is 'preFilter' for new indexes. Known values are: "postFilter", "preFilter", and "strictPostFilter". :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._models.HybridSearch """ include_total_count: Optional[bool] = rest_field( @@ -612,6 +835,24 @@ class SearchRequest(_Model): ) """A value that specifies whether any or all of the search terms must be matched in order to count the document as a match. Known values are: \"any\" and \"all\".""" + query_language: Optional[Union[str, "_models._enums.QueryLanguage"]] = rest_field( + name="queryLanguage", visibility=["read", "create", "update", "delete", "query"] + ) + """A value that specifies the language of the search query. Known values are: \"none\", \"en-us\", + \"en-gb\", \"en-in\", \"en-ca\", \"en-au\", \"fr-fr\", \"fr-ca\", \"de-de\", \"es-es\", + \"es-mx\", \"zh-cn\", \"zh-tw\", \"pt-br\", \"pt-pt\", \"it-it\", \"ja-jp\", \"ko-kr\", + \"ru-ru\", \"cs-cz\", \"nl-be\", \"nl-nl\", \"hu-hu\", \"pl-pl\", \"sv-se\", \"tr-tr\", + \"hi-in\", \"ar-sa\", \"ar-eg\", \"ar-ma\", \"ar-kw\", \"ar-jo\", \"da-dk\", \"no-no\", + \"bg-bg\", \"hr-hr\", \"hr-ba\", \"ms-my\", \"ms-bn\", \"sl-sl\", \"ta-in\", \"vi-vn\", + \"el-gr\", \"ro-ro\", \"is-is\", \"id-id\", \"th-th\", \"lt-lt\", \"uk-ua\", \"lv-lv\", + \"et-ee\", \"ca-es\", \"fi-fi\", \"sr-ba\", \"sr-me\", \"sr-rs\", \"sk-sk\", \"nb-no\", + \"hy-am\", \"bn-in\", \"eu-es\", \"gl-es\", \"gu-in\", \"he-il\", \"ga-ie\", \"kn-in\", + \"ml-in\", \"mr-in\", \"fa-ae\", \"pa-in\", \"te-in\", and \"ur-pk\".""" + query_speller: Optional[Union[str, "_models._enums.QuerySpellerType"]] = rest_field( + name="speller", visibility=["read", "create", "update", "delete", "query"] + ) + """A value that specifies the type of the speller to use to spell-correct individual search query + terms. Known values are: \"none\" and \"lexicon\".""" select: Optional[list[str]] = rest_field( visibility=["read", "create", "update", "delete", "query"], format="commaDelimited" ) @@ -657,6 +898,15 @@ class SearchRequest(_Model): ) """A value that specifies whether captions should be returned as part of the search response. Known values are: \"none\" and \"extractive\".""" + query_rewrites: Optional[Union[str, "_models.QueryRewritesType"]] = rest_field( + name="queryRewrites", visibility=["read", "create", "update", "delete", "query"] + ) + """A value that specifies whether query rewrites should be generated to augment the search query. + Known values are: \"none\" and \"generative\".""" + semantic_fields: Optional[list[str]] = rest_field( + name="semanticFields", visibility=["read", "create", "update", "delete", "query"], format="commaDelimited" + ) + """The comma-separated list of field names used for semantic ranking.""" vector_queries: Optional[list["_models.VectorQuery"]] = rest_field( name="vectorQueries", visibility=["read", "create", "update", "delete", "query"] ) @@ -667,6 +917,10 @@ class SearchRequest(_Model): """Determines whether or not filters are applied before or after the vector search is performed. Default is 'preFilter' for new indexes. Known values are: \"postFilter\", \"preFilter\", and \"strictPostFilter\".""" + hybrid_search: Optional["_models._models.HybridSearch"] = rest_field( + name="hybridSearch", visibility=["read", "create", "update", "delete", "query"] + ) + """The query parameters to configure hybrid search behaviors.""" @overload def __init__( # pylint: disable=too-many-locals @@ -689,6 +943,8 @@ def __init__( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, "_models.SearchMode"]] = None, + query_language: Optional[Union[str, "_models._enums.QueryLanguage"]] = None, + query_speller: Optional[Union[str, "_models._enums.QuerySpellerType"]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -698,8 +954,11 @@ def __init__( # pylint: disable=too-many-locals semantic_query: Optional[str] = None, answers: Optional[Union[str, "_models.QueryAnswerType"]] = None, captions: Optional[Union[str, "_models.QueryCaptionType"]] = None, + query_rewrites: Optional[Union[str, "_models.QueryRewritesType"]] = None, + semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list["_models.VectorQuery"]] = None, vector_filter_mode: Optional[Union[str, "_models.VectorFilterMode"]] = None, + hybrid_search: Optional["_models._models.HybridSearch"] = None, ) -> None: ... @overload @@ -764,6 +1023,114 @@ class SearchResult(_Model): """Contains debugging information that can be used to further explore your search results.""" +class VectorThreshold(_Model): + """The threshold used for vector queries. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SearchScoreThreshold, VectorSimilarityThreshold + + :ivar kind: Type of threshold. Required. Known values are: "vectorSimilarity" and + "searchScore". + :vartype kind: str or ~azure.search.documents.models.VectorThresholdKind + """ + + __mapping__: dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """Type of threshold. Required. Known values are: \"vectorSimilarity\" and \"searchScore\".""" + + @overload + def __init__( + self, + *, + kind: str, + ) -> 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 SearchScoreThreshold(VectorThreshold, discriminator="searchScore"): + """The results of the vector query will filter based on the '. + + :ivar value: The threshold will filter based on the '. Required. + :vartype value: float + :ivar kind: The kind of threshold used to filter vector queries. Required. The results of the + vector query will filter based on the '@search.score' value. Note this is the @search.score + returned as part of the search response. The threshold direction will be chosen for higher + @search.score. + :vartype kind: str or ~azure.search.documents.models.SEARCH_SCORE + """ + + value: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The threshold will filter based on the '. Required.""" + kind: Literal[VectorThresholdKind.SEARCH_SCORE] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The kind of threshold used to filter vector queries. Required. The results of the vector query + will filter based on the '@search.score' value. Note this is the @search.score returned as part + of the search response. The threshold direction will be chosen for higher @search.score.""" + + @overload + def __init__( + self, + *, + value: float, + ) -> 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) + self.kind = VectorThresholdKind.SEARCH_SCORE # type: ignore + + +class SemanticDebugInfo(_Model): + """Contains debugging information specific to semantic ranking requests. + + :ivar title_field: The title field that was sent to the semantic enrichment process, as well as + how it was used. + :vartype title_field: ~azure.search.documents.models.QueryResultDocumentSemanticField + :ivar content_fields: The content fields that were sent to the semantic enrichment process, as + well as how they were used. + :vartype content_fields: list[~azure.search.documents.models.QueryResultDocumentSemanticField] + :ivar keyword_fields: The keyword fields that were sent to the semantic enrichment process, as + well as how they were used. + :vartype keyword_fields: list[~azure.search.documents.models.QueryResultDocumentSemanticField] + :ivar reranker_input: The raw concatenated strings that were sent to the semantic enrichment + process. + :vartype reranker_input: ~azure.search.documents.models.QueryResultDocumentRerankerInput + """ + + title_field: Optional["_models.QueryResultDocumentSemanticField"] = rest_field( + name="titleField", visibility=["read"] + ) + """The title field that was sent to the semantic enrichment process, as well as how it was used.""" + content_fields: Optional[list["_models.QueryResultDocumentSemanticField"]] = rest_field( + name="contentFields", visibility=["read"] + ) + """The content fields that were sent to the semantic enrichment process, as well as how they were + used.""" + keyword_fields: Optional[list["_models.QueryResultDocumentSemanticField"]] = rest_field( + name="keywordFields", visibility=["read"] + ) + """The keyword fields that were sent to the semantic enrichment process, as well as how they were + used.""" + reranker_input: Optional["_models.QueryResultDocumentRerankerInput"] = rest_field( + name="rerankerInput", visibility=["read"] + ) + """The raw concatenated strings that were sent to the semantic enrichment process.""" + + class SingleVectorFieldResult(_Model): """A single vector field result. Both. @@ -849,6 +1216,18 @@ class VectorQuery(_Model): will be in the final ranking. Default is 1.0 and the value needs to be a positive number larger than zero. :vartype weight: float + :ivar threshold: The threshold used for vector queries. Note this can only be set if all + 'fields' use the same similarity metric. + :vartype threshold: ~azure.search.documents.models.VectorThreshold + :ivar filter_override: The OData filter expression to apply to this specific vector query. If + no filter expression is defined at the vector level, the expression defined in the top level + filter parameter is used instead. + :vartype filter_override: str + :ivar per_document_vector_limit: Controls how many vectors can be matched from each document in + a vector search query. Setting it to 1 ensures at most one vector per document is matched, + guaranteeing results come from distinct documents. Setting it to 0 (unlimited) allows multiple + relevant vectors from the same document to be matched. Default is 0. + :vartype per_document_vector_limit: int :ivar kind: Type of query. Required. Known values are: "vector", "text", "imageUrl", and "imageBinary". :vartype kind: str or ~azure.search.documents.models.VectorQueryKind @@ -876,6 +1255,24 @@ class VectorQuery(_Model): ranking lists produced by the different vector queries and/or the results retrieved through the text query. The higher the weight, the higher the documents that matched that query will be in the final ranking. Default is 1.0 and the value needs to be a positive number larger than zero.""" + threshold: Optional["_models.VectorThreshold"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The threshold used for vector queries. Note this can only be set if all 'fields' use the same + similarity metric.""" + filter_override: Optional[str] = rest_field( + name="filterOverride", visibility=["read", "create", "update", "delete", "query"] + ) + """The OData filter expression to apply to this specific vector query. If no filter expression is + defined at the vector level, the expression defined in the top level filter parameter is used + instead.""" + per_document_vector_limit: Optional[int] = rest_field( + name="perDocumentVectorLimit", visibility=["read", "create", "update", "delete", "query"] + ) + """Controls how many vectors can be matched from each document in a vector search query. Setting + it to 1 ensures at most one vector per document is matched, guaranteeing results come from + distinct documents. Setting it to 0 (unlimited) allows multiple relevant vectors from the same + document to be matched. Default is 0.""" kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) """Type of query. Required. Known values are: \"vector\", \"text\", \"imageUrl\", and \"imageBinary\".""" @@ -890,6 +1287,9 @@ def __init__( exhaustive: Optional[bool] = None, oversampling: Optional[float] = None, weight: Optional[float] = None, + threshold: Optional["_models.VectorThreshold"] = None, + filter_override: Optional[str] = None, + per_document_vector_limit: Optional[int] = None, ) -> None: ... @overload @@ -928,6 +1328,18 @@ class VectorizableImageBinaryQuery(VectorQuery, discriminator="imageBinary"): will be in the final ranking. Default is 1.0 and the value needs to be a positive number larger than zero. :vartype weight: float + :ivar threshold: The threshold used for vector queries. Note this can only be set if all + 'fields' use the same similarity metric. + :vartype threshold: ~azure.search.documents.models.VectorThreshold + :ivar filter_override: The OData filter expression to apply to this specific vector query. If + no filter expression is defined at the vector level, the expression defined in the top level + filter parameter is used instead. + :vartype filter_override: str + :ivar per_document_vector_limit: Controls how many vectors can be matched from each document in + a vector search query. Setting it to 1 ensures at most one vector per document is matched, + guaranteeing results come from distinct documents. Setting it to 0 (unlimited) allows multiple + relevant vectors from the same document to be matched. Default is 0. + :vartype per_document_vector_limit: int :ivar base64_image: The base 64 encoded binary of an image to be vectorized to perform a vector search query. :vartype base64_image: str @@ -953,6 +1365,9 @@ def __init__( exhaustive: Optional[bool] = None, oversampling: Optional[float] = None, weight: Optional[float] = None, + threshold: Optional["_models.VectorThreshold"] = None, + filter_override: Optional[str] = None, + per_document_vector_limit: Optional[int] = None, base64_image: Optional[str] = None, ) -> None: ... @@ -993,6 +1408,18 @@ class VectorizableImageUrlQuery(VectorQuery, discriminator="imageUrl"): will be in the final ranking. Default is 1.0 and the value needs to be a positive number larger than zero. :vartype weight: float + :ivar threshold: The threshold used for vector queries. Note this can only be set if all + 'fields' use the same similarity metric. + :vartype threshold: ~azure.search.documents.models.VectorThreshold + :ivar filter_override: The OData filter expression to apply to this specific vector query. If + no filter expression is defined at the vector level, the expression defined in the top level + filter parameter is used instead. + :vartype filter_override: str + :ivar per_document_vector_limit: Controls how many vectors can be matched from each document in + a vector search query. Setting it to 1 ensures at most one vector per document is matched, + guaranteeing results come from distinct documents. Setting it to 0 (unlimited) allows multiple + relevant vectors from the same document to be matched. Default is 0. + :vartype per_document_vector_limit: int :ivar url: The URL of an image to be vectorized to perform a vector search query. :vartype url: str :ivar kind: The kind of vector query being performed. Required. Vector query where an url that @@ -1015,6 +1442,9 @@ def __init__( exhaustive: Optional[bool] = None, oversampling: Optional[float] = None, weight: Optional[float] = None, + threshold: Optional["_models.VectorThreshold"] = None, + filter_override: Optional[str] = None, + per_document_vector_limit: Optional[int] = None, url: Optional[str] = None, ) -> None: ... @@ -1055,8 +1485,23 @@ class VectorizableTextQuery(VectorQuery, discriminator="text"): will be in the final ranking. Default is 1.0 and the value needs to be a positive number larger than zero. :vartype weight: float + :ivar threshold: The threshold used for vector queries. Note this can only be set if all + 'fields' use the same similarity metric. + :vartype threshold: ~azure.search.documents.models.VectorThreshold + :ivar filter_override: The OData filter expression to apply to this specific vector query. If + no filter expression is defined at the vector level, the expression defined in the top level + filter parameter is used instead. + :vartype filter_override: str + :ivar per_document_vector_limit: Controls how many vectors can be matched from each document in + a vector search query. Setting it to 1 ensures at most one vector per document is matched, + guaranteeing results come from distinct documents. Setting it to 0 (unlimited) allows multiple + relevant vectors from the same document to be matched. Default is 0. + :vartype per_document_vector_limit: int :ivar text: The text to be vectorized to perform a vector search query. Required. :vartype text: str + :ivar query_rewrites: Can be configured to let a generative model rewrite the query before + sending it to be vectorized. Known values are: "none" and "generative". + :vartype query_rewrites: str or ~azure.search.documents.models.QueryRewritesType :ivar kind: The kind of vector query being performed. Required. Vector query where a text value that needs to be vectorized is provided. :vartype kind: str or ~azure.search.documents.models.TEXT @@ -1064,6 +1509,11 @@ class VectorizableTextQuery(VectorQuery, discriminator="text"): text: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The text to be vectorized to perform a vector search query. Required.""" + query_rewrites: Optional[Union[str, "_models.QueryRewritesType"]] = rest_field( + name="queryRewrites", visibility=["read", "create", "update", "delete", "query"] + ) + """Can be configured to let a generative model rewrite the query before sending it to be + vectorized. Known values are: \"none\" and \"generative\".""" kind: Literal[VectorQueryKind.TEXT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The kind of vector query being performed. Required. Vector query where a text value that needs to be vectorized is provided.""" @@ -1078,6 +1528,10 @@ def __init__( exhaustive: Optional[bool] = None, oversampling: Optional[float] = None, weight: Optional[float] = None, + threshold: Optional["_models.VectorThreshold"] = None, + filter_override: Optional[str] = None, + per_document_vector_limit: Optional[int] = None, + query_rewrites: Optional[Union[str, "_models.QueryRewritesType"]] = None, ) -> None: ... @overload @@ -1116,6 +1570,18 @@ class VectorizedQuery(VectorQuery, discriminator="vector"): will be in the final ranking. Default is 1.0 and the value needs to be a positive number larger than zero. :vartype weight: float + :ivar threshold: The threshold used for vector queries. Note this can only be set if all + 'fields' use the same similarity metric. + :vartype threshold: ~azure.search.documents.models.VectorThreshold + :ivar filter_override: The OData filter expression to apply to this specific vector query. If + no filter expression is defined at the vector level, the expression defined in the top level + filter parameter is used instead. + :vartype filter_override: str + :ivar per_document_vector_limit: Controls how many vectors can be matched from each document in + a vector search query. Setting it to 1 ensures at most one vector per document is matched, + guaranteeing results come from distinct documents. Setting it to 0 (unlimited) allows multiple + relevant vectors from the same document to be matched. Default is 0. + :vartype per_document_vector_limit: int :ivar vector: The vector representation of a search query. Required. :vartype vector: list[float] :ivar kind: The kind of vector query being performed. Required. Vector query where a raw vector @@ -1139,6 +1605,9 @@ def __init__( exhaustive: Optional[bool] = None, oversampling: Optional[float] = None, weight: Optional[float] = None, + threshold: Optional["_models.VectorThreshold"] = None, + filter_override: Optional[str] = None, + per_document_vector_limit: Optional[int] = None, ) -> None: ... @overload @@ -1164,3 +1633,50 @@ class VectorsDebugInfo(_Model): subscores: Optional["_models.QueryResultDocumentSubscores"] = rest_field(visibility=["read"]) """The breakdown of subscores of the document prior to the chosen result set fusion/combination method such as RRF.""" + + +class VectorSimilarityThreshold(VectorThreshold, discriminator="vectorSimilarity"): + """The results of the vector query will be filtered based on the vector similarity metric. Note + this is the canonical definition of similarity metric, not the 'distance' version. The + threshold direction (larger or smaller) will be chosen automatically according to the metric + used by the field. + + :ivar value: The threshold will filter based on the similarity metric value. Note this is the + canonical definition of similarity metric, not the 'distance' version. The threshold direction + (larger or smaller) will be chosen automatically according to the metric used by the field. + Required. + :vartype value: float + :ivar kind: The kind of threshold used to filter vector queries. Required. The results of the + vector query will be filtered based on the vector similarity metric. Note this is the canonical + definition of similarity metric, not the 'distance' version. The threshold direction (larger or + smaller) will be chosen automatically according to the metric used by the field. + :vartype kind: str or ~azure.search.documents.models.VECTOR_SIMILARITY + """ + + value: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The threshold will filter based on the similarity metric value. Note this is the canonical + definition of similarity metric, not the 'distance' version. The threshold direction (larger or + smaller) will be chosen automatically according to the metric used by the field. Required.""" + kind: Literal[VectorThresholdKind.VECTOR_SIMILARITY] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The kind of threshold used to filter vector queries. Required. The results of the vector query + will be filtered based on the vector similarity metric. Note this is the canonical definition + of similarity metric, not the 'distance' version. The threshold direction (larger or smaller) + will be chosen automatically according to the metric used by the field.""" + + @overload + def __init__( + self, + *, + value: float, + ) -> 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) + self.kind = VectorThresholdKind.VECTOR_SIMILARITY # type: ignore diff --git a/sdk/search/azure-search-documents/pyproject.toml b/sdk/search/azure-search-documents/pyproject.toml index 16ddad630488..04403f6d9741 100644 --- a/sdk/search/azure-search-documents/pyproject.toml +++ b/sdk/search/azure-search-documents/pyproject.toml @@ -17,7 +17,7 @@ authors = [ description = "Microsoft Corporation Azure Search Documents Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", diff --git a/sdk/search/azure-search-documents/search/__init__.py b/sdk/search/azure-search-documents/search/__init__.py new file mode 100644 index 000000000000..d55ccad1f573 --- /dev/null +++ b/sdk/search/azure-search-documents/search/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/search/azure-search-documents/search/models/__init__.py b/sdk/search/azure-search-documents/search/models/__init__.py new file mode 100644 index 000000000000..e4ec13bcce13 --- /dev/null +++ b/sdk/search/azure-search-documents/search/models/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + SharePointConnectorAppRegistration, +) + +from ._enums import ( # type: ignore + ContentUnderstandingSkillChunkingMethod, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "SharePointConnectorAppRegistration", + "ContentUnderstandingSkillChunkingMethod", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/search/azure-search-documents/search/models/_enums.py b/sdk/search/azure-search-documents/search/models/_enums.py new file mode 100644 index 000000000000..bd3f644f1acb --- /dev/null +++ b/sdk/search/azure-search-documents/search/models/_enums.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class ContentUnderstandingSkillChunkingMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The chunking strategy used by the Content Understanding skill. Default is 'fixedSize'.""" + + FIXED_SIZE = "fixedSize" + """Fixed-size character-based windowed chunking.""" + SEMANTIC = "semantic" + """Layout-aware, paragraph-boundary-respecting chunking.""" diff --git a/sdk/search/azure-search-documents/search/models/_models.py b/sdk/search/azure-search-documents/search/models/_models.py new file mode 100644 index 000000000000..bc7bd51c7c7e --- /dev/null +++ b/sdk/search/azure-search-documents/search/models/_models.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +from typing import Any, Mapping, Optional, overload + +from ...azure.search.documents._utils.model_base import Model as _Model, rest_field + + +class SharePointConnectorAppRegistration(_Model): + """Configures a SharePoint connector app registration for the index, enabling document-level + permissions from SharePoint. + + :ivar application_id: The application (client) ID of the app registration used to connect to + SharePoint. Required. + :vartype application_id: str + :ivar federated_credential_id: The federated credential ID configured on the app registration. + Required. + :vartype federated_credential_id: str + :ivar tenant_id: The tenant ID of the app registration. If not specified, the tenant of the + search service is used. + :vartype tenant_id: str + """ + + application_id: str = rest_field(name="applicationId", visibility=["read", "create", "update", "delete", "query"]) + """The application (client) ID of the app registration used to connect to SharePoint. Required.""" + federated_credential_id: str = rest_field( + name="federatedCredentialId", visibility=["read", "create", "update", "delete", "query"] + ) + """The federated credential ID configured on the app registration. Required.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The tenant ID of the app registration. If not specified, the tenant of the search service is + used.""" + + @overload + def __init__( + self, + *, + application_id: str, + federated_credential_id: str, + tenant_id: Optional[str] = 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) diff --git a/sdk/search/azure-search-documents/search/models/_patch.py b/sdk/search/azure-search-documents/search/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/search/azure-search-documents/search/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/search/azure-search-documents/tests/_search_helpers.py b/sdk/search/azure-search-documents/tests/_search_helpers.py index 67500d6d4f49..b13c685365bd 100644 --- a/sdk/search/azure-search-documents/tests/_search_helpers.py +++ b/sdk/search/azure-search-documents/tests/_search_helpers.py @@ -81,8 +81,7 @@ "HotelId": "2", "HotelName": "Old Century Hotel", "Description": ( - "The hotel is situated in a nineteenth century plaza renovated to the highest architectural " - "standards." + "The hotel is situated in a nineteenth century plaza renovated to the highest architectural " "standards." ), "Description_fr": "Hotel situe dans une place du dix-neuvieme siecle.", "Category": "Boutique", @@ -240,9 +239,7 @@ def poll_until( if attempt < attempts - 1: time.sleep(interval) last_snapshot = snapshots[-1] if snapshots else None - raise AssertionError( - f"Polling timed out after {attempts} attempts; last snapshot: {last_snapshot!r}" - ) + raise AssertionError(f"Polling timed out after {attempts} attempts; last snapshot: {last_snapshot!r}") # --------------------------------------------------------------------------- @@ -280,9 +277,7 @@ def build_index(index_name: str, *, semantic: bool = False) -> SearchIndex: configurations=[ SemanticConfiguration( name=SEMANTIC_CONFIGURATION_NAME, - prioritized_fields=SemanticPrioritizedFields( - content_fields=[SemanticField(field_name="content")] - ), + prioritized_fields=SemanticPrioritizedFields(content_fields=[SemanticField(field_name="content")]), ) ], ) @@ -543,9 +538,7 @@ def hotel_index( index_client = make_index_client(endpoint) search_client = make_search_client(endpoint, index_name) index_documents = ( - documents - if documents is not None - else build_hotel_documents(document_count or HOTEL_DOCUMENT_COUNT) + documents if documents is not None else build_hotel_documents(document_count or HOTEL_DOCUMENT_COUNT) ) try: index_client.create_index(build_hotel_index(index_name)) diff --git a/sdk/search/azure-search-documents/tests/_search_helpers_async.py b/sdk/search/azure-search-documents/tests/_search_helpers_async.py index 6882ee3fa483..687ccb66d4f4 100644 --- a/sdk/search/azure-search-documents/tests/_search_helpers_async.py +++ b/sdk/search/azure-search-documents/tests/_search_helpers_async.py @@ -67,9 +67,7 @@ async def poll_until( if attempt < attempts - 1: await asyncio.sleep(interval) last_snapshot = snapshots[-1] if snapshots else None - raise AssertionError( - f"Polling timed out after {attempts} attempts; last snapshot: {last_snapshot!r}" - ) + raise AssertionError(f"Polling timed out after {attempts} attempts; last snapshot: {last_snapshot!r}") # --------------------------------------------------------------------------- @@ -123,9 +121,7 @@ def live_test() -> Callable: """Compose the standard async live-test decorator stack.""" def wrap(fn: Callable) -> Callable: - return SearchEnvVarPreparer()( - search_decorator()(recorded_by_proxy_async(fn)) - ) + return SearchEnvVarPreparer()(search_decorator()(recorded_by_proxy_async(fn))) return wrap @@ -165,9 +161,7 @@ async def hotel_index( index_client = make_index_client(endpoint) search_client = make_search_client(endpoint, index_name) index_documents = ( - documents - if documents is not None - else build_hotel_documents(document_count or HOTEL_DOCUMENT_COUNT) + documents if documents is not None else build_hotel_documents(document_count or HOTEL_DOCUMENT_COUNT) ) try: await index_client.create_index(build_hotel_index(index_name)) diff --git a/sdk/search/azure-search-documents/tests/test_search_client_index_documents_live.py b/sdk/search/azure-search-documents/tests/test_search_client_index_documents_live.py index 6f4dbdaab43b..8b889d28ffee 100644 --- a/sdk/search/azure-search-documents/tests/test_search_client_index_documents_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_client_index_documents_live.py @@ -39,9 +39,7 @@ def test_index_documents_sends_batch_actions(self, endpoint): with hotel_index(self, endpoint, index_name) as (search_client, _): batch = IndexDocumentsBatch() - batch.add_upload_actions( - [build_hotel_document("1000", rating=5), build_hotel_document("1001", rating=4)] - ) + batch.add_upload_actions([build_hotel_document("1000", rating=5), build_hotel_document("1001", rating=4)]) batch.add_delete_actions([{"HotelId": "2"}]) batch.add_merge_actions([{"HotelId": "3", "Rating": 1}]) @@ -126,9 +124,7 @@ def test_merge_documents_updates_existing_documents(self, endpoint): index_name = self.get_resource_name("index-merge-documents-existing") with hotel_index(self, endpoint, index_name) as (search_client, _): - results = search_client.merge_documents( - [{"HotelId": "5", "Rating": 1}, {"HotelId": "6", "Rating": 2}] - ) + results = search_client.merge_documents([{"HotelId": "5", "Rating": 1}, {"HotelId": "6", "Rating": 2}]) self._wait_for_indexing() assert len(results) == 2 diff --git a/sdk/search/azure-search-documents/tests/test_search_client_index_documents_live_async.py b/sdk/search/azure-search-documents/tests/test_search_client_index_documents_live_async.py index 599dbf665b13..7eecf1e32856 100644 --- a/sdk/search/azure-search-documents/tests/test_search_client_index_documents_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_client_index_documents_live_async.py @@ -37,9 +37,7 @@ async def test_index_documents_sends_batch_actions(self, endpoint): async with hotel_index(self, endpoint, index_name) as (search_client, _): batch = IndexDocumentsBatch() - batch.add_upload_actions( - [build_hotel_document("1000", rating=5), build_hotel_document("1001", rating=4)] - ) + batch.add_upload_actions([build_hotel_document("1000", rating=5), build_hotel_document("1001", rating=4)]) batch.add_delete_actions([{"HotelId": "2"}]) batch.add_merge_actions([{"HotelId": "3", "Rating": 1}]) diff --git a/sdk/search/azure-search-documents/tests/test_search_client_search_live.py b/sdk/search/azure-search-documents/tests/test_search_client_search_live.py index c5d05686db90..fc4b4a8cb096 100644 --- a/sdk/search/azure-search-documents/tests/test_search_client_search_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_client_search_live.py @@ -105,10 +105,7 @@ def test_search_continues_across_service_pages(self, endpoint): index_name, document_count=LARGE_HOTEL_DOCUMENT_COUNT, ) as (search_client, _): - assert ( - len(list(search_client.search(search_text=""))) - == LARGE_HOTEL_DOCUMENT_COUNT - ) + assert len(list(search_client.search(search_text=""))) == LARGE_HOTEL_DOCUMENT_COUNT @live_test() def test_autocomplete_returns_completed_terms(self, endpoint): diff --git a/sdk/search/azure-search-documents/tests/test_search_client_search_live_async.py b/sdk/search/azure-search-documents/tests/test_search_client_search_live_async.py index 3d19c5dfd650..659e49d94fa9 100644 --- a/sdk/search/azure-search-documents/tests/test_search_client_search_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_client_search_live_async.py @@ -89,9 +89,7 @@ async def test_search_get_facets_reads_first_page_metadata(self, endpoint): index_name = self.get_resource_name("index-search-facets") async with hotel_index(self, endpoint, index_name) as (search_client, _): - results = await search_client.search( - search_text="WiFi", facets=["Category"], select=SEARCH_SELECT_FIELDS - ) + results = await search_client.search(search_text="WiFi", facets=["Category"], select=SEARCH_SELECT_FIELDS) assert await results.get_facets() == { "Category": [ {"value": "Budget", "count": 4}, @@ -111,10 +109,7 @@ async def test_search_continues_across_service_pages(self, endpoint): index_name, document_count=LARGE_HOTEL_DOCUMENT_COUNT, ) as (search_client, _): - assert ( - len(await _collect(await search_client.search(search_text=""))) - == LARGE_HOTEL_DOCUMENT_COUNT - ) + assert len(await _collect(await search_client.search(search_text=""))) == LARGE_HOTEL_DOCUMENT_COUNT @live_test() async def test_autocomplete_returns_completed_terms(self, endpoint): diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live_async.py b/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live_async.py index d99054803cfe..479d51355bc0 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live_async.py @@ -189,7 +189,9 @@ async def test_delete_index_accepts_model_etag_and_match_condition(self, endpoin index = await client.create_index(_build_hotel_index(index_name)) original_e_tag = index.e_tag - await client.create_or_update_index(_build_hotel_index(index_name, description=REPLACEMENT_INDEX_DESCRIPTION)) + await client.create_or_update_index( + _build_hotel_index(index_name, description=REPLACEMENT_INDEX_DESCRIPTION) + ) index.e_tag = original_e_tag with pytest.raises(HttpResponseError): diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live.py b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live.py index 8549a7b9b10b..92454a007fcf 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live.py @@ -19,9 +19,7 @@ class TestKnowledgeBaseConfiguration(AzureRecordedTestCase): @live_test() - def test_create_or_update_knowledge_base_round_trips_references_description_and_etag( - self, endpoint: str - ) -> None: + def test_create_or_update_knowledge_base_round_trips_references_description_and_etag(self, endpoint: str) -> None: with knowledge_base_resources( self, endpoint, diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live_async.py b/sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live_async.py index d2762636f845..1d6744a6a503 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live_async.py @@ -88,7 +88,9 @@ async def test_create_or_update_synonym_map_uses_model_etag_and_match_condition( synonym_map = await client.create_synonym_map(_build_synonym_map(synonym_map_name)) original_e_tag = synonym_map.e_tag - await client.create_or_update_synonym_map(_build_synonym_map(synonym_map_name, synonyms=REPLACEMENT_SYNONYMS)) + await client.create_or_update_synonym_map( + _build_synonym_map(synonym_map_name, synonyms=REPLACEMENT_SYNONYMS) + ) synonym_map.e_tag = original_e_tag synonym_map.synonyms = SYNONYMS @@ -106,7 +108,9 @@ async def test_delete_synonym_map_accepts_model_etag_and_match_condition(self, e synonym_map = await client.create_synonym_map(_build_synonym_map(synonym_map_name)) original_e_tag = synonym_map.e_tag - await client.create_or_update_synonym_map(_build_synonym_map(synonym_map_name, synonyms=REPLACEMENT_SYNONYMS)) + await client.create_or_update_synonym_map( + _build_synonym_map(synonym_map_name, synonyms=REPLACEMENT_SYNONYMS) + ) synonym_map.e_tag = original_e_tag with pytest.raises(HttpResponseError): diff --git a/sdk/search/azure-search-documents/tests/test_search_indexer_client_data_sources_live.py b/sdk/search/azure-search-documents/tests/test_search_indexer_client_data_sources_live.py index c36d72211f97..df0d15fc5442 100644 --- a/sdk/search/azure-search-documents/tests/test_search_indexer_client_data_sources_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_indexer_client_data_sources_live.py @@ -152,7 +152,10 @@ def test_create_or_update_data_source_connection_replaces_existing_resource(self assert isinstance(result, SearchIndexerDataSourceConnection) assert result.name == data_source_connection_name assert result.description == REPLACEMENT_DATA_SOURCE_DESCRIPTION - assert client.get_data_source_connection(data_source_connection_name).description == REPLACEMENT_DATA_SOURCE_DESCRIPTION + assert ( + client.get_data_source_connection(data_source_connection_name).description + == REPLACEMENT_DATA_SOURCE_DESCRIPTION + ) finally: safe_delete(client.delete_data_source_connection, data_source_connection_name) client.close() diff --git a/sdk/search/azure-search-documents/tests/test_search_indexer_client_data_sources_live_async.py b/sdk/search/azure-search-documents/tests/test_search_indexer_client_data_sources_live_async.py index 57d8d00f1c9a..156479ff9468 100644 --- a/sdk/search/azure-search-documents/tests/test_search_indexer_client_data_sources_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_indexer_client_data_sources_live_async.py @@ -101,7 +101,10 @@ async def test_get_data_source_connections_and_names_return_created_resources(se async with client: try: - for data_source_connection_name in [first_data_source_connection_name, second_data_source_connection_name]: + for data_source_connection_name in [ + first_data_source_connection_name, + second_data_source_connection_name, + ]: await client.create_data_source_connection( _build_data_source_connection( data_source_connection_name, diff --git a/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender.py b/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender.py index 8f61678facbb..20f943679077 100644 --- a/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender.py +++ b/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender.py @@ -77,8 +77,7 @@ def test_constructor_uses_public_settings_and_creates_inner_client(self): assert sender._auto_flush is False assert sender._client._config.api_version == API_VERSION assert repr(sender) == ( - "" + "" ) def test_constructor_rejects_non_positive_auto_flush_interval(self): @@ -266,9 +265,13 @@ class TestSearchIndexingBufferedSenderIndexing: def test_context_manager_enters_client_and_closes_on_exit(self): sender = create_sender() - with mock.patch.object(sender._client, "__enter__", return_value=sender._client) as mock_enter, mock.patch.object( + with mock.patch.object( + sender._client, "__enter__", return_value=sender._client + ) as mock_enter, mock.patch.object( sender._client, "__exit__", return_value=None - ) as mock_exit, mock.patch.object(sender, "close") as mock_close: + ) as mock_exit, mock.patch.object( + sender, "close" + ) as mock_close: with sender as result: assert result is sender diff --git a/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_async.py b/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_async.py index 0247a0114141..43e075bab73c 100644 --- a/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_async.py @@ -84,8 +84,7 @@ def test_constructor_uses_public_settings_and_creates_inner_client(self): assert sender._auto_flush is False assert sender._client._config.api_version == API_VERSION assert repr(sender) == ( - "" + "" ) def test_constructor_rejects_non_positive_auto_flush_interval(self): diff --git a/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_live.py b/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_live.py index 2bc0394bdb8e..81e6c766465f 100644 --- a/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_live.py @@ -103,9 +103,7 @@ def test_merge_documents_flushes_existing_document_and_reports_missing_key_failu index_name, auto_flush=False, ) as (search_client, buffered_sender): - buffered_sender.merge_documents( - [{"HotelId": "5", "Rating": 1}, {"HotelId": MISSING_HOTEL_ID, "Rating": 2}] - ) + buffered_sender.merge_documents([{"HotelId": "5", "Rating": 1}, {"HotelId": MISSING_HOTEL_ID, "Rating": 2}]) has_error = buffered_sender.flush() if self.is_live: diff --git a/sdk/search/azure-search-documents/tsp-location.yaml b/sdk/search/azure-search-documents/tsp-location.yaml index e5e54626e777..80134ffbdec6 100644 --- a/sdk/search/azure-search-documents/tsp-location.yaml +++ b/sdk/search/azure-search-documents/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/search/data-plane/Search -commit: d62196d5e224f0cd58f6dd2dbd082ed72300af5a +commit: 711800258e129c0d1459581f343813c3cd0d5ad7 repo: Azure/azure-rest-api-specs - \ No newline at end of file + From f1a2b2821fd5ed21842d055e8857c49ba82f0947 Mon Sep 17 00:00:00 2001 From: Zixin Yao Date: Fri, 15 May 2026 11:33:39 -0700 Subject: [PATCH 2/5] Regenerate search SDK from updated TypeSpec Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../apiview-properties.json | 7 ++++ .../documents/_operations/_operations.py | 22 ++++++------ .../documents/aio/_operations/_operations.py | 18 +++++----- .../search/documents/indexes/models/_enums.py | 5 ++- .../documents/indexes/models/_models.py | 4 +-- .../azure/search/documents/models/__init__.py | 14 ++++++++ .../azure/search/documents/models/_models.py | 36 +++++++++---------- .../azure-search-documents/pyproject.toml | 3 ++ .../azure-search-documents/sdk_packaging.toml | 2 -- .../azure-search-documents/tsp-location.yaml | 2 +- 10 files changed, 66 insertions(+), 47 deletions(-) delete mode 100644 sdk/search/azure-search-documents/sdk_packaging.toml diff --git a/sdk/search/azure-search-documents/apiview-properties.json b/sdk/search/azure-search-documents/apiview-properties.json index 3475ab3a100e..49176387408a 100644 --- a/sdk/search/azure-search-documents/apiview-properties.json +++ b/sdk/search/azure-search-documents/apiview-properties.json @@ -62,6 +62,7 @@ "azure.search.documents.indexes.models.DataChangeDetectionPolicy": "Search.DataChangeDetectionPolicy", "azure.search.documents.indexes.models.DataDeletionDetectionPolicy": "Search.DataDeletionDetectionPolicy", "azure.search.documents.indexes.models.DataSourceCredentials": "Search.DataSourceCredentials", + "azure.search.documents.models.DebugInfo": "Search.DebugInfo", "azure.search.documents.indexes.models.DefaultCognitiveServicesAccount": "Search.DefaultCognitiveServicesAccount", "azure.search.documents.indexes.models.DictionaryDecompounderTokenFilter": "Search.DictionaryDecompounderTokenFilter", "azure.search.documents.indexes.models.ScoringFunction": "Search.ScoringFunction", @@ -103,6 +104,7 @@ "azure.search.documents.indexes.models.HighWaterMarkChangeDetectionPolicy": "Search.HighWaterMarkChangeDetectionPolicy", "azure.search.documents.indexes.models.HnswAlgorithmConfiguration": "Search.HnswAlgorithmConfiguration", "azure.search.documents.indexes.models.HnswParameters": "Search.HnswParameters", + "azure.search.documents.models.HybridSearch": "Search.HybridSearch", "azure.search.documents.indexes.models.ImageAnalysisSkill": "Search.ImageAnalysisSkill", "azure.search.documents.models.IndexAction": "Search.IndexAction", "azure.search.documents.models.IndexDocumentsBatch": "Search.IndexBatch", @@ -219,6 +221,8 @@ "azure.search.documents.models.QueryResultDocumentRerankerInput": "Search.QueryResultDocumentRerankerInput", "azure.search.documents.models.QueryResultDocumentSemanticField": "Search.QueryResultDocumentSemanticField", "azure.search.documents.models.QueryResultDocumentSubscores": "Search.QueryResultDocumentSubscores", + "azure.search.documents.models.QueryRewritesDebugInfo": "Search.QueryRewritesDebugInfo", + "azure.search.documents.models.QueryRewritesValuesDebugInfo": "Search.QueryRewritesValuesDebugInfo", "azure.search.documents.indexes.models.RemoteSharePointKnowledgeSource": "Search.RemoteSharePointKnowledgeSource", "azure.search.documents.indexes.models.RemoteSharePointKnowledgeSourceParameters": "Search.RemoteSharePointKnowledgeSourceParameters", "azure.search.documents.knowledgebases.models.RemoteSharePointKnowledgeSourceParams": "Search.RemoteSharePointKnowledgeSourceParams", @@ -324,6 +328,8 @@ "azure.search.documents.models.ScoringStatistics": "Search.ScoringStatistics", "azure.search.documents.models.QueryDebugMode": "Search.QueryDebugMode", "azure.search.documents.models.SearchMode": "Search.SearchMode", + "azure.search.documents.models.QueryLanguage": "Search.QueryLanguage", + "azure.search.documents.models.QuerySpellerType": "Search.QuerySpellerType", "azure.search.documents.models.SemanticErrorMode": "Search.SemanticErrorMode", "azure.search.documents.models.QueryAnswerType": "Search.QueryAnswerType", "azure.search.documents.models.QueryCaptionType": "Search.QueryCaptionType", @@ -331,6 +337,7 @@ "azure.search.documents.models.VectorThresholdKind": "Search.VectorThresholdKind", "azure.search.documents.models.VectorQueryKind": "Search.VectorQueryKind", "azure.search.documents.models.VectorFilterMode": "Search.VectorFilterMode", + "azure.search.documents.models.HybridCountAndFacetMode": "Search.HybridCountAndFacetMode", "azure.search.documents.models.SemanticFieldState": "Search.SemanticFieldState", "azure.search.documents.models.SemanticErrorReason": "Search.SemanticErrorReason", "azure.search.documents.models.SemanticSearchResultsType": "Search.SemanticSearchResultsType", 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 815c222495a8..ac4d9c19342f 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 @@ -100,8 +100,8 @@ def build_search_search_get_request( # pylint: disable=too-many-locals,too-many semantic_query: Optional[str] = None, query_rewrites: Optional[Union[str, _models1.QueryRewritesType]] = None, debug: Optional[Union[str, _models1.QueryDebugMode]] = None, - query_language: Optional[Union[str, _models1._enums.QueryLanguage]] = None, - speller: Optional[Union[str, _models1._enums.QuerySpellerType]] = None, + query_language: Optional[Union[str, _models1.QueryLanguage]] = None, + speller: Optional[Union[str, _models1.QuerySpellerType]] = None, semantic_fields: Optional[list[str]] = None, **kwargs: Any ) -> HttpRequest: @@ -598,8 +598,8 @@ def _search_get( # pylint: disable=too-many-locals semantic_query: Optional[str] = None, query_rewrites: Optional[Union[str, _models1.QueryRewritesType]] = None, debug: Optional[Union[str, _models1.QueryDebugMode]] = None, - query_language: Optional[Union[str, _models1._enums.QueryLanguage]] = None, - speller: Optional[Union[str, _models1._enums.QuerySpellerType]] = None, + query_language: Optional[Union[str, _models1.QueryLanguage]] = None, + speller: Optional[Union[str, _models1.QuerySpellerType]] = None, semantic_fields: Optional[list[str]] = None, **kwargs: Any ) -> _models1._models.SearchDocumentsResult: @@ -873,8 +873,8 @@ def _search_post( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, _models1.SearchMode]] = None, - query_language: Optional[Union[str, _models1._enums.QueryLanguage]] = None, - query_speller: Optional[Union[str, _models1._enums.QuerySpellerType]] = None, + query_language: Optional[Union[str, _models1.QueryLanguage]] = None, + query_speller: Optional[Union[str, _models1.QuerySpellerType]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -888,7 +888,7 @@ def _search_post( # pylint: disable=too-many-locals semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list[_models1.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models1.VectorFilterMode]] = None, - hybrid_search: Optional[_models1._models.HybridSearch] = None, + hybrid_search: Optional[_models1.HybridSearch] = None, **kwargs: Any ) -> _models1._models.SearchDocumentsResult: ... @overload @@ -940,8 +940,8 @@ def _search_post( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, _models1.SearchMode]] = None, - query_language: Optional[Union[str, _models1._enums.QueryLanguage]] = None, - query_speller: Optional[Union[str, _models1._enums.QuerySpellerType]] = None, + query_language: Optional[Union[str, _models1.QueryLanguage]] = None, + query_speller: Optional[Union[str, _models1.QuerySpellerType]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -955,7 +955,7 @@ def _search_post( # pylint: disable=too-many-locals semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list[_models1.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models1.VectorFilterMode]] = None, - hybrid_search: Optional[_models1._models.HybridSearch] = None, + hybrid_search: Optional[_models1.HybridSearch] = None, **kwargs: Any ) -> _models1._models.SearchDocumentsResult: """Searches for documents in the index. @@ -1105,7 +1105,7 @@ def _search_post( # pylint: disable=too-many-locals :paramtype vector_filter_mode: str or ~azure.search.documents.models.VectorFilterMode :keyword hybrid_search: The query parameters to configure hybrid search behaviors. Default value is None. - :paramtype hybrid_search: ~azure.search.documents.models._models.HybridSearch + :paramtype hybrid_search: ~azure.search.documents.models.HybridSearch :return: SearchDocumentsResult. The SearchDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models._models.SearchDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: 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 04e85b9b0d7b..55e638a61cfe 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 @@ -166,8 +166,8 @@ async def _search_get( # pylint: disable=too-many-locals semantic_query: Optional[str] = None, query_rewrites: Optional[Union[str, _models2.QueryRewritesType]] = None, debug: Optional[Union[str, _models2.QueryDebugMode]] = None, - query_language: Optional[Union[str, _models2._enums.QueryLanguage]] = None, - speller: Optional[Union[str, _models2._enums.QuerySpellerType]] = None, + query_language: Optional[Union[str, _models2.QueryLanguage]] = None, + speller: Optional[Union[str, _models2.QuerySpellerType]] = None, semantic_fields: Optional[list[str]] = None, **kwargs: Any ) -> _models2._models.SearchDocumentsResult: @@ -441,8 +441,8 @@ async def _search_post( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, _models2.SearchMode]] = None, - query_language: Optional[Union[str, _models2._enums.QueryLanguage]] = None, - query_speller: Optional[Union[str, _models2._enums.QuerySpellerType]] = None, + query_language: Optional[Union[str, _models2.QueryLanguage]] = None, + query_speller: Optional[Union[str, _models2.QuerySpellerType]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -456,7 +456,7 @@ async def _search_post( # pylint: disable=too-many-locals semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list[_models2.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models2.VectorFilterMode]] = None, - hybrid_search: Optional[_models2._models.HybridSearch] = None, + hybrid_search: Optional[_models2.HybridSearch] = None, **kwargs: Any ) -> _models2._models.SearchDocumentsResult: ... @overload @@ -508,8 +508,8 @@ async def _search_post( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, _models2.SearchMode]] = None, - query_language: Optional[Union[str, _models2._enums.QueryLanguage]] = None, - query_speller: Optional[Union[str, _models2._enums.QuerySpellerType]] = None, + query_language: Optional[Union[str, _models2.QueryLanguage]] = None, + query_speller: Optional[Union[str, _models2.QuerySpellerType]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -523,7 +523,7 @@ async def _search_post( # pylint: disable=too-many-locals semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list[_models2.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models2.VectorFilterMode]] = None, - hybrid_search: Optional[_models2._models.HybridSearch] = None, + hybrid_search: Optional[_models2.HybridSearch] = None, **kwargs: Any ) -> _models2._models.SearchDocumentsResult: """Searches for documents in the index. @@ -673,7 +673,7 @@ async def _search_post( # pylint: disable=too-many-locals :paramtype vector_filter_mode: str or ~azure.search.documents.models.VectorFilterMode :keyword hybrid_search: The query parameters to configure hybrid search behaviors. Default value is None. - :paramtype hybrid_search: ~azure.search.documents.models._models.HybridSearch + :paramtype hybrid_search: ~azure.search.documents.models.HybridSearch :return: SearchDocumentsResult. The SearchDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models._models.SearchDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: 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 43bc00076004..c618250fe00c 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 @@ -1029,10 +1029,9 @@ class McpServerToolInclusionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): RERANKED = "reranked" """Tool results go through the reranking and aggregation pipeline alongside results from other - knowledge sources.""" + knowledge sources. This is the default behavior.""" ALWAYS = "always" - """Tool results bypass reranking and are always included in the agent context. This is the default - behavior.""" + """Tool results bypass reranking and are always included in the agent context.""" class MicrosoftStemmingTokenizerLanguage(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 32842f01c046..3365e3dbe8ab 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 @@ -7295,7 +7295,7 @@ class McpServerTool(_Model): :ivar output_parsing: Optional configuration for parsing the tool's output. :vartype output_parsing: ~azure.search.documents.indexes.models.McpServerOutputParsing :ivar inclusion_mode: Controls how the parsed results from this tool are integrated into the - final result set. Defaults to 'always' when not specified. Known values are: "reranked" and + final result set. Defaults to 'reranked' when not specified. Known values are: "reranked" and "always". :vartype inclusion_mode: str or ~azure.search.documents.indexes.models.McpServerToolInclusionMode @@ -7314,7 +7314,7 @@ class McpServerTool(_Model): name="inclusionMode", visibility=["read", "create", "update", "delete", "query"] ) """Controls how the parsed results from this tool are integrated into the final result set. - Defaults to 'always' when not specified. Known values are: \"reranked\" and \"always\".""" + Defaults to 'reranked' when not specified. Known values are: \"reranked\" and \"always\".""" max_output_tokens: Optional[int] = rest_field( name="maxOutputTokens", visibility=["read", "create", "update", "delete", "query"] ) 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 cdd0632ef1bf..410fa28d8250 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 @@ -15,11 +15,13 @@ from ._models import ( # type: ignore AutocompleteItem, + DebugInfo, DocumentDebugInfo, ErrorAdditionalInfo, ErrorDetail, ErrorResponse, FacetResult, + HybridSearch, IndexAction, IndexDocumentsBatch, IndexingResult, @@ -30,6 +32,8 @@ QueryResultDocumentRerankerInput, QueryResultDocumentSemanticField, QueryResultDocumentSubscores, + QueryRewritesDebugInfo, + QueryRewritesValuesDebugInfo, SearchResult, SearchScoreThreshold, SemanticDebugInfo, @@ -48,11 +52,14 @@ from ._enums import ( # type: ignore AutocompleteMode, + HybridCountAndFacetMode, IndexActionType, QueryAnswerType, QueryCaptionType, QueryDebugMode, + QueryLanguage, QueryRewritesType, + QuerySpellerType, QueryType, ScoringStatistics, SearchMode, @@ -70,11 +77,13 @@ __all__ = [ "AutocompleteItem", + "DebugInfo", "DocumentDebugInfo", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", "FacetResult", + "HybridSearch", "IndexAction", "IndexDocumentsBatch", "IndexingResult", @@ -85,6 +94,8 @@ "QueryResultDocumentRerankerInput", "QueryResultDocumentSemanticField", "QueryResultDocumentSubscores", + "QueryRewritesDebugInfo", + "QueryRewritesValuesDebugInfo", "SearchResult", "SearchScoreThreshold", "SemanticDebugInfo", @@ -100,11 +111,14 @@ "VectorizedQuery", "VectorsDebugInfo", "AutocompleteMode", + "HybridCountAndFacetMode", "IndexActionType", "QueryAnswerType", "QueryCaptionType", "QueryDebugMode", + "QueryLanguage", "QueryRewritesType", + "QuerySpellerType", "QueryType", "ScoringStatistics", "SearchMode", 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 6e23ea09d117..511f83418935 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 @@ -53,12 +53,10 @@ class DebugInfo(_Model): """Contains debugging information that can be used to further explore your search results. :ivar query_rewrites: Contains debugging information specific to query rewrites. - :vartype query_rewrites: ~azure.search.documents.models._models.QueryRewritesDebugInfo + :vartype query_rewrites: ~azure.search.documents.models.QueryRewritesDebugInfo """ - query_rewrites: Optional["_models._models.QueryRewritesDebugInfo"] = rest_field( - name="queryRewrites", visibility=["read"] - ) + query_rewrites: Optional["_models.QueryRewritesDebugInfo"] = rest_field(name="queryRewrites", visibility=["read"]) """Contains debugging information specific to query rewrites.""" @@ -225,7 +223,7 @@ class HybridSearch(_Model): will allow retrieving and paging through more documents (using the top and skip parameters), at the cost of higher resource utilization and higher latency. The value needs to be between 1 and 10,000. Default is 1000.""" - count_and_facet_mode: Optional[Union[str, "_models._enums.HybridCountAndFacetMode"]] = rest_field( + count_and_facet_mode: Optional[Union[str, "_models.HybridCountAndFacetMode"]] = rest_field( name="countAndFacetMode", visibility=["read", "create", "update", "delete", "query"] ) """Determines whether the count and facets should includes all documents that matched the search @@ -237,7 +235,7 @@ def __init__( self, *, max_text_recall_size: Optional[int] = None, - count_and_facet_mode: Optional[Union[str, "_models._enums.HybridCountAndFacetMode"]] = None, + count_and_facet_mode: Optional[Union[str, "_models.HybridCountAndFacetMode"]] = None, ) -> None: ... @overload @@ -493,14 +491,14 @@ class QueryRewritesDebugInfo(_Model): """Contains debugging information specific to query rewrites. :ivar text: List of query rewrites generated for the text query. - :vartype text: ~azure.search.documents.models._models.QueryRewritesValuesDebugInfo + :vartype text: ~azure.search.documents.models.QueryRewritesValuesDebugInfo :ivar vectors: List of query rewrites generated for the vectorizable text queries. - :vartype vectors: list[~azure.search.documents.models._models.QueryRewritesValuesDebugInfo] + :vartype vectors: list[~azure.search.documents.models.QueryRewritesValuesDebugInfo] """ - text: Optional["_models._models.QueryRewritesValuesDebugInfo"] = rest_field(visibility=["read"]) + text: Optional["_models.QueryRewritesValuesDebugInfo"] = rest_field(visibility=["read"]) """List of query rewrites generated for the text query.""" - vectors: Optional[list["_models._models.QueryRewritesValuesDebugInfo"]] = rest_field(visibility=["read"]) + vectors: Optional[list["_models.QueryRewritesValuesDebugInfo"]] = rest_field(visibility=["read"]) """List of query rewrites generated for the vectorizable text queries.""" @@ -539,7 +537,7 @@ class SearchDocumentsResult(_Model): parameter was not specified or set to 'none'. :vartype answers: list[~azure.search.documents.models.QueryAnswerResult] :ivar debug_info: Debug information that applies to the search results as a whole. - :vartype debug_info: ~azure.search.documents.models._models.DebugInfo + :vartype debug_info: ~azure.search.documents.models.DebugInfo :ivar next_page_parameters: Continuation JSON payload returned when the query can't return all the requested results in a single response. You can use this JSON along with. :vartype next_page_parameters: ~azure.search.documents.models._models.SearchRequest @@ -579,7 +577,7 @@ class SearchDocumentsResult(_Model): answers: Optional[list["_models.QueryAnswerResult"]] = rest_field(name="@search.answers", visibility=["read"]) """The answers query results for the search operation; null if the answers query parameter was not specified or set to 'none'.""" - debug_info: Optional["_models._models.DebugInfo"] = rest_field(name="@search.debug", visibility=["read"]) + debug_info: Optional["_models.DebugInfo"] = rest_field(name="@search.debug", visibility=["read"]) """Debug information that applies to the search results as a whole.""" next_page_parameters: Optional["_models._models.SearchRequest"] = rest_field( name="@search.nextPageParameters", visibility=["read"] @@ -740,7 +738,7 @@ class SearchRequest(_Model): "postFilter", "preFilter", and "strictPostFilter". :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._models.HybridSearch + :vartype hybrid_search: ~azure.search.documents.models.HybridSearch """ include_total_count: Optional[bool] = rest_field( @@ -835,7 +833,7 @@ class SearchRequest(_Model): ) """A value that specifies whether any or all of the search terms must be matched in order to count the document as a match. Known values are: \"any\" and \"all\".""" - query_language: Optional[Union[str, "_models._enums.QueryLanguage"]] = rest_field( + query_language: Optional[Union[str, "_models.QueryLanguage"]] = rest_field( name="queryLanguage", visibility=["read", "create", "update", "delete", "query"] ) """A value that specifies the language of the search query. Known values are: \"none\", \"en-us\", @@ -848,7 +846,7 @@ class SearchRequest(_Model): \"et-ee\", \"ca-es\", \"fi-fi\", \"sr-ba\", \"sr-me\", \"sr-rs\", \"sk-sk\", \"nb-no\", \"hy-am\", \"bn-in\", \"eu-es\", \"gl-es\", \"gu-in\", \"he-il\", \"ga-ie\", \"kn-in\", \"ml-in\", \"mr-in\", \"fa-ae\", \"pa-in\", \"te-in\", and \"ur-pk\".""" - query_speller: Optional[Union[str, "_models._enums.QuerySpellerType"]] = rest_field( + query_speller: Optional[Union[str, "_models.QuerySpellerType"]] = rest_field( name="speller", visibility=["read", "create", "update", "delete", "query"] ) """A value that specifies the type of the speller to use to spell-correct individual search query @@ -917,7 +915,7 @@ class SearchRequest(_Model): """Determines whether or not filters are applied before or after the vector search is performed. Default is 'preFilter' for new indexes. Known values are: \"postFilter\", \"preFilter\", and \"strictPostFilter\".""" - hybrid_search: Optional["_models._models.HybridSearch"] = rest_field( + hybrid_search: Optional["_models.HybridSearch"] = rest_field( name="hybridSearch", visibility=["read", "create", "update", "delete", "query"] ) """The query parameters to configure hybrid search behaviors.""" @@ -943,8 +941,8 @@ def __init__( # pylint: disable=too-many-locals search_text: Optional[str] = None, search_fields: Optional[list[str]] = None, search_mode: Optional[Union[str, "_models.SearchMode"]] = None, - query_language: Optional[Union[str, "_models._enums.QueryLanguage"]] = None, - query_speller: Optional[Union[str, "_models._enums.QuerySpellerType"]] = None, + query_language: Optional[Union[str, "_models.QueryLanguage"]] = None, + query_speller: Optional[Union[str, "_models.QuerySpellerType"]] = None, select: Optional[list[str]] = None, skip: Optional[int] = None, top: Optional[int] = None, @@ -958,7 +956,7 @@ def __init__( # pylint: disable=too-many-locals semantic_fields: Optional[list[str]] = None, vector_queries: Optional[list["_models.VectorQuery"]] = None, vector_filter_mode: Optional[Union[str, "_models.VectorFilterMode"]] = None, - hybrid_search: Optional["_models._models.HybridSearch"] = None, + hybrid_search: Optional["_models.HybridSearch"] = None, ) -> None: ... @overload diff --git a/sdk/search/azure-search-documents/pyproject.toml b/sdk/search/azure-search-documents/pyproject.toml index 04403f6d9741..3bf87af09a10 100644 --- a/sdk/search/azure-search-documents/pyproject.toml +++ b/sdk/search/azure-search-documents/pyproject.toml @@ -66,3 +66,6 @@ verifytypes = true [tool.azure-sdk-conda] in_bundle = false + +[packaging] +auto_update = false diff --git a/sdk/search/azure-search-documents/sdk_packaging.toml b/sdk/search/azure-search-documents/sdk_packaging.toml deleted file mode 100644 index e7687fdae93b..000000000000 --- a/sdk/search/azure-search-documents/sdk_packaging.toml +++ /dev/null @@ -1,2 +0,0 @@ -[packaging] -auto_update = false \ No newline at end of file diff --git a/sdk/search/azure-search-documents/tsp-location.yaml b/sdk/search/azure-search-documents/tsp-location.yaml index 80134ffbdec6..e087e99c6206 100644 --- a/sdk/search/azure-search-documents/tsp-location.yaml +++ b/sdk/search/azure-search-documents/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/search/data-plane/Search -commit: 711800258e129c0d1459581f343813c3cd0d5ad7 +commit: c3500ccf73433d095fac59c07ee72ecfd6576f3d repo: Azure/azure-rest-api-specs From cf38ff2e18f17e7b31430f6901da6610cbe3c2d5 Mon Sep 17 00:00:00 2001 From: Zixin Yao Date: Fri, 15 May 2026 15:05:00 -0700 Subject: [PATCH 3/5] Update search preview customizations and tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../references/release.md | 27 +- .../references/testing.md | 16 +- .../azure-search-documents/CHANGELOG.md | 11 +- .../search/documents/_operations/_patch.py | 73 +++- .../azure/search/documents/_patch.py | 9 +- .../azure/search/documents/_version.py | 2 +- .../documents/aio/_operations/_patch.py | 58 ++- .../azure/search/documents/aio/_patch.py | 6 +- .../indexes/_operations/_operations.py | 2 +- .../documents/indexes/_operations/_patch.py | 133 ++++++- .../azure/search/documents/indexes/_patch.py | 12 +- .../indexes/aio/_operations/_operations.py | 2 +- .../indexes/aio/_operations/_patch.py | 131 ++++++- .../search/documents/indexes/aio/_patch.py | 12 +- .../search/documents/knowledgebases/_patch.py | 6 +- .../documents/knowledgebases/aio/_patch.py | 6 +- .../azure/search/documents/models/_patch.py | 4 +- sdk/search/azure-search-documents/mypy.ini | 4 +- .../tests/_capabilities.py | 369 ++++++++++++++++++ .../test_knowledge_base_retrieval_client.py | 31 ++ ...t_knowledge_base_retrieval_client_async.py | 34 ++ .../tests/test_search_client.py | 95 ++++- .../tests/test_search_client_async.py | 98 ++++- .../tests/test_search_index_client.py | 122 ++++++ .../tests/test_search_index_client_async.py | 137 +++++++ .../tests/test_search_index_model.py | 7 +- .../tests/test_search_indexer_client.py | 224 +++++++++++ .../tests/test_search_indexer_client_async.py | 237 +++++++++++ .../tests/test_search_indexer_models.py | 1 + 29 files changed, 1792 insertions(+), 77 deletions(-) create mode 100644 sdk/search/azure-search-documents/tests/_capabilities.py create mode 100644 sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client.py create mode 100644 sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_async.py create mode 100644 sdk/search/azure-search-documents/tests/test_search_index_client.py create mode 100644 sdk/search/azure-search-documents/tests/test_search_index_client_async.py create mode 100644 sdk/search/azure-search-documents/tests/test_search_indexer_client.py create mode 100644 sdk/search/azure-search-documents/tests/test_search_indexer_client_async.py diff --git a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/release.md b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/release.md index b1147463a180..38df02116333 100644 --- a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/release.md +++ b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/release.md @@ -19,23 +19,26 @@ If the current branch differs from the inventories in many places, consider rege ## CHANGELOG conventions -Use `azsdk_package_update_changelog_content` to draft entries, then review and adjust. +### Drafting changelog entries -The generated SDK code is the source of truth for CHANGELOG content. If something exists in generated code, treat it as present. Fall back to the TypeSpec config in the spec PR only when the generated code is ambiguous. +1. Start from the spec PR's `CHANGELOG.md`. Map its sections to ours and use it as the candidate list of what changed. +2. Treat generated SDK code as the source of truth. Confirm each candidate entry exists in the current generated code with `venv python -c "from ... import X; print(X)"`. +3. Group entries by symbol kind and feature theme when meaningful. Kinds are `clients`, `enum members`, `models`, `operations`, `parameters`, `properties`; combine kinds inline when a group includes more than one kind. +4. Write each group as a lead-in bullet with an indented sublist. Use one of these patterns: + - `Below are added [or changed] [for ]` + - `Below are renamed` + - `Below do not exist in this release` +5. Sort entries within each sublist alphabetically by fully qualified name. -After drafting the CHANGELOG, verify both directions: +### Checking whether a symbol exists in a release -1. Code to CHANGELOG: for every changed item in generated code, verify it is reflected in `CHANGELOG.md`. -2. CHANGELOG to code: for every item in `CHANGELOG.md`, verify it matches actual code. - -Use the import checks in `SKILL.md` plus targeted `venv python -c "from ... import X; print(X)"` checks for individual symbols. - -Sort lists within each CHANGELOG section alphabetically by fully qualified name. +- Spot-check: `git show azure-search-documents_:sdk/search/azure-search-documents/`. +- Full dump: `pip install azure-search-documents==` into a temp venv, dump via `dir()` / `inspect.signature`, diff against current. Run from outside the package root or local source shadows the wheel. ### Preview releases - `Features Added`: list changes since the previous preview release. -- `Breaking Changes`: list breaking changes since the previous preview release. Put this beta-only disclaimer before the list: +- `Breaking Changes`: list breaking changes since the previous preview release. Prepend this beta-only disclaimer: ```markdown > These changes do not impact the API of stable versions such as . @@ -46,8 +49,8 @@ Sort lists within each CHANGELOG section alphabetically by fully qualified name. - `Features Added`: list changes since the previous GA release. Do not compare against the latest preview. - `Breaking Changes`: when both categories apply, group them in this order: - 1. GA-to-GA breaking changes, with no disclaimer. - 2. Preview-to-GA breaking changes, after this beta-only disclaimer: + 1. Breaking changes since the previous GA release, with no disclaimer. + 2. Breaking changes since the latest preview in this GA's minor, prepended with this beta-only disclaimer: ```markdown > These changes do not impact the API of stable versions such as . diff --git a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/testing.md b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/testing.md index c50e806d3c9f..1e80e7ab2282 100644 --- a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/testing.md +++ b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/testing.md @@ -64,9 +64,17 @@ New live tests require new [Test Proxy](https://github.com/Azure/azure-sdk-tools This checklist is mandatory for every test change. Do not add or update tests without checking each item below. -1. Start from current SDK source. Prioritize public behavior owned or customized by the Python SDK, especially `_patch.py` and other hand-written code paths. +1. Start from current SDK source. Test SDK-owned behavior, especially `_patch.py` and other hand-written code paths. Do not add package tests solely for pure generated models, enums, or fields; validate generated exports through public API surface review instead. 2. Prefer unit tests whenever the behavior is SDK-owned and can be proven without HTTP. Use playback or live tests only when the service contract matters. 3. Place each test in the file that matches the public SDK surface and subject that owns the final assertion: unit `test_.py`, async unit `test__async.py`, live `test___live.py`, async live `test___live_async.py`. -4. Name each test after the primary public SDK method or surface under test: `test__`. If a parametrized test covers a family of related methods, use a clear family name instead of listing every method. -5. Use deterministic fixtures in Python builders. Share repeated setup and keep scenario-specific setup in the test. -6. Add sync and async together when both public surfaces exist, with matching test names unless the public API differs. +4. Name each test class after the public SDK surface or subject family it groups: `Test`. +5. Name each test after the primary public SDK method or surface under test: `test__`. If a parametrized test covers a family of related methods, use a clear family name instead of listing every method. +6. Use deterministic fixtures in Python builders. Share repeated setup and keep scenario-specific setup in the test. +7. Add sync and async together when both public surfaces exist, with matching test names and test class names unless the public API differs. + +## Gating preview-only tests + +1. Wrap each test scenario that depends on preview-only surfaces with `require_capability(...)`; pass every preview surface the scenario uses. +2. Register capabilities in `tests/_capabilities.py` at the narrowest public surface: new class, new method, method kwarg, model field, or enum member. Use dotted names that match the surface under test, for example `SearchClient.search.query_rewrites`; set `owner` to the public object that must exist and `kwargs` only for method kwargs, model fields, or enum members. +3. Avoid importing preview symbols at module load. Use strings, JSON, local imports, or `hasattr` checks when needed. + diff --git a/sdk/search/azure-search-documents/CHANGELOG.md b/sdk/search/azure-search-documents/CHANGELOG.md index 0932d9177d41..3e49b8983c1f 100644 --- a/sdk/search/azure-search-documents/CHANGELOG.md +++ b/sdk/search/azure-search-documents/CHANGELOG.md @@ -1,15 +1,20 @@ # Release History -## 12.0.1 (Unreleased) +## 12.1.0b1 ### Features Added -### Breaking Changes +- Below enum members are added for API version support + - `azure.search.documents.ApiVersion.V2026_05_01_PREVIEW` -### Bugs Fixed +- Below properties are added for service counters + - `azure.search.documents.indexes.models.SearchServiceCounters.knowledge_base_counter` + - `azure.search.documents.indexes.models.SearchServiceCounters.knowledge_source_counter` ### Other Changes +- Updated default API version to `2026-05-01-preview`. + ## 12.0.0 (2026-04-01) ### Features Added 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 628843b22425..d3190964dfdf 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 @@ -118,6 +118,11 @@ def _build_search_request( session_id: Optional[str] = None, vector_queries: Optional[List[_models.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models.VectorFilterMode]] = None, + query_language: Optional[Union[str, _models.QueryLanguage]] = None, + speller: Optional[Union[str, _models.QuerySpellerType]] = None, + query_rewrites: Optional[Union[str, _models.QueryRewritesType]] = None, + semantic_fields: Optional[List[str]] = None, + hybrid_search: Optional[_models.HybridSearch] = None, semantic_error_mode: Optional[Union[str, _models.SemanticErrorMode]] = None, semantic_max_wait_in_milliseconds: Optional[int] = None, debug: Optional[Union[str, _models.QueryDebugMode]] = None, @@ -161,6 +166,11 @@ def _build_search_request( :keyword str session_id: The session ID for the search query. :keyword list[~azure.search.documents.models.VectorQuery] vector_queries: The list of vector queries to use for the search. :keyword vector_filter_mode: The vector filter mode to use for the search query. + :keyword query_language: The language of the search query. + :keyword speller: The type of the speller to use to spell-correct individual search query terms. + :keyword query_rewrites: Whether query rewrites should be generated to augment the search query. + :keyword semantic_fields: The list of field names used for semantic ranking. + :keyword hybrid_search: The query parameters to configure hybrid search behaviors. :keyword semantic_error_mode: The semantic error handling mode to use for the search query. :keyword int semantic_max_wait_in_milliseconds: The maximum wait time in milliseconds for semantic search. :keyword debug: The debug mode for the search query. @@ -214,6 +224,11 @@ def _build_search_request( scoring_statistics=scoring_statistics, vector_queries=vector_queries, vector_filter_mode=vector_filter_mode, + query_language=query_language, + query_speller=speller, + query_rewrites=query_rewrites, + semantic_fields=semantic_fields, + hybrid_search=hybrid_search, semantic_error_handling=semantic_error_mode, semantic_max_wait_in_milliseconds=semantic_max_wait_in_milliseconds, debug=debug, @@ -233,7 +248,7 @@ def __init__(self, client, initial_request: SearchRequest, kwargs, continuation_ 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", "2026-04-01") + self._api_version = kwargs.get("api_version", "2026-05-01-preview") def _get_next_cb(self, continuation_token): if continuation_token is None: @@ -277,6 +292,12 @@ def get_answers(self) -> Optional[List[_models.QueryAnswerResult]]: response = cast(SearchDocumentsResult, self._response) return cast(Optional[List[_models.QueryAnswerResult]], response.answers) + @_ensure_response + def get_debug_info(self) -> Optional[_models.DebugInfo]: + self.continuation_token = None + response = cast(SearchDocumentsResult, self._response) + return response.debug_info + class SearchItemPaged(ItemPaged[ReturnType]): """A pageable list of search results.""" @@ -331,6 +352,14 @@ def get_answers(self) -> Optional[List[_models.QueryAnswerResult]]: """ return cast(Optional[List[_models.QueryAnswerResult]], self._first_iterator_instance().get_answers()) + def get_debug_info(self) -> _models.DebugInfo: + """Return the debug information for the query. + + :return: the debug information for the query + :rtype: ~azure.search.documents.models.DebugInfo + """ + return cast(_models.DebugInfo, self._first_iterator_instance().get_debug_info()) + class _SearchClientOperationsMixin(_SearchClientOperationsMixinGenerated): """SearchClient operations mixin customizations.""" @@ -519,9 +548,16 @@ def search( session_id: Optional[str] = None, vector_queries: Optional[List[_models.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models.VectorFilterMode]] = None, + query_language: Optional[Union[str, _models.QueryLanguage]] = None, + speller: Optional[Union[str, _models.QuerySpellerType]] = None, + query_rewrites: Optional[Union[str, _models.QueryRewritesType]] = None, + semantic_fields: Optional[List[str]] = None, + hybrid_search: Optional[_models.HybridSearch] = None, semantic_error_mode: Optional[Union[str, _models.SemanticErrorMode]] = None, semantic_max_wait_in_milliseconds: Optional[int] = None, debug: Optional[Union[str, _models.QueryDebugMode]] = None, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, **kwargs: Any, ) -> SearchItemPaged[Dict]: # pylint:disable=too-many-locals @@ -622,13 +658,31 @@ def search( :keyword int 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. :keyword debug: Enables a debugging tool that can be used to further explore your Semantic search - results. Known values are: "disabled", "speller", "semantic", and "all". + results. Known values are: "disabled", "semantic", "vector", "queryRewrites", "innerHits", + and "all". :paramtype debug: str or ~azure.search.documents.models.QueryDebugMode :keyword vector_queries: The query parameters for vector and hybrid search queries. :paramtype vector_queries: list[~azure.search.documents.models.VectorQuery] :keyword vector_filter_mode: Determines whether or not filters are applied before or after the vector search is performed. Default is 'preFilter'. Known values are: "postFilter" and "preFilter". :paramtype vector_filter_mode: str or ~azure.search.documents.models.VectorFilterMode + :keyword query_language: A value that specifies the language of the search query. + :paramtype query_language: str or ~azure.search.documents.models.QueryLanguage + :keyword speller: A value that specifies the type of the speller to use to spell-correct + individual search query terms. + :paramtype speller: str or ~azure.search.documents.models.QuerySpellerType + :keyword query_rewrites: A value that specifies whether query rewrites should be generated to + augment the search query. + :paramtype query_rewrites: str or ~azure.search.documents.models.QueryRewritesType + :keyword semantic_fields: The list of field names used for semantic ranking. + :paramtype semantic_fields: list[str] + :keyword hybrid_search: The query parameters to configure hybrid search behaviors. + :paramtype hybrid_search: ~azure.search.documents.models.HybridSearch + :keyword query_source_authorization: Token identifying the user for which the query is being executed. + :paramtype query_source_authorization: str + :keyword enable_elevated_read: A value that enables elevated read that bypasses document-level + permission checks for the query operation. + :paramtype enable_elevated_read: bool :return: List of search results. :rtype: SearchItemPaged[dict] @@ -689,6 +743,11 @@ def search( session_id=session_id, vector_queries=vector_queries, vector_filter_mode=vector_filter_mode, + query_language=query_language, + speller=speller, + query_rewrites=query_rewrites, + semantic_fields=semantic_fields, + hybrid_search=hybrid_search, semantic_error_mode=semantic_error_mode, semantic_max_wait_in_milliseconds=semantic_max_wait_in_milliseconds, debug=debug, @@ -696,6 +755,16 @@ def search( # Create kwargs for the search_post call search_kwargs = dict(kwargs) + legacy_query_source_authorization = search_kwargs.pop("x_ms_query_source_authorization", None) + legacy_enable_elevated_read = search_kwargs.pop("x_ms_enable_elevated_read", None) + if query_source_authorization is None: + query_source_authorization = legacy_query_source_authorization + if enable_elevated_read is None: + enable_elevated_read = legacy_enable_elevated_read + if query_source_authorization is not None: + search_kwargs["query_source_authorization"] = query_source_authorization + if enable_elevated_read is not None: + search_kwargs["enable_elevated_read"] = enable_elevated_read return SearchItemPaged(self, search_request, search_kwargs, page_iterator_class=SearchPageIterator) 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 9dcbc461b0a0..c05f9214163a 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" V2026_04_01 = "2026-04-01" + V2026_05_01_PREVIEW = "2026-05-01-preview" -DEFAULT_VERSION = ApiVersion.V2026_04_01 +DEFAULT_VERSION = ApiVersion.V2026_05_01_PREVIEW class SearchClient(_SearchClient): @@ -57,9 +58,9 @@ class SearchClient(_SearchClient): ~azure.core.credentials.TokenCredential :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 "2026-04-01" - and None. Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-01-preview" and None. Default value is "2026-05-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword str audience: Sets the Audience to use for authentication with Microsoft Entra ID. The audience is not considered when using a shared key. If audience is not provided, the public cloud diff --git a/sdk/search/azure-search-documents/azure/search/documents/_version.py b/sdk/search/azure-search-documents/azure/search/documents/_version.py index 529e7b9073b9..c82d639e1b3b 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_version.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_version.py @@ -3,6 +3,6 @@ # Licensed under the MIT License. # ------------------------------------ -VERSION = "12.0.1" # type: str +VERSION = "12.1.0b1" # type: str SDK_MONIKER = "search-documents/{}".format(VERSION) # type: str 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 02472c79cd47..8061b6154eff 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 @@ -55,7 +55,7 @@ def __init__(self, client, initial_request: SearchRequest, kwargs, continuation_ 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", "2026-04-01") + self._api_version = kwargs.get("api_version", "2026-05-01-preview") async def _get_next_cb(self, continuation_token): if continuation_token is None: @@ -101,6 +101,12 @@ async def get_answers(self) -> Optional[List[_models.QueryAnswerResult]]: response = cast(SearchDocumentsResult, self._response) return response.answers + @_ensure_response + async def get_debug_info(self) -> Optional[_models.DebugInfo]: + self.continuation_token = None + response = cast(SearchDocumentsResult, self._response) + return response.debug_info + class AsyncSearchItemPaged(AsyncItemPaged[ReturnType]): """An async pageable list of search results.""" @@ -163,6 +169,14 @@ async def get_answers(self) -> Optional[List[_models.QueryAnswerResult]]: """ return cast(Optional[List[_models.QueryAnswerResult]], await self._first_iterator_instance().get_answers()) + async def get_debug_info(self) -> _models.DebugInfo: + """Return the debug information for the query. + + :return: the debug information for the query + :rtype: ~azure.search.documents.models.DebugInfo + """ + return cast(_models.DebugInfo, await self._first_iterator_instance().get_debug_info()) + class _SearchClientOperationsMixin(_SearchClientOperationsMixinGenerated): """Async SearchClient operations mixin customizations.""" @@ -352,9 +366,16 @@ async def search( session_id: Optional[str] = None, vector_queries: Optional[List[_models.VectorQuery]] = None, vector_filter_mode: Optional[Union[str, _models.VectorFilterMode]] = None, + query_language: Optional[Union[str, _models.QueryLanguage]] = None, + speller: Optional[Union[str, _models.QuerySpellerType]] = None, + query_rewrites: Optional[Union[str, _models.QueryRewritesType]] = None, + semantic_fields: Optional[List[str]] = None, + hybrid_search: Optional[_models.HybridSearch] = None, semantic_error_mode: Optional[Union[str, _models.SemanticErrorMode]] = None, semantic_max_wait_in_milliseconds: Optional[int] = None, debug: Optional[Union[str, _models.QueryDebugMode]] = None, + query_source_authorization: Optional[str] = None, + enable_elevated_read: Optional[bool] = None, **kwargs: Any, ) -> AsyncSearchItemPaged[Dict]: # pylint:disable=too-many-locals @@ -455,13 +476,31 @@ async def search( :keyword int 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. :keyword debug: Enables a debugging tool that can be used to further explore your Semantic search - results. Known values are: "disabled", "speller", "semantic", and "all". + results. Known values are: "disabled", "semantic", "vector", "queryRewrites", "innerHits", + and "all". :paramtype debug: str or ~azure.search.documents.models.QueryDebugMode :keyword vector_queries: The query parameters for vector and hybrid search queries. :paramtype vector_queries: list[~azure.search.documents.models.VectorQuery] :keyword vector_filter_mode: Determines whether or not filters are applied before or after the vector search is performed. Default is 'preFilter'. Known values are: "postFilter" and "preFilter". :paramtype vector_filter_mode: str or ~azure.search.documents.models.VectorFilterMode + :keyword query_language: A value that specifies the language of the search query. + :paramtype query_language: str or ~azure.search.documents.models.QueryLanguage + :keyword speller: A value that specifies the type of the speller to use to spell-correct + individual search query terms. + :paramtype speller: str or ~azure.search.documents.models.QuerySpellerType + :keyword query_rewrites: A value that specifies whether query rewrites should be generated to + augment the search query. + :paramtype query_rewrites: str or ~azure.search.documents.models.QueryRewritesType + :keyword semantic_fields: The list of field names used for semantic ranking. + :paramtype semantic_fields: list[str] + :keyword hybrid_search: The query parameters to configure hybrid search behaviors. + :paramtype hybrid_search: ~azure.search.documents.models.HybridSearch + :keyword query_source_authorization: Token identifying the user for which the query is being executed. + :paramtype query_source_authorization: str + :keyword enable_elevated_read: A value that enables elevated read that bypasses document-level + permission checks for the query operation. + :paramtype enable_elevated_read: bool :return: A list of documents (dicts) matching the specified search criteria. :return: List of search results. :rtype: AsyncSearchItemPaged[dict] @@ -523,6 +562,11 @@ async def search( session_id=session_id, vector_queries=vector_queries, vector_filter_mode=vector_filter_mode, + query_language=query_language, + speller=speller, + query_rewrites=query_rewrites, + semantic_fields=semantic_fields, + hybrid_search=hybrid_search, semantic_error_mode=semantic_error_mode, semantic_max_wait_in_milliseconds=semantic_max_wait_in_milliseconds, debug=debug, @@ -530,6 +574,16 @@ async def search( # Create kwargs for the search_post call search_kwargs = dict(kwargs) + legacy_query_source_authorization = search_kwargs.pop("x_ms_query_source_authorization", None) + legacy_enable_elevated_read = search_kwargs.pop("x_ms_enable_elevated_read", None) + if query_source_authorization is None: + query_source_authorization = legacy_query_source_authorization + if enable_elevated_read is None: + enable_elevated_read = legacy_enable_elevated_read + if query_source_authorization is not None: + search_kwargs["query_source_authorization"] = query_source_authorization + if enable_elevated_read is not None: + search_kwargs["enable_elevated_read"] = enable_elevated_read return AsyncSearchItemPaged(self, search_request, search_kwargs, page_iterator_class=AsyncSearchPageIterator) diff --git a/sdk/search/azure-search-documents/azure/search/documents/aio/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/aio/_patch.py index b569f9509dc9..fe6e26f0bcc7 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/aio/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/aio/_patch.py @@ -35,9 +35,9 @@ class SearchClient(_SearchClient): ~azure.core.credentials_async.AsyncTokenCredential :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 "2026-04-01" - and None. Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-01-preview" and None. Default value is "2026-05-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword str audience: Sets the Audience to use for authentication with Microsoft Entra ID. The audience is not considered when using a shared key. If audience is not provided, the public cloud 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 c1f60e96e76f..3f557c358df6 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 @@ -2512,7 +2512,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - list[_models1._models.SearchIndexResponse], + list[_models1._models.SearchIndexResponse], # pylint: disable=protected-access deserialized.get("value", []), ) if cls: diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py index b48c74d087df..44aadaa24a59 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_operations/_patch.py @@ -9,7 +9,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ from collections.abc import MutableMapping # pylint: disable=import-error -from typing import Any, cast, List, Sequence, Union, Optional, TYPE_CHECKING +from typing import Any, cast, IO, List, Sequence, Union, Optional, TYPE_CHECKING from azure.core import MatchConditions from azure.core.paging import ItemPaged @@ -53,6 +53,8 @@ def _convert_index_response(response: _SearchIndexResponse) -> _models.SearchInd similarity=response.similarity, semantic_search=response.semantic_search, vector_search=response.vector_search, + permission_filter_option=response.permission_filter_option, + purview_enabled=response.purview_enabled, e_tag=response.e_tag, ) @@ -369,13 +371,29 @@ def delete_knowledge_source( ) @distributed_trace - def list_indexes(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> ItemPaged[_models.SearchIndex]: + def list_indexes( + self, + *, + select: Optional[List[str]] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + count: Optional[bool] = None, + **kwargs: Any, + ) -> ItemPaged[_models.SearchIndex]: """Lists all indexes available for a search service. :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated list of JSON property names, or '*' for all properties. The default is all properties. Default value is None. :paramtype select: list[str] + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool :return: An iterator like instance of SearchIndex :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex] :raises ~azure.core.exceptions.HttpResponseError: @@ -385,21 +403,39 @@ def list_indexes(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> ItemPaged[_models.SearchIndex], self._list_indexes_with_selected_properties( select=select, + top=top, + skip=skip, + count=count, cls=lambda objs: [_convert_index_response(x) for x in objs], **kwargs, ), ) - return self._list_indexes(**kwargs) + return cast(ItemPaged[_models.SearchIndex], self._list_indexes(top=top, skip=skip, count=count, **kwargs)) @distributed_trace - def list_index_names(self, **kwargs: Any) -> ItemPaged[str]: + def list_index_names( + self, + *, + top: Optional[int] = None, + skip: Optional[int] = None, + count: Optional[bool] = None, + **kwargs: Any, + ) -> ItemPaged[str]: """Lists the names of all indexes available for a search service. + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool :return: An iterator like instance of index names :rtype: ~azure.core.paging.ItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ - names = self._list_indexes(cls=lambda objs: [x.name for x in objs], **kwargs) + names = self._list_indexes(top=top, skip=skip, count=count, cls=lambda objs: [x.name for x in objs], **kwargs) return cast(ItemPaged[str], names) @distributed_trace @@ -545,6 +581,7 @@ def create_or_update_data_source_connection( self, data_source_connection: Union[_models.SearchIndexerDataSourceConnection, JSON], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any, ) -> _models.SearchIndexerDataSourceConnection: @@ -552,6 +589,8 @@ def create_or_update_data_source_connection( :param data_source_connection: The SearchIndexerDataSourceConnection object to create or update. Required. :type data_source_connection: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or JSON + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions :return: SearchIndexerDataSourceConnection @@ -564,6 +603,7 @@ def create_or_update_data_source_connection( name=data_source_connection.name, data_source=data_source_connection, prefer="return=representation", + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, etag=data_source_connection.e_tag, match_condition=match_condition, **kwargs, @@ -607,6 +647,8 @@ def create_or_update_indexer( self, indexer: Union[_models.SearchIndexer, JSON], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any, ) -> _models.SearchIndexer: @@ -614,6 +656,11 @@ def create_or_update_indexer( :param indexer: The SearchIndexer object to create or update. Required. :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or JSON + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool + :keyword disable_cache_reprocessing_change_detection: Disables cache reprocessing change + detection. Default value is None. + :paramtype disable_cache_reprocessing_change_detection: bool :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions :return: SearchIndexer @@ -626,11 +673,58 @@ def create_or_update_indexer( name=indexer.name, indexer=indexer, prefer="return=representation", + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, + disable_cache_reprocessing_change_detection=disable_cache_reprocessing_change_detection, etag=indexer.e_tag, match_condition=match_condition, **kwargs, ) + @distributed_trace + def resync( + self, + name: str, + indexer_resync: Union[_models.IndexerResyncBody, JSON, IO[bytes]], + **kwargs: Any, + ) -> None: + """Resync selective options from the datasource to be re-ingested by the indexer. + + :param name: The name of the indexer. Required. + :type name: str + :param indexer_resync: The definition of the indexer resync options. Required. + :type indexer_resync: ~azure.search.documents.indexes.models.IndexerResyncBody or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + return self._resync(name=name, indexer_resync=indexer_resync, **kwargs) + + @distributed_trace + def reset_documents( + self, + name: str, + keys_or_ids: Optional[Union[_models.DocumentKeysOrIds, JSON, IO[bytes]]] = None, + *, + overwrite: Optional[bool] = None, + **kwargs: Any, + ) -> None: + """Resets specific documents in the datasource to be selectively re-ingested by the indexer. + + :param name: The name of the indexer. Required. + :type name: str + :param keys_or_ids: The keys or ids of the documents to be re-ingested. If keys are provided, + the document key field must be specified in the indexer configuration. If ids are provided, + the document key field is ignored. Default value is None. + :type keys_or_ids: ~azure.search.documents.indexes.models.DocumentKeysOrIds or JSON or IO[bytes] + :keyword overwrite: If false, keys or ids will be appended to existing ones. If true, only the + keys or ids in this payload will be queued to be re-ingested. Default value is None. + :paramtype overwrite: bool + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + return self._reset_documents(name=name, keys_or_ids=keys_or_ids, overwrite=overwrite, **kwargs) + @distributed_trace def delete_skillset( self, @@ -669,6 +763,8 @@ def create_or_update_skillset( self, skillset: Union[_models.SearchIndexerSkillset, JSON], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any, ) -> _models.SearchIndexerSkillset: @@ -676,6 +772,11 @@ def create_or_update_skillset( :param skillset: The SearchIndexerSkillset object to create or update. Required. :type skillset: ~azure.search.documents.indexes.models.SearchIndexerSkillset or JSON + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool + :keyword disable_cache_reprocessing_change_detection: Disables cache reprocessing change + detection. Default value is None. + :paramtype disable_cache_reprocessing_change_detection: bool :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions :return: SearchIndexerSkillset @@ -688,11 +789,33 @@ def create_or_update_skillset( name=skillset.name, skillset=skillset, prefer="return=representation", + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, + disable_cache_reprocessing_change_detection=disable_cache_reprocessing_change_detection, etag=skillset.e_tag, match_condition=match_condition, **kwargs, ) + @distributed_trace + def reset_skills( + self, + name: str, + skill_names: Union[_models.SkillNames, JSON, IO[bytes]], + **kwargs: Any, + ) -> None: + """Reset an existing skillset in a search service. + + :param name: The name of the skillset. Required. + :type name: str + :param skill_names: The names of the skills to reset. If not specified, all skills in the + skillset will be reset. Required. + :type skill_names: ~azure.search.documents.indexes.models.SkillNames or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + return self._reset_skills(name=name, skill_names=skill_names, **kwargs) + @distributed_trace def get_skillsets( self, *, select: Optional[List[str]] = None, **kwargs: Any diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_patch.py index 0d7690d7a688..5ba79d67feee 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_patch.py @@ -24,9 +24,9 @@ class SearchIndexClient(_SearchIndexClient): 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 "2026-04-01" - and None. Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-01-preview" and None. Default value is "2026-05-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword str audience: Sets the Audience to use for authentication with Microsoft Entra ID. The audience is not considered when using a shared key. If audience is not provided, the public cloud @@ -49,9 +49,9 @@ class SearchIndexerClient(_SearchIndexerClient): 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 "2026-04-01" - and None. Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-01-preview" and None. Default value is "2026-05-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword str audience: Sets the Audience to use for authentication with Microsoft Entra ID. The audience is not considered when using a shared key. If audience is not provided, the public cloud 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 8dd72cbb87d1..5e7b4920c6df 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 @@ -1042,7 +1042,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - list[_models2._models.SearchIndexResponse], + list[_models2._models.SearchIndexResponse], # pylint: disable=protected-access deserialized.get("value", []), ) if cls: diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py index 261ad68aa474..46ccf4742626 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_operations/_patch.py @@ -9,7 +9,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ from collections.abc import MutableMapping # pylint: disable=import-error -from typing import Any, cast, List, Sequence, Union, Optional, TYPE_CHECKING +from typing import Any, cast, IO, List, Sequence, Union, Optional, TYPE_CHECKING from azure.core import MatchConditions from azure.core.async_paging import AsyncItemPaged @@ -351,13 +351,29 @@ async def delete_knowledge_source( ) @distributed_trace - def list_indexes(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> AsyncItemPaged[_models.SearchIndex]: + def list_indexes( + self, + *, + select: Optional[List[str]] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + count: Optional[bool] = None, + **kwargs: Any, + ) -> AsyncItemPaged[_models.SearchIndex]: """Lists all indexes available for a search service. :keyword select: Selects which top-level properties to retrieve. Specified as a comma-separated list of JSON property names, or '*' for all properties. The default is all properties. Default value is None. :paramtype select: list[str] + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool :return: An async iterator like instance of SearchIndex :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndex] :raises ~azure.core.exceptions.HttpResponseError: @@ -367,21 +383,39 @@ def list_indexes(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> AsyncItemPaged[_models.SearchIndex], self._list_indexes_with_selected_properties( select=select, + top=top, + skip=skip, + count=count, cls=lambda objs: [_convert_index_response(x) for x in objs], **kwargs, ), ) - return self._list_indexes(**kwargs) + return cast(AsyncItemPaged[_models.SearchIndex], self._list_indexes(top=top, skip=skip, count=count, **kwargs)) @distributed_trace - def list_index_names(self, **kwargs: Any) -> AsyncItemPaged[str]: + def list_index_names( + self, + *, + top: Optional[int] = None, + skip: Optional[int] = None, + count: Optional[bool] = None, + **kwargs: Any, + ) -> AsyncItemPaged[str]: """Lists the names of all indexes available for a search service. + :keyword top: The number of items to retrieve. Default is 50, maximum is 1000. Default value is + None. + :paramtype top: int + :keyword skip: The number of items to skip. Default value is None. + :paramtype skip: int + :keyword count: A value that specifies whether to fetch the total count of items. Default is + false. Default value is None. + :paramtype count: bool :return: An async iterator like instance of index names :rtype: ~azure.core.async_paging.AsyncItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ - names = self._list_indexes(cls=lambda objs: [x.name for x in objs], **kwargs) + names = self._list_indexes(top=top, skip=skip, count=count, cls=lambda objs: [x.name for x in objs], **kwargs) return cast(AsyncItemPaged[str], names) @distributed_trace_async @@ -526,6 +560,7 @@ async def create_or_update_data_source_connection( self, data_source_connection: Union[_models.SearchIndexerDataSourceConnection, JSON], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any, ) -> _models.SearchIndexerDataSourceConnection: @@ -533,6 +568,8 @@ async def create_or_update_data_source_connection( :param data_source_connection: The SearchIndexerDataSourceConnection object to create or update. Required. :type data_source_connection: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or JSON + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions :return: SearchIndexerDataSourceConnection @@ -545,6 +582,7 @@ async def create_or_update_data_source_connection( name=data_source_connection.name, data_source=data_source_connection, prefer="return=representation", + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, match_condition=match_condition, etag=data_source_connection.e_tag, **kwargs, @@ -588,6 +626,8 @@ async def create_or_update_indexer( self, indexer: Union[_models.SearchIndexer, JSON], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any, ) -> _models.SearchIndexer: @@ -595,6 +635,11 @@ async def create_or_update_indexer( :param indexer: The SearchIndexer object to create or update. Required. :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or JSON + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool + :keyword disable_cache_reprocessing_change_detection: Disables cache reprocessing change + detection. Default value is None. + :paramtype disable_cache_reprocessing_change_detection: bool :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions :return: SearchIndexer @@ -607,11 +652,58 @@ async def create_or_update_indexer( name=indexer.name, indexer=indexer, prefer="return=representation", + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, + disable_cache_reprocessing_change_detection=disable_cache_reprocessing_change_detection, match_condition=match_condition, etag=indexer.e_tag, **kwargs, ) + @distributed_trace_async + async def resync( + self, + name: str, + indexer_resync: Union[_models.IndexerResyncBody, JSON, IO[bytes]], + **kwargs: Any, + ) -> None: + """Resync selective options from the datasource to be re-ingested by the indexer. + + :param name: The name of the indexer. Required. + :type name: str + :param indexer_resync: The definition of the indexer resync options. Required. + :type indexer_resync: ~azure.search.documents.indexes.models.IndexerResyncBody or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + return await self._resync(name=name, indexer_resync=indexer_resync, **kwargs) + + @distributed_trace_async + async def reset_documents( + self, + name: str, + keys_or_ids: Optional[Union[_models.DocumentKeysOrIds, JSON, IO[bytes]]] = None, + *, + overwrite: Optional[bool] = None, + **kwargs: Any, + ) -> None: + """Resets specific documents in the datasource to be selectively re-ingested by the indexer. + + :param name: The name of the indexer. Required. + :type name: str + :param keys_or_ids: The keys or ids of the documents to be re-ingested. If keys are provided, + the document key field must be specified in the indexer configuration. If ids are provided, + the document key field is ignored. Default value is None. + :type keys_or_ids: ~azure.search.documents.indexes.models.DocumentKeysOrIds or JSON or IO[bytes] + :keyword overwrite: If false, keys or ids will be appended to existing ones. If true, only the + keys or ids in this payload will be queued to be re-ingested. Default value is None. + :paramtype overwrite: bool + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + return await self._reset_documents(name=name, keys_or_ids=keys_or_ids, overwrite=overwrite, **kwargs) + @distributed_trace_async async def delete_skillset( self, @@ -650,6 +742,8 @@ async def create_or_update_skillset( self, skillset: Union[_models.SearchIndexerSkillset, JSON], *, + skip_indexer_reset_requirement_for_cache: Optional[bool] = None, + disable_cache_reprocessing_change_detection: Optional[bool] = None, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any, ) -> _models.SearchIndexerSkillset: @@ -657,6 +751,11 @@ async def create_or_update_skillset( :param skillset: The SearchIndexerSkillset object to create or update. Required. :type skillset: ~azure.search.documents.indexes.models.SearchIndexerSkillset or JSON + :keyword skip_indexer_reset_requirement_for_cache: Ignores cache reset requirements. Default value is None. + :paramtype skip_indexer_reset_requirement_for_cache: bool + :keyword disable_cache_reprocessing_change_detection: Disables cache reprocessing change + detection. Default value is None. + :paramtype disable_cache_reprocessing_change_detection: bool :keyword match_condition: The match condition to use upon the etag. Default value is None. :paramtype match_condition: ~azure.core.MatchConditions :return: SearchIndexerSkillset @@ -669,11 +768,33 @@ async def create_or_update_skillset( name=skillset.name, skillset=skillset, prefer="return=representation", + skip_indexer_reset_requirement_for_cache=skip_indexer_reset_requirement_for_cache, + disable_cache_reprocessing_change_detection=disable_cache_reprocessing_change_detection, match_condition=match_condition, etag=skillset.e_tag, **kwargs, ) + @distributed_trace_async + async def reset_skills( + self, + name: str, + skill_names: Union[_models.SkillNames, JSON, IO[bytes]], + **kwargs: Any, + ) -> None: + """Reset an existing skillset in a search service. + + :param name: The name of the skillset. Required. + :type name: str + :param skill_names: The names of the skills to reset. If not specified, all skills in the + skillset will be reset. Required. + :type skill_names: ~azure.search.documents.indexes.models.SkillNames or JSON or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + return await self._reset_skills(name=name, skill_names=skill_names, **kwargs) + @distributed_trace_async async def get_skillsets( self, *, select: Optional[List[str]] = None, **kwargs: Any diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_patch.py index 0388b8323482..61a01128e974 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/aio/_patch.py @@ -25,9 +25,9 @@ class SearchIndexClient(_SearchIndexClient): 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 "2026-04-01" - and None. Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-01-preview" and None. Default value is "2026-05-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword str audience: Sets the Audience to use for authentication with Microsoft Entra ID. The audience is not considered when using a shared key. If audience is not provided, the public cloud @@ -52,9 +52,9 @@ class SearchIndexerClient(_SearchIndexerClient): 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 "2026-04-01" - and None. Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-01-preview" and None. Default value is "2026-05-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword str audience: Sets the Audience to use for authentication with Microsoft Entra ID. The audience is not considered when using a shared key. If audience is not provided, the public cloud diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_patch.py index 0464a4f98c4a..f6e9aade4a1c 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_patch.py @@ -25,9 +25,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClient): ~azure.core.credentials.TokenCredential :param knowledge_base_name: The name of the knowledge base. Required. :type knowledge_base_name: str - :keyword api_version: The API version to use for this operation. Known values are "2026-04-01" - and None. Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-01-preview" and None. Default value is "2026-05-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword str audience: Sets the Audience to use for authentication with Microsoft Entra ID. The audience is not considered when using a shared key. If audience is not provided, the public cloud diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_patch.py index 5a69656c99ec..df6bca6e1dda 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_patch.py @@ -26,9 +26,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClient): ~azure.core.credentials_async.AsyncTokenCredential :param knowledge_base_name: The name of the knowledge base. Required. :type knowledge_base_name: str - :keyword api_version: The API version to use for this operation. Known values are "2026-04-01" - and None. Default value is "2026-04-01". Note that overriding this default value may result in - unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-05-01-preview" and None. Default value is "2026-05-01-preview". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword str audience: Sets the Audience to use for authentication with Microsoft Entra ID. The audience is not considered when using a shared key. If audience is not provided, the public cloud diff --git a/sdk/search/azure-search-documents/azure/search/documents/models/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/models/_patch.py index 264ae9ac9a63..ec5d6fa0da16 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/models/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/models/_patch.py @@ -11,9 +11,9 @@ from typing import Any, Dict, List, Tuple, Union, cast, Optional from azure.core.exceptions import HttpResponseError -from ._models import IndexDocumentsBatch as IndexDocumentsBatchGenerated -from ._models import IndexAction from ._enums import IndexActionType +from ._models import IndexAction +from ._models import IndexDocumentsBatch as IndexDocumentsBatchGenerated def _flatten_args(args: Tuple[Union[List[Dict[Any, Any]], List[List[Dict[Any, Any]]]], ...]) -> List[Dict]: diff --git a/sdk/search/azure-search-documents/mypy.ini b/sdk/search/azure-search-documents/mypy.ini index 034deb97d8dd..630f557faea8 100644 --- a/sdk/search/azure-search-documents/mypy.ini +++ b/sdk/search/azure-search-documents/mypy.ini @@ -10,6 +10,8 @@ ignore_missing_imports = True ignore_errors = True follow_imports = skip +[mypy-azure.search.documents._validation] +warn_return_any = False + [mypy-azure.core.*] ignore_errors = True - diff --git a/sdk/search/azure-search-documents/tests/_capabilities.py b/sdk/search/azure-search-documents/tests/_capabilities.py new file mode 100644 index 000000000000..ba1d2cba4a78 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/_capabilities.py @@ -0,0 +1,369 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Capability gates for preview-only test scenarios. + +See ``.github/skills/azure-search-documents/references/testing.md`` for the convention. +""" + +from __future__ import annotations + +import enum +import importlib +import inspect +from typing import Any, Mapping + +import pytest + +PREVIEW = "2026-05-01-preview" + + +def _surface(owner: str, kwargs: tuple = (), available_from: str = PREVIEW) -> Mapping[str, Any]: + return {"owner": owner, "kwargs": kwargs, "available_from": available_from} + + +# Module aliases to keep the table compact. +_IM = "azure.search.documents.indexes.models" +_KBM = "azure.search.documents.knowledgebases.models" +_M = "azure.search.documents.models" +_IDX = "azure.search.documents.indexes" + + +def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: + """One entry per new public model class (existence-only) and per new field on existing models.""" + entries: dict = {} + + # New knowledge-source / parameter / supporting model classes. + new_classes = [ + # IndexedSql + f"{_IM}.IndexedSqlKnowledgeSource", + f"{_IM}.IndexedSqlKnowledgeSourceParameters", + f"{_IM}.ContentColumnMapping", + f"{_IM}.EmbeddingColumnMapping", + # WorkIQ (parameters live in knowledgebases.models) + f"{_IM}.WorkIQKnowledgeSource", + f"{_KBM}.WorkIQKnowledgeSourceParams", + # File + f"{_IM}.FileKnowledgeSource", + f"{_IM}.FileKnowledgeSourceParameters", + # MCP server + f"{_IM}.McpServerKnowledgeSource", + f"{_IM}.McpServerKnowledgeSourceParameters", + f"{_IM}.McpServerAuthentication", + f"{_IM}.McpServerFoundryConnectionAuthentication", + f"{_IM}.McpServerFoundryConnectionParameters", + f"{_IM}.McpServerStoredHeadersAuthentication", + f"{_IM}.McpServerStoredHeadersParameters", + f"{_IM}.McpServerHeaders", + f"{_IM}.McpServerTool", + f"{_IM}.McpServerOutputParsing", + f"{_IM}.McpServerAutoOutputParsing", + f"{_IM}.McpServerJsonOutputParsing", + f"{_IM}.McpServerOutputParsingJsonParameters", + f"{_IM}.McpServerSplitOutputParsing", + f"{_IM}.McpServerOutputParsingSplitParameters", + f"{_IM}.McpServerNoneOutputParsing", + # Fabric Data Agent / Ontology + f"{_IM}.FabricDataAgentKnowledgeSource", + f"{_IM}.FabricDataAgentKnowledgeSourceParameters", + f"{_IM}.FabricOntologyKnowledgeSource", + f"{_IM}.FabricOntologyKnowledgeSourceParameters", + # SharePoint family (re-introduced preview) + f"{_IM}.IndexedSharePointKnowledgeSource", + f"{_IM}.IndexedSharePointKnowledgeSourceParameters", + f"{_IM}.RemoteSharePointKnowledgeSource", + f"{_IM}.RemoteSharePointKnowledgeSourceParameters", + # Skills + f"{_IM}.AzureMachineLearningSkill", + f"{_IM}.ChatCompletionSkill", + f"{_IM}.ChatCompletionCommonModelParameters", + f"{_IM}.ChatCompletionResponseFormat", + f"{_IM}.ChatCompletionSchema", + f"{_IM}.ChatCompletionSchemaProperties", + f"{_IM}.VisionVectorizeSkill", + # Indexer cache + f"{_IM}.SearchIndexerCache", + f"{_IM}.ServiceIndexersRuntime", + # KB activity / reference / output mode types + f"{_KBM}.AIServices", + f"{_KBM}.AssetStore", + f"{_KBM}.FreshnessPolicy", + f"{_KBM}.KnowledgeSourceIngestionParameters", + f"{_KBM}.KnowledgeRetrievalLowReasoningEffort", + f"{_KBM}.KnowledgeRetrievalMediumReasoningEffort", + f"{_KBM}.KnowledgeRetrievalOutputMode", + f"{_KBM}.KnowledgeBaseModelQueryPlanningActivityRecord", + f"{_KBM}.KnowledgeBaseModelAnswerSynthesisActivityRecord", + f"{_KBM}.KnowledgeBaseModelWebSummarizationActivityRecord", + f"{_KBM}.KnowledgeBaseWorkIQReference", + f"{_KBM}.WorkIQAttribution", + f"{_KBM}.PurviewSensitivityLabelInfo", + # Permission filter and option types + f"{_IM}.SearchIndexPermissionFilterOption", + f"{_IM}.PermissionFilter", + # Debug / hybrid / search request types + f"{_M}.DebugInfo", + f"{_M}.HybridSearch", + f"{_M}.QueryResultDocumentRerankerInput", + f"{_M}.SemanticDebugInfo", + f"{_M}.DocumentDebugInfo", + ] + for dotted in new_classes: + entries[dotted] = _surface(dotted) + + # New fields on existing models. Key = ".", owner = dotted-class, kwargs = (field,). + field_additions = [ + (f"{_IM}.SearchIndex", "cors_options"), + (f"{_IM}.SearchIndex", "share_point_connector_app_registration"), + (f"{_IM}.SearchIndex", "permission_filter_option"), + (f"{_IM}.SearchIndex", "purview_enabled"), + (f"{_IM}.SearchField", "sensitivity_label_id"), + (f"{_IM}.SearchField", "sensitivity_label_name"), + (f"{_IM}.SearchField", "source_document_id"), + (f"{_IM}.SearchField", "sharepoint_site_url"), + (f"{_IM}.SearchField", "permission_filter"), + (f"{_IM}.SearchIndexer", "cache"), + (f"{_IM}.SearchIndexerDataSourceConnection", "sub_type"), + (f"{_IM}.SearchIndexerDataSourceConnection", "indexer_permission_options"), + (f"{_IM}.SearchIndexerStatus", "runtime"), + (f"{_IM}.SearchIndexerStatus", "current_state"), + (f"{_IM}.IndexerExecutionResult", "status_detail"), + (f"{_IM}.IndexerExecutionResult", "mode"), + (f"{_IM}.SearchIndexerKnowledgeStore", "parameters"), + (f"{_IM}.McpServerTool", "inclusion_mode"), + (f"{_IM}.McpServerTool", "max_output_tokens"), + (f"{_IM}.SearchResourceEncryptionKey", "is_service_level_key"), + (f"{_IM}.SearchIndexerDataUserAssignedIdentity", "federated_identity_client_id"), + (f"{_IM}.SemanticConfiguration", "flighting_opt_in"), + (f"{_IM}.KnowledgeBase", "cors_options"), + (f"{_IM}.KnowledgeBase", "retrieval_reasoning_effort"), + (f"{_IM}.KnowledgeBase", "output_mode"), + (f"{_IM}.KnowledgeBase", "retrieval_instructions"), + (f"{_IM}.KnowledgeBase", "answer_instructions"), + (f"{_IM}.KnowledgeSourceReference", "enable_image_serving"), + (f"{_IM}.KnowledgeSourceReference", "enable_freshness"), + (f"{_IM}.WebKnowledgeSourceParameters", "language"), + (f"{_IM}.WebKnowledgeSourceParameters", "market"), + (f"{_IM}.WebKnowledgeSourceParameters", "count"), + (f"{_IM}.WebKnowledgeSourceParameters", "freshness"), + (f"{_IM}.ContentUnderstandingSkillChunkingProperties", "method"), + (f"{_IM}.ContentUnderstandingSkillChunkingProperties", "unit"), + (f"{_IM}.SearchServiceCounters", "knowledge_base_counter"), + (f"{_IM}.SearchServiceCounters", "knowledge_source_counter"), + (f"{_IM}.SearchServiceStatistics", "indexers_runtime"), + (f"{_IM}.SplitSkill", "unit"), + (f"{_IM}.SplitSkill", "azure_open_ai_tokenizer_parameters"), + (f"{_KBM}.KnowledgeBaseRetrievalRequest", "messages"), + (f"{_KBM}.KnowledgeBaseRetrievalRequest", "max_output_size"), + (f"{_KBM}.KnowledgeBaseRetrievalRequest", "retrieval_reasoning_effort"), + (f"{_KBM}.KnowledgeBaseRetrievalRequest", "output_mode"), + (f"{_KBM}.KnowledgeBaseRetrievalRequest", "max_output_documents"), + (f"{_KBM}.KnowledgeBaseAzureBlobReference", "search_sensitivity_label_info"), + (f"{_KBM}.KnowledgeBaseIndexedOneLakeReference", "search_sensitivity_label_info"), + (f"{_KBM}.KnowledgeBaseIndexedSharePointReference", "search_sensitivity_label_info"), + (f"{_KBM}.KnowledgeBaseRemoteSharePointReference", "search_sensitivity_label_info"), + (f"{_KBM}.KnowledgeBaseSearchIndexReference", "search_sensitivity_label_info"), + (f"{_KBM}.KnowledgeSourceParams", "always_query_source"), + (f"{_KBM}.KnowledgeSourceParams", "fail_on_error"), + (f"{_KBM}.KnowledgeSourceParams", "max_output_documents"), + (f"{_KBM}.KnowledgeSourceParams", "enable_image_serving"), + (f"{_KBM}.KnowledgeSourceIngestionParameters", "ai_services"), + (f"{_KBM}.KnowledgeSourceIngestionParameters", "asset_store"), + (f"{_KBM}.KnowledgeSourceIngestionParameters", "freshness_policy"), + (f"{_M}.VectorizableTextQuery", "query_rewrites"), + (f"{_M}.VectorQuery", "threshold"), + (f"{_M}.VectorQuery", "filter_override"), + (f"{_M}.VectorQuery", "per_document_vector_limit"), + (f"{_M}.HybridSearch", "max_text_recall_size"), + (f"{_M}.HybridSearch", "count_and_facet_mode"), + (f"{_M}.FacetResult", "avg"), + (f"{_M}.FacetResult", "min"), + (f"{_M}.FacetResult", "max"), + (f"{_M}.FacetResult", "sum"), + (f"{_M}.FacetResult", "cardinality"), + (f"{_M}.FacetResult", "facets"), + (f"{_M}.DocumentDebugInfo", "inner_hits"), + (f"{_M}.DocumentDebugInfo", "semantic"), + (f"{_M}.SemanticDebugInfo", "reranker_input"), + ] + for owner, field in field_additions: + entries[f"{owner}.{field}"] = _surface(owner, kwargs=(field,)) + + # Enum member additions: key = enum dotted path + "." + member; owner = enum class; kwargs = (member,). + enum_additions = [ + (f"{_IM}.AzureOpenAIModelName", "GPT4_O"), + (f"{_IM}.AzureOpenAIModelName", "GPT4_O_MINI"), + (f"{_IM}.AzureOpenAIModelName", "GPT41"), + (f"{_IM}.AzureOpenAIModelName", "GPT41_MINI"), + (f"{_IM}.AzureOpenAIModelName", "GPT41_NANO"), + (f"{_IM}.AzureOpenAIModelName", "GPT5"), + (f"{_IM}.AzureOpenAIModelName", "GPT51"), + (f"{_IM}.AzureOpenAIModelName", "GPT52"), + (f"{_IM}.AzureOpenAIModelName", "GPT54"), + (f"{_IM}.ChatCompletionExtraParametersBehavior", "PASS_THROUGH"), + (f"{_IM}.ChatCompletionExtraParametersBehavior", "DROP"), + (f"{_IM}.ChatCompletionExtraParametersBehavior", "ERROR"), + (f"{_IM}.ChatCompletionResponseFormatType", "TEXT"), + (f"{_IM}.ChatCompletionResponseFormatType", "JSON_OBJECT"), + (f"{_IM}.ChatCompletionResponseFormatType", "JSON_SCHEMA"), + (f"{_IM}.ContentUnderstandingSkillChunkingUnit", "TOKENS"), + (f"{_IM}.KnowledgeSourceKind", "INDEXED_SQL"), + (f"{_IM}.KnowledgeSourceKind", "REMOTE_SHARE_POINT"), + (f"{_IM}.KnowledgeSourceKind", "WORK_IQ"), + (f"{_IM}.KnowledgeSourceKind", "FILE"), + (f"{_IM}.KnowledgeSourceKind", "MCP_SERVER"), + (f"{_IM}.KnowledgeSourceKind", "FABRIC_DATA_AGENT"), + (f"{_IM}.KnowledgeSourceKind", "FABRIC_ONTOLOGY"), + (f"{_IM}.McpServerAuthenticationKind", "FOUNDRY_CONNECTION"), + (f"{_IM}.McpServerAuthenticationKind", "STORED_HEADERS"), + (f"{_IM}.McpServerToolInclusionMode", "RERANKED"), + (f"{_IM}.McpServerToolInclusionMode", "ALWAYS"), + (f"{_KBM}.KnowledgeBaseActivityRecordType", "WORK_IQ"), + (f"{_KBM}.KnowledgeBaseActivityRecordType", "FABRIC_DATA_AGENT"), + (f"{_KBM}.KnowledgeBaseActivityRecordType", "FABRIC_ONTOLOGY"), + (f"{_KBM}.KnowledgeBaseActivityRecordType", "MODEL_WEB_SUMMARIZATION"), + (f"{_KBM}.KnowledgeBaseReferenceType", "WORK_IQ"), + (f"{_KBM}.KnowledgeBaseReferenceType", "FABRIC_DATA_AGENT"), + (f"{_KBM}.KnowledgeBaseReferenceType", "FABRIC_ONTOLOGY"), + (f"{_IM}.KnowledgeSourceIngestionPermissionOption", "SENSITIVITY_LABELS"), + (f"{_IM}.McpServerOutputParsingKind", "AUTO"), + (f"{_IM}.McpServerOutputParsingKind", "JSON"), + (f"{_IM}.McpServerOutputParsingKind", "SPLIT"), + (f"{_IM}.McpServerOutputParsingKind", "NONE"), + (f"{_IM}.SplitSkillUnit", "AZURE_OPEN_AI_TOKENS"), + ] + for owner, member in enum_additions: + entries[f"{owner}.{member}"] = _surface(owner, kwargs=(member,)) + + return entries + + +def _client_capabilities() -> Mapping[str, Mapping[str, Any]]: + entries: dict = {} + # Sync clients. + method_existence = [ + f"{_IDX}.SearchIndexerClient.resync", + f"{_IDX}.SearchIndexerClient.reset_documents", + f"{_IDX}.SearchIndexerClient.reset_skills", + f"{_IDX}.SearchIndexClient.list_index_stats_summary", + f"{_IDX}.aio.SearchIndexerClient.resync", + f"{_IDX}.aio.SearchIndexerClient.reset_documents", + f"{_IDX}.aio.SearchIndexerClient.reset_skills", + f"{_IDX}.aio.SearchIndexClient.list_index_stats_summary", + ] + for dotted in method_existence: + entries[dotted] = _surface(dotted) + + method_kwargs = [ + ( + f"{_IDX}.SearchIndexerClient.create_or_update_data_source_connection", + ("skip_indexer_reset_requirement_for_cache",), + ), + ( + f"{_IDX}.SearchIndexerClient.create_or_update_indexer", + ("skip_indexer_reset_requirement_for_cache", "disable_cache_reprocessing_change_detection"), + ), + ( + f"{_IDX}.SearchIndexerClient.create_or_update_skillset", + ("skip_indexer_reset_requirement_for_cache", "disable_cache_reprocessing_change_detection"), + ), + (f"{_IDX}.SearchIndexClient.list_indexes", ("top", "skip", "count")), + (f"{_IDX}.SearchIndexClient.list_index_names", ("top", "skip", "count")), + ( + f"{_IDX}.aio.SearchIndexerClient.create_or_update_data_source_connection", + ("skip_indexer_reset_requirement_for_cache",), + ), + ( + f"{_IDX}.aio.SearchIndexerClient.create_or_update_indexer", + ("skip_indexer_reset_requirement_for_cache", "disable_cache_reprocessing_change_detection"), + ), + ( + f"{_IDX}.aio.SearchIndexerClient.create_or_update_skillset", + ("skip_indexer_reset_requirement_for_cache", "disable_cache_reprocessing_change_detection"), + ), + (f"{_IDX}.aio.SearchIndexClient.list_indexes", ("top", "skip", "count")), + (f"{_IDX}.aio.SearchIndexClient.list_index_names", ("top", "skip", "count")), + ] + for dotted, kwargs in method_kwargs: + for kw in kwargs: + entries[f"{dotted}.{kw}"] = _surface(dotted, kwargs=(kw,)) + return entries + + +_CAPS: dict = { + "SearchClient.search.query_rewrites": _surface("azure.search.documents.SearchClient.search", ("query_rewrites",)), + "SearchClient.search.hybrid_search": _surface("azure.search.documents.SearchClient.search", ("hybrid_search",)), + "SearchClient.search.semantic_fields": _surface("azure.search.documents.SearchClient.search", ("semantic_fields",)), + "SearchClient.search.query_language": _surface("azure.search.documents.SearchClient.search", ("query_language",)), + "SearchClient.search.speller": _surface("azure.search.documents.SearchClient.search", ("speller",)), + "SearchClient.search.enable_elevated_read": _surface( + "azure.search.documents.SearchClient.search", ("enable_elevated_read",) + ), + "SearchClient.search.query_source_authorization": _surface( + "azure.search.documents.SearchClient.search", ("query_source_authorization",) + ), + "SearchItemPaged.get_debug_info": _surface("azure.search.documents.SearchItemPaged", ("get_debug_info",)), + "KnowledgeBaseRetrievalClient": _surface("azure.search.documents.knowledgebases.KnowledgeBaseRetrievalClient"), + "KnowledgeBaseRetrievalClient.aio": _surface( + "azure.search.documents.knowledgebases.aio.KnowledgeBaseRetrievalClient" + ), +} +_CAPS.update(_model_capabilities()) +_CAPS.update(_client_capabilities()) + +CAPABILITIES: Mapping[str, Mapping[str, Any]] = _CAPS + + +def _resolve(dotted: str) -> Any: + parts = dotted.split(".") + for i in range(len(parts), 0, -1): + try: + module = importlib.import_module(".".join(parts[:i])) + except ImportError: + continue + obj: Any = module + for name in parts[i:]: + obj = getattr(obj, name) + return obj + raise ImportError(f"Could not resolve {dotted!r}") + + +def _has_capability_attr(owner: Any, name: str) -> bool: + """Detect a capability attribute on a function, enum, or model class.""" + # Method/function signature parameters. + try: + if name in inspect.signature(owner).parameters: + return True + except (TypeError, ValueError): + pass + # Enum member. + if isinstance(owner, type) and issubclass(owner, enum.Enum): + return name in owner.__members__ + # Model class: walk MRO for rest_field descriptors. + if isinstance(owner, type): + for cls in owner.__mro__: + descriptor = vars(cls).get(name) + if descriptor is not None and "RestField" in type(descriptor).__name__: + return True + if hasattr(owner, name): + return True + return False + + +def require_capability(*names: str) -> None: + for name in names: + try: + cap = CAPABILITIES[name] + except KeyError: # pragma: no cover - misuse + raise KeyError(f"Unknown capability {name!r}") + try: + owner = _resolve(cap["owner"]) + except (ImportError, AttributeError) as exc: + pytest.skip(f"{name} unavailable: owner {cap['owner']!r} cannot be resolved ({exc})") + if not cap["kwargs"]: + # Existence of owner is the capability. + continue + missing = [k for k in cap["kwargs"] if not _has_capability_attr(owner, k)] + if missing: + pytest.skip(f"{name} unavailable: missing {missing}") diff --git a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client.py b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client.py new file mode 100644 index 000000000000..8b04832ceaee --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client.py @@ -0,0 +1,31 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Unit tests for ``KnowledgeBaseRetrievalClient`` patched public behavior.""" + +from azure.core.credentials import AzureKeyCredential + +from _capabilities import require_capability + +ENDPOINT = "https://my-search-service.search.windows.net" +KEY = "fake-api-key" +KNOWLEDGE_BASE_NAME = "hotel-kb" +AUDIENCE = "https://search.azure.com/" + + +class TestKnowledgeBaseRetrievalClientConstructor: + def test_constructor_translates_audience_to_credential_scope(self): + require_capability("KnowledgeBaseRetrievalClient") + from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient + + client = KnowledgeBaseRetrievalClient( + ENDPOINT, + AzureKeyCredential(KEY), + knowledge_base_name=KNOWLEDGE_BASE_NAME, + audience=AUDIENCE, + ) + + assert client._config.endpoint == ENDPOINT + assert client._config.knowledge_base_name == KNOWLEDGE_BASE_NAME + assert client._config.credential_scopes == ["https://search.azure.com/.default"] diff --git a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_async.py b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_async.py new file mode 100644 index 000000000000..cfe44a6c9af5 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_async.py @@ -0,0 +1,34 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Async unit tests for ``KnowledgeBaseRetrievalClient`` patched public behavior.""" + +import pytest +from azure.core.credentials import AzureKeyCredential + +from _capabilities import require_capability + +ENDPOINT = "https://my-search-service.search.windows.net" +KEY = "fake-api-key" +KNOWLEDGE_BASE_NAME = "hotel-kb" +AUDIENCE = "https://search.azure.com/" + + +@pytest.mark.asyncio +class TestKnowledgeBaseRetrievalClientConstructorAsync: + async def test_constructor_translates_audience_to_credential_scope(self): + require_capability("KnowledgeBaseRetrievalClient.aio") + from azure.search.documents.knowledgebases.aio import KnowledgeBaseRetrievalClient + + client = KnowledgeBaseRetrievalClient( + ENDPOINT, + AzureKeyCredential(KEY), + knowledge_base_name=KNOWLEDGE_BASE_NAME, + audience=AUDIENCE, + ) + + assert client._config.endpoint == ENDPOINT + assert client._config.knowledge_base_name == KNOWLEDGE_BASE_NAME + assert client._config.credential_scopes == ["https://search.azure.com/.default"] + await client.close() diff --git a/sdk/search/azure-search-documents/tests/test_search_client.py b/sdk/search/azure-search-documents/tests/test_search_client.py index 55ca6f1cc94f..6bbb41ade52b 100644 --- a/sdk/search/azure-search-documents/tests/test_search_client.py +++ b/sdk/search/azure-search-documents/tests/test_search_client.py @@ -15,7 +15,8 @@ from azure.search.documents import ApiVersion, IndexDocumentsBatch, RequestEntityTooLargeError, SearchClient from azure.search.documents._operations._patch import SearchPageIterator from azure.search.documents.models import FacetResult, IndexingResult, SearchResult -from azure.search.documents.models._models import SearchDocumentsResult + +from _capabilities import require_capability SEARCH_ENDPOINT = "https://my-search-service.search.windows.net" INDEX_NAME = "hotel-index" @@ -32,6 +33,19 @@ CREDENTIAL = AzureKeyCredential(API_KEY) + +class SearchDocumentsResultStub: + def __init__(self): + self.results = [] + self.facets = None + self.count = None + self.coverage = None + self.answers = None + self.debug_info = None + self.next_page_parameters = None + self.next_link = None + + DOCUMENT_METHODS = [ "upload_documents", "delete_documents", @@ -46,7 +60,7 @@ def create_search_client(**kwargs): def create_search_documents_result(*documents): - result = SearchDocumentsResult() + result = SearchDocumentsResultStub() if not documents: documents = ({"HotelId": DOCUMENT_KEY, "HotelName": "Northwind Lodge"},) result.results = [SearchResult(document) for document in documents] @@ -118,8 +132,6 @@ def test_search_returns_lazy_pager_and_builds_search_request(self, mock_search_p semantic_error_mode="partial", semantic_max_wait_in_milliseconds=750, debug="semantic", - x_ms_enable_elevated_read=True, - x_ms_query_source_authorization=SOURCE_AUTHORIZATION, ) assert isinstance(result, ItemPaged) @@ -132,8 +144,6 @@ def test_search_returns_lazy_pager_and_builds_search_request(self, mock_search_p assert document["@search.score"] is None mock_search_post.assert_called_once() assert mock_search_post.call_args.args == () - assert mock_search_post.call_args.kwargs["x_ms_enable_elevated_read"] is True - assert mock_search_post.call_args.kwargs["x_ms_query_source_authorization"] == SOURCE_AUTHORIZATION search_request = get_search_request(mock_search_post) assert search_request.search_text == SEARCH_TEXT assert search_request.include_total_count is True @@ -164,6 +174,61 @@ def test_search_returns_lazy_pager_and_builds_search_request(self, mock_search_p assert search_request.semantic_max_wait_in_milliseconds == 750 assert search_request.debug == "semantic" + @mock.patch("azure.search.documents._operations._operations._SearchClientOperationsMixin._search_post") + def test_search_passes_query_language_speller_rewrites_semantic_fields_and_hybrid_search(self, mock_search_post): + require_capability( + "SearchClient.search.query_language", + "SearchClient.search.speller", + "SearchClient.search.query_rewrites", + "SearchClient.search.semantic_fields", + "SearchClient.search.hybrid_search", + "azure.search.documents.models.HybridSearch", + "azure.search.documents.models.HybridSearch.max_text_recall_size", + "azure.search.documents.models.HybridSearch.count_and_facet_mode", + ) + from azure.search.documents.models import HybridSearch + + mock_search_post.return_value = create_search_documents_result() + client = create_search_client() + + result = client.search( + search_text=SEARCH_TEXT, + query_language="en-us", + speller="lexicon", + query_rewrites="generative", + semantic_fields=["HotelName", "Description"], + hybrid_search=HybridSearch(max_text_recall_size=100, count_and_facet_mode="countAllResults"), + ) + next(result) + + search_request = get_search_request(mock_search_post) + assert search_request.query_language == "en-us" + assert search_request.query_speller == "lexicon" + assert search_request.query_rewrites == "generative" + assert search_request.semantic_fields == ["HotelName", "Description"] + assert search_request.hybrid_search.max_text_recall_size == 100 + assert search_request.hybrid_search.count_and_facet_mode == "countAllResults" + + @mock.patch("azure.search.documents._operations._operations._SearchClientOperationsMixin._search_post") + def test_search_translates_legacy_x_ms_kwargs_to_generated_names(self, mock_search_post): + require_capability( + "SearchClient.search.enable_elevated_read", + "SearchClient.search.query_source_authorization", + ) + mock_search_post.return_value = create_search_documents_result() + client = create_search_client() + + next( + client.search( + search_text=SEARCH_TEXT, + x_ms_enable_elevated_read=True, + x_ms_query_source_authorization=SOURCE_AUTHORIZATION, + ) + ) + + assert mock_search_post.call_args.kwargs["enable_elevated_read"] is True + assert mock_search_post.call_args.kwargs["query_source_authorization"] == SOURCE_AUTHORIZATION + @mock.patch("azure.search.documents._operations._operations._SearchClientOperationsMixin._search_post") def test_search_accepts_comma_delimited_select(self, mock_search_post): mock_search_post.return_value = create_search_documents_result() @@ -207,6 +272,24 @@ def test_search_metadata_accessors_return_none_when_metadata_is_absent(self, moc assert result.get_facets() is None mock_search_post.assert_called_once() + @mock.patch("azure.search.documents._operations._operations._SearchClientOperationsMixin._search_post") + def test_get_debug_info_returns_response_debug_info(self, mock_search_post): + require_capability( + "azure.search.documents.models.DebugInfo", + "SearchItemPaged.get_debug_info", + ) + from azure.search.documents.models import DebugInfo + + search_result = create_search_documents_result() + debug_info = DebugInfo() + search_result.debug_info = debug_info + mock_search_post.return_value = search_result + client = create_search_client() + result = client.search(search_text=SEARCH_TEXT) + + assert result.get_debug_info() is debug_info + mock_search_post.assert_called_once() + class TestSearchSuggestionRequests: @mock.patch("azure.search.documents._operations._operations._SearchClientOperationsMixin._suggest_post") diff --git a/sdk/search/azure-search-documents/tests/test_search_client_async.py b/sdk/search/azure-search-documents/tests/test_search_client_async.py index 42d78cb5af48..cc8b935b8214 100644 --- a/sdk/search/azure-search-documents/tests/test_search_client_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_client_async.py @@ -15,7 +15,8 @@ from azure.search.documents.aio import SearchClient from azure.search.documents.aio._operations._patch import AsyncSearchItemPaged, AsyncSearchPageIterator from azure.search.documents.models import FacetResult, IndexingResult, SearchResult -from azure.search.documents.models._models import SearchDocumentsResult + +from _capabilities import require_capability SEARCH_ENDPOINT = "https://my-search-service.search.windows.net" INDEX_NAME = "hotel-index" @@ -32,6 +33,19 @@ CREDENTIAL = AzureKeyCredential(API_KEY) + +class SearchDocumentsResultStub: + def __init__(self): + self.results = [] + self.facets = None + self.count = None + self.coverage = None + self.answers = None + self.debug_info = None + self.next_page_parameters = None + self.next_link = None + + DOCUMENT_METHODS = [ "upload_documents", "delete_documents", @@ -46,7 +60,7 @@ def create_search_client(**kwargs): def create_search_documents_result(*documents): - result = SearchDocumentsResult() + result = SearchDocumentsResultStub() if not documents: documents = ({"HotelId": DOCUMENT_KEY, "HotelName": "Northwind Lodge"},) result.results = [SearchResult(document) for document in documents] @@ -118,8 +132,6 @@ async def test_search_returns_lazy_pager_and_builds_search_request(self, mock_se semantic_error_mode="partial", semantic_max_wait_in_milliseconds=750, debug="semantic", - x_ms_enable_elevated_read=True, - x_ms_query_source_authorization=SOURCE_AUTHORIZATION, ) assert isinstance(result, AsyncSearchItemPaged) @@ -132,8 +144,6 @@ async def test_search_returns_lazy_pager_and_builds_search_request(self, mock_se assert document["@search.score"] is None mock_search_post.assert_awaited_once() assert mock_search_post.call_args.args == () - assert mock_search_post.call_args.kwargs["x_ms_enable_elevated_read"] is True - assert mock_search_post.call_args.kwargs["x_ms_query_source_authorization"] == SOURCE_AUTHORIZATION search_request = get_search_request(mock_search_post) assert search_request.search_text == SEARCH_TEXT assert search_request.include_total_count is True @@ -164,6 +174,62 @@ async def test_search_returns_lazy_pager_and_builds_search_request(self, mock_se assert search_request.semantic_max_wait_in_milliseconds == 750 assert search_request.debug == "semantic" + @pytest.mark.asyncio + @mock.patch("azure.search.documents.aio._operations._operations._SearchClientOperationsMixin._search_post") + async def test_search_passes_query_language_speller_rewrites_semantic_fields_and_hybrid_search( + self, mock_search_post + ): + require_capability( + "SearchClient.search.query_language", + "SearchClient.search.speller", + "SearchClient.search.query_rewrites", + "SearchClient.search.semantic_fields", + "SearchClient.search.hybrid_search", + "azure.search.documents.models.HybridSearch", + "azure.search.documents.models.HybridSearch.max_text_recall_size", + "azure.search.documents.models.HybridSearch.count_and_facet_mode", + ) + from azure.search.documents.models import HybridSearch + + mock_search_post.return_value = create_search_documents_result() + async with create_search_client() as client: + result = await client.search( + search_text=SEARCH_TEXT, + query_language="en-us", + speller="lexicon", + query_rewrites="generative", + semantic_fields=["HotelName", "Description"], + hybrid_search=HybridSearch(max_text_recall_size=100, count_and_facet_mode="countAllResults"), + ) + await result.__anext__() + + search_request = get_search_request(mock_search_post) + assert search_request.query_language == "en-us" + assert search_request.query_speller == "lexicon" + assert search_request.query_rewrites == "generative" + assert search_request.semantic_fields == ["HotelName", "Description"] + assert search_request.hybrid_search.max_text_recall_size == 100 + assert search_request.hybrid_search.count_and_facet_mode == "countAllResults" + + @pytest.mark.asyncio + @mock.patch("azure.search.documents.aio._operations._operations._SearchClientOperationsMixin._search_post") + async def test_search_translates_legacy_x_ms_kwargs_to_generated_names(self, mock_search_post): + require_capability( + "SearchClient.search.enable_elevated_read", + "SearchClient.search.query_source_authorization", + ) + mock_search_post.return_value = create_search_documents_result() + async with create_search_client() as client: + result = await client.search( + search_text=SEARCH_TEXT, + x_ms_enable_elevated_read=True, + x_ms_query_source_authorization=SOURCE_AUTHORIZATION, + ) + await result.__anext__() + + assert mock_search_post.call_args.kwargs["enable_elevated_read"] is True + assert mock_search_post.call_args.kwargs["query_source_authorization"] == SOURCE_AUTHORIZATION + @pytest.mark.asyncio @mock.patch("azure.search.documents.aio._operations._operations._SearchClientOperationsMixin._search_post") async def test_search_accepts_comma_delimited_select(self, mock_search_post): @@ -210,6 +276,26 @@ async def test_search_metadata_accessors_return_none_when_metadata_is_absent(sel mock_search_post.assert_awaited_once() + @pytest.mark.asyncio + @mock.patch("azure.search.documents.aio._operations._operations._SearchClientOperationsMixin._search_post") + async def test_get_debug_info_returns_response_debug_info(self, mock_search_post): + require_capability( + "azure.search.documents.models.DebugInfo", + "SearchItemPaged.get_debug_info", + ) + from azure.search.documents.models import DebugInfo + + search_result = create_search_documents_result() + debug_info = DebugInfo() + search_result.debug_info = debug_info + mock_search_post.return_value = search_result + async with create_search_client() as client: + result = await client.search(search_text=SEARCH_TEXT) + + assert await result.get_debug_info() is debug_info + + mock_search_post.assert_awaited_once() + class TestSearchSuggestionRequestsAsync: @pytest.mark.asyncio diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client.py b/sdk/search/azure-search-documents/tests/test_search_index_client.py new file mode 100644 index 000000000000..50916fcd5fbd --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_search_index_client.py @@ -0,0 +1,122 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Unit tests for ``SearchIndexClient`` preview list-paging kwargs.""" + +from __future__ import annotations + +from unittest import mock + +from azure.core.credentials import AzureKeyCredential +from azure.core.paging import ItemPaged + +from azure.search.documents.indexes import SearchIndexClient +from azure.search.documents.indexes.models import SearchIndex + +from _capabilities import require_capability + +ENDPOINT = "https://my-search-service.search.windows.net" +KEY = "fake-api-key" + + +def _client() -> SearchIndexClient: + return SearchIndexClient(ENDPOINT, AzureKeyCredential(KEY)) + + +def _empty_pager(*_args, **_kwargs): + pager = mock.MagicMock(spec=ItemPaged) + pager.__iter__.return_value = iter([]) + return pager + + +def _index_response_stub(name="hotels"): + response = mock.Mock() + response.name = name + response.fields = [] + response.description = None + response.scoring_profiles = None + response.default_scoring_profile = None + response.cors_options = None + response.suggesters = None + response.analyzers = None + response.tokenizers = None + response.token_filters = None + response.char_filters = None + response.normalizers = None + response.encryption_key = None + response.similarity = None + response.semantic_search = None + response.vector_search = None + response.permission_filter_option = None + response.purview_enabled = None + response.e_tag = '"etag"' + return response + + +class TestListIndexes: + @mock.patch( + "azure.search.documents.indexes._operations._operations._SearchIndexClientOperationsMixin._list_indexes", + side_effect=_empty_pager, + ) + def test_list_indexes_forwards_top_skip_count(self, mock_list): + require_capability( + "azure.search.documents.indexes.SearchIndexClient.list_indexes.top", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.skip", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.count", + ) + + list(_client().list_indexes(top=10, skip=5, count=True)) + + mock_list.assert_called_once() + kwargs = mock_list.call_args.kwargs + assert kwargs["top"] == 10 + assert kwargs["skip"] == 5 + assert kwargs["count"] is True + + @mock.patch( + "azure.search.documents.indexes._operations._operations." + "_SearchIndexClientOperationsMixin._list_indexes_with_selected_properties", + side_effect=_empty_pager, + ) + def test_list_indexes_with_select_forwards_paging_kwargs(self, mock_list_select): + require_capability( + "azure.search.documents.indexes.SearchIndexClient.list_indexes.top", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.skip", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.count", + ) + + list(_client().list_indexes(select=["name"], top=3, skip=1, count=False)) + + mock_list_select.assert_called_once() + kwargs = mock_list_select.call_args.kwargs + assert kwargs["select"] == ["name"] + assert kwargs["top"] == 3 + assert kwargs["skip"] == 1 + assert kwargs["count"] is False + converted = kwargs["cls"]([_index_response_stub()]) + assert isinstance(converted[0], SearchIndex) + assert converted[0].name == "hotels" + + +class TestListIndexNames: + @mock.patch( + "azure.search.documents.indexes._operations._operations._SearchIndexClientOperationsMixin._list_indexes", + side_effect=_empty_pager, + ) + def test_list_index_names_forwards_top_skip_count(self, mock_list): + require_capability( + "azure.search.documents.indexes.SearchIndexClient.list_index_names.top", + "azure.search.documents.indexes.SearchIndexClient.list_index_names.skip", + "azure.search.documents.indexes.SearchIndexClient.list_index_names.count", + ) + + list(_client().list_index_names(top=20, skip=0, count=True)) + + mock_list.assert_called_once() + kwargs = mock_list.call_args.kwargs + assert kwargs["top"] == 20 + assert kwargs["skip"] == 0 + assert kwargs["count"] is True + # The names projection passes a `cls` callback that maps to .name strings. + assert callable(kwargs["cls"]) diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_async.py b/sdk/search/azure-search-documents/tests/test_search_index_client_async.py new file mode 100644 index 000000000000..6220775bd04f --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_async.py @@ -0,0 +1,137 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Async unit tests for ``SearchIndexClient`` preview list-paging kwargs.""" + +from __future__ import annotations + +from unittest import mock + +import pytest +from azure.core.async_paging import AsyncItemPaged +from azure.core.credentials import AzureKeyCredential + +from azure.search.documents.indexes.aio import SearchIndexClient +from azure.search.documents.indexes.models import SearchIndex + +from _capabilities import require_capability + +ENDPOINT = "https://my-search-service.search.windows.net" +KEY = "fake-api-key" + + +def _client() -> SearchIndexClient: + return SearchIndexClient(ENDPOINT, AzureKeyCredential(KEY)) + + +def _empty_async_pager(*_args, **_kwargs): + pager = mock.MagicMock(spec=AsyncItemPaged) + + async def _aiter(): + for _ in (): + yield _ + + pager.__aiter__ = lambda self: _aiter() + return pager + + +def _index_response_stub(name="hotels"): + response = mock.Mock() + response.name = name + response.fields = [] + response.description = None + response.scoring_profiles = None + response.default_scoring_profile = None + response.cors_options = None + response.suggesters = None + response.analyzers = None + response.tokenizers = None + response.token_filters = None + response.char_filters = None + response.normalizers = None + response.encryption_key = None + response.similarity = None + response.semantic_search = None + response.vector_search = None + response.permission_filter_option = None + response.purview_enabled = None + response.e_tag = '"etag"' + return response + + +@pytest.mark.asyncio +class TestListIndexesAsync: + async def test_list_indexes_forwards_top_skip_count(self): + require_capability( + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.top", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.skip", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.count", + ) + + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations." + "_SearchIndexClientOperationsMixin._list_indexes", + side_effect=_empty_async_pager, + ) as mock_list: + pager = _client().list_indexes(top=10, skip=5, count=True) + async for _ in pager: + pass + + mock_list.assert_called_once() + kwargs = mock_list.call_args.kwargs + assert kwargs["top"] == 10 + assert kwargs["skip"] == 5 + assert kwargs["count"] is True + + async def test_list_indexes_with_select_forwards_paging_kwargs(self): + require_capability( + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.top", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.skip", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.count", + ) + + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations." + "_SearchIndexClientOperationsMixin._list_indexes_with_selected_properties", + side_effect=_empty_async_pager, + ) as mock_list_select: + pager = _client().list_indexes(select=["name"], top=3, skip=1, count=False) + async for _ in pager: + pass + + mock_list_select.assert_called_once() + kwargs = mock_list_select.call_args.kwargs + assert kwargs["select"] == ["name"] + assert kwargs["top"] == 3 + assert kwargs["skip"] == 1 + assert kwargs["count"] is False + converted = kwargs["cls"]([_index_response_stub()]) + assert isinstance(converted[0], SearchIndex) + assert converted[0].name == "hotels" + + +@pytest.mark.asyncio +class TestListIndexNamesAsync: + async def test_list_index_names_forwards_top_skip_count(self): + require_capability( + "azure.search.documents.indexes.aio.SearchIndexClient.list_index_names.top", + "azure.search.documents.indexes.aio.SearchIndexClient.list_index_names.skip", + "azure.search.documents.indexes.aio.SearchIndexClient.list_index_names.count", + ) + + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations." + "_SearchIndexClientOperationsMixin._list_indexes", + side_effect=_empty_async_pager, + ) as mock_list: + pager = _client().list_index_names(top=20, skip=0, count=True) + async for _ in pager: + pass + + mock_list.assert_called_once() + kwargs = mock_list.call_args.kwargs + assert kwargs["top"] == 20 + assert kwargs["skip"] == 0 + assert kwargs["count"] is True + assert callable(kwargs["cls"]) diff --git a/sdk/search/azure-search-documents/tests/test_search_index_model.py b/sdk/search/azure-search-documents/tests/test_search_index_model.py index 4b51e592e892..1c031e7a8669 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_model.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_model.py @@ -2,7 +2,11 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ -"""Unit tests for ``SearchIndex`` helper serialization.""" +"""Unit tests for ``SearchIndex`` helper serialization and preview surfaces. + +Preview-gated round-trip tests live alongside the GA helper tests and use +``require_capability`` so the file remains import-safe on GA branches. +""" from __future__ import annotations @@ -15,6 +19,7 @@ SimpleField, ) + INDEX_NAME = "hotels" diff --git a/sdk/search/azure-search-documents/tests/test_search_indexer_client.py b/sdk/search/azure-search-documents/tests/test_search_indexer_client.py new file mode 100644 index 000000000000..b42056e2c522 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_search_indexer_client.py @@ -0,0 +1,224 @@ +# pylint: disable=line-too-long,useless-suppression +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Unit tests for ``SearchIndexerClient`` preview operations. + +Covers the 2026-05-01-preview re-introduced operations: ``resync``, +``reset_documents`` and ``reset_skills``. Each test gates on +``require_capability`` so the module is import-safe on GA branches. +""" + +from __future__ import annotations + +from unittest import mock + +from azure.core import MatchConditions +from azure.core.credentials import AzureKeyCredential + +from azure.search.documents.indexes import SearchIndexerClient +from azure.search.documents.indexes.models import ( + SearchIndexer, + SearchIndexerDataContainer, + SearchIndexerDataSourceConnection, + SearchIndexerSkillset, +) + +from _capabilities import require_capability + +ENDPOINT = "https://my-search-service.search.windows.net" +KEY = "fake-api-key" + + +def _client() -> SearchIndexerClient: + return SearchIndexerClient(ENDPOINT, AzureKeyCredential(KEY)) + + +class TestSearchIndexerCreateOrUpdateDataSourceConnection: + @mock.patch( + "azure.search.documents.indexes._operations._operations." + "_SearchIndexerClientOperationsMixin._create_or_update_data_source_connection" + ) + def test_create_or_update_data_source_connection_forwards_reset_requirement_option(self, mock_create): + require_capability( + "azure.search.documents.indexes.SearchIndexerClient." + "create_or_update_data_source_connection.skip_indexer_reset_requirement_for_cache" + ) + data_source = SearchIndexerDataSourceConnection( + name="ds-1", + type="azureblob", + connection_string="UseDevelopmentStorage=true", + container=SearchIndexerDataContainer(name="c"), + ) + data_source.e_tag = '"etag-ds"' + + _client().create_or_update_data_source_connection( + data_source, + skip_indexer_reset_requirement_for_cache=True, + match_condition=MatchConditions.IfNotModified, + ) + + mock_create.assert_called_once() + kwargs = mock_create.call_args.kwargs + assert kwargs["name"] == "ds-1" + assert kwargs["data_source"] is data_source + assert kwargs["prefer"] == "return=representation" + assert kwargs["etag"] == '"etag-ds"' + assert kwargs["match_condition"] == MatchConditions.IfNotModified + assert kwargs["skip_indexer_reset_requirement_for_cache"] is True + + +class TestSearchIndexerCreateOrUpdateIndexer: + @mock.patch( + "azure.search.documents.indexes._operations._operations._SearchIndexerClientOperationsMixin._create_or_update_indexer" + ) + def test_create_or_update_indexer_forwards_reset_requirement_and_cache_reprocessing_options(self, mock_create): + require_capability( + "azure.search.documents.indexes.SearchIndexerClient." + "create_or_update_indexer.skip_indexer_reset_requirement_for_cache", + "azure.search.documents.indexes.SearchIndexerClient." + "create_or_update_indexer.disable_cache_reprocessing_change_detection", + ) + indexer = SearchIndexer(name="idxr-1", data_source_name="ds-1", target_index_name="idx-1") + indexer.e_tag = '"etag-indexer"' + + _client().create_or_update_indexer( + indexer, + skip_indexer_reset_requirement_for_cache=True, + disable_cache_reprocessing_change_detection=True, + match_condition=MatchConditions.IfNotModified, + ) + + mock_create.assert_called_once() + kwargs = mock_create.call_args.kwargs + assert kwargs["name"] == "idxr-1" + assert kwargs["indexer"] is indexer + assert kwargs["prefer"] == "return=representation" + assert kwargs["etag"] == '"etag-indexer"' + assert kwargs["match_condition"] == MatchConditions.IfNotModified + assert kwargs["skip_indexer_reset_requirement_for_cache"] is True + assert kwargs["disable_cache_reprocessing_change_detection"] is True + + +class TestSearchIndexerCreateOrUpdateSkillset: + @mock.patch( + "azure.search.documents.indexes._operations._operations._SearchIndexerClientOperationsMixin._create_or_update_skillset" + ) + def test_create_or_update_skillset_forwards_reset_requirement_and_cache_reprocessing_options(self, mock_create): + require_capability( + "azure.search.documents.indexes.SearchIndexerClient." + "create_or_update_skillset.skip_indexer_reset_requirement_for_cache", + "azure.search.documents.indexes.SearchIndexerClient." + "create_or_update_skillset.disable_cache_reprocessing_change_detection", + ) + skillset = SearchIndexerSkillset(name="skillset-1", skills=[]) + skillset.e_tag = '"etag-skillset"' + + _client().create_or_update_skillset( + skillset, + skip_indexer_reset_requirement_for_cache=True, + disable_cache_reprocessing_change_detection=True, + match_condition=MatchConditions.IfNotModified, + ) + + mock_create.assert_called_once() + kwargs = mock_create.call_args.kwargs + assert kwargs["name"] == "skillset-1" + assert kwargs["skillset"] is skillset + assert kwargs["prefer"] == "return=representation" + assert kwargs["etag"] == '"etag-skillset"' + assert kwargs["match_condition"] == MatchConditions.IfNotModified + assert kwargs["skip_indexer_reset_requirement_for_cache"] is True + assert kwargs["disable_cache_reprocessing_change_detection"] is True + + +class TestSearchIndexerResync: + @mock.patch("azure.search.documents.indexes._operations._operations._SearchIndexerClientOperationsMixin._resync") + def test_resync_forwards_name_and_body(self, mock_resync): + require_capability("azure.search.documents.indexes.SearchIndexerClient.resync") + from azure.search.documents.indexes.models import IndexerResyncBody + + body = IndexerResyncBody(options=["permissions"]) + + _client().resync("idx-1", body, request_id="req-1") + + mock_resync.assert_called_once() + kwargs = mock_resync.call_args.kwargs + assert kwargs["name"] == "idx-1" + assert kwargs["indexer_resync"] is body + assert kwargs["request_id"] == "req-1" + + @mock.patch("azure.search.documents.indexes._operations._operations._SearchIndexerClientOperationsMixin._resync") + def test_resync_accepts_json_dict(self, mock_resync): + require_capability("azure.search.documents.indexes.SearchIndexerClient.resync") + + body = {"options": ["permissions"]} + _client().resync("idx-1", body) + + mock_resync.assert_called_once() + assert mock_resync.call_args.kwargs["indexer_resync"] == body + + +class TestSearchIndexerResetDocuments: + @mock.patch( + "azure.search.documents.indexes._operations._operations._SearchIndexerClientOperationsMixin._reset_documents" + ) + def test_reset_documents_forwards_keys_and_overwrite(self, mock_reset): + require_capability("azure.search.documents.indexes.SearchIndexerClient.reset_documents") + from azure.search.documents.indexes.models import DocumentKeysOrIds + + body = DocumentKeysOrIds(document_keys=["k1", "k2"], datasource_document_ids=["id1"]) + + _client().reset_documents("idx-1", body, overwrite=True) + + mock_reset.assert_called_once() + kwargs = mock_reset.call_args.kwargs + assert kwargs["name"] == "idx-1" + assert kwargs["keys_or_ids"] is body + assert kwargs["overwrite"] is True + + @mock.patch( + "azure.search.documents.indexes._operations._operations._SearchIndexerClientOperationsMixin._reset_documents" + ) + def test_reset_documents_defaults_keys_to_none(self, mock_reset): + require_capability("azure.search.documents.indexes.SearchIndexerClient.reset_documents") + + _client().reset_documents("idx-1") + + mock_reset.assert_called_once() + kwargs = mock_reset.call_args.kwargs + assert kwargs["name"] == "idx-1" + assert kwargs["keys_or_ids"] is None + assert kwargs["overwrite"] is None + + +class TestSearchIndexerResetSkills: + @mock.patch( + "azure.search.documents.indexes._operations._operations._SearchIndexerClientOperationsMixin._reset_skills" + ) + def test_reset_skills_forwards_skill_names(self, mock_reset): + require_capability("azure.search.documents.indexes.SearchIndexerClient.reset_skills") + from azure.search.documents.indexes.models import SkillNames + + names = SkillNames(skill_names=["skill-a", "skill-b"]) + + _client().reset_skills("skillset-1", names, request_id="req-2") + + mock_reset.assert_called_once() + kwargs = mock_reset.call_args.kwargs + assert kwargs["name"] == "skillset-1" + assert kwargs["skill_names"] is names + assert kwargs["request_id"] == "req-2" + + @mock.patch( + "azure.search.documents.indexes._operations._operations._SearchIndexerClientOperationsMixin._reset_skills" + ) + def test_reset_skills_accepts_json_dict(self, mock_reset): + require_capability("azure.search.documents.indexes.SearchIndexerClient.reset_skills") + + body = {"skillNames": ["skill-a"]} + _client().reset_skills("skillset-1", body) + + mock_reset.assert_called_once() + assert mock_reset.call_args.kwargs["skill_names"] == body diff --git a/sdk/search/azure-search-documents/tests/test_search_indexer_client_async.py b/sdk/search/azure-search-documents/tests/test_search_indexer_client_async.py new file mode 100644 index 000000000000..ff8a0af3a993 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_search_indexer_client_async.py @@ -0,0 +1,237 @@ +# pylint: disable=line-too-long,useless-suppression +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Async unit tests for ``SearchIndexerClient`` preview operations.""" + +from __future__ import annotations + +from unittest import mock + +import pytest +from azure.core import MatchConditions +from azure.core.credentials import AzureKeyCredential + +from azure.search.documents.indexes.aio import SearchIndexerClient +from azure.search.documents.indexes.models import ( + SearchIndexer, + SearchIndexerDataContainer, + SearchIndexerDataSourceConnection, + SearchIndexerSkillset, +) + +from _capabilities import require_capability + +ENDPOINT = "https://my-search-service.search.windows.net" +KEY = "fake-api-key" + + +def _client() -> SearchIndexerClient: + return SearchIndexerClient(ENDPOINT, AzureKeyCredential(KEY)) + + +async def _async_none(*args, **kwargs): + return None + + +@pytest.mark.asyncio +class TestSearchIndexerCreateOrUpdateDataSourceConnectionAsync: + async def test_create_or_update_data_source_connection_forwards_reset_requirement_option(self): + require_capability( + "azure.search.documents.indexes.aio.SearchIndexerClient." + "create_or_update_data_source_connection.skip_indexer_reset_requirement_for_cache" + ) + data_source = SearchIndexerDataSourceConnection( + name="ds-1", + type="azureblob", + connection_string="UseDevelopmentStorage=true", + container=SearchIndexerDataContainer(name="c"), + ) + data_source.e_tag = '"etag-ds"' + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations." + "_SearchIndexerClientOperationsMixin._create_or_update_data_source_connection", + new=mock.AsyncMock(return_value=data_source), + ) as mock_create: + await _client().create_or_update_data_source_connection( + data_source, + skip_indexer_reset_requirement_for_cache=True, + match_condition=MatchConditions.IfNotModified, + ) + + mock_create.assert_awaited_once() + kwargs = mock_create.call_args.kwargs + assert kwargs["name"] == "ds-1" + assert kwargs["data_source"] is data_source + assert kwargs["prefer"] == "return=representation" + assert kwargs["etag"] == '"etag-ds"' + assert kwargs["match_condition"] == MatchConditions.IfNotModified + assert kwargs["skip_indexer_reset_requirement_for_cache"] is True + + +@pytest.mark.asyncio +class TestSearchIndexerCreateOrUpdateIndexerAsync: + async def test_create_or_update_indexer_forwards_reset_requirement_and_cache_reprocessing_options(self): + require_capability( + "azure.search.documents.indexes.aio.SearchIndexerClient." + "create_or_update_indexer.skip_indexer_reset_requirement_for_cache", + "azure.search.documents.indexes.aio.SearchIndexerClient." + "create_or_update_indexer.disable_cache_reprocessing_change_detection", + ) + indexer = SearchIndexer(name="idxr-1", data_source_name="ds-1", target_index_name="idx-1") + indexer.e_tag = '"etag-indexer"' + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations." + "_SearchIndexerClientOperationsMixin._create_or_update_indexer", + new=mock.AsyncMock(return_value=indexer), + ) as mock_create: + await _client().create_or_update_indexer( + indexer, + skip_indexer_reset_requirement_for_cache=True, + disable_cache_reprocessing_change_detection=True, + match_condition=MatchConditions.IfNotModified, + ) + + mock_create.assert_awaited_once() + kwargs = mock_create.call_args.kwargs + assert kwargs["name"] == "idxr-1" + assert kwargs["indexer"] is indexer + assert kwargs["prefer"] == "return=representation" + assert kwargs["etag"] == '"etag-indexer"' + assert kwargs["match_condition"] == MatchConditions.IfNotModified + assert kwargs["skip_indexer_reset_requirement_for_cache"] is True + assert kwargs["disable_cache_reprocessing_change_detection"] is True + + +@pytest.mark.asyncio +class TestSearchIndexerCreateOrUpdateSkillsetAsync: + async def test_create_or_update_skillset_forwards_reset_requirement_and_cache_reprocessing_options(self): + require_capability( + "azure.search.documents.indexes.aio.SearchIndexerClient." + "create_or_update_skillset.skip_indexer_reset_requirement_for_cache", + "azure.search.documents.indexes.aio.SearchIndexerClient." + "create_or_update_skillset.disable_cache_reprocessing_change_detection", + ) + skillset = SearchIndexerSkillset(name="skillset-1", skills=[]) + skillset.e_tag = '"etag-skillset"' + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations." + "_SearchIndexerClientOperationsMixin._create_or_update_skillset", + new=mock.AsyncMock(return_value=skillset), + ) as mock_create: + await _client().create_or_update_skillset( + skillset, + skip_indexer_reset_requirement_for_cache=True, + disable_cache_reprocessing_change_detection=True, + match_condition=MatchConditions.IfNotModified, + ) + + mock_create.assert_awaited_once() + kwargs = mock_create.call_args.kwargs + assert kwargs["name"] == "skillset-1" + assert kwargs["skillset"] is skillset + assert kwargs["prefer"] == "return=representation" + assert kwargs["etag"] == '"etag-skillset"' + assert kwargs["match_condition"] == MatchConditions.IfNotModified + assert kwargs["skip_indexer_reset_requirement_for_cache"] is True + assert kwargs["disable_cache_reprocessing_change_detection"] is True + + +@pytest.mark.asyncio +class TestSearchIndexerResyncAsync: + async def test_resync_forwards_name_and_body(self): + require_capability("azure.search.documents.indexes.aio.SearchIndexerClient.resync") + from azure.search.documents.indexes.models import IndexerResyncBody + + body = IndexerResyncBody(options=["permissions"]) + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations._SearchIndexerClientOperationsMixin._resync", + new=mock.AsyncMock(return_value=None), + ) as mock_resync: + await _client().resync("idx-1", body, request_id="req-1") + + mock_resync.assert_awaited_once() + kwargs = mock_resync.call_args.kwargs + assert kwargs["name"] == "idx-1" + assert kwargs["indexer_resync"] is body + assert kwargs["request_id"] == "req-1" + + async def test_resync_accepts_json_dict(self): + require_capability("azure.search.documents.indexes.aio.SearchIndexerClient.resync") + + body = {"options": ["permissions"]} + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations._SearchIndexerClientOperationsMixin._resync", + new=mock.AsyncMock(return_value=None), + ) as mock_resync: + await _client().resync("idx-1", body) + + assert mock_resync.call_args.kwargs["indexer_resync"] == body + + +@pytest.mark.asyncio +class TestSearchIndexerResetDocumentsAsync: + async def test_reset_documents_forwards_keys_and_overwrite(self): + require_capability("azure.search.documents.indexes.aio.SearchIndexerClient.reset_documents") + from azure.search.documents.indexes.models import DocumentKeysOrIds + + body = DocumentKeysOrIds(document_keys=["k1", "k2"], datasource_document_ids=["id1"]) + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations." + "_SearchIndexerClientOperationsMixin._reset_documents", + new=mock.AsyncMock(return_value=None), + ) as mock_reset: + await _client().reset_documents("idx-1", body, overwrite=True) + + mock_reset.assert_awaited_once() + kwargs = mock_reset.call_args.kwargs + assert kwargs["name"] == "idx-1" + assert kwargs["keys_or_ids"] is body + assert kwargs["overwrite"] is True + + async def test_reset_documents_defaults_keys_to_none(self): + require_capability("azure.search.documents.indexes.aio.SearchIndexerClient.reset_documents") + + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations." + "_SearchIndexerClientOperationsMixin._reset_documents", + new=mock.AsyncMock(return_value=None), + ) as mock_reset: + await _client().reset_documents("idx-1") + + kwargs = mock_reset.call_args.kwargs + assert kwargs["keys_or_ids"] is None + assert kwargs["overwrite"] is None + + +@pytest.mark.asyncio +class TestSearchIndexerResetSkillsAsync: + async def test_reset_skills_forwards_skill_names(self): + require_capability("azure.search.documents.indexes.aio.SearchIndexerClient.reset_skills") + from azure.search.documents.indexes.models import SkillNames + + names = SkillNames(skill_names=["skill-a", "skill-b"]) + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations._SearchIndexerClientOperationsMixin._reset_skills", + new=mock.AsyncMock(return_value=None), + ) as mock_reset: + await _client().reset_skills("skillset-1", names, request_id="req-2") + + mock_reset.assert_awaited_once() + kwargs = mock_reset.call_args.kwargs + assert kwargs["name"] == "skillset-1" + assert kwargs["skill_names"] is names + assert kwargs["request_id"] == "req-2" + + async def test_reset_skills_accepts_json_dict(self): + require_capability("azure.search.documents.indexes.aio.SearchIndexerClient.reset_skills") + + body = {"skillNames": ["skill-a"]} + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations._SearchIndexerClientOperationsMixin._reset_skills", + new=mock.AsyncMock(return_value=None), + ) as mock_reset: + await _client().reset_skills("skillset-1", body) + + assert mock_reset.call_args.kwargs["skill_names"] == body diff --git a/sdk/search/azure-search-documents/tests/test_search_indexer_models.py b/sdk/search/azure-search-documents/tests/test_search_indexer_models.py index 7d702fbd014a..4a6fbbe21007 100644 --- a/sdk/search/azure-search-documents/tests/test_search_indexer_models.py +++ b/sdk/search/azure-search-documents/tests/test_search_indexer_models.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. From 93d33d7f69179d2cefb2d6ea624020b0ff322cf7 Mon Sep 17 00:00:00 2001 From: Zixin Yao Date: Fri, 15 May 2026 23:07:21 -0700 Subject: [PATCH 4/5] Regenerate search preview after namespace update Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../apiview-properties.json | 4 +- .../indexes/_operations/_operations.py | 2 +- .../indexes/aio/_operations/_operations.py | 2 +- .../documents/indexes/models/__init__.py | 4 ++ .../search/documents/indexes/models/_enums.py | 9 +++ .../documents/indexes/models/_models.py | 59 ++++++++++++++-- .../azure-search-documents/search/__init__.py | 1 - .../search/models/__init__.py | 32 --------- .../search/models/_enums.py | 19 ------ .../search/models/_models.py | 57 ---------------- .../search/models/_patch.py | 21 ------ .../tests/_capabilities.py | 43 +++++++++++- .../tests/_search_helpers.py | 13 ++-- .../tests/_search_helpers_async.py | 9 ++- ...ge_base_retrieval_client_retrieve_live.py} | 33 +++++++-- ...e_retrieval_client_retrieve_live_async.py} | 33 +++++++-- .../test_search_index_client_indexes_live.py | 6 -- ..._search_index_client_indexes_live_async.py | 6 -- ...ient_knowledge_base_configurations_live.py | 17 ++++- ...nowledge_base_configurations_live_async.py | 17 ++++- ...earch_index_client_knowledge_bases_live.py | 41 +++++++++++- ...index_client_knowledge_bases_live_async.py | 41 +++++++++++- ...rch_index_client_knowledge_sources_live.py | 67 ++++++++++++++++--- ...dex_client_knowledge_sources_live_async.py | 67 ++++++++++++++++--- .../tests/test_search_index_model.py | 14 +--- .../tests/test_search_indexer_models.py | 61 ----------------- .../azure-search-documents/tsp-location.yaml | 2 +- 27 files changed, 407 insertions(+), 273 deletions(-) delete mode 100644 sdk/search/azure-search-documents/search/__init__.py delete mode 100644 sdk/search/azure-search-documents/search/models/__init__.py delete mode 100644 sdk/search/azure-search-documents/search/models/_enums.py delete mode 100644 sdk/search/azure-search-documents/search/models/_models.py delete mode 100644 sdk/search/azure-search-documents/search/models/_patch.py rename sdk/search/azure-search-documents/tests/{test_knowledge_base_retrieval_client_live.py => test_knowledge_base_retrieval_client_retrieve_live.py} (52%) rename sdk/search/azure-search-documents/tests/{test_knowledge_base_retrieval_client_live_async.py => test_knowledge_base_retrieval_client_retrieve_live_async.py} (53%) diff --git a/sdk/search/azure-search-documents/apiview-properties.json b/sdk/search/azure-search-documents/apiview-properties.json index 49176387408a..36fa2dc942c8 100644 --- a/sdk/search/azure-search-documents/apiview-properties.json +++ b/sdk/search/azure-search-documents/apiview-properties.json @@ -277,7 +277,7 @@ "azure.search.documents.indexes.models.SentimentSkillV3": "Search.SentimentSkillV3", "azure.search.documents.indexes.models.ServiceIndexersRuntime": "Search.ServiceIndexersRuntime", "azure.search.documents.indexes.models.ShaperSkill": "Search.ShaperSkill", - "search.models.SharePointConnectorAppRegistration": "Search.SharePointConnectorAppRegistration", + "azure.search.documents.indexes.models.SharePointConnectorAppRegistration": "Search.SharePointConnectorAppRegistration", "azure.search.documents.indexes.models.ShingleTokenFilter": "Search.ShingleTokenFilter", "azure.search.documents.models.SingleVectorFieldResult": "Search.SingleVectorFieldResult", "azure.search.documents.indexes.models.SkillNames": "Search.SkillNames", @@ -486,4 +486,4 @@ "azure.search.documents.KnowledgeBaseRetrievalClient.retrieve": "Customizations.KnowledgeBaseRetrievalClient.retrieve", "azure.search.documents.aio.KnowledgeBaseRetrievalClient.retrieve": "Customizations.KnowledgeBaseRetrievalClient.retrieve" } -} \ No newline at end of file +} 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 3f557c358df6..c1f60e96e76f 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 @@ -2512,7 +2512,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - list[_models1._models.SearchIndexResponse], # pylint: disable=protected-access + list[_models1._models.SearchIndexResponse], deserialized.get("value", []), ) if cls: 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 5e7b4920c6df..8dd72cbb87d1 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 @@ -1042,7 +1042,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - list[_models2._models.SearchIndexResponse], # pylint: disable=protected-access + list[_models2._models.SearchIndexResponse], deserialized.get("value", []), ) if cls: 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 a2655c90133a..a48df18d11b1 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 @@ -212,6 +212,7 @@ SentimentSkillV3, ServiceIndexersRuntime, ShaperSkill, + SharePointConnectorAppRegistration, ShingleTokenFilter, SimilarityAlgorithm, SkillNames, @@ -262,6 +263,7 @@ ChatCompletionExtraParametersBehavior, ChatCompletionResponseFormatType, CjkBigramTokenFilterScripts, + ContentUnderstandingSkillChunkingMethod, ContentUnderstandingSkillChunkingUnit, ContentUnderstandingSkillExtractionOptions, CustomEntityLookupSkillLanguage, @@ -535,6 +537,7 @@ "SentimentSkillV3", "ServiceIndexersRuntime", "ShaperSkill", + "SharePointConnectorAppRegistration", "ShingleTokenFilter", "SimilarityAlgorithm", "SkillNames", @@ -582,6 +585,7 @@ "ChatCompletionExtraParametersBehavior", "ChatCompletionResponseFormatType", "CjkBigramTokenFilterScripts", + "ContentUnderstandingSkillChunkingMethod", "ContentUnderstandingSkillChunkingUnit", "ContentUnderstandingSkillExtractionOptions", "CustomEntityLookupSkillLanguage", 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 c618250fe00c..bbda9f8a7ba4 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 @@ -180,6 +180,15 @@ class CjkBigramTokenFilterScripts(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Ignore Hangul script when forming bigrams of CJK terms.""" +class ContentUnderstandingSkillChunkingMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The chunking strategy used by the Content Understanding skill. Default is 'fixedSize'.""" + + FIXED_SIZE = "fixedSize" + """Fixed-size character-based windowed chunking.""" + SEMANTIC = "semantic" + """Layout-aware, paragraph-boundary-respecting chunking.""" + + class ContentUnderstandingSkillChunkingUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Controls the cardinality of the chunk unit. Default is 'characters'.""" 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 3365e3dbe8ab..64b5f4905b1e 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 @@ -24,7 +24,6 @@ if TYPE_CHECKING: from .. import models as _models - from ......search import models as _search_models6 from ...knowledgebases import models as _knowledgebases_models3 @@ -2355,7 +2354,8 @@ class ContentUnderstandingSkillChunkingProperties(_Model): # pylint: disable=na :ivar method: The chunking strategy. 'fixedSize' (default) or 'semantic'. Known values are: "fixedSize" and "semantic". - :vartype method: str or ~search.models.ContentUnderstandingSkillChunkingMethod + :vartype method: str or + ~azure.search.documents.indexes.models.ContentUnderstandingSkillChunkingMethod :ivar unit: The unit of the chunk. Known values are: "characters" and "tokens". :vartype unit: str or ~azure.search.documents.indexes.models.ContentUnderstandingSkillChunkingUnit @@ -2365,7 +2365,7 @@ class ContentUnderstandingSkillChunkingProperties(_Model): # pylint: disable=na :vartype overlap_length: int """ - method: Optional[Union[str, "_search_models6.ContentUnderstandingSkillChunkingMethod"]] = rest_field( + method: Optional[Union[str, "_models.ContentUnderstandingSkillChunkingMethod"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) """The chunking strategy. 'fixedSize' (default) or 'semantic'. Known values are: \"fixedSize\" and @@ -2387,7 +2387,7 @@ class ContentUnderstandingSkillChunkingProperties(_Model): # pylint: disable=na def __init__( self, *, - method: Optional[Union[str, "_search_models6.ContentUnderstandingSkillChunkingMethod"]] = None, + method: Optional[Union[str, "_models.ContentUnderstandingSkillChunkingMethod"]] = None, unit: Optional[Union[str, "_models.ContentUnderstandingSkillChunkingUnit"]] = None, maximum_length: Optional[int] = None, overlap_length: Optional[int] = None, @@ -9258,7 +9258,7 @@ class SearchIndex(_Model): registration for the index, enabling document-level permissions from SharePoint. If provided, the applicationId and federatedCredentialId properties are required. :vartype share_point_connector_app_registration: - ~search.models.SharePointConnectorAppRegistration + ~azure.search.documents.indexes.models.SharePointConnectorAppRegistration :ivar e_tag: The ETag of the index. :vartype e_tag: str """ @@ -9340,7 +9340,7 @@ class SearchIndex(_Model): name="purviewEnabled", visibility=["read", "create", "update", "delete", "query"] ) """A value indicating whether Purview is enabled for the index.""" - share_point_connector_app_registration: Optional["_search_models6.SharePointConnectorAppRegistration"] = rest_field( + share_point_connector_app_registration: Optional["_models.SharePointConnectorAppRegistration"] = rest_field( name="sharePointConnectorAppRegistration", visibility=["read", "create", "update", "delete", "query"] ) """Configures a SharePoint connector app registration for the index, enabling document-level @@ -9371,7 +9371,7 @@ def __init__( vector_search: Optional["_models.VectorSearch"] = None, permission_filter_option: Optional[Union[str, "_models.SearchIndexPermissionFilterOption"]] = None, purview_enabled: Optional[bool] = None, - share_point_connector_app_registration: Optional["_search_models6.SharePointConnectorAppRegistration"] = None, + share_point_connector_app_registration: Optional["_models.SharePointConnectorAppRegistration"] = None, e_tag: Optional[str] = None, ) -> None: ... @@ -11669,6 +11669,51 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Util.ShaperSkill" # type: ignore +class SharePointConnectorAppRegistration(_Model): + """Configures a SharePoint connector app registration for the index, enabling document-level + permissions from SharePoint. + + :ivar application_id: The application (client) ID of the app registration used to connect to + SharePoint. Required. + :vartype application_id: str + :ivar federated_credential_id: The federated credential ID configured on the app registration. + Required. + :vartype federated_credential_id: str + :ivar tenant_id: The tenant ID of the app registration. If not specified, the tenant of the + search service is used. + :vartype tenant_id: str + """ + + application_id: str = rest_field(name="applicationId", visibility=["read", "create", "update", "delete", "query"]) + """The application (client) ID of the app registration used to connect to SharePoint. Required.""" + federated_credential_id: str = rest_field( + name="federatedCredentialId", visibility=["read", "create", "update", "delete", "query"] + ) + """The federated credential ID configured on the app registration. Required.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The tenant ID of the app registration. If not specified, the tenant of the search service is + used.""" + + @overload + def __init__( + self, + *, + application_id: str, + federated_credential_id: str, + tenant_id: Optional[str] = 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 ShingleTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.ShingleTokenFilter"): """Creates combinations of tokens as a single token. This token filter is implemented using Apache Lucene. diff --git a/sdk/search/azure-search-documents/search/__init__.py b/sdk/search/azure-search-documents/search/__init__.py deleted file mode 100644 index d55ccad1f573..000000000000 --- a/sdk/search/azure-search-documents/search/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/search/azure-search-documents/search/models/__init__.py b/sdk/search/azure-search-documents/search/models/__init__.py deleted file mode 100644 index e4ec13bcce13..000000000000 --- a/sdk/search/azure-search-documents/search/models/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models import ( # type: ignore - SharePointConnectorAppRegistration, -) - -from ._enums import ( # type: ignore - ContentUnderstandingSkillChunkingMethod, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "SharePointConnectorAppRegistration", - "ContentUnderstandingSkillChunkingMethod", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/search/azure-search-documents/search/models/_enums.py b/sdk/search/azure-search-documents/search/models/_enums.py deleted file mode 100644 index bd3f644f1acb..000000000000 --- a/sdk/search/azure-search-documents/search/models/_enums.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ContentUnderstandingSkillChunkingMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The chunking strategy used by the Content Understanding skill. Default is 'fixedSize'.""" - - FIXED_SIZE = "fixedSize" - """Fixed-size character-based windowed chunking.""" - SEMANTIC = "semantic" - """Layout-aware, paragraph-boundary-respecting chunking.""" diff --git a/sdk/search/azure-search-documents/search/models/_models.py b/sdk/search/azure-search-documents/search/models/_models.py deleted file mode 100644 index bc7bd51c7c7e..000000000000 --- a/sdk/search/azure-search-documents/search/models/_models.py +++ /dev/null @@ -1,57 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=useless-super-delegation - -from typing import Any, Mapping, Optional, overload - -from ...azure.search.documents._utils.model_base import Model as _Model, rest_field - - -class SharePointConnectorAppRegistration(_Model): - """Configures a SharePoint connector app registration for the index, enabling document-level - permissions from SharePoint. - - :ivar application_id: The application (client) ID of the app registration used to connect to - SharePoint. Required. - :vartype application_id: str - :ivar federated_credential_id: The federated credential ID configured on the app registration. - Required. - :vartype federated_credential_id: str - :ivar tenant_id: The tenant ID of the app registration. If not specified, the tenant of the - search service is used. - :vartype tenant_id: str - """ - - application_id: str = rest_field(name="applicationId", visibility=["read", "create", "update", "delete", "query"]) - """The application (client) ID of the app registration used to connect to SharePoint. Required.""" - federated_credential_id: str = rest_field( - name="federatedCredentialId", visibility=["read", "create", "update", "delete", "query"] - ) - """The federated credential ID configured on the app registration. Required.""" - tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) - """The tenant ID of the app registration. If not specified, the tenant of the search service is - used.""" - - @overload - def __init__( - self, - *, - application_id: str, - federated_credential_id: str, - tenant_id: Optional[str] = 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) diff --git a/sdk/search/azure-search-documents/search/models/_patch.py b/sdk/search/azure-search-documents/search/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/search/azure-search-documents/search/models/_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__all__: list[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/search/azure-search-documents/tests/_capabilities.py b/sdk/search/azure-search-documents/tests/_capabilities.py index ba1d2cba4a78..06ac0acd9029 100644 --- a/sdk/search/azure-search-documents/tests/_capabilities.py +++ b/sdk/search/azure-search-documents/tests/_capabilities.py @@ -26,6 +26,7 @@ def _surface(owner: str, kwargs: tuple = (), available_from: str = PREVIEW) -> M # Module aliases to keep the table compact. _IM = "azure.search.documents.indexes.models" _KBM = "azure.search.documents.knowledgebases.models" +_KB = "azure.search.documents.knowledgebases" _M = "azure.search.documents.models" _IDX = "azure.search.documents.indexes" @@ -42,6 +43,14 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: f"{_IM}.ContentColumnMapping", f"{_IM}.EmbeddingColumnMapping", # WorkIQ (parameters live in knowledgebases.models) + f"{_IM}.KnowledgeBase", + f"{_IM}.KnowledgeSourceReference", + f"{_IM}.SearchIndexKnowledgeSource", + f"{_IM}.SearchIndexKnowledgeSourceParameters", + f"{_IM}.WebKnowledgeSource", + f"{_IM}.WebKnowledgeSourceDomain", + f"{_IM}.WebKnowledgeSourceDomains", + f"{_IM}.WebKnowledgeSourceParameters", f"{_IM}.WorkIQKnowledgeSource", f"{_KBM}.WorkIQKnowledgeSourceParams", # File @@ -74,6 +83,7 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: f"{_IM}.IndexedSharePointKnowledgeSourceParameters", f"{_IM}.RemoteSharePointKnowledgeSource", f"{_IM}.RemoteSharePointKnowledgeSourceParameters", + f"{_IM}.SharePointConnectorAppRegistration", # Skills f"{_IM}.AzureMachineLearningSkill", f"{_IM}.ChatCompletionSkill", @@ -89,6 +99,9 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: f"{_KBM}.AIServices", f"{_KBM}.AssetStore", f"{_KBM}.FreshnessPolicy", + f"{_KBM}.KnowledgeBaseRetrievalRequest", + f"{_KBM}.KnowledgeBaseRetrievalResponse", + f"{_KBM}.KnowledgeRetrievalSemanticIntent", f"{_KBM}.KnowledgeSourceIngestionParameters", f"{_KBM}.KnowledgeRetrievalLowReasoningEffort", f"{_KBM}.KnowledgeRetrievalMediumReasoningEffort", @@ -207,9 +220,13 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: (f"{_IM}.ChatCompletionResponseFormatType", "TEXT"), (f"{_IM}.ChatCompletionResponseFormatType", "JSON_OBJECT"), (f"{_IM}.ChatCompletionResponseFormatType", "JSON_SCHEMA"), + (f"{_IM}.ContentUnderstandingSkillChunkingMethod", "FIXED_SIZE"), + (f"{_IM}.ContentUnderstandingSkillChunkingMethod", "SEMANTIC"), (f"{_IM}.ContentUnderstandingSkillChunkingUnit", "TOKENS"), (f"{_IM}.KnowledgeSourceKind", "INDEXED_SQL"), (f"{_IM}.KnowledgeSourceKind", "REMOTE_SHARE_POINT"), + (f"{_IM}.KnowledgeSourceKind", "SEARCH_INDEX"), + (f"{_IM}.KnowledgeSourceKind", "WEB"), (f"{_IM}.KnowledgeSourceKind", "WORK_IQ"), (f"{_IM}.KnowledgeSourceKind", "FILE"), (f"{_IM}.KnowledgeSourceKind", "MCP_SERVER"), @@ -243,10 +260,34 @@ def _client_capabilities() -> Mapping[str, Mapping[str, Any]]: entries: dict = {} # Sync clients. method_existence = [ + f"{_KB}.KnowledgeBaseRetrievalClient.retrieve", + f"{_KB}.aio.KnowledgeBaseRetrievalClient.retrieve", + f"{_IDX}.SearchIndexClient.create_knowledge_base", + f"{_IDX}.SearchIndexClient.create_knowledge_source", + f"{_IDX}.SearchIndexClient.create_or_update_knowledge_base", + f"{_IDX}.SearchIndexClient.create_or_update_knowledge_source", + f"{_IDX}.SearchIndexClient.delete_knowledge_base", + f"{_IDX}.SearchIndexClient.delete_knowledge_source", + f"{_IDX}.SearchIndexClient.get_knowledge_base", + f"{_IDX}.SearchIndexClient.get_knowledge_source", + f"{_IDX}.SearchIndexClient.get_knowledge_source_status", + f"{_IDX}.SearchIndexClient.list_knowledge_bases", + f"{_IDX}.SearchIndexClient.list_knowledge_sources", f"{_IDX}.SearchIndexerClient.resync", f"{_IDX}.SearchIndexerClient.reset_documents", f"{_IDX}.SearchIndexerClient.reset_skills", f"{_IDX}.SearchIndexClient.list_index_stats_summary", + f"{_IDX}.aio.SearchIndexClient.create_knowledge_base", + f"{_IDX}.aio.SearchIndexClient.create_knowledge_source", + f"{_IDX}.aio.SearchIndexClient.create_or_update_knowledge_base", + f"{_IDX}.aio.SearchIndexClient.create_or_update_knowledge_source", + f"{_IDX}.aio.SearchIndexClient.delete_knowledge_base", + f"{_IDX}.aio.SearchIndexClient.delete_knowledge_source", + f"{_IDX}.aio.SearchIndexClient.get_knowledge_base", + f"{_IDX}.aio.SearchIndexClient.get_knowledge_source", + f"{_IDX}.aio.SearchIndexClient.get_knowledge_source_status", + f"{_IDX}.aio.SearchIndexClient.list_knowledge_bases", + f"{_IDX}.aio.SearchIndexClient.list_knowledge_sources", f"{_IDX}.aio.SearchIndexerClient.resync", f"{_IDX}.aio.SearchIndexerClient.reset_documents", f"{_IDX}.aio.SearchIndexerClient.reset_skills", @@ -303,7 +344,7 @@ def _client_capabilities() -> Mapping[str, Mapping[str, Any]]: "SearchClient.search.query_source_authorization": _surface( "azure.search.documents.SearchClient.search", ("query_source_authorization",) ), - "SearchItemPaged.get_debug_info": _surface("azure.search.documents.SearchItemPaged", ("get_debug_info",)), + "SearchItemPaged.get_debug_info": _surface("azure.search.documents.SearchItemPaged.get_debug_info"), "KnowledgeBaseRetrievalClient": _surface("azure.search.documents.knowledgebases.KnowledgeBaseRetrievalClient"), "KnowledgeBaseRetrievalClient.aio": _surface( "azure.search.documents.knowledgebases.aio.KnowledgeBaseRetrievalClient" diff --git a/sdk/search/azure-search-documents/tests/_search_helpers.py b/sdk/search/azure-search-documents/tests/_search_helpers.py index b13c685365bd..8cded939d495 100644 --- a/sdk/search/azure-search-documents/tests/_search_helpers.py +++ b/sdk/search/azure-search-documents/tests/_search_helpers.py @@ -14,19 +14,15 @@ import time from contextlib import contextmanager from dataclasses import dataclass, field -from typing import Any, Callable, Iterator, Optional +from typing import TYPE_CHECKING, Any, Callable, Iterator, Optional from azure.core.exceptions import HttpResponseError from azure.search.documents import IndexDocumentsBatch, SearchClient, SearchIndexingBufferedSender from azure.search.documents.indexes import SearchIndexClient, SearchIndexerClient from azure.search.documents.indexes.models import ( - KnowledgeBase, - KnowledgeSourceReference, SearchField, SearchFieldDataType, SearchIndex, - SearchIndexKnowledgeSource, - SearchIndexKnowledgeSourceParameters, SearchSuggester, SemanticConfiguration, SemanticField, @@ -37,6 +33,9 @@ from search_service_preparer import SearchEnvVarPreparer, search_decorator +if TYPE_CHECKING: + from azure.search.documents.indexes.models import KnowledgeBase, SearchIndexKnowledgeSource + KNOWLEDGE_BASE_DESCRIPTION = "Search knowledge base description" KNOWLEDGE_SOURCE_DESCRIPTION = "Search knowledge source description" @@ -293,6 +292,8 @@ def build_knowledge_source( *, description: str = KNOWLEDGE_SOURCE_DESCRIPTION, ) -> SearchIndexKnowledgeSource: + from azure.search.documents.indexes.models import SearchIndexKnowledgeSource, SearchIndexKnowledgeSourceParameters + return SearchIndexKnowledgeSource( name=knowledge_source_name, description=description, @@ -306,6 +307,8 @@ def build_knowledge_base( *, description: str = KNOWLEDGE_BASE_DESCRIPTION, ) -> KnowledgeBase: + from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference + return KnowledgeBase( name=knowledge_base_name, description=description, diff --git a/sdk/search/azure-search-documents/tests/_search_helpers_async.py b/sdk/search/azure-search-documents/tests/_search_helpers_async.py index 687ccb66d4f4..96de51e55e44 100644 --- a/sdk/search/azure-search-documents/tests/_search_helpers_async.py +++ b/sdk/search/azure-search-documents/tests/_search_helpers_async.py @@ -8,21 +8,20 @@ import asyncio from contextlib import asynccontextmanager -from typing import Any, AsyncIterator, Awaitable, Callable, Optional +from typing import TYPE_CHECKING, Any, AsyncIterator, Awaitable, Callable, Optional from azure.core.exceptions import HttpResponseError from azure.search.documents import IndexDocumentsBatch from azure.search.documents.aio import SearchClient, SearchIndexingBufferedSender from azure.search.documents.indexes.aio import SearchIndexClient, SearchIndexerClient -from azure.search.documents.indexes.models import ( - KnowledgeBase, - SearchIndexKnowledgeSource, -) from devtools_testutils import get_credential from devtools_testutils.aio import recorded_by_proxy_async from search_service_preparer import SearchEnvVarPreparer, search_decorator +if TYPE_CHECKING: + from azure.search.documents.indexes.models import KnowledgeBase, SearchIndexKnowledgeSource + from _search_helpers import ( HOTEL_DOCUMENT_COUNT, INDEXING_DELAY_SECONDS, diff --git a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_live.py b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live.py similarity index 52% rename from sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_live.py rename to sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live.py index 17e604f8160e..34525edefc21 100644 --- a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_live.py +++ b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live.py @@ -6,24 +6,45 @@ from __future__ import annotations -from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient -from azure.search.documents.knowledgebases.models import ( - KnowledgeBaseRetrievalRequest, - KnowledgeBaseRetrievalResponse, - KnowledgeRetrievalSemanticIntent, -) from devtools_testutils import AzureRecordedTestCase +from _capabilities import require_capability from _search_helpers import knowledge_base_resources, live_test KNOWLEDGE_BASE_RETRIEVAL_DESCRIPTION = "Knowledge base for retrieval client live coverage" KNOWLEDGE_SOURCE_RETRIEVAL_DESCRIPTION = "Knowledge source for retrieval client live coverage" RETRIEVAL_QUERY = "hotels with complimentary wireless internet" +_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES = ( + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_base", + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_base", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.get_knowledge_source_status", + "azure.search.documents.indexes.models.KnowledgeBase", + "azure.search.documents.indexes.models.KnowledgeSourceReference", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSource", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters", +) +_RETRIEVAL_CAPABILITIES = ( + "KnowledgeBaseRetrievalClient", + "azure.search.documents.knowledgebases.KnowledgeBaseRetrievalClient.retrieve", + "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest", + "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse", + "azure.search.documents.knowledgebases.models.KnowledgeRetrievalSemanticIntent", +) class TestKnowledgeBaseRetrievalClient(AzureRecordedTestCase): @live_test() def test_retrieve_returns_knowledge_base_response(self, endpoint: str) -> None: + require_capability(*_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, *_RETRIEVAL_CAPABILITIES) + from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient + from azure.search.documents.knowledgebases.models import ( + KnowledgeBaseRetrievalRequest, + KnowledgeBaseRetrievalResponse, + KnowledgeRetrievalSemanticIntent, + ) + with knowledge_base_resources( self, endpoint, diff --git a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_live_async.py b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live_async.py similarity index 53% rename from sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_live_async.py rename to sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live_async.py index 0a86c9db64d0..bb8720f95f46 100644 --- a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live_async.py @@ -6,24 +6,45 @@ from __future__ import annotations -from azure.search.documents.knowledgebases.aio import KnowledgeBaseRetrievalClient -from azure.search.documents.knowledgebases.models import ( - KnowledgeBaseRetrievalRequest, - KnowledgeBaseRetrievalResponse, - KnowledgeRetrievalSemanticIntent, -) from devtools_testutils import AzureRecordedTestCase +from _capabilities import require_capability from _search_helpers_async import knowledge_base_resources, live_test KNOWLEDGE_BASE_RETRIEVAL_DESCRIPTION = "Knowledge base for retrieval client live coverage" KNOWLEDGE_SOURCE_RETRIEVAL_DESCRIPTION = "Knowledge source for retrieval client live coverage" RETRIEVAL_QUERY = "hotels with complimentary wireless internet" +_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES = ( + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_base", + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_base", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.get_knowledge_source_status", + "azure.search.documents.indexes.models.KnowledgeBase", + "azure.search.documents.indexes.models.KnowledgeSourceReference", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSource", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters", +) +_RETRIEVAL_CAPABILITIES = ( + "KnowledgeBaseRetrievalClient.aio", + "azure.search.documents.knowledgebases.aio.KnowledgeBaseRetrievalClient.retrieve", + "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest", + "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse", + "azure.search.documents.knowledgebases.models.KnowledgeRetrievalSemanticIntent", +) class TestKnowledgeBaseRetrievalClientAsync(AzureRecordedTestCase): @live_test() async def test_retrieve_returns_knowledge_base_response(self, endpoint: str) -> None: + require_capability(*_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, *_RETRIEVAL_CAPABILITIES) + from azure.search.documents.knowledgebases.aio import KnowledgeBaseRetrievalClient + from azure.search.documents.knowledgebases.models import ( + KnowledgeBaseRetrievalRequest, + KnowledgeBaseRetrievalResponse, + KnowledgeRetrievalSemanticIntent, + ) + async with knowledge_base_resources( self, endpoint, diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live.py b/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live.py index f8fbe0a38a03..f5b118b02e0f 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live.py @@ -13,7 +13,6 @@ from azure.core.exceptions import HttpResponseError from azure.search.documents.indexes.models import ( AnalyzeTextOptions, - CorsOptions, FreshnessScoringFunction, FreshnessScoringParameters, ScoringFunctionAggregation, @@ -28,7 +27,6 @@ INDEX_DESCRIPTION = "Hotel index" REPLACEMENT_INDEX_DESCRIPTION = "Replacement hotel index" -CORS_OPTIONS = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) SCORING_PROFILE_NAME = "scoring-profile" REPLACEMENT_SCORING_PROFILE_NAME = "replacement-scoring-profile" @@ -45,14 +43,12 @@ def _build_hotel_index( *, description: str = INDEX_DESCRIPTION, scoring_profiles: list[ScoringProfile] | None = None, - cors_options: CorsOptions | None = CORS_OPTIONS, ) -> SearchIndex: return SearchIndex( name=index_name, fields=_build_hotel_fields(), description=description, scoring_profiles=scoring_profiles or [], - cors_options=cors_options, ) @@ -92,8 +88,6 @@ def test_create_get_list_statistics_analyze_and_delete_index(self, endpoint): assert created_index.name == index_name assert created_index.description == INDEX_DESCRIPTION assert created_index.scoring_profiles[0].name == SCORING_PROFILE_NAME - assert created_index.cors_options.allowed_origins == CORS_OPTIONS.allowed_origins - assert created_index.cors_options.max_age_in_seconds == CORS_OPTIONS.max_age_in_seconds retrieved_index = client.get_index(index_name) assert retrieved_index.name == index_name diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live_async.py b/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live_async.py index 479d51355bc0..e1de9580fe7a 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live_async.py @@ -13,7 +13,6 @@ from azure.core.exceptions import HttpResponseError from azure.search.documents.indexes.models import ( AnalyzeTextOptions, - CorsOptions, FreshnessScoringFunction, FreshnessScoringParameters, ScoringFunctionAggregation, @@ -28,7 +27,6 @@ INDEX_DESCRIPTION = "Hotel index" REPLACEMENT_INDEX_DESCRIPTION = "Replacement hotel index" -CORS_OPTIONS = CorsOptions(allowed_origins=["*"], max_age_in_seconds=60) SCORING_PROFILE_NAME = "scoring-profile" REPLACEMENT_SCORING_PROFILE_NAME = "replacement-scoring-profile" @@ -45,14 +43,12 @@ def _build_hotel_index( *, description: str = INDEX_DESCRIPTION, scoring_profiles: list[ScoringProfile] | None = None, - cors_options: CorsOptions | None = CORS_OPTIONS, ) -> SearchIndex: return SearchIndex( name=index_name, fields=_build_hotel_fields(), description=description, scoring_profiles=scoring_profiles or [], - cors_options=cors_options, ) @@ -96,8 +92,6 @@ async def test_create_get_list_statistics_analyze_and_delete_index(self, endpoin assert created_index.name == index_name assert created_index.description == INDEX_DESCRIPTION assert created_index.scoring_profiles[0].name == SCORING_PROFILE_NAME - assert created_index.cors_options.allowed_origins == CORS_OPTIONS.allowed_origins - assert created_index.cors_options.max_age_in_seconds == CORS_OPTIONS.max_age_in_seconds retrieved_index = await client.get_index(index_name) assert retrieved_index.name == index_name diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live.py b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live.py index 92454a007fcf..c6adcbe410fb 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live.py @@ -7,19 +7,34 @@ from __future__ import annotations from azure.core import MatchConditions -from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference from devtools_testutils import AzureRecordedTestCase +from _capabilities import require_capability from _search_helpers import knowledge_base_resources, live_test KNOWLEDGE_BASE_CONFIGURATION_DESCRIPTION = "Knowledge base configuration before replacement" KNOWLEDGE_SOURCE_CONFIGURATION_DESCRIPTION = "Knowledge source for knowledge base configuration coverage" REPLACEMENT_KNOWLEDGE_BASE_CONFIGURATION_DESCRIPTION = "Knowledge base configuration after replacement" +_KNOWLEDGE_BASE_CONFIGURATION_CAPABILITIES = ( + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_base", + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.create_or_update_knowledge_base", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_base", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.get_knowledge_base", + "azure.search.documents.indexes.models.KnowledgeBase", + "azure.search.documents.indexes.models.KnowledgeSourceReference", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSource", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters", +) class TestKnowledgeBaseConfiguration(AzureRecordedTestCase): @live_test() def test_create_or_update_knowledge_base_round_trips_references_description_and_etag(self, endpoint: str) -> None: + require_capability(*_KNOWLEDGE_BASE_CONFIGURATION_CAPABILITIES) + from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference + with knowledge_base_resources( self, endpoint, diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live_async.py b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live_async.py index f6953b19e90c..e38e6a18d2b1 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live_async.py @@ -7,14 +7,26 @@ from __future__ import annotations from azure.core import MatchConditions -from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference from devtools_testutils import AzureRecordedTestCase +from _capabilities import require_capability from _search_helpers_async import knowledge_base_resources, live_test KNOWLEDGE_BASE_CONFIGURATION_DESCRIPTION = "Knowledge base configuration before replacement" KNOWLEDGE_SOURCE_CONFIGURATION_DESCRIPTION = "Knowledge source for knowledge base configuration coverage" REPLACEMENT_KNOWLEDGE_BASE_CONFIGURATION_DESCRIPTION = "Knowledge base configuration after replacement" +_KNOWLEDGE_BASE_CONFIGURATION_CAPABILITIES = ( + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_base", + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.create_or_update_knowledge_base", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_base", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.get_knowledge_base", + "azure.search.documents.indexes.models.KnowledgeBase", + "azure.search.documents.indexes.models.KnowledgeSourceReference", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSource", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters", +) class TestKnowledgeBaseConfigurationAsync(AzureRecordedTestCase): @@ -22,6 +34,9 @@ class TestKnowledgeBaseConfigurationAsync(AzureRecordedTestCase): async def test_create_or_update_knowledge_base_round_trips_references_description_and_etag( self, endpoint: str ) -> None: + require_capability(*_KNOWLEDGE_BASE_CONFIGURATION_CAPABILITIES) + from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference + async with knowledge_base_resources( self, endpoint, diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live.py b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live.py index 4c7bf432882f..cc2cba61dbce 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live.py @@ -7,14 +7,27 @@ from __future__ import annotations from azure.core import MatchConditions -from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceKind, KnowledgeSourceReference from devtools_testutils import AzureRecordedTestCase +from _capabilities import require_capability from _search_helpers import knowledge_base_resources, live_test, poll_until KNOWLEDGE_BASE_DESCRIPTION = "Knowledge base for SearchIndexClient live coverage" KNOWLEDGE_SOURCE_DESCRIPTION = "Knowledge source for SearchIndexClient knowledge base coverage" REPLACEMENT_KNOWLEDGE_BASE_DESCRIPTION = "Knowledge base replacement for SearchIndexClient live coverage" +_KNOWLEDGE_BASE_MODEL_CAPABILITIES = ( + "azure.search.documents.indexes.models.KnowledgeBase", + "azure.search.documents.indexes.models.KnowledgeSourceReference", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSource", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters", +) +_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES = ( + *_KNOWLEDGE_BASE_MODEL_CAPABILITIES, + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_base", + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_base", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", +) def _knowledge_base_resources(test_case: AzureRecordedTestCase, endpoint: str, *, sdk_verb: str, scenario: str = ""): @@ -33,6 +46,7 @@ def _knowledge_base_resources(test_case: AzureRecordedTestCase, endpoint: str, * class TestSearchIndexClientKnowledgeBases(AzureRecordedTestCase): @live_test() def test_create_knowledge_base_returns_resource(self, endpoint: str) -> None: + require_capability(*_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES) with _knowledge_base_resources(self, endpoint, sdk_verb="create") as context: knowledge_base_name = context.knowledge_base_name knowledge_source_name = context.knowledge_source_name @@ -46,6 +60,12 @@ def test_create_knowledge_base_returns_resource(self, endpoint: str) -> None: @live_test() def test_create_or_update_knowledge_base_uses_model_name_and_etag(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.SearchIndexClient.create_or_update_knowledge_base", + ) + from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference + with _knowledge_base_resources(self, endpoint, sdk_verb="create-or-update") as context: knowledge_base_name = context.knowledge_base_name knowledge_source_name = context.knowledge_source_name @@ -69,6 +89,10 @@ def test_create_or_update_knowledge_base_uses_model_name_and_etag(self, endpoint @live_test() def test_get_knowledge_base_returns_named_resource(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.SearchIndexClient.get_knowledge_base", + ) with _knowledge_base_resources(self, endpoint, sdk_verb="get") as context: knowledge_base_name = context.knowledge_base_name knowledge_source_name = context.knowledge_source_name @@ -82,6 +106,10 @@ def test_get_knowledge_base_returns_named_resource(self, endpoint: str) -> None: @live_test() def test_list_knowledge_bases_includes_created_resource(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.SearchIndexClient.list_knowledge_bases", + ) with _knowledge_base_resources(self, endpoint, sdk_verb="list") as context: knowledge_base_name = context.knowledge_base_name @@ -91,6 +119,10 @@ def test_list_knowledge_bases_includes_created_resource(self, endpoint: str) -> @live_test() def test_delete_knowledge_base_accepts_model_and_etag(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.SearchIndexClient.list_knowledge_bases", + ) with _knowledge_base_resources(self, endpoint, sdk_verb="delete") as context: knowledge_base_name = context.knowledge_base_name @@ -107,6 +139,13 @@ def test_delete_knowledge_base_accepts_model_and_etag(self, endpoint: str) -> No class TestSearchIndexClientKnowledgeSourceStatus(AzureRecordedTestCase): @live_test() def test_get_knowledge_source_status_reaches_active_search_index_source(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.SearchIndexClient.get_knowledge_source_status", + "azure.search.documents.indexes.models.KnowledgeSourceKind.SEARCH_INDEX", + ) + from azure.search.documents.indexes.models import KnowledgeSourceKind + with _knowledge_base_resources(self, endpoint, sdk_verb="get", scenario="source-status") as context: knowledge_source_name = context.knowledge_source_name diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live_async.py b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live_async.py index e0f77630fd5d..69eaaf0762a8 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live_async.py @@ -7,14 +7,27 @@ from __future__ import annotations from azure.core import MatchConditions -from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceKind, KnowledgeSourceReference from devtools_testutils import AzureRecordedTestCase +from _capabilities import require_capability from _search_helpers_async import knowledge_base_resources, live_test, poll_until KNOWLEDGE_BASE_DESCRIPTION = "Knowledge base for SearchIndexClient live coverage" KNOWLEDGE_SOURCE_DESCRIPTION = "Knowledge source for SearchIndexClient knowledge base coverage" REPLACEMENT_KNOWLEDGE_BASE_DESCRIPTION = "Knowledge base replacement for SearchIndexClient live coverage" +_KNOWLEDGE_BASE_MODEL_CAPABILITIES = ( + "azure.search.documents.indexes.models.KnowledgeBase", + "azure.search.documents.indexes.models.KnowledgeSourceReference", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSource", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters", +) +_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES = ( + *_KNOWLEDGE_BASE_MODEL_CAPABILITIES, + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_base", + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_base", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", +) def _knowledge_base_resources(test_case: AzureRecordedTestCase, endpoint: str, *, sdk_verb: str, scenario: str = ""): @@ -33,6 +46,7 @@ def _knowledge_base_resources(test_case: AzureRecordedTestCase, endpoint: str, * class TestSearchIndexClientKnowledgeBasesAsync(AzureRecordedTestCase): @live_test() async def test_create_knowledge_base_returns_resource(self, endpoint: str) -> None: + require_capability(*_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES) async with _knowledge_base_resources(self, endpoint, sdk_verb="create") as context: knowledge_base_name = context.knowledge_base_name knowledge_source_name = context.knowledge_source_name @@ -46,6 +60,12 @@ async def test_create_knowledge_base_returns_resource(self, endpoint: str) -> No @live_test() async def test_create_or_update_knowledge_base_uses_model_name_and_etag(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.aio.SearchIndexClient.create_or_update_knowledge_base", + ) + from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference + async with _knowledge_base_resources(self, endpoint, sdk_verb="create-or-update") as context: knowledge_base_name = context.knowledge_base_name knowledge_source_name = context.knowledge_source_name @@ -69,6 +89,10 @@ async def test_create_or_update_knowledge_base_uses_model_name_and_etag(self, en @live_test() async def test_get_knowledge_base_returns_named_resource(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.aio.SearchIndexClient.get_knowledge_base", + ) async with _knowledge_base_resources(self, endpoint, sdk_verb="get") as context: knowledge_base_name = context.knowledge_base_name knowledge_source_name = context.knowledge_source_name @@ -82,6 +106,10 @@ async def test_get_knowledge_base_returns_named_resource(self, endpoint: str) -> @live_test() async def test_list_knowledge_bases_includes_created_resource(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.aio.SearchIndexClient.list_knowledge_bases", + ) async with _knowledge_base_resources(self, endpoint, sdk_verb="list") as context: knowledge_base_name = context.knowledge_base_name @@ -91,6 +119,10 @@ async def test_list_knowledge_bases_includes_created_resource(self, endpoint: st @live_test() async def test_delete_knowledge_base_accepts_model_and_etag(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.aio.SearchIndexClient.list_knowledge_bases", + ) async with _knowledge_base_resources(self, endpoint, sdk_verb="delete") as context: knowledge_base_name = context.knowledge_base_name @@ -107,6 +139,13 @@ async def test_delete_knowledge_base_accepts_model_and_etag(self, endpoint: str) class TestSearchIndexClientKnowledgeSourceStatusAsync(AzureRecordedTestCase): @live_test() async def test_get_knowledge_source_status_reaches_active_search_index_source(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + "azure.search.documents.indexes.aio.SearchIndexClient.get_knowledge_source_status", + "azure.search.documents.indexes.models.KnowledgeSourceKind.SEARCH_INDEX", + ) + from azure.search.documents.indexes.models import KnowledgeSourceKind + async with _knowledge_base_resources(self, endpoint, sdk_verb="get", scenario="source-status") as context: knowledge_source_name = context.knowledge_source_name diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live.py b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live.py index 063a6bc7ad28..338add7328fa 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live.py @@ -6,24 +6,38 @@ from __future__ import annotations +from typing import Any + from azure.core import MatchConditions -from azure.search.documents.indexes.models import ( - KnowledgeSourceKind, - WebKnowledgeSource, - WebKnowledgeSourceDomain, - WebKnowledgeSourceDomains, - WebKnowledgeSourceParameters, -) from devtools_testutils import AzureRecordedTestCase +from _capabilities import require_capability from _search_helpers import live_test, make_index_client, safe_delete WEB_DOMAIN_ADDRESS = "https://learn.microsoft.com" WEB_KNOWLEDGE_SOURCE_DESCRIPTION = "Web knowledge source for SearchIndexClient live coverage" REPLACEMENT_WEB_KNOWLEDGE_SOURCE_DESCRIPTION = "Web knowledge source replacement for SearchIndexClient live coverage" +_WEB_KNOWLEDGE_SOURCE_MODEL_CAPABILITIES = ( + "azure.search.documents.indexes.models.KnowledgeSourceKind.WEB", + "azure.search.documents.indexes.models.WebKnowledgeSource", + "azure.search.documents.indexes.models.WebKnowledgeSourceDomain", + "azure.search.documents.indexes.models.WebKnowledgeSourceDomains", + "azure.search.documents.indexes.models.WebKnowledgeSourceParameters", +) + + +def _require_web_knowledge_source_capabilities(*methods: str) -> None: + require_capability(*_WEB_KNOWLEDGE_SOURCE_MODEL_CAPABILITIES, *methods) -def _build_web_knowledge_source(knowledge_source_name: str) -> WebKnowledgeSource: +def _build_web_knowledge_source(knowledge_source_name: str) -> Any: + from azure.search.documents.indexes.models import ( + WebKnowledgeSource, + WebKnowledgeSourceDomain, + WebKnowledgeSourceDomains, + WebKnowledgeSourceParameters, + ) + return WebKnowledgeSource( name=knowledge_source_name, description=WEB_KNOWLEDGE_SOURCE_DESCRIPTION, @@ -40,7 +54,9 @@ def _build_web_knowledge_source(knowledge_source_name: str) -> WebKnowledgeSourc ) -def _assert_web_knowledge_source(result: WebKnowledgeSource, knowledge_source_name: str) -> None: +def _assert_web_knowledge_source(result: Any, knowledge_source_name: str) -> None: + from azure.search.documents.indexes.models import KnowledgeSourceKind + assert result.name == knowledge_source_name assert result.kind == KnowledgeSourceKind.WEB assert result.description == WEB_KNOWLEDGE_SOURCE_DESCRIPTION @@ -54,6 +70,10 @@ def _assert_web_knowledge_source(result: WebKnowledgeSource, knowledge_source_na class TestSearchIndexClientWebKnowledgeSources(AzureRecordedTestCase): @live_test() def test_create_knowledge_source_returns_web_source(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", + ) knowledge_source_name = self.get_resource_name("knowledge-source-create-web") with make_index_client(endpoint) as client: @@ -67,6 +87,13 @@ def test_create_knowledge_source_returns_web_source(self, endpoint: str) -> None @live_test() def test_create_or_update_knowledge_source_uses_model_name_and_etag(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.create_or_update_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", + ) + from azure.search.documents.indexes.models import KnowledgeSourceKind, WebKnowledgeSource + knowledge_source_name = self.get_resource_name("knowledge-source-create-or-update-web") with make_index_client(endpoint) as client: @@ -93,6 +120,11 @@ def test_create_or_update_knowledge_source_uses_model_name_and_etag(self, endpoi @live_test() def test_get_knowledge_source_returns_named_web_source(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.get_knowledge_source", + ) knowledge_source_name = self.get_resource_name("knowledge-source-get-web") with make_index_client(endpoint) as client: @@ -107,6 +139,11 @@ def test_get_knowledge_source_returns_named_web_source(self, endpoint: str) -> N @live_test() def test_list_knowledge_sources_includes_created_web_source(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.list_knowledge_sources", + ) knowledge_source_name = self.get_resource_name("knowledge-source-list-web") with make_index_client(endpoint) as client: @@ -121,6 +158,11 @@ def test_list_knowledge_sources_includes_created_web_source(self, endpoint: str) @live_test() def test_delete_knowledge_source_accepts_model_and_etag(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.list_knowledge_sources", + ) knowledge_source_name = self.get_resource_name("knowledge-source-delete-web") with make_index_client(endpoint) as client: @@ -140,6 +182,13 @@ def test_delete_knowledge_source_accepts_model_and_etag(self, endpoint: str) -> @live_test() def test_get_knowledge_source_status_returns_web_status(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.get_knowledge_source_status", + ) + from azure.search.documents.indexes.models import KnowledgeSourceKind + knowledge_source_name = self.get_resource_name("knowledge-source-get-status-web") with make_index_client(endpoint) as client: diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live_async.py b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live_async.py index 73be7df35164..4782a2ddad28 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live_async.py @@ -6,24 +6,38 @@ from __future__ import annotations +from typing import Any + from azure.core import MatchConditions -from azure.search.documents.indexes.models import ( - KnowledgeSourceKind, - WebKnowledgeSource, - WebKnowledgeSourceDomain, - WebKnowledgeSourceDomains, - WebKnowledgeSourceParameters, -) from devtools_testutils import AzureRecordedTestCase +from _capabilities import require_capability from _search_helpers_async import live_test, make_index_client, safe_delete WEB_DOMAIN_ADDRESS = "https://learn.microsoft.com" WEB_KNOWLEDGE_SOURCE_DESCRIPTION = "Web knowledge source for SearchIndexClient live coverage" REPLACEMENT_WEB_KNOWLEDGE_SOURCE_DESCRIPTION = "Web knowledge source replacement for SearchIndexClient live coverage" +_WEB_KNOWLEDGE_SOURCE_MODEL_CAPABILITIES = ( + "azure.search.documents.indexes.models.KnowledgeSourceKind.WEB", + "azure.search.documents.indexes.models.WebKnowledgeSource", + "azure.search.documents.indexes.models.WebKnowledgeSourceDomain", + "azure.search.documents.indexes.models.WebKnowledgeSourceDomains", + "azure.search.documents.indexes.models.WebKnowledgeSourceParameters", +) + + +def _require_web_knowledge_source_capabilities(*methods: str) -> None: + require_capability(*_WEB_KNOWLEDGE_SOURCE_MODEL_CAPABILITIES, *methods) -def _build_web_knowledge_source(knowledge_source_name: str) -> WebKnowledgeSource: +def _build_web_knowledge_source(knowledge_source_name: str) -> Any: + from azure.search.documents.indexes.models import ( + WebKnowledgeSource, + WebKnowledgeSourceDomain, + WebKnowledgeSourceDomains, + WebKnowledgeSourceParameters, + ) + return WebKnowledgeSource( name=knowledge_source_name, description=WEB_KNOWLEDGE_SOURCE_DESCRIPTION, @@ -40,7 +54,9 @@ def _build_web_knowledge_source(knowledge_source_name: str) -> WebKnowledgeSourc ) -def _assert_web_knowledge_source(result: WebKnowledgeSource, knowledge_source_name: str) -> None: +def _assert_web_knowledge_source(result: Any, knowledge_source_name: str) -> None: + from azure.search.documents.indexes.models import KnowledgeSourceKind + assert result.name == knowledge_source_name assert result.kind == KnowledgeSourceKind.WEB assert result.description == WEB_KNOWLEDGE_SOURCE_DESCRIPTION @@ -54,6 +70,10 @@ def _assert_web_knowledge_source(result: WebKnowledgeSource, knowledge_source_na class TestSearchIndexClientWebKnowledgeSourcesAsync(AzureRecordedTestCase): @live_test() async def test_create_knowledge_source_returns_web_source(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", + ) knowledge_source_name = self.get_resource_name("knowledge-source-create-web") async with make_index_client(endpoint) as client: @@ -67,6 +87,13 @@ async def test_create_knowledge_source_returns_web_source(self, endpoint: str) - @live_test() async def test_create_or_update_knowledge_source_uses_model_name_and_etag(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.create_or_update_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", + ) + from azure.search.documents.indexes.models import KnowledgeSourceKind, WebKnowledgeSource + knowledge_source_name = self.get_resource_name("knowledge-source-create-or-update-web") async with make_index_client(endpoint) as client: @@ -93,6 +120,11 @@ async def test_create_or_update_knowledge_source_uses_model_name_and_etag(self, @live_test() async def test_get_knowledge_source_returns_named_web_source(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.get_knowledge_source", + ) knowledge_source_name = self.get_resource_name("knowledge-source-get-web") async with make_index_client(endpoint) as client: @@ -107,6 +139,11 @@ async def test_get_knowledge_source_returns_named_web_source(self, endpoint: str @live_test() async def test_list_knowledge_sources_includes_created_web_source(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.list_knowledge_sources", + ) knowledge_source_name = self.get_resource_name("knowledge-source-list-web") async with make_index_client(endpoint) as client: @@ -121,6 +158,11 @@ async def test_list_knowledge_sources_includes_created_web_source(self, endpoint @live_test() async def test_delete_knowledge_source_accepts_model_and_etag(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.list_knowledge_sources", + ) knowledge_source_name = self.get_resource_name("knowledge-source-delete-web") async with make_index_client(endpoint) as client: @@ -140,6 +182,13 @@ async def test_delete_knowledge_source_accepts_model_and_etag(self, endpoint: st @live_test() async def test_get_knowledge_source_status_returns_web_status(self, endpoint: str) -> None: + _require_web_knowledge_source_capabilities( + "azure.search.documents.indexes.aio.SearchIndexClient.create_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.get_knowledge_source_status", + ) + from azure.search.documents.indexes.models import KnowledgeSourceKind + knowledge_source_name = self.get_resource_name("knowledge-source-get-status-web") async with make_index_client(endpoint) as client: diff --git a/sdk/search/azure-search-documents/tests/test_search_index_model.py b/sdk/search/azure-search-documents/tests/test_search_index_model.py index 1c031e7a8669..2281186ae7bc 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_model.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_model.py @@ -2,17 +2,12 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ -"""Unit tests for ``SearchIndex`` helper serialization and preview surfaces. - -Preview-gated round-trip tests live alongside the GA helper tests and use -``require_capability`` so the file remains import-safe on GA branches. -""" +"""Unit tests for ``SearchIndex`` helper serialization.""" from __future__ import annotations from azure.search.documents.indexes.models import ( ComplexField, - CorsOptions, SearchFieldDataType, SearchIndex, SearchableField, @@ -43,7 +38,6 @@ def create_search_index(index_name=INDEX_NAME): return SearchIndex( name=index_name, fields=create_hotel_fields(), - cors_options=CorsOptions(allowed_origins=["https://portal.contoso.example"], max_age_in_seconds=60), ) @@ -89,10 +83,6 @@ def test_search_index_serializes_helper_fields_to_wire_names(self): "retrievable": True, }, ] - assert serialized["corsOptions"] == { - "allowedOrigins": ["https://portal.contoso.example"], - "maxAgeInSeconds": 60, - } def test_search_index_round_trips_helper_field_wire_shape(self): serialized = create_search_index().as_dict() @@ -107,5 +97,3 @@ def test_search_index_round_trips_helper_field_wire_shape(self): assert index.fields[2].analyzer_name == "en.lucene" assert index.fields[3].type == "Collection(Edm.String)" assert index.fields[4].fields[1].name == "State" - assert index.cors_options.allowed_origins == ["https://portal.contoso.example"] - assert index.cors_options.max_age_in_seconds == 60 diff --git a/sdk/search/azure-search-documents/tests/test_search_indexer_models.py b/sdk/search/azure-search-documents/tests/test_search_indexer_models.py index 4a6fbbe21007..45681521a437 100644 --- a/sdk/search/azure-search-documents/tests/test_search_indexer_models.py +++ b/sdk/search/azure-search-documents/tests/test_search_indexer_models.py @@ -8,15 +8,9 @@ from __future__ import annotations from azure.search.documents.indexes.models import ( - CognitiveServicesAccountKey, - InputFieldMappingEntry, - OutputFieldMappingEntry, SearchIndexerDataContainer, SearchIndexerDataSourceConnection, SearchIndexerDataSourceType, - SearchIndexerSkillset, - SplitSkill, - TextSplitMode, ) DATA_SOURCE_NAME = "hotel-data-source" @@ -26,10 +20,6 @@ ) CONTAINER_NAME = "hotel-documents" REPLACEMENT_CONNECTION_STRING = "" -SKILLSET_NAME = "hotel-skillset" -SPLIT_SKILL_NAME = "split-hotel-description" -COGNITIVE_SERVICES_KEY = "00000000000000000000000000000000" -COGNITIVE_SERVICES_DESCRIPTION = "Skillset cognitive services account" def create_data_source(connection_string=CONNECTION_STRING): @@ -41,26 +31,6 @@ def create_data_source(connection_string=CONNECTION_STRING): ) -def create_skillset(): - return SearchIndexerSkillset( - name=SKILLSET_NAME, - skills=[ - SplitSkill( - name=SPLIT_SKILL_NAME, - inputs=[InputFieldMappingEntry(name="text", source="/document/Description")], - outputs=[OutputFieldMappingEntry(name="textItems", target_name="pages")], - context="/document", - text_split_mode=TextSplitMode.PAGES, - maximum_page_length=5000, - ) - ], - cognitive_services_account=CognitiveServicesAccountKey( - key=COGNITIVE_SERVICES_KEY, - description=COGNITIVE_SERVICES_DESCRIPTION, - ), - ) - - class TestSearchIndexerDataSourceConnectionSerialization: def test_connection_string_overload_serializes_as_nested_credentials(self): data_source = create_data_source() @@ -82,34 +52,3 @@ def test_connection_string_property_round_trips_through_credentials(self): assert data_source.connection_string == REPLACEMENT_CONNECTION_STRING assert data_source.credentials.connection_string == REPLACEMENT_CONNECTION_STRING assert data_source.as_dict()["credentials"] == {"connectionString": REPLACEMENT_CONNECTION_STRING} - - -class TestSearchIndexerSkillsetSerialization: - def test_skillset_round_trips_split_skill_and_cognitive_services(self): - skillset = create_skillset() - - serialized = skillset.as_dict() - round_trip = SearchIndexerSkillset(serialized) - - assert serialized["name"] == SKILLSET_NAME - assert serialized["cognitiveServices"] == { - "@odata.type": "#Microsoft.Azure.Search.CognitiveServicesByKey", - "description": COGNITIVE_SERVICES_DESCRIPTION, - "key": COGNITIVE_SERVICES_KEY, - } - assert serialized["skills"][0]["@odata.type"] == "#Microsoft.Skills.Text.SplitSkill" - assert serialized["skills"][0]["name"] == SPLIT_SKILL_NAME - assert serialized["skills"][0]["context"] == "/document" - assert serialized["skills"][0]["inputs"] == [{"name": "text", "source": "/document/Description"}] - assert serialized["skills"][0]["outputs"] == [{"name": "textItems", "targetName": "pages"}] - assert serialized["skills"][0]["textSplitMode"] == "pages" - assert serialized["skills"][0]["maximumPageLength"] == 5000 - assert round_trip.name == SKILLSET_NAME - assert round_trip.cognitive_services_account.key == COGNITIVE_SERVICES_KEY - assert round_trip.cognitive_services_account.description == COGNITIVE_SERVICES_DESCRIPTION - assert round_trip.skills[0].name == SPLIT_SKILL_NAME - assert round_trip.skills[0].context == "/document" - assert round_trip.skills[0].inputs[0].source == "/document/Description" - assert round_trip.skills[0].outputs[0].target_name == "pages" - assert round_trip.skills[0].text_split_mode == "pages" - assert round_trip.skills[0].maximum_page_length == 5000 diff --git a/sdk/search/azure-search-documents/tsp-location.yaml b/sdk/search/azure-search-documents/tsp-location.yaml index e087e99c6206..e508d45289e9 100644 --- a/sdk/search/azure-search-documents/tsp-location.yaml +++ b/sdk/search/azure-search-documents/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/search/data-plane/Search -commit: c3500ccf73433d095fac59c07ee72ecfd6576f3d +commit: 94762f261b92c73966ae86d77ef862133e172f78 repo: Azure/azure-rest-api-specs From d38dd3cb5ba81b772df72a6a43fa342509d70fb7 Mon Sep 17 00:00:00 2001 From: Zixin Yao Date: Fri, 15 May 2026 23:36:11 -0700 Subject: [PATCH 5/5] Allow SearchResourceEncryptionKey to be created without required parameters Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../search/documents/indexes/models/_patch.py | 30 ++++++++++++++++- .../tests/test_search_indexer_models.py | 33 +++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) 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 2fb18c507aa8..00e98e8b9b76 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 @@ -12,6 +12,7 @@ from ._models import SearchField as _SearchField from ._models import SearchIndexerDataSourceConnection as _SearchIndexerDataSourceConnection from ._models import KnowledgeBase as _KnowledgeBase +from ._models import SearchResourceEncryptionKey as _SearchResourceEncryptionKey from ._enums import ( LexicalAnalyzerName, SearchFieldDataType as _SearchFieldDataType, @@ -19,12 +20,12 @@ if TYPE_CHECKING: from ._models import ( + AzureActiveDirectoryApplicationCredentials, DataChangeDetectionPolicy, DataDeletionDetectionPolicy, DataSourceCredentials, SearchIndexerDataContainer, SearchIndexerDataIdentity, - SearchResourceEncryptionKey, ) from ._enums import SearchIndexerDataSourceType @@ -120,6 +121,32 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class SearchResourceEncryptionKey(_SearchResourceEncryptionKey): + """A customer-managed encryption key in Azure Key Vault.""" + + @overload + def __init__( + self, + *, + key_name: Optional[str] = None, + vault_uri: Optional[str] = None, + key_version: Optional[str] = None, + access_credentials: Optional["AzureActiveDirectoryApplicationCredentials"] = None, + identity: Optional["SearchIndexerDataIdentity"] = None, + is_service_level_key: Optional[bool] = 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 KnowledgeBase(_KnowledgeBase): """Represents a knowledge base definition.""" @@ -427,6 +454,7 @@ def ComplexField( "SearchField", "SearchFieldDataType", "SearchIndexerDataSourceConnection", + "SearchResourceEncryptionKey", "SimpleField", "SearchableField", "ComplexField", diff --git a/sdk/search/azure-search-documents/tests/test_search_indexer_models.py b/sdk/search/azure-search-documents/tests/test_search_indexer_models.py index 45681521a437..51edcc2ca94f 100644 --- a/sdk/search/azure-search-documents/tests/test_search_indexer_models.py +++ b/sdk/search/azure-search-documents/tests/test_search_indexer_models.py @@ -7,12 +7,18 @@ from __future__ import annotations +from inspect import Parameter, signature +from typing import get_overloads + from azure.search.documents.indexes.models import ( SearchIndexerDataContainer, SearchIndexerDataSourceConnection, SearchIndexerDataSourceType, + SearchResourceEncryptionKey, ) +from _capabilities import require_capability + DATA_SOURCE_NAME = "hotel-data-source" CONNECTION_STRING = ( "ResourceId=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/search/" @@ -52,3 +58,30 @@ def test_connection_string_property_round_trips_through_credentials(self): assert data_source.connection_string == REPLACEMENT_CONNECTION_STRING assert data_source.credentials.connection_string == REPLACEMENT_CONNECTION_STRING assert data_source.as_dict()["credentials"] == {"connectionString": REPLACEMENT_CONNECTION_STRING} + + +class TestSearchResourceEncryptionKey: + def test_search_resource_encryption_key_allows_service_level_key_without_vault_details(self): + require_capability( + "azure.search.documents.indexes.models.SearchResourceEncryptionKey.is_service_level_key" + ) + overload = next( + ( + overload + for overload in get_overloads(SearchResourceEncryptionKey.__init__) + if "key_name" in signature(overload).parameters + ), + None, + ) + assert overload is not None + required_keywords = [ + name + for name, parameter in signature(overload).parameters.items() + if parameter.kind is Parameter.KEYWORD_ONLY and parameter.default is Parameter.empty + ] + assert required_keywords == [] + + encryption_key = SearchResourceEncryptionKey() + encryption_key.is_service_level_key = True + + assert encryption_key.as_dict() == {"isServiceLevelKey": True}