diff --git a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/SKILL.md b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/SKILL.md index a0982992a6dc..beaa36f33ff9 100644 --- a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/SKILL.md +++ b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/SKILL.md @@ -34,6 +34,10 @@ cd sdk/search/azure-search-documents tsp-client update # or: azsdk_package_generate_code +# Reapply temporary Python emitter workarounds, then verify they are present: +python .github/skills/azure-search-documents/scripts/apply_generator_workarounds.py +python .github/skills/azure-search-documents/scripts/apply_generator_workarounds.py --check + # If the API version changed, _metadata.json updates automatically; # reconcile the hand-maintained ApiVersion enum in Step 3. ``` diff --git a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/customizations.md b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/customizations.md index dbadf11a7a76..facd5134f7b5 100644 --- a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/customizations.md +++ b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/references/customizations.md @@ -2,6 +2,21 @@ File-by-file inventory of every non-empty `_patch.py` in `azure-search-documents`. Use this after running `tsp-client update` to verify each customization still holds. +## Temporary Python emitter workarounds + + Until the emitter issues encoded in the package-owned rewriter are fixed upstream, run it after + +```bash +python .github/skills/azure-search-documents/scripts/apply_generator_workarounds.py +python .github/skills/azure-search-documents/scripts/apply_generator_workarounds.py --check +``` + +The script is idempotent and applies exact replacements only. It exits with an error before writing +files if the emitter output no longer matches either the known generated or patched form. Remove the +script and these instructions after the emitter produces all four corrected type surfaces and the +package passes MyPy without the rewriter. +Note: Occasionally, types.py might import packages incorrectly. Verify that the imports are valid and actually reference something valid. + --- ## File: `azure/search/documents/_patch.py` diff --git a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/scripts/Set-LiveTestEnvironment.sample.ps1 b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/scripts/Set-LiveTestEnvironment.sample.ps1 index dd60dba1196d..06dac78340c7 100644 --- a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/scripts/Set-LiveTestEnvironment.sample.ps1 +++ b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/scripts/Set-LiveTestEnvironment.sample.ps1 @@ -12,9 +12,19 @@ $env:SEARCH_SERVICE_ENDPOINT = "https://.search.windows.net $env:SEARCH_SERVICE_NAME = "" $env:SEARCH_STORAGE_CONNECTION_STRING = "" $env:SEARCH_STORAGE_CONTAINER_NAME = "" +$env:SEARCH_AZURE_OPENAI_ENDPOINT = "https://.openai.azure.com" +$env:SEARCH_AZURE_OPENAI_EMBEDDING_DEPLOYMENT = "" +$env:SEARCH_AZURE_OPENAI_EMBEDDING_MODEL = "" # Uncomment when recording live tests. # $env:AZURE_TEST_RUN_LIVE = "true" -# Uncomment if you need to authenticate before live tests. +# Option 1: authenticate with Azure CLI and uncomment the auth selector. # az login --tenant "" +# $env:AZURE_TEST_USE_CLI_AUTH = "true" + +# Option 2: configure a test service principal. Keep these values only in the +# untracked Set-LiveTestEnvironment.ps1 file. +# $env:AZURE_TENANT_ID = "" +# $env:AZURE_CLIENT_ID = "" +# $env:AZURE_CLIENT_SECRET = "" diff --git a/sdk/search/azure-search-documents/.github/skills/azure-search-documents/scripts/apply_generator_workarounds.py b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/scripts/apply_generator_workarounds.py new file mode 100644 index 000000000000..5cba52dd0f8b --- /dev/null +++ b/sdk/search/azure-search-documents/.github/skills/azure-search-documents/scripts/apply_generator_workarounds.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python3 +"""Apply temporary azure-search-documents Python emitter workarounds. Delete when emitter fixes the issues.""" + +from __future__ import annotations + +import argparse +from dataclasses import dataclass +from pathlib import Path + + +PACKAGE_ROOT = Path(__file__).resolve().parents[4] + + +@dataclass(frozen=True) +class Replacement: + path: str + description: str + generated: str + patched: str + applies_when: str | None = None + + +REPLACEMENTS = ( + Replacement( + "azure/search/documents/models/__init__.py", + "export SemanticQueryRewritesResultType", + """ SemanticFieldState, + SemanticSearchResultsType, +""", + """ SemanticFieldState, + SemanticQueryRewritesResultType, + SemanticSearchResultsType, +""", + ), + Replacement( + "azure/search/documents/models/__init__.py", + "include SemanticQueryRewritesResultType in __all__", + """ "SemanticFieldState", + "SemanticSearchResultsType", +""", + """ "SemanticFieldState", + "SemanticQueryRewritesResultType", + "SemanticSearchResultsType", +""", + ), + Replacement( + "azure/search/documents/types.py", + "use the imported SemanticQueryRewritesResultType enum", + '"@search.semanticQueryRewritesResultType": Union[str, "_enums.SemanticQueryRewritesResultType"],', + '"@search.semanticQueryRewritesResultType": Union[str, "SemanticQueryRewritesResultType"],', + applies_when="@search.semanticQueryRewritesResultType", + ), + Replacement( + "azure/search/documents/knowledgebases/types.py", + "remove the duplicate KnowledgeSourceKind type-only import", + """ KnowledgeSourceIngestionPermissionOption, + KnowledgeSourceKind, + KnowledgeSourceResultsProcessing, +""", + """ KnowledgeSourceIngestionPermissionOption, + KnowledgeSourceResultsProcessing, +""", + applies_when="KnowledgeSourceIngestionPermissionOption", + ), + Replacement( + "azure/search/documents/indexes/types.py", + "avoid overriding TypedDict field requiredness", + """class SearchIndexerKnowledgeStoreTableProjectionSelector( + SearchIndexerKnowledgeStoreProjectionSelector +): # pylint: disable=name-too-long + \"\"\"Description for what data to store in Azure Tables. + + :ivar referenceKeyName: Name of reference key to different projection. + :vartype referenceKeyName: str + :ivar source: Source data to project. + :vartype source: str + :ivar sourceContext: Source context for complex projections. + :vartype sourceContext: str + :ivar inputs: Nested inputs for complex projections. + :vartype inputs: list[\"InputFieldMappingEntry\"] + :ivar generatedKeyName: Name of generated key to store projection under. Required. + :vartype generatedKeyName: str + :ivar tableName: Name of the Azure table to store projected data in. Required. + :vartype tableName: str + \"\"\" + + generatedKeyName: Required[str] + \"\"\"Name of generated key to store projection under. Required.\"\"\" + tableName: Required[str] + \"\"\"Name of the Azure table to store projected data in. Required.\"\"\" +""", + ( + "class SearchIndexerKnowledgeStoreTableProjectionSelector(TypedDict, total=False): " + "# pylint: disable=name-too-long\n" + """ \"\"\"Description for what data to store in Azure Tables. + + :ivar referenceKeyName: Name of reference key to different projection. + :vartype referenceKeyName: str + :ivar source: Source data to project. + :vartype source: str + :ivar sourceContext: Source context for complex projections. + :vartype sourceContext: str + :ivar inputs: Nested inputs for complex projections. + :vartype inputs: list[\"InputFieldMappingEntry\"] + :ivar generatedKeyName: Name of generated key to store projection under. Required. + :vartype generatedKeyName: str + :ivar tableName: Name of the Azure table to store projected data in. Required. + :vartype tableName: str + \"\"\" + + referenceKeyName: str + \"\"\"Name of reference key to different projection.\"\"\" + source: str + \"\"\"Source data to project.\"\"\" + sourceContext: str + \"\"\"Source context for complex projections.\"\"\" + inputs: list[\"InputFieldMappingEntry\"] + \"\"\"Nested inputs for complex projections.\"\"\" + generatedKeyName: Required[str] + \"\"\"Name of generated key to store projection under. Required.\"\"\" + tableName: Required[str] + \"\"\"Name of the Azure table to store projected data in. Required.\"\"\" +""" + ), + ), + Replacement( + "azure/search/documents/indexes/types.py", + "import KnowledgeSourceIngestionParameters from the public models namespace", + " from ..knowledgebases.types import KnowledgeRetrievalReasoningEffort, KnowledgeSourceIngestionParameters\n", + " from ..knowledgebases.models import KnowledgeSourceIngestionParameters\n" + " from ..knowledgebases.types import KnowledgeRetrievalReasoningEffort\n", + ), + Replacement( + "azure/search/documents/indexes/_operations/_operations.py", + "suppress protected access for the generated SearchIndexResponse type", + " list[_models1._models.SearchIndexResponse],\n" + ' deserialized.get("value", []),\n' + " )", + " list[_models1._models.SearchIndexResponse], # pylint: disable=protected-access\n" + ' deserialized.get("value", []),\n' + " )", + ), + Replacement( + "azure/search/documents/indexes/aio/_operations/_operations.py", + "suppress protected access for the generated async SearchIndexResponse type", + " list[_models2._models.SearchIndexResponse],\n" + ' deserialized.get("value", []),\n' + " )", + " list[_models2._models.SearchIndexResponse], # pylint: disable=protected-access\n" + ' deserialized.get("value", []),\n' + " )", + ), +) + + +def update_sources(*, check: bool) -> int: + sources: dict[Path, str] = {} + pending: list[str] = [] + + for replacement in REPLACEMENTS: + path = PACKAGE_ROOT / replacement.path + source = sources.setdefault(path, path.read_text(encoding="utf-8")) + generated_count = source.count(replacement.generated) + patched_count = source.count(replacement.patched) + + if generated_count == 1 and patched_count == 0: + sources[path] = source.replace(replacement.generated, replacement.patched, 1) + pending.append(replacement.description) + elif generated_count == 0 and patched_count == 1: + continue + elif replacement.applies_when is not None and replacement.applies_when not in source: + continue + else: + raise RuntimeError( + f"Unexpected emitter output in {replacement.path} while attempting to " + f"{replacement.description}; expected exactly one generated or patched snippet" + ) + + if check: + if pending: + print("Generator workarounds are required:") + for description in pending: + print(f"- {description}") + return 1 + print("Generator workarounds are applied.") + return 0 + + for path, source in sources.items(): + path.write_text(source, encoding="utf-8") + + if pending: + print("Applied generator workarounds:") + for description in pending: + print(f"- {description}") + else: + print("Generator workarounds were already applied.") + return 0 + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "--check", + action="store_true", + help="verify that all workarounds are applied without changing files", + ) + args = parser.parse_args() + return update_sources(check=args.check) + + +if __name__ == "__main__": + raise SystemExit(main()) \ No newline at end of file diff --git a/sdk/search/azure-search-documents/CHANGELOG.md b/sdk/search/azure-search-documents/CHANGELOG.md index ddec13dd33b2..2f7d81c14c58 100644 --- a/sdk/search/azure-search-documents/CHANGELOG.md +++ b/sdk/search/azure-search-documents/CHANGELOG.md @@ -1,15 +1,87 @@ # Release History -## 12.1.0b2 (Unreleased) +## 12.1.0b2 (2026-08-27) ### Features Added +- Added `ApiVersion.V2026_08_01_PREVIEW` so the `2026-08-01-preview` Search API version can be + selected via the `api_version` keyword on the clients. +- Added filtered and paged resource listing with `search`, `page_size`, and `search_type` parameters. + File listings also support `prefix`. +- Added multipart File knowledge source operations and models: + - `azure.search.documents.indexes.SearchIndexClient.update_knowledge_source_file` + - `azure.search.documents.indexes.SearchIndexClient.upload_knowledge_source_file_multipart` + - `azure.search.documents.indexes.models.FileUploadMetadata` + - `azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest` + - `azure.search.documents.indexes.models.UploadKnowledgeSourceFileMultipartRequest` +- Added knowledge source query-hint and result-processing models: + - `azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing` + - `azure.search.documents.indexes.models.SearchIndexKnowledgeSourceBoost` + - `azure.search.documents.indexes.models.SearchIndexKnowledgeSourceBoostKind` + - `azure.search.documents.indexes.models.SearchIndexKnowledgeSourceFieldValueBoost` + - `azure.search.documents.indexes.models.SearchIndexKnowledgeSourceFilterHint` + - `azure.search.documents.indexes.models.SearchIndexKnowledgeSourceMultiWordExpressionBoost` + - `azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints` + - `azure.search.documents.knowledgebases.models.KnowledgeBaseQueryHintProcessing` +- Added knowledge base retrieval streaming through + `azure.search.documents.knowledgebases.KnowledgeBaseRetrievalClient.retrieve_stream` and its + asynchronous equivalent. The methods return closeable streams of typed + `KnowledgeBaseRetrievalEvent` instances. New stream payload models include: + - `azure.search.documents.knowledgebases.models.KnowledgeBaseActivityStartedEvent` + - `azure.search.documents.knowledgebases.models.KnowledgeBaseAnswerCompletedEvent` + - `azure.search.documents.knowledgebases.models.KnowledgeBaseResponseCompletedEvent` + - `azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalStartedEvent` + - `azure.search.documents.knowledgebases.models.KnowledgeBaseStreamErrorEvent` +- Added knowledge base configuration and retrieval features: + - Knowledge base `tags` and persisted `retrieve_defaults`. + - Per-source `never_query_source`, `results_processing`, and `query_hint_overrides`. + - `KnowledgeRetrievalAutoReasoningEffort` for automatic reasoning-effort selection. + - Activity start/completion timestamps, model metadata, query-hint processing details, and + served-image metadata. + - Citation URLs on index-backed knowledge base references. + - Private ingestion networking through `KnowledgeSourceNetworkAccessMode`. +- Added Work IQ configuration through `EntraAppAuthentication` and + `WorkIQKnowledgeSourceParameters`, plus the `query_work_iq_source_authorization` retrieval + parameter. +- Added File knowledge source CORS, metadata, prefix, parsing-mode, and extraction-mode support. +- Added GPT-5.5, GPT-5.6 Luna, GPT-5.6 Sol, and GPT-5.6 Terra model names. +- Added `SearchServiceLimits.max_vector_index_size_per_index_in_bytes`. + ### Breaking Changes +> These changes do not impact the API of stable versions such as 11.6.0. +> Only code written against a beta version such as 12.1.0b1 may be affected. + +- Replaced `ApiVersion.V2026_05_01_PREVIEW` with `ApiVersion.V2026_08_01_PREVIEW` and made the new + version the default. +- Replaced `top`, `skip`, and `count` with `search`, `page_size`, and `search_type` on + `SearchIndexClient.list_indexes`, `SearchIndexClient.list_index_names`, and their asynchronous + equivalents. `list_index_stats_summary` uses the same new parameters. +- Replaced `McpServerTool.inclusion_mode` and `McpServerToolInclusionMode` with + `McpServerTool.results_processing` and `KnowledgeSourceResultsProcessing`. +- Replaced `model_name` with `model` on model query-planning, answer-synthesis, and web-summarization + activity records. The new value is a `KnowledgeBaseActivityRecordModel`. +- Replaced `KnowledgeBaseWorkIQReference.attributions` and `WorkIQAttribution` with + `search_sensitivity_label_info`. +- Renamed the Python enum members `GPT_5_MINI`, `GPT_5_NANO`, `GPT_5_4_MINI`, and `GPT_5_4_NANO` + to `GPT5_MINI`, `GPT5_NANO`, `GPT5_4_MINI`, and `GPT5_4_NANO`, respectively. Wire values are + unchanged. +- Dropped Python 3.9 support. Python 3.10 or later is now required. + ### Bugs Fixed +- Normalized `SearchIndexClient.update_knowledge_source_file` and its asynchronous equivalent to + use the name-first signature `(name, file_id, body)`, consistent with the other File knowledge + source operations. +- Published the synchronous and asynchronous knowledge base retrieval stream classes from their + respective public namespaces. + ### Other Changes +- Updated `tsp-location.yaml` to target spec commit + `c195a3fe73b28cd90bf8a302944b2c0ec3d80def` (`2026-08-01-preview`). +- Added Python 3.14 support. + ## 12.1.0b1 (2026-05-28) ### Features Added diff --git a/sdk/search/azure-search-documents/MANIFEST.in b/sdk/search/azure-search-documents/MANIFEST.in index 9ae9a22b29e4..28229d044bf6 100644 --- a/sdk/search/azure-search-documents/MANIFEST.in +++ b/sdk/search/azure-search-documents/MANIFEST.in @@ -1,6 +1,7 @@ include *.md include LICENSE include azure/search/documents/py.typed +recursive-include doc *.rst recursive-include tests *.py recursive-include samples *.py *.md include azure/__init__.py diff --git a/sdk/search/azure-search-documents/README.md b/sdk/search/azure-search-documents/README.md index b8419b4b4546..bc1fb3f5242e 100644 --- a/sdk/search/azure-search-documents/README.md +++ b/sdk/search/azure-search-documents/README.md @@ -48,7 +48,7 @@ pip install azure-search-documents ### Prerequisites -* Python 3.8 or later is required to use this package. +* Python 3.9 or later is required to use this package. * You need an [Azure subscription][azure_sub] and an [Azure AI Search service][search_resource] to use this package. @@ -63,7 +63,7 @@ See [choosing a pricing tier](https://learn.microsoft.com/azure/search/search-sk ### Authenticate the client -To interact with the search service, you'll need to create an instance of the appropriate client class: `SearchClient` for searching indexed documents, `SearchIndexClient` for managing indexes, or `SearchIndexerClient` for crawling data sources and loading search documents into an index. To instantiate a client object, you'll need an **endpoint** and **Azure roles** or an **API key**. You can refer to the documentation for more information on [supported authenticating approaches](https://learn.microsoft.com/azure/search/search-security-overview#authentication) with the search service. +To interact with the search service, create an instance of the appropriate client class: `SearchClient` for searching indexed documents, `SearchIndexClient` for managing indexes and knowledge resources, `SearchIndexerClient` for crawling data sources and loading search documents into an index, or `KnowledgeBaseRetrievalClient` for retrieving from a knowledge base. To instantiate a client object, you'll need an **endpoint** and **Azure roles** or an **API key**. You can refer to the documentation for more information on [supported authenticating approaches](https://learn.microsoft.com/azure/search/search-security-overview#authentication) with the search service. #### Get an API Key @@ -134,7 +134,7 @@ An Azure AI Search service contains one or more indexes that provide persistent storage of searchable data in the form of JSON documents. _(If you're brand new to search, you can make a very rough analogy between indexes and database tables.)_ The Azure.Search.Documents client library -exposes operations on these resources through three main client types. +exposes operations on these resources through four main client types. * `SearchClient` helps with: * [Searching](https://learn.microsoft.com/azure/search/search-lucene-query-architecture) @@ -153,12 +153,17 @@ exposes operations on these resources through three main client types. * `SearchIndexClient` allows you to: * [Create, delete, update, or configure a search index](https://learn.microsoft.com/rest/api/searchservice/index-operations) * [Declare custom synonym maps to expand or rewrite queries](https://learn.microsoft.com/rest/api/searchservice/synonym-map-operations) + * Create and manage knowledge bases and knowledge sources * `SearchIndexerClient` allows you to: * [Start indexers to automatically crawl data sources](https://learn.microsoft.com/rest/api/searchservice/indexer-operations) * [Define AI powered Skillsets to transform and enrich your data](https://learn.microsoft.com/rest/api/searchservice/skillset-operations) +* `KnowledgeBaseRetrievalClient` allows you to: + * Retrieve relevant content and synthesized answers from a knowledge base + * Stream typed retrieval progress and results as server-sent events + Azure AI Search provides two powerful features: **semantic ranking** and **vector search**. **Semantic ranking** enhances the quality of search results for text-based queries. By enabling semantic ranking on your search service, you can improve the relevance of search results in two ways: diff --git a/sdk/search/azure-search-documents/TROUBLESHOOTING.md b/sdk/search/azure-search-documents/TROUBLESHOOTING.md index 16a20314f535..d4c6f7670874 100644 --- a/sdk/search/azure-search-documents/TROUBLESHOOTING.md +++ b/sdk/search/azure-search-documents/TROUBLESHOOTING.md @@ -1,18 +1,21 @@ -# Troubleshooting Azure Cognitive Search SDK Issues +# Troubleshooting Azure AI Search SDK Issues -The `azure-search-documents` package provides APIs for operations on the [Azure Cognitive Search](https://learn.microsoft.com/azure/search/search-what-is-azure-search) cloud service. +The `azure-search-documents` package provides APIs for operations on the [Azure AI Search](https://learn.microsoft.com/azure/search/search-what-is-azure-search) cloud service. ## Table of Contents -* [Identifying and Troubleshooting Issues by Response Code](#troubleshooting-issues-by-response-code) - * [HTTP 207 Errors](#207-multi-status) - * [HTTP 404 Errors](#404-not-found) - * [HTTP 429 Errors](#429-too-many-requests) -* [Unexpected search query results](#unexpected-search-query-results) +- [Troubleshooting Azure AI Search SDK Issues](#troubleshooting-azure-ai-search-sdk-issues) + - [Table of Contents](#table-of-contents) + - [Troubleshooting Issues By Response Code](#troubleshooting-issues-by-response-code) + - [207 Multi-Status](#207-multi-status) + - [403 Forbidden](#403-forbidden) + - [404 Not Found](#404-not-found) + - [429 too many requests](#429-too-many-requests) + - [Unexpected Search Query Results](#unexpected-search-query-results) ## Troubleshooting Issues By Response Code -See [this page](https://learn.microsoft.com/rest/api/searchservice/http-status-codes) for the common response status codes sent by the Azure Cognitive Search service. +See [this page](https://learn.microsoft.com/rest/api/searchservice/http-status-codes) for the common response status codes sent by the Azure AI Search service. ### 207 Multi-Status @@ -22,7 +25,7 @@ This response status indicates a partial success for an indexing operation. Some Returned when you pass an invalid api-key. Search service uses two types of keys to control access: admin (read-write) and query (read-only). The **admin key** grants full rights to all operations, including the ability to manage the service, create and delete indexes, indexers, and data sources. The **query key** grants read-only access to indexes and documents. Ensure that the key used for an API call provides sufficient privileges for the operation. See [here](https://learn.microsoft.com/azure/search/search-security-api-keys) for details about managing API keys. -If you are using the `azure-identity` package to authenticate requests to Azure Cognitive Search, please see our [troubleshooting guide](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/TROUBLESHOOTING.md). +If you are using the `azure-identity` package to authenticate requests to Azure AI Search, please see our [troubleshooting guide](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/TROUBLESHOOTING.md). ### 404 Not Found @@ -30,7 +33,7 @@ Returned when a resource does not exist on the server. If you are managing or qu ### 429 too many requests -If this error occurs while you are trying to create an index, it means you already have the maximum number of indexes allowed for your pricing tier. A count of the indexes stored in Azure Cognitive Search is visible in the search service dashboard on the [Azure portal](https://portal.azure.com/). To view the indexes by name, click the Index tile. +If this error occurs while you are trying to create an index, it means you already have the maximum number of indexes allowed for your pricing tier. A count of the indexes stored in Azure AI Search is visible in the search service dashboard on the [Azure portal](https://portal.azure.com/). To view the indexes by name, click the Index tile. Alternatively, you can also get a list of the indexes by name using the [list_index_names() method](https://learn.microsoft.com/python/api/azure-search-documents/azure.search.documents.indexes.searchindexclient?view=azure-python#azure-search-documents-indexes-searchindexclient-list-index-names). If this error occurs during document upload, it indicates that you've exceeded your [quota](https://learn.microsoft.com/azure/search/search-limits-quotas-capacity) on the number of documents per index. You must either create a new index or upgrade for higher capacity limits. diff --git a/sdk/search/azure-search-documents/_metadata.json b/sdk/search/azure-search-documents/_metadata.json index b41f4dc8e881..cd58dfc162d6 100644 --- a/sdk/search/azure-search-documents/_metadata.json +++ b/sdk/search/azure-search-documents/_metadata.json @@ -1,6 +1,6 @@ { - "apiVersion": "2026-05-01-preview", + "apiVersion": "2026-08-01-preview", "apiVersions": { - "Search": "2026-05-01-preview" + "Search": "2026-08-01-preview" } } \ No newline at end of file diff --git a/sdk/search/azure-search-documents/api.md b/sdk/search/azure-search-documents/api.md index 13f9dde66b56..07882a1711a0 100644 --- a/sdk/search/azure-search-documents/api.md +++ b/sdk/search/azure-search-documents/api.md @@ -7,7 +7,7 @@ namespace azure.search.documents 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" + V2026_08_01_PREVIEW = "2026-08-01-preview" class azure.search.documents.IndexDocumentsBatch(MutableMapping[str, Any]): @@ -96,7 +96,7 @@ namespace azure.search.documents ) -> List[IndexingResult]: ... @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']) + @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', '2026-08-01-preview']) def get_document( self, key: str, @@ -360,7 +360,7 @@ namespace azure.search.documents.aio ) -> List[IndexingResult]: ... @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']) + @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', '2026-08-01-preview']) async def get_document( self, key: str, @@ -577,7 +577,7 @@ namespace azure.search.documents.indexes @overload def create_alias( self, - alias: JSON, + alias: SearchAlias, *, content_type: str = "application/json", **kwargs: Any @@ -604,7 +604,7 @@ namespace azure.search.documents.indexes @overload def create_index( self, - index: JSON, + index: SearchIndex, *, content_type: str = "application/json", **kwargs: Any @@ -631,7 +631,7 @@ namespace azure.search.documents.indexes @overload def create_knowledge_base( self, - knowledge_base: JSON, + knowledge_base: KnowledgeBase, *, content_type: str = "application/json", **kwargs: Any @@ -658,7 +658,7 @@ namespace azure.search.documents.indexes @overload def create_knowledge_source( self, - knowledge_source: JSON, + knowledge_source: KnowledgeSource, *, content_type: str = "application/json", **kwargs: Any @@ -731,7 +731,7 @@ namespace azure.search.documents.indexes @overload def create_synonym_map( self, - synonym_map: JSON, + synonym_map: SynonymMap, *, content_type: str = "application/json", **kwargs: Any @@ -864,6 +864,9 @@ namespace azure.search.documents.indexes def get_synonym_maps( self, *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., **kwargs: Any ) -> List[SynonymMap]: ... @@ -872,26 +875,34 @@ namespace azure.search.documents.indexes def list_alias_names(self, **kwargs: Any) -> ItemPaged[str]: ... @distributed_trace - def list_aliases(self, **kwargs: Any) -> ItemPaged[SearchAlias]: ... + @api_version_validation(params_added_on={'2026-08-01-preview': ['search', 'page_size', 'search_type']}, api_versions_list=['2025-11-01-preview', '2026-04-01', '2026-05-01-preview', '2026-08-01-preview']) + def list_aliases( + self, + *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., + **kwargs: Any + ) -> ItemPaged[SearchAlias]: ... @distributed_trace def list_index_names( self, *, - count: Optional[bool] = ..., - skip: Optional[int] = ..., - top: Optional[int] = ..., + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., **kwargs: Any ) -> ItemPaged[str]: ... @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']) + @api_version_validation(method_added_on='2026-08-01-preview', params_added_on={'2026-08-01-preview': ['api_version', 'accept', 'search', 'page_size', 'search_type', 'client_request_id']}, api_versions_list=['2026-08-01-preview']) def list_index_stats_summary( self, *, - count: Optional[bool] = ..., - skip: Optional[int] = ..., - top: Optional[int] = ..., + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., **kwargs: Any ) -> ItemPaged[IndexStatisticsSummary]: ... @@ -899,26 +910,47 @@ namespace azure.search.documents.indexes def list_indexes( self, *, - count: Optional[bool] = ..., + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., - skip: Optional[int] = ..., - top: Optional[int] = ..., **kwargs: Any ) -> ItemPaged[SearchIndex]: ... @distributed_trace - def list_knowledge_bases(self, **kwargs: Any) -> ItemPaged[KnowledgeBase]: ... + @api_version_validation(params_added_on={'2026-08-01-preview': ['search', 'page_size', 'search_type']}, api_versions_list=['2025-11-01-preview', '2026-04-01', '2026-05-01-preview', '2026-08-01-preview']) + def list_knowledge_bases( + self, + *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., + **kwargs: Any + ) -> ItemPaged[KnowledgeBase]: ... @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']}, api_versions_list=['2026-05-01-preview']) + @api_version_validation(method_added_on='2026-05-01-preview', params_added_on={'2026-05-01-preview': ['api_version', 'accept', 'client_request_id', 'name'], '2026-08-01-preview': ['prefix', 'search', 'page_size', 'search_type']}, api_versions_list=['2026-05-01-preview', '2026-08-01-preview']) def list_knowledge_source_files( self, name: str, + *, + page_size: Optional[int] = ..., + prefix: Optional[str] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., **kwargs: Any ) -> ItemPaged[KnowledgeSourceFile]: ... @distributed_trace - def list_knowledge_sources(self, **kwargs: Any) -> ItemPaged[KnowledgeSource]: ... + @api_version_validation(params_added_on={'2026-08-01-preview': ['search', 'page_size', 'search_type']}, api_versions_list=['2025-11-01-preview', '2026-04-01', '2026-05-01-preview', '2026-08-01-preview']) + def list_knowledge_sources( + self, + *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., + **kwargs: Any + ) -> ItemPaged[KnowledgeSource]: ... def send_request( self, @@ -928,6 +960,15 @@ namespace azure.search.documents.indexes **kwargs: Any ) -> HttpResponse: ... + @distributed_trace + def update_knowledge_source_file( + self, + name: str, + file_id: str, + body: Union[UpdateKnowledgeSourceFileRequest, UpdateKnowledgeSourceFileRequest], + **kwargs: Any + ) -> KnowledgeSourceFile: ... + @distributed_trace def upload_knowledge_source_file( self, @@ -939,6 +980,22 @@ namespace azure.search.documents.indexes **kwargs: Any ) -> KnowledgeSourceFile: ... + @overload + def upload_knowledge_source_file_multipart( + self, + name: str, + body: UploadKnowledgeSourceFileMultipartRequest, + **kwargs: Any + ) -> KnowledgeSourceFile: ... + + @overload + def upload_knowledge_source_file_multipart( + self, + name: str, + body: UploadKnowledgeSourceFileMultipartRequest, + **kwargs: Any + ) -> KnowledgeSourceFile: ... + class azure.search.documents.indexes.SearchIndexerClient(_SearchIndexerClient): implements ContextManager @@ -966,7 +1023,7 @@ namespace azure.search.documents.indexes @overload def create_data_source_connection( self, - data_source_connection: JSON, + data_source_connection: SearchIndexerDataSourceConnection, *, content_type: str = "application/json", **kwargs: Any @@ -993,7 +1050,7 @@ namespace azure.search.documents.indexes @overload def create_indexer( self, - indexer: JSON, + indexer: SearchIndexer, *, content_type: str = "application/json", **kwargs: Any @@ -1052,7 +1109,7 @@ namespace azure.search.documents.indexes @overload def create_skillset( self, - skillset: JSON, + skillset: SearchIndexerSkillset, *, content_type: str = "application/json", **kwargs: Any @@ -1108,6 +1165,9 @@ namespace azure.search.documents.indexes def get_data_source_connections( self, *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., **kwargs: Any ) -> List[SearchIndexerDataSourceConnection]: ... @@ -1133,6 +1193,9 @@ namespace azure.search.documents.indexes def get_indexers( self, *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., **kwargs: Any ) -> List[SearchIndexer]: ... @@ -1151,6 +1214,9 @@ namespace azure.search.documents.indexes def get_skillsets( self, *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., **kwargs: Any ) -> List[SearchIndexerSkillset]: ... @@ -1240,7 +1306,7 @@ namespace azure.search.documents.indexes.aio @overload async def create_alias( self, - alias: JSON, + alias: SearchAlias, *, content_type: str = "application/json", **kwargs: Any @@ -1267,7 +1333,7 @@ namespace azure.search.documents.indexes.aio @overload async def create_index( self, - index: JSON, + index: SearchIndex, *, content_type: str = "application/json", **kwargs: Any @@ -1294,7 +1360,7 @@ namespace azure.search.documents.indexes.aio @overload async def create_knowledge_base( self, - knowledge_base: JSON, + knowledge_base: KnowledgeBase, *, content_type: str = "application/json", **kwargs: Any @@ -1321,7 +1387,7 @@ namespace azure.search.documents.indexes.aio @overload async def create_knowledge_source( self, - knowledge_source: JSON, + knowledge_source: KnowledgeSource, *, content_type: str = "application/json", **kwargs: Any @@ -1394,7 +1460,7 @@ namespace azure.search.documents.indexes.aio @overload async def create_synonym_map( self, - synonym_map: JSON, + synonym_map: SynonymMap, *, content_type: str = "application/json", **kwargs: Any @@ -1527,6 +1593,9 @@ namespace azure.search.documents.indexes.aio async def get_synonym_maps( self, *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., **kwargs: Any ) -> List[SynonymMap]: ... @@ -1535,26 +1604,34 @@ namespace azure.search.documents.indexes.aio def list_alias_names(self, **kwargs) -> AsyncItemPaged[str]: ... @distributed_trace - def list_aliases(self, **kwargs: Any) -> AsyncItemPaged[SearchAlias]: ... + @api_version_validation(params_added_on={'2026-08-01-preview': ['search', 'page_size', 'search_type']}, api_versions_list=['2025-11-01-preview', '2026-04-01', '2026-05-01-preview', '2026-08-01-preview']) + def list_aliases( + self, + *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[SearchAlias]: ... @distributed_trace def list_index_names( self, *, - count: Optional[bool] = ..., - skip: Optional[int] = ..., - top: Optional[int] = ..., + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., **kwargs: Any ) -> AsyncItemPaged[str]: ... @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']) + @api_version_validation(method_added_on='2026-08-01-preview', params_added_on={'2026-08-01-preview': ['api_version', 'accept', 'search', 'page_size', 'search_type', 'client_request_id']}, api_versions_list=['2026-08-01-preview']) def list_index_stats_summary( self, *, - count: Optional[bool] = ..., - skip: Optional[int] = ..., - top: Optional[int] = ..., + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., **kwargs: Any ) -> AsyncItemPaged[IndexStatisticsSummary]: ... @@ -1562,26 +1639,47 @@ namespace azure.search.documents.indexes.aio def list_indexes( self, *, - count: Optional[bool] = ..., + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., - skip: Optional[int] = ..., - top: Optional[int] = ..., **kwargs: Any ) -> AsyncItemPaged[SearchIndex]: ... @distributed_trace - def list_knowledge_bases(self, **kwargs: Any) -> AsyncItemPaged[KnowledgeBase]: ... + @api_version_validation(params_added_on={'2026-08-01-preview': ['search', 'page_size', 'search_type']}, api_versions_list=['2025-11-01-preview', '2026-04-01', '2026-05-01-preview', '2026-08-01-preview']) + def list_knowledge_bases( + self, + *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[KnowledgeBase]: ... @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']}, api_versions_list=['2026-05-01-preview']) + @api_version_validation(method_added_on='2026-05-01-preview', params_added_on={'2026-05-01-preview': ['api_version', 'accept', 'client_request_id', 'name'], '2026-08-01-preview': ['prefix', 'search', 'page_size', 'search_type']}, api_versions_list=['2026-05-01-preview', '2026-08-01-preview']) def list_knowledge_source_files( self, name: str, + *, + page_size: Optional[int] = ..., + prefix: Optional[str] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., **kwargs: Any ) -> AsyncItemPaged[KnowledgeSourceFile]: ... @distributed_trace - def list_knowledge_sources(self, **kwargs: Any) -> AsyncItemPaged[KnowledgeSource]: ... + @api_version_validation(params_added_on={'2026-08-01-preview': ['search', 'page_size', 'search_type']}, api_versions_list=['2025-11-01-preview', '2026-04-01', '2026-05-01-preview', '2026-08-01-preview']) + def list_knowledge_sources( + self, + *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., + **kwargs: Any + ) -> AsyncItemPaged[KnowledgeSource]: ... def send_request( self, @@ -1591,6 +1689,15 @@ namespace azure.search.documents.indexes.aio **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: ... + @distributed_trace_async + async def update_knowledge_source_file( + self, + name: str, + file_id: str, + body: Union[UpdateKnowledgeSourceFileRequest, UpdateKnowledgeSourceFileRequest], + **kwargs: Any + ) -> KnowledgeSourceFile: ... + @distributed_trace_async async def upload_knowledge_source_file( self, @@ -1602,6 +1709,22 @@ namespace azure.search.documents.indexes.aio **kwargs: Any ) -> KnowledgeSourceFile: ... + @overload + async def upload_knowledge_source_file_multipart( + self, + name: str, + body: UploadKnowledgeSourceFileMultipartRequest, + **kwargs: Any + ) -> KnowledgeSourceFile: ... + + @overload + async def upload_knowledge_source_file_multipart( + self, + name: str, + body: UploadKnowledgeSourceFileMultipartRequest, + **kwargs: Any + ) -> KnowledgeSourceFile: ... + class azure.search.documents.indexes.aio.SearchIndexerClient(_SearchIndexerClient): implements AsyncContextManager @@ -1629,7 +1752,7 @@ namespace azure.search.documents.indexes.aio @overload async def create_data_source_connection( self, - data_source_connection: JSON, + data_source_connection: SearchIndexerDataSourceConnection, *, content_type: str = "application/json", **kwargs: Any @@ -1656,7 +1779,7 @@ namespace azure.search.documents.indexes.aio @overload async def create_indexer( self, - indexer: JSON, + indexer: SearchIndexer, *, content_type: str = "application/json", **kwargs: Any @@ -1715,7 +1838,7 @@ namespace azure.search.documents.indexes.aio @overload async def create_skillset( self, - skillset: JSON, + skillset: SearchIndexerSkillset, *, content_type: str = "application/json", **kwargs: Any @@ -1771,6 +1894,9 @@ namespace azure.search.documents.indexes.aio async def get_data_source_connections( self, *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., **kwargs: Any ) -> List[SearchIndexerDataSourceConnection]: ... @@ -1796,6 +1922,9 @@ namespace azure.search.documents.indexes.aio async def get_indexers( self, *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., **kwargs: Any ) -> List[SearchIndexer]: ... @@ -1814,6 +1943,9 @@ namespace azure.search.documents.indexes.aio async def get_skillsets( self, *, + page_size: Optional[int] = ..., + search: Optional[str] = ..., + search_type: Optional[Union[str, ListingSearchType]] = ..., select: Optional[List[str]] = ..., **kwargs: Any ) -> List[SearchIndexerSkillset]: ... @@ -2079,6 +2211,7 @@ namespace azure.search.documents.indexes.models encryption_key: SearchResourceEncryptionKey kind: Literal[KnowledgeSourceKind.AZURE_BLOB] name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -2088,7 +2221,8 @@ namespace azure.search.documents.indexes.models description: Optional[str] = ..., e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., - name: str + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -2102,6 +2236,7 @@ namespace azure.search.documents.indexes.models folder_path: Optional[str] ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] is_adls_gen2: Optional[bool] + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] @overload def __init__( @@ -2111,7 +2246,8 @@ namespace azure.search.documents.indexes.models container_name: str, folder_path: Optional[str] = ..., ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] = ..., - is_adls_gen2: Optional[bool] = ... + is_adls_gen2: Optional[bool] = ..., + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] = ... ) -> None: ... @overload @@ -2239,10 +2375,14 @@ namespace azure.search.documents.indexes.models GPT51 = "gpt-5.1" GPT52 = "gpt-5.2" GPT54 = "gpt-5.4" - GPT_5_4_MINI = "gpt-5.4-mini" - GPT_5_4_NANO = "gpt-5.4-nano" - GPT_5_MINI = "gpt-5-mini" - GPT_5_NANO = "gpt-5-nano" + GPT55 = "gpt-5.5" + GPT56_LUNA = "gpt-5.6-luna" + GPT56_SOL = "gpt-5.6-sol" + GPT56_TERRA = "gpt-5.6-terra" + GPT5_4_MINI = "gpt-5.4-mini" + GPT5_4_NANO = "gpt-5.4-nano" + GPT5_MINI = "gpt-5-mini" + GPT5_NANO = "gpt-5-nano" TEXT_EMBEDDING3_LARGE = "text-embedding-3-large" TEXT_EMBEDDING3_SMALL = "text-embedding-3-small" TEXT_EMBEDDING_ADA002 = "text-embedding-ada-002" @@ -3328,6 +3468,24 @@ namespace azure.search.documents.indexes.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.models.EntraAppAuthentication(_Model): + application_id: str + federated_credential_id: str + tenant_id: Optional[str] + + @overload + def __init__( + self, + *, + application_id: str, + federated_credential_id: str, + tenant_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.indexes.models.ExhaustiveKnnAlgorithmConfiguration(VectorSearchAlgorithmConfiguration, discriminator='exhaustiveKnn'): kind: Literal[VectorSearchAlgorithmKind.EXHAUSTIVE_KNN] name: str @@ -3366,6 +3524,7 @@ namespace azure.search.documents.indexes.models fabric_data_agent_parameters: FabricDataAgentKnowledgeSourceParameters kind: Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT] name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -3375,7 +3534,8 @@ namespace azure.search.documents.indexes.models e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., fabric_data_agent_parameters: FabricDataAgentKnowledgeSourceParameters, - name: str + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -3405,6 +3565,7 @@ namespace azure.search.documents.indexes.models fabric_ontology_parameters: FabricOntologyKnowledgeSourceParameters kind: Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY] name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -3414,7 +3575,8 @@ namespace azure.search.documents.indexes.models e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., fabric_ontology_parameters: FabricOntologyKnowledgeSourceParameters, - name: str + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -3472,37 +3634,64 @@ namespace azure.search.documents.indexes.models class azure.search.documents.indexes.models.FileKnowledgeSource(KnowledgeSource, discriminator='file'): + cors_options: Optional[CorsOptions] description: str e_tag: str encryption_key: SearchResourceEncryptionKey file_parameters: FileKnowledgeSourceParameters kind: Literal[KnowledgeSourceKind.FILE] name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( self, *, + cors_options: Optional[CorsOptions] = ..., description: Optional[str] = ..., e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., file_parameters: FileKnowledgeSourceParameters, - name: str + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.models.FileKnowledgeSourceExtractionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MINIMAL = "minimal" + STANDARD = "standard" + + class azure.search.documents.indexes.models.FileKnowledgeSourceParameters(_Model): created_resources: Optional[CreatedResources] ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] + + @overload + def __init__( + self, + *, + ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] = ..., + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.FileUploadMetadata(_Model): + file_name: Optional[str] + metadata: Optional[dict[str, str]] @overload def __init__( self, *, - ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] = ... + file_name: Optional[str] = ..., + metadata: Optional[dict[str, str]] = ... ) -> None: ... @overload @@ -3720,6 +3909,7 @@ namespace azure.search.documents.indexes.models indexed_one_lake_parameters: IndexedOneLakeKnowledgeSourceParameters kind: Literal[KnowledgeSourceKind.INDEXED_ONELAKE] name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -3729,7 +3919,8 @@ namespace azure.search.documents.indexes.models e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., indexed_one_lake_parameters: IndexedOneLakeKnowledgeSourceParameters, - name: str + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -3741,6 +3932,7 @@ namespace azure.search.documents.indexes.models fabric_workspace_id: str ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] lakehouse_id: str + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] target_path: Optional[str] @overload @@ -3750,6 +3942,7 @@ namespace azure.search.documents.indexes.models fabric_workspace_id: str, ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] = ..., lakehouse_id: str, + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] = ..., target_path: Optional[str] = ... ) -> None: ... @@ -3770,6 +3963,7 @@ namespace azure.search.documents.indexes.models indexed_share_point_parameters: IndexedSharePointKnowledgeSourceParameters kind: Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT] name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -3779,7 +3973,8 @@ namespace azure.search.documents.indexes.models e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., indexed_share_point_parameters: IndexedSharePointKnowledgeSourceParameters, - name: str + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -3792,6 +3987,7 @@ namespace azure.search.documents.indexes.models created_resources: Optional[CreatedResources] ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] query: Optional[str] + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] @overload def __init__( @@ -3800,7 +3996,8 @@ namespace azure.search.documents.indexes.models connection_string: str, container_name: Union[str, IndexedSharePointContainerName], ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] = ..., - query: Optional[str] = ... + query: Optional[str] = ..., + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] = ... ) -> None: ... @overload @@ -3814,6 +4011,7 @@ namespace azure.search.documents.indexes.models indexed_sql_parameters: IndexedSqlKnowledgeSourceParameters kind: Literal[KnowledgeSourceKind.INDEXED_SQL] name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -3823,7 +4021,8 @@ namespace azure.search.documents.indexes.models e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., indexed_sql_parameters: IndexedSqlKnowledgeSourceParameters, - name: str + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -3837,6 +4036,7 @@ namespace azure.search.documents.indexes.models embedding_columns: Optional[list[EmbeddingColumnMapping]] high_water_mark_column_name: Optional[str] ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] table_or_view: str @overload @@ -3848,6 +4048,7 @@ namespace azure.search.documents.indexes.models embedding_columns: Optional[list[EmbeddingColumnMapping]] = ..., high_water_mark_column_name: Optional[str] = ..., ingestion_parameters: Optional[KnowledgeSourceIngestionParameters] = ..., + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] = ..., table_or_view: str ) -> None: ... @@ -4221,12 +4422,31 @@ namespace azure.search.documents.indexes.models AZURE_OPEN_AI = "azureOpenAI" + class azure.search.documents.indexes.models.KnowledgeBaseRetrieveDefaults(_Model): + max_output_documents: Optional[int] + max_output_size_in_tokens: Optional[int] + max_runtime_in_seconds: Optional[int] + + @overload + def __init__( + self, + *, + max_output_documents: Optional[int] = ..., + max_output_size_in_tokens: Optional[int] = ..., + max_runtime_in_seconds: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.indexes.models.KnowledgeSource(_Model): description: Optional[str] e_tag: Optional[str] encryption_key: Optional[SearchResourceEncryptionKey] kind: str name: str + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] @overload def __init__( @@ -4236,7 +4456,8 @@ namespace azure.search.documents.indexes.models e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., kind: str, - name: str + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -4251,10 +4472,14 @@ namespace azure.search.documents.indexes.models class azure.search.documents.indexes.models.KnowledgeSourceFile(_Model): created_at: Optional[datetime] error_message: Optional[str] + extraction_mode: Optional[Union[str, FileKnowledgeSourceExtractionMode]] file_id: Optional[str] file_name: Optional[str] file_size_bytes: Optional[int] last_updated_at: Optional[datetime] + metadata: Optional[dict[str, str]] + parsing_mode: Optional[Union[str, BlobIndexerParsingMode]] + prefix: Optional[str] class azure.search.documents.indexes.models.KnowledgeSourceIngestionPermissionOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -4297,6 +4522,11 @@ namespace azure.search.documents.indexes.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NONE = "none" + RERANK = "rerank" + + class azure.search.documents.indexes.models.KnowledgeSourceSynchronizationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): ACTIVE = "active" CREATING = "creating" @@ -4536,6 +4766,10 @@ namespace azure.search.documents.indexes.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.models.ListingSearchType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + PREFIX = "prefix" + + class azure.search.documents.indexes.models.LuceneStandardAnalyzer(LexicalAnalyzer, discriminator='#Microsoft.Azure.Search.StandardAnalyzer'): max_token_length: Optional[int] name: str @@ -4742,6 +4976,7 @@ namespace azure.search.documents.indexes.models kind: Literal[KnowledgeSourceKind.MCP_SERVER] mcp_server_parameters: McpServerKnowledgeSourceParameters name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -4751,7 +4986,8 @@ namespace azure.search.documents.indexes.models e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., mcp_server_parameters: McpServerKnowledgeSourceParameters, - name: str + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -4890,30 +5126,25 @@ namespace azure.search.documents.indexes.models class azure.search.documents.indexes.models.McpServerTool(_Model): - inclusion_mode: Optional[Union[str, McpServerToolInclusionMode]] max_output_tokens: Optional[int] name: Optional[str] output_parsing: Optional[McpServerOutputParsing] + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] @overload def __init__( self, *, - inclusion_mode: Optional[Union[str, McpServerToolInclusionMode]] = ..., max_output_tokens: Optional[int] = ..., name: Optional[str] = ..., - output_parsing: Optional[McpServerOutputParsing] = ... + output_parsing: Optional[McpServerOutputParsing] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.search.documents.indexes.models.McpServerToolInclusionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - ALWAYS = "always" - RERANKED = "reranked" - - class azure.search.documents.indexes.models.MergeSkill(SearchIndexerSkill, discriminator='#Microsoft.Skills.Text.MergeSkill'): context: str description: str @@ -5600,6 +5831,7 @@ namespace azure.search.documents.indexes.models kind: Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT] name: str remote_share_point_parameters: Optional[RemoteSharePointKnowledgeSourceParameters] + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -5609,7 +5841,8 @@ namespace azure.search.documents.indexes.models e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., name: str, - remote_share_point_parameters: Optional[RemoteSharePointKnowledgeSourceParameters] = ... + remote_share_point_parameters: Optional[RemoteSharePointKnowledgeSourceParameters] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -5875,6 +6108,7 @@ namespace azure.search.documents.indexes.models encryption_key: SearchResourceEncryptionKey kind: Literal[KnowledgeSourceKind.SEARCH_INDEX] name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] search_index_parameters: SearchIndexKnowledgeSourceParameters @overload @@ -5885,6 +6119,7 @@ namespace azure.search.documents.indexes.models e_tag: Optional[str] = ..., encryption_key: Optional[SearchResourceEncryptionKey] = ..., name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ..., search_index_parameters: SearchIndexKnowledgeSourceParameters ) -> None: ... @@ -5892,8 +6127,88 @@ namespace azure.search.documents.indexes.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.models.SearchIndexKnowledgeSourceBoost(_Model): + boost_instructions: Optional[str] + kind: str + + @overload + def __init__( + self, + *, + boost_instructions: Optional[str] = ..., + kind: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.SearchIndexKnowledgeSourceBoostKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FIELD_VALUE = "fieldValue" + MULTI_WORD_EXPRESSION = "multiWordExpression" + + + class azure.search.documents.indexes.models.SearchIndexKnowledgeSourceFieldValueBoost(SearchIndexKnowledgeSourceBoost, discriminator='fieldValue'): + boost: float + boost_instructions: str + field: str + field_values: Optional[list[str]] + kind: Literal[SearchIndexKnowledgeSourceBoostKind.FIELD_VALUE] + + @overload + def __init__( + self, + *, + boost: float, + boost_instructions: Optional[str] = ..., + field: str, + field_values: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.SearchIndexKnowledgeSourceFilterHint(_Model): + field: str + field_values: list[str] + filter_instructions: Optional[str] + + @overload + def __init__( + self, + *, + field: str, + field_values: list[str], + filter_instructions: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.SearchIndexKnowledgeSourceMultiWordExpressionBoost(SearchIndexKnowledgeSourceBoost, discriminator='multiWordExpression'): + boost: float + boost_instructions: str + field_values: Optional[list[str]] + kind: Literal[SearchIndexKnowledgeSourceBoostKind.MULTI_WORD_EXPRESSION] + + @overload + def __init__( + self, + *, + boost: float, + boost_instructions: Optional[str] = ..., + field_values: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters(_Model): base_filter: Optional[str] + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] search_fields: Optional[list[SearchIndexFieldReference]] search_index_name: str semantic_configuration_name: Optional[str] @@ -5904,6 +6219,7 @@ namespace azure.search.documents.indexes.models self, *, base_filter: Optional[str] = ..., + query_hints: Optional[SearchIndexKnowledgeSourceQueryHints] = ..., search_fields: Optional[list[SearchIndexFieldReference]] = ..., search_index_name: str, semantic_configuration_name: Optional[str] = ..., @@ -5914,6 +6230,22 @@ namespace azure.search.documents.indexes.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints(_Model): + boosts: Optional[list[SearchIndexKnowledgeSourceBoost]] + filters: Optional[list[SearchIndexKnowledgeSourceFilterHint]] + + @overload + def __init__( + self, + *, + boosts: Optional[list[SearchIndexKnowledgeSourceBoost]] = ..., + filters: Optional[list[SearchIndexKnowledgeSourceFilterHint]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.indexes.models.SearchIndexPermissionFilterOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "disabled" ENABLED = "enabled" @@ -6463,6 +6795,7 @@ namespace azure.search.documents.indexes.models max_field_nesting_depth_per_index: Optional[int] max_fields_per_index: Optional[int] max_storage_per_index_in_bytes: Optional[int] + max_vector_index_size_per_index_in_bytes: Optional[int] @overload def __init__( @@ -6473,7 +6806,8 @@ namespace azure.search.documents.indexes.models max_cumulative_indexer_runtime_seconds: Optional[int] = ..., max_field_nesting_depth_per_index: Optional[int] = ..., max_fields_per_index: Optional[int] = ..., - max_storage_per_index_in_bytes: Optional[int] = ... + max_storage_per_index_in_bytes: Optional[int] = ..., + max_vector_index_size_per_index_in_bytes: Optional[int] = ... ) -> None: ... @overload @@ -7377,13 +7711,45 @@ namespace azure.search.documents.indexes.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.search.documents.indexes.models.VectorEncodingFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): - PACKED_BIT = "packedBit" - + class azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest(_Model): + content: Union[str, bytes, IO[str], IO[bytes], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]]], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]], Optional[str]]] + metadata: FileUploadMetadata - class azure.search.documents.indexes.models.VectorSearch(_Model): - algorithms: Optional[list[VectorSearchAlgorithmConfiguration]] - compressions: Optional[list[VectorSearchCompression]] + @overload + def __init__( + self, + *, + content: FileType, + metadata: FileUploadMetadata + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.UploadKnowledgeSourceFileMultipartRequest(_Model): + content: Union[str, bytes, IO[str], IO[bytes], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]]], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]], Optional[str]]] + metadata: FileUploadMetadata + + @overload + def __init__( + self, + *, + content: FileType, + metadata: FileUploadMetadata + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.VectorEncodingFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + PACKED_BIT = "packedBit" + + + class azure.search.documents.indexes.models.VectorSearch(_Model): + algorithms: Optional[list[VectorSearchAlgorithmConfiguration]] + compressions: Optional[list[VectorSearchCompression]] profiles: Optional[list[VectorSearchProfile]] vectorizers: Optional[list[VectorSearchVectorizer]] @@ -7549,212 +7915,2859 @@ namespace azure.search.documents.indexes.models auth_resource_id: Optional[str] batch_size: Optional[int] context: str - degree_of_parallelism: Optional[int] + degree_of_parallelism: Optional[int] + description: str + http_headers: Optional[WebApiHttpHeaders] + http_method: Optional[str] + inputs: list[InputFieldMappingEntry] + name: str + odata_type: Literal["#WebApiSkill"] + outputs: list[OutputFieldMappingEntry] + timeout: Optional[timedelta] + uri: str + + @overload + def __init__( + self, + *, + auth_identity: Optional[SearchIndexerDataIdentity] = ..., + auth_resource_id: Optional[str] = ..., + batch_size: Optional[int] = ..., + context: Optional[str] = ..., + degree_of_parallelism: Optional[int] = ..., + description: Optional[str] = ..., + http_headers: Optional[WebApiHttpHeaders] = ..., + http_method: Optional[str] = ..., + inputs: list[InputFieldMappingEntry], + name: Optional[str] = ..., + outputs: list[OutputFieldMappingEntry], + timeout: Optional[timedelta] = ..., + uri: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.WebApiVectorizer(VectorSearchVectorizer, discriminator='customWebApi'): + kind: Literal[VectorSearchVectorizerKind.CUSTOM_WEB_API] + vectorizer_name: str + web_api_parameters: Optional[WebApiVectorizerParameters] + + @overload + def __init__( + self, + *, + vectorizer_name: str, + web_api_parameters: Optional[WebApiVectorizerParameters] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.WebApiVectorizerParameters(_Model): + auth_identity: Optional[SearchIndexerDataIdentity] + auth_resource_id: Optional[str] + http_headers: Optional[dict[str, str]] + http_method: Optional[str] + timeout: Optional[timedelta] + url: Optional[str] + + @overload + def __init__( + self, + *, + auth_identity: Optional[SearchIndexerDataIdentity] = ..., + auth_resource_id: Optional[str] = ..., + http_headers: Optional[dict[str, str]] = ..., + http_method: Optional[str] = ..., + timeout: Optional[timedelta] = ..., + url: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.WebKnowledgeSource(KnowledgeSource, discriminator='web'): + description: str + e_tag: str + encryption_key: SearchResourceEncryptionKey + kind: Literal[KnowledgeSourceKind.WEB] + name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] + web_parameters: Optional[WebKnowledgeSourceParameters] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + e_tag: Optional[str] = ..., + encryption_key: Optional[SearchResourceEncryptionKey] = ..., + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ..., + web_parameters: Optional[WebKnowledgeSourceParameters] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.WebKnowledgeSourceDomain(_Model): + address: str + include_subpages: Optional[bool] + + @overload + def __init__( + self, + *, + address: str, + include_subpages: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.WebKnowledgeSourceDomains(_Model): + allowed_domains: Optional[list[WebKnowledgeSourceDomain]] + blocked_domains: Optional[list[WebKnowledgeSourceDomain]] + + @overload + def __init__( + self, + *, + allowed_domains: Optional[list[WebKnowledgeSourceDomain]] = ..., + blocked_domains: Optional[list[WebKnowledgeSourceDomain]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.WebKnowledgeSourceParameters(_Model): + count: Optional[int] + domains: Optional[WebKnowledgeSourceDomains] + freshness: Optional[str] + language: Optional[str] + market: Optional[str] + + @overload + def __init__( + self, + *, + count: Optional[int] = ..., + domains: Optional[WebKnowledgeSourceDomains] = ..., + freshness: Optional[str] = ..., + language: Optional[str] = ..., + market: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.WordDelimiterTokenFilter(TokenFilter, discriminator='#Microsoft.Azure.Search.WordDelimiterTokenFilter'): + catenate_all: Optional[bool] + catenate_numbers: Optional[bool] + catenate_words: Optional[bool] + generate_number_parts: Optional[bool] + generate_word_parts: Optional[bool] + name: str + odata_type: Literal["#WordDelimiterTokenFilter"] + preserve_original: Optional[bool] + protected_words: Optional[list[str]] + split_on_case_change: Optional[bool] + split_on_numerics: Optional[bool] + stem_english_possessive: Optional[bool] + + @overload + def __init__( + self, + *, + catenate_all: Optional[bool] = ..., + catenate_numbers: Optional[bool] = ..., + catenate_words: Optional[bool] = ..., + generate_number_parts: Optional[bool] = ..., + generate_word_parts: Optional[bool] = ..., + name: str, + preserve_original: Optional[bool] = ..., + protected_words: Optional[list[str]] = ..., + split_on_case_change: Optional[bool] = ..., + split_on_numerics: Optional[bool] = ..., + stem_english_possessive: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.WorkIQKnowledgeSource(KnowledgeSource, discriminator='workIQ'): + description: str + e_tag: str + encryption_key: SearchResourceEncryptionKey + kind: Literal[KnowledgeSourceKind.WORK_IQ] + name: str + results_processing: Union[str, KnowledgeSourceResultsProcessing] + work_iq_parameters: WorkIQKnowledgeSourceParameters + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + e_tag: Optional[str] = ..., + encryption_key: Optional[SearchResourceEncryptionKey] = ..., + name: str, + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ..., + work_iq_parameters: WorkIQKnowledgeSourceParameters + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.indexes.models.WorkIQKnowledgeSourceParameters(_Model): + entra_app_authentication: EntraAppAuthentication + + @overload + def __init__( + self, + *, + entra_app_authentication: EntraAppAuthentication + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + +namespace azure.search.documents.indexes.types + + class azure.search.documents.indexes.types.AIServicesAccountIdentity(TypedDict): + key "@odata.type": Required[Literal["#AIServicesByIdentity"]] + key "description": str + key "identity": Optional[SearchIndexerDataIdentity] + key "subdomainUrl": Required[str] + ``@odata.type``: Literal[#AIServicesByIdentity] + description: str + identity: SearchIndexerDataIdentity + subdomainUrl: str + + + class azure.search.documents.indexes.types.AIServicesAccountKey(TypedDict): + key "@odata.type": Required[Literal["#AIServicesByKey"]] + key "description": str + key "key": Required[str] + key "subdomainUrl": Required[str] + ``@odata.type``: Literal[#AIServicesByKey] + description: str + key: str + subdomainUrl: str + + + class azure.search.documents.indexes.types.AIServicesVisionParameters(TypedDict, total=False): + key "apiKey": str + key "authIdentity": Optional[SearchIndexerDataIdentity] + key "modelVersion": Required[Optional[str]] + key "resourceUri": Required[str] + apiKey: str + authIdentity: SearchIndexerDataIdentity + modelVersion: str + resourceUri: str + + + class azure.search.documents.indexes.types.AIServicesVisionVectorizer(TypedDict, total=False): + key "aiServicesVisionParameters": ForwardRef('AIServicesVisionParameters', module='types') + key "kind": Required[Literal[VectorSearchVectorizerKind.AI_SERVICES_VISION]] + key "name": Required[str] + aiServicesVisionParameters: AIServicesVisionParameters + kind: Literal[VectorSearchVectorizerKind.AI_SERVICES_VISION] + name: str + + + class azure.search.documents.indexes.types.AnalyzeTextOptions(TypedDict, total=False): + key "analyzer": Union[str, LexicalAnalyzerName] + key "normalizer": Union[str, LexicalNormalizerName] + key "text": Required[str] + key "tokenizer": Union[str, LexicalTokenizerName] + analyzer: Union[str, LexicalAnalyzerName] + charFilters: list[Union[str, CharFilterName]] + normalizer: Union[str, LexicalNormalizerName] + text: str + tokenFilters: list[Union[str, TokenFilterName]] + tokenizer: Union[str, LexicalTokenizerName] + + + class azure.search.documents.indexes.types.AsciiFoldingTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#AsciiFoldingTokenFilter"]] + key "name": Required[str] + key "preserveOriginal": bool + ``@odata.type``: Literal[#AsciiFoldingTokenFilter] + name: str + preserveOriginal: bool + + + class azure.search.documents.indexes.types.AzureActiveDirectoryApplicationCredentials(TypedDict, total=False): + key "applicationId": Required[str] + key "applicationSecret": str + applicationId: str + applicationSecret: str + + + class azure.search.documents.indexes.types.AzureBlobKnowledgeSource(TypedDict): + key "@odata.etag": str + key "azureBlobParameters": Required[AzureBlobKnowledgeSourceParameters] + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "kind": Required[Literal[KnowledgeSourceKind.AZURE_BLOB]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + ``@odata.etag``: str + azureBlobParameters: AzureBlobKnowledgeSourceParameters + description: str + encryptionKey: SearchResourceEncryptionKey + kind: Literal[KnowledgeSourceKind.AZURE_BLOB] + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.AzureBlobKnowledgeSourceParameters(TypedDict, total=False): + key "connectionString": Required[str] + key "containerName": Required[str] + key "createdResources": ForwardRef('CreatedResources', module='types') + key "folderPath": Optional[str] + key "ingestionParameters": Optional[KnowledgeSourceIngestionParameters] + key "isADLSGen2": bool + key "queryHints": ForwardRef('SearchIndexKnowledgeSourceQueryHints', module='types') + connectionString: str + containerName: str + createdResources: CreatedResources + folderPath: str + ingestionParameters: KnowledgeSourceIngestionParameters + isADLSGen2: bool + queryHints: SearchIndexKnowledgeSourceQueryHints + + + class azure.search.documents.indexes.types.AzureMachineLearningParameters(TypedDict, total=False): + key "key": Optional[str] + key "modelName": Union[str, AIFoundryModelCatalogName] + key "region": Optional[str] + key "resourceId": Optional[str] + key "timeout": Optional[str] + key "uri": Required[Optional[str]] + key: str + modelName: Union[str, AIFoundryModelCatalogName] + region: str + resourceId: str + timeout: str + uri: str + + + class azure.search.documents.indexes.types.AzureMachineLearningSkill(TypedDict): + key "@odata.type": Required[Literal["#AmlSkill"]] + key "context": str + key "degreeOfParallelism": Optional[int] + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "key": Optional[str] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + key "region": Optional[str] + key "resourceId": Optional[str] + key "timeout": Optional[str] + key "uri": Optional[str] + ``@odata.type``: Literal[#AmlSkill] + context: str + degreeOfParallelism: int + description: str + inputs: list[InputFieldMappingEntry] + key: str + name: str + outputs: list[OutputFieldMappingEntry] + region: str + resourceId: str + timeout: str + uri: str + + + class azure.search.documents.indexes.types.AzureMachineLearningVectorizer(TypedDict, total=False): + key "amlParameters": ForwardRef('AzureMachineLearningParameters', module='types') + key "kind": Required[Literal[VectorSearchVectorizerKind.AML]] + key "name": Required[str] + amlParameters: AzureMachineLearningParameters + kind: Literal[VectorSearchVectorizerKind.AML] + name: str + + + class azure.search.documents.indexes.types.AzureOpenAIEmbeddingSkill(TypedDict): + key "@odata.type": Required[Literal["#AzureOpenAIEmbeddingSkill"]] + key "apiKey": str + key "authIdentity": ForwardRef('SearchIndexerDataIdentity', module='types') + key "context": str + key "deploymentId": str + key "description": str + key "dimensions": Optional[int] + key "inputs": Required[list[InputFieldMappingEntry]] + key "modelName": Union[str, AzureOpenAIModelName] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + key "resourceUri": str + ``@odata.type``: Literal[#AzureOpenAIEmbeddingSkill] + apiKey: str + authIdentity: SearchIndexerDataIdentity + context: str + deploymentId: str + description: str + dimensions: int + inputs: list[InputFieldMappingEntry] + modelName: Union[str, AzureOpenAIModelName] + name: str + outputs: list[OutputFieldMappingEntry] + resourceUri: str + + + class azure.search.documents.indexes.types.AzureOpenAITokenizerParameters(TypedDict, total=False): + key "encoderModelName": Optional[Union[str, SplitSkillEncoderModelName]] + allowedSpecialTokens: list[str] + encoderModelName: Union[str, SplitSkillEncoderModelName] + + + class azure.search.documents.indexes.types.AzureOpenAIVectorizer(TypedDict, total=False): + key "azureOpenAIParameters": ForwardRef('AzureOpenAIVectorizerParameters', module='types') + key "kind": Required[Literal[VectorSearchVectorizerKind.AZURE_OPEN_AI]] + key "name": Required[str] + azureOpenAIParameters: AzureOpenAIVectorizerParameters + kind: Literal[VectorSearchVectorizerKind.AZURE_OPEN_AI] + name: str + + + class azure.search.documents.indexes.types.AzureOpenAIVectorizerParameters(TypedDict, total=False): + key "apiKey": str + key "authIdentity": ForwardRef('SearchIndexerDataIdentity', module='types') + key "deploymentId": str + key "modelName": Union[str, AzureOpenAIModelName] + key "resourceUri": str + apiKey: str + authIdentity: SearchIndexerDataIdentity + deploymentId: str + modelName: Union[str, AzureOpenAIModelName] + resourceUri: str + + + class azure.search.documents.indexes.types.BM25SimilarityAlgorithm(TypedDict): + key "@odata.type": Required[Literal["#BM25Similarity"]] + key "b": Optional[float] + key "k1": Optional[float] + ``@odata.type``: Literal[#BM25Similarity] + b: float + k1: float + + + class azure.search.documents.indexes.types.BinaryQuantizationCompression(TypedDict, total=False): + key "kind": Required[Literal[VectorSearchCompressionKind.BINARY_QUANTIZATION]] + key "name": Required[str] + key "rescoringOptions": Optional[RescoringOptions] + key "truncationDimension": Optional[int] + kind: Literal[VectorSearchCompressionKind.BINARY_QUANTIZATION] + name: str + rescoringOptions: RescoringOptions + truncationDimension: int + + + class azure.search.documents.indexes.types.ChatCompletionCommonModelParameters(TypedDict, total=False): + key "frequencyPenalty": Optional[float] + key "maxTokens": Optional[int] + key "model": Optional[str] + key "presencePenalty": Optional[float] + key "seed": Optional[int] + key "stop": Optional[list[str]] + key "temperature": Optional[float] + frequencyPenalty: float + maxTokens: int + model: str + presencePenalty: float + seed: int + stop: list[str] + temperature: float + + + class azure.search.documents.indexes.types.ChatCompletionResponseFormat(TypedDict, total=False): + key "jsonSchemaProperties": Optional[ChatCompletionSchemaProperties] + key "type": Union[str, ChatCompletionResponseFormatType] + jsonSchemaProperties: ChatCompletionSchemaProperties + type: Union[str, ChatCompletionResponseFormatType] + + + class azure.search.documents.indexes.types.ChatCompletionSchema(TypedDict, total=False): + key "additionalProperties": bool + key "properties": str + key "type": str + additionalProperties: bool + properties: str + required: list[str] + type: str + + + class azure.search.documents.indexes.types.ChatCompletionSchemaProperties(TypedDict, total=False): + key "description": Optional[str] + key "name": Optional[str] + key "schema": ForwardRef('ChatCompletionSchema', module='types') + key "strict": bool + description: str + name: str + schema: ChatCompletionSchema + strict: bool + + + class azure.search.documents.indexes.types.ChatCompletionSkill(TypedDict): + key "@odata.type": Required[Literal["#ChatCompletionSkill"]] + key "apiKey": str + key "authIdentity": Optional[SearchIndexerDataIdentity] + key "commonModelParameters": ForwardRef('ChatCompletionCommonModelParameters', module='types') + key "context": str + key "description": str + key "extraParameters": Optional[dict[str, Any]] + key "extraParametersBehavior": Union[str, ChatCompletionExtraParametersBehavior] + key "inputs": Required[list[InputFieldMappingEntry]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + key "responseFormat": ForwardRef('ChatCompletionResponseFormat', module='types') + key "uri": Required[str] + ``@odata.type``: Literal[#ChatCompletionSkill] + apiKey: str + authIdentity: SearchIndexerDataIdentity + commonModelParameters: ChatCompletionCommonModelParameters + context: str + description: str + extraParameters: dict[str, Any] + extraParametersBehavior: Union[str, ChatCompletionExtraParametersBehavior] + inputs: list[InputFieldMappingEntry] + name: str + outputs: list[OutputFieldMappingEntry] + responseFormat: ChatCompletionResponseFormat + uri: str + + + class azure.search.documents.indexes.types.CjkBigramTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#CjkBigramTokenFilter"]] + key "name": Required[str] + key "outputUnigrams": bool + ``@odata.type``: Literal[#CjkBigramTokenFilter] + ignoreScripts: list[Union[str, CjkBigramTokenFilterScripts]] + name: str + outputUnigrams: bool + + + class azure.search.documents.indexes.types.ClassicSimilarityAlgorithm(TypedDict): + key "@odata.type": Required[Literal["#ClassicSimilarity"]] + ``@odata.type``: Literal[#ClassicSimilarity] + + + class azure.search.documents.indexes.types.ClassicTokenizer(TypedDict): + key "@odata.type": Required[Literal["#ClassicTokenizer"]] + key "maxTokenLength": int + key "name": Required[str] + ``@odata.type``: Literal[#ClassicTokenizer] + maxTokenLength: int + name: str + + + class azure.search.documents.indexes.types.CognitiveServicesAccountKey(TypedDict): + key "@odata.type": Required[Literal["#CognitiveServicesByKey"]] + key "description": str + key "key": Required[str] + ``@odata.type``: Literal[#CognitiveServicesByKey] + description: str + key: str + + + class azure.search.documents.indexes.types.CommonGramTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#CommonGramTokenFilter"]] + key "commonWords": Required[list[str]] + key "ignoreCase": bool + key "name": Required[str] + key "queryMode": bool + ``@odata.type``: Literal[#CommonGramTokenFilter] + commonWords: list[str] + ignoreCase: bool + name: str + queryMode: bool + + + class azure.search.documents.indexes.types.ConditionalSkill(TypedDict): + key "@odata.type": Required[Literal["#ConditionalSkill"]] + key "context": str + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#ConditionalSkill] + context: str + description: str + inputs: list[InputFieldMappingEntry] + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.ContentColumnMapping(TypedDict, total=False): + key "name": Required[str] + key "searchFieldType": Required[str] + key "sourceField": Required[str] + name: str + searchFieldType: str + sourceField: str + + + class azure.search.documents.indexes.types.ContentUnderstandingSkill(TypedDict): + key "@odata.type": Required[Literal["#ContentUnderstandingSkill"]] + key "chunkingProperties": Optional[ContentUnderstandingSkillChunkingProperties] + key "context": str + key "description": str + key "extractionOptions": Optional[list[Union[str, ContentUnderstandingSkillExtractionOptions]]] + key "inputs": Required[list[InputFieldMappingEntry]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#ContentUnderstandingSkill] + chunkingProperties: ContentUnderstandingSkillChunkingProperties + context: str + description: str + extractionOptions: list[Union[str, ContentUnderstandingSkillExtractionOptions]] + inputs: list[InputFieldMappingEntry] + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.ContentUnderstandingSkillChunkingProperties(TypedDict, total=False): + key "maximumLength": Optional[int] + key "method": Union[str, ContentUnderstandingSkillChunkingMethod] + key "overlapLength": Optional[int] + key "unit": Optional[Union[str, ContentUnderstandingSkillChunkingUnit]] + maximumLength: int + method: Union[str, ContentUnderstandingSkillChunkingMethod] + overlapLength: int + unit: Union[str, ContentUnderstandingSkillChunkingUnit] + + + class azure.search.documents.indexes.types.CorsOptions(TypedDict, total=False): + key "allowedOrigins": Required[list[str]] + key "maxAgeInSeconds": Optional[int] + allowedOrigins: list[str] + maxAgeInSeconds: int + + + class azure.search.documents.indexes.types.CreatedResources(TypedDict, total=False): + + + class azure.search.documents.indexes.types.CustomAnalyzer(TypedDict): + key "@odata.type": Required[Literal["#CustomAnalyzer"]] + key "name": Required[str] + key "tokenizer": Required[Union[str, LexicalTokenizerName]] + ``@odata.type``: Literal[#CustomAnalyzer] + charFilters: list[Union[str, CharFilterName]] + name: str + tokenFilters: list[Union[str, TokenFilterName]] + tokenizer: Union[str, LexicalTokenizerName] + + + class azure.search.documents.indexes.types.CustomEntity(TypedDict, total=False): + key "accentSensitive": Optional[bool] + key "aliases": Optional[list[CustomEntityAlias]] + key "caseSensitive": Optional[bool] + key "defaultAccentSensitive": Optional[bool] + key "defaultCaseSensitive": Optional[bool] + key "defaultFuzzyEditDistance": Optional[int] + key "description": Optional[str] + key "fuzzyEditDistance": Optional[int] + key "id": Optional[str] + key "name": Required[str] + key "subtype": Optional[str] + key "type": Optional[str] + accentSensitive: bool + aliases: list[CustomEntityAlias] + caseSensitive: bool + defaultAccentSensitive: bool + defaultCaseSensitive: bool + defaultFuzzyEditDistance: int + description: str + fuzzyEditDistance: int + id: str + name: str + subtype: str + type: str + + + class azure.search.documents.indexes.types.CustomEntityAlias(TypedDict, total=False): + key "accentSensitive": Optional[bool] + key "caseSensitive": Optional[bool] + key "fuzzyEditDistance": Optional[int] + key "text": Required[str] + accentSensitive: bool + caseSensitive: bool + fuzzyEditDistance: int + text: str + + + class azure.search.documents.indexes.types.CustomEntityLookupSkill(TypedDict): + key "@odata.type": Required[Literal["#CustomEntityLookupSkill"]] + key "context": str + key "defaultLanguageCode": Optional[Union[str, CustomEntityLookupSkillLanguage]] + key "description": str + key "entitiesDefinitionUri": Optional[str] + key "globalDefaultAccentSensitive": Optional[bool] + key "globalDefaultCaseSensitive": Optional[bool] + key "globalDefaultFuzzyEditDistance": Optional[int] + key "inlineEntitiesDefinition": Optional[list[CustomEntity]] + key "inputs": Required[list[InputFieldMappingEntry]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#CustomEntityLookupSkill] + context: str + defaultLanguageCode: Union[str, CustomEntityLookupSkillLanguage] + description: str + entitiesDefinitionUri: str + globalDefaultAccentSensitive: bool + globalDefaultCaseSensitive: bool + globalDefaultFuzzyEditDistance: int + inlineEntitiesDefinition: list[CustomEntity] + inputs: list[InputFieldMappingEntry] + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.CustomNormalizer(TypedDict): + key "@odata.type": Required[Literal["#CustomNormalizer"]] + key "name": Required[str] + ``@odata.type``: Literal[#CustomNormalizer] + charFilters: list[Union[str, CharFilterName]] + name: str + tokenFilters: list[Union[str, TokenFilterName]] + + + class azure.search.documents.indexes.types.DataSourceCredentials(TypedDict, total=False): + key "connectionString": str + connectionString: str + + + class azure.search.documents.indexes.types.DefaultCognitiveServicesAccount(TypedDict): + key "@odata.type": Required[Literal["#DefaultCognitiveServices"]] + key "description": str + ``@odata.type``: Literal[#DefaultCognitiveServices] + description: str + + + class azure.search.documents.indexes.types.DictionaryDecompounderTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#DictionaryDecompounderTokenFilter"]] + key "maxSubwordSize": int + key "minSubwordSize": int + key "minWordSize": int + key "name": Required[str] + key "onlyLongestMatch": bool + key "wordList": Required[list[str]] + ``@odata.type``: Literal[#DictionaryDecompounderTokenFilter] + maxSubwordSize: int + minSubwordSize: int + minWordSize: int + name: str + onlyLongestMatch: bool + wordList: list[str] + + + class azure.search.documents.indexes.types.DistanceScoringFunction(TypedDict, total=False): + key "boost": Required[float] + key "distance": Required[DistanceScoringParameters] + key "fieldName": Required[str] + key "interpolation": Union[str, ScoringFunctionInterpolation] + key "type": Required[Literal["distance"]] + boost: float + distance: DistanceScoringParameters + fieldName: str + interpolation: Union[str, ScoringFunctionInterpolation] + type: Literal[distance] + + + class azure.search.documents.indexes.types.DistanceScoringParameters(TypedDict, total=False): + key "boostingDistance": Required[float] + key "referencePointParameter": Required[str] + boostingDistance: float + referencePointParameter: str + + + class azure.search.documents.indexes.types.DocumentExtractionSkill(TypedDict): + key "@odata.type": Required[Literal["#DocumentExtractionSkill"]] + key "configuration": Optional[dict[str, Any]] + key "context": str + key "dataToExtract": Optional[str] + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + key "parsingMode": Optional[str] + ``@odata.type``: Literal[#DocumentExtractionSkill] + configuration: dict[str, Any] + context: str + dataToExtract: str + description: str + inputs: list[InputFieldMappingEntry] + name: str + outputs: list[OutputFieldMappingEntry] + parsingMode: str + + + class azure.search.documents.indexes.types.DocumentIntelligenceLayoutSkill(TypedDict): + key "@odata.type": Required[Literal["#DocumentIntelligenceLayoutSkill"]] + key "chunkingProperties": Optional[DocumentIntelligenceLayoutSkillChunkingProperties] + key "context": str + key "description": str + key "extractionOptions": Optional[list[Union[str, DocumentIntelligenceLayoutSkillExtractionOptions]]] + key "inputs": Required[list[InputFieldMappingEntry]] + key "markdownHeaderDepth": Optional[Union[str, DocumentIntelligenceLayoutSkillMarkdownHeaderDepth]] + key "name": str + key "outputFormat": Optional[Union[str, DocumentIntelligenceLayoutSkillOutputFormat]] + key "outputMode": Optional[Union[str, DocumentIntelligenceLayoutSkillOutputMode]] + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#DocumentIntelligenceLayoutSkill] + chunkingProperties: DocumentIntelligenceLayoutSkillChunkingProperties + context: str + description: str + extractionOptions: list[Union[str, DocumentIntelligenceLayoutSkillExtractionOptions]] + inputs: list[InputFieldMappingEntry] + markdownHeaderDepth: Union[str, DocumentIntelligenceLayoutSkillMarkdownHeaderDepth] + name: str + outputFormat: Union[str, DocumentIntelligenceLayoutSkillOutputFormat] + outputMode: Union[str, DocumentIntelligenceLayoutSkillOutputMode] + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.DocumentIntelligenceLayoutSkillChunkingProperties(TypedDict, total=False): + key "maximumLength": Optional[int] + key "overlapLength": Optional[int] + key "unit": Optional[Union[str, DocumentIntelligenceLayoutSkillChunkingUnit]] + maximumLength: int + overlapLength: int + unit: Union[str, DocumentIntelligenceLayoutSkillChunkingUnit] + + + class azure.search.documents.indexes.types.DocumentKeysOrIds(TypedDict, total=False): + datasourceDocumentIds: list[str] + documentKeys: list[str] + + + class azure.search.documents.indexes.types.EdgeNGramTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#EdgeNGramTokenFilter"]] + key "maxGram": int + key "minGram": int + key "name": Required[str] + key "side": Union[str, EdgeNGramTokenFilterSide] + ``@odata.type``: Literal[#EdgeNGramTokenFilter] + maxGram: int + minGram: int + name: str + side: Union[str, EdgeNGramTokenFilterSide] + + + class azure.search.documents.indexes.types.EdgeNGramTokenFilterV2(TypedDict): + key "@odata.type": Required[Literal["#EdgeNGramTokenFilterV2"]] + key "maxGram": int + key "minGram": int + key "name": Required[str] + key "side": Union[str, EdgeNGramTokenFilterSide] + ``@odata.type``: Literal[#EdgeNGramTokenFilterV2] + maxGram: int + minGram: int + name: str + side: Union[str, EdgeNGramTokenFilterSide] + + + class azure.search.documents.indexes.types.EdgeNGramTokenizer(TypedDict): + key "@odata.type": Required[Literal["#EdgeNGramTokenizer"]] + key "maxGram": int + key "minGram": int + key "name": Required[str] + ``@odata.type``: Literal[#EdgeNGramTokenizer] + maxGram: int + minGram: int + name: str + tokenChars: list[Union[str, TokenCharacterKind]] + + + class azure.search.documents.indexes.types.ElisionTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#ElisionTokenFilter"]] + key "name": Required[str] + ``@odata.type``: Literal[#ElisionTokenFilter] + articles: list[str] + name: str + + + class azure.search.documents.indexes.types.EmbeddingColumnMapping(TypedDict, total=False): + key "name": Required[str] + key "sourceField": Required[str] + name: str + sourceField: str + + + class azure.search.documents.indexes.types.EntityLinkingSkill(TypedDict): + key "@odata.type": Required[Literal["#EntityLinkingSkill"]] + key "context": str + key "defaultLanguageCode": Optional[str] + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "minimumPrecision": float + key "modelVersion": Optional[str] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#EntityLinkingSkill] + context: str + defaultLanguageCode: str + description: str + inputs: list[InputFieldMappingEntry] + minimumPrecision: float + modelVersion: str + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.EntityRecognitionSkillV3(TypedDict): + key "@odata.type": Required[Literal["#EntityRecognitionSkill"]] + key "context": str + key "defaultLanguageCode": Optional[Union[str, EntityRecognitionSkillLanguage]] + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "minimumPrecision": float + key "modelVersion": Optional[str] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#EntityRecognitionSkill] + categories: list[Union[str, EntityCategory]] + context: str + defaultLanguageCode: Union[str, EntityRecognitionSkillLanguage] + description: str + inputs: list[InputFieldMappingEntry] + minimumPrecision: float + modelVersion: str + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.EntraAppAuthentication(TypedDict, total=False): + key "applicationId": Required[str] + key "federatedCredentialId": Required[str] + key "tenantId": str + applicationId: str + federatedCredentialId: str + tenantId: str + + + class azure.search.documents.indexes.types.ExhaustiveKnnAlgorithmConfiguration(TypedDict, total=False): + key "exhaustiveKnnParameters": ForwardRef('ExhaustiveKnnParameters', module='types') + key "kind": Required[Literal[VectorSearchAlgorithmKind.EXHAUSTIVE_KNN]] + key "name": Required[str] + exhaustiveKnnParameters: ExhaustiveKnnParameters + kind: Literal[VectorSearchAlgorithmKind.EXHAUSTIVE_KNN] + name: str + + + class azure.search.documents.indexes.types.ExhaustiveKnnParameters(TypedDict, total=False): + key "metric": Optional[Union[str, VectorSearchAlgorithmMetric]] + metric: Union[str, VectorSearchAlgorithmMetric] + + + class azure.search.documents.indexes.types.FabricDataAgentKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "fabricDataAgentParameters": Required[FabricDataAgentKnowledgeSourceParameters] + key "kind": Required[Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + ``@odata.etag``: str + description: str + encryptionKey: SearchResourceEncryptionKey + fabricDataAgentParameters: FabricDataAgentKnowledgeSourceParameters + kind: Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT] + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.FabricDataAgentKnowledgeSourceParameters(TypedDict, total=False): + key "dataAgentId": Required[str] + key "workspaceId": Required[str] + dataAgentId: str + workspaceId: str + + + class azure.search.documents.indexes.types.FabricOntologyKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "fabricOntologyParameters": Required[FabricOntologyKnowledgeSourceParameters] + key "kind": Required[Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + ``@odata.etag``: str + description: str + encryptionKey: SearchResourceEncryptionKey + fabricOntologyParameters: FabricOntologyKnowledgeSourceParameters + kind: Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY] + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.FabricOntologyKnowledgeSourceParameters(TypedDict, total=False): + key "ontologyId": Required[str] + key "workspaceId": Required[str] + ontologyId: str + workspaceId: str + + + class azure.search.documents.indexes.types.FieldMapping(TypedDict, total=False): + key "mappingFunction": Optional[FieldMappingFunction] + key "sourceFieldName": Required[str] + key "targetFieldName": str + mappingFunction: FieldMappingFunction + sourceFieldName: str + targetFieldName: str + + + class azure.search.documents.indexes.types.FieldMappingFunction(TypedDict, total=False): + key "name": Required[str] + key "parameters": Optional[dict[str, Any]] + name: str + parameters: dict[str, Any] + + + class azure.search.documents.indexes.types.FileKnowledgeSource(TypedDict): + key "@odata.etag": str + key "corsOptions": ForwardRef('CorsOptions', module='types') + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "fileParameters": Required[FileKnowledgeSourceParameters] + key "kind": Required[Literal[KnowledgeSourceKind.FILE]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + ``@odata.etag``: str + corsOptions: CorsOptions + description: str + encryptionKey: SearchResourceEncryptionKey + fileParameters: FileKnowledgeSourceParameters + kind: Literal[KnowledgeSourceKind.FILE] + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.FileKnowledgeSourceParameters(TypedDict, total=False): + key "createdResources": ForwardRef('CreatedResources', module='types') + key "ingestionParameters": Optional[KnowledgeSourceIngestionParameters] + key "queryHints": ForwardRef('SearchIndexKnowledgeSourceQueryHints', module='types') + createdResources: CreatedResources + ingestionParameters: KnowledgeSourceIngestionParameters + queryHints: SearchIndexKnowledgeSourceQueryHints + + + class azure.search.documents.indexes.types.FileUploadMetadata(TypedDict, total=False): + key "fileName": str + fileName: str + metadata: dict[str, str] + + + class azure.search.documents.indexes.types.FreshnessScoringFunction(TypedDict, total=False): + key "boost": Required[float] + key "fieldName": Required[str] + key "freshness": Required[FreshnessScoringParameters] + key "interpolation": Union[str, ScoringFunctionInterpolation] + key "type": Required[Literal["freshness"]] + boost: float + fieldName: str + freshness: FreshnessScoringParameters + interpolation: Union[str, ScoringFunctionInterpolation] + type: Literal[freshness] + + + class azure.search.documents.indexes.types.FreshnessScoringParameters(TypedDict, total=False): + key "boostingDuration": Required[str] + boostingDuration: str + + + class azure.search.documents.indexes.types.HighWaterMarkChangeDetectionPolicy(TypedDict): + key "@odata.type": Required[Literal["#HighWaterMarkChangeDetectionPolicy"]] + key "highWaterMarkColumnName": Required[str] + ``@odata.type``: Literal[#HighWaterMarkChangeDetectionPolicy] + highWaterMarkColumnName: str + + + class azure.search.documents.indexes.types.HnswAlgorithmConfiguration(TypedDict, total=False): + key "hnswParameters": ForwardRef('HnswParameters', module='types') + key "kind": Required[Literal[VectorSearchAlgorithmKind.HNSW]] + key "name": Required[str] + hnswParameters: HnswParameters + kind: Literal[VectorSearchAlgorithmKind.HNSW] + name: str + + + class azure.search.documents.indexes.types.HnswParameters(TypedDict, total=False): + key "efConstruction": int + key "efSearch": int + key "m": int + key "metric": Optional[Union[str, VectorSearchAlgorithmMetric]] + efConstruction: int + efSearch: int + m: int + metric: Union[str, VectorSearchAlgorithmMetric] + + + class azure.search.documents.indexes.types.ImageAnalysisSkill(TypedDict): + key "@odata.type": Required[Literal["#ImageAnalysisSkill"]] + key "context": str + key "defaultLanguageCode": Union[str, ImageAnalysisSkillLanguage] + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#ImageAnalysisSkill] + context: str + defaultLanguageCode: Union[str, ImageAnalysisSkillLanguage] + description: str + details: list[Union[str, ImageDetail]] + inputs: list[InputFieldMappingEntry] + name: str + outputs: list[OutputFieldMappingEntry] + visualFeatures: list[Union[str, VisualFeature]] + + + class azure.search.documents.indexes.types.IndexedOneLakeKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "indexedOneLakeParameters": Required[IndexedOneLakeKnowledgeSourceParameters] + key "kind": Required[Literal[KnowledgeSourceKind.INDEXED_ONELAKE]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + ``@odata.etag``: str + description: str + encryptionKey: SearchResourceEncryptionKey + indexedOneLakeParameters: IndexedOneLakeKnowledgeSourceParameters + kind: Literal[KnowledgeSourceKind.INDEXED_ONELAKE] + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.IndexedOneLakeKnowledgeSourceParameters(TypedDict, total=False): + key "createdResources": ForwardRef('CreatedResources', module='types') + key "fabricWorkspaceId": Required[str] + key "ingestionParameters": Optional[KnowledgeSourceIngestionParameters] + key "lakehouseId": Required[str] + key "queryHints": ForwardRef('SearchIndexKnowledgeSourceQueryHints', module='types') + key "targetPath": Optional[str] + createdResources: CreatedResources + fabricWorkspaceId: str + ingestionParameters: KnowledgeSourceIngestionParameters + lakehouseId: str + queryHints: SearchIndexKnowledgeSourceQueryHints + targetPath: str + + + class azure.search.documents.indexes.types.IndexedSharePointKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "indexedSharePointParameters": Required[IndexedSharePointKnowledgeSourceParameters] + key "kind": Required[Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + ``@odata.etag``: str + description: str + encryptionKey: SearchResourceEncryptionKey + indexedSharePointParameters: IndexedSharePointKnowledgeSourceParameters + kind: Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT] + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.IndexedSharePointKnowledgeSourceParameters(TypedDict, total=False): + key "connectionString": Required[str] + key "containerName": Required[Union[str, IndexedSharePointContainerName]] + key "createdResources": ForwardRef('CreatedResources', module='types') + key "ingestionParameters": Optional[KnowledgeSourceIngestionParameters] + key "query": Optional[str] + key "queryHints": ForwardRef('SearchIndexKnowledgeSourceQueryHints', module='types') + connectionString: str + containerName: Union[str, IndexedSharePointContainerName] + createdResources: CreatedResources + ingestionParameters: KnowledgeSourceIngestionParameters + query: str + queryHints: SearchIndexKnowledgeSourceQueryHints + + + class azure.search.documents.indexes.types.IndexedSqlKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "indexedSqlParameters": Required[IndexedSqlKnowledgeSourceParameters] + key "kind": Required[Literal[KnowledgeSourceKind.INDEXED_SQL]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + ``@odata.etag``: str + description: str + encryptionKey: SearchResourceEncryptionKey + indexedSqlParameters: IndexedSqlKnowledgeSourceParameters + kind: Literal[KnowledgeSourceKind.INDEXED_SQL] + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.IndexedSqlKnowledgeSourceParameters(TypedDict, total=False): + key "connectionString": Required[str] + key "createdResources": ForwardRef('CreatedResources', module='types') + key "highWaterMarkColumnName": str + key "ingestionParameters": Optional[KnowledgeSourceIngestionParameters] + key "queryHints": ForwardRef('SearchIndexKnowledgeSourceQueryHints', module='types') + key "tableOrView": Required[str] + connectionString: str + contentColumns: list[ContentColumnMapping] + createdResources: CreatedResources + embeddingColumns: list[EmbeddingColumnMapping] + highWaterMarkColumnName: str + ingestionParameters: KnowledgeSourceIngestionParameters + queryHints: SearchIndexKnowledgeSourceQueryHints + tableOrView: str + + + class azure.search.documents.indexes.types.IndexerResyncBody(TypedDict, total=False): + key "options": Optional[list[Union[str, IndexerResyncOption]]] + options: list[Union[str, IndexerResyncOption]] + + + class azure.search.documents.indexes.types.IndexingParameters(TypedDict, total=False): + key "batchSize": Optional[int] + key "configuration": ForwardRef('IndexingParametersConfiguration', module='types') + key "maxFailedItems": Optional[int] + key "maxFailedItemsPerBatch": Optional[int] + batchSize: int + configuration: IndexingParametersConfiguration + maxFailedItems: int + maxFailedItemsPerBatch: int + + + class azure.search.documents.indexes.types.IndexingParametersConfiguration(TypedDict, total=False): + key "allowSkillsetToReadFileData": bool + key "dataToExtract": Union[str, BlobIndexerDataToExtract] + key "delimitedTextDelimiter": str + key "delimitedTextHeaders": str + key "documentRoot": str + key "excludedFileNameExtensions": str + key "executionEnvironment": Union[str, IndexerExecutionEnvironment] + key "failOnUnprocessableDocument": bool + key "failOnUnsupportedContentType": bool + key "firstLineContainsHeaders": bool + key "imageAction": Union[str, BlobIndexerImageAction] + key "indexStorageMetadataOnlyForOversizedDocuments": bool + key "indexedFileNameExtensions": str + key "markdownHeaderDepth": Optional[Union[str, MarkdownHeaderDepth]] + key "markdownParsingSubmode": Optional[Union[str, MarkdownParsingSubmode]] + key "parsingMode": Union[str, BlobIndexerParsingMode] + key "pdfTextRotationAlgorithm": Union[str, BlobIndexerPDFTextRotationAlgorithm] + key "queryTimeout": str + allowSkillsetToReadFileData: bool + dataToExtract: Union[str, BlobIndexerDataToExtract] + delimitedTextDelimiter: str + delimitedTextHeaders: str + documentRoot: str + excludedFileNameExtensions: str + executionEnvironment: Union[str, IndexerExecutionEnvironment] + failOnUnprocessableDocument: bool + failOnUnsupportedContentType: bool + firstLineContainsHeaders: bool + imageAction: Union[str, BlobIndexerImageAction] + indexStorageMetadataOnlyForOversizedDocuments: bool + indexedFileNameExtensions: str + markdownHeaderDepth: Union[str, MarkdownHeaderDepth] + markdownParsingSubmode: Union[str, MarkdownParsingSubmode] + parsingMode: Union[str, BlobIndexerParsingMode] + pdfTextRotationAlgorithm: Union[str, BlobIndexerPDFTextRotationAlgorithm] + queryTimeout: str + + + class azure.search.documents.indexes.types.IndexingSchedule(TypedDict, total=False): + key "interval": Required[str] + key "startTime": str + interval: str + startTime: str + + + class azure.search.documents.indexes.types.InputFieldMappingEntry(TypedDict, total=False): + key "name": Required[str] + key "source": str + key "sourceContext": str + inputs: list[InputFieldMappingEntry] + name: str + source: str + sourceContext: str + + + class azure.search.documents.indexes.types.KeepTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#KeepTokenFilter"]] + key "keepWords": Required[list[str]] + key "keepWordsCase": bool + key "name": Required[str] + ``@odata.type``: Literal[#KeepTokenFilter] + keepWords: list[str] + keepWordsCase: bool + name: str + + + class azure.search.documents.indexes.types.KeyPhraseExtractionSkill(TypedDict): + key "@odata.type": Required[Literal["#KeyPhraseExtractionSkill"]] + key "context": str + key "defaultLanguageCode": Union[str, KeyPhraseExtractionSkillLanguage] + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "maxKeyPhraseCount": Optional[int] + key "modelVersion": Optional[str] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#KeyPhraseExtractionSkill] + context: str + defaultLanguageCode: Union[str, KeyPhraseExtractionSkillLanguage] + description: str + inputs: list[InputFieldMappingEntry] + maxKeyPhraseCount: int + modelVersion: str + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.KeywordMarkerTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#KeywordMarkerTokenFilter"]] + key "ignoreCase": bool + key "keywords": Required[list[str]] + key "name": Required[str] + ``@odata.type``: Literal[#KeywordMarkerTokenFilter] + ignoreCase: bool + keywords: list[str] + name: str + + + class azure.search.documents.indexes.types.KeywordTokenizer(TypedDict): + key "@odata.type": Required[Literal["#KeywordTokenizer"]] + key "bufferSize": int + key "name": Required[str] + ``@odata.type``: Literal[#KeywordTokenizer] + bufferSize: int + name: str + + + class azure.search.documents.indexes.types.KeywordTokenizerV2(TypedDict): + key "@odata.type": Required[Literal["#KeywordTokenizerV2"]] + key "maxTokenLength": int + key "name": Required[str] + ``@odata.type``: Literal[#KeywordTokenizerV2] + maxTokenLength: int + name: str + + + class azure.search.documents.indexes.types.KnowledgeBase(TypedDict): + key "@odata.etag": str + key "answerInstructions": str + key "corsOptions": ForwardRef('CorsOptions', module='types') + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "knowledgeSources": Required[list[KnowledgeSourceReference]] + key "name": Required[str] + key "outputMode": Union[str, KnowledgeRetrievalOutputMode] + key "retrievalInstructions": str + key "retrievalReasoningEffort": ForwardRef('KnowledgeRetrievalReasoningEffort', module='types') + key "retrieveDefaults": ForwardRef('KnowledgeBaseRetrieveDefaults', module='types') + ``@odata.etag``: str + answerInstructions: str + corsOptions: CorsOptions + description: str + encryptionKey: SearchResourceEncryptionKey + knowledgeSources: list[KnowledgeSourceReference] + models: list[KnowledgeBaseModel] + name: str + outputMode: Union[str, KnowledgeRetrievalOutputMode] + retrievalInstructions: str + retrievalReasoningEffort: KnowledgeRetrievalReasoningEffort + retrieveDefaults: KnowledgeBaseRetrieveDefaults + tags: dict[str, str] + + + class azure.search.documents.indexes.types.KnowledgeBaseAzureOpenAIModel(TypedDict, total=False): + key "azureOpenAIParameters": Required[AzureOpenAIVectorizerParameters] + key "kind": Required[Literal[KnowledgeBaseModelKind.AZURE_OPEN_AI]] + azureOpenAIParameters: AzureOpenAIVectorizerParameters + kind: Literal[KnowledgeBaseModelKind.AZURE_OPEN_AI] + + + class azure.search.documents.indexes.types.KnowledgeBaseModel(TypedDict, total=False): + key "azureOpenAIParameters": Required[AzureOpenAIVectorizerParameters] + key "kind": Required[Literal[KnowledgeBaseModelKind.AZURE_OPEN_AI]] + azureOpenAIParameters: AzureOpenAIVectorizerParameters + kind: Literal[KnowledgeBaseModelKind.AZURE_OPEN_AI] + + + class azure.search.documents.indexes.types.KnowledgeBaseModelKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AZURE_OPEN_AI = "azureOpenAI" + + + class azure.search.documents.indexes.types.KnowledgeBaseRetrieveDefaults(TypedDict, total=False): + key "maxOutputDocuments": int + key "maxOutputSizeInTokens": int + key "maxRuntimeInSeconds": int + maxOutputDocuments: int + maxOutputSizeInTokens: int + maxRuntimeInSeconds: int + + + class azure.search.documents.indexes.types.KnowledgeSourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AZURE_BLOB = "azureBlob" + FABRIC_DATA_AGENT = "fabricDataAgent" + FABRIC_ONTOLOGY = "fabricOntology" + FILE = "file" + INDEXED_ONELAKE = "indexedOneLake" + INDEXED_SHARE_POINT = "indexedSharePoint" + INDEXED_SQL = "indexedSql" + MCP_SERVER = "mcpServer" + REMOTE_SHARE_POINT = "remoteSharePoint" + SEARCH_INDEX = "searchIndex" + WEB = "web" + WORK_IQ = "workIQ" + + + class azure.search.documents.indexes.types.KnowledgeSourceReference(TypedDict, total=False): + key "enableFreshness": bool + key "enableImageServing": bool + key "name": Required[str] + enableFreshness: bool + enableImageServing: bool + name: str + + + class azure.search.documents.indexes.types.LanguageDetectionSkill(TypedDict): + key "@odata.type": Required[Literal["#LanguageDetectionSkill"]] + key "context": str + key "defaultCountryHint": Optional[str] + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "modelVersion": Optional[str] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#LanguageDetectionSkill] + context: str + defaultCountryHint: str + description: str + inputs: list[InputFieldMappingEntry] + modelVersion: str + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.LengthTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#LengthTokenFilter"]] + key "max": int + key "min": int + key "name": Required[str] + ``@odata.type``: Literal[#LengthTokenFilter] + max: int + min: int + name: str + + + class azure.search.documents.indexes.types.LexicalNormalizer(TypedDict): + key "@odata.type": Required[Literal["#CustomNormalizer"]] + key "name": Required[str] + ``@odata.type``: Literal[#CustomNormalizer] + charFilters: list[Union[str, CharFilterName]] + name: str + tokenFilters: list[Union[str, TokenFilterName]] + + + class azure.search.documents.indexes.types.LimitTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#LimitTokenFilter"]] + key "consumeAllTokens": bool + key "maxTokenCount": int + key "name": Required[str] + ``@odata.type``: Literal[#LimitTokenFilter] + consumeAllTokens: bool + maxTokenCount: int + name: str + + + class azure.search.documents.indexes.types.LuceneStandardAnalyzer(TypedDict): + key "@odata.type": Required[Literal["#StandardAnalyzer"]] + key "maxTokenLength": int + key "name": Required[str] + ``@odata.type``: Literal[#StandardAnalyzer] + maxTokenLength: int + name: str + stopwords: list[str] + + + class azure.search.documents.indexes.types.LuceneStandardTokenizer(TypedDict): + key "@odata.type": Required[Literal["#StandardTokenizer"]] + key "maxTokenLength": int + key "name": Required[str] + ``@odata.type``: Literal[#StandardTokenizer] + maxTokenLength: int + name: str + + + class azure.search.documents.indexes.types.LuceneStandardTokenizerV2(TypedDict): + key "@odata.type": Required[Literal["#StandardTokenizerV2"]] + key "maxTokenLength": int + key "name": Required[str] + ``@odata.type``: Literal[#StandardTokenizerV2] + maxTokenLength: int + name: str + + + class azure.search.documents.indexes.types.MagnitudeScoringFunction(TypedDict, total=False): + key "boost": Required[float] + key "fieldName": Required[str] + key "interpolation": Union[str, ScoringFunctionInterpolation] + key "magnitude": Required[MagnitudeScoringParameters] + key "type": Required[Literal["magnitude"]] + boost: float + fieldName: str + interpolation: Union[str, ScoringFunctionInterpolation] + magnitude: MagnitudeScoringParameters + type: Literal[magnitude] + + + class azure.search.documents.indexes.types.MagnitudeScoringParameters(TypedDict, total=False): + key "boostingRangeEnd": Required[float] + key "boostingRangeStart": Required[float] + key "constantBoostBeyondRange": bool + boostingRangeEnd: float + boostingRangeStart: float + constantBoostBeyondRange: bool + + + class azure.search.documents.indexes.types.MappingCharFilter(TypedDict): + key "@odata.type": Required[Literal["#MappingCharFilter"]] + key "mappings": Required[list[str]] + key "name": Required[str] + ``@odata.type``: Literal[#MappingCharFilter] + mappings: list[str] + name: str + + + class azure.search.documents.indexes.types.McpServerAuthenticationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FOUNDRY_CONNECTION = "foundryConnection" + STORED_HEADERS = "storedHeaders" + + + class azure.search.documents.indexes.types.McpServerAutoOutputParsing(TypedDict, total=False): + key "kind": Required[Literal[McpServerOutputParsingKind.AUTO]] + kind: Literal[McpServerOutputParsingKind.AUTO] + + + class azure.search.documents.indexes.types.McpServerFoundryConnectionAuthentication(TypedDict, total=False): + key "foundryConnectionParameters": Required[McpServerFoundryConnectionParameters] + key "kind": Required[Literal[McpServerAuthenticationKind.FOUNDRY_CONNECTION]] + foundryConnectionParameters: McpServerFoundryConnectionParameters + kind: Literal[McpServerAuthenticationKind.FOUNDRY_CONNECTION] + + + class azure.search.documents.indexes.types.McpServerFoundryConnectionParameters(TypedDict, total=False): + key "connectionId": str + connectionId: str + + + class azure.search.documents.indexes.types.McpServerHeaders(TypedDict, total=False): + + + class azure.search.documents.indexes.types.McpServerJsonOutputParsing(TypedDict, total=False): + key "jsonParameters": Required[McpServerOutputParsingJsonParameters] + key "kind": Required[Literal[McpServerOutputParsingKind.JSON]] + jsonParameters: McpServerOutputParsingJsonParameters + kind: Literal[McpServerOutputParsingKind.JSON] + + + class azure.search.documents.indexes.types.McpServerKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "kind": Required[Literal[KnowledgeSourceKind.MCP_SERVER]] + key "mcpServerParameters": Required[McpServerKnowledgeSourceParameters] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + ``@odata.etag``: str + description: str + encryptionKey: SearchResourceEncryptionKey + kind: Literal[KnowledgeSourceKind.MCP_SERVER] + mcpServerParameters: McpServerKnowledgeSourceParameters + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.McpServerKnowledgeSourceParameters(TypedDict, total=False): + key "authentication": ForwardRef('McpServerAuthentication', module='types') + key "serverURL": Required[str] + key "tools": Required[list[McpServerTool]] + authentication: McpServerAuthentication + serverURL: str + tools: list[McpServerTool] + + + class azure.search.documents.indexes.types.McpServerNoneOutputParsing(TypedDict, total=False): + key "kind": Required[Literal[McpServerOutputParsingKind.NONE]] + kind: Literal[McpServerOutputParsingKind.NONE] + + + class azure.search.documents.indexes.types.McpServerOutputParsingJsonParameters(TypedDict, total=False): + key "documentsPath": Required[str] + key "includeContext": bool + documentsPath: str + includeContext: bool + + + class azure.search.documents.indexes.types.McpServerOutputParsingKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AUTO = "auto" + JSON = "json" + NONE = "none" + SPLIT = "split" + + + class azure.search.documents.indexes.types.McpServerOutputParsingSplitParameters(TypedDict, total=False): + key "defaultLanguageCode": Union[str, SplitSkillLanguage] + key "maximumPageLength": int + key "maximumPagesToTake": int + key "pageOverlapLength": int + key "textSplitMode": Union[str, TextSplitMode] + defaultLanguageCode: Union[str, SplitSkillLanguage] + maximumPageLength: int + maximumPagesToTake: int + pageOverlapLength: int + textSplitMode: Union[str, TextSplitMode] + + + class azure.search.documents.indexes.types.McpServerSplitOutputParsing(TypedDict, total=False): + key "kind": Required[Literal[McpServerOutputParsingKind.SPLIT]] + key "splitParameters": ForwardRef('McpServerOutputParsingSplitParameters', module='types') + kind: Literal[McpServerOutputParsingKind.SPLIT] + splitParameters: McpServerOutputParsingSplitParameters + + + class azure.search.documents.indexes.types.McpServerStoredHeadersAuthentication(TypedDict, total=False): + key "kind": Required[Literal[McpServerAuthenticationKind.STORED_HEADERS]] + key "storedHeadersParameters": Required[McpServerStoredHeadersParameters] + kind: Literal[McpServerAuthenticationKind.STORED_HEADERS] + storedHeadersParameters: McpServerStoredHeadersParameters + + + class azure.search.documents.indexes.types.McpServerStoredHeadersParameters(TypedDict, total=False): + key "headers": ForwardRef('McpServerHeaders', module='types') + headers: McpServerHeaders + + + class azure.search.documents.indexes.types.McpServerTool(TypedDict, total=False): + key "maxOutputTokens": int + key "name": str + key "outputParsing": ForwardRef('McpServerOutputParsing', module='types') + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + maxOutputTokens: int + name: str + outputParsing: McpServerOutputParsing + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.MergeSkill(TypedDict): + key "@odata.type": Required[Literal["#MergeSkill"]] + key "context": str + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "insertPostTag": str + key "insertPreTag": str + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#MergeSkill] + context: str + description: str + inputs: list[InputFieldMappingEntry] + insertPostTag: str + insertPreTag: str + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.MicrosoftLanguageStemmingTokenizer(TypedDict): + key "@odata.type": Required[Literal["#MicrosoftLanguageStemmingTokenizer"]] + key "isSearchTokenizer": bool + key "language": Union[str, MicrosoftStemmingTokenizerLanguage] + key "maxTokenLength": int + key "name": Required[str] + ``@odata.type``: Literal[#MicrosoftLanguageStemmingTokenizer] + isSearchTokenizer: bool + language: Union[str, MicrosoftStemmingTokenizerLanguage] + maxTokenLength: int + name: str + + + class azure.search.documents.indexes.types.MicrosoftLanguageTokenizer(TypedDict): + key "@odata.type": Required[Literal["#MicrosoftLanguageTokenizer"]] + key "isSearchTokenizer": bool + key "language": Union[str, MicrosoftTokenizerLanguage] + key "maxTokenLength": int + key "name": Required[str] + ``@odata.type``: Literal[#MicrosoftLanguageTokenizer] + isSearchTokenizer: bool + language: Union[str, MicrosoftTokenizerLanguage] + maxTokenLength: int + name: str + + + class azure.search.documents.indexes.types.NGramTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#NGramTokenFilter"]] + key "maxGram": int + key "minGram": int + key "name": Required[str] + ``@odata.type``: Literal[#NGramTokenFilter] + maxGram: int + minGram: int + name: str + + + class azure.search.documents.indexes.types.NGramTokenFilterV2(TypedDict): + key "@odata.type": Required[Literal["#NGramTokenFilterV2"]] + key "maxGram": int + key "minGram": int + key "name": Required[str] + ``@odata.type``: Literal[#NGramTokenFilterV2] + maxGram: int + minGram: int + name: str + + + class azure.search.documents.indexes.types.NGramTokenizer(TypedDict): + key "@odata.type": Required[Literal["#NGramTokenizer"]] + key "maxGram": int + key "minGram": int + key "name": Required[str] + ``@odata.type``: Literal[#NGramTokenizer] + maxGram: int + minGram: int + name: str + tokenChars: list[Union[str, TokenCharacterKind]] + + + class azure.search.documents.indexes.types.NativeBlobSoftDeleteDeletionDetectionPolicy(TypedDict): + key "@odata.type": Required[Literal["#NativeBlobSoftDeleteDeletionDetectionPolicy"]] + ``@odata.type``: Literal[#NativeBlobSoftDeleteDeletionDetectionPolicy] + + + class azure.search.documents.indexes.types.OcrSkill(TypedDict): + key "@odata.type": Required[Literal["#OcrSkill"]] + key "context": str + key "defaultLanguageCode": Union[str, OcrSkillLanguage] + key "description": str + key "detectOrientation": bool + key "inputs": Required[list[InputFieldMappingEntry]] + key "lineEnding": Union[str, OcrLineEnding] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#OcrSkill] + context: str + defaultLanguageCode: Union[str, OcrSkillLanguage] + description: str + detectOrientation: bool + inputs: list[InputFieldMappingEntry] + lineEnding: Union[str, OcrLineEnding] + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.OutputFieldMappingEntry(TypedDict, total=False): + key "name": Required[str] + key "targetName": str + name: str + targetName: str + + + class azure.search.documents.indexes.types.PIIDetectionSkill(TypedDict): + key "@odata.type": Required[Literal["#PIIDetectionSkill"]] + key "context": str + key "defaultLanguageCode": Optional[str] + key "description": str + key "domain": Optional[str] + key "inputs": Required[list[InputFieldMappingEntry]] + key "maskingCharacter": str + key "maskingMode": Union[str, PIIDetectionSkillMaskingMode] + key "minimumPrecision": float + key "modelVersion": Optional[str] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#PIIDetectionSkill] + context: str + defaultLanguageCode: str + description: str + domain: str + inputs: list[InputFieldMappingEntry] + maskingCharacter: str + maskingMode: Union[str, PIIDetectionSkillMaskingMode] + minimumPrecision: float + modelVersion: str + name: str + outputs: list[OutputFieldMappingEntry] + piiCategories: list[str] + + + class azure.search.documents.indexes.types.PathHierarchyTokenizerV2(TypedDict): + key "@odata.type": Required[Literal["#PathHierarchyTokenizerV2"]] + key "delimiter": str + key "maxTokenLength": int + key "name": Required[str] + key "replacement": str + key "reverse": bool + key "skip": int + ``@odata.type``: Literal[#PathHierarchyTokenizerV2] + delimiter: str + maxTokenLength: int + name: str + replacement: str + reverse: bool + skip: int + + + class azure.search.documents.indexes.types.PatternAnalyzer(TypedDict): + key "@odata.type": Required[Literal["#PatternAnalyzer"]] + key "lowercase": bool + key "name": Required[str] + key "pattern": str + ``@odata.type``: Literal[#PatternAnalyzer] + flags: list[Union[str, RegexFlags]] + lowercase: bool + name: str + pattern: str + stopwords: list[str] + + + class azure.search.documents.indexes.types.PatternCaptureTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#PatternCaptureTokenFilter"]] + key "name": Required[str] + key "patterns": Required[list[str]] + key "preserveOriginal": bool + ``@odata.type``: Literal[#PatternCaptureTokenFilter] + name: str + patterns: list[str] + preserveOriginal: bool + + + class azure.search.documents.indexes.types.PatternReplaceCharFilter(TypedDict): + key "@odata.type": Required[Literal["#PatternReplaceCharFilter"]] + key "name": Required[str] + key "pattern": Required[str] + key "replacement": Required[str] + ``@odata.type``: Literal[#PatternReplaceCharFilter] + name: str + pattern: str + replacement: str + + + class azure.search.documents.indexes.types.PatternReplaceTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#PatternReplaceTokenFilter"]] + key "name": Required[str] + key "pattern": Required[str] + key "replacement": Required[str] + ``@odata.type``: Literal[#PatternReplaceTokenFilter] + name: str + pattern: str + replacement: str + + + class azure.search.documents.indexes.types.PatternTokenizer(TypedDict): + key "@odata.type": Required[Literal["#PatternTokenizer"]] + key "group": int + key "name": Required[str] + key "pattern": str + ``@odata.type``: Literal[#PatternTokenizer] + flags: list[Union[str, RegexFlags]] + group: int + name: str + pattern: str + + + class azure.search.documents.indexes.types.PhoneticTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#PhoneticTokenFilter"]] + key "encoder": Union[str, PhoneticEncoder] + key "name": Required[str] + key "replace": bool + ``@odata.type``: Literal[#PhoneticTokenFilter] + encoder: Union[str, PhoneticEncoder] + name: str + replace: bool + + + class azure.search.documents.indexes.types.RemoteSharePointKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "kind": Required[Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT]] + key "name": Required[str] + key "remoteSharePointParameters": ForwardRef('RemoteSharePointKnowledgeSourceParameters', module='types') + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + ``@odata.etag``: str + description: str + encryptionKey: SearchResourceEncryptionKey + kind: Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT] + name: str + remoteSharePointParameters: RemoteSharePointKnowledgeSourceParameters + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.indexes.types.RemoteSharePointKnowledgeSourceParameters(TypedDict, total=False): + key "containerTypeId": str + key "filterExpression": str + containerTypeId: str + filterExpression: str + resourceMetadata: list[str] + + + class azure.search.documents.indexes.types.RescoringOptions(TypedDict, total=False): + key "defaultOversampling": Optional[float] + key "enableRescoring": Optional[bool] + key "rescoreStorageMethod": Optional[Union[str, VectorSearchCompressionRescoreStorageMethod]] + defaultOversampling: float + enableRescoring: bool + rescoreStorageMethod: Union[str, VectorSearchCompressionRescoreStorageMethod] + + + class azure.search.documents.indexes.types.ScalarQuantizationCompression(TypedDict, total=False): + key "kind": Required[Literal[VectorSearchCompressionKind.SCALAR_QUANTIZATION]] + key "name": Required[str] + key "rescoringOptions": Optional[RescoringOptions] + key "scalarQuantizationParameters": ForwardRef('ScalarQuantizationParameters', module='types') + key "truncationDimension": Optional[int] + kind: Literal[VectorSearchCompressionKind.SCALAR_QUANTIZATION] + name: str + rescoringOptions: RescoringOptions + scalarQuantizationParameters: ScalarQuantizationParameters + truncationDimension: int + + + class azure.search.documents.indexes.types.ScalarQuantizationParameters(TypedDict, total=False): + key "quantizedDataType": Optional[Union[str, VectorSearchCompressionTarget]] + quantizedDataType: Union[str, VectorSearchCompressionTarget] + + + class azure.search.documents.indexes.types.ScoringProfile(TypedDict, total=False): + key "functionAggregation": Union[str, ScoringFunctionAggregation] + key "name": Required[str] + key "text": Optional[TextWeights] + functionAggregation: Union[str, ScoringFunctionAggregation] + functions: list[ScoringFunction] + name: str + text: TextWeights + + + class azure.search.documents.indexes.types.SearchAlias(TypedDict): + key "@odata.etag": str + key "indexes": Required[list[str]] + key "name": Required[str] + ``@odata.etag``: str + indexes: list[str] + name: str + + + class azure.search.documents.indexes.types.SearchField(TypedDict, total=False): + key "analyzer": Optional[Union[str, LexicalAnalyzerName]] + key "dimensions": int + key "facetable": bool + key "filterable": bool + key "indexAnalyzer": Optional[Union[str, LexicalAnalyzerName]] + key "key": bool + key "name": Required[str] + key "normalizer": Optional[Union[str, LexicalNormalizerName]] + key "permissionFilter": Optional[Union[str, PermissionFilter]] + key "retrievable": bool + key "searchAnalyzer": Optional[Union[str, LexicalAnalyzerName]] + key "searchable": bool + key "sensitivityLabelId": bool + key "sensitivityLabelName": bool + key "sharepointSiteUrl": bool + key "sortable": bool + key "sourceDocumentId": bool + key "stored": bool + key "type": Required[Union[str, SearchFieldDataType]] + key "vectorEncoding": Optional[Union[str, VectorEncodingFormat]] + key "vectorSearchProfile": Optional[str] + analyzer: Union[str, LexicalAnalyzerName] + dimensions: int + facetable: bool + fields: list[SearchField] + filterable: bool + indexAnalyzer: Union[str, LexicalAnalyzerName] + key: bool + name: str + normalizer: Union[str, LexicalNormalizerName] + permissionFilter: Union[str, PermissionFilter] + retrievable: bool + searchAnalyzer: Union[str, LexicalAnalyzerName] + searchable: bool + sensitivityLabelId: bool + sensitivityLabelName: bool + sharepointSiteUrl: bool + sortable: bool + sourceDocumentId: bool + stored: bool + synonymMaps: list[str] + type: Union[str, SearchFieldDataType] + vectorEncoding: Union[str, VectorEncodingFormat] + vectorSearchProfile: str + + + class azure.search.documents.indexes.types.SearchIndex(TypedDict): + key "@odata.etag": str + key "corsOptions": Optional[CorsOptions] + key "defaultScoringProfile": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "fields": Required[list[SearchField]] + key "name": Required[str] + key "permissionFilterOption": Optional[Union[str, SearchIndexPermissionFilterOption]] + key "purviewEnabled": Optional[bool] + key "semantic": Optional[SemanticSearch] + key "sharePointConnectorAppRegistration": ForwardRef('SharePointConnectorAppRegistration', module='types') + key "similarity": ForwardRef('SimilarityAlgorithm', module='types') + key "vectorSearch": Optional[VectorSearch] + ``@odata.etag``: str + analyzers: list[LexicalAnalyzer] + charFilters: list[CharFilter] + corsOptions: CorsOptions + defaultScoringProfile: str + description: str + encryptionKey: SearchResourceEncryptionKey + fields: list[SearchField] + name: str + normalizers: list[LexicalNormalizer] + permissionFilterOption: Union[str, SearchIndexPermissionFilterOption] + purviewEnabled: bool + scoringProfiles: list[ScoringProfile] + semantic: SemanticSearch + sharePointConnectorAppRegistration: SharePointConnectorAppRegistration + similarity: SimilarityAlgorithm + suggesters: list[SearchSuggester] + tokenFilters: list[TokenFilter] + tokenizers: list[LexicalTokenizer] + vectorSearch: VectorSearch + + + class azure.search.documents.indexes.types.SearchIndexFieldReference(TypedDict, total=False): + key "name": Required[str] + name: str + + + class azure.search.documents.indexes.types.SearchIndexKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "kind": Required[Literal[KnowledgeSourceKind.SEARCH_INDEX]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + key "searchIndexParameters": Required[SearchIndexKnowledgeSourceParameters] + ``@odata.etag``: str + description: str + encryptionKey: SearchResourceEncryptionKey + kind: Literal[KnowledgeSourceKind.SEARCH_INDEX] + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + searchIndexParameters: SearchIndexKnowledgeSourceParameters + + + class azure.search.documents.indexes.types.SearchIndexKnowledgeSourceBoostKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FIELD_VALUE = "fieldValue" + MULTI_WORD_EXPRESSION = "multiWordExpression" + + + class azure.search.documents.indexes.types.SearchIndexKnowledgeSourceFieldValueBoost(TypedDict, total=False): + key "boost": Required[float] + key "boostInstructions": str + key "field": Required[str] + key "kind": Required[Literal[SearchIndexKnowledgeSourceBoostKind.FIELD_VALUE]] + boost: float + boostInstructions: str + field: str + fieldValues: list[str] + kind: Literal[SearchIndexKnowledgeSourceBoostKind.FIELD_VALUE] + + + class azure.search.documents.indexes.types.SearchIndexKnowledgeSourceFilterHint(TypedDict, total=False): + key "field": Required[str] + key "fieldValues": Required[list[str]] + key "filterInstructions": str + field: str + fieldValues: list[str] + filterInstructions: str + + + class azure.search.documents.indexes.types.SearchIndexKnowledgeSourceMultiWordExpressionBoost(TypedDict, total=False): + key "boost": Required[float] + key "boostInstructions": str + key "kind": Required[Literal[SearchIndexKnowledgeSourceBoostKind.MULTI_WORD_EXPRESSION]] + boost: float + boostInstructions: str + fieldValues: list[str] + kind: Literal[SearchIndexKnowledgeSourceBoostKind.MULTI_WORD_EXPRESSION] + + + class azure.search.documents.indexes.types.SearchIndexKnowledgeSourceParameters(TypedDict, total=False): + key "baseFilter": str + key "queryHints": ForwardRef('SearchIndexKnowledgeSourceQueryHints', module='types') + key "searchIndexName": Required[str] + key "semanticConfigurationName": str + baseFilter: str + queryHints: SearchIndexKnowledgeSourceQueryHints + searchFields: list[SearchIndexFieldReference] + searchIndexName: str + semanticConfigurationName: str + sourceDataFields: list[SearchIndexFieldReference] + + + class azure.search.documents.indexes.types.SearchIndexKnowledgeSourceQueryHints(TypedDict, total=False): + boosts: list[SearchIndexKnowledgeSourceBoost] + filters: list[SearchIndexKnowledgeSourceFilterHint] + + + class azure.search.documents.indexes.types.SearchIndexer(TypedDict): + key "@odata.etag": str + key "cache": Optional[SearchIndexerCache] + key "dataSourceName": Required[str] + key "description": str + key "disabled": Optional[bool] + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "name": Required[str] + key "parameters": Optional[IndexingParameters] + key "schedule": Optional[IndexingSchedule] + key "skillsetName": str + key "targetIndexName": Required[str] + ``@odata.etag``: str + cache: SearchIndexerCache + dataSourceName: str + description: str + disabled: bool + encryptionKey: SearchResourceEncryptionKey + fieldMappings: list[FieldMapping] + name: str + outputFieldMappings: list[FieldMapping] + parameters: IndexingParameters + schedule: IndexingSchedule + skillsetName: str + targetIndexName: str + + + class azure.search.documents.indexes.types.SearchIndexerCache(TypedDict, total=False): + key "enableReprocessing": Optional[bool] + key "id": str + key "identity": Optional[SearchIndexerDataIdentity] + key "storageConnectionString": str + enableReprocessing: bool + id: str + identity: SearchIndexerDataIdentity + storageConnectionString: str + + + class azure.search.documents.indexes.types.SearchIndexerDataContainer(TypedDict, total=False): + key "name": Required[str] + key "query": str + name: str + query: str + + + class azure.search.documents.indexes.types.SearchIndexerDataNoneIdentity(TypedDict): + key "@odata.type": Required[Literal["#DataNoneIdentity"]] + ``@odata.type``: Literal[#DataNoneIdentity] + + + class azure.search.documents.indexes.types.SearchIndexerDataSourceConnection(TypedDict): + key "@odata.etag": str + key "container": Required[SearchIndexerDataContainer] + key "credentials": Required[DataSourceCredentials] + key "dataChangeDetectionPolicy": Optional[DataChangeDetectionPolicy] + key "dataDeletionDetectionPolicy": Optional[DataDeletionDetectionPolicy] + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "identity": Optional[SearchIndexerDataIdentity] + key "indexerPermissionOptions": Optional[list[Union[str, IndexerPermissionOption]]] + key "name": Required[str] + key "subType": str + key "type": Required[Union[str, SearchIndexerDataSourceType]] + ``@odata.etag``: str + container: SearchIndexerDataContainer + credentials: DataSourceCredentials + dataChangeDetectionPolicy: DataChangeDetectionPolicy + dataDeletionDetectionPolicy: DataDeletionDetectionPolicy + description: str + encryptionKey: SearchResourceEncryptionKey + identity: SearchIndexerDataIdentity + indexerPermissionOptions: list[Union[str, IndexerPermissionOption]] + name: str + subType: str + type: Union[str, SearchIndexerDataSourceType] + + + class azure.search.documents.indexes.types.SearchIndexerDataUserAssignedIdentity(TypedDict): + key "@odata.type": Required[Literal["#DataUserAssignedIdentity"]] + key "federatedIdentityClientId": str + key "userAssignedIdentity": Required[str] + ``@odata.type``: Literal[#DataUserAssignedIdentity] + federatedIdentityClientId: str + userAssignedIdentity: str + + + class azure.search.documents.indexes.types.SearchIndexerIndexProjection(TypedDict, total=False): + key "parameters": ForwardRef('SearchIndexerIndexProjectionsParameters', module='types') + key "selectors": Required[list[SearchIndexerIndexProjectionSelector]] + parameters: SearchIndexerIndexProjectionsParameters + selectors: list[SearchIndexerIndexProjectionSelector] + + + class azure.search.documents.indexes.types.SearchIndexerIndexProjectionSelector(TypedDict, total=False): + key "mappings": Required[list[InputFieldMappingEntry]] + key "parentKeyFieldName": Required[str] + key "sourceContext": Required[str] + key "targetIndexName": Required[str] + mappings: list[InputFieldMappingEntry] + parentKeyFieldName: str + sourceContext: str + targetIndexName: str + + + class azure.search.documents.indexes.types.SearchIndexerIndexProjectionsParameters(TypedDict, total=False): + key "projectionMode": Union[str, IndexProjectionMode] + projectionMode: Union[str, IndexProjectionMode] + + + class azure.search.documents.indexes.types.SearchIndexerKnowledgeStore(TypedDict, total=False): + key "identity": Optional[SearchIndexerDataIdentity] + key "parameters": ForwardRef('SearchIndexerKnowledgeStoreParameters', module='types') + key "projections": Required[list[SearchIndexerKnowledgeStoreProjection]] + key "storageConnectionString": Required[str] + identity: SearchIndexerDataIdentity + parameters: SearchIndexerKnowledgeStoreParameters + projections: list[SearchIndexerKnowledgeStoreProjection] + storageConnectionString: str + + + class azure.search.documents.indexes.types.SearchIndexerKnowledgeStoreBlobProjectionSelector(SearchIndexerKnowledgeStoreProjectionSelector): + key "generatedKeyName": str + key "referenceKeyName": str + key "source": str + key "sourceContext": str + key "storageContainer": Required[str] + generatedKeyName: str + inputs: list[InputFieldMappingEntry] + referenceKeyName: str + source: str + sourceContext: str + storageContainer: str + + + class azure.search.documents.indexes.types.SearchIndexerKnowledgeStoreFileProjectionSelector(SearchIndexerKnowledgeStoreBlobProjectionSelector): + key "generatedKeyName": str + key "referenceKeyName": str + key "source": str + key "sourceContext": str + key "storageContainer": Required[str] + generatedKeyName: str + inputs: list[InputFieldMappingEntry] + referenceKeyName: str + source: str + sourceContext: str + storageContainer: str + + + class azure.search.documents.indexes.types.SearchIndexerKnowledgeStoreObjectProjectionSelector(SearchIndexerKnowledgeStoreBlobProjectionSelector): + key "generatedKeyName": str + key "referenceKeyName": str + key "source": str + key "sourceContext": str + key "storageContainer": Required[str] + generatedKeyName: str + inputs: list[InputFieldMappingEntry] + referenceKeyName: str + source: str + sourceContext: str + storageContainer: str + + + class azure.search.documents.indexes.types.SearchIndexerKnowledgeStoreParameters(TypedDict, total=False): + key "synthesizeGeneratedKeyName": bool + synthesizeGeneratedKeyName: bool + + + class azure.search.documents.indexes.types.SearchIndexerKnowledgeStoreProjection(TypedDict, total=False): + files: list[SearchIndexerKnowledgeStoreFileProjectionSelector] + objects: list[SearchIndexerKnowledgeStoreObjectProjectionSelector] + tables: list[SearchIndexerKnowledgeStoreTableProjectionSelector] + + + class azure.search.documents.indexes.types.SearchIndexerKnowledgeStoreProjectionSelector(TypedDict, total=False): + key "generatedKeyName": str + key "referenceKeyName": str + key "source": str + key "sourceContext": str + generatedKeyName: str + inputs: list[InputFieldMappingEntry] + referenceKeyName: str + source: str + sourceContext: str + + + class azure.search.documents.indexes.types.SearchIndexerKnowledgeStoreTableProjectionSelector(TypedDict, total=False): + key "generatedKeyName": Required[str] + key "referenceKeyName": str + key "source": str + key "sourceContext": str + key "tableName": Required[str] + generatedKeyName: str + inputs: list[InputFieldMappingEntry] + referenceKeyName: str + source: str + sourceContext: str + tableName: str + + + class azure.search.documents.indexes.types.SearchIndexerSkillset(TypedDict): + key "@odata.etag": str + key "cognitiveServices": ForwardRef('CognitiveServicesAccount', module='types') + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "indexProjections": ForwardRef('SearchIndexerIndexProjection', module='types') + key "knowledgeStore": ForwardRef('SearchIndexerKnowledgeStore', module='types') + key "name": Required[str] + key "skills": Required[list[SearchIndexerSkill]] + ``@odata.etag``: str + cognitiveServices: CognitiveServicesAccount + description: str + encryptionKey: SearchResourceEncryptionKey + indexProjections: SearchIndexerIndexProjection + knowledgeStore: SearchIndexerKnowledgeStore + name: str + skills: list[SearchIndexerSkill] + + + class azure.search.documents.indexes.types.SearchResourceEncryptionKey(TypedDict, total=False): + key "accessCredentials": ForwardRef('AzureActiveDirectoryApplicationCredentials', module='types') + key "identity": Optional[SearchIndexerDataIdentity] + key "isServiceLevelKey": bool + key "keyVaultKeyName": Required[str] + key "keyVaultKeyVersion": str + key "keyVaultUri": Required[str] + accessCredentials: AzureActiveDirectoryApplicationCredentials + identity: SearchIndexerDataIdentity + isServiceLevelKey: bool + keyVaultKeyName: str + keyVaultKeyVersion: str + keyVaultUri: str + + + class azure.search.documents.indexes.types.SearchSuggester(TypedDict, total=False): + key "name": Required[str] + key "searchMode": Required[Literal["analyzingInfixMatching"]] + key "sourceFields": Required[list[str]] + name: str + searchMode: Literal[analyzingInfixMatching] + sourceFields: list[str] + + + class azure.search.documents.indexes.types.SemanticConfiguration(TypedDict, total=False): + key "flightingOptIn": bool + key "name": Required[str] + key "prioritizedFields": Required[SemanticPrioritizedFields] + key "rankingOrder": Optional[Union[str, RankingOrder]] + flightingOptIn: bool + name: str + prioritizedFields: SemanticPrioritizedFields + rankingOrder: Union[str, RankingOrder] + + + class azure.search.documents.indexes.types.SemanticField(TypedDict, total=False): + key "fieldName": Required[str] + fieldName: str + + + class azure.search.documents.indexes.types.SemanticPrioritizedFields(TypedDict, total=False): + key "titleField": ForwardRef('SemanticField', module='types') + prioritizedContentFields: list[SemanticField] + prioritizedKeywordsFields: list[SemanticField] + titleField: SemanticField + + + class azure.search.documents.indexes.types.SemanticSearch(TypedDict, total=False): + key "defaultConfiguration": str + configurations: list[SemanticConfiguration] + defaultConfiguration: str + + + class azure.search.documents.indexes.types.SentimentSkillV3(TypedDict): + key "@odata.type": Required[Literal["#SentimentSkill"]] + key "context": str + key "defaultLanguageCode": Optional[Union[str, SentimentSkillLanguage]] + key "description": str + key "includeOpinionMining": bool + key "inputs": Required[list[InputFieldMappingEntry]] + key "modelVersion": Optional[str] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#SentimentSkill] + context: str + defaultLanguageCode: Union[str, SentimentSkillLanguage] + description: str + includeOpinionMining: bool + inputs: list[InputFieldMappingEntry] + modelVersion: str + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.ShaperSkill(TypedDict): + key "@odata.type": Required[Literal["#ShaperSkill"]] + key "context": str + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#ShaperSkill] + context: str + description: str + inputs: list[InputFieldMappingEntry] + name: str + outputs: list[OutputFieldMappingEntry] + + + class azure.search.documents.indexes.types.SharePointConnectorAppRegistration(TypedDict, total=False): + key "applicationId": Required[str] + key "federatedCredentialId": Required[str] + key "tenantId": str + applicationId: str + federatedCredentialId: str + tenantId: str + + + class azure.search.documents.indexes.types.ShingleTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#ShingleTokenFilter"]] + key "filterToken": str + key "maxShingleSize": int + key "minShingleSize": int + key "name": Required[str] + key "outputUnigrams": bool + key "outputUnigramsIfNoShingles": bool + key "tokenSeparator": str + ``@odata.type``: Literal[#ShingleTokenFilter] + filterToken: str + maxShingleSize: int + minShingleSize: int + name: str + outputUnigrams: bool + outputUnigramsIfNoShingles: bool + tokenSeparator: str + + + class azure.search.documents.indexes.types.SkillNames(TypedDict, total=False): + skillNames: list[str] + + + class azure.search.documents.indexes.types.SnowballTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#SnowballTokenFilter"]] + key "language": Required[Union[str, SnowballTokenFilterLanguage]] + key "name": Required[str] + ``@odata.type``: Literal[#SnowballTokenFilter] + language: Union[str, SnowballTokenFilterLanguage] + name: str + + + class azure.search.documents.indexes.types.SoftDeleteColumnDeletionDetectionPolicy(TypedDict): + key "@odata.type": Required[Literal["#SoftDeleteColumnDeletionDetectionPolicy"]] + key "softDeleteColumnName": str + key "softDeleteMarkerValue": str + ``@odata.type``: Literal[#SoftDeleteColumnDeletionDetectionPolicy] + softDeleteColumnName: str + softDeleteMarkerValue: str + + + class azure.search.documents.indexes.types.SplitSkill(TypedDict): + key "@odata.type": Required[Literal["#SplitSkill"]] + key "azureOpenAITokenizerParameters": Optional[AzureOpenAITokenizerParameters] + key "context": str + key "defaultLanguageCode": Union[str, SplitSkillLanguage] + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "maximumPageLength": Optional[int] + key "maximumPagesToTake": Optional[int] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + key "pageOverlapLength": Optional[int] + key "textSplitMode": Union[str, TextSplitMode] + key "unit": Optional[Union[str, SplitSkillUnit]] + ``@odata.type``: Literal[#SplitSkill] + azureOpenAITokenizerParameters: AzureOpenAITokenizerParameters + context: str + defaultLanguageCode: Union[str, SplitSkillLanguage] + description: str + inputs: list[InputFieldMappingEntry] + maximumPageLength: int + maximumPagesToTake: int + name: str + outputs: list[OutputFieldMappingEntry] + pageOverlapLength: int + textSplitMode: Union[str, TextSplitMode] + unit: Union[str, SplitSkillUnit] + + + class azure.search.documents.indexes.types.SqlIntegratedChangeTrackingPolicy(TypedDict): + key "@odata.type": Required[Literal["#SqlIntegratedChangeTrackingPolicy"]] + ``@odata.type``: Literal[#SqlIntegratedChangeTrackingPolicy] + + + class azure.search.documents.indexes.types.StemmerOverrideTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#StemmerOverrideTokenFilter"]] + key "name": Required[str] + key "rules": Required[list[str]] + ``@odata.type``: Literal[#StemmerOverrideTokenFilter] + name: str + rules: list[str] + + + class azure.search.documents.indexes.types.StemmerTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#StemmerTokenFilter"]] + key "language": Required[Union[str, StemmerTokenFilterLanguage]] + key "name": Required[str] + ``@odata.type``: Literal[#StemmerTokenFilter] + language: Union[str, StemmerTokenFilterLanguage] + name: str + + + class azure.search.documents.indexes.types.StopAnalyzer(TypedDict): + key "@odata.type": Required[Literal["#StopAnalyzer"]] + key "name": Required[str] + ``@odata.type``: Literal[#StopAnalyzer] + name: str + stopwords: list[str] + + + class azure.search.documents.indexes.types.StopwordsTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#StopwordsTokenFilter"]] + key "ignoreCase": bool + key "name": Required[str] + key "removeTrailing": bool + key "stopwordsList": Union[str, StopwordsList] + ``@odata.type``: Literal[#StopwordsTokenFilter] + ignoreCase: bool + name: str + removeTrailing: bool + stopwords: list[str] + stopwordsList: Union[str, StopwordsList] + + + class azure.search.documents.indexes.types.SynonymMap(TypedDict): + key "@odata.etag": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "format": Required[Literal["solr"]] + key "name": Required[str] + key "synonyms": Required[list[str]] + ``@odata.etag``: str + encryptionKey: SearchResourceEncryptionKey + format: Literal[solr] + name: str + synonyms: list[str] + + + class azure.search.documents.indexes.types.SynonymTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#SynonymTokenFilter"]] + key "expand": bool + key "ignoreCase": bool + key "name": Required[str] + key "synonyms": Required[list[str]] + ``@odata.type``: Literal[#SynonymTokenFilter] + expand: bool + ignoreCase: bool + name: str + synonyms: list[str] + + + class azure.search.documents.indexes.types.TagScoringFunction(TypedDict, total=False): + key "boost": Required[float] + key "fieldName": Required[str] + key "interpolation": Union[str, ScoringFunctionInterpolation] + key "tag": Required[TagScoringParameters] + key "type": Required[Literal["tag"]] + boost: float + fieldName: str + interpolation: Union[str, ScoringFunctionInterpolation] + tag: TagScoringParameters + type: Literal[tag] + + + class azure.search.documents.indexes.types.TagScoringParameters(TypedDict, total=False): + key "tagsParameter": Required[str] + tagsParameter: str + + + class azure.search.documents.indexes.types.TextTranslationSkill(TypedDict): + key "@odata.type": Required[Literal["#TranslationSkill"]] + key "context": str + key "defaultFromLanguageCode": Union[str, TextTranslationSkillLanguage] + key "defaultToLanguageCode": Required[Union[str, TextTranslationSkillLanguage]] + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + key "suggestedFrom": Optional[Union[str, TextTranslationSkillLanguage]] + ``@odata.type``: Literal[#TranslationSkill] + context: str + defaultFromLanguageCode: Union[str, TextTranslationSkillLanguage] + defaultToLanguageCode: Union[str, TextTranslationSkillLanguage] description: str - http_headers: Optional[WebApiHttpHeaders] - http_method: Optional[str] inputs: list[InputFieldMappingEntry] name: str - odata_type: Literal["#WebApiSkill"] outputs: list[OutputFieldMappingEntry] - timeout: Optional[timedelta] - uri: str + suggestedFrom: Union[str, TextTranslationSkillLanguage] - @overload - def __init__( - self, - *, - auth_identity: Optional[SearchIndexerDataIdentity] = ..., - auth_resource_id: Optional[str] = ..., - batch_size: Optional[int] = ..., - context: Optional[str] = ..., - degree_of_parallelism: Optional[int] = ..., - description: Optional[str] = ..., - http_headers: Optional[WebApiHttpHeaders] = ..., - http_method: Optional[str] = ..., - inputs: list[InputFieldMappingEntry], - name: Optional[str] = ..., - outputs: list[OutputFieldMappingEntry], - timeout: Optional[timedelta] = ..., - uri: str - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.types.TextWeights(TypedDict, total=False): + key "weights": Required[dict[str, float]] + weights: dict[str, float] - class azure.search.documents.indexes.models.WebApiVectorizer(VectorSearchVectorizer, discriminator='customWebApi'): - kind: Literal[VectorSearchVectorizerKind.CUSTOM_WEB_API] - vectorizer_name: str - web_api_parameters: Optional[WebApiVectorizerParameters] + class azure.search.documents.indexes.types.TruncateTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#TruncateTokenFilter"]] + key "length": int + key "name": Required[str] + ``@odata.type``: Literal[#TruncateTokenFilter] + length: int + name: str - @overload - def __init__( - self, - *, - vectorizer_name: str, - web_api_parameters: Optional[WebApiVectorizerParameters] = ... - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.types.UaxUrlEmailTokenizer(TypedDict): + key "@odata.type": Required[Literal["#UaxUrlEmailTokenizer"]] + key "maxTokenLength": int + key "name": Required[str] + ``@odata.type``: Literal[#UaxUrlEmailTokenizer] + maxTokenLength: int + name: str - class azure.search.documents.indexes.models.WebApiVectorizerParameters(_Model): - auth_identity: Optional[SearchIndexerDataIdentity] - auth_resource_id: Optional[str] - http_headers: Optional[dict[str, str]] - http_method: Optional[str] - timeout: Optional[timedelta] - url: Optional[str] + class azure.search.documents.indexes.types.UniqueTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#UniqueTokenFilter"]] + key "name": Required[str] + key "onlyOnSamePosition": bool + ``@odata.type``: Literal[#UniqueTokenFilter] + name: str + onlyOnSamePosition: bool - @overload - def __init__( - self, - *, - auth_identity: Optional[SearchIndexerDataIdentity] = ..., - auth_resource_id: Optional[str] = ..., - http_headers: Optional[dict[str, str]] = ..., - http_method: Optional[str] = ..., - timeout: Optional[timedelta] = ..., - url: Optional[str] = ... - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.types.UpdateKnowledgeSourceFileRequest(TypedDict, total=False): + key "content": Required[Union[str, bytes, IO[str], IO[bytes], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]]], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]], Optional[str]]]] + key "metadata": Required[FileUploadMetadata] + content: FileType + metadata: FileUploadMetadata - class azure.search.documents.indexes.models.WebKnowledgeSource(KnowledgeSource, discriminator='web'): - description: str - e_tag: str - encryption_key: SearchResourceEncryptionKey - kind: Literal[KnowledgeSourceKind.WEB] - name: str - web_parameters: Optional[WebKnowledgeSourceParameters] + class azure.search.documents.indexes.types.UploadKnowledgeSourceFileMultipartRequest(TypedDict, total=False): + key "content": Required[Union[str, bytes, IO[str], IO[bytes], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]]], tuple[Optional[str], Union[str, bytes, IO[str], IO[bytes]], Optional[str]]]] + key "metadata": Required[FileUploadMetadata] + content: FileType + metadata: FileUploadMetadata - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - e_tag: Optional[str] = ..., - encryption_key: Optional[SearchResourceEncryptionKey] = ..., - name: str, - web_parameters: Optional[WebKnowledgeSourceParameters] = ... - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.types.VectorSearch(TypedDict, total=False): + algorithms: list[VectorSearchAlgorithmConfiguration] + compressions: list[VectorSearchCompression] + profiles: list[VectorSearchProfile] + vectorizers: list[VectorSearchVectorizer] - class azure.search.documents.indexes.models.WebKnowledgeSourceDomain(_Model): - address: str - include_subpages: Optional[bool] + class azure.search.documents.indexes.types.VectorSearchAlgorithmKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + EXHAUSTIVE_KNN = "exhaustiveKnn" + HNSW = "hnsw" - @overload - def __init__( - self, - *, - address: str, - include_subpages: Optional[bool] = ... - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.types.VectorSearchCompressionKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + BINARY_QUANTIZATION = "binaryQuantization" + SCALAR_QUANTIZATION = "scalarQuantization" - class azure.search.documents.indexes.models.WebKnowledgeSourceDomains(_Model): - allowed_domains: Optional[list[WebKnowledgeSourceDomain]] - blocked_domains: Optional[list[WebKnowledgeSourceDomain]] + class azure.search.documents.indexes.types.VectorSearchProfile(TypedDict, total=False): + key "algorithm": Required[str] + key "compression": str + key "name": Required[str] + key "vectorizer": str + algorithm: str + compression: str + name: str + vectorizer: str - @overload - def __init__( - self, - *, - allowed_domains: Optional[list[WebKnowledgeSourceDomain]] = ..., - blocked_domains: Optional[list[WebKnowledgeSourceDomain]] = ... - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.types.VectorSearchVectorizerKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AI_SERVICES_VISION = "aiServicesVision" + AML = "aml" + AZURE_OPEN_AI = "azureOpenAI" + CUSTOM_WEB_API = "customWebApi" - class azure.search.documents.indexes.models.WebKnowledgeSourceParameters(_Model): - count: Optional[int] - domains: Optional[WebKnowledgeSourceDomains] - freshness: Optional[str] - language: Optional[str] - market: Optional[str] + class azure.search.documents.indexes.types.VisionVectorizeSkill(TypedDict): + key "@odata.type": Required[Literal["#VectorizeSkill"]] + key "context": str + key "description": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "modelVersion": Required[Optional[str]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + ``@odata.type``: Literal[#VectorizeSkill] + context: str + description: str + inputs: list[InputFieldMappingEntry] + modelVersion: str + name: str + outputs: list[OutputFieldMappingEntry] - @overload - def __init__( - self, - *, - count: Optional[int] = ..., - domains: Optional[WebKnowledgeSourceDomains] = ..., - freshness: Optional[str] = ..., - language: Optional[str] = ..., - market: Optional[str] = ... - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.types.WebApiHttpHeaders(TypedDict, total=False): + + + class azure.search.documents.indexes.types.WebApiSkill(TypedDict): + key "@odata.type": Required[Literal["#WebApiSkill"]] + key "authIdentity": Optional[SearchIndexerDataIdentity] + key "authResourceId": Optional[str] + key "batchSize": Optional[int] + key "context": str + key "degreeOfParallelism": Optional[int] + key "description": str + key "httpHeaders": ForwardRef('WebApiHttpHeaders', module='types') + key "httpMethod": str + key "inputs": Required[list[InputFieldMappingEntry]] + key "name": str + key "outputs": Required[list[OutputFieldMappingEntry]] + key "timeout": str + key "uri": Required[str] + ``@odata.type``: Literal[#WebApiSkill] + authIdentity: SearchIndexerDataIdentity + authResourceId: str + batchSize: int + context: str + degreeOfParallelism: int + description: str + httpHeaders: WebApiHttpHeaders + httpMethod: str + inputs: list[InputFieldMappingEntry] + name: str + outputs: list[OutputFieldMappingEntry] + timeout: str + uri: str - class azure.search.documents.indexes.models.WordDelimiterTokenFilter(TokenFilter, discriminator='#Microsoft.Azure.Search.WordDelimiterTokenFilter'): - catenate_all: Optional[bool] - catenate_numbers: Optional[bool] - catenate_words: Optional[bool] - generate_number_parts: Optional[bool] - generate_word_parts: Optional[bool] + class azure.search.documents.indexes.types.WebApiVectorizer(TypedDict, total=False): + key "customWebApiParameters": ForwardRef('WebApiVectorizerParameters', module='types') + key "kind": Required[Literal[VectorSearchVectorizerKind.CUSTOM_WEB_API]] + key "name": Required[str] + customWebApiParameters: WebApiVectorizerParameters + kind: Literal[VectorSearchVectorizerKind.CUSTOM_WEB_API] name: str - odata_type: Literal["#WordDelimiterTokenFilter"] - preserve_original: Optional[bool] - protected_words: Optional[list[str]] - split_on_case_change: Optional[bool] - split_on_numerics: Optional[bool] - stem_english_possessive: Optional[bool] - @overload - def __init__( - self, - *, - catenate_all: Optional[bool] = ..., - catenate_numbers: Optional[bool] = ..., - catenate_words: Optional[bool] = ..., - generate_number_parts: Optional[bool] = ..., - generate_word_parts: Optional[bool] = ..., - name: str, - preserve_original: Optional[bool] = ..., - protected_words: Optional[list[str]] = ..., - split_on_case_change: Optional[bool] = ..., - split_on_numerics: Optional[bool] = ..., - stem_english_possessive: Optional[bool] = ... - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.types.WebApiVectorizerParameters(TypedDict, total=False): + key "authIdentity": Optional[SearchIndexerDataIdentity] + key "authResourceId": Optional[str] + key "httpMethod": str + key "timeout": str + key "uri": str + authIdentity: SearchIndexerDataIdentity + authResourceId: str + httpHeaders: dict[str, str] + httpMethod: str + timeout: str + uri: str - class azure.search.documents.indexes.models.WorkIQKnowledgeSource(KnowledgeSource, discriminator='workIQ'): + class azure.search.documents.indexes.types.WebKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "kind": Required[Literal[KnowledgeSourceKind.WEB]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + key "webParameters": ForwardRef('WebKnowledgeSourceParameters', module='types') + ``@odata.etag``: str description: str - e_tag: str - encryption_key: SearchResourceEncryptionKey + encryptionKey: SearchResourceEncryptionKey + kind: Literal[KnowledgeSourceKind.WEB] + name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + webParameters: WebKnowledgeSourceParameters + + + class azure.search.documents.indexes.types.WebKnowledgeSourceDomain(TypedDict, total=False): + key "address": Required[str] + key "includeSubpages": bool + address: str + includeSubpages: bool + + + class azure.search.documents.indexes.types.WebKnowledgeSourceDomains(TypedDict, total=False): + allowedDomains: list[WebKnowledgeSourceDomain] + blockedDomains: list[WebKnowledgeSourceDomain] + + + class azure.search.documents.indexes.types.WebKnowledgeSourceParameters(TypedDict, total=False): + key "count": int + key "domains": ForwardRef('WebKnowledgeSourceDomains', module='types') + key "freshness": str + key "language": str + key "market": str + count: int + domains: WebKnowledgeSourceDomains + freshness: str + language: str + market: str + + + class azure.search.documents.indexes.types.WordDelimiterTokenFilter(TypedDict): + key "@odata.type": Required[Literal["#WordDelimiterTokenFilter"]] + key "catenateAll": bool + key "catenateNumbers": bool + key "catenateWords": bool + key "generateNumberParts": bool + key "generateWordParts": bool + key "name": Required[str] + key "preserveOriginal": bool + key "splitOnCaseChange": bool + key "splitOnNumerics": bool + key "stemEnglishPossessive": bool + ``@odata.type``: Literal[#WordDelimiterTokenFilter] + catenateAll: bool + catenateNumbers: bool + catenateWords: bool + generateNumberParts: bool + generateWordParts: bool + name: str + preserveOriginal: bool + protectedWords: list[str] + splitOnCaseChange: bool + splitOnNumerics: bool + stemEnglishPossessive: bool + + + class azure.search.documents.indexes.types.WorkIQKnowledgeSource(TypedDict): + key "@odata.etag": str + key "description": str + key "encryptionKey": Optional[SearchResourceEncryptionKey] + key "kind": Required[Literal[KnowledgeSourceKind.WORK_IQ]] + key "name": Required[str] + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + key "workIQParameters": Required[WorkIQKnowledgeSourceParameters] + ``@odata.etag``: str + description: str + encryptionKey: SearchResourceEncryptionKey kind: Literal[KnowledgeSourceKind.WORK_IQ] name: str + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + workIQParameters: WorkIQKnowledgeSourceParameters - @overload - def __init__( - self, - *, - description: Optional[str] = ..., - e_tag: Optional[str] = ..., - encryption_key: Optional[SearchResourceEncryptionKey] = ..., - name: str - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.indexes.types.WorkIQKnowledgeSourceParameters(TypedDict, total=False): + key "entraAppAuthentication": Required[EntraAppAuthentication] + entraAppAuthentication: EntraAppAuthentication namespace azure.search.documents.knowledgebases @@ -7780,16 +10793,18 @@ namespace azure.search.documents.knowledgebases *, content_type: str = "application/json", query_source_authorization: Optional[str] = ..., + query_work_iq_source_authorization: Optional[str] = ..., **kwargs: Any ) -> KnowledgeBaseRetrievalResponse: ... @overload def retrieve( self, - retrieval_request: JSON, + retrieval_request: KnowledgeBaseRetrievalRequest, *, content_type: str = "application/json", query_source_authorization: Optional[str] = ..., + query_work_iq_source_authorization: Optional[str] = ..., **kwargs: Any ) -> KnowledgeBaseRetrievalResponse: ... @@ -7800,9 +10815,21 @@ namespace azure.search.documents.knowledgebases *, content_type: str = "application/json", query_source_authorization: Optional[str] = ..., + query_work_iq_source_authorization: Optional[str] = ..., **kwargs: Any ) -> KnowledgeBaseRetrievalResponse: ... + @distributed_trace + def retrieve_stream( + self, + retrieval_request: Union[KnowledgeBaseRetrievalRequest, dict[str, Any], IO[bytes]], + *, + content_type: str = "application/json", + query_source_authorization: Optional[str] = ..., + query_work_iq_source_authorization: Optional[str] = ..., + **kwargs: Any + ) -> KnowledgeBaseRetrievalStream: ... + def send_request( self, request: HttpRequest, @@ -7812,8 +10839,45 @@ namespace azure.search.documents.knowledgebases ) -> HttpResponse: ... + class azure.search.documents.knowledgebases.KnowledgeBaseRetrievalEvent: + data: Optional[Union[KnowledgeBaseRetrievalStartedEvent, KnowledgeBaseActivityStartedEvent, KnowledgeBaseActivityRecord, KnowledgeBaseAnswerCompletedEvent, list[KnowledgeBaseReference], KnowledgeBaseStreamErrorEvent, KnowledgeBaseResponseCompletedEvent, dict[str, Any], list[Any], str, int, float, bool]] + event_type: str + + def __init__( + self, + event_type: str, + data: KnowledgeBaseRetrievalEventData + ) -> None: ... + + def __repr__(self) -> str: ... + + + class azure.search.documents.knowledgebases.KnowledgeBaseRetrievalStream(Iterator[KnowledgeBaseRetrievalEvent]): implements ContextManager , Iterator + + def __init__( + self, + *, + raw_stream: Iterator[bytes], + response: Any + ) -> None: ... + + def close(self) -> None: ... + + namespace azure.search.documents.knowledgebases.aio + class azure.search.documents.knowledgebases.aio.AsyncKnowledgeBaseRetrievalStream(AsyncIterator[KnowledgeBaseRetrievalEvent]): implements AsyncContextManager , AsyncIterable , AsyncIterator + + def __init__( + self, + *, + raw_stream: AsyncIterator[bytes], + response: Any + ) -> None: ... + + async def close(self) -> None: ... + + class azure.search.documents.knowledgebases.aio.KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClient): implements AsyncContextManager def __init__( @@ -7835,16 +10899,18 @@ namespace azure.search.documents.knowledgebases.aio *, content_type: str = "application/json", query_source_authorization: Optional[str] = ..., + query_work_iq_source_authorization: Optional[str] = ..., **kwargs: Any ) -> KnowledgeBaseRetrievalResponse: ... @overload async def retrieve( self, - retrieval_request: JSON, + retrieval_request: KnowledgeBaseRetrievalRequest, *, content_type: str = "application/json", query_source_authorization: Optional[str] = ..., + query_work_iq_source_authorization: Optional[str] = ..., **kwargs: Any ) -> KnowledgeBaseRetrievalResponse: ... @@ -7855,9 +10921,21 @@ namespace azure.search.documents.knowledgebases.aio *, content_type: str = "application/json", query_source_authorization: Optional[str] = ..., + query_work_iq_source_authorization: Optional[str] = ..., **kwargs: Any ) -> KnowledgeBaseRetrievalResponse: ... + @distributed_trace_async + async def retrieve_stream( + self, + retrieval_request: Union[KnowledgeBaseRetrievalRequest, dict[str, Any], IO[bytes]], + *, + content_type: str = "application/json", + query_source_authorization: Optional[str] = ..., + query_work_iq_source_authorization: Optional[str] = ..., + **kwargs: Any + ) -> AsyncKnowledgeBaseRetrievalStream: ... + def send_request( self, request: HttpRequest, @@ -7867,6 +10945,19 @@ namespace azure.search.documents.knowledgebases.aio ) -> Awaitable[AsyncHttpResponse]: ... + class azure.search.documents.knowledgebases.aio.KnowledgeBaseRetrievalEvent: + data: Optional[Union[KnowledgeBaseRetrievalStartedEvent, KnowledgeBaseActivityStartedEvent, KnowledgeBaseActivityRecord, KnowledgeBaseAnswerCompletedEvent, list[KnowledgeBaseReference], KnowledgeBaseStreamErrorEvent, KnowledgeBaseResponseCompletedEvent, dict[str, Any], list[Any], str, int, float, bool]] + event_type: str + + def __init__( + self, + event_type: str, + data: KnowledgeBaseRetrievalEventData + ) -> None: ... + + def __repr__(self) -> str: ... + + namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.AIServices(_Model): @@ -7910,7 +11001,10 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.AZURE_BLOB] knowledge_source_name: str max_output_documents: int + never_query_source: bool + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -7923,7 +11017,10 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -7961,7 +11058,9 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT] knowledge_source_name: str max_output_documents: int + never_query_source: bool reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -7974,7 +11073,9 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -7990,7 +11091,9 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY] knowledge_source_name: str max_output_documents: int + never_query_source: bool reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -8003,7 +11106,9 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -8019,7 +11124,10 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.FILE] knowledge_source_name: str max_output_documents: int + never_query_source: bool + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -8032,7 +11140,10 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -8056,6 +11167,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.ImageServingStatistics(_Model): images_retrieved: Optional[int] images_sent_to_model: Optional[int] + served_images: Optional[list[ServedImage]] total_image_size_bytes: Optional[int] verbalization_used: Optional[bool] @@ -8065,6 +11177,7 @@ namespace azure.search.documents.knowledgebases.models *, images_retrieved: Optional[int] = ..., images_sent_to_model: Optional[int] = ..., + served_images: Optional[list[ServedImage]] = ..., total_image_size_bytes: Optional[int] = ..., verbalization_used: Optional[bool] = ... ) -> None: ... @@ -8082,7 +11195,10 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.INDEXED_ONELAKE] knowledge_source_name: str max_output_documents: int + never_query_source: bool + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -8095,7 +11211,10 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -8111,7 +11230,10 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT] knowledge_source_name: str max_output_documents: int + never_query_source: bool + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -8124,7 +11246,10 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -8140,7 +11265,10 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.INDEXED_SQL] knowledge_source_name: str max_output_documents: int + never_query_source: bool + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -8153,7 +11281,10 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -8161,9 +11292,11 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecord(_Model): + completed_at: Optional[datetime] elapsed_ms: Optional[int] error: Optional[KnowledgeBaseErrorDetail] id: int + started_at: Optional[datetime] type: str warning: Optional[str] @@ -8171,9 +11304,11 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., id: int, + started_at: Optional[datetime] = ..., type: str, warning: Optional[str] = ... ) -> None: ... @@ -8182,6 +11317,22 @@ namespace azure.search.documents.knowledgebases.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecordModel(_Model): + deployment_id: Optional[str] + model_name: str + + @overload + def __init__( + self, + *, + deployment_id: Optional[str] = ..., + model_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecordType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AGENTIC_REASONING = "agenticReasoning" AZURE_BLOB = "azureBlob" @@ -8201,12 +11352,35 @@ namespace azure.search.documents.knowledgebases.models WORK_IQ = "workIQ" + class azure.search.documents.knowledgebases.models.KnowledgeBaseActivityStartedEvent(_Model): + id: int + knowledge_source_name: Optional[str] + started_at: datetime + type: Union[str, KnowledgeBaseActivityRecordType] + + @overload + def __init__( + self, + *, + id: int, + knowledge_source_name: Optional[str] = ..., + started_at: datetime, + type: Union[str, KnowledgeBaseActivityRecordType] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.knowledgebases.models.KnowledgeBaseAgenticReasoningActivityRecord(KnowledgeBaseActivityRecord, discriminator='agenticReasoning'): + completed_at: datetime elapsed_ms: int error: KnowledgeBaseErrorDetail id: int + logical_reasoning_effort: Optional[KnowledgeRetrievalReasoningEffort] reasoning_tokens: Optional[int] retrieval_reasoning_effort: Optional[KnowledgeRetrievalReasoningEffort] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.AGENTIC_REASONING] warning: str @@ -8214,11 +11388,14 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., id: int, + logical_reasoning_effort: Optional[KnowledgeRetrievalReasoningEffort] = ..., reasoning_tokens: Optional[int] = ..., retrieval_reasoning_effort: Optional[KnowledgeRetrievalReasoningEffort] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8226,6 +11403,22 @@ namespace azure.search.documents.knowledgebases.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.knowledgebases.models.KnowledgeBaseAnswerCompletedEvent(_Model): + message: KnowledgeBaseMessage + message_index: int + + @overload + def __init__( + self, + *, + message: KnowledgeBaseMessage, + message_index: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.knowledgebases.models.KnowledgeBaseAzureBlobActivityArguments(_Model): search: Optional[str] @@ -8242,13 +11435,16 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseAzureBlobActivityRecord(KnowledgeBaseActivityRecord, discriminator='azureBlob'): azure_blob_arguments: Optional[KnowledgeBaseAzureBlobActivityArguments] + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail id: int image_serving: Optional[ImageServingStatistics] knowledge_source_name: Optional[str] + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.AZURE_BLOB] warning: str @@ -8257,13 +11453,16 @@ namespace azure.search.documents.knowledgebases.models self, *, azure_blob_arguments: Optional[KnowledgeBaseAzureBlobActivityArguments] = ..., + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., id: int, image_serving: Optional[ImageServingStatistics] = ..., knowledge_source_name: Optional[str] = ..., + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8274,6 +11473,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseAzureBlobReference(KnowledgeBaseReference, discriminator='azureBlob'): activity_source: int blob_url: Optional[str] + citation_url: Optional[str] id: str reranker_score: float search_sensitivity_label_info: Optional[PurviewSensitivityLabelInfo] @@ -8286,6 +11486,7 @@ namespace azure.search.documents.knowledgebases.models *, activity_source: int, blob_url: Optional[str] = ..., + citation_url: Optional[str] = ..., id: str, reranker_score: Optional[float] = ..., search_sensitivity_label_info: Optional[PurviewSensitivityLabelInfo] = ..., @@ -8324,6 +11525,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseFabricDataAgentActivityRecord(KnowledgeBaseActivityRecord, discriminator='fabricDataAgent'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -8332,6 +11534,7 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] knowledge_source_name: Optional[str] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.FABRIC_DATA_AGENT] warning: str @@ -8339,6 +11542,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -8347,6 +11551,7 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] = ..., knowledge_source_name: Optional[str] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8394,6 +11599,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseFabricOntologyActivityRecord(KnowledgeBaseActivityRecord, discriminator='fabricOntology'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -8402,6 +11608,7 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] knowledge_source_name: Optional[str] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.FABRIC_ONTOLOGY] warning: str @@ -8409,6 +11616,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -8417,6 +11625,7 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] = ..., knowledge_source_name: Optional[str] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8464,6 +11673,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseFileActivityRecord(KnowledgeBaseActivityRecord, discriminator='file'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -8471,7 +11681,9 @@ namespace azure.search.documents.knowledgebases.models id: int image_serving: Optional[ImageServingStatistics] knowledge_source_name: Optional[str] + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.FILE] warning: str @@ -8479,6 +11691,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -8486,7 +11699,9 @@ namespace azure.search.documents.knowledgebases.models id: int, image_serving: Optional[ImageServingStatistics] = ..., knowledge_source_name: Optional[str] = ..., + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8496,6 +11711,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseFileReference(KnowledgeBaseReference, discriminator='file'): activity_source: int + citation_url: Optional[str] doc_name: Optional[str] id: str reranker_score: float @@ -8507,6 +11723,7 @@ namespace azure.search.documents.knowledgebases.models self, *, activity_source: int, + citation_url: Optional[str] = ..., doc_name: Optional[str] = ..., id: str, reranker_score: Optional[float] = ..., @@ -8546,6 +11763,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedOneLakeActivityRecord(KnowledgeBaseActivityRecord, discriminator='indexedOneLake'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -8553,7 +11771,9 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] indexed_one_lake_arguments: Optional[KnowledgeBaseIndexedOneLakeActivityArguments] knowledge_source_name: Optional[str] + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.INDEXED_ONELAKE] warning: str @@ -8561,6 +11781,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -8568,7 +11789,9 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] = ..., indexed_one_lake_arguments: Optional[KnowledgeBaseIndexedOneLakeActivityArguments] = ..., knowledge_source_name: Optional[str] = ..., + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8578,6 +11801,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedOneLakeReference(KnowledgeBaseReference, discriminator='indexedOneLake'): activity_source: int + citation_url: Optional[str] doc_url: Optional[str] id: str reranker_score: float @@ -8590,6 +11814,7 @@ namespace azure.search.documents.knowledgebases.models self, *, activity_source: int, + citation_url: Optional[str] = ..., doc_url: Optional[str] = ..., id: str, reranker_score: Optional[float] = ..., @@ -8616,6 +11841,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedSharePointActivityRecord(KnowledgeBaseActivityRecord, discriminator='indexedSharePoint'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -8623,7 +11849,9 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] indexed_share_point_arguments: Optional[KnowledgeBaseIndexedSharePointActivityArguments] knowledge_source_name: Optional[str] + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.INDEXED_SHARE_POINT] warning: str @@ -8631,6 +11859,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -8638,7 +11867,9 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] = ..., indexed_share_point_arguments: Optional[KnowledgeBaseIndexedSharePointActivityArguments] = ..., knowledge_source_name: Optional[str] = ..., + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8648,6 +11879,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedSharePointReference(KnowledgeBaseReference, discriminator='indexedSharePoint'): activity_source: int + citation_url: Optional[str] doc_url: Optional[str] id: str reranker_score: float @@ -8660,6 +11892,7 @@ namespace azure.search.documents.knowledgebases.models self, *, activity_source: int, + citation_url: Optional[str] = ..., doc_url: Optional[str] = ..., id: str, reranker_score: Optional[float] = ..., @@ -8686,6 +11919,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedSqlActivityRecord(KnowledgeBaseActivityRecord, discriminator='indexedSql'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -8693,7 +11927,9 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] indexed_sql_arguments: Optional[KnowledgeBaseIndexedSqlActivityArguments] knowledge_source_name: Optional[str] + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.INDEXED_SQL] warning: str @@ -8701,6 +11937,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -8708,7 +11945,9 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] = ..., indexed_sql_arguments: Optional[KnowledgeBaseIndexedSqlActivityArguments] = ..., knowledge_source_name: Optional[str] = ..., + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8718,6 +11957,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedSqlReference(KnowledgeBaseReference, discriminator='indexedSql'): activity_source: int + citation_url: Optional[str] doc_url: Optional[str] id: str reranker_score: float @@ -8729,6 +11969,7 @@ namespace azure.search.documents.knowledgebases.models self, *, activity_source: int, + citation_url: Optional[str] = ..., doc_url: Optional[str] = ..., id: str, reranker_score: Optional[float] = ..., @@ -8756,6 +11997,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseMcpServerActivityRecord(KnowledgeBaseActivityRecord, discriminator='mcpServer'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -8764,6 +12006,7 @@ namespace azure.search.documents.knowledgebases.models knowledge_source_name: Optional[str] mcp_server_arguments: Optional[KnowledgeBaseMcpServerActivityArguments] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.MCP_SERVER] warning: str @@ -8771,6 +12014,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -8779,6 +12023,7 @@ namespace azure.search.documents.knowledgebases.models knowledge_source_name: Optional[str] = ..., mcp_server_arguments: Optional[KnowledgeBaseMcpServerActivityArguments] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8877,12 +12122,14 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseModelAnswerSynthesisActivityRecord(KnowledgeBaseActivityRecord, discriminator='modelAnswerSynthesis'): + completed_at: datetime elapsed_ms: int error: KnowledgeBaseErrorDetail id: int input_tokens: Optional[int] - model_name: Optional[str] + model: Optional[KnowledgeBaseActivityRecordModel] output_tokens: Optional[int] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.MODEL_ANSWER_SYNTHESIS] warning: str @@ -8890,12 +12137,14 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., id: int, input_tokens: Optional[int] = ..., - model_name: Optional[str] = ..., + model: Optional[KnowledgeBaseActivityRecordModel] = ..., output_tokens: Optional[int] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8904,12 +12153,14 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseModelQueryPlanningActivityRecord(KnowledgeBaseActivityRecord, discriminator='modelQueryPlanning'): + completed_at: datetime elapsed_ms: int error: KnowledgeBaseErrorDetail id: int input_tokens: Optional[int] - model_name: Optional[str] + model: Optional[KnowledgeBaseActivityRecordModel] output_tokens: Optional[int] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.MODEL_QUERY_PLANNING] warning: str @@ -8917,12 +12168,14 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., id: int, input_tokens: Optional[int] = ..., - model_name: Optional[str] = ..., + model: Optional[KnowledgeBaseActivityRecordModel] = ..., output_tokens: Optional[int] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8931,12 +12184,14 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseModelWebSummarizationActivityRecord(KnowledgeBaseActivityRecord, discriminator='modelWebSummarization'): + completed_at: datetime elapsed_ms: int error: KnowledgeBaseErrorDetail id: int input_tokens_count: Optional[int] - model_name: Optional[str] + model: Optional[KnowledgeBaseActivityRecordModel] output_tokens_count: Optional[int] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.MODEL_WEB_SUMMARIZATION] warning: str @@ -8944,12 +12199,14 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., id: int, input_tokens_count: Optional[int] = ..., - model_name: Optional[str] = ..., + model: Optional[KnowledgeBaseActivityRecordModel] = ..., output_tokens_count: Optional[int] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -8957,6 +12214,22 @@ namespace azure.search.documents.knowledgebases.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.knowledgebases.models.KnowledgeBaseQueryHintProcessing(_Model): + generated_boost: Optional[str] + generated_filter: Optional[str] + + @overload + def __init__( + self, + *, + generated_boost: Optional[str] = ..., + generated_filter: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.knowledgebases.models.KnowledgeBaseReference(_Model): activity_source: int id: str @@ -9011,6 +12284,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseRemoteSharePointActivityRecord(KnowledgeBaseActivityRecord, discriminator='remoteSharePoint'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -9019,6 +12293,7 @@ namespace azure.search.documents.knowledgebases.models knowledge_source_name: Optional[str] query_time: Optional[datetime] remote_share_point_arguments: Optional[KnowledgeBaseRemoteSharePointActivityArguments] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.REMOTE_SHARE_POINT] warning: str @@ -9026,6 +12301,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -9034,6 +12310,7 @@ namespace azure.search.documents.knowledgebases.models knowledge_source_name: Optional[str] = ..., query_time: Optional[datetime] = ..., remote_share_point_arguments: Optional[KnowledgeBaseRemoteSharePointActivityArguments] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -9066,6 +12343,22 @@ namespace azure.search.documents.knowledgebases.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.knowledgebases.models.KnowledgeBaseResponseCompletedEvent(_Model): + response: KnowledgeBaseRetrievalResponse + status_code: Union[int, KnowledgeBaseRetrievalStatusCode] + + @overload + def __init__( + self, + *, + response: KnowledgeBaseRetrievalResponse, + status_code: Union[int, KnowledgeBaseRetrievalStatusCode] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest(_Model): include_activity: Optional[bool] intents: Optional[list[KnowledgeRetrievalIntent]] @@ -9118,8 +12411,34 @@ namespace azure.search.documents.knowledgebases.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalStartedEvent(_Model): + knowledge_base_name: str + output_mode: Union[str, KnowledgeRetrievalOutputMode] + reasoning_effort: KnowledgeRetrievalReasoningEffort + request_id: str + + @overload + def __init__( + self, + *, + knowledge_base_name: str, + output_mode: Union[str, KnowledgeRetrievalOutputMode], + reasoning_effort: KnowledgeRetrievalReasoningEffort, + request_id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalStatusCode(int, Enum, metaclass=CaseInsensitiveEnumMeta): + OK = 200 + PARTIAL_CONTENT = 206 + + class azure.search.documents.knowledgebases.models.KnowledgeBaseSearchIndexActivityArguments(_Model): filter: Optional[str] + query_type: Optional[Union[str, QueryType]] search: Optional[str] search_fields: Optional[list[SearchIndexFieldReference]] semantic_configuration_name: Optional[str] @@ -9130,6 +12449,7 @@ namespace azure.search.documents.knowledgebases.models self, *, filter: Optional[str] = ..., + query_type: Optional[Union[str, QueryType]] = ..., search: Optional[str] = ..., search_fields: Optional[list[SearchIndexFieldReference]] = ..., semantic_configuration_name: Optional[str] = ..., @@ -9141,14 +12461,17 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseSearchIndexActivityRecord(KnowledgeBaseActivityRecord, discriminator='searchIndex'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail id: int image_serving: Optional[ImageServingStatistics] knowledge_source_name: Optional[str] + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] query_time: Optional[datetime] search_index_arguments: Optional[KnowledgeBaseSearchIndexActivityArguments] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.SEARCH_INDEX] warning: str @@ -9156,14 +12479,17 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., id: int, image_serving: Optional[ImageServingStatistics] = ..., knowledge_source_name: Optional[str] = ..., + query_hint_processing: Optional[KnowledgeBaseQueryHintProcessing] = ..., query_time: Optional[datetime] = ..., search_index_arguments: Optional[KnowledgeBaseSearchIndexActivityArguments] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ... ) -> None: ... @@ -9173,6 +12499,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseSearchIndexReference(KnowledgeBaseReference, discriminator='searchIndex'): activity_source: int + citation_url: Optional[str] doc_key: Optional[str] id: str reranker_score: float @@ -9185,6 +12512,7 @@ namespace azure.search.documents.knowledgebases.models self, *, activity_source: int, + citation_url: Optional[str] = ..., doc_key: Optional[str] = ..., id: str, reranker_score: Optional[float] = ..., @@ -9196,6 +12524,22 @@ namespace azure.search.documents.knowledgebases.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.knowledgebases.models.KnowledgeBaseStreamErrorEvent(_Model): + activity: Optional[list[KnowledgeBaseActivityRecord]] + error: KnowledgeBaseErrorDetail + + @overload + def __init__( + self, + *, + activity: Optional[list[KnowledgeBaseActivityRecord]] = ..., + error: KnowledgeBaseErrorDetail + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.knowledgebases.models.KnowledgeBaseWebActivityArguments(_Model): count: Optional[int] freshness: Optional[str] @@ -9219,6 +12563,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseWebActivityRecord(KnowledgeBaseActivityRecord, discriminator='web'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -9226,6 +12571,7 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] knowledge_source_name: Optional[str] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.WEB] warning: str web_arguments: Optional[KnowledgeBaseWebActivityArguments] @@ -9234,6 +12580,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -9241,6 +12588,7 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] = ..., knowledge_source_name: Optional[str] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ..., web_arguments: Optional[KnowledgeBaseWebActivityArguments] = ... ) -> None: ... @@ -9289,6 +12637,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseWorkIQActivityRecord(KnowledgeBaseActivityRecord, discriminator='workIQ'): + completed_at: datetime count: Optional[int] elapsed_ms: int error: KnowledgeBaseErrorDetail @@ -9296,6 +12645,7 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] knowledge_source_name: Optional[str] query_time: Optional[datetime] + started_at: datetime type: Literal[KnowledgeBaseActivityRecordType.WORK_IQ] warning: str work_iq_arguments: Optional[KnowledgeBaseWorkIQActivityArguments] @@ -9304,6 +12654,7 @@ namespace azure.search.documents.knowledgebases.models def __init__( self, *, + completed_at: Optional[datetime] = ..., count: Optional[int] = ..., elapsed_ms: Optional[int] = ..., error: Optional[KnowledgeBaseErrorDetail] = ..., @@ -9311,6 +12662,7 @@ namespace azure.search.documents.knowledgebases.models image_serving: Optional[ImageServingStatistics] = ..., knowledge_source_name: Optional[str] = ..., query_time: Optional[datetime] = ..., + started_at: Optional[datetime] = ..., warning: Optional[str] = ..., work_iq_arguments: Optional[KnowledgeBaseWorkIQActivityArguments] = ... ) -> None: ... @@ -9321,9 +12673,9 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeBaseWorkIQReference(KnowledgeBaseReference, discriminator='workIQ'): activity_source: int - attributions: Optional[list[WorkIQAttribution]] id: str reranker_score: float + search_sensitivity_label_info: Optional[PurviewSensitivityLabelInfo] source_data: dict[str, any] type: Literal[KnowledgeBaseReferenceType.WORK_IQ] @@ -9332,9 +12684,9 @@ namespace azure.search.documents.knowledgebases.models self, *, activity_source: int, - attributions: Optional[list[WorkIQAttribution]] = ..., id: str, reranker_score: Optional[float] = ..., + search_sensitivity_label_info: Optional[PurviewSensitivityLabelInfo] = ..., source_data: Optional[dict[str, Any]] = ... ) -> None: ... @@ -9342,6 +12694,16 @@ namespace azure.search.documents.knowledgebases.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.knowledgebases.models.KnowledgeRetrievalAutoReasoningEffort(KnowledgeRetrievalReasoningEffort, discriminator='auto'): + kind: Literal[KnowledgeRetrievalReasoningEffortKind.AUTO] + + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.search.documents.knowledgebases.models.KnowledgeRetrievalIntent(_Model): type: str @@ -9410,6 +12772,7 @@ namespace azure.search.documents.knowledgebases.models class azure.search.documents.knowledgebases.models.KnowledgeRetrievalReasoningEffortKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AUTO = "auto" LOW = "low" MEDIUM = "medium" MINIMAL = "minimal" @@ -9456,6 +12819,7 @@ namespace azure.search.documents.knowledgebases.models identity: Optional[SearchIndexerDataIdentity] ingestion_permission_options: Optional[list[Union[str, KnowledgeSourceIngestionPermissionOption]]] ingestion_schedule: Optional[IndexingSchedule] + network_access_mode: Optional[Union[str, KnowledgeSourceNetworkAccessMode]] @overload def __init__( @@ -9470,13 +12834,19 @@ namespace azure.search.documents.knowledgebases.models freshness_policy: Optional[FreshnessPolicy] = ..., identity: Optional[SearchIndexerDataIdentity] = ..., ingestion_permission_options: Optional[list[Union[str, KnowledgeSourceIngestionPermissionOption]]] = ..., - ingestion_schedule: Optional[IndexingSchedule] = ... + ingestion_schedule: Optional[IndexingSchedule] = ..., + network_access_mode: Optional[Union[str, KnowledgeSourceNetworkAccessMode]] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.search.documents.knowledgebases.models.KnowledgeSourceNetworkAccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + PRIVATE = "private" + PUBLIC = "public" + + class azure.search.documents.knowledgebases.models.KnowledgeSourceParams(_Model): always_query_source: Optional[bool] enable_image_serving: Optional[bool] @@ -9486,7 +12856,9 @@ namespace azure.search.documents.knowledgebases.models kind: str knowledge_source_name: str max_output_documents: Optional[int] + never_query_source: Optional[bool] reranker_threshold: Optional[float] + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] @overload def __init__( @@ -9500,7 +12872,9 @@ namespace azure.search.documents.knowledgebases.models kind: str, knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -9596,7 +12970,9 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.MCP_SERVER] knowledge_source_name: str max_output_documents: int + never_query_source: bool reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -9609,7 +12985,9 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -9650,7 +13028,9 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT] knowledge_source_name: str max_output_documents: int + never_query_source: bool reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -9664,7 +13044,9 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -9681,7 +13063,10 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.SEARCH_INDEX] knowledge_source_name: str max_output_documents: int + never_query_source: bool + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -9695,7 +13080,28 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + query_hint_overrides: Optional[SearchIndexKnowledgeSourceQueryHints] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.search.documents.knowledgebases.models.ServedImage(_Model): + image_id: Optional[str] + image_path: str + size_bytes: int + + @overload + def __init__( + self, + *, + image_id: Optional[str] = ..., + image_path: str, + size_bytes: int ) -> None: ... @overload @@ -9737,7 +13143,9 @@ namespace azure.search.documents.knowledgebases.models language: Optional[str] market: Optional[str] max_output_documents: int + never_query_source: bool reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -9754,21 +13162,9 @@ namespace azure.search.documents.knowledgebases.models language: Optional[str] = ..., market: Optional[str] = ..., max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - - class azure.search.documents.knowledgebases.models.WorkIQAttribution(_Model): - see_more_web_url: Optional[str] - - @overload - def __init__( - self, - *, - see_more_web_url: Optional[str] = ... + never_query_source: Optional[bool] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload @@ -9784,7 +13180,9 @@ namespace azure.search.documents.knowledgebases.models kind: Literal[KnowledgeSourceKind.WORK_IQ] knowledge_source_name: str max_output_documents: int + never_query_source: bool reranker_threshold: float + results_processing: Union[str, KnowledgeSourceResultsProcessing] @overload def __init__( @@ -9797,13 +13195,446 @@ namespace azure.search.documents.knowledgebases.models include_references: Optional[bool] = ..., knowledge_source_name: str, max_output_documents: Optional[int] = ..., - reranker_threshold: Optional[float] = ... + never_query_source: Optional[bool] = ..., + reranker_threshold: Optional[float] = ..., + results_processing: Optional[Union[str, KnowledgeSourceResultsProcessing]] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... +namespace azure.search.documents.knowledgebases.types + + class azure.search.documents.knowledgebases.types.AzureBlobKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.AZURE_BLOB]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.AZURE_BLOB] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + queryHintOverrides: SearchIndexKnowledgeSourceQueryHints + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.FabricDataAgentKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.FabricOntologyKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.FileKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.FILE]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.FILE] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + queryHintOverrides: SearchIndexKnowledgeSourceQueryHints + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.IndexedOneLakeKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.INDEXED_ONELAKE]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.INDEXED_ONELAKE] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + queryHintOverrides: SearchIndexKnowledgeSourceQueryHints + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.IndexedSharePointKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + queryHintOverrides: SearchIndexKnowledgeSourceQueryHints + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.IndexedSqlKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.INDEXED_SQL]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.INDEXED_SQL] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + queryHintOverrides: SearchIndexKnowledgeSourceQueryHints + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.KnowledgeBaseImageContent(TypedDict, total=False): + key "url": Required[str] + url: str + + + class azure.search.documents.knowledgebases.types.KnowledgeBaseMessage(TypedDict, total=False): + key "content": Required[list[KnowledgeBaseMessageContent]] + key "role": str + content: list[KnowledgeBaseMessageContent] + role: str + + + class azure.search.documents.knowledgebases.types.KnowledgeBaseMessageContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + IMAGE = "image" + TEXT = "text" + + + class azure.search.documents.knowledgebases.types.KnowledgeBaseMessageImageContent(TypedDict, total=False): + key "image": Required[KnowledgeBaseImageContent] + key "type": Required[Literal[KnowledgeBaseMessageContentType.IMAGE]] + image: KnowledgeBaseImageContent + type: Literal[KnowledgeBaseMessageContentType.IMAGE] + + + class azure.search.documents.knowledgebases.types.KnowledgeBaseMessageTextContent(TypedDict, total=False): + key "text": Required[str] + key "type": Required[Literal[KnowledgeBaseMessageContentType.TEXT]] + text: str + type: Literal[KnowledgeBaseMessageContentType.TEXT] + + + class azure.search.documents.knowledgebases.types.KnowledgeBaseRetrievalRequest(TypedDict, total=False): + key "includeActivity": bool + key "maxOutputDocuments": int + key "maxOutputSize": int + key "maxOutputSizeInTokens": int + key "maxRuntimeInSeconds": int + key "outputMode": Union[str, KnowledgeRetrievalOutputMode] + key "retrievalReasoningEffort": ForwardRef('KnowledgeRetrievalReasoningEffort', module='types') + includeActivity: bool + intents: list[KnowledgeRetrievalIntent] + knowledgeSourceParams: list[KnowledgeSourceParams] + maxOutputDocuments: int + maxOutputSize: int + maxOutputSizeInTokens: int + maxRuntimeInSeconds: int + messages: list[KnowledgeBaseMessage] + outputMode: Union[str, KnowledgeRetrievalOutputMode] + retrievalReasoningEffort: KnowledgeRetrievalReasoningEffort + + + class azure.search.documents.knowledgebases.types.KnowledgeRetrievalAutoReasoningEffort(TypedDict, total=False): + key "kind": Required[Literal[KnowledgeRetrievalReasoningEffortKind.AUTO]] + kind: Literal[KnowledgeRetrievalReasoningEffortKind.AUTO] + + + class azure.search.documents.knowledgebases.types.KnowledgeRetrievalIntent(TypedDict, total=False): + key "search": Required[str] + key "type": Required[Literal[KnowledgeRetrievalIntentType.SEMANTIC]] + search: str + type: Literal[KnowledgeRetrievalIntentType.SEMANTIC] + + + class azure.search.documents.knowledgebases.types.KnowledgeRetrievalIntentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SEMANTIC = "semantic" + + + class azure.search.documents.knowledgebases.types.KnowledgeRetrievalLowReasoningEffort(TypedDict, total=False): + key "kind": Required[Literal[KnowledgeRetrievalReasoningEffortKind.LOW]] + kind: Literal[KnowledgeRetrievalReasoningEffortKind.LOW] + + + class azure.search.documents.knowledgebases.types.KnowledgeRetrievalMediumReasoningEffort(TypedDict, total=False): + key "kind": Required[Literal[KnowledgeRetrievalReasoningEffortKind.MEDIUM]] + kind: Literal[KnowledgeRetrievalReasoningEffortKind.MEDIUM] + + + class azure.search.documents.knowledgebases.types.KnowledgeRetrievalMinimalReasoningEffort(TypedDict, total=False): + key "kind": Required[Literal[KnowledgeRetrievalReasoningEffortKind.MINIMAL]] + kind: Literal[KnowledgeRetrievalReasoningEffortKind.MINIMAL] + + + class azure.search.documents.knowledgebases.types.KnowledgeRetrievalReasoningEffortKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AUTO = "auto" + LOW = "low" + MEDIUM = "medium" + MINIMAL = "minimal" + + + class azure.search.documents.knowledgebases.types.KnowledgeRetrievalSemanticIntent(TypedDict, total=False): + key "search": Required[str] + key "type": Required[Literal[KnowledgeRetrievalIntentType.SEMANTIC]] + search: str + type: Literal[KnowledgeRetrievalIntentType.SEMANTIC] + + + class azure.search.documents.knowledgebases.types.KnowledgeSourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AZURE_BLOB = "azureBlob" + FABRIC_DATA_AGENT = "fabricDataAgent" + FABRIC_ONTOLOGY = "fabricOntology" + FILE = "file" + INDEXED_ONELAKE = "indexedOneLake" + INDEXED_SHARE_POINT = "indexedSharePoint" + INDEXED_SQL = "indexedSql" + MCP_SERVER = "mcpServer" + REMOTE_SHARE_POINT = "remoteSharePoint" + SEARCH_INDEX = "searchIndex" + WEB = "web" + WORK_IQ = "workIQ" + + + class azure.search.documents.knowledgebases.types.McpServerKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.MCP_SERVER]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.MCP_SERVER] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.RemoteSharePointKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "filterExpressionAddOn": str + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + filterExpressionAddOn: str + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.SearchIndexKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "filterAddOn": str + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.SEARCH_INDEX]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + filterAddOn: str + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.SEARCH_INDEX] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + queryHintOverrides: SearchIndexKnowledgeSourceQueryHints + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.WebKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "count": int + key "enableImageServing": bool + key "failOnError": bool + key "freshness": str + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.WEB]] + key "knowledgeSourceName": Required[str] + key "language": str + key "market": str + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + count: int + enableImageServing: bool + failOnError: bool + freshness: str + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.WEB] + knowledgeSourceName: str + language: str + market: str + maxOutputDocuments: int + neverQuerySource: bool + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + + class azure.search.documents.knowledgebases.types.WorkIQKnowledgeSourceParams(TypedDict, total=False): + key "alwaysQuerySource": bool + key "enableImageServing": bool + key "failOnError": bool + key "includeReferenceSourceData": bool + key "includeReferences": bool + key "kind": Required[Literal[KnowledgeSourceKind.WORK_IQ]] + key "knowledgeSourceName": Required[str] + key "maxOutputDocuments": int + key "neverQuerySource": bool + key "rerankerThreshold": float + key "resultsProcessing": Union[str, KnowledgeSourceResultsProcessing] + alwaysQuerySource: bool + enableImageServing: bool + failOnError: bool + includeReferenceSourceData: bool + includeReferences: bool + kind: Literal[KnowledgeSourceKind.WORK_IQ] + knowledgeSourceName: str + maxOutputDocuments: int + neverQuerySource: bool + rerankerThreshold: float + resultsProcessing: Union[str, KnowledgeSourceResultsProcessing] + + namespace azure.search.documents.models class azure.search.documents.models.AutocompleteItem(_Model): @@ -10172,6 +14003,10 @@ namespace azure.search.documents.models USED = "used" + class azure.search.documents.models.SemanticQueryRewritesResultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ORIGINAL_QUERY_ONLY = "originalQueryOnly" + + class azure.search.documents.models.SemanticSearchResultsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): BASE_RESULTS = "baseResults" RERANKED_RESULTS = "rerankedResults" @@ -10397,4 +14232,248 @@ namespace azure.search.documents.models subscores: Optional[QueryResultDocumentSubscores] +namespace azure.search.documents.types + + class azure.search.documents.types.AutocompletePostRequest(TypedDict, total=False): + key "autocompleteMode": Union[str, AutocompleteMode] + key "filter": str + key "fuzzy": bool + key "highlightPostTag": str + key "highlightPreTag": str + key "minimumCoverage": float + key "search": Required[str] + key "suggesterName": Required[str] + key "top": int + autocompleteMode: Union[str, AutocompleteMode] + filter: str + fuzzy: bool + highlightPostTag: str + highlightPreTag: str + minimumCoverage: float + search: str + searchFields: list[str] + suggesterName: str + top: int + + + class azure.search.documents.types.HybridSearch(TypedDict, total=False): + key "countAndFacetMode": Union[str, HybridCountAndFacetMode] + key "maxTextRecallSize": int + countAndFacetMode: Union[str, HybridCountAndFacetMode] + maxTextRecallSize: int + + + class azure.search.documents.types.IndexAction(TypedDict): + key "@search.action": Union[str, IndexActionType] + ``@search.action``: Union[str, IndexActionType] + + + class azure.search.documents.types.IndexDocumentsBatch(TypedDict, total=False): + key "value": Required[list[IndexAction]] + value: list[IndexAction] + + + class azure.search.documents.types.SearchPostRequest(TypedDict, total=False): + key "answers": Union[str, QueryAnswerType] + key "captions": Union[str, QueryCaptionType] + key "count": bool + key "debug": Union[str, QueryDebugMode] + key "filter": str + key "highlightPostTag": str + key "highlightPreTag": str + key "hybridSearch": ForwardRef('HybridSearch', module='types') + key "minimumCoverage": float + key "queryLanguage": Union[str, QueryLanguage] + key "queryRewrites": Union[str, QueryRewritesType] + key "queryType": Union[str, QueryType] + key "scoringProfile": str + key "scoringStatistics": Union[str, ScoringStatistics] + key "search": str + key "searchMode": Union[str, SearchMode] + key "semanticConfiguration": str + key "semanticErrorHandling": Union[str, SemanticErrorMode] + key "semanticMaxWaitInMilliseconds": int + key "semanticQuery": str + key "sessionId": str + key "skip": int + key "speller": Union[str, QuerySpellerType] + key "top": int + key "vectorFilterMode": Union[str, VectorFilterMode] + answers: Union[str, QueryAnswerType] + captions: Union[str, QueryCaptionType] + count: bool + debug: Union[str, QueryDebugMode] + facets: list[str] + filter: str + highlight: list[str] + highlightPostTag: str + highlightPreTag: str + hybridSearch: HybridSearch + minimumCoverage: float + orderby: list[str] + queryLanguage: Union[str, QueryLanguage] + queryRewrites: Union[str, QueryRewritesType] + queryType: Union[str, QueryType] + scoringParameters: list[str] + scoringProfile: str + scoringStatistics: Union[str, ScoringStatistics] + search: str + searchFields: list[str] + searchMode: Union[str, SearchMode] + select: list[str] + semanticConfiguration: str + semanticErrorHandling: Union[str, SemanticErrorMode] + semanticFields: list[str] + semanticMaxWaitInMilliseconds: int + semanticQuery: str + sessionId: str + skip: int + speller: Union[str, QuerySpellerType] + top: int + vectorFilterMode: Union[str, VectorFilterMode] + vectorQueries: list[VectorQuery] + + + class azure.search.documents.types.SearchScoreThreshold(TypedDict, total=False): + key "kind": Required[Literal[VectorThresholdKind.SEARCH_SCORE]] + key "value": Required[float] + kind: Literal[VectorThresholdKind.SEARCH_SCORE] + value: float + + + class azure.search.documents.types.SuggestPostRequest(TypedDict, total=False): + key "filter": str + key "fuzzy": bool + key "highlightPostTag": str + key "highlightPreTag": str + key "minimumCoverage": float + key "search": Required[str] + key "suggesterName": Required[str] + key "top": int + filter: str + fuzzy: bool + highlightPostTag: str + highlightPreTag: str + minimumCoverage: float + orderby: list[str] + search: str + searchFields: list[str] + select: list[str] + suggesterName: str + top: int + + + class azure.search.documents.types.VectorQueryKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + IMAGE_BINARY = "imageBinary" + IMAGE_URL = "imageUrl" + TEXT = "text" + VECTOR = "vector" + + + class azure.search.documents.types.VectorSimilarityThreshold(TypedDict, total=False): + key "kind": Required[Literal[VectorThresholdKind.VECTOR_SIMILARITY]] + key "value": Required[float] + kind: Literal[VectorThresholdKind.VECTOR_SIMILARITY] + value: float + + + class azure.search.documents.types.VectorThresholdKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SEARCH_SCORE = "searchScore" + VECTOR_SIMILARITY = "vectorSimilarity" + + + class azure.search.documents.types.VectorizableImageBinaryQuery(TypedDict, total=False): + key "base64Image": str + key "exhaustive": bool + key "fields": str + key "filterOverride": str + key "k": int + key "kind": Required[Literal[VectorQueryKind.IMAGE_BINARY]] + key "oversampling": float + key "perDocumentVectorLimit": int + key "threshold": ForwardRef('VectorThreshold', module='types') + key "weight": float + base64Image: str + exhaustive: bool + fields: str + filterOverride: str + k: int + kind: Literal[VectorQueryKind.IMAGE_BINARY] + oversampling: float + perDocumentVectorLimit: int + threshold: VectorThreshold + weight: float + + + class azure.search.documents.types.VectorizableImageUrlQuery(TypedDict, total=False): + key "exhaustive": bool + key "fields": str + key "filterOverride": str + key "k": int + key "kind": Required[Literal[VectorQueryKind.IMAGE_URL]] + key "oversampling": float + key "perDocumentVectorLimit": int + key "threshold": ForwardRef('VectorThreshold', module='types') + key "url": str + key "weight": float + exhaustive: bool + fields: str + filterOverride: str + k: int + kind: Literal[VectorQueryKind.IMAGE_URL] + oversampling: float + perDocumentVectorLimit: int + threshold: VectorThreshold + url: str + weight: float + + + class azure.search.documents.types.VectorizableTextQuery(TypedDict, total=False): + key "exhaustive": bool + key "fields": str + key "filterOverride": str + key "k": int + key "kind": Required[Literal[VectorQueryKind.TEXT]] + key "oversampling": float + key "perDocumentVectorLimit": int + key "queryRewrites": Union[str, QueryRewritesType] + key "text": Required[str] + key "threshold": ForwardRef('VectorThreshold', module='types') + key "weight": float + exhaustive: bool + fields: str + filterOverride: str + k: int + kind: Literal[VectorQueryKind.TEXT] + oversampling: float + perDocumentVectorLimit: int + queryRewrites: Union[str, QueryRewritesType] + text: str + threshold: VectorThreshold + weight: float + + + class azure.search.documents.types.VectorizedQuery(TypedDict, total=False): + key "exhaustive": bool + key "fields": str + key "filterOverride": str + key "k": int + key "kind": Required[Literal[VectorQueryKind.VECTOR]] + key "oversampling": float + key "perDocumentVectorLimit": int + key "threshold": ForwardRef('VectorThreshold', module='types') + key "vector": Required[list[float]] + key "weight": float + exhaustive: bool + fields: str + filterOverride: str + k: int + kind: Literal[VectorQueryKind.VECTOR] + oversampling: float + perDocumentVectorLimit: int + threshold: VectorThreshold + vector: list[float] + weight: float + + ``` \ No newline at end of file diff --git a/sdk/search/azure-search-documents/api.metadata.yml b/sdk/search/azure-search-documents/api.metadata.yml index b5f806f0ac36..5400e54cde2a 100644 --- a/sdk/search/azure-search-documents/api.metadata.yml +++ b/sdk/search/azure-search-documents/api.metadata.yml @@ -1,3 +1,3 @@ -apiMdSha256: cf9b5548f872667463b76b7b872cc6b9083f419238d4b4df3bc2410ad0d64c8b -parserVersion: 0.3.28 -pythonVersion: 3.12.13 +apiMdSha256: 084e314c75fadd638286314c23b600310d948b8748f479b39b840db568f7b0f4 +parserVersion: 0.3.31 +pythonVersion: 3.12.1 diff --git a/sdk/search/azure-search-documents/apiview-properties.json b/sdk/search/azure-search-documents/apiview-properties.json index 05215a621a9a..f71351b7e357 100644 --- a/sdk/search/azure-search-documents/apiview-properties.json +++ b/sdk/search/azure-search-documents/apiview-properties.json @@ -80,6 +80,7 @@ "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.indexes.models.EntraAppAuthentication": "Search.EntraAppAuthentication", "azure.search.documents.models.ErrorAdditionalInfo": "Search.ErrorAdditionalInfo", "azure.search.documents.models.ErrorDetail": "Search.ErrorDetail", "azure.search.documents.models.ErrorResponse": "Search.ErrorResponse", @@ -98,6 +99,7 @@ "azure.search.documents.indexes.models.FileKnowledgeSource": "Search.FileKnowledgeSource", "azure.search.documents.indexes.models.FileKnowledgeSourceParameters": "Search.FileKnowledgeSourceParameters", "azure.search.documents.knowledgebases.models.FileKnowledgeSourceParams": "Search.FileKnowledgeSourceParams", + "azure.search.documents.indexes.models.FileUploadMetadata": "Search.FileUploadMetadata", "azure.search.documents.knowledgebases.models.FreshnessPolicy": "Search.FreshnessPolicy", "azure.search.documents.indexes.models.FreshnessScoringFunction": "Search.FreshnessScoringFunction", "azure.search.documents.indexes.models.FreshnessScoringParameters": "Search.FreshnessScoringParameters", @@ -136,7 +138,10 @@ "azure.search.documents.indexes.models.KeywordTokenizerV2": "Search.KeywordTokenizerV2", "azure.search.documents.indexes.models.KnowledgeBase": "Search.KnowledgeBase", "azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecord": "Search.KnowledgeBaseActivityRecord", + "azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecordModel": "Search.KnowledgeBaseActivityRecordModel", + "azure.search.documents.knowledgebases.models.KnowledgeBaseActivityStartedEvent": "Search.KnowledgeBaseActivityStartedEvent", "azure.search.documents.knowledgebases.models.KnowledgeBaseAgenticReasoningActivityRecord": "Search.KnowledgeBaseAgenticReasoningActivityRecord", + "azure.search.documents.knowledgebases.models.KnowledgeBaseAnswerCompletedEvent": "Search.KnowledgeBaseAnswerCompletedEvent", "azure.search.documents.knowledgebases.models.KnowledgeBaseAzureBlobActivityArguments": "Search.KnowledgeBaseAzureBlobActivityArguments", "azure.search.documents.knowledgebases.models.KnowledgeBaseAzureBlobActivityRecord": "Search.KnowledgeBaseAzureBlobActivityRecord", "azure.search.documents.knowledgebases.models.KnowledgeBaseReference": "Search.KnowledgeBaseReference", @@ -174,22 +179,28 @@ "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.KnowledgeBaseQueryHintProcessing": "Search.KnowledgeBaseQueryHintProcessing", "azure.search.documents.knowledgebases.models.KnowledgeBaseRemoteSharePointActivityArguments": "Search.KnowledgeBaseRemoteSharePointActivityArguments", "azure.search.documents.knowledgebases.models.KnowledgeBaseRemoteSharePointActivityRecord": "Search.KnowledgeBaseRemoteSharePointActivityRecord", "azure.search.documents.knowledgebases.models.KnowledgeBaseRemoteSharePointReference": "Search.KnowledgeBaseRemoteSharePointReference", + "azure.search.documents.knowledgebases.models.KnowledgeBaseResponseCompletedEvent": "Search.KnowledgeBaseResponseCompletedEvent", "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest": "Search.KnowledgeBaseRetrievalRequest", "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse": "Search.KnowledgeBaseRetrievalResponse", + "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalStartedEvent": "Search.KnowledgeBaseRetrievalStartedEvent", + "azure.search.documents.indexes.models.KnowledgeBaseRetrieveDefaults": "Search.KnowledgeBaseRetrieveDefaults", "azure.search.documents.knowledgebases.models.KnowledgeBaseSearchIndexActivityArguments": "Search.KnowledgeBaseSearchIndexActivityArguments", "azure.search.documents.knowledgebases.models.KnowledgeBaseSearchIndexActivityRecord": "Search.KnowledgeBaseSearchIndexActivityRecord", "azure.search.documents.knowledgebases.models.KnowledgeBaseSearchIndexReference": "Search.KnowledgeBaseSearchIndexReference", + "azure.search.documents.knowledgebases.models.KnowledgeBaseStreamErrorEvent": "Search.KnowledgeBaseStreamErrorEvent", "azure.search.documents.knowledgebases.models.KnowledgeBaseWebActivityArguments": "Search.KnowledgeBaseWebActivityArguments", "azure.search.documents.knowledgebases.models.KnowledgeBaseWebActivityRecord": "Search.KnowledgeBaseWebActivityRecord", "azure.search.documents.knowledgebases.models.KnowledgeBaseWebReference": "Search.KnowledgeBaseWebReference", "azure.search.documents.knowledgebases.models.KnowledgeBaseWorkIQActivityArguments": "Search.KnowledgeBaseWorkIQActivityArguments", "azure.search.documents.knowledgebases.models.KnowledgeBaseWorkIQActivityRecord": "Search.KnowledgeBaseWorkIQActivityRecord", "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.KnowledgeRetrievalAutoReasoningEffort": "Search.KnowledgeRetrievalAutoReasoningEffort", + "azure.search.documents.knowledgebases.models.KnowledgeRetrievalIntent": "Search.KnowledgeRetrievalIntent", "azure.search.documents.knowledgebases.models.KnowledgeRetrievalLowReasoningEffort": "Search.KnowledgeRetrievalLowReasoningEffort", "azure.search.documents.knowledgebases.models.KnowledgeRetrievalMediumReasoningEffort": "Search.KnowledgeRetrievalMediumReasoningEffort", "azure.search.documents.knowledgebases.models.KnowledgeRetrievalMinimalReasoningEffort": "Search.KnowledgeRetrievalMinimalReasoningEffort", @@ -291,8 +302,13 @@ "azure.search.documents.indexes.models.SearchIndexerWarning": "Search.SearchIndexerWarning", "azure.search.documents.indexes.models.SearchIndexFieldReference": "Search.SearchIndexFieldReference", "azure.search.documents.indexes.models.SearchIndexKnowledgeSource": "Search.SearchIndexKnowledgeSource", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceBoost": "Search.SearchIndexKnowledgeSourceBoost", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceFieldValueBoost": "Search.SearchIndexKnowledgeSourceFieldValueBoost", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceFilterHint": "Search.SearchIndexKnowledgeSourceFilterHint", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceMultiWordExpressionBoost": "Search.SearchIndexKnowledgeSourceMultiWordExpressionBoost", "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceParameters": "Search.SearchIndexKnowledgeSourceParameters", "azure.search.documents.knowledgebases.models.SearchIndexKnowledgeSourceParams": "Search.SearchIndexKnowledgeSourceParams", + "azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints": "Search.SearchIndexKnowledgeSourceQueryHints", "azure.search.documents.indexes.models.SearchResourceEncryptionKey": "Search.SearchResourceEncryptionKey", "azure.search.documents.models.SearchResult": "Search.SearchResult", "azure.search.documents.models.VectorThreshold": "Search.VectorThreshold", @@ -307,6 +323,7 @@ "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.knowledgebases.models.ServedImage": "Search.ServedImage", "azure.search.documents.indexes.models.ServiceIndexersRuntime": "Search.ServiceIndexersRuntime", "azure.search.documents.indexes.models.ShaperSkill": "Search.ShaperSkill", "azure.search.documents.indexes.models.SharePointConnectorAppRegistration": "Search.SharePointConnectorAppRegistration", @@ -333,6 +350,8 @@ "azure.search.documents.indexes.models.TruncateTokenFilter": "Search.TruncateTokenFilter", "azure.search.documents.indexes.models.UaxUrlEmailTokenizer": "Search.UaxUrlEmailTokenizer", "azure.search.documents.indexes.models.UniqueTokenFilter": "Search.UniqueTokenFilter", + "azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest": "Search.UpdateKnowledgeSourceFileRequest", + "azure.search.documents.indexes.models.UploadKnowledgeSourceFileMultipartRequest": "Search.UploadKnowledgeSourceFileMultipartRequest", "azure.search.documents.models.VectorQuery": "Search.VectorQuery", "azure.search.documents.models.VectorizableImageBinaryQuery": "Search.VectorizableImageBinaryQuery", "azure.search.documents.models.VectorizableImageUrlQuery": "Search.VectorizableImageUrlQuery", @@ -353,8 +372,8 @@ "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.indexes.models.WorkIQKnowledgeSourceParameters": "Search.WorkIQKnowledgeSourceParameters", "azure.search.documents.knowledgebases.models.WorkIQKnowledgeSourceParams": "Search.WorkIQKnowledgeSourceParams", "azure.search.documents.models.QueryType": "Search.QueryType", "azure.search.documents.models.ScoringStatistics": "Search.ScoringStatistics", @@ -375,6 +394,7 @@ "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.ListingSearchType": "Search.ListingSearchType", "azure.search.documents.models.SearchFieldDataType": "Search.SearchFieldDataType", "azure.search.documents.models.PermissionFilter": "Search.PermissionFilter", "azure.search.documents.models.LexicalAnalyzerName": "Search.LexicalAnalyzerName", @@ -409,19 +429,22 @@ "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.KnowledgeSourceResultsProcessing": "Search.KnowledgeSourceResultsProcessing", "azure.search.documents.models.KnowledgeSourceIngestionPermissionOption": "Search.KnowledgeSourceIngestionPermissionOption", "azure.search.documents.models.KnowledgeSourceContentExtractionMode": "Search.KnowledgeSourceContentExtractionMode", + "azure.search.documents.models.KnowledgeSourceNetworkAccessMode": "Search.KnowledgeSourceNetworkAccessMode", + "azure.search.documents.models.SearchIndexKnowledgeSourceBoostKind": "Search.SearchIndexKnowledgeSourceBoostKind", "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.BlobIndexerParsingMode": "Search.BlobIndexerParsingMode", + "azure.search.documents.models.FileKnowledgeSourceExtractionMode": "Search.FileKnowledgeSourceExtractionMode", "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", "azure.search.documents.models.BlobIndexerDataToExtract": "Search.BlobIndexerDataToExtract", @@ -461,6 +484,7 @@ "azure.search.documents.models.KnowledgeBaseActivityRecordType": "Search.KnowledgeBaseActivityRecordType", "azure.search.documents.models.KnowledgeBaseReferenceType": "Search.KnowledgeBaseReferenceType", "azure.search.documents.models.KnowledgeRetrievalIntentType": "Search.KnowledgeRetrievalIntentType", + "azure.search.documents.models.KnowledgeBaseRetrievalStatusCode": "Search.KnowledgeBaseRetrievalStatusCode", "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", @@ -493,8 +517,12 @@ "azure.search.documents.aio.SearchIndexClient.create_knowledge_source": "Customizations.SearchIndexClient.createKnowledgeSource", "azure.search.documents.SearchIndexClient.get_knowledge_source_status": "Customizations.SearchIndexClient.getKnowledgeSourceStatus", "azure.search.documents.aio.SearchIndexClient.get_knowledge_source_status": "Customizations.SearchIndexClient.getKnowledgeSourceStatus", + "azure.search.documents.SearchIndexClient.upload_knowledge_source_file_multipart": "Customizations.SearchIndexClient.uploadKnowledgeSourceFileMultipart", + "azure.search.documents.aio.SearchIndexClient.upload_knowledge_source_file_multipart": "Customizations.SearchIndexClient.uploadKnowledgeSourceFileMultipart", "azure.search.documents.SearchIndexClient.list_knowledge_source_files": "Customizations.SearchIndexClient.listKnowledgeSourceFiles", "azure.search.documents.aio.SearchIndexClient.list_knowledge_source_files": "Customizations.SearchIndexClient.listKnowledgeSourceFiles", + "azure.search.documents.SearchIndexClient.update_knowledge_source_file": "Customizations.SearchIndexClient.updateKnowledgeSourceFile", + "azure.search.documents.aio.SearchIndexClient.update_knowledge_source_file": "Customizations.SearchIndexClient.updateKnowledgeSourceFile", "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", @@ -518,6 +546,9 @@ "azure.search.documents.SearchIndexerClient.create_skillset": "Customizations.SearchIndexerClient.createSkillset", "azure.search.documents.aio.SearchIndexerClient.create_skillset": "Customizations.SearchIndexerClient.createSkillset", "azure.search.documents.KnowledgeBaseRetrievalClient.retrieve": "Customizations.KnowledgeBaseRetrievalClient.retrieve", - "azure.search.documents.aio.KnowledgeBaseRetrievalClient.retrieve": "Customizations.KnowledgeBaseRetrievalClient.retrieve" - } + "azure.search.documents.aio.KnowledgeBaseRetrievalClient.retrieve": "Customizations.KnowledgeBaseRetrievalClient.retrieve", + "azure.search.documents.KnowledgeBaseRetrievalClient.retrieve_stream": "Customizations.KnowledgeBaseRetrievalClient.retrieveStream", + "azure.search.documents.aio.KnowledgeBaseRetrievalClient.retrieve_stream": "Customizations.KnowledgeBaseRetrievalClient.retrieveStream" + }, + "CrossLanguageVersion": "989eb0de7d67" } \ No newline at end of file diff --git a/sdk/search/azure-search-documents/assets.json b/sdk/search/azure-search-documents/assets.json index 7cda7e51d5b0..87064b838664 100644 --- a/sdk/search/azure-search-documents/assets.json +++ b/sdk/search/azure-search-documents/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/search/azure-search-documents", - "Tag": "python/search/azure-search-documents_199a6c97e6" + "Tag": "python/search/azure-search-documents_a3f89a168c" } 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 8db5c60f68dd..64d9a3865607 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_client.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,11 +19,16 @@ from ._operations import _SearchClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential -class SearchClient(_SearchClientOperationsMixin): +class SearchClient(_SearchClientOperationsMixin): # pylint: disable=docstring-keyword-should-match-keyword-only """SearchClient. :param endpoint: The endpoint URL of the search service. Required. @@ -35,8 +40,9 @@ class SearchClient(_SearchClientOperationsMixin): :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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 13fad1111791..85b237927565 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_configuration.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_configuration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -17,7 +18,7 @@ from azure.core.credentials import TokenCredential -class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes +class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for SearchClient. Note that all parameters used to create this instance are saved as instance @@ -32,15 +33,16 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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-05-01-preview") + api_version: str = kwargs.pop("api_version", "2026-08-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 ac4d9c19342f..78daae5ea45a 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 @@ -27,7 +27,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict -from .. import models as _models1 +from .. import models as _models1, types as _types_models1 from .._configuration import SearchClientConfiguration from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Serializer @@ -47,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -108,7 +108,7 @@ def build_search_search_get_request( # pylint: disable=too-many-locals,too-many _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -210,7 +210,7 @@ def build_search_search_post_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -251,7 +251,7 @@ def build_search_get_document_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -300,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -346,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -374,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -415,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -459,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=none") # Construct URL @@ -564,7 +564,7 @@ def get_document_count(self, **kwargs: Any) -> int: "semantic_fields", ] }, - api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) def _search_get( # pylint: disable=too-many-locals self, @@ -894,7 +894,7 @@ def _search_post( # pylint: disable=too-many-locals @overload def _search_post( self, - body: JSON, + body: _types_models1.SearchPostRequest, *, query_source_authorization: Optional[str] = None, enable_elevated_read: Optional[bool] = None, @@ -915,11 +915,11 @@ def _search_post( @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"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) def _search_post( # pylint: disable=too-many-locals self, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types_models1.SearchPostRequest, IO[bytes]] = _Unset, *, query_source_authorization: Optional[str] = None, enable_elevated_read: Optional[bool] = None, @@ -960,8 +960,8 @@ def _search_post( # pylint: disable=too-many-locals ) -> _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] + :param body: Is one of the following types: JSON, SearchPostRequest, IO[bytes] Required. + :type body: JSON or ~azure.search.documents.types.SearchPostRequest 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. @@ -1219,7 +1219,7 @@ def _search_post( # pylint: disable=too-many-locals @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"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) def get_document( self, @@ -1462,7 +1462,7 @@ def _suggest_post( ) -> _models1._models.SuggestDocumentsResult: ... @overload def _suggest_post( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: _types_models1.SuggestPostRequest, *, content_type: str = "application/json", **kwargs: Any ) -> _models1._models.SuggestDocumentsResult: ... @overload def _suggest_post( @@ -1472,7 +1472,7 @@ def _suggest_post( @distributed_trace def _suggest_post( # pylint: disable=too-many-locals self, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types_models1.SuggestPostRequest, IO[bytes]] = _Unset, *, search_text: str = _Unset, suggester_name: str = _Unset, @@ -1489,8 +1489,8 @@ def _suggest_post( # pylint: disable=too-many-locals ) -> _models1._models.SuggestDocumentsResult: """Suggests documents in the index that match the given partial query text. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is one of the following types: JSON, SuggestPostRequest, IO[bytes] Required. + :type body: JSON or ~azure.search.documents.types.SuggestPostRequest or IO[bytes] :keyword search_text: The search text to use to suggest documents. Must be at least 1 character, and no more than 100 characters. Required. :paramtype search_text: str @@ -1631,7 +1631,7 @@ def _index( ) -> _models1._models.IndexDocumentsResult: ... @overload def _index( - self, batch: JSON, *, content_type: str = "application/json", **kwargs: Any + self, batch: _types_models1.IndexDocumentsBatch, *, content_type: str = "application/json", **kwargs: Any ) -> _models1._models.IndexDocumentsResult: ... @overload def _index( @@ -1640,13 +1640,14 @@ def _index( @distributed_trace def _index( - self, batch: Union[_models1.IndexDocumentsBatch, JSON, IO[bytes]], **kwargs: Any + self, batch: Union[_models1.IndexDocumentsBatch, _types_models1.IndexDocumentsBatch, IO[bytes]], **kwargs: Any ) -> _models1._models.IndexDocumentsResult: """Sends a batch of document write actions to the index. - :param batch: The batch of index actions. Is one of the following types: IndexDocumentsBatch, - JSON, IO[bytes] Required. - :type batch: ~azure.search.documents.models.IndexDocumentsBatch or JSON or IO[bytes] + :param batch: The batch of index actions. Is either a IndexDocumentsBatch type or a IO[bytes] + type. Required. + :type batch: ~azure.search.documents.models.IndexDocumentsBatch or + ~azure.search.documents.types.IndexDocumentsBatch or IO[bytes] :return: IndexDocumentsResult. The IndexDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models._models.IndexDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1862,7 +1863,7 @@ def _autocomplete_post( ) -> _models1._models.AutocompleteResult: ... @overload def _autocomplete_post( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: _types_models1.AutocompletePostRequest, *, content_type: str = "application/json", **kwargs: Any ) -> _models1._models.AutocompleteResult: ... @overload def _autocomplete_post( @@ -1872,7 +1873,7 @@ def _autocomplete_post( @distributed_trace def _autocomplete_post( # pylint: disable=too-many-locals self, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types_models1.AutocompletePostRequest, IO[bytes]] = _Unset, *, search_text: str = _Unset, suggester_name: str = _Unset, @@ -1888,8 +1889,8 @@ def _autocomplete_post( # pylint: disable=too-many-locals ) -> _models1._models.AutocompleteResult: """Autocompletes incomplete query terms based on input text and matching terms in the index. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is one of the following types: JSON, AutocompletePostRequest, IO[bytes] Required. + :type body: JSON or ~azure.search.documents.types.AutocompletePostRequest or IO[bytes] :keyword search_text: The search text on which to base autocomplete results. Required. :paramtype search_text: str :keyword suggester_name: The name of the suggester as specified in the suggesters collection 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 a0e6587db9f7..94dde1147809 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 @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List, Optional, Union, cast import base64 import itertools @@ -248,7 +249,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-05-01-preview") + self._api_version = kwargs.get("api_version", "2026-08-01-preview") def _get_next_cb(self, continuation_token): if continuation_token is None: @@ -372,7 +373,7 @@ def index_documents(self, batch: _models.IndexDocumentsBatch, **kwargs: Any) -> :param batch: A batch of document operations to perform. :type batch: IndexDocumentsBatch :return: List of IndexingResult - :rtype: list[IndexingResult] + :rtype: list[~azure.search.documents.types.IndexingResult] :raises ~azure.search.documents.RequestEntityTooLargeError: The request is too large. """ 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 9fbd081e9f8e..fa5948ba249f 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Union, List, Dict, Optional, cast from enum import Enum import time @@ -41,10 +42,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" + V2026_08_01_PREVIEW = "2026-08-01-preview" -DEFAULT_VERSION = ApiVersion.V2026_05_01_PREVIEW +DEFAULT_VERSION = ApiVersion.V2026_08_01_PREVIEW class SearchClient(_SearchClient): @@ -59,9 +60,9 @@ class SearchClient(_SearchClient): :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is - ``ApiVersion.V2026_05_01_PREVIEW``. Note that overriding this default value may - result in unsupported behavior. + listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is + ``ApiVersion.V2026_08_01_PREVIEW``. Note that overriding this default value may + result in unsupported behavior. :paramtype api_version: str or ~azure.search.documents.ApiVersion :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 @@ -165,7 +166,7 @@ def __repr__(self) -> str: def actions(self) -> List[IndexAction]: """The list of currently index actions in queue to index. - :rtype: list[IndexAction] + :rtype: list[~azure.search.documents.types.IndexAction] """ return self._index_documents_batch.actions if self._index_documents_batch.actions else [] @@ -327,7 +328,7 @@ def index_documents(self, batch: IndexDocumentsBatch, **kwargs) -> List[Indexing :param batch: A batch of document operations to perform. :type batch: IndexDocumentsBatch :return: Indexing result of each action in the batch. - :rtype: list[IndexingResult] + :rtype: list[~azure.search.documents.types.IndexingResult] :raises ~azure.search.documents.RequestEntityTooLargeError: The request is too large. """ return self._index_documents_actions(actions=batch.actions if batch.actions else [], **kwargs) 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 db24930fdca9..35d5fc024978 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 @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -104,6 +109,29 @@ def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: return encoded +def _serialize_duration(td: timedelta, format: typing.Optional[str] = None): + """Serialize a timedelta to its wire representation. + + For the ``seconds``/``milliseconds`` encodings the value is converted to a + numeric value, otherwise it falls back to an ISO 8601 duration string. + + :param timedelta td: The timedelta to serialize. + :param str format: The duration encoding format. + :rtype: int or float or str + :return: serialized duration + """ + seconds = td.total_seconds() + if format == "duration-seconds-int": + return int(seconds) + if format == "duration-seconds-float": + return seconds + if format == "duration-milliseconds-int": + return int(seconds * 1000) + if format == "duration-milliseconds-float": + return seconds * 1000 + return _timedelta_as_isostr(td) + + def _serialize_datetime(o, format: typing.Optional[str] = None): if hasattr(o, "year") and hasattr(o, "hour"): if format == "rfc7231": @@ -130,7 +158,15 @@ def _is_readonly(p): class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" + """A JSON encoder that's capable of serializing datetime objects and bytes. + + :param args: Additional positional arguments passed to the base ``JSONEncoder``. + :type args: typing.Any + :keyword exclude_readonly: Whether to exclude readonly properties. Defaults to False. + :paramtype exclude_readonly: bool + :keyword format: The format to use for serialization. Defaults to None. + :paramtype format: typing.Optional[str] + """ def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): super().__init__(*args, **kwargs) @@ -296,6 +332,12 @@ def _deserialize_duration(attr): return isodate.parse_duration(attr) +def _deserialize_duration_numeric(attr, unit): + if isinstance(attr, timedelta): + return attr + return timedelta(**{unit: float(attr)}) + + def _deserialize_decimal(attr): if isinstance(attr, decimal.Decimal): return attr @@ -308,6 +350,12 @@ def _deserialize_int_as_str(attr): return int(attr) +def _deserialize_bool_as_str(attr): + if isinstance(attr, bool): + return attr + return attr.lower() == "true" + + _DESERIALIZE_MAPPING = { datetime: _deserialize_datetime, date: _deserialize_date, @@ -325,12 +373,18 @@ def _deserialize_int_as_str(attr): "unix-timestamp": _deserialize_datetime_unix_timestamp, "base64": _deserialize_bytes, "base64url": _deserialize_bytes_base64, + "duration-seconds-int": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-seconds-float": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-milliseconds-int": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), + "duration-milliseconds-float": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), } def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): if annotation is int and rf and rf._format == "str": return _deserialize_int_as_str + if annotation is bool and rf and rf._format == "str": + return _deserialize_bool_as_str if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) if rf and rf._format: @@ -420,21 +474,21 @@ def __ne__(self, other: typing.Any) -> bool: def keys(self) -> typing.KeysView[str]: """ - :returns: a set-like object providing a view on D's keys + :returns: a set-like object providing a view on the mapping's keys :rtype: ~typing.KeysView """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: """ - :returns: an object providing a view on D's values + :returns: an object providing a view on the mapping's values :rtype: ~typing.ValuesView """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: """ - :returns: set-like object providing a view on D's items + :returns: a set-like object providing a view on the mapping's items :rtype: ~typing.ItemsView """ return self._data.items() @@ -444,7 +498,7 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ try: @@ -479,19 +533,19 @@ def popitem(self) -> tuple[str, typing.Any]: Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple - :raises KeyError: if D is empty. + :raises KeyError: if the dictionary is empty. """ return self._data.popitem() def clear(self) -> None: """ - Remove all items from D. + Remove all items from the dictionary. """ self._data.clear() def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ """ - Updates D from mapping/iterable E and F. + Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs. """ self._data.update(*args, **kwargs) @@ -504,10 +558,11 @@ def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: """ - Same as calling D.get(k, d), and setting D[k]=d if k not found + Return the value for key if key is in the dictionary; otherwise set the key to + default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ if default is _UNSET: @@ -559,7 +614,7 @@ def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-m pass # Last, try datetime.timedelta try: - return _timedelta_as_isostr(o) + return _serialize_duration(o, format) except AttributeError: # This will be raised when it hits value.total_seconds in the method above pass @@ -585,6 +640,239 @@ def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typin return _serialize(value, rf._format) +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param class Model(_MyMutableMapping): _is_model = True # label whether current class's _attr_to_rest_field has been calculated @@ -595,11 +883,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -619,9 +903,19 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if v is not None } ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) super().__init__(dict_to_pass) - def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: """Deserialize an XML element into a dict mapping rest field names to values. :param ET.Element element: The XML element to deserialize from. @@ -629,53 +923,89 @@ def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: :rtype: dict """ result: dict[str, typing.Any] = {} - model_meta = getattr(self, "_xml", {}) existed_attr_keys: list[str] = [] - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) + result[rf._rest_name] = _deserialize(rf._type, item) # rest thing is additional properties for e in element: @@ -708,6 +1038,9 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: if not rf._rest_name_input: rf._rest_name_input = attr cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) @@ -1082,6 +1415,7 @@ def __init__( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ): self._type = type self._rest_name_input = name @@ -1094,6 +1428,7 @@ def __init__( self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._deserializer = deserializer @property def _class_type(self) -> typing.Any: @@ -1113,7 +1448,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: @@ -1126,7 +1464,11 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # Return the value from _data directly (it's been deserialized in place) return obj._data.get(self._rest_name) - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) # For mutable types, store the deserialized value back in _data # so mutations directly affect _data @@ -1172,6 +1514,7 @@ def rest_field( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ) -> typing.Any: return _RestField( name=name, @@ -1181,6 +1524,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + deserializer=deserializer, ) @@ -1414,6 +1758,8 @@ def _deserialize_xml( value: str, ) -> typing.Any: element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) return _deserialize(deserializer, element) diff --git a/sdk/search/azure-search-documents/azure/search/documents/_utils/serialization.py b/sdk/search/azure-search-documents/azure/search/documents/_utils/serialization.py index 81ec1de5922b..ae08f9d89f74 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_utils/serialization.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -476,7 +480,11 @@ def _decode_attribute_map_key(key): class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" + """Request object model serializer. + + :param classes: Mapping of model names to model types, used to resolve models during serialization. + :type classes: typing.Optional[typing.Mapping[str, type]] + """ basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -516,6 +524,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Serializer.serialize_rfc, "unix-time": Serializer.serialize_unix, "duration": Serializer.serialize_duration, + "duration-seconds-int": Serializer.serialize_duration_seconds_int, + "duration-seconds-float": Serializer.serialize_duration_seconds_float, + "duration-milliseconds-int": Serializer.serialize_duration_milliseconds_int, + "duration-milliseconds-float": Serializer.serialize_duration_milliseconds_float, "date": Serializer.serialize_date, "time": Serializer.serialize_time, "decimal": Serializer.serialize_decimal, @@ -1105,6 +1117,61 @@ def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) + @staticmethod + def _serialize_duration_numeric(attr, scale, as_int): + """Serialize a TimeDelta into a numeric value scaled to the wire unit. + + :param TimeDelta attr: Object to be serialized. + :param int scale: Multiplier applied to total seconds (1 for seconds, 1000 for milliseconds). + :param bool as_int: Whether to truncate the result to an int. + :rtype: int or float + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + value = attr.total_seconds() * scale if isinstance(attr, datetime.timedelta) else attr + return int(value) if as_int else float(value) + + @staticmethod + def serialize_duration_seconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, True) + + @staticmethod + def serialize_duration_seconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, False) + + @staticmethod + def serialize_duration_milliseconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, True) + + @staticmethod + def serialize_duration_milliseconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, False) + @staticmethod def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. @@ -1377,6 +1444,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Deserializer.deserialize_rfc, "unix-time": Deserializer.deserialize_unix, "duration": Deserializer.deserialize_duration, + "duration-seconds-int": Deserializer.deserialize_duration_seconds, + "duration-seconds-float": Deserializer.deserialize_duration_seconds, + "duration-milliseconds-int": Deserializer.deserialize_duration_milliseconds, + "duration-milliseconds-float": Deserializer.deserialize_duration_milliseconds, "date": Deserializer.deserialize_date, "time": Deserializer.deserialize_time, "decimal": Deserializer.deserialize_decimal, @@ -1389,6 +1460,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: } self.deserialize_expected_types = { "duration": (isodate.Duration, datetime.timedelta), + "duration-seconds-int": (isodate.Duration, datetime.timedelta), + "duration-seconds-float": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-int": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-float": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } self.dependencies: dict[str, type] = dict(classes) if classes else {} @@ -1401,7 +1476,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1411,6 +1486,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) @@ -1929,6 +2025,48 @@ def deserialize_duration(attr): raise DeserializationError(msg) from err return duration + @staticmethod + def _deserialize_duration_numeric(attr, unit): + """Deserialize a numeric duration value into a TimeDelta object. + + :param float attr: response value to be deserialized. + :param str unit: The wire unit, used as the ``timedelta`` keyword + (``"seconds"`` or ``"milliseconds"``). + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = datetime.timedelta(**{unit: float(attr)}) # type: ignore + except (ValueError, OverflowError, TypeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_duration_seconds(attr): + """Deserialize a numeric number of seconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "seconds") + + @staticmethod + def deserialize_duration_milliseconds(attr): + """Deserialize a numeric number of milliseconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "milliseconds") + @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. diff --git a/sdk/search/azure-search-documents/azure/search/documents/_utils/utils.py b/sdk/search/azure-search-documents/azure/search/documents/_utils/utils.py index 927adb7c8ae2..b0131200252f 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/_utils/utils.py +++ b/sdk/search/azure-search-documents/azure/search/documents/_utils/utils.py @@ -6,10 +6,14 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import Generic, Optional, TYPE_CHECKING, TypeVar +import json +import os +from typing import Any, Generic, IO, Mapping, Optional, TYPE_CHECKING, TypeVar, Union from azure.core import MatchConditions +from .._utils.model_base import Model, SdkJSONEncoder + if TYPE_CHECKING: from .serialization import Deserializer, Serializer @@ -55,3 +59,81 @@ def prep_if_none_match(etag: Optional[str], match_condition: Optional[MatchCondi if match_condition == MatchConditions.IfMissing: return "*" return None + + +# file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)` +FileContent = Union[str, bytes, IO[str], IO[bytes]] + +FileType = Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + tuple[Optional[str], FileContent], + # (filename, file (or bytes), content_type) + tuple[Optional[str], FileContent, Optional[str]], +] + + +def serialize_multipart_data_entry(data_entry: Any) -> Any: + if isinstance(data_entry, (list, tuple, dict, Model)): + return json.dumps(data_entry, cls=SdkJSONEncoder, exclude_readonly=True) + return data_entry + + +def _normalize_multipart_file_entry(field_name: str, entry: Any, index: int) -> Any: + """Ensure a multipart file entry carries a filename for Content-Disposition. + + Servers distinguish file parts from plain form fields by the presence of + ``filename=`` in the ``Content-Disposition`` header. When callers pass + bare bytes/str/IO the HTTP client omits the filename and the server may + reject the upload. This helper wraps bare values into a (filename, content) + tuple, deriving the name from IO.name when available. + + :param str field_name: The multipart field name used as a filename fallback. + :param entry: The user-provided file entry (tuple, bytes, str, or IO). + :type entry: any + :param int index: The positional index of the entry within the field, used + to disambiguate fallback filenames when multiple entries are provided. + :return: Either the original tuple entry, or a ``(filename, content)`` tuple + wrapping the bare value. + :rtype: any + """ + if isinstance(entry, tuple): + return entry + filename: Optional[str] = None + name_attr = getattr(entry, "name", None) + if isinstance(name_attr, str) and name_attr: + filename = os.path.basename(name_attr) + if not filename: + filename = f"{field_name}_{index}" if index else field_name + + # Return a 3-tuple with an explicit "application/octet-stream" content type. + # A 2-tuple (filename, content) would leave the part's Content-Type unset, and + # the sdk core library only defaults to "application/octet-stream" for bare + # (non-tuple) values - a tuple bypasses that default and falls back to the + # HTTP "text/plain" default instead. Setting it explicitly preserves the + # pre-existing behavior for bare bytes/IO across all transports. + return (filename, entry, "application/octet-stream") + + +def prepare_multipart_form_data( + body: Mapping[str, Any], multipart_fields: list[str], data_fields: list[str] +) -> list[FileType]: + files: list[FileType] = [] + + # Data fields first so streaming server-side parsers see metadata before + # binary file parts. + for data_field in data_fields: + data_entry = body.get(data_field) + if data_entry: + files.append((data_field, str(serialize_multipart_data_entry(data_entry)))) + + for multipart_field in multipart_fields: + multipart_entry = body.get(multipart_field) + if isinstance(multipart_entry, list): + for idx, e in enumerate(multipart_entry): + files.append((multipart_field, _normalize_multipart_file_entry(multipart_field, e, idx))) + elif multipart_entry is not None: + files.append((multipart_field, _normalize_multipart_file_entry(multipart_field, multipart_entry, 0))) + + return files 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 0c9271c6af74..2258b7f1fed2 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 @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,11 +19,16 @@ from ._configuration import SearchClientConfiguration from ._operations import _SearchClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential -class SearchClient(_SearchClientOperationsMixin): +class SearchClient(_SearchClientOperationsMixin): # pylint: disable=docstring-keyword-should-match-keyword-only """SearchClient. :param endpoint: The endpoint URL of the search service. Required. @@ -35,8 +40,9 @@ class SearchClient(_SearchClientOperationsMixin): :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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 f76517b9b88f..ddd5e3e5cedc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -17,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes +class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for SearchClient. Note that all parameters used to create this instance are saved as instance @@ -32,8 +33,9 @@ class SearchClientConfiguration: # pylint: disable=too-many-instance-attributes :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -44,7 +46,7 @@ def __init__( index_name: str, **kwargs: Any, ) -> None: - api_version: str = kwargs.pop("api_version", "2026-05-01-preview") + api_version: str = kwargs.pop("api_version", "2026-08-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 55e638a61cfe..4943ac4c4c80 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 @@ -27,7 +27,7 @@ from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict -from ... import models as _models2 +from ... import models as _models2, types as _types_models2 from ..._operations._operations import ( build_search_autocomplete_get_request, build_search_autocomplete_post_request, @@ -132,7 +132,7 @@ async def get_document_count(self, **kwargs: Any) -> int: "semantic_fields", ] }, - api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) async def _search_get( # pylint: disable=too-many-locals self, @@ -462,7 +462,7 @@ async def _search_post( # pylint: disable=too-many-locals @overload async def _search_post( self, - body: JSON, + body: _types_models2.SearchPostRequest, *, query_source_authorization: Optional[str] = None, enable_elevated_read: Optional[bool] = None, @@ -483,11 +483,11 @@ async def _search_post( @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"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) async def _search_post( # pylint: disable=too-many-locals self, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types_models2.SearchPostRequest, IO[bytes]] = _Unset, *, query_source_authorization: Optional[str] = None, enable_elevated_read: Optional[bool] = None, @@ -528,8 +528,8 @@ async def _search_post( # pylint: disable=too-many-locals ) -> _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] + :param body: Is one of the following types: JSON, SearchPostRequest, IO[bytes] Required. + :type body: JSON or ~azure.search.documents.types.SearchPostRequest 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. @@ -787,7 +787,7 @@ async def _search_post( # pylint: disable=too-many-locals @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"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) async def get_document( self, @@ -1030,7 +1030,7 @@ async def _suggest_post( ) -> _models2._models.SuggestDocumentsResult: ... @overload async def _suggest_post( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: _types_models2.SuggestPostRequest, *, content_type: str = "application/json", **kwargs: Any ) -> _models2._models.SuggestDocumentsResult: ... @overload async def _suggest_post( @@ -1040,7 +1040,7 @@ async def _suggest_post( @distributed_trace_async async def _suggest_post( # pylint: disable=too-many-locals self, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types_models2.SuggestPostRequest, IO[bytes]] = _Unset, *, search_text: str = _Unset, suggester_name: str = _Unset, @@ -1057,8 +1057,8 @@ async def _suggest_post( # pylint: disable=too-many-locals ) -> _models2._models.SuggestDocumentsResult: """Suggests documents in the index that match the given partial query text. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is one of the following types: JSON, SuggestPostRequest, IO[bytes] Required. + :type body: JSON or ~azure.search.documents.types.SuggestPostRequest or IO[bytes] :keyword search_text: The search text to use to suggest documents. Must be at least 1 character, and no more than 100 characters. Required. :paramtype search_text: str @@ -1199,7 +1199,7 @@ async def _index( ) -> _models2._models.IndexDocumentsResult: ... @overload async def _index( - self, batch: JSON, *, content_type: str = "application/json", **kwargs: Any + self, batch: _types_models2.IndexDocumentsBatch, *, content_type: str = "application/json", **kwargs: Any ) -> _models2._models.IndexDocumentsResult: ... @overload async def _index( @@ -1208,13 +1208,14 @@ async def _index( @distributed_trace_async async def _index( - self, batch: Union[_models2.IndexDocumentsBatch, JSON, IO[bytes]], **kwargs: Any + self, batch: Union[_models2.IndexDocumentsBatch, _types_models2.IndexDocumentsBatch, IO[bytes]], **kwargs: Any ) -> _models2._models.IndexDocumentsResult: """Sends a batch of document write actions to the index. - :param batch: The batch of index actions. Is one of the following types: IndexDocumentsBatch, - JSON, IO[bytes] Required. - :type batch: ~azure.search.documents.models.IndexDocumentsBatch or JSON or IO[bytes] + :param batch: The batch of index actions. Is either a IndexDocumentsBatch type or a IO[bytes] + type. Required. + :type batch: ~azure.search.documents.models.IndexDocumentsBatch or + ~azure.search.documents.types.IndexDocumentsBatch or IO[bytes] :return: IndexDocumentsResult. The IndexDocumentsResult is compatible with MutableMapping :rtype: ~azure.search.documents.models._models.IndexDocumentsResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1430,7 +1431,7 @@ async def _autocomplete_post( ) -> _models2._models.AutocompleteResult: ... @overload async def _autocomplete_post( - self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, body: _types_models2.AutocompletePostRequest, *, content_type: str = "application/json", **kwargs: Any ) -> _models2._models.AutocompleteResult: ... @overload async def _autocomplete_post( @@ -1440,7 +1441,7 @@ async def _autocomplete_post( @distributed_trace_async async def _autocomplete_post( # pylint: disable=too-many-locals self, - body: Union[JSON, IO[bytes]] = _Unset, + body: Union[JSON, _types_models2.AutocompletePostRequest, IO[bytes]] = _Unset, *, search_text: str = _Unset, suggester_name: str = _Unset, @@ -1456,8 +1457,8 @@ async def _autocomplete_post( # pylint: disable=too-many-locals ) -> _models2._models.AutocompleteResult: """Autocompletes incomplete query terms based on input text and matching terms in the index. - :param body: Is either a JSON type or a IO[bytes] type. Required. - :type body: JSON or IO[bytes] + :param body: Is one of the following types: JSON, AutocompletePostRequest, IO[bytes] Required. + :type body: JSON or ~azure.search.documents.types.AutocompletePostRequest or IO[bytes] :keyword search_text: The search text on which to base autocomplete results. Required. :paramtype search_text: str :keyword suggester_name: The name of the suggester as specified in the suggesters collection 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 48fdf84c6519..21b39cbd1ec7 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 @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List, Optional, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncPageIterator, ReturnType @@ -55,7 +56,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-05-01-preview") + self._api_version = kwargs.get("api_version", "2026-08-01-preview") async def _get_next_cb(self, continuation_token): if continuation_token is None: @@ -189,7 +190,7 @@ async def index_documents(self, batch: _models.IndexDocumentsBatch, **kwargs: An :param batch: A batch of document operations to perform. :type batch: ~azure.search.documents.models.IndexDocumentsBatch :return: List of IndexingResult - :rtype: list[IndexingResult] + :rtype: list[~azure.search.documents.types.IndexingResult] :raises ~azure.search.documents.RequestEntityTooLargeError: The request is too large. """ 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 769641727b2f..cead743f44b8 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 @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Union, List, Dict, Optional, cast import asyncio # pylint: disable=do-not-import-asyncio @@ -36,9 +37,9 @@ class SearchClient(_SearchClient): :param index_name: The name of the index. Required. :type index_name: str :keyword api_version: The API version to use for this operation. Known values are - listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is - ``ApiVersion.V2026_05_01_PREVIEW``. Note that overriding this default value may - result in unsupported behavior. + listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is + ``ApiVersion.V2026_08_01_PREVIEW``. Note that overriding this default value may + result in unsupported behavior. :paramtype api_version: str or ~azure.search.documents.ApiVersion :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 @@ -150,7 +151,7 @@ def __repr__(self) -> str: def actions(self) -> List[IndexAction]: """The list of currently index actions in queue to index. - :rtype: list[IndexAction] + :rtype: list[~azure.search.documents.types.IndexAction] """ return self._index_documents_batch.actions if self._index_documents_batch.actions else [] @@ -307,7 +308,7 @@ async def index_documents(self, batch: IndexDocumentsBatch, **kwargs) -> List[In :param batch: A batch of document operations to perform. :type batch: ~azure.search.documents.models.IndexDocumentsBatch :return: Indexing result of each action in the batch. - :rtype: list[IndexingResult] + :rtype: list[~azure.search.documents.types.IndexingResult] :raises ~azure.search.documents.RequestEntityTooLargeError: The request is too large. """ return await self._index_documents_actions(actions=batch.actions if batch.actions else [], **kwargs) 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 f03893069315..8459f987eccf 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 @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,11 +19,18 @@ from ._configuration import SearchIndexClientConfiguration, SearchIndexerClientConfiguration from ._operations import _SearchIndexClientOperationsMixin, _SearchIndexerClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential -class SearchIndexClient(_SearchIndexClientOperationsMixin): +class SearchIndexClient( + _SearchIndexClientOperationsMixin +): # pylint: disable=docstring-keyword-should-match-keyword-only """SearchIndexClient. :param endpoint: The endpoint URL of the search service. Required. @@ -33,8 +40,9 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -102,7 +110,9 @@ def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) -class SearchIndexerClient(_SearchIndexerClientOperationsMixin): +class SearchIndexerClient( + _SearchIndexerClientOperationsMixin +): # pylint: disable=docstring-keyword-should-match-keyword-only """SearchIndexerClient. :param endpoint: The endpoint URL of the search service. Required. @@ -112,8 +122,9 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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 7c1756d62618..4f84d2fcb079 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -17,7 +18,7 @@ from azure.core.credentials import TokenCredential -class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attributes +class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for SearchIndexClient. Note that all parameters used to create this instance are saved as instance @@ -30,13 +31,14 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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-05-01-preview") + api_version: str = kwargs.pop("api_version", "2026-08-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -72,7 +74,7 @@ def _configure(self, **kwargs: Any) -> None: self.authentication_policy = self._infer_policy(**kwargs) -class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-attributes +class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for SearchIndexerClient. Note that all parameters used to create this instance are saved as instance @@ -85,13 +87,14 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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-05-01-preview") + api_version: str = kwargs.pop("api_version", "2026-08-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 068e8567c539..79ba61ac3ec1 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 @@ -30,16 +30,15 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict -from .. import models as _models1 +from .. import models as _models1, types as _types_models1 from ... import models as _models2 -from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.model_base import Model as _Model, SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Serializer -from ..._utils.utils import ClientMixinABC, prep_if_match, prep_if_none_match +from ..._utils.utils import ClientMixinABC, prep_if_match, prep_if_none_match, prepare_multipart_form_data from ..._validation import api_version_validation from ...knowledgebases import models as _knowledgebases_models3 from .._configuration import SearchIndexClientConfiguration, SearchIndexerClientConfiguration -JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] @@ -55,7 +54,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -91,7 +90,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -124,7 +123,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -146,12 +145,17 @@ def build_search_index_get_synonym_map_request( # pylint: disable=name-too-long def build_search_index_get_synonym_maps_request( # pylint: disable=name-too-long - *, select: Optional[list[str]] = None, **kwargs: Any + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -161,6 +165,12 @@ def build_search_index_get_synonym_maps_request( # pylint: disable=name-too-lon _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if select is not None: _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -174,7 +184,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -205,7 +215,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -243,7 +253,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -274,7 +284,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -296,12 +306,16 @@ def build_search_index_get_index_request(name: str, **kwargs: Any) -> HttpReques def build_search_index_list_indexes_request( - *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None, **kwargs: Any + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -309,12 +323,12 @@ def build_search_index_list_indexes_request( # 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") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -326,15 +340,15 @@ def build_search_index_list_indexes_request( def build_search_index_list_indexes_with_selected_properties_request( # pylint: disable=name-too-long *, select: Optional[list[str]] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - count: Optional[bool] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -344,12 +358,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") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -363,7 +377,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -387,7 +401,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -413,7 +427,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -444,7 +458,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -480,7 +494,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -511,7 +525,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -532,11 +546,17 @@ def build_search_index_get_alias_request(name: str, **kwargs: Any) -> HttpReques return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_search_index_list_aliases_request(**kwargs: Any) -> HttpRequest: +def build_search_index_list_aliases_request( + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -544,6 +564,12 @@ def build_search_index_list_aliases_request(**kwargs: Any) -> HttpRequest: # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -557,7 +583,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -583,7 +609,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -619,7 +645,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -652,7 +678,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -673,11 +699,17 @@ def build_search_index_get_knowledge_base_request( # pylint: disable=name-too-l return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_search_index_list_knowledge_bases_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_search_index_list_knowledge_bases_request( # pylint: disable=name-too-long + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -685,6 +717,12 @@ def build_search_index_list_knowledge_bases_request(**kwargs: Any) -> HttpReques # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -698,7 +736,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -724,7 +762,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -760,7 +798,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -793,7 +831,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -814,11 +852,17 @@ def build_search_index_get_knowledge_source_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_search_index_list_knowledge_sources_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long +def build_search_index_list_knowledge_sources_request( # pylint: disable=name-too-long + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -826,6 +870,12 @@ def build_search_index_list_knowledge_sources_request(**kwargs: Any) -> HttpRequ # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -839,7 +889,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -863,7 +913,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -890,8 +940,8 @@ def build_search_index_upload_knowledge_source_file_request( # pylint: disable= _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: str = kwargs.pop("content_type") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + 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-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -906,20 +956,53 @@ def build_search_index_upload_knowledge_source_file_request( # pylint: disable= _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") + if content_type is not None: + _headers["content-type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Content-Disposition"] = _SERIALIZER.header("content_disposition", content_disposition, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_search_index_list_knowledge_source_files_request( # pylint: disable=name-too-long +def build_search_index_upload_knowledge_source_file_multipart_request( # pylint: disable=name-too-long 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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/knowledgesources('{sourceName}')/files" + path_format_arguments = { + "sourceName": _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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_search_index_list_knowledge_source_files_request( # pylint: disable=name-too-long + name: str, + *, + prefix: Optional[str] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -932,6 +1015,14 @@ def build_search_index_list_knowledge_source_files_request( # pylint: disable=n # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if prefix is not None: + _params["prefix"] = _SERIALIZER.query("prefix", prefix, "str") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -946,7 +1037,7 @@ def build_search_index_delete_knowledge_source_file_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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -968,11 +1059,38 @@ def build_search_index_delete_knowledge_source_file_request( # pylint: disable= return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_search_index_update_knowledge_source_file_request( # pylint: disable=name-too-long + file_id: str, 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-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/knowledgesources('{sourceName}')/files('{fileId}')" + path_format_arguments = { + "fileId": _SERIALIZER.url("file_id", file_id, "str"), + "sourceName": _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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + def build_search_index_get_service_statistics_request(**kwargs: Any) -> HttpRequest: # 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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -989,12 +1107,16 @@ def build_search_index_get_service_statistics_request(**kwargs: Any) -> HttpRequ 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 + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1002,12 +1124,12 @@ def build_search_index_list_index_stats_summary_request( # pylint: disable=name # 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") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -1029,7 +1151,7 @@ def build_search_indexer_create_or_update_data_source_connection_request( # pyl prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1069,7 +1191,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1102,7 +1224,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1124,12 +1246,17 @@ def build_search_indexer_get_data_source_connection_request( # pylint: disable= def build_search_indexer_get_data_source_connections_request( # pylint: disable=name-too-long - *, select: Optional[list[str]] = None, **kwargs: Any + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1139,6 +1266,12 @@ def build_search_indexer_get_data_source_connections_request( # pylint: disable _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if select is not None: _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -1154,7 +1287,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1178,7 +1311,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1204,7 +1337,7 @@ def build_search_indexer_resync_request(name: str, **kwargs: Any) -> HttpRequest _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1234,7 +1367,7 @@ def build_search_indexer_reset_documents_request( # pylint: disable=name-too-lo _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1263,7 +1396,7 @@ def build_search_indexer_run_indexer_request(name: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1298,7 +1431,7 @@ def build_search_indexer_create_or_update_indexer_request( # pylint: disable=na prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1342,7 +1475,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1373,7 +1506,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1395,12 +1528,17 @@ def build_search_indexer_get_indexer_request(name: str, **kwargs: Any) -> HttpRe def build_search_indexer_get_indexers_request( # pylint: disable=name-too-long - *, select: Optional[list[str]] = None, **kwargs: Any + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1410,6 +1548,12 @@ def build_search_indexer_get_indexers_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if select is not None: _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -1423,7 +1567,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1447,7 +1591,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1482,7 +1626,7 @@ def build_search_indexer_create_or_update_skillset_request( # pylint: disable=n prefer: Literal["return=representation"] = kwargs.pop("prefer", _headers.pop("Prefer", "return=representation")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1526,7 +1670,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1557,7 +1701,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1579,12 +1723,17 @@ def build_search_indexer_get_skillset_request(name: str, **kwargs: Any) -> HttpR def build_search_indexer_get_skillsets_request( # pylint: disable=name-too-long - *, select: Optional[list[str]] = None, **kwargs: Any + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1594,6 +1743,12 @@ def build_search_indexer_get_skillsets_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") if select is not None: _params["$select"] = _SERIALIZER.query("select", select, "[str]", div=",") + if search is not None: + _params["search"] = _SERIALIZER.query("search", search, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if search_type is not None: + _params["searchType"] = _SERIALIZER.query("search_type", search_type, "str") # Construct headers if accept is not None: @@ -1607,7 +1762,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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1630,7 +1785,7 @@ def build_search_indexer_reset_skills_request(name: str, **kwargs: Any) -> HttpR _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -1672,7 +1827,7 @@ def _create_or_update_synonym_map( def _create_or_update_synonym_map( self, name: str, - synonym_map: JSON, + synonym_map: _types_models1.SynonymMap, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -1695,7 +1850,7 @@ def _create_or_update_synonym_map( def _create_or_update_synonym_map( self, name: str, - synonym_map: Union[_models1.SynonymMap, JSON, IO[bytes]], + synonym_map: Union[_models1.SynonymMap, _types_models1.SynonymMap, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -1705,9 +1860,10 @@ def _create_or_update_synonym_map( :param name: The name of the synonym map. Required. :type name: str - :param synonym_map: The definition of the synonym map to create or update. Is one of the - following types: SynonymMap, JSON, IO[bytes] Required. - :type synonym_map: ~azure.search.documents.indexes.models.SynonymMap or JSON or IO[bytes] + :param synonym_map: The definition of the synonym map to create or update. Is either a + SynonymMap type or a IO[bytes] type. Required. + :type synonym_map: ~azure.search.documents.indexes.models.SynonymMap or + ~azure.search.documents.indexes.types.SynonymMap or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -1925,19 +2081,44 @@ def get_synonym_map(self, name: str, **kwargs: Any) -> _models1.SynonymMap: return deserialized # type: ignore @distributed_trace + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) def _get_synonym_maps( - self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> _models1._models.ListSynonymMapsResult: + self, + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = None, + **kwargs: Any, + ) -> ItemPaged["_models1.SynonymMap"]: """Lists all synonym maps 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] - :return: ListSynonymMapsResult. The ListSynonymMapsResult is compatible with MutableMapping - :rtype: ~azure.search.documents.indexes.models._models.ListSynonymMapsResult + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of SynonymMap + :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SynonymMap] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models1.SynonymMap]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1946,54 +2127,80 @@ def _get_synonym_maps( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models1._models.ListSynonymMapsResult] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_search_index_get_synonym_maps_request( - select=select, - 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) + _request = build_search_index_get_synonym_maps_request( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + 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) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models2.ErrorResponse, - response, + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models1.SynonymMap], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, iter(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize( - _models1._models.ListSynonymMapsResult, response.json() # pylint: disable=protected-access + 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 cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + 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 deserialized # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) @overload def create_synonym_map( @@ -2013,12 +2220,12 @@ def create_synonym_map( @overload def create_synonym_map( - self, synonym_map: JSON, *, content_type: str = "application/json", **kwargs: Any + self, synonym_map: _types_models1.SynonymMap, *, content_type: str = "application/json", **kwargs: Any ) -> _models1.SynonymMap: """Creates a new synonym map. :param synonym_map: The definition of the synonym map to create. Required. - :type synonym_map: JSON + :type synonym_map: ~azure.search.documents.indexes.types.SynonymMap :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2045,13 +2252,14 @@ def create_synonym_map( @distributed_trace def create_synonym_map( - self, synonym_map: Union[_models1.SynonymMap, JSON, IO[bytes]], **kwargs: Any + self, synonym_map: Union[_models1.SynonymMap, _types_models1.SynonymMap, IO[bytes]], **kwargs: Any ) -> _models1.SynonymMap: """Creates a new synonym map. - :param synonym_map: The definition of the synonym map to create. Is one of the following types: - SynonymMap, JSON, IO[bytes] Required. - :type synonym_map: ~azure.search.documents.indexes.models.SynonymMap or JSON or IO[bytes] + :param synonym_map: The definition of the synonym map to create. Is either a SynonymMap type or + a IO[bytes] type. Required. + :type synonym_map: ~azure.search.documents.indexes.models.SynonymMap or + ~azure.search.documents.indexes.types.SynonymMap or IO[bytes] :return: SynonymMap. The SynonymMap is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SynonymMap :raises ~azure.core.exceptions.HttpResponseError: @@ -2136,7 +2344,7 @@ def _create_or_update_index( def _create_or_update_index( self, name: str, - index: JSON, + index: _types_models1.SearchIndex, *, allow_index_downtime: Optional[bool] = None, content_type: str = "application/json", @@ -2161,7 +2369,7 @@ def _create_or_update_index( def _create_or_update_index( self, name: str, - index: Union[_models1.SearchIndex, JSON, IO[bytes]], + index: Union[_models1.SearchIndex, _types_models1.SearchIndex, IO[bytes]], *, allow_index_downtime: Optional[bool] = None, etag: Optional[str] = None, @@ -2172,9 +2380,10 @@ def _create_or_update_index( :param name: The name of the index. Required. :type name: str - :param index: The definition of the index to create or update. Is one of the following types: - SearchIndex, JSON, IO[bytes] Required. - :type index: ~azure.search.documents.indexes.models.SearchIndex or JSON or IO[bytes] + :param index: The definition of the index to create or update. Is either a SearchIndex type or + a IO[bytes] type. Required. + :type index: ~azure.search.documents.indexes.models.SearchIndex or + ~azure.search.documents.indexes.types.SearchIndex or IO[bytes] :keyword allow_index_downtime: Allows new analyzers, tokenizers, token filters, or char filters to be added to an index by taking the index offline for at least a few seconds. This temporarily causes indexing and query requests to fail. Performance and write availability of @@ -2402,22 +2611,32 @@ def get_index(self, name: str, **kwargs: Any) -> _models1.SearchIndex: @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"], + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": ["api_version", "accept", "search", "page_size", "search_type", "client_request_id"] + }, + api_versions_list=["2026-08-01-preview"], ) def _list_indexes( - self, *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None, **kwargs: Any + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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 + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of SearchIndex :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex] :raises ~azure.core.exceptions.HttpResponseError: @@ -2439,9 +2658,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_indexes_request( - top=top, - skip=skip, - count=count, + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2464,7 +2683,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -2508,16 +2730,27 @@ def get_next(next_link=None): @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"], + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": [ + "api_version", + "accept", + "select", + "search", + "page_size", + "search_type", + "client_request_id", + ] + }, + api_versions_list=["2026-08-01-preview"], ) def _list_indexes_with_selected_properties( self, *, select: Optional[list[str]] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - count: Optional[bool] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = None, **kwargs: Any, ) -> ItemPaged["_models1._models.SearchIndexResponse"]: """Lists all indexes available for a search service. @@ -2526,14 +2759,16 @@ 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 + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of SearchIndexResponse :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models._models.SearchIndexResponse] @@ -2557,9 +2792,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, + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2582,7 +2817,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -2642,12 +2880,12 @@ def create_index( @overload def create_index( - self, index: JSON, *, content_type: str = "application/json", **kwargs: Any + self, index: _types_models1.SearchIndex, *, content_type: str = "application/json", **kwargs: Any ) -> _models1.SearchIndex: """Creates a new search index. :param index: The definition of the index to create. Required. - :type index: JSON + :type index: ~azure.search.documents.indexes.types.SearchIndex :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2673,12 +2911,15 @@ def create_index( """ @distributed_trace - def create_index(self, index: Union[_models1.SearchIndex, JSON, IO[bytes]], **kwargs: Any) -> _models1.SearchIndex: + def create_index( + self, index: Union[_models1.SearchIndex, _types_models1.SearchIndex, IO[bytes]], **kwargs: Any + ) -> _models1.SearchIndex: """Creates a new search index. - :param index: The definition of the index to create. Is one of the following types: - SearchIndex, JSON, IO[bytes] Required. - :type index: ~azure.search.documents.indexes.models.SearchIndex or JSON or IO[bytes] + :param index: The definition of the index to create. Is either a SearchIndex type or a + IO[bytes] type. Required. + :type index: ~azure.search.documents.indexes.models.SearchIndex or + ~azure.search.documents.indexes.types.SearchIndex or IO[bytes] :return: SearchIndex. The SearchIndex is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchIndex :raises ~azure.core.exceptions.HttpResponseError: @@ -2819,7 +3060,12 @@ def _analyze_text( ) -> _models1.AnalyzeResult: ... @overload def _analyze_text( - self, name: str, request: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + request: _types_models1.AnalyzeTextOptions, + *, + content_type: str = "application/json", + **kwargs: Any, ) -> _models1.AnalyzeResult: ... @overload def _analyze_text( @@ -2828,15 +3074,19 @@ def _analyze_text( @distributed_trace def _analyze_text( - self, name: str, request: Union[_models1.AnalyzeTextOptions, JSON, IO[bytes]], **kwargs: Any + self, + name: str, + request: Union[_models1.AnalyzeTextOptions, _types_models1.AnalyzeTextOptions, IO[bytes]], + **kwargs: Any, ) -> _models1.AnalyzeResult: """Shows how an analyzer breaks text into tokens. :param name: The name of the index. Required. :type name: str - :param request: The text and analyzer or analysis components to test. Is one of the following - types: AnalyzeTextOptions, JSON, IO[bytes] Required. - :type request: ~azure.search.documents.indexes.models.AnalyzeTextOptions or JSON or IO[bytes] + :param request: The text and analyzer or analysis components to test. Is either a + AnalyzeTextOptions type or a IO[bytes] type. Required. + :type request: ~azure.search.documents.indexes.models.AnalyzeTextOptions or + ~azure.search.documents.indexes.types.AnalyzeTextOptions or IO[bytes] :return: AnalyzeResult. The AnalyzeResult is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.AnalyzeResult :raises ~azure.core.exceptions.HttpResponseError: @@ -2921,7 +3171,7 @@ def _create_or_update_alias( def _create_or_update_alias( self, name: str, - alias: JSON, + alias: _types_models1.SearchAlias, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -2944,7 +3194,7 @@ def _create_or_update_alias( def _create_or_update_alias( self, name: str, - alias: Union[_models1.SearchAlias, JSON, IO[bytes]], + alias: Union[_models1.SearchAlias, _types_models1.SearchAlias, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -2954,9 +3204,10 @@ def _create_or_update_alias( :param name: The name of the alias. Required. :type name: str - :param alias: The definition of the alias to create or update. Is one of the following types: - SearchAlias, JSON, IO[bytes] Required. - :type alias: ~azure.search.documents.indexes.models.SearchAlias or JSON or IO[bytes] + :param alias: The definition of the alias to create or update. Is either a SearchAlias type or + a IO[bytes] type. Required. + :type alias: ~azure.search.documents.indexes.models.SearchAlias or + ~azure.search.documents.indexes.types.SearchAlias or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -3175,9 +3426,30 @@ def get_alias(self, name: str, **kwargs: Any) -> _models1.SearchAlias: return deserialized # type: ignore @distributed_trace - def list_aliases(self, **kwargs: Any) -> ItemPaged["_models1.SearchAlias"]: + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def list_aliases( + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = None, + **kwargs: Any, + ) -> ItemPaged["_models1.SearchAlias"]: """Lists all aliases available for a search service. + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of SearchAlias :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchAlias] :raises ~azure.core.exceptions.HttpResponseError: @@ -3199,6 +3471,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_aliases_request( + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3221,7 +3496,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -3240,7 +3518,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) @@ -3281,12 +3559,12 @@ def create_alias( @overload def create_alias( - self, alias: JSON, *, content_type: str = "application/json", **kwargs: Any + self, alias: _types_models1.SearchAlias, *, content_type: str = "application/json", **kwargs: Any ) -> _models1.SearchAlias: """Creates a new search alias. :param alias: The definition of the alias to create. Required. - :type alias: JSON + :type alias: ~azure.search.documents.indexes.types.SearchAlias :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3312,12 +3590,15 @@ def create_alias( """ @distributed_trace - def create_alias(self, alias: Union[_models1.SearchAlias, JSON, IO[bytes]], **kwargs: Any) -> _models1.SearchAlias: + def create_alias( + self, alias: Union[_models1.SearchAlias, _types_models1.SearchAlias, IO[bytes]], **kwargs: Any + ) -> _models1.SearchAlias: """Creates a new search alias. - :param alias: The definition of the alias to create. Is one of the following types: - SearchAlias, JSON, IO[bytes] Required. - :type alias: ~azure.search.documents.indexes.models.SearchAlias or JSON or IO[bytes] + :param alias: The definition of the alias to create. Is either a SearchAlias type or a + IO[bytes] type. Required. + :type alias: ~azure.search.documents.indexes.models.SearchAlias or + ~azure.search.documents.indexes.types.SearchAlias or IO[bytes] :return: SearchAlias. The SearchAlias is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchAlias :raises ~azure.core.exceptions.HttpResponseError: @@ -3401,7 +3682,7 @@ def _create_or_update_knowledge_base( def _create_or_update_knowledge_base( self, name: str, - knowledge_base: JSON, + knowledge_base: _types_models1.KnowledgeBase, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -3424,7 +3705,7 @@ def _create_or_update_knowledge_base( def _create_or_update_knowledge_base( self, name: str, - knowledge_base: Union[_models1.KnowledgeBase, JSON, IO[bytes]], + knowledge_base: Union[_models1.KnowledgeBase, _types_models1.KnowledgeBase, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -3434,9 +3715,10 @@ def _create_or_update_knowledge_base( :param name: The name of the knowledge base. Required. :type name: str - :param knowledge_base: The definition of the knowledge base to create or update. Is one of the - following types: KnowledgeBase, JSON, IO[bytes] Required. - :type knowledge_base: ~azure.search.documents.indexes.models.KnowledgeBase or JSON or IO[bytes] + :param knowledge_base: The definition of the knowledge base to create or update. Is either a + KnowledgeBase type or a IO[bytes] type. Required. + :type knowledge_base: ~azure.search.documents.indexes.models.KnowledgeBase or + ~azure.search.documents.indexes.types.KnowledgeBase or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -3654,9 +3936,30 @@ def get_knowledge_base(self, name: str, **kwargs: Any) -> _models1.KnowledgeBase return deserialized # type: ignore @distributed_trace - def list_knowledge_bases(self, **kwargs: Any) -> ItemPaged["_models1.KnowledgeBase"]: + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def list_knowledge_bases( + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = None, + **kwargs: Any, + ) -> ItemPaged["_models1.KnowledgeBase"]: """Lists all knowledge bases available for a search service. + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of KnowledgeBase :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.KnowledgeBase] :raises ~azure.core.exceptions.HttpResponseError: @@ -3678,6 +3981,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_knowledge_bases_request( + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3700,7 +4006,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -3719,7 +4028,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) @@ -3760,12 +4069,12 @@ def create_knowledge_base( @overload def create_knowledge_base( - self, knowledge_base: JSON, *, content_type: str = "application/json", **kwargs: Any + self, knowledge_base: _types_models1.KnowledgeBase, *, content_type: str = "application/json", **kwargs: Any ) -> _models1.KnowledgeBase: """Creates a new knowledge base. :param knowledge_base: The definition of the knowledge base to create. Required. - :type knowledge_base: JSON + :type knowledge_base: ~azure.search.documents.indexes.types.KnowledgeBase :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3792,13 +4101,14 @@ def create_knowledge_base( @distributed_trace def create_knowledge_base( - self, knowledge_base: Union[_models1.KnowledgeBase, JSON, IO[bytes]], **kwargs: Any + self, knowledge_base: Union[_models1.KnowledgeBase, _types_models1.KnowledgeBase, IO[bytes]], **kwargs: Any ) -> _models1.KnowledgeBase: """Creates a new knowledge base. - :param knowledge_base: The definition of the knowledge base to create. Is one of the following - types: KnowledgeBase, JSON, IO[bytes] Required. - :type knowledge_base: ~azure.search.documents.indexes.models.KnowledgeBase or JSON or IO[bytes] + :param knowledge_base: The definition of the knowledge base to create. Is either a + KnowledgeBase type or a IO[bytes] type. Required. + :type knowledge_base: ~azure.search.documents.indexes.models.KnowledgeBase or + ~azure.search.documents.indexes.types.KnowledgeBase or IO[bytes] :return: KnowledgeBase. The KnowledgeBase is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.KnowledgeBase :raises ~azure.core.exceptions.HttpResponseError: @@ -3882,7 +4192,7 @@ def _create_or_update_knowledge_source( def _create_or_update_knowledge_source( self, name: str, - knowledge_source: JSON, + knowledge_source: _types_models1.KnowledgeSource, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -3905,7 +4215,7 @@ def _create_or_update_knowledge_source( def _create_or_update_knowledge_source( self, name: str, - knowledge_source: Union[_models1.KnowledgeSource, JSON, IO[bytes]], + knowledge_source: Union[_models1.KnowledgeSource, _types_models1.KnowledgeSource, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -3915,10 +4225,10 @@ def _create_or_update_knowledge_source( :param name: The name of the knowledge source. Required. :type name: str - :param knowledge_source: The definition of the knowledge source to create or update. Is one of - the following types: KnowledgeSource, JSON, IO[bytes] Required. - :type knowledge_source: ~azure.search.documents.indexes.models.KnowledgeSource or JSON or - IO[bytes] + :param knowledge_source: The definition of the knowledge source to create or update. Is either + a KnowledgeSource type or a IO[bytes] type. Required. + :type knowledge_source: ~azure.search.documents.indexes.models.KnowledgeSource or + ~azure.search.documents.indexes.types.KnowledgeSource or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -4136,9 +4446,30 @@ def get_knowledge_source(self, name: str, **kwargs: Any) -> _models1.KnowledgeSo return deserialized # type: ignore @distributed_trace - def list_knowledge_sources(self, **kwargs: Any) -> ItemPaged["_models1.KnowledgeSource"]: + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def list_knowledge_sources( + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = None, + **kwargs: Any, + ) -> ItemPaged["_models1.KnowledgeSource"]: """Lists all knowledge sources available for a search service. + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of KnowledgeSource :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.KnowledgeSource] :raises ~azure.core.exceptions.HttpResponseError: @@ -4160,6 +4491,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_knowledge_sources_request( + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4182,7 +4516,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -4201,7 +4538,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) @@ -4242,12 +4579,12 @@ def create_knowledge_source( @overload def create_knowledge_source( - self, knowledge_source: JSON, *, content_type: str = "application/json", **kwargs: Any + self, knowledge_source: _types_models1.KnowledgeSource, *, content_type: str = "application/json", **kwargs: Any ) -> _models1.KnowledgeSource: """Creates a new knowledge source. :param knowledge_source: The definition of the knowledge source to create. Required. - :type knowledge_source: JSON + :type knowledge_source: ~azure.search.documents.indexes.types.KnowledgeSource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -4274,14 +4611,16 @@ def create_knowledge_source( @distributed_trace def create_knowledge_source( - self, knowledge_source: Union[_models1.KnowledgeSource, JSON, IO[bytes]], **kwargs: Any + self, + knowledge_source: Union[_models1.KnowledgeSource, _types_models1.KnowledgeSource, IO[bytes]], + **kwargs: Any, ) -> _models1.KnowledgeSource: """Creates a new knowledge source. - :param knowledge_source: The definition of the knowledge source to create. Is one of the - following types: KnowledgeSource, JSON, IO[bytes] Required. - :type knowledge_source: ~azure.search.documents.indexes.models.KnowledgeSource or JSON or - IO[bytes] + :param knowledge_source: The definition of the knowledge source to create. Is either a + KnowledgeSource type or a IO[bytes] type. Required. + :type knowledge_source: ~azure.search.documents.indexes.models.KnowledgeSource or + ~azure.search.documents.indexes.types.KnowledgeSource or IO[bytes] :return: KnowledgeSource. The KnowledgeSource is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.KnowledgeSource :raises ~azure.core.exceptions.HttpResponseError: @@ -4415,6 +4754,27 @@ def get_knowledge_source_status(self, name: str, **kwargs: Any) -> _knowledgebas return deserialized # type: ignore + @overload + def _upload_knowledge_source_file( + self, + name: str, + file: bytes, + *, + content_disposition: str, + content_type: str = "application/octet-stream", + **kwargs: Any, + ) -> _models1.KnowledgeSourceFile: ... + @overload + def _upload_knowledge_source_file( + self, + name: str, + file: IO[bytes], + *, + content_disposition: str, + content_type: str = "application/octet-stream", + **kwargs: Any, + ) -> _models1.KnowledgeSourceFile: ... + @distributed_trace @api_version_validation( method_added_on="2026-05-01-preview", @@ -4428,17 +4788,17 @@ def get_knowledge_source_status(self, name: str, **kwargs: Any) -> _knowledgebas "accept", ] }, - api_versions_list=["2026-05-01-preview"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) def _upload_knowledge_source_file( - self, name: str, file: bytes, *, content_disposition: str, **kwargs: Any + self, name: str, file: Union[bytes, IO[bytes]], *, content_disposition: str, **kwargs: Any ) -> _models1.KnowledgeSourceFile: """Uploads a file to a File knowledge source for processing and indexing. :param name: The name of the knowledge source. Required. :type name: str - :param file: The file content to upload. Required. - :type file: bytes + :param file: The file content to upload. Is either a bytes type or a IO[bytes] type. Required. + :type file: bytes or IO[bytes] :keyword content_disposition: The Content-Disposition header specifying the filename of the uploaded file. Must follow the format: ``attachment; filename=""``. @@ -4459,9 +4819,10 @@ def _upload_knowledge_source_file( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[_models1.KnowledgeSourceFile] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = file _request = build_search_index_upload_knowledge_source_file_request( @@ -4509,23 +4870,168 @@ def _upload_knowledge_source_file( 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", "client_request_id", "name"]}, - api_versions_list=["2026-05-01-preview"], - ) - def list_knowledge_source_files(self, name: str, **kwargs: Any) -> ItemPaged["_models1.KnowledgeSourceFile"]: - """Lists all files in a File knowledge source. + @overload + def upload_knowledge_source_file_multipart( + self, name: str, body: _models1.UploadKnowledgeSourceFileMultipartRequest, **kwargs: Any + ) -> _models1.KnowledgeSourceFile: + """Uploads a file to a File knowledge source using multipart/form-data: a JSON 'metadata' part + (file name and custom metadata) and a 'content' part with the raw file bytes. :param name: The name of the knowledge source. Required. :type name: str - :return: An iterator like instance of KnowledgeSourceFile - :rtype: - ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.KnowledgeSourceFile] + :param body: The multipart/form-data body containing the metadata and content parts. Required. + :type body: ~azure.search.documents.indexes.models.UploadKnowledgeSourceFileMultipartRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + def upload_knowledge_source_file_multipart( + self, name: str, body: _types_models1.UploadKnowledgeSourceFileMultipartRequest, **kwargs: Any + ) -> _models1.KnowledgeSourceFile: + """Uploads a file to a File knowledge source using multipart/form-data: a JSON 'metadata' part + (file name and custom metadata) and a 'content' part with the raw file bytes. + + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Required. + :type body: ~azure.search.documents.indexes.types.UploadKnowledgeSourceFileMultipartRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-08-01-preview", + params_added_on={"2026-08-01-preview": ["api_version", "client_request_id", "name", "content_type", "accept"]}, + api_versions_list=["2026-08-01-preview"], + ) + def upload_knowledge_source_file_multipart( + self, + name: str, + body: Union[ + _models1.UploadKnowledgeSourceFileMultipartRequest, _types_models1.UploadKnowledgeSourceFileMultipartRequest + ], + **kwargs: Any, + ) -> _models1.KnowledgeSourceFile: + """Uploads a file to a File knowledge source using multipart/form-data: a JSON 'metadata' part + (file name and custom metadata) and a 'content' part with the raw file bytes. + + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Is one of + the following types: UploadKnowledgeSourceFileMultipartRequest Required. + :type body: ~azure.search.documents.indexes.models.UploadKnowledgeSourceFileMultipartRequest or + ~azure.search.documents.indexes.types.UploadKnowledgeSourceFileMultipartRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models1.KnowledgeSourceFile] = kwargs.pop("cls", None) + + _body = body.as_dict() if isinstance(body, _Model) else body + _file_fields: list[str] = ["content"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_search_index_upload_knowledge_source_file_multipart_request( + name=name, + api_version=self._config.api_version, + files=_files, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models2.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models1.KnowledgeSourceFile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + 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", "client_request_id", "name"], + "2026-08-01-preview": ["prefix", "search", "page_size", "search_type"], + }, + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], + ) + def list_knowledge_source_files( + self, + name: str, + *, + prefix: Optional[str] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = None, + **kwargs: Any, + ) -> ItemPaged["_models1.KnowledgeSourceFile"]: + """Lists all files in a File knowledge source. + + :param name: The name of the knowledge source. Required. + :type name: str + :keyword prefix: Optional prefix to filter files by their directory-like path. Default value is + None. + :paramtype prefix: str + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of KnowledgeSourceFile + :rtype: + ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.KnowledgeSourceFile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} cls: ClsType[list[_models1.KnowledgeSourceFile]] = kwargs.pop("cls", None) @@ -4543,6 +5049,10 @@ def prepare_request(next_link=None): _request = build_search_index_list_knowledge_source_files_request( name=name, + prefix=prefix, + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4565,7 +5075,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -4584,7 +5097,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) @@ -4611,7 +5124,7 @@ def get_next(next_link=None): @api_version_validation( method_added_on="2026-05-01-preview", params_added_on={"2026-05-01-preview": ["api_version", "file_id", "accept", "client_request_id", "name"]}, - api_versions_list=["2026-05-01-preview"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) def _delete_knowledge_source_file( # pylint: disable=inconsistent-return-statements self, file_id: str, name: str, **kwargs: Any @@ -4669,6 +5182,137 @@ def _delete_knowledge_source_file( # pylint: disable=inconsistent-return-statem if cls: return cls(pipeline_response, None, {}) # type: ignore + @overload + def update_knowledge_source_file( + self, file_id: str, name: str, body: _models1.UpdateKnowledgeSourceFileRequest, **kwargs: Any + ) -> _models1.KnowledgeSourceFile: + """Updates an existing file in a File knowledge source in place, replacing its indexed content. + Uses multipart/form-data: a JSON 'metadata' part (file name and custom metadata) and a + 'content' part with the raw file bytes. + + :param file_id: The unique identifier of the file to update. Required. + :type file_id: str + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Required. + :type body: ~azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_knowledge_source_file( + self, file_id: str, name: str, body: _types_models1.UpdateKnowledgeSourceFileRequest, **kwargs: Any + ) -> _models1.KnowledgeSourceFile: + """Updates an existing file in a File knowledge source in place, replacing its indexed content. + Uses multipart/form-data: a JSON 'metadata' part (file name and custom metadata) and a + 'content' part with the raw file bytes. + + :param file_id: The unique identifier of the file to update. Required. + :type file_id: str + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Required. + :type body: ~azure.search.documents.indexes.types.UpdateKnowledgeSourceFileRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": ["api_version", "file_id", "client_request_id", "name", "content_type", "accept"] + }, + api_versions_list=["2026-08-01-preview"], + ) + def update_knowledge_source_file( + self, + file_id: str, + name: str, + body: Union[_models1.UpdateKnowledgeSourceFileRequest, _types_models1.UpdateKnowledgeSourceFileRequest], + **kwargs: Any, + ) -> _models1.KnowledgeSourceFile: + """Updates an existing file in a File knowledge source in place, replacing its indexed content. + Uses multipart/form-data: a JSON 'metadata' part (file name and custom metadata) and a + 'content' part with the raw file bytes. + + :param file_id: The unique identifier of the file to update. Required. + :type file_id: str + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Is one of + the following types: UpdateKnowledgeSourceFileRequest Required. + :type body: ~azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest or + ~azure.search.documents.indexes.types.UpdateKnowledgeSourceFileRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models1.KnowledgeSourceFile] = kwargs.pop("cls", None) + + _body = body.as_dict() if isinstance(body, _Model) else body + _file_fields: list[str] = ["content"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_search_index_update_knowledge_source_file_request( + file_id=file_id, + name=name, + api_version=self._config.api_version, + files=_files, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models2.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models1.KnowledgeSourceFile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @distributed_trace def get_service_statistics(self, **kwargs: Any) -> _models1.SearchServiceStatistics: """Gets service level statistics for a search service. @@ -4733,23 +5377,32 @@ def get_service_statistics(self, **kwargs: Any) -> _models1.SearchServiceStatist @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"], + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": ["api_version", "accept", "search", "page_size", "search_type", "client_request_id"] + }, + api_versions_list=["2026-08-01-preview"], ) def list_index_stats_summary( - self, *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None, **kwargs: Any + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = 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 + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of IndexStatisticsSummary :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.IndexStatisticsSummary] @@ -4772,9 +5425,9 @@ 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, + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -4797,7 +5450,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -4860,7 +5516,7 @@ def _create_or_update_data_source_connection( def _create_or_update_data_source_connection( self, name: str, - data_source: JSON, + data_source: _types_models1.SearchIndexerDataSourceConnection, *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, content_type: str = "application/json", @@ -4884,12 +5540,14 @@ def _create_or_update_data_source_connection( @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"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) def _create_or_update_data_source_connection( self, name: str, - data_source: Union[_models1.SearchIndexerDataSourceConnection, JSON, IO[bytes]], + data_source: Union[ + _models1.SearchIndexerDataSourceConnection, _types_models1.SearchIndexerDataSourceConnection, IO[bytes] + ], *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, etag: Optional[str] = None, @@ -4900,10 +5558,10 @@ def _create_or_update_data_source_connection( :param name: The name of the datasource. Required. :type name: str - :param data_source: The definition of the datasource to create or update. Is one of the - following types: SearchIndexerDataSourceConnection, JSON, IO[bytes] Required. + :param data_source: The definition of the datasource to create or update. Is either a + SearchIndexerDataSourceConnection type or a IO[bytes] type. Required. :type data_source: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or - JSON or IO[bytes] + ~azure.search.documents.indexes.types.SearchIndexerDataSourceConnection 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 @@ -5127,19 +5785,45 @@ def get_data_source_connection(self, name: str, **kwargs: Any) -> _models1.Searc return deserialized # type: ignore @distributed_trace + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) def _get_data_source_connections( - self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> _models1._models.ListDataSourcesResult: + self, + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = None, + **kwargs: Any, + ) -> ItemPaged["_models1.SearchIndexerDataSourceConnection"]: """Lists all datasources 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] - :return: ListDataSourcesResult. The ListDataSourcesResult is compatible with MutableMapping - :rtype: ~azure.search.documents.indexes.models._models.ListDataSourcesResult + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of SearchIndexerDataSourceConnection + :rtype: + ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models1.SearchIndexerDataSourceConnection]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5148,54 +5832,80 @@ def _get_data_source_connections( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models1._models.ListDataSourcesResult] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_search_indexer_get_data_source_connections_request( - select=select, - 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) + _request = build_search_indexer_get_data_source_connections_request( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + 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) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models2.ErrorResponse, - response, + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models1.SearchIndexerDataSourceConnection], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, iter(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize( - _models1._models.ListDataSourcesResult, response.json() # pylint: disable=protected-access + 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 cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + 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 deserialized # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) @overload def create_data_source_connection( @@ -5221,12 +5931,17 @@ def create_data_source_connection( @overload def create_data_source_connection( - self, data_source_connection: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + data_source_connection: _types_models1.SearchIndexerDataSourceConnection, + *, + content_type: str = "application/json", + **kwargs: Any, ) -> _models1.SearchIndexerDataSourceConnection: """Creates a new datasource. :param data_source_connection: The definition of the datasource to create. Required. - :type data_source_connection: JSON + :type data_source_connection: + ~azure.search.documents.indexes.types.SearchIndexerDataSourceConnection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5255,14 +5970,19 @@ def create_data_source_connection( @distributed_trace def create_data_source_connection( - self, data_source_connection: Union[_models1.SearchIndexerDataSourceConnection, JSON, IO[bytes]], **kwargs: Any + self, + data_source_connection: Union[ + _models1.SearchIndexerDataSourceConnection, _types_models1.SearchIndexerDataSourceConnection, IO[bytes] + ], + **kwargs: Any, ) -> _models1.SearchIndexerDataSourceConnection: """Creates a new datasource. - :param data_source_connection: The definition of the datasource to create. Is one of the - following types: SearchIndexerDataSourceConnection, JSON, IO[bytes] Required. + :param data_source_connection: The definition of the datasource to create. Is either a + SearchIndexerDataSourceConnection type or a IO[bytes] type. Required. :type data_source_connection: - ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or JSON or IO[bytes] + ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or + ~azure.search.documents.indexes.types.SearchIndexerDataSourceConnection or IO[bytes] :return: SearchIndexerDataSourceConnection. The SearchIndexerDataSourceConnection is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection @@ -5395,7 +6115,12 @@ def _resync( ) -> None: ... @overload def _resync( - self, name: str, indexer_resync: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + indexer_resync: _types_models1.IndexerResyncBody, + *, + content_type: str = "application/json", + **kwargs: Any, ) -> None: ... @overload def _resync( @@ -5406,19 +6131,22 @@ def _resync( @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"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) def _resync( # pylint: disable=inconsistent-return-statements - self, name: str, indexer_resync: Union[_models1.IndexerResyncBody, JSON, IO[bytes]], **kwargs: Any + self, + name: str, + indexer_resync: Union[_models1.IndexerResyncBody, _types_models1.IndexerResyncBody, 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] + :param indexer_resync: The definition of the indexer resync options. Is either a + IndexerResyncBody type or a IO[bytes] type. Required. + :type indexer_resync: ~azure.search.documents.indexes.models.IndexerResyncBody or + ~azure.search.documents.indexes.types.IndexerResyncBody or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -5489,7 +6217,7 @@ def _reset_documents( def _reset_documents( self, name: str, - keys_or_ids: Optional[JSON] = None, + keys_or_ids: Optional[_types_models1.DocumentKeysOrIds] = None, *, overwrite: Optional[bool] = None, content_type: str = "application/json", @@ -5512,12 +6240,12 @@ def _reset_documents( params_added_on={ "2026-05-01-preview": ["api_version", "accept", "overwrite", "client_request_id", "name", "content_type"] }, - api_versions_list=["2026-05-01-preview"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) def _reset_documents( # pylint: disable=inconsistent-return-statements self, name: str, - keys_or_ids: Optional[Union[_models1.DocumentKeysOrIds, JSON, IO[bytes]]] = None, + keys_or_ids: Optional[Union[_models1.DocumentKeysOrIds, _types_models1.DocumentKeysOrIds, IO[bytes]]] = None, *, overwrite: Optional[bool] = None, **kwargs: Any, @@ -5528,10 +6256,10 @@ def _reset_documents( # pylint: disable=inconsistent-return-statements :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] + document key field is ignored. Is either a DocumentKeysOrIds type or a IO[bytes] type. Default + value is None. + :type keys_or_ids: ~azure.search.documents.indexes.models.DocumentKeysOrIds or + ~azure.search.documents.indexes.types.DocumentKeysOrIds 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 @@ -5665,7 +6393,7 @@ def _create_or_update_indexer( def _create_or_update_indexer( self, name: str, - indexer: JSON, + indexer: _types_models1.SearchIndexer, *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, disable_cache_reprocessing_change_detection: Optional[bool] = None, @@ -5696,12 +6424,12 @@ def _create_or_update_indexer( "disable_cache_reprocessing_change_detection", ] }, - api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) def _create_or_update_indexer( self, name: str, - indexer: Union[_models1.SearchIndexer, JSON, IO[bytes]], + indexer: Union[_models1.SearchIndexer, _types_models1.SearchIndexer, IO[bytes]], *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, disable_cache_reprocessing_change_detection: Optional[bool] = None, @@ -5713,9 +6441,10 @@ def _create_or_update_indexer( :param name: The name of the indexer. Required. :type name: str - :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] + :param indexer: The definition of the indexer to create or update. Is either a SearchIndexer + type or a IO[bytes] type. Required. + :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or + ~azure.search.documents.indexes.types.SearchIndexer 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 @@ -5941,19 +6670,44 @@ def get_indexer(self, name: str, **kwargs: Any) -> _models1.SearchIndexer: return deserialized # type: ignore @distributed_trace + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) def _get_indexers( - self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> _models1._models.ListIndexersResult: + self, + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = None, + **kwargs: Any, + ) -> ItemPaged["_models1.SearchIndexer"]: """Lists all indexers 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] - :return: ListIndexersResult. The ListIndexersResult is compatible with MutableMapping - :rtype: ~azure.search.documents.indexes.models._models.ListIndexersResult + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of SearchIndexer + :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndexer] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models1.SearchIndexer]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5962,54 +6716,80 @@ def _get_indexers( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models1._models.ListIndexersResult] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_search_indexer_get_indexers_request( - select=select, - 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) + _request = build_search_indexer_get_indexers_request( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + 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) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models2.ErrorResponse, - response, + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models1.SearchIndexer], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, iter(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize( - _models1._models.ListIndexersResult, response.json() # pylint: disable=protected-access + 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 cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + 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 deserialized # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) @overload def create_indexer( @@ -6029,12 +6809,12 @@ def create_indexer( @overload def create_indexer( - self, indexer: JSON, *, content_type: str = "application/json", **kwargs: Any + self, indexer: _types_models1.SearchIndexer, *, content_type: str = "application/json", **kwargs: Any ) -> _models1.SearchIndexer: """Creates a new indexer. :param indexer: The definition of the indexer to create. Required. - :type indexer: JSON + :type indexer: ~azure.search.documents.indexes.types.SearchIndexer :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -6061,13 +6841,14 @@ def create_indexer( @distributed_trace def create_indexer( - self, indexer: Union[_models1.SearchIndexer, JSON, IO[bytes]], **kwargs: Any + self, indexer: Union[_models1.SearchIndexer, _types_models1.SearchIndexer, IO[bytes]], **kwargs: Any ) -> _models1.SearchIndexer: """Creates a new indexer. - :param indexer: The definition of the indexer to create. Is one of the following types: - SearchIndexer, JSON, IO[bytes] Required. - :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or JSON or IO[bytes] + :param indexer: The definition of the indexer to create. Is either a SearchIndexer type or a + IO[bytes] type. Required. + :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or + ~azure.search.documents.indexes.types.SearchIndexer or IO[bytes] :return: SearchIndexer. The SearchIndexer is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchIndexer :raises ~azure.core.exceptions.HttpResponseError: @@ -6218,7 +6999,7 @@ def _create_or_update_skillset( def _create_or_update_skillset( self, name: str, - skillset: JSON, + skillset: _types_models1.SearchIndexerSkillset, *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, disable_cache_reprocessing_change_detection: Optional[bool] = None, @@ -6249,12 +7030,12 @@ def _create_or_update_skillset( "disable_cache_reprocessing_change_detection", ] }, - api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) def _create_or_update_skillset( self, name: str, - skillset: Union[_models1.SearchIndexerSkillset, JSON, IO[bytes]], + skillset: Union[_models1.SearchIndexerSkillset, _types_models1.SearchIndexerSkillset, IO[bytes]], *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, disable_cache_reprocessing_change_detection: Optional[bool] = None, @@ -6267,9 +7048,9 @@ def _create_or_update_skillset( :param name: The name of the skillset. Required. :type name: str :param skillset: The skillset containing one or more skills to create or update in a search - 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] + service. Is either a SearchIndexerSkillset type or a IO[bytes] type. Required. + :type skillset: ~azure.search.documents.indexes.models.SearchIndexerSkillset or + ~azure.search.documents.indexes.types.SearchIndexerSkillset 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 @@ -6495,19 +7276,45 @@ def get_skillset(self, name: str, **kwargs: Any) -> _models1.SearchIndexerSkills return deserialized # type: ignore @distributed_trace + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) def _get_skillsets( - self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> _models1._models.ListSkillsetsResult: + self, + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models1.ListingSearchType]] = None, + **kwargs: Any, + ) -> ItemPaged["_models1.SearchIndexerSkillset"]: """List all skillsets in 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] - :return: ListSkillsetsResult. The ListSkillsetsResult is compatible with MutableMapping - :rtype: ~azure.search.documents.indexes.models._models.ListSkillsetsResult + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of SearchIndexerSkillset + :rtype: + ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndexerSkillset] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models1.SearchIndexerSkillset]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6516,54 +7323,80 @@ def _get_skillsets( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models1._models.ListSkillsetsResult] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_search_indexer_get_skillsets_request( - select=select, - 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) + _request = build_search_indexer_get_skillsets_request( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + 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) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models2.ErrorResponse, - response, + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models1.SearchIndexerSkillset], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, iter(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize( - _models1._models.ListSkillsetsResult, response.json() # pylint: disable=protected-access + 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 cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + 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 deserialized # type: ignore + return pipeline_response + + return ItemPaged(get_next, extract_data) @overload def create_skillset( @@ -6584,13 +7417,13 @@ def create_skillset( @overload def create_skillset( - self, skillset: JSON, *, content_type: str = "application/json", **kwargs: Any + self, skillset: _types_models1.SearchIndexerSkillset, *, content_type: str = "application/json", **kwargs: Any ) -> _models1.SearchIndexerSkillset: """Creates a new skillset in a search service. :param skillset: The skillset containing one or more skills to create in a search service. Required. - :type skillset: JSON + :type skillset: ~azure.search.documents.indexes.types.SearchIndexerSkillset :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -6618,14 +7451,16 @@ def create_skillset( @distributed_trace def create_skillset( - self, skillset: Union[_models1.SearchIndexerSkillset, JSON, IO[bytes]], **kwargs: Any + self, + skillset: Union[_models1.SearchIndexerSkillset, _types_models1.SearchIndexerSkillset, IO[bytes]], + **kwargs: Any, ) -> _models1.SearchIndexerSkillset: """Creates a new skillset in a search service. :param skillset: The skillset containing one or more skills to create in a search 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] + either a SearchIndexerSkillset type or a IO[bytes] type. Required. + :type skillset: ~azure.search.documents.indexes.models.SearchIndexerSkillset or + ~azure.search.documents.indexes.types.SearchIndexerSkillset or IO[bytes] :return: SearchIndexerSkillset. The SearchIndexerSkillset is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchIndexerSkillset :raises ~azure.core.exceptions.HttpResponseError: @@ -6700,7 +7535,12 @@ def _reset_skills( ) -> None: ... @overload def _reset_skills( - self, name: str, skill_names: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + skill_names: _types_models1.SkillNames, + *, + content_type: str = "application/json", + **kwargs: Any, ) -> None: ... @overload def _reset_skills( @@ -6711,18 +7551,19 @@ def _reset_skills( @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"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) def _reset_skills( # pylint: disable=inconsistent-return-statements - self, name: str, skill_names: Union[_models1.SkillNames, JSON, IO[bytes]], **kwargs: Any + self, name: str, skill_names: Union[_models1.SkillNames, _types_models1.SkillNames, 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] + skillset will be reset. Is either a SkillNames type or a IO[bytes] type. Required. + :type skill_names: ~azure.search.documents.indexes.models.SkillNames or + ~azure.search.documents.indexes.types.SkillNames or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: 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 4ca6b5addaba..06449fb21c60 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 @@ -8,6 +8,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, IO, List, Sequence, Union, Optional, TYPE_CHECKING @@ -15,7 +16,7 @@ from azure.core.paging import ItemPaged from azure.core.tracing.decorator import distributed_trace -from .. import models as _models +from .. import models as _models, types as _types from ..models._models import SearchIndexResponse as _SearchIndexResponse from ._operations import ( _SearchIndexClientOperationsMixin as _SearchIndexClientOperationsMixinGenerated, @@ -59,7 +60,9 @@ def _convert_index_response(response: _SearchIndexResponse) -> _models.SearchInd ) -class _SearchIndexClientOperationsMixin(_SearchIndexClientOperationsMixinGenerated): +class _SearchIndexClientOperationsMixin( + _SearchIndexClientOperationsMixinGenerated +): # pylint: disable=too-many-public-methods """Custom operations mixin for SearchIndexClient.""" @distributed_trace @@ -432,14 +435,38 @@ def delete_knowledge_source_file( """ self._delete_knowledge_source_file(name=name, file_id=file_id, **kwargs) + @distributed_trace + # pylint: disable-next=arguments-renamed + def update_knowledge_source_file( # type: ignore[override] + self, + name: str, + file_id: str, + body: Union[_models.UpdateKnowledgeSourceFileRequest, _types.UpdateKnowledgeSourceFileRequest], + **kwargs: Any, + ) -> _models.KnowledgeSourceFile: + """Updates an existing file in a File knowledge source in place. + + :param name: The name of the File knowledge source. Required. + :type name: str + :param file_id: The unique identifier of the file to update. Required. + :type file_id: str + :param body: The multipart body containing replacement metadata and content. Required. + :type body: ~azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest or + ~azure.search.documents.indexes.types.UpdateKnowledgeSourceFileRequest + :return: The updated knowledge source file. + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + return super().update_knowledge_source_file(name=name, file_id=file_id, body=body, **kwargs) + @distributed_trace def list_indexes( self, *, select: Optional[List[str]] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - count: Optional[bool] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, **kwargs: Any, ) -> ItemPaged[_models.SearchIndex]: """Lists all indexes available for a search service. @@ -448,14 +475,13 @@ def list_indexes( 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 + :keyword search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of SearchIndex :rtype: ~azure.core.paging.ItemPaged[~azure.search.documents.indexes.models.SearchIndex] :raises ~azure.core.exceptions.HttpResponseError: @@ -465,58 +491,85 @@ def list_indexes( ItemPaged[_models.SearchIndex], self._list_indexes_with_selected_properties( select=select, - top=top, - skip=skip, - count=count, + search=search, + page_size=page_size, + search_type=search_type, cls=lambda objs: [_convert_index_response(x) for x in objs], **kwargs, ), ) - return cast(ItemPaged[_models.SearchIndex], self._list_indexes(top=top, skip=skip, count=count, **kwargs)) + return cast( + ItemPaged[_models.SearchIndex], + self._list_indexes(search=search, page_size=page_size, search_type=search_type, **kwargs), + ) @distributed_trace def list_index_names( self, *, - top: Optional[int] = None, - skip: Optional[int] = None, - count: Optional[bool] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = 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 + :keyword search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of index names :rtype: ~azure.core.paging.ItemPaged[str] :raises ~azure.core.exceptions.HttpResponseError: """ - names = self._list_indexes(top=top, skip=skip, count=count, cls=lambda objs: [x.name for x in objs], **kwargs) + names = self._list_indexes( + search=search, + page_size=page_size, + search_type=search_type, + cls=lambda objs: [x.name for x in objs], + **kwargs, + ) return cast(ItemPaged[str], names) @distributed_trace - def get_synonym_maps(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> List[_models.SynonymMap]: + def get_synonym_maps( + self, + *, + select: Optional[List[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, + **kwargs: Any, + ) -> List[_models.SynonymMap]: """Lists all synonym maps available for a search service. :keyword select: Selects which top-level properties of the synonym maps 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 search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: List of synonym maps :rtype: list[~azure.search.documents.indexes.models.SynonymMap] :raises ~azure.core.exceptions.HttpResponseError: """ - result = self._get_synonym_maps(select=select, **kwargs) - assert result.synonym_maps is not None # Hint for mypy - # typed_result = [cast(_models.SynonymMap, x) for x in result.synonym_maps] - typed_result = result.synonym_maps - return typed_result + return list( + self._get_synonym_maps( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + **kwargs, + ) + ) @distributed_trace def get_synonym_map_names(self, **kwargs: Any) -> List[str]: @@ -759,7 +812,10 @@ def resync( :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - return self._resync(name=name, indexer_resync=indexer_resync, **kwargs) + typed_indexer_resync = cast( + Union[_models.IndexerResyncBody, _types.IndexerResyncBody, IO[bytes]], indexer_resync + ) + return self._resync(name=name, indexer_resync=typed_indexer_resync, **kwargs) @distributed_trace def reset_documents( @@ -785,7 +841,10 @@ def reset_documents( :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - return self._reset_documents(name=name, keys_or_ids=keys_or_ids, overwrite=overwrite, **kwargs) + typed_keys_or_ids = cast( + Optional[Union[_models.DocumentKeysOrIds, _types.DocumentKeysOrIds, IO[bytes]]], keys_or_ids + ) + return self._reset_documents(name=name, keys_or_ids=typed_keys_or_ids, overwrite=overwrite, **kwargs) @distributed_trace def delete_skillset( @@ -875,11 +934,18 @@ def reset_skills( :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - return self._reset_skills(name=name, skill_names=skill_names, **kwargs) + typed_skill_names = cast(Union[_models.SkillNames, _types.SkillNames, IO[bytes]], skill_names) + return self._reset_skills(name=name, skill_names=typed_skill_names, **kwargs) @distributed_trace def get_skillsets( - self, *, select: Optional[List[str]] = None, **kwargs: Any + self, + *, + select: Optional[List[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, + **kwargs: Any, ) -> List[_models.SearchIndexerSkillset]: """Lists all skillsets available for a search service. @@ -887,33 +953,63 @@ def get_skillsets( list of JSON property names, or '*' for all properties. The default is all properties. Default value is None. :paramtype select: list[str] + :keyword search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: List of all the SearchIndexerSkillsets. :rtype: list[~azure.search.documents.indexes.models.SearchIndexerSkillset] :raises ~azure.core.exceptions.HttpResponseError: """ - result = self._get_skillsets(select=select, **kwargs) - assert result.skillsets is not None # Hint for mypy - # typed_result = [cast(_models.SearchIndexerSkillset, x) for x in result.skillsets] - typed_result = result.skillsets - return typed_result + return list( + self._get_skillsets( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + **kwargs, + ) + ) @distributed_trace - def get_indexers(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> List[_models.SearchIndexer]: + def get_indexers( + self, + *, + select: Optional[List[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, + **kwargs: Any, + ) -> List[_models.SearchIndexer]: """Lists all indexers 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 search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: List of all the SearchIndexers. :rtype: list[~azure.search.documents.indexes.models.SearchIndexer] :raises ~azure.core.exceptions.HttpResponseError: """ - result = self._get_indexers(select=select, **kwargs) - assert result.indexers is not None # Hint for mypy - # typed_result = [cast(_models.SearchIndexer, x) for x in result.indexers] - typed_result = result.indexers - return typed_result + return list( + self._get_indexers( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + **kwargs, + ) + ) @distributed_trace def get_indexer_names(self, **kwargs: Any) -> Sequence[str]: @@ -936,7 +1032,13 @@ def get_indexer_names(self, **kwargs: Any) -> Sequence[str]: @distributed_trace def get_data_source_connections( - self, *, select: Optional[List[str]] = None, **kwargs: Any + self, + *, + select: Optional[List[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, + **kwargs: Any, ) -> List[_models.SearchIndexerDataSourceConnection]: """Lists all data source connections available for a search service. @@ -944,15 +1046,26 @@ def get_data_source_connections( list of JSON property names, or '*' for all properties. The default is all properties. Default value is None. :paramtype select: list[str] + :keyword search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: List of all the data source connections. :rtype: list[~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - result = self._get_data_source_connections(select=select, **kwargs) - assert result.data_sources is not None # Hint for mypy - # typed_result = [cast(_models.SearchIndexerDataSourceConnection, x) for x in result.data_sources] - typed_result = result.data_sources - return typed_result + return list( + self._get_data_source_connections( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + **kwargs, + ) + ) @distributed_trace def get_data_source_connection_names(self, **kwargs: Any) -> Sequence[str]: 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 9eda53c64b99..e55ff2517b1d 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 @@ -7,7 +7,8 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Any, Union + +from typing import Any, Optional, Union from azure.core.credentials import AzureKeyCredential, TokenCredential @@ -25,9 +26,9 @@ class SearchIndexClient(_SearchIndexClient): :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 - listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is - ``ApiVersion.V2026_05_01_PREVIEW``. Note that overriding this default value may - result in unsupported behavior. + listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is + ``ApiVersion.V2026_08_01_PREVIEW``. Note that overriding this default value may + result in unsupported behavior. :paramtype api_version: str or ~azure.search.documents.ApiVersion :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 @@ -51,9 +52,9 @@ class SearchIndexerClient(_SearchIndexerClient): :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 - listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is - ``ApiVersion.V2026_05_01_PREVIEW``. Note that overriding this default value may - result in unsupported behavior. + listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is + ``ApiVersion.V2026_08_01_PREVIEW``. Note that overriding this default value may + result in unsupported behavior. :paramtype api_version: str or ~azure.search.documents.ApiVersion :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 @@ -80,3 +81,16 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from . import types + + ingestion_parameter_types = ( + types.AzureBlobKnowledgeSourceParameters, + types.FileKnowledgeSourceParameters, + types.IndexedOneLakeKnowledgeSourceParameters, + types.IndexedSharePointKnowledgeSourceParameters, + types.IndexedSqlKnowledgeSourceParameters, + ) + for parameter_type in ingestion_parameter_types: + parameter_type.__annotations__["ingestionParameters"] = Optional[ + "azure.search.documents.knowledgebases.types.KnowledgeSourceIngestionParameters" + ] 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 db24930fdca9..35d5fc024978 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 @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -104,6 +109,29 @@ def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: return encoded +def _serialize_duration(td: timedelta, format: typing.Optional[str] = None): + """Serialize a timedelta to its wire representation. + + For the ``seconds``/``milliseconds`` encodings the value is converted to a + numeric value, otherwise it falls back to an ISO 8601 duration string. + + :param timedelta td: The timedelta to serialize. + :param str format: The duration encoding format. + :rtype: int or float or str + :return: serialized duration + """ + seconds = td.total_seconds() + if format == "duration-seconds-int": + return int(seconds) + if format == "duration-seconds-float": + return seconds + if format == "duration-milliseconds-int": + return int(seconds * 1000) + if format == "duration-milliseconds-float": + return seconds * 1000 + return _timedelta_as_isostr(td) + + def _serialize_datetime(o, format: typing.Optional[str] = None): if hasattr(o, "year") and hasattr(o, "hour"): if format == "rfc7231": @@ -130,7 +158,15 @@ def _is_readonly(p): class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" + """A JSON encoder that's capable of serializing datetime objects and bytes. + + :param args: Additional positional arguments passed to the base ``JSONEncoder``. + :type args: typing.Any + :keyword exclude_readonly: Whether to exclude readonly properties. Defaults to False. + :paramtype exclude_readonly: bool + :keyword format: The format to use for serialization. Defaults to None. + :paramtype format: typing.Optional[str] + """ def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): super().__init__(*args, **kwargs) @@ -296,6 +332,12 @@ def _deserialize_duration(attr): return isodate.parse_duration(attr) +def _deserialize_duration_numeric(attr, unit): + if isinstance(attr, timedelta): + return attr + return timedelta(**{unit: float(attr)}) + + def _deserialize_decimal(attr): if isinstance(attr, decimal.Decimal): return attr @@ -308,6 +350,12 @@ def _deserialize_int_as_str(attr): return int(attr) +def _deserialize_bool_as_str(attr): + if isinstance(attr, bool): + return attr + return attr.lower() == "true" + + _DESERIALIZE_MAPPING = { datetime: _deserialize_datetime, date: _deserialize_date, @@ -325,12 +373,18 @@ def _deserialize_int_as_str(attr): "unix-timestamp": _deserialize_datetime_unix_timestamp, "base64": _deserialize_bytes, "base64url": _deserialize_bytes_base64, + "duration-seconds-int": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-seconds-float": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-milliseconds-int": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), + "duration-milliseconds-float": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), } def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): if annotation is int and rf and rf._format == "str": return _deserialize_int_as_str + if annotation is bool and rf and rf._format == "str": + return _deserialize_bool_as_str if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) if rf and rf._format: @@ -420,21 +474,21 @@ def __ne__(self, other: typing.Any) -> bool: def keys(self) -> typing.KeysView[str]: """ - :returns: a set-like object providing a view on D's keys + :returns: a set-like object providing a view on the mapping's keys :rtype: ~typing.KeysView """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: """ - :returns: an object providing a view on D's values + :returns: an object providing a view on the mapping's values :rtype: ~typing.ValuesView """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: """ - :returns: set-like object providing a view on D's items + :returns: a set-like object providing a view on the mapping's items :rtype: ~typing.ItemsView """ return self._data.items() @@ -444,7 +498,7 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ try: @@ -479,19 +533,19 @@ def popitem(self) -> tuple[str, typing.Any]: Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple - :raises KeyError: if D is empty. + :raises KeyError: if the dictionary is empty. """ return self._data.popitem() def clear(self) -> None: """ - Remove all items from D. + Remove all items from the dictionary. """ self._data.clear() def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ """ - Updates D from mapping/iterable E and F. + Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs. """ self._data.update(*args, **kwargs) @@ -504,10 +558,11 @@ def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: """ - Same as calling D.get(k, d), and setting D[k]=d if k not found + Return the value for key if key is in the dictionary; otherwise set the key to + default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ if default is _UNSET: @@ -559,7 +614,7 @@ def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-m pass # Last, try datetime.timedelta try: - return _timedelta_as_isostr(o) + return _serialize_duration(o, format) except AttributeError: # This will be raised when it hits value.total_seconds in the method above pass @@ -585,6 +640,239 @@ def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typin return _serialize(value, rf._format) +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param class Model(_MyMutableMapping): _is_model = True # label whether current class's _attr_to_rest_field has been calculated @@ -595,11 +883,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -619,9 +903,19 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if v is not None } ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) super().__init__(dict_to_pass) - def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: """Deserialize an XML element into a dict mapping rest field names to values. :param ET.Element element: The XML element to deserialize from. @@ -629,53 +923,89 @@ def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: :rtype: dict """ result: dict[str, typing.Any] = {} - model_meta = getattr(self, "_xml", {}) existed_attr_keys: list[str] = [] - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) + result[rf._rest_name] = _deserialize(rf._type, item) # rest thing is additional properties for e in element: @@ -708,6 +1038,9 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: if not rf._rest_name_input: rf._rest_name_input = attr cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) @@ -1082,6 +1415,7 @@ def __init__( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ): self._type = type self._rest_name_input = name @@ -1094,6 +1428,7 @@ def __init__( self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._deserializer = deserializer @property def _class_type(self) -> typing.Any: @@ -1113,7 +1448,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: @@ -1126,7 +1464,11 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # Return the value from _data directly (it's been deserialized in place) return obj._data.get(self._rest_name) - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) # For mutable types, store the deserialized value back in _data # so mutations directly affect _data @@ -1172,6 +1514,7 @@ def rest_field( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ) -> typing.Any: return _RestField( name=name, @@ -1181,6 +1524,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + deserializer=deserializer, ) @@ -1414,6 +1758,8 @@ def _deserialize_xml( value: str, ) -> typing.Any: element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) return _deserialize(deserializer, element) diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/serialization.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/serialization.py index 81ec1de5922b..ae08f9d89f74 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/serialization.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -476,7 +480,11 @@ def _decode_attribute_map_key(key): class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" + """Request object model serializer. + + :param classes: Mapping of model names to model types, used to resolve models during serialization. + :type classes: typing.Optional[typing.Mapping[str, type]] + """ basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -516,6 +524,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Serializer.serialize_rfc, "unix-time": Serializer.serialize_unix, "duration": Serializer.serialize_duration, + "duration-seconds-int": Serializer.serialize_duration_seconds_int, + "duration-seconds-float": Serializer.serialize_duration_seconds_float, + "duration-milliseconds-int": Serializer.serialize_duration_milliseconds_int, + "duration-milliseconds-float": Serializer.serialize_duration_milliseconds_float, "date": Serializer.serialize_date, "time": Serializer.serialize_time, "decimal": Serializer.serialize_decimal, @@ -1105,6 +1117,61 @@ def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) + @staticmethod + def _serialize_duration_numeric(attr, scale, as_int): + """Serialize a TimeDelta into a numeric value scaled to the wire unit. + + :param TimeDelta attr: Object to be serialized. + :param int scale: Multiplier applied to total seconds (1 for seconds, 1000 for milliseconds). + :param bool as_int: Whether to truncate the result to an int. + :rtype: int or float + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + value = attr.total_seconds() * scale if isinstance(attr, datetime.timedelta) else attr + return int(value) if as_int else float(value) + + @staticmethod + def serialize_duration_seconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, True) + + @staticmethod + def serialize_duration_seconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, False) + + @staticmethod + def serialize_duration_milliseconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, True) + + @staticmethod + def serialize_duration_milliseconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, False) + @staticmethod def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. @@ -1377,6 +1444,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Deserializer.deserialize_rfc, "unix-time": Deserializer.deserialize_unix, "duration": Deserializer.deserialize_duration, + "duration-seconds-int": Deserializer.deserialize_duration_seconds, + "duration-seconds-float": Deserializer.deserialize_duration_seconds, + "duration-milliseconds-int": Deserializer.deserialize_duration_milliseconds, + "duration-milliseconds-float": Deserializer.deserialize_duration_milliseconds, "date": Deserializer.deserialize_date, "time": Deserializer.deserialize_time, "decimal": Deserializer.deserialize_decimal, @@ -1389,6 +1460,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: } self.deserialize_expected_types = { "duration": (isodate.Duration, datetime.timedelta), + "duration-seconds-int": (isodate.Duration, datetime.timedelta), + "duration-seconds-float": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-int": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-float": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } self.dependencies: dict[str, type] = dict(classes) if classes else {} @@ -1401,7 +1476,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1411,6 +1486,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) @@ -1929,6 +2025,48 @@ def deserialize_duration(attr): raise DeserializationError(msg) from err return duration + @staticmethod + def _deserialize_duration_numeric(attr, unit): + """Deserialize a numeric duration value into a TimeDelta object. + + :param float attr: response value to be deserialized. + :param str unit: The wire unit, used as the ``timedelta`` keyword + (``"seconds"`` or ``"milliseconds"``). + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = datetime.timedelta(**{unit: float(attr)}) # type: ignore + except (ValueError, OverflowError, TypeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_duration_seconds(attr): + """Deserialize a numeric number of seconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "seconds") + + @staticmethod + def deserialize_duration_milliseconds(attr): + """Deserialize a numeric number of milliseconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "milliseconds") + @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. diff --git a/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/utils.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/utils.py index 927adb7c8ae2..b0131200252f 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/utils.py +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/_utils/utils.py @@ -6,10 +6,14 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import Generic, Optional, TYPE_CHECKING, TypeVar +import json +import os +from typing import Any, Generic, IO, Mapping, Optional, TYPE_CHECKING, TypeVar, Union from azure.core import MatchConditions +from .._utils.model_base import Model, SdkJSONEncoder + if TYPE_CHECKING: from .serialization import Deserializer, Serializer @@ -55,3 +59,81 @@ def prep_if_none_match(etag: Optional[str], match_condition: Optional[MatchCondi if match_condition == MatchConditions.IfMissing: return "*" return None + + +# file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)` +FileContent = Union[str, bytes, IO[str], IO[bytes]] + +FileType = Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + tuple[Optional[str], FileContent], + # (filename, file (or bytes), content_type) + tuple[Optional[str], FileContent, Optional[str]], +] + + +def serialize_multipart_data_entry(data_entry: Any) -> Any: + if isinstance(data_entry, (list, tuple, dict, Model)): + return json.dumps(data_entry, cls=SdkJSONEncoder, exclude_readonly=True) + return data_entry + + +def _normalize_multipart_file_entry(field_name: str, entry: Any, index: int) -> Any: + """Ensure a multipart file entry carries a filename for Content-Disposition. + + Servers distinguish file parts from plain form fields by the presence of + ``filename=`` in the ``Content-Disposition`` header. When callers pass + bare bytes/str/IO the HTTP client omits the filename and the server may + reject the upload. This helper wraps bare values into a (filename, content) + tuple, deriving the name from IO.name when available. + + :param str field_name: The multipart field name used as a filename fallback. + :param entry: The user-provided file entry (tuple, bytes, str, or IO). + :type entry: any + :param int index: The positional index of the entry within the field, used + to disambiguate fallback filenames when multiple entries are provided. + :return: Either the original tuple entry, or a ``(filename, content)`` tuple + wrapping the bare value. + :rtype: any + """ + if isinstance(entry, tuple): + return entry + filename: Optional[str] = None + name_attr = getattr(entry, "name", None) + if isinstance(name_attr, str) and name_attr: + filename = os.path.basename(name_attr) + if not filename: + filename = f"{field_name}_{index}" if index else field_name + + # Return a 3-tuple with an explicit "application/octet-stream" content type. + # A 2-tuple (filename, content) would leave the part's Content-Type unset, and + # the sdk core library only defaults to "application/octet-stream" for bare + # (non-tuple) values - a tuple bypasses that default and falls back to the + # HTTP "text/plain" default instead. Setting it explicitly preserves the + # pre-existing behavior for bare bytes/IO across all transports. + return (filename, entry, "application/octet-stream") + + +def prepare_multipart_form_data( + body: Mapping[str, Any], multipart_fields: list[str], data_fields: list[str] +) -> list[FileType]: + files: list[FileType] = [] + + # Data fields first so streaming server-side parsers see metadata before + # binary file parts. + for data_field in data_fields: + data_entry = body.get(data_field) + if data_entry: + files.append((data_field, str(serialize_multipart_data_entry(data_entry)))) + + for multipart_field in multipart_fields: + multipart_entry = body.get(multipart_field) + if isinstance(multipart_entry, list): + for idx, e in enumerate(multipart_entry): + files.append((multipart_field, _normalize_multipart_file_entry(multipart_field, e, idx))) + elif multipart_entry is not None: + files.append((multipart_field, _normalize_multipart_file_entry(multipart_field, multipart_entry, 0))) + + return files 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 78e71a744af2..a68dcf474b6e 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 @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,11 +19,18 @@ from ._configuration import SearchIndexClientConfiguration, SearchIndexerClientConfiguration from ._operations import _SearchIndexClientOperationsMixin, _SearchIndexerClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential -class SearchIndexClient(_SearchIndexClientOperationsMixin): +class SearchIndexClient( + _SearchIndexClientOperationsMixin +): # pylint: disable=docstring-keyword-should-match-keyword-only """SearchIndexClient. :param endpoint: The endpoint URL of the search service. Required. @@ -33,8 +40,9 @@ class SearchIndexClient(_SearchIndexClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -106,7 +114,9 @@ async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) -class SearchIndexerClient(_SearchIndexerClientOperationsMixin): +class SearchIndexerClient( + _SearchIndexerClientOperationsMixin +): # pylint: disable=docstring-keyword-should-match-keyword-only """SearchIndexerClient. :param endpoint: The endpoint URL of the search service. Required. @@ -116,8 +126,9 @@ class SearchIndexerClient(_SearchIndexerClientOperationsMixin): :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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 fdfd0c820779..b13d1ed65042 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -17,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attributes +class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for SearchIndexClient. Note that all parameters used to create this instance are saved as instance @@ -30,15 +31,16 @@ class SearchIndexClientConfiguration: # pylint: disable=too-many-instance-attri :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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-05-01-preview") + api_version: str = kwargs.pop("api_version", "2026-08-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -74,7 +76,7 @@ def _configure(self, **kwargs: Any) -> None: self.authentication_policy = self._infer_policy(**kwargs) -class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-attributes +class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for SearchIndexerClient. Note that all parameters used to create this instance are saved as instance @@ -87,15 +89,16 @@ class SearchIndexerClientConfiguration: # pylint: disable=too-many-instance-att :type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Known values are - "2026-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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-05-01-preview") + api_version: str = kwargs.pop("api_version", "2026-08-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 88a417b69913..3cc1796a3c8f 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 @@ -31,10 +31,10 @@ from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict -from ... import models as _models2 +from ... import models as _models2, types as _types_models2 from .... import models as _models3 -from ...._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize -from ...._utils.utils import ClientMixinABC +from ...._utils.model_base import Model as _Model, SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ...._utils.utils import ClientMixinABC, prepare_multipart_form_data from ...._validation import api_version_validation from ....knowledgebases import models as _knowledgebases_models4 from ..._operations._operations import ( @@ -71,6 +71,8 @@ build_search_index_list_knowledge_bases_request, build_search_index_list_knowledge_source_files_request, build_search_index_list_knowledge_sources_request, + build_search_index_update_knowledge_source_file_request, + build_search_index_upload_knowledge_source_file_multipart_request, build_search_index_upload_knowledge_source_file_request, build_search_indexer_create_data_source_connection_request, build_search_indexer_create_indexer_request, @@ -96,7 +98,6 @@ ) from .._configuration import SearchIndexClientConfiguration, SearchIndexerClientConfiguration -JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] @@ -120,7 +121,7 @@ async def _create_or_update_synonym_map( async def _create_or_update_synonym_map( self, name: str, - synonym_map: JSON, + synonym_map: _types_models2.SynonymMap, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -143,7 +144,7 @@ async def _create_or_update_synonym_map( async def _create_or_update_synonym_map( self, name: str, - synonym_map: Union[_models2.SynonymMap, JSON, IO[bytes]], + synonym_map: Union[_models2.SynonymMap, _types_models2.SynonymMap, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -153,9 +154,10 @@ async def _create_or_update_synonym_map( :param name: The name of the synonym map. Required. :type name: str - :param synonym_map: The definition of the synonym map to create or update. Is one of the - following types: SynonymMap, JSON, IO[bytes] Required. - :type synonym_map: ~azure.search.documents.indexes.models.SynonymMap or JSON or IO[bytes] + :param synonym_map: The definition of the synonym map to create or update. Is either a + SynonymMap type or a IO[bytes] type. Required. + :type synonym_map: ~azure.search.documents.indexes.models.SynonymMap or + ~azure.search.documents.indexes.types.SynonymMap or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -372,20 +374,46 @@ async def get_synonym_map(self, name: str, **kwargs: Any) -> _models2.SynonymMap return deserialized # type: ignore - @distributed_trace_async - async def _get_synonym_maps( - self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> _models2._models.ListSynonymMapsResult: + @distributed_trace + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def _get_synonym_maps( + self, + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models2.SynonymMap"]: """Lists all synonym maps 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] - :return: ListSynonymMapsResult. The ListSynonymMapsResult is compatible with MutableMapping - :rtype: ~azure.search.documents.indexes.models._models.ListSynonymMapsResult + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of SynonymMap + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SynonymMap] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models2.SynonymMap]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -394,54 +422,80 @@ async def _get_synonym_maps( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models2._models.ListSynonymMapsResult] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_search_index_get_synonym_maps_request( - select=select, - 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) + _request = build_search_index_get_synonym_maps_request( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + 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) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models3.ErrorResponse, - response, + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models2.SynonymMap], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, AsyncList(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize( - _models2._models.ListSynonymMapsResult, response.json() # pylint: disable=protected-access + 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 cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + 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 deserialized # type: ignore + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @overload async def create_synonym_map( @@ -461,12 +515,12 @@ async def create_synonym_map( @overload async def create_synonym_map( - self, synonym_map: JSON, *, content_type: str = "application/json", **kwargs: Any + self, synonym_map: _types_models2.SynonymMap, *, content_type: str = "application/json", **kwargs: Any ) -> _models2.SynonymMap: """Creates a new synonym map. :param synonym_map: The definition of the synonym map to create. Required. - :type synonym_map: JSON + :type synonym_map: ~azure.search.documents.indexes.types.SynonymMap :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -493,13 +547,14 @@ async def create_synonym_map( @distributed_trace_async async def create_synonym_map( - self, synonym_map: Union[_models2.SynonymMap, JSON, IO[bytes]], **kwargs: Any + self, synonym_map: Union[_models2.SynonymMap, _types_models2.SynonymMap, IO[bytes]], **kwargs: Any ) -> _models2.SynonymMap: """Creates a new synonym map. - :param synonym_map: The definition of the synonym map to create. Is one of the following types: - SynonymMap, JSON, IO[bytes] Required. - :type synonym_map: ~azure.search.documents.indexes.models.SynonymMap or JSON or IO[bytes] + :param synonym_map: The definition of the synonym map to create. Is either a SynonymMap type or + a IO[bytes] type. Required. + :type synonym_map: ~azure.search.documents.indexes.models.SynonymMap or + ~azure.search.documents.indexes.types.SynonymMap or IO[bytes] :return: SynonymMap. The SynonymMap is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SynonymMap :raises ~azure.core.exceptions.HttpResponseError: @@ -584,7 +639,7 @@ async def _create_or_update_index( async def _create_or_update_index( self, name: str, - index: JSON, + index: _types_models2.SearchIndex, *, allow_index_downtime: Optional[bool] = None, content_type: str = "application/json", @@ -609,7 +664,7 @@ async def _create_or_update_index( async def _create_or_update_index( self, name: str, - index: Union[_models2.SearchIndex, JSON, IO[bytes]], + index: Union[_models2.SearchIndex, _types_models2.SearchIndex, IO[bytes]], *, allow_index_downtime: Optional[bool] = None, etag: Optional[str] = None, @@ -620,9 +675,10 @@ async def _create_or_update_index( :param name: The name of the index. Required. :type name: str - :param index: The definition of the index to create or update. Is one of the following types: - SearchIndex, JSON, IO[bytes] Required. - :type index: ~azure.search.documents.indexes.models.SearchIndex or JSON or IO[bytes] + :param index: The definition of the index to create or update. Is either a SearchIndex type or + a IO[bytes] type. Required. + :type index: ~azure.search.documents.indexes.models.SearchIndex or + ~azure.search.documents.indexes.types.SearchIndex or IO[bytes] :keyword allow_index_downtime: Allows new analyzers, tokenizers, token filters, or char filters to be added to an index by taking the index offline for at least a few seconds. This temporarily causes indexing and query requests to fail. Performance and write availability of @@ -850,22 +906,32 @@ async def get_index(self, name: str, **kwargs: Any) -> _models2.SearchIndex: @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"], + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": ["api_version", "accept", "search", "page_size", "search_type", "client_request_id"] + }, + api_versions_list=["2026-08-01-preview"], ) def _list_indexes( - self, *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None, **kwargs: Any + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = 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 + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of SearchIndex :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndex] @@ -888,9 +954,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_indexes_request( - top=top, - skip=skip, - count=count, + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -913,7 +979,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -957,16 +1026,27 @@ async def get_next(next_link=None): @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"], + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": [ + "api_version", + "accept", + "select", + "search", + "page_size", + "search_type", + "client_request_id", + ] + }, + api_versions_list=["2026-08-01-preview"], ) def _list_indexes_with_selected_properties( self, *, select: Optional[list[str]] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - count: Optional[bool] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = None, **kwargs: Any ) -> AsyncItemPaged["_models2._models.SearchIndexResponse"]: """Lists all indexes available for a search service. @@ -975,14 +1055,16 @@ 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 + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of SearchIndexResponse :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models._models.SearchIndexResponse] @@ -1006,9 +1088,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, + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1031,7 +1113,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1091,12 +1176,12 @@ async def create_index( @overload async def create_index( - self, index: JSON, *, content_type: str = "application/json", **kwargs: Any + self, index: _types_models2.SearchIndex, *, content_type: str = "application/json", **kwargs: Any ) -> _models2.SearchIndex: """Creates a new search index. :param index: The definition of the index to create. Required. - :type index: JSON + :type index: ~azure.search.documents.indexes.types.SearchIndex :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1123,13 +1208,14 @@ async def create_index( @distributed_trace_async async def create_index( - self, index: Union[_models2.SearchIndex, JSON, IO[bytes]], **kwargs: Any + self, index: Union[_models2.SearchIndex, _types_models2.SearchIndex, IO[bytes]], **kwargs: Any ) -> _models2.SearchIndex: """Creates a new search index. - :param index: The definition of the index to create. Is one of the following types: - SearchIndex, JSON, IO[bytes] Required. - :type index: ~azure.search.documents.indexes.models.SearchIndex or JSON or IO[bytes] + :param index: The definition of the index to create. Is either a SearchIndex type or a + IO[bytes] type. Required. + :type index: ~azure.search.documents.indexes.models.SearchIndex or + ~azure.search.documents.indexes.types.SearchIndex or IO[bytes] :return: SearchIndex. The SearchIndex is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchIndex :raises ~azure.core.exceptions.HttpResponseError: @@ -1270,7 +1356,12 @@ async def _analyze_text( ) -> _models2.AnalyzeResult: ... @overload async def _analyze_text( - self, name: str, request: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + request: _types_models2.AnalyzeTextOptions, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models2.AnalyzeResult: ... @overload async def _analyze_text( @@ -1279,15 +1370,19 @@ async def _analyze_text( @distributed_trace_async async def _analyze_text( - self, name: str, request: Union[_models2.AnalyzeTextOptions, JSON, IO[bytes]], **kwargs: Any + self, + name: str, + request: Union[_models2.AnalyzeTextOptions, _types_models2.AnalyzeTextOptions, IO[bytes]], + **kwargs: Any ) -> _models2.AnalyzeResult: """Shows how an analyzer breaks text into tokens. :param name: The name of the index. Required. :type name: str - :param request: The text and analyzer or analysis components to test. Is one of the following - types: AnalyzeTextOptions, JSON, IO[bytes] Required. - :type request: ~azure.search.documents.indexes.models.AnalyzeTextOptions or JSON or IO[bytes] + :param request: The text and analyzer or analysis components to test. Is either a + AnalyzeTextOptions type or a IO[bytes] type. Required. + :type request: ~azure.search.documents.indexes.models.AnalyzeTextOptions or + ~azure.search.documents.indexes.types.AnalyzeTextOptions or IO[bytes] :return: AnalyzeResult. The AnalyzeResult is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.AnalyzeResult :raises ~azure.core.exceptions.HttpResponseError: @@ -1372,7 +1467,7 @@ async def _create_or_update_alias( async def _create_or_update_alias( self, name: str, - alias: JSON, + alias: _types_models2.SearchAlias, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -1395,7 +1490,7 @@ async def _create_or_update_alias( async def _create_or_update_alias( self, name: str, - alias: Union[_models2.SearchAlias, JSON, IO[bytes]], + alias: Union[_models2.SearchAlias, _types_models2.SearchAlias, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -1405,9 +1500,10 @@ async def _create_or_update_alias( :param name: The name of the alias. Required. :type name: str - :param alias: The definition of the alias to create or update. Is one of the following types: - SearchAlias, JSON, IO[bytes] Required. - :type alias: ~azure.search.documents.indexes.models.SearchAlias or JSON or IO[bytes] + :param alias: The definition of the alias to create or update. Is either a SearchAlias type or + a IO[bytes] type. Required. + :type alias: ~azure.search.documents.indexes.models.SearchAlias or + ~azure.search.documents.indexes.types.SearchAlias or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -1626,9 +1722,30 @@ async def get_alias(self, name: str, **kwargs: Any) -> _models2.SearchAlias: return deserialized # type: ignore @distributed_trace - def list_aliases(self, **kwargs: Any) -> AsyncItemPaged["_models2.SearchAlias"]: + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def list_aliases( + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models2.SearchAlias"]: """Lists all aliases available for a search service. + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of SearchAlias :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchAlias] @@ -1651,6 +1768,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_aliases_request( + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1673,7 +1793,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -1692,7 +1815,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) @@ -1733,12 +1856,12 @@ async def create_alias( @overload async def create_alias( - self, alias: JSON, *, content_type: str = "application/json", **kwargs: Any + self, alias: _types_models2.SearchAlias, *, content_type: str = "application/json", **kwargs: Any ) -> _models2.SearchAlias: """Creates a new search alias. :param alias: The definition of the alias to create. Required. - :type alias: JSON + :type alias: ~azure.search.documents.indexes.types.SearchAlias :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1765,13 +1888,14 @@ async def create_alias( @distributed_trace_async async def create_alias( - self, alias: Union[_models2.SearchAlias, JSON, IO[bytes]], **kwargs: Any + self, alias: Union[_models2.SearchAlias, _types_models2.SearchAlias, IO[bytes]], **kwargs: Any ) -> _models2.SearchAlias: """Creates a new search alias. - :param alias: The definition of the alias to create. Is one of the following types: - SearchAlias, JSON, IO[bytes] Required. - :type alias: ~azure.search.documents.indexes.models.SearchAlias or JSON or IO[bytes] + :param alias: The definition of the alias to create. Is either a SearchAlias type or a + IO[bytes] type. Required. + :type alias: ~azure.search.documents.indexes.models.SearchAlias or + ~azure.search.documents.indexes.types.SearchAlias or IO[bytes] :return: SearchAlias. The SearchAlias is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchAlias :raises ~azure.core.exceptions.HttpResponseError: @@ -1855,7 +1979,7 @@ async def _create_or_update_knowledge_base( async def _create_or_update_knowledge_base( self, name: str, - knowledge_base: JSON, + knowledge_base: _types_models2.KnowledgeBase, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -1878,7 +2002,7 @@ async def _create_or_update_knowledge_base( async def _create_or_update_knowledge_base( self, name: str, - knowledge_base: Union[_models2.KnowledgeBase, JSON, IO[bytes]], + knowledge_base: Union[_models2.KnowledgeBase, _types_models2.KnowledgeBase, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -1888,9 +2012,10 @@ async def _create_or_update_knowledge_base( :param name: The name of the knowledge base. Required. :type name: str - :param knowledge_base: The definition of the knowledge base to create or update. Is one of the - following types: KnowledgeBase, JSON, IO[bytes] Required. - :type knowledge_base: ~azure.search.documents.indexes.models.KnowledgeBase or JSON or IO[bytes] + :param knowledge_base: The definition of the knowledge base to create or update. Is either a + KnowledgeBase type or a IO[bytes] type. Required. + :type knowledge_base: ~azure.search.documents.indexes.models.KnowledgeBase or + ~azure.search.documents.indexes.types.KnowledgeBase or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -2108,9 +2233,30 @@ async def get_knowledge_base(self, name: str, **kwargs: Any) -> _models2.Knowled return deserialized # type: ignore @distributed_trace - def list_knowledge_bases(self, **kwargs: Any) -> AsyncItemPaged["_models2.KnowledgeBase"]: + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def list_knowledge_bases( + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models2.KnowledgeBase"]: """Lists all knowledge bases available for a search service. + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of KnowledgeBase :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.KnowledgeBase] @@ -2133,6 +2279,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_knowledge_bases_request( + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2155,7 +2304,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -2174,7 +2326,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) @@ -2215,12 +2367,12 @@ async def create_knowledge_base( @overload async def create_knowledge_base( - self, knowledge_base: JSON, *, content_type: str = "application/json", **kwargs: Any + self, knowledge_base: _types_models2.KnowledgeBase, *, content_type: str = "application/json", **kwargs: Any ) -> _models2.KnowledgeBase: """Creates a new knowledge base. :param knowledge_base: The definition of the knowledge base to create. Required. - :type knowledge_base: JSON + :type knowledge_base: ~azure.search.documents.indexes.types.KnowledgeBase :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2247,13 +2399,14 @@ async def create_knowledge_base( @distributed_trace_async async def create_knowledge_base( - self, knowledge_base: Union[_models2.KnowledgeBase, JSON, IO[bytes]], **kwargs: Any + self, knowledge_base: Union[_models2.KnowledgeBase, _types_models2.KnowledgeBase, IO[bytes]], **kwargs: Any ) -> _models2.KnowledgeBase: """Creates a new knowledge base. - :param knowledge_base: The definition of the knowledge base to create. Is one of the following - types: KnowledgeBase, JSON, IO[bytes] Required. - :type knowledge_base: ~azure.search.documents.indexes.models.KnowledgeBase or JSON or IO[bytes] + :param knowledge_base: The definition of the knowledge base to create. Is either a + KnowledgeBase type or a IO[bytes] type. Required. + :type knowledge_base: ~azure.search.documents.indexes.models.KnowledgeBase or + ~azure.search.documents.indexes.types.KnowledgeBase or IO[bytes] :return: KnowledgeBase. The KnowledgeBase is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.KnowledgeBase :raises ~azure.core.exceptions.HttpResponseError: @@ -2337,7 +2490,7 @@ async def _create_or_update_knowledge_source( async def _create_or_update_knowledge_source( self, name: str, - knowledge_source: JSON, + knowledge_source: _types_models2.KnowledgeSource, *, content_type: str = "application/json", etag: Optional[str] = None, @@ -2360,7 +2513,7 @@ async def _create_or_update_knowledge_source( async def _create_or_update_knowledge_source( self, name: str, - knowledge_source: Union[_models2.KnowledgeSource, JSON, IO[bytes]], + knowledge_source: Union[_models2.KnowledgeSource, _types_models2.KnowledgeSource, IO[bytes]], *, etag: Optional[str] = None, match_condition: Optional[MatchConditions] = None, @@ -2370,10 +2523,10 @@ async def _create_or_update_knowledge_source( :param name: The name of the knowledge source. Required. :type name: str - :param knowledge_source: The definition of the knowledge source to create or update. Is one of - the following types: KnowledgeSource, JSON, IO[bytes] Required. - :type knowledge_source: ~azure.search.documents.indexes.models.KnowledgeSource or JSON or - IO[bytes] + :param knowledge_source: The definition of the knowledge source to create or update. Is either + a KnowledgeSource type or a IO[bytes] type. Required. + :type knowledge_source: ~azure.search.documents.indexes.models.KnowledgeSource or + ~azure.search.documents.indexes.types.KnowledgeSource or IO[bytes] :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is None. :paramtype etag: str @@ -2591,9 +2744,30 @@ async def get_knowledge_source(self, name: str, **kwargs: Any) -> _models2.Knowl return deserialized # type: ignore @distributed_trace - def list_knowledge_sources(self, **kwargs: Any) -> AsyncItemPaged["_models2.KnowledgeSource"]: + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def list_knowledge_sources( + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models2.KnowledgeSource"]: """Lists all knowledge sources available for a search service. + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of KnowledgeSource :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.KnowledgeSource] @@ -2616,6 +2790,9 @@ def prepare_request(next_link=None): if not next_link: _request = build_search_index_list_knowledge_sources_request( + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2638,7 +2815,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -2657,7 +2837,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) @@ -2698,12 +2878,12 @@ async def create_knowledge_source( @overload async def create_knowledge_source( - self, knowledge_source: JSON, *, content_type: str = "application/json", **kwargs: Any + self, knowledge_source: _types_models2.KnowledgeSource, *, content_type: str = "application/json", **kwargs: Any ) -> _models2.KnowledgeSource: """Creates a new knowledge source. :param knowledge_source: The definition of the knowledge source to create. Required. - :type knowledge_source: JSON + :type knowledge_source: ~azure.search.documents.indexes.types.KnowledgeSource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -2730,14 +2910,16 @@ async def create_knowledge_source( @distributed_trace_async async def create_knowledge_source( - self, knowledge_source: Union[_models2.KnowledgeSource, JSON, IO[bytes]], **kwargs: Any + self, + knowledge_source: Union[_models2.KnowledgeSource, _types_models2.KnowledgeSource, IO[bytes]], + **kwargs: Any ) -> _models2.KnowledgeSource: """Creates a new knowledge source. - :param knowledge_source: The definition of the knowledge source to create. Is one of the - following types: KnowledgeSource, JSON, IO[bytes] Required. - :type knowledge_source: ~azure.search.documents.indexes.models.KnowledgeSource or JSON or - IO[bytes] + :param knowledge_source: The definition of the knowledge source to create. Is either a + KnowledgeSource type or a IO[bytes] type. Required. + :type knowledge_source: ~azure.search.documents.indexes.models.KnowledgeSource or + ~azure.search.documents.indexes.types.KnowledgeSource or IO[bytes] :return: KnowledgeSource. The KnowledgeSource is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.KnowledgeSource :raises ~azure.core.exceptions.HttpResponseError: @@ -2873,6 +3055,27 @@ async def get_knowledge_source_status( return deserialized # type: ignore + @overload + async def _upload_knowledge_source_file( + self, + name: str, + file: bytes, + *, + content_disposition: str, + content_type: str = "application/octet-stream", + **kwargs: Any + ) -> _models2.KnowledgeSourceFile: ... + @overload + async def _upload_knowledge_source_file( + self, + name: str, + file: IO[bytes], + *, + content_disposition: str, + content_type: str = "application/octet-stream", + **kwargs: Any + ) -> _models2.KnowledgeSourceFile: ... + @distributed_trace_async @api_version_validation( method_added_on="2026-05-01-preview", @@ -2886,17 +3089,17 @@ async def get_knowledge_source_status( "accept", ] }, - api_versions_list=["2026-05-01-preview"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) async def _upload_knowledge_source_file( - self, name: str, file: bytes, *, content_disposition: str, **kwargs: Any + self, name: str, file: Union[bytes, IO[bytes]], *, content_disposition: str, **kwargs: Any ) -> _models2.KnowledgeSourceFile: """Uploads a file to a File knowledge source for processing and indexing. :param name: The name of the knowledge source. Required. :type name: str - :param file: The file content to upload. Required. - :type file: bytes + :param file: The file content to upload. Is either a bytes type or a IO[bytes] type. Required. + :type file: bytes or IO[bytes] :keyword content_disposition: The Content-Disposition header specifying the filename of the uploaded file. Must follow the format: ``attachment; filename=""``. @@ -2917,9 +3120,10 @@ async def _upload_knowledge_source_file( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/octet-stream")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) cls: ClsType[_models2.KnowledgeSourceFile] = kwargs.pop("cls", None) + content_type = content_type or "application/octet-stream" _content = file _request = build_search_index_upload_knowledge_source_file_request( @@ -2967,27 +3171,65 @@ async def _upload_knowledge_source_file( 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", "client_request_id", "name"]}, - api_versions_list=["2026-05-01-preview"], - ) - def list_knowledge_source_files(self, name: str, **kwargs: Any) -> AsyncItemPaged["_models2.KnowledgeSourceFile"]: - """Lists all files in a File knowledge source. + @overload + async def upload_knowledge_source_file_multipart( + self, name: str, body: _models2.UploadKnowledgeSourceFileMultipartRequest, **kwargs: Any + ) -> _models2.KnowledgeSourceFile: + """Uploads a file to a File knowledge source using multipart/form-data: a JSON 'metadata' part + (file name and custom metadata) and a 'content' part with the raw file bytes. :param name: The name of the knowledge source. Required. :type name: str - :return: An iterator like instance of KnowledgeSourceFile - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.KnowledgeSourceFile] + :param body: The multipart/form-data body containing the metadata and content parts. Required. + :type body: ~azure.search.documents.indexes.models.UploadKnowledgeSourceFileMultipartRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[list[_models2.KnowledgeSourceFile]] = kwargs.pop("cls", None) + @overload + async def upload_knowledge_source_file_multipart( + self, name: str, body: _types_models2.UploadKnowledgeSourceFileMultipartRequest, **kwargs: Any + ) -> _models2.KnowledgeSourceFile: + """Uploads a file to a File knowledge source using multipart/form-data: a JSON 'metadata' part + (file name and custom metadata) and a 'content' part with the raw file bytes. + + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Required. + :type body: ~azure.search.documents.indexes.types.UploadKnowledgeSourceFileMultipartRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-08-01-preview", + params_added_on={"2026-08-01-preview": ["api_version", "client_request_id", "name", "content_type", "accept"]}, + api_versions_list=["2026-08-01-preview"], + ) + async def upload_knowledge_source_file_multipart( + self, + name: str, + body: Union[ + _models2.UploadKnowledgeSourceFileMultipartRequest, _types_models2.UploadKnowledgeSourceFileMultipartRequest + ], + **kwargs: Any + ) -> _models2.KnowledgeSourceFile: + """Uploads a file to a File knowledge source using multipart/form-data: a JSON 'metadata' part + (file name and custom metadata) and a 'content' part with the raw file bytes. + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Is one of + the following types: UploadKnowledgeSourceFileMultipartRequest Required. + :type body: ~azure.search.documents.indexes.models.UploadKnowledgeSourceFileMultipartRequest or + ~azure.search.documents.indexes.types.UploadKnowledgeSourceFileMultipartRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -2996,55 +3238,169 @@ def list_knowledge_source_files(self, name: str, **kwargs: Any) -> AsyncItemPage } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_search_index_list_knowledge_source_files_request( - name=name, - 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) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - 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) + cls: ClsType[_models2.KnowledgeSourceFile] = kwargs.pop("cls", None) - return _request + _body = body.as_dict() if isinstance(body, _Model) else body + _file_fields: list[str] = ["content"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - list[_models2.KnowledgeSourceFile], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + _request = build_search_index_upload_knowledge_source_file_multipart_request( + name=name, + api_version=self._config.api_version, + files=_files, + 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) - async def get_next(next_link=None): + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models3.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models2.KnowledgeSourceFile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + 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", "client_request_id", "name"], + "2026-08-01-preview": ["prefix", "search", "page_size", "search_type"], + }, + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], + ) + def list_knowledge_source_files( + self, + name: str, + *, + prefix: Optional[str] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models2.KnowledgeSourceFile"]: + """Lists all files in a File knowledge source. + + :param name: The name of the knowledge source. Required. + :type name: str + :keyword prefix: Optional prefix to filter files by their directory-like path. Default value is + None. + :paramtype prefix: str + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of KnowledgeSourceFile + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.KnowledgeSourceFile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models2.KnowledgeSourceFile]] = 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_knowledge_source_files_request( + name=name, + prefix=prefix, + search=search, + page_size=page_size, + search_type=search_type, + 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), + headers=_headers, + 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 + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models2.KnowledgeSourceFile], + 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 @@ -3069,7 +3425,7 @@ async def get_next(next_link=None): @api_version_validation( method_added_on="2026-05-01-preview", params_added_on={"2026-05-01-preview": ["api_version", "file_id", "accept", "client_request_id", "name"]}, - api_versions_list=["2026-05-01-preview"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) async def _delete_knowledge_source_file(self, file_id: str, name: str, **kwargs: Any) -> None: """Deletes a file from a File knowledge source and removes all indexed content derived from it. @@ -3125,6 +3481,137 @@ async def _delete_knowledge_source_file(self, file_id: str, name: str, **kwargs: if cls: return cls(pipeline_response, None, {}) # type: ignore + @overload + async def update_knowledge_source_file( + self, file_id: str, name: str, body: _models2.UpdateKnowledgeSourceFileRequest, **kwargs: Any + ) -> _models2.KnowledgeSourceFile: + """Updates an existing file in a File knowledge source in place, replacing its indexed content. + Uses multipart/form-data: a JSON 'metadata' part (file name and custom metadata) and a + 'content' part with the raw file bytes. + + :param file_id: The unique identifier of the file to update. Required. + :type file_id: str + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Required. + :type body: ~azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_knowledge_source_file( + self, file_id: str, name: str, body: _types_models2.UpdateKnowledgeSourceFileRequest, **kwargs: Any + ) -> _models2.KnowledgeSourceFile: + """Updates an existing file in a File knowledge source in place, replacing its indexed content. + Uses multipart/form-data: a JSON 'metadata' part (file name and custom metadata) and a + 'content' part with the raw file bytes. + + :param file_id: The unique identifier of the file to update. Required. + :type file_id: str + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Required. + :type body: ~azure.search.documents.indexes.types.UpdateKnowledgeSourceFileRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": ["api_version", "file_id", "client_request_id", "name", "content_type", "accept"] + }, + api_versions_list=["2026-08-01-preview"], + ) + async def update_knowledge_source_file( + self, + file_id: str, + name: str, + body: Union[_models2.UpdateKnowledgeSourceFileRequest, _types_models2.UpdateKnowledgeSourceFileRequest], + **kwargs: Any + ) -> _models2.KnowledgeSourceFile: + """Updates an existing file in a File knowledge source in place, replacing its indexed content. + Uses multipart/form-data: a JSON 'metadata' part (file name and custom metadata) and a + 'content' part with the raw file bytes. + + :param file_id: The unique identifier of the file to update. Required. + :type file_id: str + :param name: The name of the knowledge source. Required. + :type name: str + :param body: The multipart/form-data body containing the metadata and content parts. Is one of + the following types: UpdateKnowledgeSourceFileRequest Required. + :type body: ~azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest or + ~azure.search.documents.indexes.types.UpdateKnowledgeSourceFileRequest + :return: KnowledgeSourceFile. The KnowledgeSourceFile is compatible with MutableMapping + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models2.KnowledgeSourceFile] = kwargs.pop("cls", None) + + _body = body.as_dict() if isinstance(body, _Model) else body + _file_fields: list[str] = ["content"] + _data_fields: list[str] = ["metadata"] + _files = prepare_multipart_form_data(_body, _file_fields, _data_fields) + + _request = build_search_index_update_knowledge_source_file_request( + file_id=file_id, + name=name, + api_version=self._config.api_version, + files=_files, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models3.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models2.KnowledgeSourceFile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @distributed_trace_async async def get_service_statistics(self, **kwargs: Any) -> _models2.SearchServiceStatistics: """Gets service level statistics for a search service. @@ -3189,23 +3676,32 @@ async def get_service_statistics(self, **kwargs: Any) -> _models2.SearchServiceS @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"], + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": ["api_version", "accept", "search", "page_size", "search_type", "client_request_id"] + }, + api_versions_list=["2026-08-01-preview"], ) def list_index_stats_summary( - self, *, top: Optional[int] = None, skip: Optional[int] = None, count: Optional[bool] = None, **kwargs: Any + self, + *, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = 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 + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: An iterator like instance of IndexStatisticsSummary :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.IndexStatisticsSummary] @@ -3228,9 +3724,9 @@ 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, + search=search, + page_size=page_size, + search_type=search_type, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3253,7 +3749,10 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) path_format_arguments = { "endpoint": self._serialize.url( @@ -3316,7 +3815,7 @@ async def _create_or_update_data_source_connection( async def _create_or_update_data_source_connection( self, name: str, - data_source: JSON, + data_source: _types_models2.SearchIndexerDataSourceConnection, *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, content_type: str = "application/json", @@ -3340,12 +3839,14 @@ async def _create_or_update_data_source_connection( @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"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) async def _create_or_update_data_source_connection( self, name: str, - data_source: Union[_models2.SearchIndexerDataSourceConnection, JSON, IO[bytes]], + data_source: Union[ + _models2.SearchIndexerDataSourceConnection, _types_models2.SearchIndexerDataSourceConnection, IO[bytes] + ], *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, etag: Optional[str] = None, @@ -3356,10 +3857,10 @@ async def _create_or_update_data_source_connection( :param name: The name of the datasource. Required. :type name: str - :param data_source: The definition of the datasource to create or update. Is one of the - following types: SearchIndexerDataSourceConnection, JSON, IO[bytes] Required. + :param data_source: The definition of the datasource to create or update. Is either a + SearchIndexerDataSourceConnection type or a IO[bytes] type. Required. :type data_source: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or - JSON or IO[bytes] + ~azure.search.documents.indexes.types.SearchIndexerDataSourceConnection 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 @@ -3582,20 +4083,46 @@ async def get_data_source_connection(self, name: str, **kwargs: Any) -> _models2 return deserialized # type: ignore - @distributed_trace_async - async def _get_data_source_connections( - self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> _models2._models.ListDataSourcesResult: + @distributed_trace + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def _get_data_source_connections( + self, + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models2.SearchIndexerDataSourceConnection"]: """Lists all datasources 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] - :return: ListDataSourcesResult. The ListDataSourcesResult is compatible with MutableMapping - :rtype: ~azure.search.documents.indexes.models._models.ListDataSourcesResult + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of SearchIndexerDataSourceConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models2.SearchIndexerDataSourceConnection]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3604,54 +4131,80 @@ async def _get_data_source_connections( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models2._models.ListDataSourcesResult] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_search_indexer_get_data_source_connections_request( - select=select, - 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) + _request = build_search_indexer_get_data_source_connections_request( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + 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) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models3.ErrorResponse, - response, + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models2.SearchIndexerDataSourceConnection], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, AsyncList(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize( - _models2._models.ListDataSourcesResult, response.json() # pylint: disable=protected-access + 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 cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + 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 deserialized # type: ignore + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @overload async def create_data_source_connection( @@ -3677,12 +4230,17 @@ async def create_data_source_connection( @overload async def create_data_source_connection( - self, data_source_connection: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + data_source_connection: _types_models2.SearchIndexerDataSourceConnection, + *, + content_type: str = "application/json", + **kwargs: Any ) -> _models2.SearchIndexerDataSourceConnection: """Creates a new datasource. :param data_source_connection: The definition of the datasource to create. Required. - :type data_source_connection: JSON + :type data_source_connection: + ~azure.search.documents.indexes.types.SearchIndexerDataSourceConnection :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -3711,14 +4269,19 @@ async def create_data_source_connection( @distributed_trace_async async def create_data_source_connection( - self, data_source_connection: Union[_models2.SearchIndexerDataSourceConnection, JSON, IO[bytes]], **kwargs: Any + self, + data_source_connection: Union[ + _models2.SearchIndexerDataSourceConnection, _types_models2.SearchIndexerDataSourceConnection, IO[bytes] + ], + **kwargs: Any ) -> _models2.SearchIndexerDataSourceConnection: """Creates a new datasource. - :param data_source_connection: The definition of the datasource to create. Is one of the - following types: SearchIndexerDataSourceConnection, JSON, IO[bytes] Required. + :param data_source_connection: The definition of the datasource to create. Is either a + SearchIndexerDataSourceConnection type or a IO[bytes] type. Required. :type data_source_connection: - ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or JSON or IO[bytes] + ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection or + ~azure.search.documents.indexes.types.SearchIndexerDataSourceConnection or IO[bytes] :return: SearchIndexerDataSourceConnection. The SearchIndexerDataSourceConnection is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection @@ -3851,7 +4414,12 @@ async def _resync( ) -> None: ... @overload async def _resync( - self, name: str, indexer_resync: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + indexer_resync: _types_models2.IndexerResyncBody, + *, + content_type: str = "application/json", + **kwargs: Any ) -> None: ... @overload async def _resync( @@ -3862,19 +4430,22 @@ async def _resync( @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"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) async def _resync( - self, name: str, indexer_resync: Union[_models2.IndexerResyncBody, JSON, IO[bytes]], **kwargs: Any + self, + name: str, + indexer_resync: Union[_models2.IndexerResyncBody, _types_models2.IndexerResyncBody, 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] + :param indexer_resync: The definition of the indexer resync options. Is either a + IndexerResyncBody type or a IO[bytes] type. Required. + :type indexer_resync: ~azure.search.documents.indexes.models.IndexerResyncBody or + ~azure.search.documents.indexes.types.IndexerResyncBody or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -3945,7 +4516,7 @@ async def _reset_documents( async def _reset_documents( self, name: str, - keys_or_ids: Optional[JSON] = None, + keys_or_ids: Optional[_types_models2.DocumentKeysOrIds] = None, *, overwrite: Optional[bool] = None, content_type: str = "application/json", @@ -3968,12 +4539,12 @@ async def _reset_documents( params_added_on={ "2026-05-01-preview": ["api_version", "accept", "overwrite", "client_request_id", "name", "content_type"] }, - api_versions_list=["2026-05-01-preview"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) async def _reset_documents( self, name: str, - keys_or_ids: Optional[Union[_models2.DocumentKeysOrIds, JSON, IO[bytes]]] = None, + keys_or_ids: Optional[Union[_models2.DocumentKeysOrIds, _types_models2.DocumentKeysOrIds, IO[bytes]]] = None, *, overwrite: Optional[bool] = None, **kwargs: Any @@ -3984,10 +4555,10 @@ async def _reset_documents( :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] + document key field is ignored. Is either a DocumentKeysOrIds type or a IO[bytes] type. Default + value is None. + :type keys_or_ids: ~azure.search.documents.indexes.models.DocumentKeysOrIds or + ~azure.search.documents.indexes.types.DocumentKeysOrIds 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 @@ -4121,7 +4692,7 @@ async def _create_or_update_indexer( async def _create_or_update_indexer( self, name: str, - indexer: JSON, + indexer: _types_models2.SearchIndexer, *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, disable_cache_reprocessing_change_detection: Optional[bool] = None, @@ -4152,12 +4723,12 @@ async def _create_or_update_indexer( "disable_cache_reprocessing_change_detection", ] }, - api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) async def _create_or_update_indexer( self, name: str, - indexer: Union[_models2.SearchIndexer, JSON, IO[bytes]], + indexer: Union[_models2.SearchIndexer, _types_models2.SearchIndexer, IO[bytes]], *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, disable_cache_reprocessing_change_detection: Optional[bool] = None, @@ -4169,9 +4740,10 @@ async def _create_or_update_indexer( :param name: The name of the indexer. Required. :type name: str - :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] + :param indexer: The definition of the indexer to create or update. Is either a SearchIndexer + type or a IO[bytes] type. Required. + :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or + ~azure.search.documents.indexes.types.SearchIndexer 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 @@ -4396,20 +4968,46 @@ async def get_indexer(self, name: str, **kwargs: Any) -> _models2.SearchIndexer: return deserialized # type: ignore - @distributed_trace_async - async def _get_indexers( - self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> _models2._models.ListIndexersResult: + @distributed_trace + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def _get_indexers( + self, + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models2.SearchIndexer"]: """Lists all indexers 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] - :return: ListIndexersResult. The ListIndexersResult is compatible with MutableMapping - :rtype: ~azure.search.documents.indexes.models._models.ListIndexersResult + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of SearchIndexer + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndexer] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models2.SearchIndexer]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4418,54 +5016,80 @@ async def _get_indexers( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models2._models.ListIndexersResult] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_search_indexer_get_indexers_request( - select=select, - 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) + _request = build_search_indexer_get_indexers_request( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + 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) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models3.ErrorResponse, - response, + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models2.SearchIndexer], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, AsyncList(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize( - _models2._models.ListIndexersResult, response.json() # pylint: disable=protected-access + 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 cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + 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 deserialized # type: ignore + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @overload async def create_indexer( @@ -4485,12 +5109,12 @@ async def create_indexer( @overload async def create_indexer( - self, indexer: JSON, *, content_type: str = "application/json", **kwargs: Any + self, indexer: _types_models2.SearchIndexer, *, content_type: str = "application/json", **kwargs: Any ) -> _models2.SearchIndexer: """Creates a new indexer. :param indexer: The definition of the indexer to create. Required. - :type indexer: JSON + :type indexer: ~azure.search.documents.indexes.types.SearchIndexer :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -4517,13 +5141,14 @@ async def create_indexer( @distributed_trace_async async def create_indexer( - self, indexer: Union[_models2.SearchIndexer, JSON, IO[bytes]], **kwargs: Any + self, indexer: Union[_models2.SearchIndexer, _types_models2.SearchIndexer, IO[bytes]], **kwargs: Any ) -> _models2.SearchIndexer: """Creates a new indexer. - :param indexer: The definition of the indexer to create. Is one of the following types: - SearchIndexer, JSON, IO[bytes] Required. - :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or JSON or IO[bytes] + :param indexer: The definition of the indexer to create. Is either a SearchIndexer type or a + IO[bytes] type. Required. + :type indexer: ~azure.search.documents.indexes.models.SearchIndexer or + ~azure.search.documents.indexes.types.SearchIndexer or IO[bytes] :return: SearchIndexer. The SearchIndexer is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchIndexer :raises ~azure.core.exceptions.HttpResponseError: @@ -4674,7 +5299,7 @@ async def _create_or_update_skillset( async def _create_or_update_skillset( self, name: str, - skillset: JSON, + skillset: _types_models2.SearchIndexerSkillset, *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, disable_cache_reprocessing_change_detection: Optional[bool] = None, @@ -4705,12 +5330,12 @@ async def _create_or_update_skillset( "disable_cache_reprocessing_change_detection", ] }, - api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview"], + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) async def _create_or_update_skillset( self, name: str, - skillset: Union[_models2.SearchIndexerSkillset, JSON, IO[bytes]], + skillset: Union[_models2.SearchIndexerSkillset, _types_models2.SearchIndexerSkillset, IO[bytes]], *, skip_indexer_reset_requirement_for_cache: Optional[bool] = None, disable_cache_reprocessing_change_detection: Optional[bool] = None, @@ -4723,9 +5348,9 @@ async def _create_or_update_skillset( :param name: The name of the skillset. Required. :type name: str :param skillset: The skillset containing one or more skills to create or update in a search - 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] + service. Is either a SearchIndexerSkillset type or a IO[bytes] type. Required. + :type skillset: ~azure.search.documents.indexes.models.SearchIndexerSkillset or + ~azure.search.documents.indexes.types.SearchIndexerSkillset 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 @@ -4950,20 +5575,46 @@ async def get_skillset(self, name: str, **kwargs: Any) -> _models2.SearchIndexer return deserialized # type: ignore - @distributed_trace_async - async def _get_skillsets( - self, *, select: Optional[list[str]] = None, **kwargs: Any - ) -> _models2._models.ListSkillsetsResult: + @distributed_trace + @api_version_validation( + params_added_on={"2026-08-01-preview": ["search", "page_size", "search_type"]}, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], + ) + def _get_skillsets( + self, + *, + select: Optional[list[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models2.ListingSearchType]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models2.SearchIndexerSkillset"]: """List all skillsets in 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] - :return: ListSkillsetsResult. The ListSkillsetsResult is compatible with MutableMapping - :rtype: ~azure.search.documents.indexes.models._models.ListSkillsetsResult + :keyword search: A string used to narrow down the listing so that fewer results need to be + paged through. If omitted or an empty string is passed, no narrowing is applied. Default value + is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. The server enforces + a maximum; if omitted, the server determines a suitable default. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. "prefix" Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType + :return: An iterator like instance of SearchIndexerSkillset + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.search.documents.indexes.models.SearchIndexerSkillset] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models2.SearchIndexerSkillset]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -4972,54 +5623,80 @@ async def _get_skillsets( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models2._models.ListSkillsetsResult] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_search_indexer_get_skillsets_request( - select=select, - 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) + _request = build_search_indexer_get_skillsets_request( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.endpoint", self._config.endpoint, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + 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) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models3.ErrorResponse, - response, + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + list[_models2.SearchIndexerSkillset], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("@odata.nextLink") or None, AsyncList(list_of_elem) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize( - _models2._models.ListSkillsetsResult, response.json() # pylint: disable=protected-access + 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 cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + 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 deserialized # type: ignore + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) @overload async def create_skillset( @@ -5040,13 +5717,13 @@ async def create_skillset( @overload async def create_skillset( - self, skillset: JSON, *, content_type: str = "application/json", **kwargs: Any + self, skillset: _types_models2.SearchIndexerSkillset, *, content_type: str = "application/json", **kwargs: Any ) -> _models2.SearchIndexerSkillset: """Creates a new skillset in a search service. :param skillset: The skillset containing one or more skills to create in a search service. Required. - :type skillset: JSON + :type skillset: ~azure.search.documents.indexes.types.SearchIndexerSkillset :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -5074,14 +5751,16 @@ async def create_skillset( @distributed_trace_async async def create_skillset( - self, skillset: Union[_models2.SearchIndexerSkillset, JSON, IO[bytes]], **kwargs: Any + self, + skillset: Union[_models2.SearchIndexerSkillset, _types_models2.SearchIndexerSkillset, IO[bytes]], + **kwargs: Any ) -> _models2.SearchIndexerSkillset: """Creates a new skillset in a search service. :param skillset: The skillset containing one or more skills to create in a search 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] + either a SearchIndexerSkillset type or a IO[bytes] type. Required. + :type skillset: ~azure.search.documents.indexes.models.SearchIndexerSkillset or + ~azure.search.documents.indexes.types.SearchIndexerSkillset or IO[bytes] :return: SearchIndexerSkillset. The SearchIndexerSkillset is compatible with MutableMapping :rtype: ~azure.search.documents.indexes.models.SearchIndexerSkillset :raises ~azure.core.exceptions.HttpResponseError: @@ -5156,7 +5835,12 @@ async def _reset_skills( ) -> None: ... @overload async def _reset_skills( - self, name: str, skill_names: JSON, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + skill_names: _types_models2.SkillNames, + *, + content_type: str = "application/json", + **kwargs: Any ) -> None: ... @overload async def _reset_skills( @@ -5167,18 +5851,19 @@ async def _reset_skills( @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"], + api_versions_list=["2026-05-01-preview", "2026-08-01-preview"], ) async def _reset_skills( - self, name: str, skill_names: Union[_models2.SkillNames, JSON, IO[bytes]], **kwargs: Any + self, name: str, skill_names: Union[_models2.SkillNames, _types_models2.SkillNames, 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] + skillset will be reset. Is either a SkillNames type or a IO[bytes] type. Required. + :type skill_names: ~azure.search.documents.indexes.models.SkillNames or + ~azure.search.documents.indexes.types.SkillNames or IO[bytes] :return: None :rtype: None :raises ~azure.core.exceptions.HttpResponseError: 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 7c884fe76970..2d44b7849154 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 @@ -8,6 +8,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, IO, List, Sequence, Union, Optional, TYPE_CHECKING @@ -16,7 +17,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async -from ... import models as _models +from ... import models as _models, types as _types from ..._operations._patch import _convert_index_response from ._operations import ( _SearchIndexClientOperationsMixin as _SearchIndexClientOperationsMixinGenerated, @@ -29,7 +30,9 @@ import azure.search.documents.aio -class _SearchIndexClientOperationsMixin(_SearchIndexClientOperationsMixinGenerated): +class _SearchIndexClientOperationsMixin( + _SearchIndexClientOperationsMixinGenerated +): # pylint: disable=too-many-public-methods """Custom operations mixin for SearchIndexClient (async).""" @distributed_trace_async @@ -412,14 +415,38 @@ async def delete_knowledge_source_file( """ await self._delete_knowledge_source_file(name=name, file_id=file_id, **kwargs) + @distributed_trace_async + # pylint: disable-next=arguments-renamed + async def update_knowledge_source_file( # type: ignore[override] + self, + name: str, + file_id: str, + body: Union[_models.UpdateKnowledgeSourceFileRequest, _types.UpdateKnowledgeSourceFileRequest], + **kwargs: Any, + ) -> _models.KnowledgeSourceFile: + """Updates an existing file in a File knowledge source in place. + + :param name: The name of the File knowledge source. Required. + :type name: str + :param file_id: The unique identifier of the file to update. Required. + :type file_id: str + :param body: The multipart body containing replacement metadata and content. Required. + :type body: ~azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest or + ~azure.search.documents.indexes.types.UpdateKnowledgeSourceFileRequest + :return: The updated knowledge source file. + :rtype: ~azure.search.documents.indexes.models.KnowledgeSourceFile + :raises ~azure.core.exceptions.HttpResponseError: + """ + return await super().update_knowledge_source_file(name=name, file_id=file_id, body=body, **kwargs) + @distributed_trace def list_indexes( self, *, select: Optional[List[str]] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - count: Optional[bool] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, **kwargs: Any, ) -> AsyncItemPaged[_models.SearchIndex]: """Lists all indexes available for a search service. @@ -428,14 +455,13 @@ def list_indexes( 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 + :keyword search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :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: @@ -445,58 +471,84 @@ def list_indexes( AsyncItemPaged[_models.SearchIndex], self._list_indexes_with_selected_properties( select=select, - top=top, - skip=skip, - count=count, + search=search, + page_size=page_size, + search_type=search_type, cls=lambda objs: [_convert_index_response(x) for x in objs], **kwargs, ), ) - return cast(AsyncItemPaged[_models.SearchIndex], self._list_indexes(top=top, skip=skip, count=count, **kwargs)) + return cast( + AsyncItemPaged[_models.SearchIndex], + self._list_indexes(search=search, page_size=page_size, search_type=search_type, **kwargs), + ) @distributed_trace def list_index_names( self, *, - top: Optional[int] = None, - skip: Optional[int] = None, - count: Optional[bool] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = 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 + :keyword search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :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(top=top, skip=skip, count=count, cls=lambda objs: [x.name for x in objs], **kwargs) + names = self._list_indexes( + search=search, + page_size=page_size, + search_type=search_type, + cls=lambda objs: [x.name for x in objs], + **kwargs, + ) return cast(AsyncItemPaged[str], names) @distributed_trace_async - async def get_synonym_maps(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> List[_models.SynonymMap]: + async def get_synonym_maps( + self, + *, + select: Optional[List[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, + **kwargs: Any, + ) -> List[_models.SynonymMap]: """Lists all synonym maps available for a search service. :keyword select: Selects which top-level properties of the synonym maps 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 search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: List of synonym maps :rtype: list[~azure.search.documents.indexes.models.SynonymMap] :raises ~azure.core.exceptions.HttpResponseError: """ - result = await self._get_synonym_maps(select=select, **kwargs) - assert result.synonym_maps is not None # Hint for mypy - # typed_result = [cast(_models.SynonymMap, x) for x in result.synonym_maps] - typed_result = result.synonym_maps - return typed_result + result = self._get_synonym_maps( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + **kwargs, + ) + return [item async for item in result] @distributed_trace_async async def get_synonym_map_names(self, **kwargs: Any) -> List[str]: @@ -738,7 +790,10 @@ async def resync( :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - return await self._resync(name=name, indexer_resync=indexer_resync, **kwargs) + typed_indexer_resync = cast( + Union[_models.IndexerResyncBody, _types.IndexerResyncBody, IO[bytes]], indexer_resync + ) + return await self._resync(name=name, indexer_resync=typed_indexer_resync, **kwargs) @distributed_trace_async async def reset_documents( @@ -764,7 +819,10 @@ async def reset_documents( :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - return await self._reset_documents(name=name, keys_or_ids=keys_or_ids, overwrite=overwrite, **kwargs) + typed_keys_or_ids = cast( + Optional[Union[_models.DocumentKeysOrIds, _types.DocumentKeysOrIds, IO[bytes]]], keys_or_ids + ) + return await self._reset_documents(name=name, keys_or_ids=typed_keys_or_ids, overwrite=overwrite, **kwargs) @distributed_trace_async async def delete_skillset( @@ -854,11 +912,18 @@ async def reset_skills( :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - return await self._reset_skills(name=name, skill_names=skill_names, **kwargs) + typed_skill_names = cast(Union[_models.SkillNames, _types.SkillNames, IO[bytes]], skill_names) + return await self._reset_skills(name=name, skill_names=typed_skill_names, **kwargs) @distributed_trace_async async def get_skillsets( - self, *, select: Optional[List[str]] = None, **kwargs: Any + self, + *, + select: Optional[List[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, + **kwargs: Any, ) -> List[_models.SearchIndexerSkillset]: """Lists all skillsets available for a search service. @@ -866,33 +931,61 @@ async def get_skillsets( list of JSON property names, or '*' for all properties. The default is all properties. Default value is None. :paramtype select: list[str] + :keyword search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: List of all the SearchIndexerSkillsets. :rtype: list[~azure.search.documents.indexes.models.SearchIndexerSkillset] :raises ~azure.core.exceptions.HttpResponseError: """ - result = await self._get_skillsets(select=select, **kwargs) - assert result.skillsets is not None # Hint for mypy - # typed_result = [cast(_models.SearchIndexerSkillset, x) for x in result.skillsets] - typed_result = result.skillsets - return typed_result + result = self._get_skillsets( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + **kwargs, + ) + return [item async for item in result] @distributed_trace_async - async def get_indexers(self, *, select: Optional[List[str]] = None, **kwargs: Any) -> List[_models.SearchIndexer]: + async def get_indexers( + self, + *, + select: Optional[List[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, + **kwargs: Any, + ) -> List[_models.SearchIndexer]: """Lists all indexers 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 search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: List of all the SearchIndexers. :rtype: list[~azure.search.documents.indexes.models.SearchIndexer] :raises ~azure.core.exceptions.HttpResponseError: """ - result = await self._get_indexers(select=select, **kwargs) - assert result.indexers is not None # Hint for mypy - # typed_result = [cast(_models.SearchIndexer, x) for x in result.indexers] - typed_result = result.indexers - return typed_result + result = self._get_indexers( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + **kwargs, + ) + return [item async for item in result] @distributed_trace_async async def get_indexer_names(self, **kwargs) -> Sequence[str]: @@ -906,7 +999,13 @@ async def get_indexer_names(self, **kwargs) -> Sequence[str]: @distributed_trace_async async def get_data_source_connections( - self, *, select: Optional[List[str]] = None, **kwargs: Any + self, + *, + select: Optional[List[str]] = None, + search: Optional[str] = None, + page_size: Optional[int] = None, + search_type: Optional[Union[str, _models.ListingSearchType]] = None, + **kwargs: Any, ) -> List[_models.SearchIndexerDataSourceConnection]: """Lists all data source connections available for a search service. @@ -914,15 +1013,25 @@ async def get_data_source_connections( list of JSON property names, or '*' for all properties. The default is all properties. Default value is None. :paramtype select: list[str] + :keyword search: A string used to narrow down the listing. Default value is None. + :paramtype search: str + :keyword page_size: The maximum number of items to return in a single page. Default value is None. + :paramtype page_size: int + :keyword search_type: Specifies how the search parameter is interpreted. Currently only + 'prefix' is supported. Default value is None. + :paramtype search_type: str or ~azure.search.documents.indexes.models.ListingSearchType :return: List of all the data source connections. :rtype: list[~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection] :raises ~azure.core.exceptions.HttpResponseError: """ - result = await self._get_data_source_connections(select=select, **kwargs) - assert result.data_sources is not None # Hint for mypy - # typed_result = [cast(_models.SearchIndexerDataSourceConnection, x) for x in result.data_sources] - typed_result = result.data_sources - return typed_result + result = self._get_data_source_connections( + select=select, + search=search, + page_size=page_size, + search_type=search_type, + **kwargs, + ) + return [item async for item in result] @distributed_trace_async async def get_data_source_connection_names(self, **kwargs) -> Sequence[str]: 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 ad8fc29ea442..c4be3b19643e 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 @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Union from azure.core.credentials import AzureKeyCredential @@ -26,9 +27,9 @@ class SearchIndexClient(_SearchIndexClient): :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 - listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is - ``ApiVersion.V2026_05_01_PREVIEW``. Note that overriding this default value may - result in unsupported behavior. + listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is + ``ApiVersion.V2026_08_01_PREVIEW``. Note that overriding this default value may + result in unsupported behavior. :paramtype api_version: str or ~azure.search.documents.ApiVersion :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 @@ -54,9 +55,9 @@ class SearchIndexerClient(_SearchIndexerClient): :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 - listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is - ``ApiVersion.V2026_05_01_PREVIEW``. Note that overriding this default value may - result in unsupported behavior. + listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is + ``ApiVersion.V2026_08_01_PREVIEW``. Note that overriding this default value may + result in unsupported behavior. :paramtype api_version: str or ~azure.search.documents.ApiVersion :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/models/__init__.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/models/__init__.py index 792fa82c35d6..1596770e0364 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 @@ -75,6 +75,7 @@ EmbeddingColumnMapping, EntityLinkingSkill, EntityRecognitionSkillV3, + EntraAppAuthentication, ExhaustiveKnnAlgorithmConfiguration, ExhaustiveKnnParameters, FabricDataAgentKnowledgeSource, @@ -85,6 +86,7 @@ FieldMappingFunction, FileKnowledgeSource, FileKnowledgeSourceParameters, + FileUploadMetadata, FreshnessScoringFunction, FreshnessScoringParameters, GetIndexStatisticsResult, @@ -115,6 +117,7 @@ KnowledgeBase, KnowledgeBaseAzureOpenAIModel, KnowledgeBaseModel, + KnowledgeBaseRetrieveDefaults, KnowledgeSource, KnowledgeSourceFile, KnowledgeSourceReference, @@ -176,7 +179,12 @@ SearchIndex, SearchIndexFieldReference, SearchIndexKnowledgeSource, + SearchIndexKnowledgeSourceBoost, + SearchIndexKnowledgeSourceFieldValueBoost, + SearchIndexKnowledgeSourceFilterHint, + SearchIndexKnowledgeSourceMultiWordExpressionBoost, SearchIndexKnowledgeSourceParameters, + SearchIndexKnowledgeSourceQueryHints, SearchIndexer, SearchIndexerCache, SearchIndexerDataContainer, @@ -235,6 +243,8 @@ TruncateTokenFilter, UaxUrlEmailTokenizer, UniqueTokenFilter, + UpdateKnowledgeSourceFileRequest, + UploadKnowledgeSourceFileMultipartRequest, VectorSearch, VectorSearchAlgorithmConfiguration, VectorSearchCompression, @@ -251,6 +261,7 @@ WebKnowledgeSourceParameters, WordDelimiterTokenFilter, WorkIQKnowledgeSource, + WorkIQKnowledgeSourceParameters, ) from ._enums import ( # type: ignore @@ -276,6 +287,7 @@ EdgeNGramTokenFilterSide, EntityCategory, EntityRecognitionSkillLanguage, + FileKnowledgeSourceExtractionMode, ImageAnalysisSkillLanguage, ImageDetail, IndexProjectionMode, @@ -292,15 +304,16 @@ KnowledgeSourceContentExtractionMode, KnowledgeSourceIngestionPermissionOption, KnowledgeSourceKind, + KnowledgeSourceResultsProcessing, KnowledgeSourceSynchronizationStatus, LexicalAnalyzerName, LexicalNormalizerName, LexicalTokenizerName, + ListingSearchType, MarkdownHeaderDepth, MarkdownParsingSubmode, McpServerAuthenticationKind, McpServerOutputParsingKind, - McpServerToolInclusionMode, MicrosoftStemmingTokenizerLanguage, MicrosoftTokenizerLanguage, OcrLineEnding, @@ -313,6 +326,7 @@ ScoringFunctionAggregation, ScoringFunctionInterpolation, SearchFieldDataType, + SearchIndexKnowledgeSourceBoostKind, SearchIndexPermissionFilterOption, SearchIndexerDataSourceType, SentimentSkillLanguage, @@ -401,6 +415,7 @@ "EmbeddingColumnMapping", "EntityLinkingSkill", "EntityRecognitionSkillV3", + "EntraAppAuthentication", "ExhaustiveKnnAlgorithmConfiguration", "ExhaustiveKnnParameters", "FabricDataAgentKnowledgeSource", @@ -411,6 +426,7 @@ "FieldMappingFunction", "FileKnowledgeSource", "FileKnowledgeSourceParameters", + "FileUploadMetadata", "FreshnessScoringFunction", "FreshnessScoringParameters", "GetIndexStatisticsResult", @@ -441,6 +457,7 @@ "KnowledgeBase", "KnowledgeBaseAzureOpenAIModel", "KnowledgeBaseModel", + "KnowledgeBaseRetrieveDefaults", "KnowledgeSource", "KnowledgeSourceFile", "KnowledgeSourceReference", @@ -502,7 +519,12 @@ "SearchIndex", "SearchIndexFieldReference", "SearchIndexKnowledgeSource", + "SearchIndexKnowledgeSourceBoost", + "SearchIndexKnowledgeSourceFieldValueBoost", + "SearchIndexKnowledgeSourceFilterHint", + "SearchIndexKnowledgeSourceMultiWordExpressionBoost", "SearchIndexKnowledgeSourceParameters", + "SearchIndexKnowledgeSourceQueryHints", "SearchIndexer", "SearchIndexerCache", "SearchIndexerDataContainer", @@ -561,6 +583,8 @@ "TruncateTokenFilter", "UaxUrlEmailTokenizer", "UniqueTokenFilter", + "UpdateKnowledgeSourceFileRequest", + "UploadKnowledgeSourceFileMultipartRequest", "VectorSearch", "VectorSearchAlgorithmConfiguration", "VectorSearchCompression", @@ -577,6 +601,7 @@ "WebKnowledgeSourceParameters", "WordDelimiterTokenFilter", "WorkIQKnowledgeSource", + "WorkIQKnowledgeSourceParameters", "AIFoundryModelCatalogName", "AzureOpenAIModelName", "BlobIndexerDataToExtract", @@ -599,6 +624,7 @@ "EdgeNGramTokenFilterSide", "EntityCategory", "EntityRecognitionSkillLanguage", + "FileKnowledgeSourceExtractionMode", "ImageAnalysisSkillLanguage", "ImageDetail", "IndexProjectionMode", @@ -615,15 +641,16 @@ "KnowledgeSourceContentExtractionMode", "KnowledgeSourceIngestionPermissionOption", "KnowledgeSourceKind", + "KnowledgeSourceResultsProcessing", "KnowledgeSourceSynchronizationStatus", "LexicalAnalyzerName", "LexicalNormalizerName", "LexicalTokenizerName", + "ListingSearchType", "MarkdownHeaderDepth", "MarkdownParsingSubmode", "McpServerAuthenticationKind", "McpServerOutputParsingKind", - "McpServerToolInclusionMode", "MicrosoftStemmingTokenizerLanguage", "MicrosoftTokenizerLanguage", "OcrLineEnding", @@ -636,6 +663,7 @@ "ScoringFunctionAggregation", "ScoringFunctionInterpolation", "SearchFieldDataType", + "SearchIndexKnowledgeSourceBoostKind", "SearchIndexPermissionFilterOption", "SearchIndexerDataSourceType", "SentimentSkillLanguage", 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 bbda9f8a7ba4..1a9086d61ce3 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 @@ -51,9 +51,9 @@ class AzureOpenAIModelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gpt41Nano model.""" GPT5 = "gpt-5" """Gpt5 model.""" - GPT_5_MINI = "gpt-5-mini" + GPT5_MINI = "gpt-5-mini" """Gpt5Mini model.""" - GPT_5_NANO = "gpt-5-nano" + GPT5_NANO = "gpt-5-nano" """Gpt5Nano model.""" GPT51 = "gpt-5.1" """Gpt51 model.""" @@ -61,10 +61,18 @@ class AzureOpenAIModelName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gpt52 model.""" GPT54 = "gpt-5.4" """Gpt54 model.""" - GPT_5_4_MINI = "gpt-5.4-mini" + GPT5_4_MINI = "gpt-5.4-mini" """Gpt54Mini model.""" - GPT_5_4_NANO = "gpt-5.4-nano" + GPT5_4_NANO = "gpt-5.4-nano" """Gpt54Nano model.""" + GPT55 = "gpt-5.5" + """Gpt55 model.""" + GPT56_SOL = "gpt-5.6-sol" + """Gpt56Sol model.""" + GPT56_TERRA = "gpt-5.6-terra" + """Gpt56Terra model.""" + GPT56_LUNA = "gpt-5.6-luna" + """Gpt56Luna model.""" class BlobIndexerDataToExtract(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -370,6 +378,17 @@ class EntityRecognitionSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMet """Turkish.""" +class FileKnowledgeSourceExtractionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The extraction effort applied to an individual file. 'minimal' (the default) uses built-in + extraction; 'standard' uses Content Understanding. + """ + + MINIMAL = "minimal" + """Built-in extraction was performed.""" + STANDARD = "standard" + """Content Understanding extraction was performed.""" + + class ImageAnalysisSkillLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The language codes supported for input by ImageAnalysisSkill.""" @@ -682,6 +701,16 @@ class KnowledgeSourceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A knowledge source that retrieves data from Microsoft Fabric Ontology ontologies.""" +class KnowledgeSourceResultsProcessing(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Controls whether a knowledge source's results are reranked.""" + + RERANK = "rerank" + """Results from this knowledge source go through the reranking pipeline. This is the default + behavior.""" + NONE = "none" + """Results from this knowledge source bypass reranking and preserve their underlying order.""" + + class KnowledgeSourceSynchronizationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current synchronization status of the knowledge source.""" @@ -978,6 +1007,15 @@ class LexicalTokenizerName(str, Enum, metaclass=CaseInsensitiveEnumMeta): `_.""" +class ListingSearchType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies how the search parameter is interpreted when narrowing down a listing result set. + Currently only 'prefix' is supported. + """ + + PREFIX = "prefix" + """Matches items whose name starts with the value of the search parameter.""" + + class MarkdownHeaderDepth(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the max header depth that will be considered while grouping markdown content. Default is ``h6``. @@ -1033,16 +1071,6 @@ class McpServerOutputParsingKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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. This is the default behavior.""" - ALWAYS = "always" - """Tool results bypass reranking and are always included in the agent context.""" - - class MicrosoftStemmingTokenizerLanguage(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Lists the languages supported by the Microsoft language stemming tokenizer.""" @@ -1765,6 +1793,15 @@ class SearchIndexerDataSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates a SharePoint datasource.""" +class SearchIndexKnowledgeSourceBoostKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of boost hint for a search index knowledge source.""" + + FIELD_VALUE = "fieldValue" + """Boost documents based on a field value.""" + MULTI_WORD_EXPRESSION = "multiWordExpression" + """Boost documents based on a multi-word expression.""" + + class SearchIndexPermissionFilterOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A value indicating whether permission filtering is enabled for the index.""" 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 f90b1e255d41..5978ea825f03 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 @@ -12,11 +12,13 @@ from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload from ..._utils.model_base import Model as _Model, rest_discriminator, rest_field +from ..._utils.utils import FileType from ._enums import ( KnowledgeBaseModelKind, KnowledgeSourceKind, McpServerAuthenticationKind, McpServerOutputParsingKind, + SearchIndexKnowledgeSourceBoostKind, VectorSearchAlgorithmKind, VectorSearchCompressionKind, VectorSearchVectorizerKind, @@ -27,7 +29,7 @@ from ...knowledgebases import models as _knowledgebases_models3 -class CognitiveServicesAccount(_Model): +class CognitiveServicesAccount(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for describing any Azure AI service resource attached to a skillset. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -65,7 +67,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AIServicesAccountIdentity(CognitiveServicesAccount, discriminator="#Microsoft.Azure.Search.AIServicesByIdentity"): +class AIServicesAccountIdentity( + CognitiveServicesAccount, discriminator="#Microsoft.Azure.Search.AIServicesByIdentity" +): # pylint: disable=docstring-keyword-should-match-keyword-only """The multi-region account of an Azure AI service resource that's attached to a skillset. :ivar description: Description of the Azure AI service resource attached to a skillset. @@ -117,7 +121,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.AIServicesByIdentity" # type: ignore -class AIServicesAccountKey(CognitiveServicesAccount, discriminator="#Microsoft.Azure.Search.AIServicesByKey"): +class AIServicesAccountKey( + CognitiveServicesAccount, discriminator="#Microsoft.Azure.Search.AIServicesByKey" +): # pylint: disable=docstring-keyword-should-match-keyword-only """The account key of an Azure AI service resource that's attached to a skillset, to be used with the resource's subdomain. @@ -163,7 +169,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.AIServicesByKey" # type: ignore -class AIServicesVisionParameters(_Model): +class AIServicesVisionParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """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 @@ -216,7 +222,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VectorSearchVectorizer(_Model): +class VectorSearchVectorizer(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """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: @@ -257,7 +263,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AIServicesVisionVectorizer(VectorSearchVectorizer, discriminator="aiServicesVision"): +class AIServicesVisionVectorizer( + VectorSearchVectorizer, discriminator="aiServicesVision" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Clears the identity property of a datasource. :ivar vectorizer_name: The name to associate with this particular vectorization method. @@ -331,7 +339,7 @@ class AnalyzedTokenInfo(_Model): Required.""" -class AnalyzeResult(_Model): +class AnalyzeResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The result of testing an analyzer on text. :ivar tokens: The list of tokens returned by the analyzer specified in the request. Required. @@ -359,7 +367,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AnalyzeTextOptions(_Model): +class AnalyzeTextOptions(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies some text and analysis components used to break that text into tokens. :ivar text: The text to break into tokens. Required. @@ -476,7 +484,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TokenFilter(_Model): +class TokenFilter(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for token filters. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -523,7 +531,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AsciiFoldingTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.AsciiFoldingTokenFilter"): +class AsciiFoldingTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.AsciiFoldingTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Converts alphabetic, numeric, and symbolic Unicode characters which are not in the first 127 ASCII characters (the "Basic Latin" Unicode block) into their ASCII equivalents, if such equivalents exist. This token filter is implemented using Apache Lucene. @@ -568,7 +578,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.AsciiFoldingTokenFilter" # type: ignore -class AzureActiveDirectoryApplicationCredentials(_Model): # pylint: disable=name-too-long +class AzureActiveDirectoryApplicationCredentials( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Credentials of a registered application created for your search service, used for authenticated access to the encryption keys stored in Azure Key Vault. @@ -608,7 +620,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeSource(_Model): +class KnowledgeSource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a knowledge source definition. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -625,6 +637,11 @@ class KnowledgeSource(_Model): "azureBlob", "indexedSharePoint", "indexedOneLake", "indexedSql", "web", "remoteSharePoint", "workIQ", "file", "mcpServer", "fabricDataAgent", and "fabricOntology". :vartype kind: str or ~azure.search.documents.indexes.models.KnowledgeSourceKind + :ivar results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -647,6 +664,12 @@ class KnowledgeSource(_Model): """The type of the knowledge source. Required. Known values are: \"searchIndex\", \"azureBlob\", \"indexedSharePoint\", \"indexedOneLake\", \"indexedSql\", \"web\", \"remoteSharePoint\", \"workIQ\", \"file\", \"mcpServer\", \"fabricDataAgent\", and \"fabricOntology\".""" + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = rest_field( + name="resultsProcessing", visibility=["read", "create", "update", "delete", "query"] + ) + """Controls whether results from this knowledge source are reranked before they are included in + the final result set. Defaults to 'rerank' when not specified. Known values are: \"rerank\" and + \"none\".""" 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( @@ -668,6 +691,7 @@ def __init__( name: str, kind: str, description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -683,13 +707,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AzureBlobKnowledgeSource(KnowledgeSource, discriminator="azureBlob"): +class AzureBlobKnowledgeSource( + KnowledgeSource, discriminator="azureBlob" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Configuration for Azure Blob Storage knowledge source. :ivar name: The name of the knowledge source. Required. :vartype name: str :ivar description: Optional user-defined description. :vartype description: str + :ivar results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -724,6 +755,7 @@ def __init__( name: str, azure_blob_parameters: "_models.AzureBlobKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -740,7 +772,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.AZURE_BLOB # type: ignore -class AzureBlobKnowledgeSourceParameters(_Model): +class AzureBlobKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for Azure Blob Storage knowledge source. :ivar connection_string: Key-based connection string or the ResourceId format if using a @@ -756,6 +788,11 @@ class AzureBlobKnowledgeSourceParameters(_Model): :ivar ingestion_parameters: Consolidates all general ingestion settings. :vartype ingestion_parameters: ~azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters + :ivar query_hints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype query_hints: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints :ivar created_resources: Resources created by the knowledge source. :vartype created_resources: ~azure.search.documents.indexes.models.CreatedResources """ @@ -778,6 +815,11 @@ class AzureBlobKnowledgeSourceParameters(_Model): name="ingestionParameters", visibility=["read", "create", "update", "delete", "query"] ) """Consolidates all general ingestion settings.""" + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHints", visibility=["read", "create", "update", "delete", "query"] + ) + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" created_resources: Optional["_models.CreatedResources"] = rest_field(name="createdResources", visibility=["read"]) """Resources created by the knowledge source.""" @@ -790,6 +832,7 @@ def __init__( folder_path: Optional[str] = None, is_adls_gen2: Optional[bool] = None, ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = None, + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -803,7 +846,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AzureMachineLearningParameters(_Model): +class AzureMachineLearningParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the properties for connecting to an AML vectorizer. :ivar scoring_uri: (Required for no authentication or key authentication) The scoring URI of @@ -879,7 +922,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerSkill(_Model): +class SearchIndexerSkill(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for skills. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -956,7 +999,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AzureMachineLearningSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Custom.AmlSkill"): +class AzureMachineLearningSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Custom.AmlSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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. @@ -1061,7 +1106,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Custom.AmlSkill" # type: ignore -class AzureMachineLearningVectorizer(VectorSearchVectorizer, discriminator="aml"): +class AzureMachineLearningVectorizer( + VectorSearchVectorizer, discriminator="aml" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies an Azure Machine Learning endpoint deployed via the Azure AI Foundry Model Catalog for generating the vector embedding of a query string. @@ -1105,7 +1152,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorSearchVectorizerKind.AML # type: ignore -class AzureOpenAIEmbeddingSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill"): +class AzureOpenAIEmbeddingSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Allows you to generate a vector embedding for a given text input using the Azure OpenAI resource. @@ -1136,8 +1185,8 @@ class AzureOpenAIEmbeddingSkill(SearchIndexerSkill, discriminator="#Microsoft.Sk :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". + "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5.1", "gpt-5.2", "gpt-5.4", "gpt-5.4-mini", + "gpt-5.4-nano", "gpt-5.5", "gpt-5.6-sol", "gpt-5.6-terra", and "gpt-5.6-luna". :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. @@ -1167,8 +1216,8 @@ class AzureOpenAIEmbeddingSkill(SearchIndexerSkill, discriminator="#Microsoft.Sk """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\".""" + \"gpt-5-mini\", \"gpt-5-nano\", \"gpt-5.1\", \"gpt-5.2\", \"gpt-5.4\", \"gpt-5.4-mini\", + \"gpt-5.4-nano\", \"gpt-5.5\", \"gpt-5.6-sol\", \"gpt-5.6-terra\", and \"gpt-5.6-luna\".""" 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.""" @@ -1205,7 +1254,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill" # type: ignore -class AzureOpenAITokenizerParameters(_Model): +class AzureOpenAITokenizerParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Azure OpenAI Tokenizer parameters. :ivar encoder_model_name: Only applies if the unit is set to azureOpenAITokens. Options include @@ -1250,7 +1299,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AzureOpenAIVectorizer(VectorSearchVectorizer, discriminator="azureOpenAI"): +class AzureOpenAIVectorizer( + VectorSearchVectorizer, discriminator="azureOpenAI" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the Azure OpenAI resource used to vectorize a query string. :ivar vectorizer_name: The name to associate with this particular vectorization method. @@ -1291,7 +1342,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorSearchVectorizerKind.AZURE_OPEN_AI # type: ignore -class AzureOpenAIVectorizerParameters(_Model): +class AzureOpenAIVectorizerParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the parameters for connecting to the Azure OpenAI resource. :ivar resource_url: The resource URI of the Azure OpenAI resource. @@ -1305,8 +1356,8 @@ class AzureOpenAIVectorizerParameters(_Model): :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". + "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-5.1", "gpt-5.2", "gpt-5.4", "gpt-5.4-mini", + "gpt-5.4-nano", "gpt-5.5", "gpt-5.6-sol", "gpt-5.6-terra", and "gpt-5.6-luna". :vartype model_name: str or ~azure.search.documents.indexes.models.AzureOpenAIModelName """ @@ -1330,8 +1381,8 @@ 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-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\".""" + \"gpt-5-mini\", \"gpt-5-nano\", \"gpt-5.1\", \"gpt-5.2\", \"gpt-5.4\", \"gpt-5.4-mini\", + \"gpt-5.4-nano\", \"gpt-5.5\", \"gpt-5.6-sol\", \"gpt-5.6-terra\", and \"gpt-5.6-luna\".""" @overload def __init__( @@ -1355,7 +1406,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VectorSearchCompression(_Model): +class VectorSearchCompression(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains configuration options specific to the compression method used during indexing or querying. @@ -1418,7 +1469,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class BinaryQuantizationCompression(VectorSearchCompression, discriminator="binaryQuantization"): +class BinaryQuantizationCompression( + VectorSearchCompression, discriminator="binaryQuantization" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains configuration options specific to the binary quantization compression method used during indexing and querying. @@ -1469,7 +1522,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorSearchCompressionKind.BINARY_QUANTIZATION # type: ignore -class SimilarityAlgorithm(_Model): +class SimilarityAlgorithm(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for similarity algorithms. Similarity algorithms are used to calculate scores that tie queries to documents. The higher the score, the more relevant the document is to that specific query. Those scores are used to rank the search results. @@ -1503,7 +1556,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class BM25SimilarityAlgorithm(SimilarityAlgorithm, discriminator="#Microsoft.Azure.Search.BM25Similarity"): +class BM25SimilarityAlgorithm( + SimilarityAlgorithm, discriminator="#Microsoft.Azure.Search.BM25Similarity" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Ranking function based on the Okapi BM25 similarity algorithm. BM25 is a TF-IDF-like algorithm that includes length normalization (controlled by the 'b' parameter) as well as term frequency saturation (controlled by the 'k1' parameter). @@ -1553,7 +1608,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.BM25Similarity" # type: ignore -class CharFilter(_Model): +class CharFilter(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for character filters. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -1594,7 +1649,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ChatCompletionCommonModelParameters(_Model): +class ChatCompletionCommonModelParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Common language model parameters for Chat Completions. If omitted, default values are used. :ivar model_name: The name of the model to use (e.g., 'gpt-4o', etc.). Default is null if not @@ -1662,7 +1717,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ChatCompletionResponseFormat(_Model): +class ChatCompletionResponseFormat(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Determines how the language model's response should be serialized. Defaults to 'text'. :ivar type: Specifies how the LLM should format the response. Known values are: "text", @@ -1703,7 +1758,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ChatCompletionSchema(_Model): +class ChatCompletionSchema(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Object defining the custom schema the model will use to structure its output. :ivar type: Type of schema representation. Usually 'object'. Default is 'object'. @@ -1754,7 +1809,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ChatCompletionSchemaProperties(_Model): +class ChatCompletionSchemaProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties for JSON schema response format. :ivar name: Name of the json schema the model will adhere to. @@ -1800,7 +1855,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ChatCompletionSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Custom.ChatCompletionSkill"): +class ChatCompletionSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Custom.ChatCompletionSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that calls a language model via Azure AI Foundry's Chat Completions endpoint. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill @@ -1913,7 +1970,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Custom.ChatCompletionSkill" # type: ignore -class CjkBigramTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.CjkBigramTokenFilter"): +class CjkBigramTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.CjkBigramTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Forms bigrams of CJK terms that are generated from the standard tokenizer. This token filter is implemented using Apache Lucene. @@ -1997,7 +2056,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.ClassicSimilarity" # type: ignore -class LexicalTokenizer(_Model): +class LexicalTokenizer(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for tokenizers. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -2041,7 +2100,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ClassicTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.ClassicTokenizer"): +class ClassicTokenizer( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.ClassicTokenizer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Grammar-based tokenizer that is suitable for processing most European-language documents. This tokenizer is implemented using Apache Lucene. @@ -2088,7 +2149,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class CognitiveServicesAccountKey( CognitiveServicesAccount, discriminator="#Microsoft.Azure.Search.CognitiveServicesByKey" -): +): # pylint: disable=docstring-keyword-should-match-keyword-only """The multi-region account key of an Azure AI service resource that's attached to a skillset. :ivar description: Description of the Azure AI service resource attached to a skillset. @@ -2127,7 +2188,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.CognitiveServicesByKey" # type: ignore -class CommonGramTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.CommonGramTokenFilter"): +class CommonGramTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.CommonGramTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Construct bigrams for frequently occurring terms while indexing. Single terms are still indexed too, with bigrams overlaid. This token filter is implemented using Apache Lucene. @@ -2187,7 +2250,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.CommonGramTokenFilter" # type: ignore -class ConditionalSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.ConditionalSkill"): +class ConditionalSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.ConditionalSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that enables scenarios that require a Boolean operation to determine the data to assign to an output. @@ -2239,7 +2304,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Util.ConditionalSkill" # type: ignore -class ContentColumnMapping(_Model): +class ContentColumnMapping(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Maps a SQL column to a search index field. :ivar name: Target index field name. Required. @@ -2279,7 +2344,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ContentUnderstandingSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.ContentUnderstandingSkill"): +class ContentUnderstandingSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.ContentUnderstandingSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that leverages Azure AI Content Understanding to process and extract structured insights from documents, enabling enriched, searchable content for enhanced document indexing and retrieval. @@ -2349,7 +2416,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Util.ContentUnderstandingSkill" # type: ignore -class ContentUnderstandingSkillChunkingProperties(_Model): # pylint: disable=name-too-long +class ContentUnderstandingSkillChunkingProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Controls the cardinality for chunking the content. :ivar method: The chunking strategy. 'fixedSize' (default) or 'semantic'. Known values are: @@ -2404,7 +2473,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CorsOptions(_Model): +class CorsOptions(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines options to control Cross-Origin Resource Sharing (CORS) for an index. :ivar allowed_origins: The list of origins from which JavaScript code will be granted access to @@ -2454,7 +2523,7 @@ class CreatedResources(_Model): """ -class LexicalAnalyzer(_Model): +class LexicalAnalyzer(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for analyzers. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -2495,7 +2564,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CustomAnalyzer(LexicalAnalyzer, discriminator="#Microsoft.Azure.Search.CustomAnalyzer"): +class CustomAnalyzer( + LexicalAnalyzer, discriminator="#Microsoft.Azure.Search.CustomAnalyzer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Allows you to take control over the process of converting text into indexable/searchable tokens. It's a user-defined configuration consisting of a single predefined tokenizer and one or more filters. The tokenizer is responsible for breaking text into tokens, and the filters @@ -2570,7 +2641,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.CustomAnalyzer" # type: ignore -class CustomEntity(_Model): +class CustomEntity(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """An object that contains information about the matches that were found, and related metadata. :ivar name: The top-level entity descriptor. Matches in the skill output will be grouped by @@ -2704,7 +2775,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CustomEntityAlias(_Model): +class CustomEntityAlias(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """A complex object that can be used to specify alternative spellings or synonyms to the root entity name. @@ -2754,7 +2825,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CustomEntityLookupSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.CustomEntityLookupSkill"): +class CustomEntityLookupSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.CustomEntityLookupSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill looks for text from a custom, user-defined list of words and phrases. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill @@ -2862,7 +2935,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.CustomEntityLookupSkill" # type: ignore -class LexicalNormalizer(_Model): +class LexicalNormalizer(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for normalizers. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -2903,7 +2976,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CustomNormalizer(LexicalNormalizer, discriminator="#Microsoft.Azure.Search.CustomNormalizer"): +class CustomNormalizer( + LexicalNormalizer, discriminator="#Microsoft.Azure.Search.CustomNormalizer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Allows you to configure normalization for filterable, sortable, and facetable fields, which by default operate with strict matching. This is a user-defined configuration consisting of at least one or more filters, which modify the token that is stored. @@ -2962,7 +3037,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.CustomNormalizer" # type: ignore -class DataChangeDetectionPolicy(_Model): +class DataChangeDetectionPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for data change detection policies. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -2994,7 +3069,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DataDeletionDetectionPolicy(_Model): +class DataDeletionDetectionPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for data deletion detection policies. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -3026,7 +3101,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DataSourceCredentials(_Model): +class DataSourceCredentials(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents credentials that can be used to connect to a datasource. :ivar connection_string: The connection string for the datasource. Set to ```` (with @@ -3062,7 +3137,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class DefaultCognitiveServicesAccount( CognitiveServicesAccount, discriminator="#Microsoft.Azure.Search.DefaultCognitiveServices" -): +): # pylint: disable=docstring-keyword-should-match-keyword-only """An empty object that represents the default Azure AI service resource for a skillset. :ivar description: Description of the Azure AI service resource attached to a skillset. @@ -3097,7 +3172,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class DictionaryDecompounderTokenFilter( TokenFilter, discriminator="#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter" -): +): # pylint: disable=docstring-keyword-should-match-keyword-only """Decomposes compound words found in many Germanic languages. This token filter is implemented using Apache Lucene. @@ -3173,7 +3248,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter" # type: ignore -class ScoringFunction(_Model): +class ScoringFunction(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for functions that can modify document scores during ranking. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -3227,7 +3302,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DistanceScoringFunction(ScoringFunction, discriminator="distance"): +class DistanceScoringFunction( + ScoringFunction, discriminator="distance" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines a function that boosts scores based on distance from a geographic location. :ivar field_name: The name of the field used as input to the scoring function. Required. @@ -3277,7 +3354,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = "distance" # type: ignore -class DistanceScoringParameters(_Model): +class DistanceScoringParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Provides parameter values to a distance scoring function. :ivar reference_point_parameter: The name of the parameter passed in search queries to specify @@ -3316,7 +3393,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DocumentExtractionSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.DocumentExtractionSkill"): +class DocumentExtractionSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.DocumentExtractionSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that extracts content from a file within the enrichment pipeline. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill @@ -3390,7 +3469,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class DocumentIntelligenceLayoutSkill( SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill" -): +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that extracts content and layout information, via Azure AI Services, from files within the enrichment pipeline. @@ -3492,7 +3571,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill" # type: ignore -class DocumentIntelligenceLayoutSkillChunkingProperties(_Model): # pylint: disable=name-too-long +class DocumentIntelligenceLayoutSkillChunkingProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Controls the cardinality for chunking the content. :ivar unit: The unit of the chunk. "characters" @@ -3537,7 +3618,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DocumentKeysOrIds(_Model): +class DocumentKeysOrIds(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The type of the keysOrIds. :ivar document_keys: document keys to be reset. @@ -3574,7 +3655,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EdgeNGramTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.EdgeNGramTokenFilter"): +class EdgeNGramTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.EdgeNGramTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Generates n-grams of the given size(s) starting from the front or the back of an input token. This token filter is implemented using Apache Lucene. @@ -3630,7 +3713,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.EdgeNGramTokenFilter" # type: ignore -class EdgeNGramTokenFilterV2(TokenFilter, discriminator="#Microsoft.Azure.Search.EdgeNGramTokenFilterV2"): +class EdgeNGramTokenFilterV2( + TokenFilter, discriminator="#Microsoft.Azure.Search.EdgeNGramTokenFilterV2" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Generates n-grams of the given size(s) starting from the front or the back of an input token. This token filter is implemented using Apache Lucene. @@ -3687,7 +3772,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.EdgeNGramTokenFilterV2" # type: ignore -class EdgeNGramTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.EdgeNGramTokenizer"): +class EdgeNGramTokenizer( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.EdgeNGramTokenizer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Tokenizes the input from an edge into n-grams of the given size(s). This tokenizer is implemented using Apache Lucene. @@ -3742,7 +3829,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.EdgeNGramTokenizer" # type: ignore -class ElisionTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.ElisionTokenFilter"): +class ElisionTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.ElisionTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Removes elisions. For example, "l'avion" (the plane) will be converted to "avion" (plane). This token filter is implemented using Apache Lucene. @@ -3783,7 +3872,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.ElisionTokenFilter" # type: ignore -class EmbeddingColumnMapping(_Model): +class EmbeddingColumnMapping(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Maps a SQL column to a vector field for embedding. :ivar name: Target vector field name in the search index. Required. @@ -3816,7 +3905,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EntityLinkingSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.V3.EntityLinkingSkill"): +class EntityLinkingSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.V3.EntityLinkingSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Using the Text Analytics API, extracts linked entities from text. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill @@ -3896,7 +3987,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.V3.EntityLinkingSkill" # type: ignore -class EntityRecognitionSkillV3(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.V3.EntityRecognitionSkill"): +class EntityRecognitionSkillV3( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.V3.EntityRecognitionSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Using the Text Analytics API, extracts entities of different types from text. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill @@ -3989,7 +4082,54 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.V3.EntityRecognitionSkill" # type: ignore -class VectorSearchAlgorithmConfiguration(_Model): +class EntraAppAuthentication(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Configuration for a customer-owned Microsoft Entra app registration used for federated + credential-based on-behalf-of authentication. + + :ivar application_id: The application (client) ID of the customer-owned Entra app registration. + Required. + :vartype application_id: str + :ivar federated_credential_id: The federated credential ID configured on the app registration, + enabling the search service to authenticate as the app without a stored client secret. + Required. + :vartype federated_credential_id: str + :ivar tenant_id: The tenant ID of the app registration. Required when the app registration is + in a different tenant than the search service. If omitted, the search service's tenant 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 customer-owned Entra app registration. Required.""" + federated_credential_id: str = rest_field( + name="federatedCredentialId", visibility=["read", "create", "update", "delete", "query"] + ) + """The federated credential ID configured on the app registration, enabling the search service to + authenticate as the app without a stored client secret. Required.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """The tenant ID of the app registration. Required when the app registration is in a different + tenant than the search service. If omitted, the search service's tenant 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 VectorSearchAlgorithmConfiguration(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains configuration options specific to the algorithm used during indexing or querying. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -4028,7 +4168,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ExhaustiveKnnAlgorithmConfiguration(VectorSearchAlgorithmConfiguration, discriminator="exhaustiveKnn"): +class ExhaustiveKnnAlgorithmConfiguration( + VectorSearchAlgorithmConfiguration, discriminator="exhaustiveKnn" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains configuration options specific to the exhaustive KNN algorithm used during querying, which will perform brute-force search across the entire vector index. @@ -4069,7 +4211,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorSearchAlgorithmKind.EXHAUSTIVE_KNN # type: ignore -class ExhaustiveKnnParameters(_Model): +class ExhaustiveKnnParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains the parameters specific to exhaustive KNN algorithm. :ivar metric: The similarity metric to use for vector comparisons. Known values are: "cosine", @@ -4101,13 +4243,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FabricDataAgentKnowledgeSource(KnowledgeSource, discriminator="fabricDataAgent"): +class FabricDataAgentKnowledgeSource( + KnowledgeSource, discriminator="fabricDataAgent" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Configuration for Fabric Data Agent knowledge source. :ivar name: The name of the knowledge source. Required. :vartype name: str :ivar description: Optional user-defined description. :vartype description: str + :ivar results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -4143,6 +4292,7 @@ def __init__( name: str, fabric_data_agent_parameters: "_models.FabricDataAgentKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -4159,7 +4309,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.FABRIC_DATA_AGENT # type: ignore -class FabricDataAgentKnowledgeSourceParameters(_Model): +class FabricDataAgentKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for Fabric Data Agent knowledge source. :ivar workspace_id: Fabric workspace ID. Required. @@ -4192,13 +4342,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FabricOntologyKnowledgeSource(KnowledgeSource, discriminator="fabricOntology"): +class FabricOntologyKnowledgeSource( + KnowledgeSource, discriminator="fabricOntology" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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 results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -4234,6 +4391,7 @@ def __init__( name: str, fabric_ontology_parameters: "_models.FabricOntologyKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -4250,7 +4408,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.FABRIC_ONTOLOGY # type: ignore -class FabricOntologyKnowledgeSourceParameters(_Model): +class FabricOntologyKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for Fabric Ontology knowledge source. :ivar workspace_id: The Fabric workspace ID containing the ontology. Required. @@ -4283,7 +4441,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FieldMapping(_Model): +class FieldMapping(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """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. @@ -4328,7 +4486,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FieldMappingFunction(_Model): +class FieldMappingFunction(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a function that transforms a value from a data source before indexing. :ivar name: The name of the field mapping function. Required. @@ -4363,13 +4521,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FileKnowledgeSource(KnowledgeSource, discriminator="file"): +class FileKnowledgeSource( + KnowledgeSource, discriminator="file" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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 results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -4386,6 +4551,9 @@ class FileKnowledgeSource(KnowledgeSource, discriminator="file"): :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 + :ivar cors_options: Options to control Cross-Origin Resource Sharing (CORS) for the File + knowledge source's file endpoints (upload, list, update, delete). + :vartype cors_options: ~azure.search.documents.indexes.models.CorsOptions """ kind: Literal[KnowledgeSourceKind.FILE] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -4395,6 +4563,11 @@ class FileKnowledgeSource(KnowledgeSource, discriminator="file"): name="fileParameters", visibility=["read", "create", "update", "delete", "query"] ) """The parameters for the File knowledge source. Required.""" + 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 File knowledge source's file + endpoints (upload, list, update, delete).""" @overload def __init__( @@ -4403,8 +4576,10 @@ def __init__( name: str, file_parameters: "_models.FileKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, + cors_options: Optional["_models.CorsOptions"] = None, ) -> None: ... @overload @@ -4419,13 +4594,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.FILE # type: ignore -class FileKnowledgeSourceParameters(_Model): +class FileKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """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. + :ivar ingestion_parameters: Consolidates all general ingestion settings for the File knowledge + source, including the content extraction mode and an optional embeddingModel. :vartype ingestion_parameters: ~azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters + :ivar query_hints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype query_hints: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints :ivar created_resources: Resources created by the file knowledge source. :vartype created_resources: ~azure.search.documents.indexes.models.CreatedResources """ @@ -4433,8 +4613,13 @@ class FileKnowledgeSourceParameters(_Model): 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.""" + """Consolidates all general ingestion settings for the File knowledge source, including the + content extraction mode and an optional embeddingModel.""" + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHints", visibility=["read", "create", "update", "delete", "query"] + ) + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" created_resources: Optional["_models.CreatedResources"] = rest_field(name="createdResources", visibility=["read"]) """Resources created by the file knowledge source.""" @@ -4443,6 +4628,7 @@ def __init__( self, *, ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = None, + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -4456,7 +4642,45 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FreshnessScoringFunction(ScoringFunction, discriminator="freshness"): +class FileUploadMetadata(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The JSON 'metadata' part of a multipart/form-data file upload: the full file name/path and + custom key/value metadata. The parsing mode and extraction mode are both chosen by the service + and are not supplied by the caller. + + :ivar file_name: The full relative file name/path to store the file under (prefixes are derived + from it). + :vartype file_name: str + :ivar metadata: Custom key/value metadata to store with the file. + :vartype metadata: dict[str, str] + """ + + file_name: Optional[str] = rest_field(name="fileName", visibility=["read", "create", "update", "delete", "query"]) + """The full relative file name/path to store the file under (prefixes are derived from it).""" + metadata: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Custom key/value metadata to store with the file.""" + + @overload + def __init__( + self, + *, + file_name: Optional[str] = None, + metadata: Optional[dict[str, 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 FreshnessScoringFunction( + ScoringFunction, discriminator="freshness" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines a function that boosts scores based on the value of a date-time field. :ivar field_name: The name of the field used as input to the scoring function. Required. @@ -4507,7 +4731,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = "freshness" # type: ignore -class FreshnessScoringParameters(_Model): +class FreshnessScoringParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Provides parameter values to a freshness scoring function. :ivar boosting_duration: The expiration period after which boosting will stop for a particular @@ -4561,7 +4785,7 @@ class GetIndexStatisticsResult(_Model): class HighWaterMarkChangeDetectionPolicy( DataChangeDetectionPolicy, discriminator="#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy" -): +): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines a data change detection policy that captures changes based on the value of a high water mark column. @@ -4599,7 +4823,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy" # type: ignore -class HnswAlgorithmConfiguration(VectorSearchAlgorithmConfiguration, discriminator="hnsw"): +class HnswAlgorithmConfiguration( + VectorSearchAlgorithmConfiguration, discriminator="hnsw" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains configuration options specific to the HNSW approximate nearest neighbors algorithm used during indexing and querying. The HNSW algorithm offers a tunable trade-off between search speed and accuracy. @@ -4642,7 +4868,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorSearchAlgorithmKind.HNSW # type: ignore -class HnswParameters(_Model): +class HnswParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains the parameters specific to the HNSW algorithm. :ivar m: The number of bi-directional links created for every new element during construction. @@ -4706,7 +4932,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ImageAnalysisSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Vision.ImageAnalysisSkill"): +class ImageAnalysisSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Vision.ImageAnalysisSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that analyzes image files. It extracts a rich set of visual features based on the image content. @@ -4789,13 +5017,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Vision.ImageAnalysisSkill" # type: ignore -class IndexedOneLakeKnowledgeSource(KnowledgeSource, discriminator="indexedOneLake"): +class IndexedOneLakeKnowledgeSource( + KnowledgeSource, discriminator="indexedOneLake" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Configuration for OneLake knowledge source. :ivar name: The name of the knowledge source. Required. :vartype name: str :ivar description: Optional user-defined description. :vartype description: str + :ivar results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -4828,6 +5063,7 @@ def __init__( name: str, indexed_one_lake_parameters: "_models.IndexedOneLakeKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -4844,7 +5080,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.INDEXED_ONELAKE # type: ignore -class IndexedOneLakeKnowledgeSourceParameters(_Model): +class IndexedOneLakeKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for OneLake knowledge source. :ivar fabric_workspace_id: OneLake workspace ID. Required. @@ -4856,6 +5092,11 @@ class IndexedOneLakeKnowledgeSourceParameters(_Model): :ivar ingestion_parameters: Consolidates all general ingestion settings. :vartype ingestion_parameters: ~azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters + :ivar query_hints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype query_hints: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints :ivar created_resources: Resources created by the knowledge source. :vartype created_resources: ~azure.search.documents.indexes.models.CreatedResources """ @@ -4874,6 +5115,11 @@ class IndexedOneLakeKnowledgeSourceParameters(_Model): name="ingestionParameters", visibility=["read", "create", "update", "delete", "query"] ) """Consolidates all general ingestion settings.""" + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHints", visibility=["read", "create", "update", "delete", "query"] + ) + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" created_resources: Optional["_models.CreatedResources"] = rest_field(name="createdResources", visibility=["read"]) """Resources created by the knowledge source.""" @@ -4885,6 +5131,7 @@ def __init__( lakehouse_id: str, target_path: Optional[str] = None, ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = None, + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -4898,13 +5145,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexedSharePointKnowledgeSource(KnowledgeSource, discriminator="indexedSharePoint"): +class IndexedSharePointKnowledgeSource( + KnowledgeSource, discriminator="indexedSharePoint" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Configuration for 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 results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -4937,6 +5191,7 @@ def __init__( name: str, indexed_share_point_parameters: "_models.IndexedSharePointKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -4953,7 +5208,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.INDEXED_SHARE_POINT # type: ignore -class IndexedSharePointKnowledgeSourceParameters(_Model): # pylint: disable=name-too-long +class IndexedSharePointKnowledgeSourceParameters( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Parameters for SharePoint knowledge source. :ivar connection_string: SharePoint connection string with format: @@ -4970,6 +5227,11 @@ class IndexedSharePointKnowledgeSourceParameters(_Model): # pylint: disable=nam :ivar ingestion_parameters: Consolidates all general ingestion settings. :vartype ingestion_parameters: ~azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters + :ivar query_hints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype query_hints: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints :ivar created_resources: Resources created by the knowledge source. :vartype created_resources: ~azure.search.documents.indexes.models.CreatedResources """ @@ -4991,6 +5253,11 @@ class IndexedSharePointKnowledgeSourceParameters(_Model): # pylint: disable=nam name="ingestionParameters", visibility=["read", "create", "update", "delete", "query"] ) """Consolidates all general ingestion settings.""" + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHints", visibility=["read", "create", "update", "delete", "query"] + ) + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" created_resources: Optional["_models.CreatedResources"] = rest_field(name="createdResources", visibility=["read"]) """Resources created by the knowledge source.""" @@ -5002,6 +5269,7 @@ def __init__( container_name: Union[str, "_models.IndexedSharePointContainerName"], query: Optional[str] = None, ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = None, + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -5015,13 +5283,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexedSqlKnowledgeSource(KnowledgeSource, discriminator="indexedSql"): +class IndexedSqlKnowledgeSource( + KnowledgeSource, discriminator="indexedSql" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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 results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -5056,6 +5331,7 @@ def __init__( name: str, indexed_sql_parameters: "_models.IndexedSqlKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -5072,7 +5348,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.INDEXED_SQL # type: ignore -class IndexedSqlKnowledgeSourceParameters(_Model): +class IndexedSqlKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for indexed SQL knowledge source. :ivar connection_string: The connection string for the Azure SQL Database or SQL Managed @@ -5094,6 +5370,11 @@ class IndexedSqlKnowledgeSourceParameters(_Model): model, schedule, and identity. :vartype ingestion_parameters: ~azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters + :ivar query_hints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype query_hints: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints :ivar created_resources: Resources created by the knowledge source. :vartype created_resources: ~azure.search.documents.indexes.models.CreatedResources """ @@ -5122,6 +5403,11 @@ class IndexedSqlKnowledgeSourceParameters(_Model): name="ingestionParameters", visibility=["read", "create", "update", "delete", "query"] ) """Consolidates all general ingestion settings including embedding model, schedule, and identity.""" + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHints", visibility=["read", "create", "update", "delete", "query"] + ) + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" created_resources: Optional["_models.CreatedResources"] = rest_field(name="createdResources", visibility=["read"]) """Resources created by the knowledge source.""" @@ -5135,6 +5421,7 @@ def __init__( content_columns: Optional[list["_models.ContentColumnMapping"]] = None, embedding_columns: Optional[list["_models.EmbeddingColumnMapping"]] = None, ingestion_parameters: Optional["_knowledgebases_models3.KnowledgeSourceIngestionParameters"] = None, + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -5279,7 +5566,7 @@ class IndexerExecutionResult(_Model): """Change tracking state with which an indexer execution finished.""" -class IndexerResyncBody(_Model): +class IndexerResyncBody(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Request body for resync indexer operation. :ivar options: Re-sync options that have been pre-defined from data source. @@ -5309,7 +5596,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexerRuntime(_Model): +class IndexerRuntime(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the indexer's cumulative runtime consumption in the service. :ivar used_seconds: Cumulative runtime of the indexer from the beginningTime to endingTime, in @@ -5364,7 +5651,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexingParameters(_Model): +class IndexingParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents parameters for indexer execution. :ivar batch_size: The number of items that are read from the data source and indexed as a @@ -5421,7 +5708,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexingParametersConfiguration(_Model): +class IndexingParametersConfiguration(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """A dictionary of indexer-specific configuration properties. Each name is the name of a specific property. Each value must be of a primitive type. @@ -5638,7 +5925,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexingSchedule(_Model): +class IndexingSchedule(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a schedule for indexer execution. :ivar interval: The interval of time between indexer executions. Required. @@ -5673,7 +5960,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexStatisticsSummary(_Model): +class IndexStatisticsSummary(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Statistics for a given index. Statistics are collected periodically and are not guaranteed to always be up-to-date. @@ -5715,7 +6002,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class InputFieldMappingEntry(_Model): +class InputFieldMappingEntry(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Input field mapping for a skill. :ivar name: The name of the input. Required. @@ -5762,7 +6049,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KeepTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.KeepTokenFilter"): +class KeepTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.KeepTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A token filter that only keeps tokens with text contained in a specified list of words. This token filter is implemented using Apache Lucene. @@ -5811,7 +6100,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.KeepTokenFilter" # type: ignore -class KeyPhraseExtractionSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.KeyPhraseExtractionSkill"): +class KeyPhraseExtractionSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.KeyPhraseExtractionSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that uses text analytics for key phrase extraction. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill @@ -5894,7 +6185,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.KeyPhraseExtractionSkill" # type: ignore -class KeywordMarkerTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.KeywordMarkerTokenFilter"): +class KeywordMarkerTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.KeywordMarkerTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Marks terms as keywords. This token filter is implemented using Apache Lucene. :ivar name: The name of the token filter. It must only contain letters, digits, spaces, dashes @@ -5943,7 +6236,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.KeywordMarkerTokenFilter" # type: ignore -class KeywordTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.KeywordTokenizer"): +class KeywordTokenizer( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.KeywordTokenizer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Emits the entire input as a single token. This tokenizer is implemented using Apache Lucene. :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or @@ -5985,7 +6280,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.KeywordTokenizer" # type: ignore -class KeywordTokenizerV2(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.KeywordTokenizerV2"): +class KeywordTokenizerV2( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.KeywordTokenizerV2" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Emits the entire input as a single token. This tokenizer is implemented using Apache Lucene. :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or @@ -6029,7 +6326,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.KeywordTokenizerV2" # type: ignore -class KnowledgeBase(_Model): +class KnowledgeBase(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a knowledge base definition. :ivar name: The name of the knowledge base. Required. @@ -6052,6 +6349,9 @@ class KnowledgeBase(_Model): :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey :ivar description: The description of the knowledge base. :vartype description: str + :ivar tags: User-defined key-value pairs for categorizing the knowledge base and attributing + its usage and costs. + :vartype tags: dict[str, str] :ivar retrieval_instructions: Instructions considered by the knowledge base when developing query plan. :vartype retrieval_instructions: str @@ -6061,6 +6361,11 @@ class KnowledgeBase(_Model): :ivar cors_options: Options to control Cross-Origin Resource Sharing (CORS) for the knowledge base. :vartype cors_options: ~azure.search.documents.indexes.models.CorsOptions + :ivar retrieve_defaults: Persisted request-wide retrieve defaults for this knowledge base. + These values apply to retrieve requests that omit the corresponding fields; request-time values + take precedence when present. + :vartype retrieve_defaults: + ~azure.search.documents.indexes.models.KnowledgeBaseRetrieveDefaults """ name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -6090,6 +6395,9 @@ 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.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """User-defined key-value pairs for categorizing the knowledge base and attributing its usage and + costs.""" retrieval_instructions: Optional[str] = rest_field( name="retrievalInstructions", visibility=["read", "create", "update", "delete", "query"] ) @@ -6102,6 +6410,12 @@ class KnowledgeBase(_Model): name="corsOptions", visibility=["read", "create", "update", "delete", "query"] ) """Options to control Cross-Origin Resource Sharing (CORS) for the knowledge base.""" + retrieve_defaults: Optional["_models.KnowledgeBaseRetrieveDefaults"] = rest_field( + name="retrieveDefaults", visibility=["read", "create", "update", "delete", "query"] + ) + """Persisted request-wide retrieve defaults for this knowledge base. These values apply to + retrieve requests that omit the corresponding fields; request-time values take precedence when + present.""" @overload def __init__( @@ -6115,9 +6429,11 @@ def __init__( e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, description: Optional[str] = None, + tags: Optional[dict[str, str]] = None, retrieval_instructions: Optional[str] = None, answer_instructions: Optional[str] = None, cors_options: Optional["_models.CorsOptions"] = None, + retrieve_defaults: Optional["_models.KnowledgeBaseRetrieveDefaults"] = None, ) -> None: ... @overload @@ -6131,7 +6447,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseModel(_Model): +class KnowledgeBaseModel(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the connection parameters for the model to use for query planning. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -6163,7 +6479,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseAzureOpenAIModel(KnowledgeBaseModel, discriminator="azureOpenAI"): +class KnowledgeBaseAzureOpenAIModel( + KnowledgeBaseModel, discriminator="azureOpenAI" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the Azure OpenAI resource used to do query planning. :ivar kind: Required. Use Azure Open AI models for query planning. @@ -6199,6 +6517,53 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeBaseModelKind.AZURE_OPEN_AI # type: ignore +class KnowledgeBaseRetrieveDefaults(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Persisted request-wide defaults for knowledge base retrieve requests. Each value provides the + default for the matching retrieve-request field; service defaults apply when unset, and + request-time values take precedence when present. + + :ivar max_runtime_in_seconds: The default maximum runtime in seconds for a retrieve request. + :vartype max_runtime_in_seconds: int + :ivar max_output_documents: The default maximum number of documents in the retrieve output. + :vartype max_output_documents: int + :ivar max_output_size_in_tokens: The default maximum size, in tokens, of the content in the + retrieve output. + :vartype max_output_size_in_tokens: int + """ + + max_runtime_in_seconds: Optional[int] = rest_field( + name="maxRuntimeInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The default maximum runtime in seconds for a retrieve request.""" + max_output_documents: Optional[int] = rest_field( + name="maxOutputDocuments", visibility=["read", "create", "update", "delete", "query"] + ) + """The default maximum number of documents in the retrieve output.""" + max_output_size_in_tokens: Optional[int] = rest_field( + name="maxOutputSizeInTokens", visibility=["read", "create", "update", "delete", "query"] + ) + """The default maximum size, in tokens, of the content in the retrieve output.""" + + @overload + def __init__( + self, + *, + max_runtime_in_seconds: Optional[int] = None, + max_output_documents: Optional[int] = None, + max_output_size_in_tokens: 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 KnowledgeSourceFile(_Model): """Metadata for a file uploaded to a File knowledge source. @@ -6214,6 +6579,19 @@ class KnowledgeSourceFile(_Model): :vartype last_updated_at: ~datetime.datetime :ivar error_message: The error message if file processing failed, null otherwise. :vartype error_message: str + :ivar prefix: The prefix (directory-like path) derived from the full file name. + :vartype prefix: str + :ivar metadata: Custom key/value metadata stored with the file. Returned but not searchable or + filterable. + :vartype metadata: dict[str, str] + :ivar parsing_mode: The parsing mode applied to the file (auto-detected from the file). Known + values are: "default", "text", "delimitedText", "json", "jsonArray", "jsonLines", and + "markdown". + :vartype parsing_mode: str or ~azure.search.documents.indexes.models.BlobIndexerParsingMode + :ivar extraction_mode: The extraction mode applied to the file. Known values are: "minimal" and + "standard". + :vartype extraction_mode: str or + ~azure.search.documents.indexes.models.FileKnowledgeSourceExtractionMode """ file_id: Optional[str] = rest_field(name="fileId", visibility=["read"]) @@ -6230,9 +6608,23 @@ class KnowledgeSourceFile(_Model): """The timestamp when the file was last updated.""" error_message: Optional[str] = rest_field(name="errorMessage", visibility=["read"]) """The error message if file processing failed, null otherwise.""" + prefix: Optional[str] = rest_field(visibility=["read"]) + """The prefix (directory-like path) derived from the full file name.""" + metadata: Optional[dict[str, str]] = rest_field(visibility=["read"]) + """Custom key/value metadata stored with the file. Returned but not searchable or filterable.""" + parsing_mode: Optional[Union[str, "_models.BlobIndexerParsingMode"]] = rest_field( + name="parsingMode", visibility=["read"] + ) + """The parsing mode applied to the file (auto-detected from the file). Known values are: + \"default\", \"text\", \"delimitedText\", \"json\", \"jsonArray\", \"jsonLines\", and + \"markdown\".""" + extraction_mode: Optional[Union[str, "_models.FileKnowledgeSourceExtractionMode"]] = rest_field( + name="extractionMode", visibility=["read"] + ) + """The extraction mode applied to the file. Known values are: \"minimal\" and \"standard\".""" -class KnowledgeSourceReference(_Model): +class KnowledgeSourceReference(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Reference to a knowledge source. :ivar name: The name of the knowledge source. Required. @@ -6281,7 +6673,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class LanguageDetectionSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.LanguageDetectionSkill"): +class LanguageDetectionSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.LanguageDetectionSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that detects the language of input text and reports a single language code for every document submitted on the request. The language code is paired with a score indicating the confidence of the analysis. @@ -6354,7 +6748,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.LanguageDetectionSkill" # type: ignore -class LengthTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.LengthTokenFilter"): +class LengthTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.LengthTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Removes words that are too long or too short. This token filter is implemented using Apache Lucene. @@ -6402,7 +6798,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.LengthTokenFilter" # type: ignore -class LimitTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.LimitTokenFilter"): +class LimitTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.LimitTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Limits the number of tokens while indexing. This token filter is implemented using Apache Lucene. @@ -6454,56 +6852,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.LimitTokenFilter" # type: ignore -class ListDataSourcesResult(_Model): - """Response from a List Datasources request. If successful, it includes the full definitions of - all datasources. - - :ivar data_sources: The datasources in the Search service. Required. - :vartype data_sources: - list[~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection] - """ - - data_sources: list["_models.SearchIndexerDataSourceConnection"] = rest_field(name="value", visibility=["read"]) - """The datasources in the Search service. Required.""" - - -class ListIndexersResult(_Model): - """Response from a List Indexers request. If successful, it includes the full definitions of all - indexers. - - :ivar indexers: The indexers in the Search service. Required. - :vartype indexers: list[~azure.search.documents.indexes.models.SearchIndexer] - """ - - indexers: list["_models.SearchIndexer"] = rest_field(name="value", visibility=["read"]) - """The indexers in the Search service. Required.""" - - -class ListSkillsetsResult(_Model): - """Response from a list skillset request. If successful, it includes the full definitions of all - skillsets. - - :ivar skillsets: The skillsets defined in the Search service. Required. - :vartype skillsets: list[~azure.search.documents.indexes.models.SearchIndexerSkillset] - """ - - skillsets: list["_models.SearchIndexerSkillset"] = rest_field(name="value", visibility=["read"]) - """The skillsets defined in the Search service. Required.""" - - -class ListSynonymMapsResult(_Model): - """Response from a List SynonymMaps request. If successful, it includes the full definitions of - all synonym maps. - - :ivar synonym_maps: The synonym maps in the Search service. Required. - :vartype synonym_maps: list[~azure.search.documents.indexes.models.SynonymMap] - """ - - synonym_maps: list["_models.SynonymMap"] = rest_field(name="value", visibility=["read"]) - """The synonym maps in the Search service. Required.""" - - -class LuceneStandardAnalyzer(LexicalAnalyzer, discriminator="#Microsoft.Azure.Search.StandardAnalyzer"): +class LuceneStandardAnalyzer( + LexicalAnalyzer, discriminator="#Microsoft.Azure.Search.StandardAnalyzer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Standard Apache Lucene analyzer; Composed of the standard tokenizer, lowercase filter and stop filter. @@ -6553,7 +6904,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.StandardAnalyzer" # type: ignore -class LuceneStandardTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.StandardTokenizer"): +class LuceneStandardTokenizer( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.StandardTokenizer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Breaks text following the Unicode Text Segmentation rules. This tokenizer is implemented using Apache Lucene. @@ -6597,7 +6950,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.StandardTokenizer" # type: ignore -class LuceneStandardTokenizerV2(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.StandardTokenizerV2"): +class LuceneStandardTokenizerV2( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.StandardTokenizerV2" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Breaks text following the Unicode Text Segmentation rules. This tokenizer is implemented using Apache Lucene. @@ -6642,7 +6997,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.StandardTokenizerV2" # type: ignore -class MagnitudeScoringFunction(ScoringFunction, discriminator="magnitude"): +class MagnitudeScoringFunction( + ScoringFunction, discriminator="magnitude" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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. @@ -6693,7 +7050,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = "magnitude" # type: ignore -class MagnitudeScoringParameters(_Model): +class MagnitudeScoringParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Provides parameter values to a magnitude scoring function. :ivar boosting_range_start: The field value at which boosting starts. Required. @@ -6739,7 +7096,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MappingCharFilter(CharFilter, discriminator="#Microsoft.Azure.Search.MappingCharFilter"): +class MappingCharFilter( + CharFilter, discriminator="#Microsoft.Azure.Search.MappingCharFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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. @@ -6783,7 +7142,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.MappingCharFilter" # type: ignore -class McpServerAuthentication(_Model): +class McpServerAuthentication(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """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: @@ -6817,7 +7176,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class McpServerOutputParsing(_Model): +class McpServerOutputParsing(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """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: @@ -6881,7 +7240,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = McpServerOutputParsingKind.AUTO # type: ignore -class McpServerFoundryConnectionAuthentication(McpServerAuthentication, discriminator="foundryConnection"): +class McpServerFoundryConnectionAuthentication( + McpServerAuthentication, discriminator="foundryConnection" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Authentication using an Azure AI Foundry connection. :ivar kind: The discriminator value. Required. Authenticate using an Azure AI Foundry @@ -6919,7 +7280,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = McpServerAuthenticationKind.FOUNDRY_CONNECTION # type: ignore -class McpServerFoundryConnectionParameters(_Model): +class McpServerFoundryConnectionParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for Foundry connection authentication. :ivar connection_id: The Azure AI Foundry connection identifier. @@ -6953,7 +7314,9 @@ class McpServerHeaders(_Model): """A dictionary of HTTP header names and values.""" -class McpServerJsonOutputParsing(McpServerOutputParsing, discriminator="json"): +class McpServerJsonOutputParsing( + McpServerOutputParsing, discriminator="json" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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 @@ -6992,13 +7355,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = McpServerOutputParsingKind.JSON # type: ignore -class McpServerKnowledgeSource(KnowledgeSource, discriminator="mcpServer"): +class McpServerKnowledgeSource( + KnowledgeSource, discriminator="mcpServer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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 results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -7033,6 +7403,7 @@ def __init__( name: str, mcp_server_parameters: "_models.McpServerKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -7049,7 +7420,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.MCP_SERVER # type: ignore -class McpServerKnowledgeSourceParameters(_Model): +class McpServerKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for an MCP server knowledge source. :ivar server_url: The URL of the MCP server endpoint. Required. @@ -7117,7 +7488,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = McpServerOutputParsingKind.NONE # type: ignore -class McpServerOutputParsingJsonParameters(_Model): +class McpServerOutputParsingJsonParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for JSON output parsing. :ivar documents_path: The JSON path to the array of documents in the tool output. Required. @@ -7153,7 +7524,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class McpServerOutputParsingSplitParameters(_Model): +class McpServerOutputParsingSplitParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for split output parsing. :ivar text_split_mode: The text split mode to use. Known values are: "pages" and "sentences". @@ -7218,7 +7589,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class McpServerSplitOutputParsing(McpServerOutputParsing, discriminator="split"): +class McpServerSplitOutputParsing( + McpServerOutputParsing, discriminator="split" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Split the output into pages using the configured split parameters. :ivar kind: The discriminator value. Required. Split the output into pages using the configured @@ -7256,7 +7629,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = McpServerOutputParsingKind.SPLIT # type: ignore -class McpServerStoredHeadersAuthentication(McpServerAuthentication, discriminator="storedHeaders"): +class McpServerStoredHeadersAuthentication( + McpServerAuthentication, discriminator="storedHeaders" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Authentication using stored HTTP headers. :ivar kind: The discriminator value. Required. Authenticate using stored HTTP headers. @@ -7292,7 +7667,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = McpServerAuthenticationKind.STORED_HEADERS # type: ignore -class McpServerStoredHeadersParameters(_Model): +class McpServerStoredHeadersParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for stored headers authentication. :ivar headers: The stored HTTP headers to include in MCP server requests. @@ -7322,18 +7697,17 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class McpServerTool(_Model): +class McpServerTool(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a single tool within an MCP server knowledge source. :ivar name: The name of the MCP tool to invoke. :vartype name: 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 'reranked' when not specified. Known values are: "reranked" and - "always". - :vartype inclusion_mode: str or - ~azure.search.documents.indexes.models.McpServerToolInclusionMode + :ivar results_processing: Controls whether the parsed results from this tool are reranked. + Defaults to 'rerank' when not specified. Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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 @@ -7345,11 +7719,11 @@ class McpServerTool(_Model): 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"] + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = rest_field( + name="resultsProcessing", visibility=["read", "create", "update", "delete", "query"] ) - """Controls how the parsed results from this tool are integrated into the final result set. - Defaults to 'reranked' when not specified. Known values are: \"reranked\" and \"always\".""" + """Controls whether the parsed results from this tool are reranked. Defaults to 'rerank' when not + specified. Known values are: \"rerank\" and \"none\".""" max_output_tokens: Optional[int] = rest_field( name="maxOutputTokens", visibility=["read", "create", "update", "delete", "query"] ) @@ -7361,7 +7735,7 @@ def __init__( *, name: Optional[str] = None, output_parsing: Optional["_models.McpServerOutputParsing"] = None, - inclusion_mode: Optional[Union[str, "_models.McpServerToolInclusionMode"]] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, max_output_tokens: Optional[int] = None, ) -> None: ... @@ -7376,7 +7750,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MergeSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.MergeSkill"): +class MergeSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.MergeSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill for merging two or more strings into a single unified string, with an optional user-defined delimiter separating each component part. @@ -7446,7 +7822,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class MicrosoftLanguageStemmingTokenizer( LexicalTokenizer, discriminator="#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer" -): +): # pylint: disable=docstring-keyword-should-match-keyword-only """Divides text using language-specific rules and reduces words to their base forms. :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or @@ -7524,7 +7900,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer" # type: ignore -class MicrosoftLanguageTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.MicrosoftLanguageTokenizer"): +class MicrosoftLanguageTokenizer( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.MicrosoftLanguageTokenizer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Divides text using language-specific rules. :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or @@ -7634,7 +8012,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.NativeBlobSoftDeleteDeletionDetectionPolicy" # type: ignore -class NGramTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.NGramTokenFilter"): +class NGramTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.NGramTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Generates n-grams of the given size(s). This token filter is implemented using Apache Lucene. :ivar name: The name of the token filter. It must only contain letters, digits, spaces, dashes @@ -7680,7 +8060,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.NGramTokenFilter" # type: ignore -class NGramTokenFilterV2(TokenFilter, discriminator="#Microsoft.Azure.Search.NGramTokenFilterV2"): +class NGramTokenFilterV2( + TokenFilter, discriminator="#Microsoft.Azure.Search.NGramTokenFilterV2" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Generates n-grams of the given size(s). This token filter is implemented using Apache Lucene. :ivar name: The name of the token filter. It must only contain letters, digits, spaces, dashes @@ -7727,7 +8109,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.NGramTokenFilterV2" # type: ignore -class NGramTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.NGramTokenizer"): +class NGramTokenizer( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.NGramTokenizer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Tokenizes the input into n-grams of the given size(s). This tokenizer is implemented using Apache Lucene. @@ -7782,7 +8166,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.NGramTokenizer" # type: ignore -class OcrSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Vision.OcrSkill"): +class OcrSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Vision.OcrSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that extracts text from image files. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill @@ -7889,7 +8275,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Vision.OcrSkill" # type: ignore -class OutputFieldMappingEntry(_Model): +class OutputFieldMappingEntry(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Output field mapping for a skill. :ivar name: The name of the output defined by the skill. Required. @@ -7924,7 +8310,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PathHierarchyTokenizerV2(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.PathHierarchyTokenizerV2"): +class PathHierarchyTokenizerV2( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.PathHierarchyTokenizerV2" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Tokenizer for path-like hierarchies. This tokenizer is implemented using Apache Lucene. :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or @@ -7991,7 +8379,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.PathHierarchyTokenizerV2" # type: ignore -class PatternAnalyzer(LexicalAnalyzer, discriminator="#Microsoft.Azure.Search.PatternAnalyzer"): +class PatternAnalyzer( + LexicalAnalyzer, discriminator="#Microsoft.Azure.Search.PatternAnalyzer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Flexibly separates text into terms via a regular expression pattern. This analyzer is implemented using Apache Lucene. @@ -8055,7 +8445,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.PatternAnalyzer" # type: ignore -class PatternCaptureTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.PatternCaptureTokenFilter"): +class PatternCaptureTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.PatternCaptureTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Uses Java regexes to emit multiple tokens - one for each capture group in one or more patterns. This token filter is implemented using Apache Lucene. @@ -8105,7 +8497,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.PatternCaptureTokenFilter" # type: ignore -class PatternReplaceCharFilter(CharFilter, discriminator="#Microsoft.Azure.Search.PatternReplaceCharFilter"): +class PatternReplaceCharFilter( + CharFilter, discriminator="#Microsoft.Azure.Search.PatternReplaceCharFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A character filter that replaces characters in the input string. It uses a regular expression to identify character sequences to preserve and a replacement pattern to identify characters to replace. For example, given the input text "aa bb aa bb", pattern "(aa)\\\\s+(bb)", and @@ -8154,7 +8548,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.PatternReplaceCharFilter" # type: ignore -class PatternReplaceTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.PatternReplaceTokenFilter"): +class PatternReplaceTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.PatternReplaceTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A character filter that replaces characters in the input string. It uses a regular expression to identify character sequences to preserve and a replacement pattern to identify characters to replace. For example, given the input text "aa bb aa bb", pattern "(aa)\\\\s+(bb)", and @@ -8203,7 +8599,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.PatternReplaceTokenFilter" # type: ignore -class PatternTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.PatternTokenizer"): +class PatternTokenizer( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.PatternTokenizer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Tokenizer that uses regex pattern matching to construct distinct tokens. This tokenizer is implemented using Apache Lucene. @@ -8263,7 +8661,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.PatternTokenizer" # type: ignore -class PhoneticTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.PhoneticTokenFilter"): +class PhoneticTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.PhoneticTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Create tokens for phonetic matches. This token filter is implemented using Apache Lucene. :ivar name: The name of the token filter. It must only contain letters, digits, spaces, dashes @@ -8318,7 +8718,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.PhoneticTokenFilter" # type: ignore -class PIIDetectionSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.PIIDetectionSkill"): +class PIIDetectionSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.PIIDetectionSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Using the Text Analytics API, extracts personal information from an input text and gives you the option of masking it. @@ -8432,13 +8834,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.PIIDetectionSkill" # type: ignore -class RemoteSharePointKnowledgeSource(KnowledgeSource, discriminator="remoteSharePoint"): +class RemoteSharePointKnowledgeSource( + KnowledgeSource, discriminator="remoteSharePoint" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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 results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -8470,6 +8879,7 @@ def __init__( *, name: str, description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, remote_share_point_parameters: Optional["_models.RemoteSharePointKnowledgeSourceParameters"] = None, @@ -8487,7 +8897,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.REMOTE_SHARE_POINT # type: ignore -class RemoteSharePointKnowledgeSourceParameters(_Model): # pylint: disable=name-too-long +class RemoteSharePointKnowledgeSourceParameters( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Parameters for remote SharePoint knowledge source. :ivar filter_expression: Keyword Query Language (KQL) expression with queryable SharePoint @@ -8538,7 +8950,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RescoringOptions(_Model): +class RescoringOptions(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains the options for rescoring. :ivar enable_rescoring: If set to true, after the initial search on the compressed vectors, the @@ -8597,7 +9009,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceCounter(_Model): +class ResourceCounter(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a resource's usage and quota. :ivar usage: The resource usage amount. Required. @@ -8630,7 +9042,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ScalarQuantizationCompression(VectorSearchCompression, discriminator="scalarQuantization"): +class ScalarQuantizationCompression( + VectorSearchCompression, discriminator="scalarQuantization" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains configuration options specific to the scalar quantization compression method used during indexing and querying. @@ -8688,7 +9102,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorSearchCompressionKind.SCALAR_QUANTIZATION # type: ignore -class ScalarQuantizationParameters(_Model): +class ScalarQuantizationParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains the parameters specific to Scalar Quantization. :ivar quantized_data_type: The quantized data type of compressed vector values. "int8" @@ -8719,7 +9133,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ScoringProfile(_Model): +class ScoringProfile(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines parameters for a search index that influence scoring in search queries. :ivar name: The name of the scoring profile. Required. @@ -8774,7 +9188,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchAlias(_Model): +class SearchAlias(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an index alias, which describes a mapping from the alias name to an index. The alias name can be used in place of the index name for supported operations. @@ -8814,7 +9228,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchField(_Model): +class SearchField(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a field in an index definition, which describes the name, data type, and search behavior of a field. @@ -9234,7 +9648,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndex(_Model): +class SearchIndex(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a search index definition, which describes the fields and search behavior of an index. @@ -9421,7 +9835,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexer(_Model): +class SearchIndexer(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an indexer. :ivar name: The name of the indexer. Required. @@ -9551,7 +9965,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerCache(_Model): +class SearchIndexerCache(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The type of the cache. :ivar id: A guid for the SearchIndexerCache. @@ -9609,7 +10023,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerDataContainer(_Model): +class SearchIndexerDataContainer(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents information about the entity (such as Azure SQL table or CosmosDB collection) that will be indexed. @@ -9647,7 +10061,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerDataIdentity(_Model): +class SearchIndexerDataIdentity(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Abstract base type for data identities. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -9711,7 +10125,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.DataNoneIdentity" # type: ignore -class SearchIndexerDataSourceConnection(_Model): +class SearchIndexerDataSourceConnection(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a datasource definition, which can be used to configure an indexer. :ivar name: The name of the datasource. Required. @@ -9857,7 +10271,7 @@ def __setattr__(self, key: str, value: Any) -> None: class SearchIndexerDataUserAssignedIdentity( SearchIndexerDataIdentity, discriminator="#Microsoft.Azure.Search.DataUserAssignedIdentity" -): +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the identity for a datasource to use. :ivar resource_id: The fully qualified Azure resource Id of a user assigned managed identity @@ -9952,7 +10366,7 @@ class SearchIndexerError(_Model): available.""" -class SearchIndexerIndexProjection(_Model): +class SearchIndexerIndexProjection(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Definition of additional projections to secondary search indexes. :ivar selectors: A list of projections to be performed to secondary search indexes. Required. @@ -9993,7 +10407,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerIndexProjectionSelector(_Model): +class SearchIndexerIndexProjectionSelector(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Description for what data to store in the designated search index. :ivar target_index_name: Name of the search index to project to. Must have a key field with the @@ -10050,7 +10464,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerIndexProjectionsParameters(_Model): +class SearchIndexerIndexProjectionsParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """A dictionary of index projection-specific configuration properties. Each name is the name of a specific property. Each value must be of a primitive type. @@ -10083,7 +10497,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerKnowledgeStore(_Model): +class SearchIndexerKnowledgeStore(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Definition of additional projections to azure blob, table, or files, of enriched data. :ivar storage_connection_string: The connection string to the storage account projections will @@ -10147,7 +10561,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerKnowledgeStoreProjectionSelector(_Model): # pylint: disable=name-too-long +class SearchIndexerKnowledgeStoreProjectionSelector( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Abstract class to share properties between concrete selectors. :ivar reference_key_name: Name of reference key to different projection. @@ -10205,7 +10621,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class SearchIndexerKnowledgeStoreBlobProjectionSelector( SearchIndexerKnowledgeStoreProjectionSelector -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Abstract class to share properties between concrete selectors. :ivar reference_key_name: Name of reference key to different projection. @@ -10252,7 +10668,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class SearchIndexerKnowledgeStoreFileProjectionSelector( SearchIndexerKnowledgeStoreBlobProjectionSelector -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Projection definition for what data to store in Azure Files. :ivar reference_key_name: Name of reference key to different projection. @@ -10294,7 +10710,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class SearchIndexerKnowledgeStoreObjectProjectionSelector( SearchIndexerKnowledgeStoreBlobProjectionSelector -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Projection definition for what data to store in Azure Blob. :ivar reference_key_name: Name of reference key to different projection. @@ -10334,7 +10750,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerKnowledgeStoreParameters(_Model): +class SearchIndexerKnowledgeStoreParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """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. @@ -10366,7 +10782,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexerKnowledgeStoreProjection(_Model): +class SearchIndexerKnowledgeStoreProjection(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Container object for various projection selectors. :ivar tables: Projections to Azure Table storage. @@ -10415,7 +10831,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class SearchIndexerKnowledgeStoreTableProjectionSelector( SearchIndexerKnowledgeStoreProjectionSelector -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Description for what data to store in Azure Tables. :ivar reference_key_name: Name of reference key to different projection. @@ -10486,7 +10902,7 @@ class SearchIndexerLimits(_Model): """The maximum number of characters that will be extracted from a document picked up for indexing.""" -class SearchIndexerSkillset(_Model): +class SearchIndexerSkillset(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """A list of skills. :ivar name: The name of the skillset. Required. @@ -10648,7 +11064,7 @@ class SearchIndexerWarning(_Model): available.""" -class SearchIndexFieldReference(_Model): +class SearchIndexFieldReference(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Field reference for a search index. :ivar name: The name of the field. Required. @@ -10676,13 +11092,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexKnowledgeSource(KnowledgeSource, discriminator="searchIndex"): +class SearchIndexKnowledgeSource( + KnowledgeSource, discriminator="searchIndex" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Knowledge Source targeting a search index. :ivar name: The name of the knowledge source. Required. :vartype name: str :ivar description: Optional user-defined description. :vartype description: str + :ivar results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -10715,6 +11138,7 @@ def __init__( name: str, search_index_parameters: "_models.SearchIndexKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -10731,7 +11155,191 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.SEARCH_INDEX # type: ignore -class SearchIndexKnowledgeSourceParameters(_Model): +class SearchIndexKnowledgeSourceBoost(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A hint that identifies a condition the query planner can use to influence document ranking. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SearchIndexKnowledgeSourceFieldValueBoost, SearchIndexKnowledgeSourceMultiWordExpressionBoost + + :ivar kind: The kind of boost hint. Required. Known values are: "fieldValue" and + "multiWordExpression". + :vartype kind: str or + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceBoostKind + :ivar boost_instructions: Natural-language instructions that explain when and how to apply the + boost. + :vartype boost_instructions: str + """ + + __mapping__: dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """The kind of boost hint. Required. Known values are: \"fieldValue\" and \"multiWordExpression\".""" + boost_instructions: Optional[str] = rest_field( + name="boostInstructions", visibility=["read", "create", "update", "delete", "query"] + ) + """Natural-language instructions that explain when and how to apply the boost.""" + + @overload + def __init__( + self, + *, + kind: str, + boost_instructions: 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 SearchIndexKnowledgeSourceFieldValueBoost( + SearchIndexKnowledgeSourceBoost, discriminator="fieldValue" +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """A hint that boosts documents based on a field value. + + :ivar boost_instructions: Natural-language instructions that explain when and how to apply the + boost. + :vartype boost_instructions: str + :ivar kind: The discriminator value. Required. Boost documents based on a field value. + :vartype kind: str or ~azure.search.documents.indexes.models.FIELD_VALUE + :ivar field: The name of the search index field. Required. + :vartype field: str + :ivar field_values: Representative values for the field. + :vartype field_values: list[str] + :ivar boost: A multiplier for the document score. Must be a positive number not equal to 1.0. + Required. + :vartype boost: float + """ + + kind: Literal[SearchIndexKnowledgeSourceBoostKind.FIELD_VALUE] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Boost documents based on a field value.""" + field: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the search index field. Required.""" + field_values: Optional[list[str]] = rest_field( + name="fieldValues", visibility=["read", "create", "update", "delete", "query"] + ) + """Representative values for the field.""" + boost: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A multiplier for the document score. Must be a positive number not equal to 1.0. Required.""" + + @overload + def __init__( + self, + *, + field: str, + boost: float, + boost_instructions: Optional[str] = None, + field_values: 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) + self.kind = SearchIndexKnowledgeSourceBoostKind.FIELD_VALUE # type: ignore + + +class SearchIndexKnowledgeSourceFilterHint(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A hint that identifies a field and representative values the query planner can use when + constructing a filter. + + :ivar field: The name of the filterable search index field. Required. + :vartype field: str + :ivar field_values: Representative values for the field. Required. + :vartype field_values: list[str] + :ivar filter_instructions: Natural-language instructions that explain when and how to filter on + the field. + :vartype filter_instructions: str + """ + + field: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the filterable search index field. Required.""" + field_values: list[str] = rest_field(name="fieldValues", visibility=["read", "create", "update", "delete", "query"]) + """Representative values for the field. Required.""" + filter_instructions: Optional[str] = rest_field( + name="filterInstructions", visibility=["read", "create", "update", "delete", "query"] + ) + """Natural-language instructions that explain when and how to filter on the field.""" + + @overload + def __init__( + self, + *, + field: str, + field_values: list[str], + filter_instructions: 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 SearchIndexKnowledgeSourceMultiWordExpressionBoost( + SearchIndexKnowledgeSourceBoost, discriminator="multiWordExpression" +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """A hint that boosts documents based on a multi-word expression. + + :ivar boost_instructions: Natural-language instructions that explain when and how to apply the + boost. + :vartype boost_instructions: str + :ivar kind: The discriminator value. Required. Boost documents based on a multi-word + expression. + :vartype kind: str or ~azure.search.documents.indexes.models.MULTI_WORD_EXPRESSION + :ivar field_values: Representative values for the boost. + :vartype field_values: list[str] + :ivar boost: A multiplier for the document score. Must be a positive number not equal to 1.0. + Required. + :vartype boost: float + """ + + kind: Literal[SearchIndexKnowledgeSourceBoostKind.MULTI_WORD_EXPRESSION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Boost documents based on a multi-word expression.""" + field_values: Optional[list[str]] = rest_field( + name="fieldValues", visibility=["read", "create", "update", "delete", "query"] + ) + """Representative values for the boost.""" + boost: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A multiplier for the document score. Must be a positive number not equal to 1.0. Required.""" + + @overload + def __init__( + self, + *, + boost: float, + boost_instructions: Optional[str] = None, + field_values: 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) + self.kind = SearchIndexKnowledgeSourceBoostKind.MULTI_WORD_EXPRESSION # type: ignore + + +class SearchIndexKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for search index knowledge source. :ivar search_index_name: The name of the Search index. Required. @@ -10747,6 +11355,11 @@ class SearchIndexKnowledgeSourceParameters(_Model): :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 + :ivar query_hints: Default hints that guide query planning toward useful filters and boosts for + this search index knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype query_hints: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints """ search_index_name: str = rest_field( @@ -10771,6 +11384,11 @@ class SearchIndexKnowledgeSourceParameters(_Model): ) """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.""" + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHints", visibility=["read", "create", "update", "delete", "query"] + ) + """Default hints that guide query planning toward useful filters and boosts for this search index + knowledge source. Request-time query hints replace these defaults as a complete object.""" @overload def __init__( @@ -10781,6 +11399,7 @@ def __init__( search_fields: Optional[list["_models.SearchIndexFieldReference"]] = None, semantic_configuration_name: Optional[str] = None, base_filter: Optional[str] = None, + query_hints: Optional["_models.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -10794,7 +11413,49 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchIndexResponse(_Model): +class SearchIndexKnowledgeSourceQueryHints(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Hints that guide query planning toward useful filters and boosts for a search index knowledge + source. + + :ivar filters: Filter hints that identify fields and representative values the query planner + can use when constructing filters. + :vartype filters: + list[~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceFilterHint] + :ivar boosts: Boost hints that identify conditions the query planner can use to influence + document ranking. + :vartype boosts: list[~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceBoost] + """ + + filters: Optional[list["_models.SearchIndexKnowledgeSourceFilterHint"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Filter hints that identify fields and representative values the query planner can use when + constructing filters.""" + boosts: Optional[list["_models.SearchIndexKnowledgeSourceBoost"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Boost hints that identify conditions the query planner can use to influence document ranking.""" + + @overload + def __init__( + self, + *, + filters: Optional[list["_models.SearchIndexKnowledgeSourceFilterHint"]] = None, + boosts: Optional[list["_models.SearchIndexKnowledgeSourceBoost"]] = 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 SearchIndexResponse(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a search index definition, which describes the fields and search behavior of an index. @@ -10971,7 +11632,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchResourceEncryptionKey(_Model): +class SearchResourceEncryptionKey(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """A customer-managed encryption key in Azure Key Vault. Keys that you create and manage can be used to encrypt or decrypt data-at-rest, such as indexes and synonym maps. @@ -11069,7 +11730,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SearchServiceCounters(_Model): +class SearchServiceCounters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents service-level resource counters and quotas. :ivar alias_counter: Total number of aliases. Required. @@ -11170,7 +11831,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchServiceLimits(_Model): +class SearchServiceLimits(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents various service level limits. :ivar max_fields_per_index: The maximum allowed fields per index. @@ -11189,6 +11850,9 @@ class SearchServiceLimits(_Model): :ivar max_cumulative_indexer_runtime_seconds: The maximum cumulative indexer runtime in seconds allowed for the service. :vartype max_cumulative_indexer_runtime_seconds: int + :ivar max_vector_index_size_per_index_in_bytes: The maximum vector index size (vector memory + quota) allowed per index in bytes. + :vartype max_vector_index_size_per_index_in_bytes: int """ max_fields_per_index: Optional[int] = rest_field( @@ -11216,6 +11880,10 @@ class SearchServiceLimits(_Model): name="maxCumulativeIndexerRuntimeSeconds", visibility=["read", "create", "update", "delete", "query"] ) """The maximum cumulative indexer runtime in seconds allowed for the service.""" + max_vector_index_size_per_index_in_bytes: Optional[int] = rest_field( + name="maxVectorIndexSizePerIndexInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum vector index size (vector memory quota) allowed per index in bytes.""" @overload def __init__( @@ -11227,6 +11895,7 @@ def __init__( max_complex_objects_in_collections_per_document: Optional[int] = None, max_storage_per_index_in_bytes: Optional[int] = None, max_cumulative_indexer_runtime_seconds: Optional[int] = None, + max_vector_index_size_per_index_in_bytes: Optional[int] = None, ) -> None: ... @overload @@ -11240,7 +11909,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchServiceStatistics(_Model): +class SearchServiceStatistics(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Response from a get service statistics request. If successful, it includes service level counters and limits. @@ -11281,7 +11950,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchSuggester(_Model): +class SearchSuggester(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines how the Suggest API should apply to a group of fields in the index. :ivar name: The name of the suggester. Required. @@ -11327,7 +11996,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.search_mode: Literal["analyzingInfixMatching"] = "analyzingInfixMatching" -class SemanticConfiguration(_Model): +class SemanticConfiguration(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines a specific configuration to be used in the context of semantic capabilities. :ivar name: The name of the semantic configuration. Required. @@ -11383,7 +12052,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SemanticField(_Model): +class SemanticField(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """A field that is used as part of the semantic configuration. :ivar field_name: File name. Required. @@ -11411,7 +12080,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SemanticPrioritizedFields(_Model): +class SemanticPrioritizedFields(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Describes the title, content, and keywords fields to be used for semantic ranking, captions, highlights, and answers. @@ -11470,7 +12139,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SemanticSearch(_Model): +class SemanticSearch(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines parameters for a search index that influence semantic capabilities. :ivar default_configuration_name: Allows you to set the name of a default semantic @@ -11509,7 +12178,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SentimentSkillV3(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.V3.SentimentSkill"): +class SentimentSkillV3( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.V3.SentimentSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Using the Text Analytics API, evaluates unstructured text and for each record, provides sentiment labels (such as "negative", "neutral" and "positive") based on the highest confidence score found by the service at a sentence and document-level. @@ -11596,7 +12267,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.V3.SentimentSkill" # type: ignore -class ServiceIndexersRuntime(_Model): +class ServiceIndexersRuntime(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents service-level indexer runtime counters. :ivar used_seconds: Cumulative runtime of all indexers in the service from the beginningTime to @@ -11652,7 +12323,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ShaperSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.ShaperSkill"): +class ShaperSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Util.ShaperSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill for reshaping the outputs. It creates a complex type to support composite fields (also known as multipart fields). @@ -11704,7 +12377,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Util.ShaperSkill" # type: ignore -class SharePointConnectorAppRegistration(_Model): +class SharePointConnectorAppRegistration(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Configures a SharePoint connector app registration for the index, enabling document-level permissions from SharePoint. @@ -11749,7 +12422,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ShingleTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.ShingleTokenFilter"): +class ShingleTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.ShingleTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Creates combinations of tokens as a single token. This token filter is implemented using Apache Lucene. @@ -11838,7 +12513,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.ShingleTokenFilter" # type: ignore -class SkillNames(_Model): +class SkillNames(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The type of the skill names. :ivar skill_names: the names of skills to be reset. @@ -11868,7 +12543,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SnowballTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.SnowballTokenFilter"): +class SnowballTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.SnowballTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A filter that stems words using a Snowball-generated stemmer. This token filter is implemented using Apache Lucene. @@ -11919,7 +12596,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class SoftDeleteColumnDeletionDetectionPolicy( DataDeletionDetectionPolicy, discriminator="#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy" -): +): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines a data deletion detection policy that implements a soft-deletion strategy. It determines whether an item should be deleted based on the value of a designated 'soft delete' column. @@ -11965,7 +12642,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy" # type: ignore -class SplitSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.SplitSkill"): +class SplitSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.SplitSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill to split a string into chunks of text. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill @@ -12123,7 +12802,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.SqlIntegratedChangeTrackingPolicy" # type: ignore -class StemmerOverrideTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.StemmerOverrideTokenFilter"): +class StemmerOverrideTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.StemmerOverrideTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Provides the ability to override other stemming filters with custom dictionary-based stemming. Any dictionary-stemmed terms will be marked as keywords so that they will not be stemmed with stemmers down the chain. Must be placed before any stemming filters. This token filter is @@ -12170,7 +12851,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.StemmerOverrideTokenFilter" # type: ignore -class StemmerTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.StemmerTokenFilter"): +class StemmerTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.StemmerTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Language specific stemming filter. This token filter is implemented using Apache Lucene. See `https://learn.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search#TokenFilters `_. @@ -12232,7 +12915,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.StemmerTokenFilter" # type: ignore -class StopAnalyzer(LexicalAnalyzer, discriminator="#Microsoft.Azure.Search.StopAnalyzer"): +class StopAnalyzer( + LexicalAnalyzer, discriminator="#Microsoft.Azure.Search.StopAnalyzer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Divides text at non-letters; Applies the lowercase and stopword token filters. This analyzer is implemented using Apache Lucene. @@ -12273,7 +12958,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.StopAnalyzer" # type: ignore -class StopwordsTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.StopwordsTokenFilter"): +class StopwordsTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.StopwordsTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Removes stop words from a token stream. This token filter is implemented using Apache Lucene. See `http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/StopFilter.html @@ -12351,7 +13038,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.StopwordsTokenFilter" # type: ignore -class SynonymMap(_Model): +class SynonymMap(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a synonym map definition. :ivar name: The name of the synonym map. Required. @@ -12420,7 +13107,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.format: Literal["solr"] = "solr" -class SynonymTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.SynonymTokenFilter"): +class SynonymTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.SynonymTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Matches single or multi-word synonyms in a token stream. This token filter is implemented using Apache Lucene. @@ -12493,7 +13182,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.SynonymTokenFilter" # type: ignore -class TagScoringFunction(ScoringFunction, discriminator="tag"): +class TagScoringFunction( + ScoringFunction, discriminator="tag" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines a function that boosts scores of documents with string values matching a given list of tags. @@ -12544,7 +13235,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = "tag" # type: ignore -class TagScoringParameters(_Model): +class TagScoringParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Provides parameter values to a tag scoring function. :ivar tags_parameter: The name of the parameter passed in search queries to specify the list of @@ -12574,7 +13265,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TextTranslationSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.TranslationSkill"): +class TextTranslationSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Text.TranslationSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill to translate text from one language to another. :ivar name: The name of the skill which uniquely identifies it within the skillset. A skill @@ -12693,7 +13386,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Text.TranslationSkill" # type: ignore -class TextWeights(_Model): +class TextWeights(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines weights on index fields for which matches should boost scoring in search queries. :ivar weights: The dictionary of per-field weights to boost document scoring. The keys are @@ -12723,7 +13416,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TruncateTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.TruncateTokenFilter"): +class TruncateTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.TruncateTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Truncates the terms to a specific length. This token filter is implemented using Apache Lucene. :ivar name: The name of the token filter. It must only contain letters, digits, spaces, dashes @@ -12763,7 +13458,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.TruncateTokenFilter" # type: ignore -class UaxUrlEmailTokenizer(LexicalTokenizer, discriminator="#Microsoft.Azure.Search.UaxUrlEmailTokenizer"): +class UaxUrlEmailTokenizer( + LexicalTokenizer, discriminator="#Microsoft.Azure.Search.UaxUrlEmailTokenizer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Tokenizes urls and emails as one token. This tokenizer is implemented using Apache Lucene. :ivar name: The name of the tokenizer. It must only contain letters, digits, spaces, dashes or @@ -12807,7 +13504,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.UaxUrlEmailTokenizer" # type: ignore -class UniqueTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.UniqueTokenFilter"): +class UniqueTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.UniqueTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Filters out tokens with same text as the previous token. This token filter is implemented using Apache Lucene. @@ -12851,7 +13550,79 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.UniqueTokenFilter" # type: ignore -class VectorSearch(_Model): +class UpdateKnowledgeSourceFileRequest(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Multipart request for updating a file in a File knowledge source. + + :ivar metadata: The JSON metadata describing the file. Required. + :vartype metadata: ~azure.search.documents.indexes.models.FileUploadMetadata + :ivar content: The raw file content. Required. + :vartype content: ~azure.search.documents._utils.utils.FileType + """ + + metadata: "_models.FileUploadMetadata" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The JSON metadata describing the file. Required.""" + content: FileType = rest_field( + visibility=["read", "create", "update", "delete", "query"], is_multipart_file_input=True + ) + """The raw file content. Required.""" + + @overload + def __init__( + self, + *, + metadata: "_models.FileUploadMetadata", + content: FileType, + ) -> 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 UploadKnowledgeSourceFileMultipartRequest( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Multipart request for uploading a file to a File knowledge source. + + :ivar metadata: The JSON metadata describing the file. Required. + :vartype metadata: ~azure.search.documents.indexes.models.FileUploadMetadata + :ivar content: The raw file content. Required. + :vartype content: ~azure.search.documents._utils.utils.FileType + """ + + metadata: "_models.FileUploadMetadata" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The JSON metadata describing the file. Required.""" + content: FileType = rest_field( + visibility=["read", "create", "update", "delete", "query"], is_multipart_file_input=True + ) + """The raw file content. Required.""" + + @overload + def __init__( + self, + *, + metadata: "_models.FileUploadMetadata", + content: FileType, + ) -> 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 VectorSearch(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains configuration options related to vector search. :ivar profiles: Defines combinations of configurations to use with vector search. @@ -12906,7 +13677,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VectorSearchProfile(_Model): +class VectorSearchProfile(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Defines a combination of configurations to use with vector search. :ivar name: The name to associate with this particular vector search profile. Required. @@ -12960,7 +13731,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VisionVectorizeSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Vision.VectorizeSkill"): +class VisionVectorizeSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Vision.VectorizeSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Allows you to generate a vector embedding for a given image or text input using the Azure AI Services Vision Vectorize API. @@ -13023,7 +13796,9 @@ class WebApiHttpHeaders(_Model): """A dictionary of http request headers.""" -class WebApiSkill(SearchIndexerSkill, discriminator="#Microsoft.Skills.Custom.WebApiSkill"): +class WebApiSkill( + SearchIndexerSkill, discriminator="#Microsoft.Skills.Custom.WebApiSkill" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A skill that can call a Web API endpoint, allowing you to extend a skillset by having it call your custom code. @@ -13142,7 +13917,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Skills.Custom.WebApiSkill" # type: ignore -class WebApiVectorizer(VectorSearchVectorizer, discriminator="customWebApi"): +class WebApiVectorizer( + VectorSearchVectorizer, discriminator="customWebApi" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies a user-defined vectorizer for generating the vector embedding of a query string. Integration of an external vectorizer is achieved using the custom Web API interface of a skillset. @@ -13185,7 +13962,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorSearchVectorizerKind.CUSTOM_WEB_API # type: ignore -class WebApiVectorizerParameters(_Model): +class WebApiVectorizerParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the properties for connecting to a user-defined vectorizer. :ivar url: The URI of the Web API providing the vectorizer. @@ -13262,13 +14039,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class WebKnowledgeSource(KnowledgeSource, discriminator="web"): +class WebKnowledgeSource( + KnowledgeSource, discriminator="web" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Knowledge Source targeting web results. :ivar name: The name of the knowledge source. Required. :vartype name: str :ivar description: Optional user-defined description. :vartype description: str + :ivar results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -13299,6 +14083,7 @@ def __init__( *, name: str, description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, web_parameters: Optional["_models.WebKnowledgeSourceParameters"] = None, @@ -13316,7 +14101,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.WEB # type: ignore -class WebKnowledgeSourceDomain(_Model): +class WebKnowledgeSourceDomain(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Configuration for web knowledge source domain. :ivar address: The address of the domain. Required. @@ -13351,7 +14136,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class WebKnowledgeSourceDomains(_Model): +class WebKnowledgeSourceDomains(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Domain allow/block configuration for web knowledge source. :ivar allowed_domains: Domains that are allowed for web results. @@ -13388,7 +14173,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class WebKnowledgeSourceParameters(_Model): +class WebKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for web knowledge source. :ivar domains: Domain allow/block configuration for web results. @@ -13446,7 +14231,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class WordDelimiterTokenFilter(TokenFilter, discriminator="#Microsoft.Azure.Search.WordDelimiterTokenFilter"): +class WordDelimiterTokenFilter( + TokenFilter, discriminator="#Microsoft.Azure.Search.WordDelimiterTokenFilter" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Splits words into subwords and performs optional transformations on subword groups. This token filter is implemented using Apache Lucene. @@ -13569,13 +14356,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.odata_type = "#Microsoft.Azure.Search.WordDelimiterTokenFilter" # type: ignore -class WorkIQKnowledgeSource(KnowledgeSource, discriminator="workIQ"): +class WorkIQKnowledgeSource( + KnowledgeSource, discriminator="workIQ" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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 results_processing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :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. @@ -13589,17 +14383,28 @@ class WorkIQKnowledgeSource(KnowledgeSource, discriminator="workIQ"): :vartype encryption_key: ~azure.search.documents.indexes.models.SearchResourceEncryptionKey :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 + :ivar work_iq_parameters: The parameters for the WorkIQ knowledge source, including the + customer-owned Entra app configuration used for on-behalf-of authentication. Required. + :vartype work_iq_parameters: + ~azure.search.documents.indexes.models.WorkIQKnowledgeSourceParameters """ 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.""" + work_iq_parameters: "_models.WorkIQKnowledgeSourceParameters" = rest_field( + name="workIQParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters for the WorkIQ knowledge source, including the customer-owned Entra app + configuration used for on-behalf-of authentication. Required.""" @overload def __init__( self, *, name: str, + work_iq_parameters: "_models.WorkIQKnowledgeSourceParameters", description: Optional[str] = None, + results_processing: Optional[Union[str, "_models.KnowledgeSourceResultsProcessing"]] = None, e_tag: Optional[str] = None, encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, ) -> None: ... @@ -13614,3 +14419,41 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.kind = KnowledgeSourceKind.WORK_IQ # type: ignore + + +class WorkIQKnowledgeSourceParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters for a WorkIQ knowledge source. + + :ivar entra_app_authentication: The customer-owned Microsoft Entra app registration + configuration used for on-behalf-of authentication to the Work IQ API. The customer registers a + tenant-owned Entra app, grants it the WorkIQAgent.Ask delegated permission, and configures a + federated credential so Azure AI Search can authenticate as that app without a stored client + secret. Required. + :vartype entra_app_authentication: + ~azure.search.documents.indexes.models.EntraAppAuthentication + """ + + entra_app_authentication: "_models.EntraAppAuthentication" = rest_field( + name="entraAppAuthentication", visibility=["read", "create", "update", "delete", "query"] + ) + """The customer-owned Microsoft Entra app registration configuration used for on-behalf-of + authentication to the Work IQ API. The customer registers a tenant-owned Entra app, grants it + the WorkIQAgent.Ask delegated permission, and configures a federated credential so Azure AI + Search can authenticate as that app without a stored client secret. Required.""" + + @overload + def __init__( + self, + *, + entra_app_authentication: "_models.EntraAppAuthentication", + ) -> 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/azure/search/documents/indexes/types.py b/sdk/search/azure-search-documents/azure/search/documents/indexes/types.py new file mode 100644 index 000000000000..adf851efecd6 --- /dev/null +++ b/sdk/search/azure-search-documents/azure/search/documents/indexes/types.py @@ -0,0 +1,7091 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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 typing import Any, Literal, Optional, TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +from .._utils.utils import FileType +from .models._enums import ( + KnowledgeBaseModelKind, + KnowledgeSourceKind, + McpServerAuthenticationKind, + McpServerOutputParsingKind, + SearchIndexKnowledgeSourceBoostKind, + VectorSearchAlgorithmKind, + VectorSearchCompressionKind, + VectorSearchVectorizerKind, +) + +if TYPE_CHECKING: + from ..knowledgebases.models import KnowledgeSourceIngestionParameters + from ..knowledgebases.types import KnowledgeRetrievalReasoningEffort + from ..knowledgebases.models import KnowledgeRetrievalOutputMode + from .models import ( + AIFoundryModelCatalogName, + AzureOpenAIModelName, + BlobIndexerDataToExtract, + BlobIndexerImageAction, + BlobIndexerPDFTextRotationAlgorithm, + BlobIndexerParsingMode, + CharFilterName, + ChatCompletionExtraParametersBehavior, + ChatCompletionResponseFormatType, + CjkBigramTokenFilterScripts, + ContentUnderstandingSkillChunkingMethod, + ContentUnderstandingSkillChunkingUnit, + ContentUnderstandingSkillExtractionOptions, + CustomEntityLookupSkillLanguage, + DocumentIntelligenceLayoutSkillChunkingUnit, + DocumentIntelligenceLayoutSkillExtractionOptions, + DocumentIntelligenceLayoutSkillMarkdownHeaderDepth, + DocumentIntelligenceLayoutSkillOutputFormat, + DocumentIntelligenceLayoutSkillOutputMode, + EdgeNGramTokenFilterSide, + EntityCategory, + EntityRecognitionSkillLanguage, + ImageAnalysisSkillLanguage, + ImageDetail, + IndexProjectionMode, + IndexedSharePointContainerName, + IndexerExecutionEnvironment, + IndexerPermissionOption, + IndexerResyncOption, + KeyPhraseExtractionSkillLanguage, + KnowledgeSourceResultsProcessing, + LexicalAnalyzerName, + LexicalNormalizerName, + LexicalTokenizerName, + MarkdownHeaderDepth, + MarkdownParsingSubmode, + MicrosoftStemmingTokenizerLanguage, + MicrosoftTokenizerLanguage, + OcrLineEnding, + OcrSkillLanguage, + PIIDetectionSkillMaskingMode, + PermissionFilter, + PhoneticEncoder, + RankingOrder, + RegexFlags, + ScoringFunctionAggregation, + ScoringFunctionInterpolation, + SearchFieldDataType, + SearchIndexPermissionFilterOption, + SearchIndexerDataSourceType, + SentimentSkillLanguage, + SnowballTokenFilterLanguage, + SplitSkillEncoderModelName, + SplitSkillLanguage, + SplitSkillUnit, + StemmerTokenFilterLanguage, + StopwordsList, + TextSplitMode, + TextTranslationSkillLanguage, + TokenCharacterKind, + TokenFilterName, + VectorEncodingFormat, + VectorSearchAlgorithmMetric, + VectorSearchCompressionRescoreStorageMethod, + VectorSearchCompressionTarget, + VisualFeature, + ) + + +AIServicesAccountIdentity = TypedDict( + "AIServicesAccountIdentity", + { + "description": str, + "identity": Optional["SearchIndexerDataIdentity"], + "subdomainUrl": Required[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.AIServicesByIdentity"]], + }, + total=False, +) +AIServicesAccountIdentity.__doc__ = """The multi-region account of an Azure AI service resource that's attached to a skillset. + +:ivar description: Description of the Azure AI service resource attached to a skillset. +:vartype description: str +:ivar identity: The user-assigned managed identity used for connections to AI Service. If not + specified, the system-assigned managed identity is used. On updates to the skillset, if the + identity is unspecified, the value remains unchanged. If set to "none", the value of this + property is cleared. +:vartype identity: "SearchIndexerDataIdentity" +:ivar subdomainUrl: The subdomain/Azure AI Services endpoint url for the corresponding AI + Service. Required. +:vartype subdomainUrl: str +:ivar ``@odata.type``: A URI fragment specifying the type of Azure AI service resource attached + to a skillset. Required. Default value is "#Microsoft.Azure.Search.AIServicesByIdentity". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.AIServicesByIdentity"] +""" + + +AIServicesAccountKey = TypedDict( + "AIServicesAccountKey", + { + "description": str, + "key": Required[str], + "subdomainUrl": Required[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.AIServicesByKey"]], + }, + total=False, +) +AIServicesAccountKey.__doc__ = """The account key of an Azure AI service resource that's attached to a skillset, to be used with +the resource's subdomain. + +:ivar description: Description of the Azure AI service resource attached to a skillset. +:vartype description: str +:ivar key: The key used to provision the Azure AI service resource attached to a skillset. + Required. +:vartype key: str +:ivar subdomainUrl: The subdomain/Azure AI Services endpoint url for the corresponding AI + Service. Required. +:vartype subdomainUrl: str +:ivar ``@odata.type``: A URI fragment specifying the type of Azure AI service resource attached + to a skillset. Required. Default value is "#Microsoft.Azure.Search.AIServicesByKey". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.AIServicesByKey"] +""" + + +class AIServicesVisionParameters(TypedDict, total=False): + """Specifies the AI Services Vision parameters for vectorizing a query image or text. + + :ivar modelVersion: 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 modelVersion: str + :ivar resourceUri: The resource URI of the AI Services resource. Required. + :vartype resourceUri: str + :ivar apiKey: API key of the designated AI Services resource. + :vartype apiKey: str + :ivar authIdentity: 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 authIdentity: "SearchIndexerDataIdentity" + """ + + modelVersion: Required[Optional[str]] + """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.""" + resourceUri: Required[str] + """The resource URI of the AI Services resource. Required.""" + apiKey: str + """API key of the designated AI Services resource.""" + authIdentity: Optional["SearchIndexerDataIdentity"] + """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.""" + + +class AIServicesVisionVectorizer(TypedDict, total=False): + """Clears the identity property of a datasource. + + :ivar name: The name to associate with this particular vectorization method. Required. + :vartype name: str + :ivar aiServicesVisionParameters: Contains the parameters specific to AI Services Vision + embedding vectorization. + :vartype aiServicesVisionParameters: "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: Literal[VectorSearchVectorizerKind.AI_SERVICES_VISION] + """ + + name: Required[str] + """The name to associate with this particular vectorization method. Required.""" + aiServicesVisionParameters: "AIServicesVisionParameters" + """Contains the parameters specific to AI Services Vision embedding vectorization.""" + kind: Required[Literal[VectorSearchVectorizerKind.AI_SERVICES_VISION]] + """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.""" + + +class AnalyzeTextOptions(TypedDict, total=False): + """Specifies some text and analysis components used to break that text into tokens. + + :ivar text: The text to break into tokens. Required. + :vartype text: str + :ivar analyzer: The name of the analyzer to use to break the given text. If this parameter is + not specified, you must specify a tokenizer instead. The tokenizer and analyzer parameters are + mutually exclusive. Known values are: "ar.microsoft", "ar.lucene", "hy.lucene", "bn.microsoft", + "eu.lucene", "bg.microsoft", "bg.lucene", "ca.microsoft", "ca.lucene", "zh-Hans.microsoft", + "zh-Hans.lucene", "zh-Hant.microsoft", "zh-Hant.lucene", "hr.microsoft", "cs.microsoft", + "cs.lucene", "da.microsoft", "da.lucene", "nl.microsoft", "nl.lucene", "en.microsoft", + "en.lucene", "et.microsoft", "fi.microsoft", "fi.lucene", "fr.microsoft", "fr.lucene", + "gl.lucene", "de.microsoft", "de.lucene", "el.microsoft", "el.lucene", "gu.microsoft", + "he.microsoft", "hi.microsoft", "hi.lucene", "hu.microsoft", "hu.lucene", "is.microsoft", + "id.microsoft", "id.lucene", "ga.lucene", "it.microsoft", "it.lucene", "ja.microsoft", + "ja.lucene", "kn.microsoft", "ko.microsoft", "ko.lucene", "lv.microsoft", "lv.lucene", + "lt.microsoft", "ml.microsoft", "ms.microsoft", "mr.microsoft", "nb.microsoft", "no.lucene", + "fa.lucene", "pl.microsoft", "pl.lucene", "pt-BR.microsoft", "pt-BR.lucene", "pt-PT.microsoft", + "pt-PT.lucene", "pa.microsoft", "ro.microsoft", "ro.lucene", "ru.microsoft", "ru.lucene", + "sr-cyrillic.microsoft", "sr-latin.microsoft", "sk.microsoft", "sl.microsoft", "es.microsoft", + "es.lucene", "sv.microsoft", "sv.lucene", "ta.microsoft", "te.microsoft", "th.microsoft", + "th.lucene", "tr.microsoft", "tr.lucene", "uk.microsoft", "ur.microsoft", "vi.microsoft", + "standard.lucene", "standardasciifolding.lucene", "keyword", "pattern", "simple", "stop", and + "whitespace". + :vartype analyzer: Union[str, "LexicalAnalyzerName"] + :ivar tokenizer: The name of the tokenizer to use to break the given text. If this parameter is + not specified, you must specify an analyzer instead. The tokenizer and analyzer parameters are + mutually exclusive. Known values are: "classic", "edgeNGram", "keyword_v2", "letter", + "lowercase", "microsoft_language_tokenizer", "microsoft_language_stemming_tokenizer", "nGram", + "path_hierarchy_v2", "pattern", "standard_v2", "uax_url_email", and "whitespace". + :vartype tokenizer: Union[str, "LexicalTokenizerName"] + :ivar normalizer: The name of the normalizer to use to normalize the given text. Known values + are: "asciifolding", "elision", "lowercase", "standard", and "uppercase". + :vartype normalizer: Union[str, "LexicalNormalizerName"] + :ivar tokenFilters: An optional list of token filters to use when breaking the given text. This + parameter can only be set when using the tokenizer parameter. + :vartype tokenFilters: list[Union[str, "TokenFilterName"]] + :ivar charFilters: An optional list of character filters to use when breaking the given text. + This parameter can only be set when using the tokenizer parameter. + :vartype charFilters: list[Union[str, "CharFilterName"]] + """ + + text: Required[str] + """The text to break into tokens. Required.""" + analyzer: Union[str, "LexicalAnalyzerName"] + """The name of the analyzer to use to break the given text. If this parameter is not specified, + you must specify a tokenizer instead. The tokenizer and analyzer parameters are mutually + exclusive. Known values are: \"ar.microsoft\", \"ar.lucene\", \"hy.lucene\", \"bn.microsoft\", + \"eu.lucene\", \"bg.microsoft\", \"bg.lucene\", \"ca.microsoft\", \"ca.lucene\", + \"zh-Hans.microsoft\", \"zh-Hans.lucene\", \"zh-Hant.microsoft\", \"zh-Hant.lucene\", + \"hr.microsoft\", \"cs.microsoft\", \"cs.lucene\", \"da.microsoft\", \"da.lucene\", + \"nl.microsoft\", \"nl.lucene\", \"en.microsoft\", \"en.lucene\", \"et.microsoft\", + \"fi.microsoft\", \"fi.lucene\", \"fr.microsoft\", \"fr.lucene\", \"gl.lucene\", + \"de.microsoft\", \"de.lucene\", \"el.microsoft\", \"el.lucene\", \"gu.microsoft\", + \"he.microsoft\", \"hi.microsoft\", \"hi.lucene\", \"hu.microsoft\", \"hu.lucene\", + \"is.microsoft\", \"id.microsoft\", \"id.lucene\", \"ga.lucene\", \"it.microsoft\", + \"it.lucene\", \"ja.microsoft\", \"ja.lucene\", \"kn.microsoft\", \"ko.microsoft\", + \"ko.lucene\", \"lv.microsoft\", \"lv.lucene\", \"lt.microsoft\", \"ml.microsoft\", + \"ms.microsoft\", \"mr.microsoft\", \"nb.microsoft\", \"no.lucene\", \"fa.lucene\", + \"pl.microsoft\", \"pl.lucene\", \"pt-BR.microsoft\", \"pt-BR.lucene\", \"pt-PT.microsoft\", + \"pt-PT.lucene\", \"pa.microsoft\", \"ro.microsoft\", \"ro.lucene\", \"ru.microsoft\", + \"ru.lucene\", \"sr-cyrillic.microsoft\", \"sr-latin.microsoft\", \"sk.microsoft\", + \"sl.microsoft\", \"es.microsoft\", \"es.lucene\", \"sv.microsoft\", \"sv.lucene\", + \"ta.microsoft\", \"te.microsoft\", \"th.microsoft\", \"th.lucene\", \"tr.microsoft\", + \"tr.lucene\", \"uk.microsoft\", \"ur.microsoft\", \"vi.microsoft\", \"standard.lucene\", + \"standardasciifolding.lucene\", \"keyword\", \"pattern\", \"simple\", \"stop\", and + \"whitespace\".""" + tokenizer: Union[str, "LexicalTokenizerName"] + """The name of the tokenizer to use to break the given text. If this parameter is not specified, + you must specify an analyzer instead. The tokenizer and analyzer parameters are mutually + exclusive. Known values are: \"classic\", \"edgeNGram\", \"keyword_v2\", \"letter\", + \"lowercase\", \"microsoft_language_tokenizer\", \"microsoft_language_stemming_tokenizer\", + \"nGram\", \"path_hierarchy_v2\", \"pattern\", \"standard_v2\", \"uax_url_email\", and + \"whitespace\".""" + normalizer: Union[str, "LexicalNormalizerName"] + """The name of the normalizer to use to normalize the given text. Known values are: + \"asciifolding\", \"elision\", \"lowercase\", \"standard\", and \"uppercase\".""" + tokenFilters: list[Union[str, "TokenFilterName"]] + """An optional list of token filters to use when breaking the given text. This parameter can only + be set when using the tokenizer parameter.""" + charFilters: list[Union[str, "CharFilterName"]] + """An optional list of character filters to use when breaking the given text. This parameter can + only be set when using the tokenizer parameter.""" + + +AsciiFoldingTokenFilter = TypedDict( + "AsciiFoldingTokenFilter", + { + "name": Required[str], + "preserveOriginal": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.AsciiFoldingTokenFilter"]], + }, + total=False, +) +AsciiFoldingTokenFilter.__doc__ = """Converts alphabetic, numeric, and symbolic Unicode characters which are not in the first 127 +ASCII characters (the "Basic Latin" Unicode block) into their ASCII equivalents, if such +equivalents exist. This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 preserveOriginal: A value indicating whether the original token will be kept. Default is + false. +:vartype preserveOriginal: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.AsciiFoldingTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.AsciiFoldingTokenFilter"] +""" + + +class AzureActiveDirectoryApplicationCredentials(TypedDict, total=False): # pylint: disable=name-too-long + """Credentials of a registered application created for your search service, used for authenticated + access to the encryption keys stored in Azure Key Vault. + + :ivar applicationId: An AAD Application ID that was granted the required access permissions to + the Azure Key Vault that is to be used when encrypting your data at rest. The Application ID + should not be confused with the Object ID for your AAD Application. Required. + :vartype applicationId: str + :ivar applicationSecret: The authentication key of the specified AAD application. + :vartype applicationSecret: str + """ + + applicationId: Required[str] + """An AAD Application ID that was granted the required access permissions to the Azure Key Vault + that is to be used when encrypting your data at rest. The Application ID should not be confused + with the Object ID for your AAD Application. Required.""" + applicationSecret: str + """The authentication key of the specified AAD application.""" + + +AzureBlobKnowledgeSource = TypedDict( + "AzureBlobKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.AZURE_BLOB]], + "azureBlobParameters": Required["AzureBlobKnowledgeSourceParameters"], + }, + total=False, +) +AzureBlobKnowledgeSource.__doc__ = """Configuration for Azure Blob Storage knowledge source. + +:ivar name: The name of the knowledge source. Required. +:vartype name: str +:ivar description: Optional user-defined description. +:vartype description: str +:ivar resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: Required. A knowledge source that read and ingest data from Azure Blob Storage to a + Search Index. +:vartype kind: Literal[KnowledgeSourceKind.AZURE_BLOB] +:ivar azureBlobParameters: The type of the knowledge source. Required. +:vartype azureBlobParameters: "AzureBlobKnowledgeSourceParameters" +""" + + +class AzureBlobKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for Azure Blob Storage knowledge source. + + :ivar connectionString: Key-based connection string or the ResourceId format if using a managed + identity. Required. + :vartype connectionString: str + :ivar containerName: The name of the blob storage container. Required. + :vartype containerName: str + :ivar folderPath: Optional folder path within the container. + :vartype folderPath: str + :ivar isADLSGen2: Set to true if connecting to an ADLS Gen2 storage account. Default is false. + :vartype isADLSGen2: bool + :ivar ingestionParameters: Consolidates all general ingestion settings. + :vartype ingestionParameters: "KnowledgeSourceIngestionParameters" + :ivar queryHints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype queryHints: "SearchIndexKnowledgeSourceQueryHints" + :ivar createdResources: Resources created by the knowledge source. + :vartype createdResources: "CreatedResources" + """ + + connectionString: Required[str] + """Key-based connection string or the ResourceId format if using a managed identity. Required.""" + containerName: Required[str] + """The name of the blob storage container. Required.""" + folderPath: Optional[str] + """Optional folder path within the container.""" + isADLSGen2: bool + """Set to true if connecting to an ADLS Gen2 storage account. Default is false.""" + ingestionParameters: Optional["KnowledgeSourceIngestionParameters"] + """Consolidates all general ingestion settings.""" + queryHints: "SearchIndexKnowledgeSourceQueryHints" + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" + createdResources: "CreatedResources" + """Resources created by the knowledge source.""" + + +class AzureMachineLearningParameters(TypedDict, total=False): + """Specifies the properties for connecting to an AML vectorizer. + + :ivar 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. Required. + :vartype uri: str + :ivar key: (Required for key authentication) The key for the AML service. + :vartype key: str + :ivar resourceId: (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 resourceId: str + :ivar timeout: (Optional) When specified, indicates the timeout for the http client making the + API call. + :vartype timeout: str + :ivar region: (Optional for token authentication). The region the AML service is deployed in. + :vartype region: str + :ivar modelName: The name of the embedding model from the Azure AI Foundry Catalog that is + deployed at the provided endpoint. Known values are: + "OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32", + "OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336", + "Facebook-DinoV2-Image-Embeddings-ViT-Base", "Facebook-DinoV2-Image-Embeddings-ViT-Giant", + "Cohere-embed-v3-english", "Cohere-embed-v3-multilingual", and "Cohere-embed-v4". + :vartype modelName: Union[str, "AIFoundryModelCatalogName"] + """ + + uri: Required[Optional[str]] + """(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. Required.""" + key: Optional[str] + """(Required for key authentication) The key for the AML service.""" + resourceId: Optional[str] + """(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[str] + """(Optional) When specified, indicates the timeout for the http client making the API call.""" + region: Optional[str] + """(Optional for token authentication). The region the AML service is deployed in.""" + modelName: Union[str, "AIFoundryModelCatalogName"] + """The name of the embedding model from the Azure AI Foundry Catalog that is deployed at the + provided endpoint. Known values are: \"OpenAI-CLIP-Image-Text-Embeddings-vit-base-patch32\", + \"OpenAI-CLIP-Image-Text-Embeddings-ViT-Large-Patch14-336\", + \"Facebook-DinoV2-Image-Embeddings-ViT-Base\", \"Facebook-DinoV2-Image-Embeddings-ViT-Giant\", + \"Cohere-embed-v3-english\", \"Cohere-embed-v3-multilingual\", and \"Cohere-embed-v4\".""" + + +AzureMachineLearningSkill = TypedDict( + "AzureMachineLearningSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "uri": Optional[str], + "key": Optional[str], + "resourceId": Optional[str], + "timeout": Optional[str], + "region": Optional[str], + "degreeOfParallelism": Optional[int], + "@odata.type": Required[Literal["#Microsoft.Skills.Custom.AmlSkill"]], + }, + total=False, +) +AzureMachineLearningSkill.__doc__ = """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, + 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["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["OutputFieldMappingEntry"] +:ivar 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 uri: str +:ivar key: (Required for key authentication) The key for the AML service. +:vartype key: str +:ivar resourceId: (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 resourceId: str +:ivar timeout: (Optional) When specified, indicates the timeout for the http client making the + API call. +:vartype timeout: str +:ivar region: (Optional for token authentication). The region the AML service is deployed in. +:vartype region: str +:ivar degreeOfParallelism: (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 degreeOfParallelism: int +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Custom.AmlSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Custom.AmlSkill"] +""" + + +class AzureMachineLearningVectorizer(TypedDict, total=False): + """Specifies an Azure Machine Learning endpoint deployed via the Azure AI Foundry Model Catalog + for generating the vector embedding of a query string. + + :ivar name: The name to associate with this particular vectorization method. Required. + :vartype name: str + :ivar amlParameters: Specifies the properties of the AML vectorizer. + :vartype amlParameters: "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: Literal[VectorSearchVectorizerKind.AML] + """ + + name: Required[str] + """The name to associate with this particular vectorization method. Required.""" + amlParameters: "AzureMachineLearningParameters" + """Specifies the properties of the AML vectorizer.""" + kind: Required[Literal[VectorSearchVectorizerKind.AML]] + """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.""" + + +AzureOpenAIEmbeddingSkill = TypedDict( + "AzureOpenAIEmbeddingSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "resourceUri": str, + "deploymentId": str, + "apiKey": str, + "authIdentity": "SearchIndexerDataIdentity", + "modelName": Union[str, "AzureOpenAIModelName"], + "dimensions": Optional[int], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill"]], + }, + total=False, +) +AzureOpenAIEmbeddingSkill.__doc__ = """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["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["OutputFieldMappingEntry"] +:ivar resourceUri: The resource URI of the Azure OpenAI resource. +:vartype resourceUri: str +:ivar deploymentId: ID of the Azure OpenAI model deployment on the designated resource. +:vartype deploymentId: str +:ivar apiKey: API key of the designated Azure OpenAI resource. +:vartype apiKey: str +:ivar authIdentity: The user-assigned managed identity used for outbound connections. +:vartype authIdentity: "SearchIndexerDataIdentity" +:ivar modelName: 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", + "gpt-5.4-nano", "gpt-5.5", "gpt-5.6-sol", "gpt-5.6-terra", and "gpt-5.6-luna". +:vartype modelName: Union[str, "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``: Literal["#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill"] +""" + + +class AzureOpenAITokenizerParameters(TypedDict, total=False): + """Azure OpenAI Tokenizer parameters. + + :ivar encoderModelName: 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 encoderModelName: Union[str, "SplitSkillEncoderModelName"] + :ivar allowedSpecialTokens: (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 allowedSpecialTokens: list[str] + """ + + encoderModelName: Optional[Union[str, "SplitSkillEncoderModelName"]] + """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\".""" + allowedSpecialTokens: list[str] + """(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.""" + + +class AzureOpenAIVectorizer(TypedDict, total=False): + """Specifies the Azure OpenAI resource used to vectorize a query string. + + :ivar name: The name to associate with this particular vectorization method. Required. + :vartype name: str + :ivar azureOpenAIParameters: Contains the parameters specific to Azure OpenAI embedding + vectorization. + :vartype azureOpenAIParameters: "AzureOpenAIVectorizerParameters" + :ivar kind: The name of the kind of vectorization method being configured for use with vector + search. Required. Generate embeddings using an Azure OpenAI resource at query time. + :vartype kind: Literal[VectorSearchVectorizerKind.AZURE_OPEN_AI] + """ + + name: Required[str] + """The name to associate with this particular vectorization method. Required.""" + azureOpenAIParameters: "AzureOpenAIVectorizerParameters" + """Contains the parameters specific to Azure OpenAI embedding vectorization.""" + kind: Required[Literal[VectorSearchVectorizerKind.AZURE_OPEN_AI]] + """The name of the kind of vectorization method being configured for use with vector search. + Required. Generate embeddings using an Azure OpenAI resource at query time.""" + + +class AzureOpenAIVectorizerParameters(TypedDict, total=False): + """Specifies the parameters for connecting to the Azure OpenAI resource. + + :ivar resourceUri: The resource URI of the Azure OpenAI resource. + :vartype resourceUri: str + :ivar deploymentId: ID of the Azure OpenAI model deployment on the designated resource. + :vartype deploymentId: str + :ivar apiKey: API key of the designated Azure OpenAI resource. + :vartype apiKey: str + :ivar authIdentity: The user-assigned managed identity used for outbound connections. + :vartype authIdentity: "SearchIndexerDataIdentity" + :ivar modelName: 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", + "gpt-5.4-nano", "gpt-5.5", "gpt-5.6-sol", "gpt-5.6-terra", and "gpt-5.6-luna". + :vartype modelName: Union[str, "AzureOpenAIModelName"] + """ + + resourceUri: str + """The resource URI of the Azure OpenAI resource.""" + deploymentId: str + """ID of the Azure OpenAI model deployment on the designated resource.""" + apiKey: str + """API key of the designated Azure OpenAI resource.""" + authIdentity: "SearchIndexerDataIdentity" + """The user-assigned managed identity used for outbound connections.""" + modelName: Union[str, "AzureOpenAIModelName"] + """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\", + \"gpt-5.4-nano\", \"gpt-5.5\", \"gpt-5.6-sol\", \"gpt-5.6-terra\", and \"gpt-5.6-luna\".""" + + +class BinaryQuantizationCompression(TypedDict, total=False): + """Contains configuration options specific to the binary quantization compression method used + during indexing and querying. + + :ivar name: The name to associate with this particular configuration. Required. + :vartype name: str + :ivar rescoringOptions: Contains the options for rescoring. + :vartype rescoringOptions: "RescoringOptions" + :ivar truncationDimension: The number of dimensions to truncate the vectors to. Truncating the + vectors reduces the size of the vectors and the amount of data that needs to be transferred + during search. This can save storage cost and improve search performance at the expense of + recall. It should be only used for embeddings trained with Matryoshka Representation Learning + (MRL) such as OpenAI text-embedding-3-large (small). The default value is null, which means no + truncation. + :vartype truncationDimension: int + :ivar kind: The name of the kind of compression method being configured for use with vector + search. Required. Binary Quantization, a type of compression method. In binary quantization, + the original vectors values are compressed to the narrower binary type by discretizing and + representing each component of a vector using binary values, thereby reducing the overall data + size. + :vartype kind: Literal[VectorSearchCompressionKind.BINARY_QUANTIZATION] + """ + + name: Required[str] + """The name to associate with this particular configuration. Required.""" + rescoringOptions: Optional["RescoringOptions"] + """Contains the options for rescoring.""" + truncationDimension: Optional[int] + """The number of dimensions to truncate the vectors to. Truncating the vectors reduces the size of + the vectors and the amount of data that needs to be transferred during search. This can save + storage cost and improve search performance at the expense of recall. It should be only used + for embeddings trained with Matryoshka Representation Learning (MRL) such as OpenAI + text-embedding-3-large (small). The default value is null, which means no truncation.""" + kind: Required[Literal[VectorSearchCompressionKind.BINARY_QUANTIZATION]] + """The name of the kind of compression method being configured for use with vector search. + Required. Binary Quantization, a type of compression method. In binary quantization, the + original vectors values are compressed to the narrower binary type by discretizing and + representing each component of a vector using binary values, thereby reducing the overall data + size.""" + + +BM25SimilarityAlgorithm = TypedDict( + "BM25SimilarityAlgorithm", + { + "k1": Optional[float], + "b": Optional[float], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.BM25Similarity"]], + }, + total=False, +) +BM25SimilarityAlgorithm.__doc__ = """Ranking function based on the Okapi BM25 similarity algorithm. BM25 is a TF-IDF-like algorithm +that includes length normalization (controlled by the 'b' parameter) as well as term frequency +saturation (controlled by the 'k1' parameter). + +:ivar k1: This property controls the scaling function between the term frequency of each + matching terms and the final relevance score of a document-query pair. By default, a value of + 1.2 is used. A value of 0.0 means the score does not scale with an increase in term frequency. +:vartype k1: float +:ivar b: This property controls how the length of a document affects the relevance score. By + default, a value of 0.75 is used. A value of 0.0 means no length normalization is applied, + while a value of 1.0 means the score is fully normalized by the length of the document. +:vartype b: float +:ivar ``@odata.type``: The discriminator for derived types. Required. Default value is + "#Microsoft.Azure.Search.BM25Similarity". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.BM25Similarity"] +""" + + +class ChatCompletionCommonModelParameters(TypedDict, total=False): + """Common language model parameters for Chat Completions. If omitted, default values are used. + + :ivar model: The name of the model to use (e.g., 'gpt-4o', etc.). Default is null if not + specified. + :vartype model: str + :ivar frequencyPenalty: A float in the range [-2,2] that reduces or increases likelihood of + repeated tokens. Default is 0. + :vartype frequencyPenalty: float + :ivar presencePenalty: A float in the range [-2,2] that penalizes new tokens based on their + existing presence. Default is 0. + :vartype presencePenalty: float + :ivar maxTokens: Maximum number of tokens to generate. + :vartype maxTokens: int + :ivar temperature: Sampling temperature. Default is 0.7. + :vartype temperature: float + :ivar seed: Random seed for controlling deterministic outputs. If omitted, randomization is + used. + :vartype seed: int + :ivar stop: List of stop sequences that will cut off text generation. Default is none. + :vartype stop: list[str] + """ + + model: Optional[str] + """The name of the model to use (e.g., 'gpt-4o', etc.). Default is null if not specified.""" + frequencyPenalty: Optional[float] + """A float in the range [-2,2] that reduces or increases likelihood of repeated tokens. Default is + 0.""" + presencePenalty: Optional[float] + """A float in the range [-2,2] that penalizes new tokens based on their existing presence. Default + is 0.""" + maxTokens: Optional[int] + """Maximum number of tokens to generate.""" + temperature: Optional[float] + """Sampling temperature. Default is 0.7.""" + seed: Optional[int] + """Random seed for controlling deterministic outputs. If omitted, randomization is used.""" + stop: Optional[list[str]] + """List of stop sequences that will cut off text generation. Default is none.""" + + +class ChatCompletionResponseFormat(TypedDict, total=False): + """Determines how the language model's response should be serialized. Defaults to 'text'. + + :ivar type: Specifies how the LLM should format the response. Known values are: "text", + "jsonObject", and "jsonSchema". + :vartype type: Union[str, "ChatCompletionResponseFormatType"] + :ivar jsonSchemaProperties: An open dictionary for extended properties. Required if 'type' == + 'json_schema'. + :vartype jsonSchemaProperties: "ChatCompletionSchemaProperties" + """ + + type: Union[str, "ChatCompletionResponseFormatType"] + """Specifies how the LLM should format the response. Known values are: \"text\", \"jsonObject\", + and \"jsonSchema\".""" + jsonSchemaProperties: Optional["ChatCompletionSchemaProperties"] + """An open dictionary for extended properties. Required if 'type' == 'json_schema'.""" + + +class ChatCompletionSchema(TypedDict, total=False): + """Object defining the custom schema the model will use to structure its output. + + :ivar type: Type of schema representation. Usually 'object'. Default is 'object'. + :vartype type: str + :ivar properties: A JSON-formatted string that defines the output schema's properties and + constraints for the model. + :vartype properties: str + :ivar required: An array of the property names that are required to be part of the model's + response. All properties must be included for structured outputs. + :vartype required: list[str] + :ivar additionalProperties: Controls whether it is allowable for an object to contain + additional keys / values that were not defined in the JSON Schema. Default is false. + :vartype additionalProperties: bool + """ + + type: str + """Type of schema representation. Usually 'object'. Default is 'object'.""" + properties: str + """A JSON-formatted string that defines the output schema's properties and constraints for the + model.""" + required: list[str] + """An array of the property names that are required to be part of the model's response. All + properties must be included for structured outputs.""" + additionalProperties: bool + """Controls whether it is allowable for an object to contain additional keys / values that were + not defined in the JSON Schema. Default is false.""" + + +class ChatCompletionSchemaProperties(TypedDict, total=False): + """Properties for JSON schema response format. + + :ivar name: Name of the json schema the model will adhere to. + :vartype name: str + :ivar description: Description of the json schema the model will adhere to. + :vartype description: str + :ivar strict: Whether or not the model's response should use structured outputs. Default is + true. + :vartype strict: bool + :ivar schema: The schema definition. + :vartype schema: "ChatCompletionSchema" + """ + + name: Optional[str] + """Name of the json schema the model will adhere to.""" + description: Optional[str] + """Description of the json schema the model will adhere to.""" + strict: bool + """Whether or not the model's response should use structured outputs. Default is true.""" + schema: "ChatCompletionSchema" + """The schema definition.""" + + +ChatCompletionSkill = TypedDict( + "ChatCompletionSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "uri": Required[str], + "authIdentity": Optional["SearchIndexerDataIdentity"], + "apiKey": str, + "commonModelParameters": "ChatCompletionCommonModelParameters", + "extraParameters": Optional[dict[str, Any]], + "extraParametersBehavior": Union[str, "ChatCompletionExtraParametersBehavior"], + "responseFormat": "ChatCompletionResponseFormat", + "@odata.type": Required[Literal["#Microsoft.Skills.Custom.ChatCompletionSkill"]], + }, + total=False, +) +ChatCompletionSkill.__doc__ = """A skill that calls a language model via Azure AI Foundry's Chat Completions endpoint. + +: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["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["OutputFieldMappingEntry"] +:ivar uri: The url for the Web API. Required. +:vartype uri: str +:ivar authIdentity: 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 indexer, if the identity is unspecified, the value remains unchanged. + If set to "none", the value of this property is cleared. +:vartype authIdentity: "SearchIndexerDataIdentity" +:ivar apiKey: API key for authenticating to the model. Both apiKey and authIdentity cannot be + specified at the same time. +:vartype apiKey: str +:ivar commonModelParameters: Common language model parameters that customers can tweak. If + omitted, reasonable defaults will be applied. +:vartype commonModelParameters: "ChatCompletionCommonModelParameters" +:ivar extraParameters: Open-type dictionary for model-specific parameters that should be + appended to the chat completions call. Follows Azure AI Foundry's extensibility pattern. +:vartype extraParameters: dict[str, Any] +:ivar extraParametersBehavior: How extra parameters are handled by Azure AI Foundry. Default is + 'error'. Known values are: "passThrough", "drop", and "error". +:vartype extraParametersBehavior: Union[str, "ChatCompletionExtraParametersBehavior"] +:ivar responseFormat: Determines how the LLM should format its response. Defaults to 'text' + response type. +:vartype responseFormat: "ChatCompletionResponseFormat" +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Custom.ChatCompletionSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Custom.ChatCompletionSkill"] +""" + + +CjkBigramTokenFilter = TypedDict( + "CjkBigramTokenFilter", + { + "name": Required[str], + "ignoreScripts": list[Union[str, "CjkBigramTokenFilterScripts"]], + "outputUnigrams": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.CjkBigramTokenFilter"]], + }, + total=False, +) +CjkBigramTokenFilter.__doc__ = """Forms bigrams of CJK terms that are generated from the standard tokenizer. This token filter is +implemented using Apache Lucene. + +:ivar name: The name of the token 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 ignoreScripts: The scripts to ignore. +:vartype ignoreScripts: list[Union[str, "CjkBigramTokenFilterScripts"]] +:ivar outputUnigrams: A value indicating whether to output both unigrams and bigrams (if true), + or just bigrams (if false). Default is false. +:vartype outputUnigrams: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.CjkBigramTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.CjkBigramTokenFilter"] +""" + + +ClassicSimilarityAlgorithm = TypedDict( + "ClassicSimilarityAlgorithm", + { + "@odata.type": Required[Literal["#Microsoft.Azure.Search.ClassicSimilarity"]], + }, + total=False, +) +ClassicSimilarityAlgorithm.__doc__ = """Legacy similarity algorithm which uses the Lucene TFIDFSimilarity implementation of TF-IDF. +This variation of TF-IDF introduces static document length normalization as well as +coordinating factors that penalize documents that only partially match the searched queries. + +:ivar ``@odata.type``: The discriminator for derived types. Required. Default value is + "#Microsoft.Azure.Search.ClassicSimilarity". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.ClassicSimilarity"] +""" + + +ClassicTokenizer = TypedDict( + "ClassicTokenizer", + { + "name": Required[str], + "maxTokenLength": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.ClassicTokenizer"]], + }, + total=False, +) +ClassicTokenizer.__doc__ = """Grammar-based tokenizer that is suitable for processing most European-language documents. 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 maxTokenLength: 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 maxTokenLength: int +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.ClassicTokenizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.ClassicTokenizer"] +""" + + +CognitiveServicesAccountKey = TypedDict( + "CognitiveServicesAccountKey", + { + "description": str, + "key": Required[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.CognitiveServicesByKey"]], + }, + total=False, +) +CognitiveServicesAccountKey.__doc__ = """The multi-region account key of an Azure AI service resource that's attached to a skillset. + +:ivar description: Description of the Azure AI service resource attached to a skillset. +:vartype description: str +:ivar key: The key used to provision the Azure AI service resource attached to a skillset. + Required. +:vartype key: str +:ivar ``@odata.type``: A URI fragment specifying the type of Azure AI service resource attached + to a skillset. Required. Default value is "#Microsoft.Azure.Search.CognitiveServicesByKey". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.CognitiveServicesByKey"] +""" + + +CommonGramTokenFilter = TypedDict( + "CommonGramTokenFilter", + { + "name": Required[str], + "commonWords": Required[list[str]], + "ignoreCase": bool, + "queryMode": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.CommonGramTokenFilter"]], + }, + total=False, +) +CommonGramTokenFilter.__doc__ = """Construct bigrams for frequently occurring terms while indexing. Single terms are still indexed +too, with bigrams overlaid. This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 commonWords: The set of common words. Required. +:vartype commonWords: list[str] +:ivar ignoreCase: A value indicating whether common words matching will be case insensitive. + Default is false. +:vartype ignoreCase: bool +:ivar queryMode: A value that indicates whether the token filter is in query mode. When in + query mode, the token filter generates bigrams and then removes common words and single terms + followed by a common word. Default is false. +:vartype queryMode: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.CommonGramTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.CommonGramTokenFilter"] +""" + + +ConditionalSkill = TypedDict( + "ConditionalSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "@odata.type": Required[Literal["#Microsoft.Skills.Util.ConditionalSkill"]], + }, + total=False, +) +ConditionalSkill.__doc__ = """A skill that enables scenarios that require a Boolean operation to determine the data to assign +to an output. + +: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["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["OutputFieldMappingEntry"] +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Util.ConditionalSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Util.ConditionalSkill"] +""" + + +class ContentColumnMapping(TypedDict, total=False): + """Maps a SQL column to a search index field. + + :ivar name: Target index field name. Required. + :vartype name: str + :ivar sourceField: SQL column name. Required. + :vartype sourceField: str + :ivar searchFieldType: Azure AI Search field type (e.g., Edm.String, Edm.Int32). Required. + :vartype searchFieldType: str + """ + + name: Required[str] + """Target index field name. Required.""" + sourceField: Required[str] + """SQL column name. Required.""" + searchFieldType: Required[str] + """Azure AI Search field type (e.g., Edm.String, Edm.Int32). Required.""" + + +ContentUnderstandingSkill = TypedDict( + "ContentUnderstandingSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "extractionOptions": Optional[list[Union[str, "ContentUnderstandingSkillExtractionOptions"]]], + "chunkingProperties": Optional["ContentUnderstandingSkillChunkingProperties"], + "@odata.type": Required[Literal["#Microsoft.Skills.Util.ContentUnderstandingSkill"]], + }, + total=False, +) +ContentUnderstandingSkill.__doc__ = """A skill that leverages Azure AI Content Understanding to process and extract structured +insights from documents, enabling enriched, searchable content for enhanced document indexing +and retrieval. + +: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["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["OutputFieldMappingEntry"] +:ivar extractionOptions: Controls the cardinality of the content extracted from the document by + the skill. +:vartype extractionOptions: list[Union[str, "ContentUnderstandingSkillExtractionOptions"]] +:ivar chunkingProperties: Controls the cardinality for chunking the content. +:vartype chunkingProperties: "ContentUnderstandingSkillChunkingProperties" +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Util.ContentUnderstandingSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Util.ContentUnderstandingSkill"] +""" + + +class ContentUnderstandingSkillChunkingProperties(TypedDict, total=False): # pylint: disable=name-too-long + """Controls the cardinality for chunking the content. + + :ivar method: The chunking strategy. 'fixedSize' (default) or 'semantic'. Known values are: + "fixedSize" and "semantic". + :vartype method: Union[str, "ContentUnderstandingSkillChunkingMethod"] + :ivar unit: The unit of the chunk. Known values are: "characters" and "tokens". + :vartype unit: Union[str, "ContentUnderstandingSkillChunkingUnit"] + :ivar maximumLength: The maximum chunk length in characters. Default is 500. + :vartype maximumLength: int + :ivar overlapLength: The length of overlap provided between two text chunks. Default is 0. + :vartype overlapLength: int + """ + + method: Union[str, "ContentUnderstandingSkillChunkingMethod"] + """The chunking strategy. 'fixedSize' (default) or 'semantic'. Known values are: \"fixedSize\" and + \"semantic\".""" + unit: Optional[Union[str, "ContentUnderstandingSkillChunkingUnit"]] + """The unit of the chunk. Known values are: \"characters\" and \"tokens\".""" + maximumLength: Optional[int] + """The maximum chunk length in characters. Default is 500.""" + overlapLength: Optional[int] + """The length of overlap provided between two text chunks. Default is 0.""" + + +class CorsOptions(TypedDict, total=False): + """Defines options to control Cross-Origin Resource Sharing (CORS) for an index. + + :ivar allowedOrigins: The list of origins from which JavaScript code will be granted access to + your index. Can contain a list of hosts of the form + {protocol}://{fully-qualified-domain-name}[:{port#}], or a single '*' to allow all origins (not + recommended). Required. + :vartype allowedOrigins: list[str] + :ivar maxAgeInSeconds: The duration for which browsers should cache CORS preflight responses. + Defaults to 5 minutes. + :vartype maxAgeInSeconds: int + """ + + allowedOrigins: Required[list[str]] + """The list of origins from which JavaScript code will be granted access to your index. Can + contain a list of hosts of the form {protocol}://{fully-qualified-domain-name}[:{port#}], or a + single '*' to allow all origins (not recommended). Required.""" + maxAgeInSeconds: Optional[int] + """The duration for which browsers should cache CORS preflight responses. Defaults to 5 minutes.""" + + +class CreatedResources(TypedDict, total=False): + """Resources created by the knowledge source. Keys represent resource types (e.g., 'datasource', + 'indexer', 'skillset', 'index') and values represent resource names. + + """ + + +CustomAnalyzer = TypedDict( + "CustomAnalyzer", + { + "name": Required[str], + "tokenizer": Required[Union[str, "LexicalTokenizerName"]], + "tokenFilters": list[Union[str, "TokenFilterName"]], + "charFilters": list[Union[str, "CharFilterName"]], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.CustomAnalyzer"]], + }, + total=False, +) +CustomAnalyzer.__doc__ = """Allows you to take control over the process of converting text into indexable/searchable +tokens. It's a user-defined configuration consisting of a single predefined tokenizer and one +or more filters. The tokenizer is responsible for breaking text into tokens, and the filters +for modifying tokens emitted by the tokenizer. + +:ivar name: The name of the analyzer. 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 tokenizer: The name of the tokenizer to use to divide continuous text into a sequence of + tokens, such as breaking a sentence into words. Required. Known values are: "classic", + "edgeNGram", "keyword_v2", "letter", "lowercase", "microsoft_language_tokenizer", + "microsoft_language_stemming_tokenizer", "nGram", "path_hierarchy_v2", "pattern", + "standard_v2", "uax_url_email", and "whitespace". +:vartype tokenizer: Union[str, "LexicalTokenizerName"] +:ivar tokenFilters: A list of token filters used to filter out or modify the tokens generated + by a tokenizer. For example, you can specify a lowercase filter that converts all characters to + lowercase. The filters are run in the order in which they are listed. +:vartype tokenFilters: list[Union[str, "TokenFilterName"]] +:ivar charFilters: A list of character filters used to prepare input text before it is + processed by the tokenizer. For instance, they can replace certain characters or symbols. The + filters are run in the order in which they are listed. +:vartype charFilters: list[Union[str, "CharFilterName"]] +:ivar ``@odata.type``: A URI fragment specifying the type of analyzer. Required. Default value + is "#Microsoft.Azure.Search.CustomAnalyzer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.CustomAnalyzer"] +""" + + +class CustomEntity(TypedDict, total=False): + """An object that contains information about the matches that were found, and related metadata. + + :ivar name: The top-level entity descriptor. Matches in the skill output will be grouped by + this name, and it should represent the "normalized" form of the text being found. Required. + :vartype name: str + :ivar description: This field can be used as a passthrough for custom metadata about the + matched text(s). The value of this field will appear with every match of its entity in the + skill output. + :vartype description: str + :ivar type: This field can be used as a passthrough for custom metadata about the matched + text(s). The value of this field will appear with every match of its entity in the skill + output. + :vartype type: str + :ivar subtype: This field can be used as a passthrough for custom metadata about the matched + text(s). The value of this field will appear with every match of its entity in the skill + output. + :vartype subtype: str + :ivar id: This field can be used as a passthrough for custom metadata about the matched + text(s). The value of this field will appear with every match of its entity in the skill + output. + :vartype id: str + :ivar caseSensitive: Defaults to false. Boolean value denoting whether comparisons with the + entity name should be sensitive to character casing. Sample case insensitive matches of + "Microsoft" could be: microsoft, microSoft, MICROSOFT. + :vartype caseSensitive: bool + :ivar accentSensitive: Defaults to false. Boolean value denoting whether comparisons with the + entity name should be sensitive to accent. + :vartype accentSensitive: bool + :ivar fuzzyEditDistance: Defaults to 0. Maximum value of 5. Denotes the acceptable number of + divergent characters that would still constitute a match with the entity name. The smallest + possible fuzziness for any given match is returned. For instance, if the edit distance is set + to 3, "Windows10" would still match "Windows", "Windows10" and "Windows 7". When case + sensitivity is set to false, case differences do NOT count towards fuzziness tolerance, but + otherwise do. + :vartype fuzzyEditDistance: int + :ivar defaultCaseSensitive: Changes the default case sensitivity value for this entity. It be + used to change the default value of all aliases caseSensitive values. + :vartype defaultCaseSensitive: bool + :ivar defaultAccentSensitive: Changes the default accent sensitivity value for this entity. It + be used to change the default value of all aliases accentSensitive values. + :vartype defaultAccentSensitive: bool + :ivar defaultFuzzyEditDistance: Changes the default fuzzy edit distance value for this entity. + It can be used to change the default value of all aliases fuzzyEditDistance values. + :vartype defaultFuzzyEditDistance: int + :ivar aliases: An array of complex objects that can be used to specify alternative spellings or + synonyms to the root entity name. + :vartype aliases: list["CustomEntityAlias"] + """ + + name: Required[str] + """The top-level entity descriptor. Matches in the skill output will be grouped by this name, and + it should represent the \"normalized\" form of the text being found. Required.""" + description: Optional[str] + """This field can be used as a passthrough for custom metadata about the matched text(s). The + value of this field will appear with every match of its entity in the skill output.""" + type: Optional[str] + """This field can be used as a passthrough for custom metadata about the matched text(s). The + value of this field will appear with every match of its entity in the skill output.""" + subtype: Optional[str] + """This field can be used as a passthrough for custom metadata about the matched text(s). The + value of this field will appear with every match of its entity in the skill output.""" + id: Optional[str] + """This field can be used as a passthrough for custom metadata about the matched text(s). The + value of this field will appear with every match of its entity in the skill output.""" + caseSensitive: Optional[bool] + """Defaults to false. Boolean value denoting whether comparisons with the entity name should be + sensitive to character casing. Sample case insensitive matches of \"Microsoft\" could be: + microsoft, microSoft, MICROSOFT.""" + accentSensitive: Optional[bool] + """Defaults to false. Boolean value denoting whether comparisons with the entity name should be + sensitive to accent.""" + fuzzyEditDistance: Optional[int] + """Defaults to 0. Maximum value of 5. Denotes the acceptable number of divergent characters that + would still constitute a match with the entity name. The smallest possible fuzziness for any + given match is returned. For instance, if the edit distance is set to 3, \"Windows10\" would + still match \"Windows\", \"Windows10\" and \"Windows 7\". When case sensitivity is set to + false, case differences do NOT count towards fuzziness tolerance, but otherwise do.""" + defaultCaseSensitive: Optional[bool] + """Changes the default case sensitivity value for this entity. It be used to change the default + value of all aliases caseSensitive values.""" + defaultAccentSensitive: Optional[bool] + """Changes the default accent sensitivity value for this entity. It be used to change the default + value of all aliases accentSensitive values.""" + defaultFuzzyEditDistance: Optional[int] + """Changes the default fuzzy edit distance value for this entity. It can be used to change the + default value of all aliases fuzzyEditDistance values.""" + aliases: Optional[list["CustomEntityAlias"]] + """An array of complex objects that can be used to specify alternative spellings or synonyms to + the root entity name.""" + + +class CustomEntityAlias(TypedDict, total=False): + """A complex object that can be used to specify alternative spellings or synonyms to the root + entity name. + + :ivar text: The text of the alias. Required. + :vartype text: str + :ivar caseSensitive: Determine if the alias is case sensitive. + :vartype caseSensitive: bool + :ivar accentSensitive: Determine if the alias is accent sensitive. + :vartype accentSensitive: bool + :ivar fuzzyEditDistance: Determine the fuzzy edit distance of the alias. + :vartype fuzzyEditDistance: int + """ + + text: Required[str] + """The text of the alias. Required.""" + caseSensitive: Optional[bool] + """Determine if the alias is case sensitive.""" + accentSensitive: Optional[bool] + """Determine if the alias is accent sensitive.""" + fuzzyEditDistance: Optional[int] + """Determine the fuzzy edit distance of the alias.""" + + +CustomEntityLookupSkill = TypedDict( + "CustomEntityLookupSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultLanguageCode": Optional[Union[str, "CustomEntityLookupSkillLanguage"]], + "entitiesDefinitionUri": Optional[str], + "inlineEntitiesDefinition": Optional[list["CustomEntity"]], + "globalDefaultCaseSensitive": Optional[bool], + "globalDefaultAccentSensitive": Optional[bool], + "globalDefaultFuzzyEditDistance": Optional[int], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.CustomEntityLookupSkill"]], + }, + total=False, +) +CustomEntityLookupSkill.__doc__ = """A skill looks for text from a custom, user-defined list of words and phrases. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultLanguageCode: A value indicating which language code to use. Default is ``en``. + Known values are: "da", "de", "en", "es", "fi", "fr", "it", "ko", and "pt". +:vartype defaultLanguageCode: Union[str, "CustomEntityLookupSkillLanguage"] +:ivar entitiesDefinitionUri: Path to a JSON or CSV file containing all the target text to match + against. This entity definition is read at the beginning of an indexer run. Any updates to this + file during an indexer run will not take effect until subsequent runs. This config must be + accessible over HTTPS. +:vartype entitiesDefinitionUri: str +:ivar inlineEntitiesDefinition: The inline CustomEntity definition. +:vartype inlineEntitiesDefinition: list["CustomEntity"] +:ivar globalDefaultCaseSensitive: A global flag for CaseSensitive. If CaseSensitive is not set + in CustomEntity, this value will be the default value. +:vartype globalDefaultCaseSensitive: bool +:ivar globalDefaultAccentSensitive: A global flag for AccentSensitive. If AccentSensitive is + not set in CustomEntity, this value will be the default value. +:vartype globalDefaultAccentSensitive: bool +:ivar globalDefaultFuzzyEditDistance: A global flag for FuzzyEditDistance. If FuzzyEditDistance + is not set in CustomEntity, this value will be the default value. +:vartype globalDefaultFuzzyEditDistance: int +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.CustomEntityLookupSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.CustomEntityLookupSkill"] +""" + + +CustomNormalizer = TypedDict( + "CustomNormalizer", + { + "name": Required[str], + "tokenFilters": list[Union[str, "TokenFilterName"]], + "charFilters": list[Union[str, "CharFilterName"]], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.CustomNormalizer"]], + }, + total=False, +) +CustomNormalizer.__doc__ = """Allows you to configure normalization for filterable, sortable, and facetable fields, which by +default operate with strict matching. This is a user-defined configuration consisting of at +least one or more filters, which modify the token that is stored. + +: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 tokenFilters: A list of token filters used to filter out or modify the input token. For + example, you can specify a lowercase filter that converts all characters to lowercase. The + filters are run in the order in which they are listed. +:vartype tokenFilters: list[Union[str, "TokenFilterName"]] +:ivar charFilters: A list of character filters used to prepare input text before it is + processed. For instance, they can replace certain characters or symbols. The filters are run in + the order in which they are listed. +:vartype charFilters: list[Union[str, "CharFilterName"]] +:ivar ``@odata.type``: A URI fragment specifying the type of normalizer. Required. Default + value is "#Microsoft.Azure.Search.CustomNormalizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.CustomNormalizer"] +""" + + +class DataSourceCredentials(TypedDict, total=False): + """Represents credentials that can be used to connect to a datasource. + + :ivar connectionString: The connection string for the datasource. Set to ```` (with + brackets) if you don't want the connection string updated. Set to ```` if you want to + remove the connection string value from the datasource. + :vartype connectionString: str + """ + + connectionString: str + """The connection string for the datasource. Set to ```` (with brackets) if you don't + want the connection string updated. Set to ```` if you want to remove the connection + string value from the datasource.""" + + +DefaultCognitiveServicesAccount = TypedDict( + "DefaultCognitiveServicesAccount", + { + "description": str, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.DefaultCognitiveServices"]], + }, + total=False, +) +DefaultCognitiveServicesAccount.__doc__ = """An empty object that represents the default Azure AI service resource for a skillset. + +:ivar description: Description of the Azure AI service resource attached to a skillset. +:vartype description: str +:ivar ``@odata.type``: A URI fragment specifying the type of Azure AI service resource attached + to a skillset. Required. Default value is "#Microsoft.Azure.Search.DefaultCognitiveServices". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.DefaultCognitiveServices"] +""" + + +DictionaryDecompounderTokenFilter = TypedDict( + "DictionaryDecompounderTokenFilter", + { + "name": Required[str], + "wordList": Required[list[str]], + "minWordSize": int, + "minSubwordSize": int, + "maxSubwordSize": int, + "onlyLongestMatch": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter"]], + }, + total=False, +) +DictionaryDecompounderTokenFilter.__doc__ = """Decomposes compound words found in many Germanic languages. This token filter is implemented +using Apache Lucene. + +:ivar name: The name of the token 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 wordList: The list of words to match against. Required. +:vartype wordList: list[str] +:ivar minWordSize: The minimum word size. Only words longer than this get processed. Default is + 5. Maximum is 300. +:vartype minWordSize: int +:ivar minSubwordSize: The minimum subword size. Only subwords longer than this are outputted. + Default is 2. Maximum is 300. +:vartype minSubwordSize: int +:ivar maxSubwordSize: The maximum subword size. Only subwords shorter than this are outputted. + Default is 15. Maximum is 300. +:vartype maxSubwordSize: int +:ivar onlyLongestMatch: A value indicating whether to add only the longest matching subword to + the output. Default is false. +:vartype onlyLongestMatch: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter"] +""" + + +class DistanceScoringFunction(TypedDict, total=False): + """Defines a function that boosts scores based on distance from a geographic location. + + :ivar fieldName: The name of the field used as input to the scoring function. Required. + :vartype fieldName: 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: Union[str, "ScoringFunctionInterpolation"] + :ivar distance: Parameter values for the distance scoring function. Required. + :vartype distance: "DistanceScoringParameters" + :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 "distance". + :vartype type: Literal["distance"] + """ + + fieldName: Required[str] + """The name of the field used as input to the scoring function. Required.""" + boost: Required[float] + """A multiplier for the raw score. Must be a positive number not equal to 1.0. Required.""" + interpolation: Union[str, "ScoringFunctionInterpolation"] + """A value indicating how boosting will be interpolated across document scores; defaults to + \"Linear\". Known values are: \"linear\", \"constant\", \"quadratic\", and \"logarithmic\".""" + distance: Required["DistanceScoringParameters"] + """Parameter values for the distance scoring function. Required.""" + type: Required[Literal["distance"]] + """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 \"distance\".""" + + +class DistanceScoringParameters(TypedDict, total=False): + """Provides parameter values to a distance scoring function. + + :ivar referencePointParameter: The name of the parameter passed in search queries to specify + the reference location. Required. + :vartype referencePointParameter: str + :ivar boostingDistance: The distance in kilometers from the reference location where the + boosting range ends. Required. + :vartype boostingDistance: float + """ + + referencePointParameter: Required[str] + """The name of the parameter passed in search queries to specify the reference location. Required.""" + boostingDistance: Required[float] + """The distance in kilometers from the reference location where the boosting range ends. Required.""" + + +DocumentExtractionSkill = TypedDict( + "DocumentExtractionSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "parsingMode": Optional[str], + "dataToExtract": Optional[str], + "configuration": Optional[dict[str, Any]], + "@odata.type": Required[Literal["#Microsoft.Skills.Util.DocumentExtractionSkill"]], + }, + total=False, +) +DocumentExtractionSkill.__doc__ = """A skill that extracts content from a file within the enrichment pipeline. + +: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["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["OutputFieldMappingEntry"] +:ivar parsingMode: The parsingMode for the skill. Will be set to 'default' if not defined. +:vartype parsingMode: str +:ivar dataToExtract: The type of data to be extracted for the skill. Will be set to + 'contentAndMetadata' if not defined. +:vartype dataToExtract: str +:ivar configuration: A dictionary of configurations for the skill. +:vartype configuration: dict[str, Any] +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Util.DocumentExtractionSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Util.DocumentExtractionSkill"] +""" + + +DocumentIntelligenceLayoutSkill = TypedDict( + "DocumentIntelligenceLayoutSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "outputFormat": Optional[Union[str, "DocumentIntelligenceLayoutSkillOutputFormat"]], + "outputMode": Optional[Union[str, "DocumentIntelligenceLayoutSkillOutputMode"]], + "markdownHeaderDepth": Optional[Union[str, "DocumentIntelligenceLayoutSkillMarkdownHeaderDepth"]], + "extractionOptions": Optional[list[Union[str, "DocumentIntelligenceLayoutSkillExtractionOptions"]]], + "chunkingProperties": Optional["DocumentIntelligenceLayoutSkillChunkingProperties"], + "@odata.type": Required[Literal["#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill"]], + }, + total=False, +) +DocumentIntelligenceLayoutSkill.__doc__ = """A skill that extracts content and layout information, via Azure AI Services, from files within +the enrichment pipeline. + +: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["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["OutputFieldMappingEntry"] +:ivar outputFormat: Controls the output format. Default is 'markdown'. Known values are: "text" + and "markdown". +:vartype outputFormat: Union[str, "DocumentIntelligenceLayoutSkillOutputFormat"] +:ivar outputMode: Controls the cardinality of the output produced by the skill. Default is + 'oneToMany'. "oneToMany" +:vartype outputMode: Union[str, "DocumentIntelligenceLayoutSkillOutputMode"] +:ivar markdownHeaderDepth: The depth of headers in the markdown output. Default is h6. Known + values are: "h1", "h2", "h3", "h4", "h5", and "h6". +:vartype markdownHeaderDepth: Union[str, "DocumentIntelligenceLayoutSkillMarkdownHeaderDepth"] +:ivar extractionOptions: Controls the cardinality of the content extracted from the document by + the skill. +:vartype extractionOptions: list[Union[str, + "DocumentIntelligenceLayoutSkillExtractionOptions"]] +:ivar chunkingProperties: Controls the cardinality for chunking the content. +:vartype chunkingProperties: "DocumentIntelligenceLayoutSkillChunkingProperties" +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill"] +""" + + +class DocumentIntelligenceLayoutSkillChunkingProperties(TypedDict, total=False): # pylint: disable=name-too-long + """Controls the cardinality for chunking the content. + + :ivar unit: The unit of the chunk. "characters" + :vartype unit: Union[str, "DocumentIntelligenceLayoutSkillChunkingUnit"] + :ivar maximumLength: The maximum chunk length in characters. Default is 500. + :vartype maximumLength: int + :ivar overlapLength: The length of overlap provided between two text chunks. Default is 0. + :vartype overlapLength: int + """ + + unit: Optional[Union[str, "DocumentIntelligenceLayoutSkillChunkingUnit"]] + """The unit of the chunk. \"characters\"""" + maximumLength: Optional[int] + """The maximum chunk length in characters. Default is 500.""" + overlapLength: Optional[int] + """The length of overlap provided between two text chunks. Default is 0.""" + + +class DocumentKeysOrIds(TypedDict, total=False): + """The type of the keysOrIds. + + :ivar documentKeys: document keys to be reset. + :vartype documentKeys: list[str] + :ivar datasourceDocumentIds: datasource document identifiers to be reset. + :vartype datasourceDocumentIds: list[str] + """ + + documentKeys: list[str] + """document keys to be reset.""" + datasourceDocumentIds: list[str] + """datasource document identifiers to be reset.""" + + +EdgeNGramTokenFilter = TypedDict( + "EdgeNGramTokenFilter", + { + "name": Required[str], + "minGram": int, + "maxGram": int, + "side": Union[str, "EdgeNGramTokenFilterSide"], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.EdgeNGramTokenFilter"]], + }, + total=False, +) +EdgeNGramTokenFilter.__doc__ = """Generates n-grams of the given size(s) starting from the front or the back of an input token. +This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 minGram: The minimum n-gram length. Default is 1. Must be less than the value of maxGram. +:vartype minGram: int +:ivar maxGram: The maximum n-gram length. Default is 2. +:vartype maxGram: int +:ivar side: Specifies which side of the input the n-gram should be generated from. Default is + "front". Known values are: "front" and "back". +:vartype side: Union[str, "EdgeNGramTokenFilterSide"] +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.EdgeNGramTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.EdgeNGramTokenFilter"] +""" + + +EdgeNGramTokenFilterV2 = TypedDict( + "EdgeNGramTokenFilterV2", + { + "name": Required[str], + "minGram": int, + "maxGram": int, + "side": Union[str, "EdgeNGramTokenFilterSide"], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.EdgeNGramTokenFilterV2"]], + }, + total=False, +) +EdgeNGramTokenFilterV2.__doc__ = """Generates n-grams of the given size(s) starting from the front or the back of an input token. +This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 minGram: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the + value of maxGram. +:vartype minGram: int +:ivar maxGram: The maximum n-gram length. Default is 2. Maximum is 300. +:vartype maxGram: int +:ivar side: Specifies which side of the input the n-gram should be generated from. Default is + "front". Known values are: "front" and "back". +:vartype side: Union[str, "EdgeNGramTokenFilterSide"] +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.EdgeNGramTokenFilterV2". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.EdgeNGramTokenFilterV2"] +""" + + +EdgeNGramTokenizer = TypedDict( + "EdgeNGramTokenizer", + { + "name": Required[str], + "minGram": int, + "maxGram": int, + "tokenChars": list[Union[str, "TokenCharacterKind"]], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.EdgeNGramTokenizer"]], + }, + total=False, +) +EdgeNGramTokenizer.__doc__ = """Tokenizes the input from an edge into n-grams of the given size(s). 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 minGram: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the + value of maxGram. +:vartype minGram: int +:ivar maxGram: The maximum n-gram length. Default is 2. Maximum is 300. +:vartype maxGram: int +:ivar tokenChars: Character classes to keep in the tokens. +:vartype tokenChars: list[Union[str, "TokenCharacterKind"]] +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.EdgeNGramTokenizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.EdgeNGramTokenizer"] +""" + + +ElisionTokenFilter = TypedDict( + "ElisionTokenFilter", + { + "name": Required[str], + "articles": list[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.ElisionTokenFilter"]], + }, + total=False, +) +ElisionTokenFilter.__doc__ = """Removes elisions. For example, "l'avion" (the plane) will be converted to "avion" (plane). This +token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 articles: The set of articles to remove. +:vartype articles: list[str] +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.ElisionTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.ElisionTokenFilter"] +""" + + +class EmbeddingColumnMapping(TypedDict, total=False): + """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 sourceField: SQL column used as input for embedding generation. Required. + :vartype sourceField: str + """ + + name: Required[str] + """Target vector field name in the search index. Required.""" + sourceField: Required[str] + """SQL column used as input for embedding generation. Required.""" + + +EntityLinkingSkill = TypedDict( + "EntityLinkingSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultLanguageCode": Optional[str], + "minimumPrecision": float, + "modelVersion": Optional[str], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.V3.EntityLinkingSkill"]], + }, + total=False, +) +EntityLinkingSkill.__doc__ = """Using the Text Analytics API, extracts linked entities from text. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultLanguageCode: A value indicating which language code to use. Default is ``en``. +:vartype defaultLanguageCode: str +:ivar minimumPrecision: 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. +:vartype minimumPrecision: float +:ivar modelVersion: 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. +:vartype modelVersion: str +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.V3.EntityLinkingSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.V3.EntityLinkingSkill"] +""" + + +EntityRecognitionSkillV3 = TypedDict( + "EntityRecognitionSkillV3", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "categories": list[Union[str, "EntityCategory"]], + "defaultLanguageCode": Optional[Union[str, "EntityRecognitionSkillLanguage"]], + "minimumPrecision": float, + "modelVersion": Optional[str], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.V3.EntityRecognitionSkill"]], + }, + total=False, +) +EntityRecognitionSkillV3.__doc__ = """Using the Text Analytics API, extracts entities of different types from text. + +: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["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["OutputFieldMappingEntry"] +:ivar categories: A list of entity categories that should be extracted. +:vartype categories: list[Union[str, "EntityCategory"]] +:ivar defaultLanguageCode: A value indicating which language code to use. Default is ``en``. + Known values are: "ar", "cs", "zh-Hans", "zh-Hant", "da", "nl", "en", "fi", "fr", "de", "el", + "hu", "it", "ja", "ko", "no", "pl", "pt-PT", "pt-BR", "ru", "es", "sv", and "tr". +:vartype defaultLanguageCode: Union[str, "EntityRecognitionSkillLanguage"] +:ivar minimumPrecision: 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. +:vartype minimumPrecision: float +:ivar modelVersion: The version of the model to use when calling the Text Analytics API. It + will default to the latest available when not specified. We recommend you do not specify this + value unless absolutely necessary. +:vartype modelVersion: str +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.V3.EntityRecognitionSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.V3.EntityRecognitionSkill"] +""" + + +class EntraAppAuthentication(TypedDict, total=False): + """Configuration for a customer-owned Microsoft Entra app registration used for federated + credential-based on-behalf-of authentication. + + :ivar applicationId: The application (client) ID of the customer-owned Entra app registration. + Required. + :vartype applicationId: str + :ivar federatedCredentialId: The federated credential ID configured on the app registration, + enabling the search service to authenticate as the app without a stored client secret. + Required. + :vartype federatedCredentialId: str + :ivar tenantId: The tenant ID of the app registration. Required when the app registration is in + a different tenant than the search service. If omitted, the search service's tenant is used. + :vartype tenantId: str + """ + + applicationId: Required[str] + """The application (client) ID of the customer-owned Entra app registration. Required.""" + federatedCredentialId: Required[str] + """The federated credential ID configured on the app registration, enabling the search service to + authenticate as the app without a stored client secret. Required.""" + tenantId: str + """The tenant ID of the app registration. Required when the app registration is in a different + tenant than the search service. If omitted, the search service's tenant is used.""" + + +class ExhaustiveKnnAlgorithmConfiguration(TypedDict, total=False): + """Contains configuration options specific to the exhaustive KNN algorithm used during querying, + which will perform brute-force search across the entire vector index. + + :ivar name: The name to associate with this particular configuration. Required. + :vartype name: str + :ivar exhaustiveKnnParameters: Contains the parameters specific to exhaustive KNN algorithm. + :vartype exhaustiveKnnParameters: "ExhaustiveKnnParameters" + :ivar kind: The name of the kind of algorithm being configured for use with vector search. + Required. Exhaustive KNN algorithm which will perform brute-force search. + :vartype kind: Literal[VectorSearchAlgorithmKind.EXHAUSTIVE_KNN] + """ + + name: Required[str] + """The name to associate with this particular configuration. Required.""" + exhaustiveKnnParameters: "ExhaustiveKnnParameters" + """Contains the parameters specific to exhaustive KNN algorithm.""" + kind: Required[Literal[VectorSearchAlgorithmKind.EXHAUSTIVE_KNN]] + """The name of the kind of algorithm being configured for use with vector search. Required. + Exhaustive KNN algorithm which will perform brute-force search.""" + + +class ExhaustiveKnnParameters(TypedDict, total=False): + """Contains the parameters specific to exhaustive KNN algorithm. + + :ivar metric: The similarity metric to use for vector comparisons. Known values are: "cosine", + "euclidean", "dotProduct", and "hamming". + :vartype metric: Union[str, "VectorSearchAlgorithmMetric"] + """ + + metric: Optional[Union[str, "VectorSearchAlgorithmMetric"]] + """The similarity metric to use for vector comparisons. Known values are: \"cosine\", + \"euclidean\", \"dotProduct\", and \"hamming\".""" + + +FabricDataAgentKnowledgeSource = TypedDict( + "FabricDataAgentKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT]], + "fabricDataAgentParameters": Required["FabricDataAgentKnowledgeSourceParameters"], + }, + total=False, +) +FabricDataAgentKnowledgeSource.__doc__ = """Configuration for Fabric Data Agent knowledge source. + +:ivar name: The name of the knowledge source. Required. +:vartype name: str +:ivar description: Optional user-defined description. +:vartype description: str +:ivar resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: The discriminator value. Required. A knowledge source that retrieves data from a + Fabric Data Agent. +:vartype kind: Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT] +:ivar fabricDataAgentParameters: The parameters for the Fabric Data Agent knowledge source. + Required. +:vartype fabricDataAgentParameters: "FabricDataAgentKnowledgeSourceParameters" +""" + + +class FabricDataAgentKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for Fabric Data Agent knowledge source. + + :ivar workspaceId: Fabric workspace ID. Required. + :vartype workspaceId: str + :ivar dataAgentId: Specifies which Fabric Data Agent to access. Required. + :vartype dataAgentId: str + """ + + workspaceId: Required[str] + """Fabric workspace ID. Required.""" + dataAgentId: Required[str] + """Specifies which Fabric Data Agent to access. Required.""" + + +FabricOntologyKnowledgeSource = TypedDict( + "FabricOntologyKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY]], + "fabricOntologyParameters": Required["FabricOntologyKnowledgeSourceParameters"], + }, + total=False, +) +FabricOntologyKnowledgeSource.__doc__ = """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 resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: The discriminator value. Required. A knowledge source that retrieves data from + Microsoft Fabric Ontology ontologies. +:vartype kind: Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY] +:ivar fabricOntologyParameters: The parameters for the Fabric Ontology knowledge source. + Required. +:vartype fabricOntologyParameters: "FabricOntologyKnowledgeSourceParameters" +""" + + +class FabricOntologyKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for Fabric Ontology knowledge source. + + :ivar workspaceId: The Fabric workspace ID containing the ontology. Required. + :vartype workspaceId: str + :ivar ontologyId: The ID of the ontology to use from the Fabric workspace. Required. + :vartype ontologyId: str + """ + + workspaceId: Required[str] + """The Fabric workspace ID containing the ontology. Required.""" + ontologyId: Required[str] + """The ID of the ontology to use from the Fabric workspace. Required.""" + + +class FieldMapping(TypedDict, total=False): + """Defines a mapping between a field in a data source and a target field in an index. + + :ivar sourceFieldName: The name of the field in the data source. Required. + :vartype sourceFieldName: str + :ivar targetFieldName: The name of the target field in the index. Same as the source field name + by default. + :vartype targetFieldName: str + :ivar mappingFunction: A function to apply to each source field value before indexing. + :vartype mappingFunction: "FieldMappingFunction" + """ + + sourceFieldName: Required[str] + """The name of the field in the data source. Required.""" + targetFieldName: str + """The name of the target field in the index. Same as the source field name by default.""" + mappingFunction: Optional["FieldMappingFunction"] + """A function to apply to each source field value before indexing.""" + + +class FieldMappingFunction(TypedDict, total=False): + """Represents a function that transforms a value from a data source before indexing. + + :ivar name: The name of the field mapping function. Required. + :vartype name: str + :ivar parameters: A dictionary of parameter name/value pairs to pass to the function. Each + value must be of a primitive type. + :vartype parameters: dict[str, Any] + """ + + name: Required[str] + """The name of the field mapping function. Required.""" + parameters: Optional[dict[str, Any]] + """A dictionary of parameter name/value pairs to pass to the function. Each value must be of a + primitive type.""" + + +FileKnowledgeSource = TypedDict( + "FileKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.FILE]], + "fileParameters": Required["FileKnowledgeSourceParameters"], + "corsOptions": "CorsOptions", + }, + total=False, +) +FileKnowledgeSource.__doc__ = """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 resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: The discriminator value. Required. A knowledge source that supports direct file + upload and indexing. +:vartype kind: Literal[KnowledgeSourceKind.FILE] +:ivar fileParameters: The parameters for the File knowledge source. Required. +:vartype fileParameters: "FileKnowledgeSourceParameters" +:ivar corsOptions: Options to control Cross-Origin Resource Sharing (CORS) for the File + knowledge source's file endpoints (upload, list, update, delete). +:vartype corsOptions: "CorsOptions" +""" + + +class FileKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for File knowledge source. + + :ivar ingestionParameters: Consolidates all general ingestion settings for the File knowledge + source, including the content extraction mode and an optional embeddingModel. + :vartype ingestionParameters: "KnowledgeSourceIngestionParameters" + :ivar queryHints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype queryHints: "SearchIndexKnowledgeSourceQueryHints" + :ivar createdResources: Resources created by the file knowledge source. + :vartype createdResources: "CreatedResources" + """ + + ingestionParameters: "KnowledgeSourceIngestionParameters" + """Consolidates all general ingestion settings for the File knowledge source, including the + content extraction mode and an optional embeddingModel.""" + queryHints: "SearchIndexKnowledgeSourceQueryHints" + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" + createdResources: "CreatedResources" + """Resources created by the file knowledge source.""" + + +class FileUploadMetadata(TypedDict, total=False): + """The JSON 'metadata' part of a multipart/form-data file upload: the full file name/path and + custom key/value metadata. The parsing mode and extraction mode are both chosen by the service + and are not supplied by the caller. + + :ivar fileName: The full relative file name/path to store the file under (prefixes are derived + from it). + :vartype fileName: str + :ivar metadata: Custom key/value metadata to store with the file. + :vartype metadata: dict[str, str] + """ + + fileName: str + """The full relative file name/path to store the file under (prefixes are derived from it).""" + metadata: dict[str, str] + """Custom key/value metadata to store with the file.""" + + +class FreshnessScoringFunction(TypedDict, total=False): + """Defines a function that boosts scores based on the value of a date-time field. + + :ivar fieldName: The name of the field used as input to the scoring function. Required. + :vartype fieldName: 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: Union[str, "ScoringFunctionInterpolation"] + :ivar freshness: Parameter values for the freshness scoring function. Required. + :vartype freshness: "FreshnessScoringParameters" + :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 + "freshness". + :vartype type: Literal["freshness"] + """ + + fieldName: Required[str] + """The name of the field used as input to the scoring function. Required.""" + boost: Required[float] + """A multiplier for the raw score. Must be a positive number not equal to 1.0. Required.""" + interpolation: Union[str, "ScoringFunctionInterpolation"] + """A value indicating how boosting will be interpolated across document scores; defaults to + \"Linear\". Known values are: \"linear\", \"constant\", \"quadratic\", and \"logarithmic\".""" + freshness: Required["FreshnessScoringParameters"] + """Parameter values for the freshness scoring function. Required.""" + type: Required[Literal["freshness"]] + """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 \"freshness\".""" + + +class FreshnessScoringParameters(TypedDict, total=False): + """Provides parameter values to a freshness scoring function. + + :ivar boostingDuration: The expiration period after which boosting will stop for a particular + document. Required. + :vartype boostingDuration: str + """ + + boostingDuration: Required[str] + """The expiration period after which boosting will stop for a particular document. Required.""" + + +HighWaterMarkChangeDetectionPolicy = TypedDict( + "HighWaterMarkChangeDetectionPolicy", + { + "highWaterMarkColumnName": Required[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy"]], + }, + total=False, +) +HighWaterMarkChangeDetectionPolicy.__doc__ = """Defines a data change detection policy that captures changes based on the value of a high water +mark column. + +:ivar highWaterMarkColumnName: The name of the high water mark column. Required. +:vartype highWaterMarkColumnName: str +:ivar ``@odata.type``: A URI fragment specifying the type of data change detection policy. + Required. Default value is "#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy"] +""" + + +class HnswAlgorithmConfiguration(TypedDict, total=False): + """Contains configuration options specific to the HNSW approximate nearest neighbors algorithm + used during indexing and querying. The HNSW algorithm offers a tunable trade-off between search + speed and accuracy. + + :ivar name: The name to associate with this particular configuration. Required. + :vartype name: str + :ivar hnswParameters: Contains the parameters specific to HNSW algorithm. + :vartype hnswParameters: "HnswParameters" + :ivar kind: The name of the kind of algorithm being configured for use with vector search. + Required. HNSW (Hierarchical Navigable Small World), a type of approximate nearest neighbors + algorithm. + :vartype kind: Literal[VectorSearchAlgorithmKind.HNSW] + """ + + name: Required[str] + """The name to associate with this particular configuration. Required.""" + hnswParameters: "HnswParameters" + """Contains the parameters specific to HNSW algorithm.""" + kind: Required[Literal[VectorSearchAlgorithmKind.HNSW]] + """The name of the kind of algorithm being configured for use with vector search. Required. HNSW + (Hierarchical Navigable Small World), a type of approximate nearest neighbors algorithm.""" + + +class HnswParameters(TypedDict, total=False): + """Contains the parameters specific to the HNSW algorithm. + + :ivar m: The number of bi-directional links created for every new element during construction. + Increasing this parameter value may improve recall and reduce retrieval times for datasets with + high intrinsic dimensionality at the expense of increased memory consumption and longer + indexing time. + :vartype m: int + :ivar efConstruction: The size of the dynamic list containing the nearest neighbors, which is + used during index time. Increasing this parameter may improve index quality, at the expense of + increased indexing time. At a certain point, increasing this parameter leads to diminishing + returns. + :vartype efConstruction: int + :ivar efSearch: The size of the dynamic list containing the nearest neighbors, which is used + during search time. Increasing this parameter may improve search results, at the expense of + slower search. At a certain point, increasing this parameter leads to diminishing returns. + :vartype efSearch: int + :ivar metric: The similarity metric to use for vector comparisons. Known values are: "cosine", + "euclidean", "dotProduct", and "hamming". + :vartype metric: Union[str, "VectorSearchAlgorithmMetric"] + """ + + m: int + """The number of bi-directional links created for every new element during construction. + Increasing this parameter value may improve recall and reduce retrieval times for datasets with + high intrinsic dimensionality at the expense of increased memory consumption and longer + indexing time.""" + efConstruction: int + """The size of the dynamic list containing the nearest neighbors, which is used during index time. + Increasing this parameter may improve index quality, at the expense of increased indexing time. + At a certain point, increasing this parameter leads to diminishing returns.""" + efSearch: int + """The size of the dynamic list containing the nearest neighbors, which is used during search + time. Increasing this parameter may improve search results, at the expense of slower search. At + a certain point, increasing this parameter leads to diminishing returns.""" + metric: Optional[Union[str, "VectorSearchAlgorithmMetric"]] + """The similarity metric to use for vector comparisons. Known values are: \"cosine\", + \"euclidean\", \"dotProduct\", and \"hamming\".""" + + +ImageAnalysisSkill = TypedDict( + "ImageAnalysisSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultLanguageCode": Union[str, "ImageAnalysisSkillLanguage"], + "visualFeatures": list[Union[str, "VisualFeature"]], + "details": list[Union[str, "ImageDetail"]], + "@odata.type": Required[Literal["#Microsoft.Skills.Vision.ImageAnalysisSkill"]], + }, + total=False, +) +ImageAnalysisSkill.__doc__ = """A skill that analyzes image files. It extracts a rich set of visual features based on the image +content. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultLanguageCode: A value indicating which language code to use. Default is ``en``. + Known values are: "ar", "az", "bg", "bs", "ca", "cs", "cy", "da", "de", "el", "en", "es", "et", + "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hu", "id", "it", "ja", "kk", "ko", "lt", "lv", + "mk", "ms", "nb", "nl", "pl", "prs", "pt-BR", "pt", "pt-PT", "ro", "ru", "sk", "sl", "sr-Cyrl", + "sr-Latn", "sv", "th", "tr", "uk", "vi", "zh", "zh-Hans", and "zh-Hant". +:vartype defaultLanguageCode: Union[str, "ImageAnalysisSkillLanguage"] +:ivar visualFeatures: A list of visual features. +:vartype visualFeatures: list[Union[str, "VisualFeature"]] +:ivar details: A string indicating which domain-specific details to return. +:vartype details: list[Union[str, "ImageDetail"]] +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Vision.ImageAnalysisSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Vision.ImageAnalysisSkill"] +""" + + +IndexedOneLakeKnowledgeSource = TypedDict( + "IndexedOneLakeKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.INDEXED_ONELAKE]], + "indexedOneLakeParameters": Required["IndexedOneLakeKnowledgeSourceParameters"], + }, + total=False, +) +IndexedOneLakeKnowledgeSource.__doc__ = """Configuration for OneLake knowledge source. + +:ivar name: The name of the knowledge source. Required. +:vartype name: str +:ivar description: Optional user-defined description. +:vartype description: str +:ivar resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: Required. A knowledge source that reads data from indexed OneLake. +:vartype kind: Literal[KnowledgeSourceKind.INDEXED_ONELAKE] +:ivar indexedOneLakeParameters: The parameters for the knowledge source. Required. +:vartype indexedOneLakeParameters: "IndexedOneLakeKnowledgeSourceParameters" +""" + + +class IndexedOneLakeKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for OneLake knowledge source. + + :ivar fabricWorkspaceId: OneLake workspace ID. Required. + :vartype fabricWorkspaceId: str + :ivar lakehouseId: Specifies which OneLake lakehouse to access. Required. + :vartype lakehouseId: str + :ivar targetPath: Optional OneLakehouse folder or shortcut to filter OneLake content. + :vartype targetPath: str + :ivar ingestionParameters: Consolidates all general ingestion settings. + :vartype ingestionParameters: "KnowledgeSourceIngestionParameters" + :ivar queryHints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype queryHints: "SearchIndexKnowledgeSourceQueryHints" + :ivar createdResources: Resources created by the knowledge source. + :vartype createdResources: "CreatedResources" + """ + + fabricWorkspaceId: Required[str] + """OneLake workspace ID. Required.""" + lakehouseId: Required[str] + """Specifies which OneLake lakehouse to access. Required.""" + targetPath: Optional[str] + """Optional OneLakehouse folder or shortcut to filter OneLake content.""" + ingestionParameters: "KnowledgeSourceIngestionParameters" + """Consolidates all general ingestion settings.""" + queryHints: "SearchIndexKnowledgeSourceQueryHints" + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" + createdResources: "CreatedResources" + """Resources created by the knowledge source.""" + + +IndexedSharePointKnowledgeSource = TypedDict( + "IndexedSharePointKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT]], + "indexedSharePointParameters": Required["IndexedSharePointKnowledgeSourceParameters"], + }, + total=False, +) +IndexedSharePointKnowledgeSource.__doc__ = """Configuration for 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 resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: Required. A knowledge source that reads data from indexed SharePoint. +:vartype kind: Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT] +:ivar indexedSharePointParameters: The parameters for the knowledge source. Required. +:vartype indexedSharePointParameters: "IndexedSharePointKnowledgeSourceParameters" +""" + + +class IndexedSharePointKnowledgeSourceParameters(TypedDict, total=False): # pylint: disable=name-too-long + """Parameters for SharePoint knowledge source. + + :ivar connectionString: 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 connectionString: str + :ivar containerName: Specifies which SharePoint libraries to access. Required. Known values + are: "defaultSiteLibrary", "allSiteLibraries", and "useQuery". + :vartype containerName: Union[str, "IndexedSharePointContainerName"] + :ivar query: Optional query to filter SharePoint content. + :vartype query: str + :ivar ingestionParameters: Consolidates all general ingestion settings. + :vartype ingestionParameters: "KnowledgeSourceIngestionParameters" + :ivar queryHints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype queryHints: "SearchIndexKnowledgeSourceQueryHints" + :ivar createdResources: Resources created by the knowledge source. + :vartype createdResources: "CreatedResources" + """ + + connectionString: Required[str] + """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.""" + containerName: Required[Union[str, "IndexedSharePointContainerName"]] + """Specifies which SharePoint libraries to access. Required. Known values are: + \"defaultSiteLibrary\", \"allSiteLibraries\", and \"useQuery\".""" + query: Optional[str] + """Optional query to filter SharePoint content.""" + ingestionParameters: Optional["KnowledgeSourceIngestionParameters"] + """Consolidates all general ingestion settings.""" + queryHints: "SearchIndexKnowledgeSourceQueryHints" + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" + createdResources: "CreatedResources" + """Resources created by the knowledge source.""" + + +IndexedSqlKnowledgeSource = TypedDict( + "IndexedSqlKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.INDEXED_SQL]], + "indexedSqlParameters": Required["IndexedSqlKnowledgeSourceParameters"], + }, + total=False, +) +IndexedSqlKnowledgeSource.__doc__ = """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 resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "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: Literal[KnowledgeSourceKind.INDEXED_SQL] +:ivar indexedSqlParameters: The parameters for the SQL knowledge source. Required. +:vartype indexedSqlParameters: "IndexedSqlKnowledgeSourceParameters" +""" + + +class IndexedSqlKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for indexed SQL knowledge source. + + :ivar connectionString: The connection string for the Azure SQL Database or SQL Managed + Instance. Required. + :vartype connectionString: str + :ivar tableOrView: The name of the table or view to index. Can be schema-qualified (e.g., + 'dbo.MyTable'). Required. + :vartype tableOrView: str + :ivar highWaterMarkColumnName: Optional column name for high water mark change detection. If + provided, uses HighWaterMarkChangeDetectionPolicy. + :vartype highWaterMarkColumnName: str + :ivar contentColumns: Optional column mappings for content fields. If omitted, all columns are + auto-discovered. + :vartype contentColumns: list["ContentColumnMapping"] + :ivar embeddingColumns: Optional column mappings for embedding vector fields. If omitted, no + vector fields are created. + :vartype embeddingColumns: list["EmbeddingColumnMapping"] + :ivar ingestionParameters: Consolidates all general ingestion settings including embedding + model, schedule, and identity. + :vartype ingestionParameters: "KnowledgeSourceIngestionParameters" + :ivar queryHints: Default hints that guide query planning toward useful filters and boosts for + this index-backed knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype queryHints: "SearchIndexKnowledgeSourceQueryHints" + :ivar createdResources: Resources created by the knowledge source. + :vartype createdResources: "CreatedResources" + """ + + connectionString: Required[str] + """The connection string for the Azure SQL Database or SQL Managed Instance. Required.""" + tableOrView: Required[str] + """The name of the table or view to index. Can be schema-qualified (e.g., 'dbo.MyTable'). + Required.""" + highWaterMarkColumnName: str + """Optional column name for high water mark change detection. If provided, uses + HighWaterMarkChangeDetectionPolicy.""" + contentColumns: list["ContentColumnMapping"] + """Optional column mappings for content fields. If omitted, all columns are auto-discovered.""" + embeddingColumns: list["EmbeddingColumnMapping"] + """Optional column mappings for embedding vector fields. If omitted, no vector fields are created.""" + ingestionParameters: "KnowledgeSourceIngestionParameters" + """Consolidates all general ingestion settings including embedding model, schedule, and identity.""" + queryHints: "SearchIndexKnowledgeSourceQueryHints" + """Default hints that guide query planning toward useful filters and boosts for this index-backed + knowledge source. Request-time query hints replace these defaults as a complete object.""" + createdResources: "CreatedResources" + """Resources created by the knowledge source.""" + + +class IndexerResyncBody(TypedDict, total=False): + """Request body for resync indexer operation. + + :ivar options: Re-sync options that have been pre-defined from data source. + :vartype options: list[Union[str, "IndexerResyncOption"]] + """ + + options: Optional[list[Union[str, "IndexerResyncOption"]]] + """Re-sync options that have been pre-defined from data source.""" + + +class IndexingParameters(TypedDict, total=False): + """Represents parameters for indexer execution. + + :ivar batchSize: The number of items that are read from the data source and indexed as a single + batch in order to improve performance. The default depends on the data source type. + :vartype batchSize: int + :ivar maxFailedItems: The maximum number of items that can fail indexing for indexer execution + to still be considered successful. -1 means no limit. Default is 0. + :vartype maxFailedItems: int + :ivar maxFailedItemsPerBatch: The maximum number of items in a single batch that can fail + indexing for the batch to still be considered successful. -1 means no limit. Default is 0. + :vartype maxFailedItemsPerBatch: int + :ivar configuration: A dictionary of indexer-specific configuration properties. Each name is + the name of a specific property. Each value must be of a primitive type. + :vartype configuration: "IndexingParametersConfiguration" + """ + + batchSize: Optional[int] + """The number of items that are read from the data source and indexed as a single batch in order + to improve performance. The default depends on the data source type.""" + maxFailedItems: Optional[int] + """The maximum number of items that can fail indexing for indexer execution to still be considered + successful. -1 means no limit. Default is 0.""" + maxFailedItemsPerBatch: Optional[int] + """The maximum number of items in a single batch that can fail indexing for the batch to still be + considered successful. -1 means no limit. Default is 0.""" + configuration: "IndexingParametersConfiguration" + """A dictionary of indexer-specific configuration properties. Each name is the name of a specific + property. Each value must be of a primitive type.""" + + +class IndexingParametersConfiguration(TypedDict, total=False): + """A dictionary of indexer-specific configuration properties. Each name is the name of a specific + property. Each value must be of a primitive type. + + :ivar parsingMode: Represents the parsing mode for indexing from an Azure blob data source. + Known values are: "default", "text", "delimitedText", "json", "jsonArray", "jsonLines", and + "markdown". + :vartype parsingMode: Union[str, "BlobIndexerParsingMode"] + :ivar excludedFileNameExtensions: Comma-delimited list of filename extensions to ignore when + processing from Azure blob storage. For example, you could exclude ".png, .mp4" to skip over + those files during indexing. + :vartype excludedFileNameExtensions: str + :ivar indexedFileNameExtensions: Comma-delimited list of filename extensions to select when + processing from Azure blob storage. For example, you could focus indexing on specific + application files ".docx, .pptx, .msg" to specifically include those file types. + :vartype indexedFileNameExtensions: str + :ivar failOnUnsupportedContentType: For Azure blobs, set to false if you want to continue + indexing when an unsupported content type is encountered, and you don't know all the content + types (file extensions) in advance. + :vartype failOnUnsupportedContentType: bool + :ivar failOnUnprocessableDocument: For Azure blobs, set to false if you want to continue + indexing if a document fails indexing. + :vartype failOnUnprocessableDocument: bool + :ivar indexStorageMetadataOnlyForOversizedDocuments: For Azure blobs, set this property to true + to still index storage metadata for blob content that is too large to process. Oversized blobs + are treated as errors by default. For limits on blob size, see + `https://learn.microsoft.com/azure/search/search-limits-quotas-capacity + `_. + :vartype indexStorageMetadataOnlyForOversizedDocuments: bool + :ivar delimitedTextHeaders: For CSV blobs, specifies a comma-delimited list of column headers, + useful for mapping source fields to destination fields in an index. + :vartype delimitedTextHeaders: str + :ivar delimitedTextDelimiter: For CSV blobs, specifies the end-of-line single-character + delimiter for CSV files where each line starts a new document (for example, "|"). + :vartype delimitedTextDelimiter: str + :ivar firstLineContainsHeaders: For CSV blobs, indicates that the first (non-blank) line of + each blob contains headers. + :vartype firstLineContainsHeaders: bool + :ivar markdownParsingSubmode: Specifies the submode that will determine whether a markdown file + will be parsed into exactly one search document or multiple search documents. Default is + ``oneToMany``. Known values are: "oneToMany" and "oneToOne". + :vartype markdownParsingSubmode: Union[str, "MarkdownParsingSubmode"] + :ivar markdownHeaderDepth: Specifies the max header depth that will be considered while + grouping markdown content. Default is ``h6``. Known values are: "h1", "h2", "h3", "h4", "h5", + and "h6". + :vartype markdownHeaderDepth: Union[str, "MarkdownHeaderDepth"] + :ivar documentRoot: For JSON arrays, given a structured or semi-structured document, you can + specify a path to the array using this property. + :vartype documentRoot: str + :ivar dataToExtract: Specifies the data to extract from Azure blob storage and tells the + indexer which data to extract from image content when "imageAction" is set to a value other + than "none". This applies to embedded image content in a .PDF or other application, or image + files such as .jpg and .png, in Azure blobs. Known values are: "storageMetadata", + "allMetadata", and "contentAndMetadata". + :vartype dataToExtract: Union[str, "BlobIndexerDataToExtract"] + :ivar imageAction: Determines how to process embedded images and image files in Azure blob + storage. Setting the "imageAction" configuration to any value other than "none" requires that + a skillset also be attached to that indexer. Known values are: "none", + "generateNormalizedImages", and "generateNormalizedImagePerPage". + :vartype imageAction: Union[str, "BlobIndexerImageAction"] + :ivar allowSkillsetToReadFileData: If true, will create a path //document//file_data that is an + object representing the original file data downloaded from your blob data source. This allows + you to pass the original file data to a custom skill for processing within the enrichment + pipeline, or to the Document Extraction skill. + :vartype allowSkillsetToReadFileData: bool + :ivar pdfTextRotationAlgorithm: Determines algorithm for text extraction from PDF files in + Azure blob storage. Known values are: "none" and "detectAngles". + :vartype pdfTextRotationAlgorithm: Union[str, "BlobIndexerPDFTextRotationAlgorithm"] + :ivar executionEnvironment: Specifies the environment in which the indexer should execute. + Known values are: "standard" and "private". + :vartype executionEnvironment: Union[str, "IndexerExecutionEnvironment"] + :ivar queryTimeout: Increases the timeout beyond the 5-minute default for Azure SQL database + data sources, specified in the format "hh:mm:ss". + :vartype queryTimeout: str + """ + + parsingMode: Union[str, "BlobIndexerParsingMode"] + """Represents the parsing mode for indexing from an Azure blob data source. Known values are: + \"default\", \"text\", \"delimitedText\", \"json\", \"jsonArray\", \"jsonLines\", and + \"markdown\".""" + excludedFileNameExtensions: str + """Comma-delimited list of filename extensions to ignore when processing from Azure blob storage. + For example, you could exclude \".png, .mp4\" to skip over those files during indexing.""" + indexedFileNameExtensions: str + """Comma-delimited list of filename extensions to select when processing from Azure blob storage. + For example, you could focus indexing on specific application files \".docx, .pptx, .msg\" to + specifically include those file types.""" + failOnUnsupportedContentType: bool + """For Azure blobs, set to false if you want to continue indexing when an unsupported content type + is encountered, and you don't know all the content types (file extensions) in advance.""" + failOnUnprocessableDocument: bool + """For Azure blobs, set to false if you want to continue indexing if a document fails indexing.""" + indexStorageMetadataOnlyForOversizedDocuments: bool + """For Azure blobs, set this property to true to still index storage metadata for blob content + that is too large to process. Oversized blobs are treated as errors by default. For limits on + blob size, see `https://learn.microsoft.com/azure/search/search-limits-quotas-capacity + `_.""" + delimitedTextHeaders: str + """For CSV blobs, specifies a comma-delimited list of column headers, useful for mapping source + fields to destination fields in an index.""" + delimitedTextDelimiter: str + """For CSV blobs, specifies the end-of-line single-character delimiter for CSV files where each + line starts a new document (for example, \"|\").""" + firstLineContainsHeaders: bool + """For CSV blobs, indicates that the first (non-blank) line of each blob contains headers.""" + markdownParsingSubmode: Optional[Union[str, "MarkdownParsingSubmode"]] + """Specifies the submode that will determine whether a markdown file will be parsed into exactly + one search document or multiple search documents. Default is ``oneToMany``. Known values are: + \"oneToMany\" and \"oneToOne\".""" + markdownHeaderDepth: Optional[Union[str, "MarkdownHeaderDepth"]] + """Specifies the max header depth that will be considered while grouping markdown content. Default + is ``h6``. Known values are: \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", and \"h6\".""" + documentRoot: str + """For JSON arrays, given a structured or semi-structured document, you can specify a path to the + array using this property.""" + dataToExtract: Union[str, "BlobIndexerDataToExtract"] + """Specifies the data to extract from Azure blob storage and tells the indexer which data to + extract from image content when \"imageAction\" is set to a value other than \"none\". This + applies to embedded image content in a .PDF or other application, or image files such as .jpg + and .png, in Azure blobs. Known values are: \"storageMetadata\", \"allMetadata\", and + \"contentAndMetadata\".""" + imageAction: Union[str, "BlobIndexerImageAction"] + """Determines how to process embedded images and image files in Azure blob storage. Setting the + \"imageAction\" configuration to any value other than \"none\" requires that a skillset also be + attached to that indexer. Known values are: \"none\", \"generateNormalizedImages\", and + \"generateNormalizedImagePerPage\".""" + allowSkillsetToReadFileData: bool + """If true, will create a path //document//file_data that is an object representing the original + file data downloaded from your blob data source. This allows you to pass the original file data + to a custom skill for processing within the enrichment pipeline, or to the Document Extraction + skill.""" + pdfTextRotationAlgorithm: Union[str, "BlobIndexerPDFTextRotationAlgorithm"] + """Determines algorithm for text extraction from PDF files in Azure blob storage. Known values + are: \"none\" and \"detectAngles\".""" + executionEnvironment: Union[str, "IndexerExecutionEnvironment"] + """Specifies the environment in which the indexer should execute. Known values are: \"standard\" + and \"private\".""" + queryTimeout: str + """Increases the timeout beyond the 5-minute default for Azure SQL database data sources, + specified in the format \"hh:mm:ss\".""" + + +class IndexingSchedule(TypedDict, total=False): + """Represents a schedule for indexer execution. + + :ivar interval: The interval of time between indexer executions. Required. + :vartype interval: str + :ivar startTime: The time when an indexer should start running. + :vartype startTime: str + """ + + interval: Required[str] + """The interval of time between indexer executions. Required.""" + startTime: str + """The time when an indexer should start running.""" + + +class InputFieldMappingEntry(TypedDict, total=False): + """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 sourceContext: The source context used for selecting recursive inputs. + :vartype sourceContext: str + :ivar inputs: The recursive inputs used when creating a complex type. + :vartype inputs: list["InputFieldMappingEntry"] + """ + + name: Required[str] + """The name of the input. Required.""" + source: str + """The source of the input.""" + sourceContext: str + """The source context used for selecting recursive inputs.""" + inputs: list["InputFieldMappingEntry"] + """The recursive inputs used when creating a complex type.""" + + +KeepTokenFilter = TypedDict( + "KeepTokenFilter", + { + "name": Required[str], + "keepWords": Required[list[str]], + "keepWordsCase": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.KeepTokenFilter"]], + }, + total=False, +) +KeepTokenFilter.__doc__ = """A token filter that only keeps tokens with text contained in a specified list of words. This +token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 keepWords: The list of words to keep. Required. +:vartype keepWords: list[str] +:ivar keepWordsCase: A value indicating whether to lower case all words first. Default is + false. +:vartype keepWordsCase: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.KeepTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.KeepTokenFilter"] +""" + + +KeyPhraseExtractionSkill = TypedDict( + "KeyPhraseExtractionSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultLanguageCode": Union[str, "KeyPhraseExtractionSkillLanguage"], + "maxKeyPhraseCount": Optional[int], + "modelVersion": Optional[str], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.KeyPhraseExtractionSkill"]], + }, + total=False, +) +KeyPhraseExtractionSkill.__doc__ = """A skill that uses text analytics for key phrase extraction. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultLanguageCode: A value indicating which language code to use. Default is ``en``. + Known values are: "da", "nl", "en", "fi", "fr", "de", "it", "ja", "ko", "no", "pl", "pt-PT", + "pt-BR", "ru", "es", and "sv". +:vartype defaultLanguageCode: Union[str, "KeyPhraseExtractionSkillLanguage"] +:ivar maxKeyPhraseCount: A number indicating how many key phrases to return. If absent, all + identified key phrases will be returned. +:vartype maxKeyPhraseCount: int +:ivar modelVersion: 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. +:vartype modelVersion: str +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.KeyPhraseExtractionSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.KeyPhraseExtractionSkill"] +""" + + +KeywordMarkerTokenFilter = TypedDict( + "KeywordMarkerTokenFilter", + { + "name": Required[str], + "keywords": Required[list[str]], + "ignoreCase": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.KeywordMarkerTokenFilter"]], + }, + total=False, +) +KeywordMarkerTokenFilter.__doc__ = """Marks terms as keywords. This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 keywords: A list of words to mark as keywords. Required. +:vartype keywords: list[str] +:ivar ignoreCase: A value indicating whether to ignore case. If true, all words are converted + to lower case first. Default is false. +:vartype ignoreCase: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.KeywordMarkerTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.KeywordMarkerTokenFilter"] +""" + + +KeywordTokenizer = TypedDict( + "KeywordTokenizer", + { + "name": Required[str], + "bufferSize": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.KeywordTokenizer"]], + }, + total=False, +) +KeywordTokenizer.__doc__ = """Emits the entire input as a single token. 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 bufferSize: The read buffer size in bytes. Default is 256. +:vartype bufferSize: int +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.KeywordTokenizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.KeywordTokenizer"] +""" + + +KeywordTokenizerV2 = TypedDict( + "KeywordTokenizerV2", + { + "name": Required[str], + "maxTokenLength": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.KeywordTokenizerV2"]], + }, + total=False, +) +KeywordTokenizerV2.__doc__ = """Emits the entire input as a single token. 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 maxTokenLength: The maximum token length. Default is 256. Tokens longer than the maximum + length are split. The maximum token length that can be used is 300 characters. +:vartype maxTokenLength: int +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.KeywordTokenizerV2". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.KeywordTokenizerV2"] +""" + + +KnowledgeBase = TypedDict( + "KnowledgeBase", + { + "name": Required[str], + "knowledgeSources": Required[list["KnowledgeSourceReference"]], + "models": list["KnowledgeBaseModel"], + "retrievalReasoningEffort": "KnowledgeRetrievalReasoningEffort", + "outputMode": Union[str, "KnowledgeRetrievalOutputMode"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "description": str, + "tags": dict[str, str], + "retrievalInstructions": str, + "answerInstructions": str, + "corsOptions": "CorsOptions", + "retrieveDefaults": "KnowledgeBaseRetrieveDefaults", + }, + total=False, +) +KnowledgeBase.__doc__ = """Represents a knowledge base definition. + +:ivar name: The name of the knowledge base. Required. +:vartype name: str +:ivar knowledgeSources: Knowledge sources referenced by this knowledge base. Required. +:vartype knowledgeSources: list["KnowledgeSourceReference"] +:ivar models: Contains configuration options on how to connect to AI models. +:vartype models: list["KnowledgeBaseModel"] +:ivar retrievalReasoningEffort: The retrieval reasoning effort configuration. +:vartype retrievalReasoningEffort: "KnowledgeRetrievalReasoningEffort" +:ivar outputMode: The output mode for the knowledge base. Known values are: "extractiveData" + and "answerSynthesis". +:vartype outputMode: Union[str, "KnowledgeRetrievalOutputMode"] +:ivar ``@odata.etag``: The ETag of the knowledge base. +:vartype ``@odata.etag``: str +:ivar encryptionKey: A description of an encryption key that you create in Azure Key Vault. +:vartype encryptionKey: "SearchResourceEncryptionKey" +:ivar description: The description of the knowledge base. +:vartype description: str +:ivar tags: User-defined key-value pairs for categorizing the knowledge base and attributing + its usage and costs. +:vartype tags: dict[str, str] +:ivar retrievalInstructions: Instructions considered by the knowledge base when developing + query plan. +:vartype retrievalInstructions: str +:ivar answerInstructions: Instructions considered by the knowledge base when generating + answers. +:vartype answerInstructions: str +:ivar corsOptions: Options to control Cross-Origin Resource Sharing (CORS) for the knowledge + base. +:vartype corsOptions: "CorsOptions" +:ivar retrieveDefaults: Persisted request-wide retrieve defaults for this knowledge base. These + values apply to retrieve requests that omit the corresponding fields; request-time values take + precedence when present. +:vartype retrieveDefaults: "KnowledgeBaseRetrieveDefaults" +""" + + +class KnowledgeBaseAzureOpenAIModel(TypedDict, total=False): + """Specifies the Azure OpenAI resource used to do query planning. + + :ivar kind: Required. Use Azure Open AI models for query planning. + :vartype kind: Literal[KnowledgeBaseModelKind.AZURE_OPEN_AI] + :ivar azureOpenAIParameters: Azure OpenAI parameters. Required. + :vartype azureOpenAIParameters: "AzureOpenAIVectorizerParameters" + """ + + kind: Required[Literal[KnowledgeBaseModelKind.AZURE_OPEN_AI]] + """Required. Use Azure Open AI models for query planning.""" + azureOpenAIParameters: Required["AzureOpenAIVectorizerParameters"] + """Azure OpenAI parameters. Required.""" + + +class KnowledgeBaseRetrieveDefaults(TypedDict, total=False): + """Persisted request-wide defaults for knowledge base retrieve requests. Each value provides the + default for the matching retrieve-request field; service defaults apply when unset, and + request-time values take precedence when present. + + :ivar maxRuntimeInSeconds: The default maximum runtime in seconds for a retrieve request. + :vartype maxRuntimeInSeconds: int + :ivar maxOutputDocuments: The default maximum number of documents in the retrieve output. + :vartype maxOutputDocuments: int + :ivar maxOutputSizeInTokens: The default maximum size, in tokens, of the content in the + retrieve output. + :vartype maxOutputSizeInTokens: int + """ + + maxRuntimeInSeconds: int + """The default maximum runtime in seconds for a retrieve request.""" + maxOutputDocuments: int + """The default maximum number of documents in the retrieve output.""" + maxOutputSizeInTokens: int + """The default maximum size, in tokens, of the content in the retrieve output.""" + + +class KnowledgeSourceReference(TypedDict, total=False): + """Reference to a knowledge source. + + :ivar name: The name of the knowledge source. Required. + :vartype name: str + :ivar enableImageServing: 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 enableImageServing: bool + :ivar enableFreshness: 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 enableFreshness: bool + """ + + name: Required[str] + """The name of the knowledge source. Required.""" + enableImageServing: bool + """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.""" + enableFreshness: bool + """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.""" + + +LanguageDetectionSkill = TypedDict( + "LanguageDetectionSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultCountryHint": Optional[str], + "modelVersion": Optional[str], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.LanguageDetectionSkill"]], + }, + total=False, +) +LanguageDetectionSkill.__doc__ = """A skill that detects the language of input text and reports a single language code for every +document submitted on the request. The language code is paired with a score indicating the +confidence of the analysis. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultCountryHint: A country code to use as a hint to the language detection model if it + cannot disambiguate the language. +:vartype defaultCountryHint: str +:ivar modelVersion: 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. +:vartype modelVersion: str +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.LanguageDetectionSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.LanguageDetectionSkill"] +""" + + +LengthTokenFilter = TypedDict( + "LengthTokenFilter", + { + "name": Required[str], + "min": int, + "max": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.LengthTokenFilter"]], + }, + total=False, +) +LengthTokenFilter.__doc__ = """Removes words that are too long or too short. This token filter is implemented using Apache +Lucene. + +:ivar name: The name of the token 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 min: The minimum length in characters. Default is 0. Maximum is 300. Must be less than + the value of max. +:vartype min: int +:ivar max: The maximum length in characters. Default and maximum is 300. +:vartype max: int +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.LengthTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.LengthTokenFilter"] +""" + + +LimitTokenFilter = TypedDict( + "LimitTokenFilter", + { + "name": Required[str], + "maxTokenCount": int, + "consumeAllTokens": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.LimitTokenFilter"]], + }, + total=False, +) +LimitTokenFilter.__doc__ = """Limits the number of tokens while indexing. This token filter is implemented using Apache +Lucene. + +:ivar name: The name of the token 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 maxTokenCount: The maximum number of tokens to produce. Default is 1. +:vartype maxTokenCount: int +:ivar consumeAllTokens: A value indicating whether all tokens from the input must be consumed + even if maxTokenCount is reached. Default is false. +:vartype consumeAllTokens: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.LimitTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.LimitTokenFilter"] +""" + + +LuceneStandardAnalyzer = TypedDict( + "LuceneStandardAnalyzer", + { + "name": Required[str], + "maxTokenLength": int, + "stopwords": list[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.StandardAnalyzer"]], + }, + total=False, +) +LuceneStandardAnalyzer.__doc__ = """Standard Apache Lucene analyzer; Composed of the standard tokenizer, lowercase filter and stop +filter. + +:ivar name: The name of the analyzer. 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 maxTokenLength: 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 maxTokenLength: int +:ivar stopwords: A list of stopwords. +:vartype stopwords: list[str] +:ivar ``@odata.type``: A URI fragment specifying the type of analyzer. Required. Default value + is "#Microsoft.Azure.Search.StandardAnalyzer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.StandardAnalyzer"] +""" + + +LuceneStandardTokenizer = TypedDict( + "LuceneStandardTokenizer", + { + "name": Required[str], + "maxTokenLength": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.StandardTokenizer"]], + }, + total=False, +) +LuceneStandardTokenizer.__doc__ = """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 maxTokenLength: The maximum token length. Default is 255. Tokens longer than the maximum + length are split. +:vartype maxTokenLength: int +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.StandardTokenizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.StandardTokenizer"] +""" + + +LuceneStandardTokenizerV2 = TypedDict( + "LuceneStandardTokenizerV2", + { + "name": Required[str], + "maxTokenLength": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.StandardTokenizerV2"]], + }, + total=False, +) +LuceneStandardTokenizerV2.__doc__ = """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 maxTokenLength: 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 maxTokenLength: int +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.StandardTokenizerV2". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.StandardTokenizerV2"] +""" + + +class MagnitudeScoringFunction(TypedDict, total=False): + """Defines a function that boosts scores based on the magnitude of a numeric field. + + :ivar fieldName: The name of the field used as input to the scoring function. Required. + :vartype fieldName: 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: Union[str, "ScoringFunctionInterpolation"] + :ivar magnitude: Parameter values for the magnitude scoring function. Required. + :vartype magnitude: "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: Literal["magnitude"] + """ + + fieldName: Required[str] + """The name of the field used as input to the scoring function. Required.""" + boost: Required[float] + """A multiplier for the raw score. Must be a positive number not equal to 1.0. Required.""" + interpolation: Union[str, "ScoringFunctionInterpolation"] + """A value indicating how boosting will be interpolated across document scores; defaults to + \"Linear\". Known values are: \"linear\", \"constant\", \"quadratic\", and \"logarithmic\".""" + magnitude: Required["MagnitudeScoringParameters"] + """Parameter values for the magnitude scoring function. Required.""" + type: Required[Literal["magnitude"]] + """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\".""" + + +class MagnitudeScoringParameters(TypedDict, total=False): + """Provides parameter values to a magnitude scoring function. + + :ivar boostingRangeStart: The field value at which boosting starts. Required. + :vartype boostingRangeStart: float + :ivar boostingRangeEnd: The field value at which boosting ends. Required. + :vartype boostingRangeEnd: float + :ivar constantBoostBeyondRange: A value indicating whether to apply a constant boost for field + values beyond the range end value; default is false. + :vartype constantBoostBeyondRange: bool + """ + + boostingRangeStart: Required[float] + """The field value at which boosting starts. Required.""" + boostingRangeEnd: Required[float] + """The field value at which boosting ends. Required.""" + constantBoostBeyondRange: bool + """A value indicating whether to apply a constant boost for field values beyond the range end + value; default is false.""" + + +MappingCharFilter = TypedDict( + "MappingCharFilter", + { + "name": Required[str], + "mappings": Required[list[str]], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.MappingCharFilter"]], + }, + total=False, +) +MappingCharFilter.__doc__ = """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``: Literal["#Microsoft.Azure.Search.MappingCharFilter"] +""" + + +class McpServerAutoOutputParsing(TypedDict, total=False): + """Automatically detect the output format and parse accordingly. + + :ivar kind: The discriminator value. Required. Automatically detect the output format and parse + accordingly. + :vartype kind: Literal[McpServerOutputParsingKind.AUTO] + """ + + kind: Required[Literal[McpServerOutputParsingKind.AUTO]] + """The discriminator value. Required. Automatically detect the output format and parse + accordingly.""" + + +class McpServerFoundryConnectionAuthentication(TypedDict, total=False): + """Authentication using an Azure AI Foundry connection. + + :ivar kind: The discriminator value. Required. Authenticate using an Azure AI Foundry + connection. + :vartype kind: Literal[McpServerAuthenticationKind.FOUNDRY_CONNECTION] + :ivar foundryConnectionParameters: Parameters for Foundry connection authentication. Required. + :vartype foundryConnectionParameters: "McpServerFoundryConnectionParameters" + """ + + kind: Required[Literal[McpServerAuthenticationKind.FOUNDRY_CONNECTION]] + """The discriminator value. Required. Authenticate using an Azure AI Foundry connection.""" + foundryConnectionParameters: Required["McpServerFoundryConnectionParameters"] + """Parameters for Foundry connection authentication. Required.""" + + +class McpServerFoundryConnectionParameters(TypedDict, total=False): + """Parameters for Foundry connection authentication. + + :ivar connectionId: The Azure AI Foundry connection identifier. + :vartype connectionId: str + """ + + connectionId: str + """The Azure AI Foundry connection identifier.""" + + +class McpServerHeaders(TypedDict, total=False): + """A dictionary of HTTP header names and values.""" + + +class McpServerJsonOutputParsing(TypedDict, total=False): + """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: Literal[McpServerOutputParsingKind.JSON] + :ivar jsonParameters: Parameters for JSON output parsing. Required when kind is 'json'. + Required. + :vartype jsonParameters: "McpServerOutputParsingJsonParameters" + """ + + kind: Required[Literal[McpServerOutputParsingKind.JSON]] + """The discriminator value. Required. Parse the output as a JSON document using the configured + JSON parameters.""" + jsonParameters: Required["McpServerOutputParsingJsonParameters"] + """Parameters for JSON output parsing. Required when kind is 'json'. Required.""" + + +McpServerKnowledgeSource = TypedDict( + "McpServerKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.MCP_SERVER]], + "mcpServerParameters": Required["McpServerKnowledgeSourceParameters"], + }, + total=False, +) +McpServerKnowledgeSource.__doc__ = """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 resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: The discriminator value. Required. A knowledge source backed by an MCP (Model + Context Protocol) server. +:vartype kind: Literal[KnowledgeSourceKind.MCP_SERVER] +:ivar mcpServerParameters: The parameters for the MCP server knowledge source. Required. +:vartype mcpServerParameters: "McpServerKnowledgeSourceParameters" +""" + + +class McpServerKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for an MCP server knowledge source. + + :ivar serverURL: The URL of the MCP server endpoint. Required. + :vartype serverURL: str + :ivar authentication: The authentication configuration for the MCP server. + :vartype authentication: "McpServerAuthentication" + :ivar tools: The list of tools to invoke on the MCP server. Required. + :vartype tools: list["McpServerTool"] + """ + + serverURL: Required[str] + """The URL of the MCP server endpoint. Required.""" + authentication: "McpServerAuthentication" + """The authentication configuration for the MCP server.""" + tools: Required[list["McpServerTool"]] + """The list of tools to invoke on the MCP server. Required.""" + + +class McpServerNoneOutputParsing(TypedDict, total=False): + """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: Literal[McpServerOutputParsingKind.NONE] + """ + + kind: Required[Literal[McpServerOutputParsingKind.NONE]] + """The discriminator value. Required. Treat the output as a single block without any parsing.""" + + +class McpServerOutputParsingJsonParameters(TypedDict, total=False): + """Parameters for JSON output parsing. + + :ivar documentsPath: The JSON path to the array of documents in the tool output. Required. + :vartype documentsPath: str + :ivar includeContext: Whether to include surrounding context from the JSON output alongside + extracted documents. + :vartype includeContext: bool + """ + + documentsPath: Required[str] + """The JSON path to the array of documents in the tool output. Required.""" + includeContext: bool + """Whether to include surrounding context from the JSON output alongside extracted documents.""" + + +class McpServerOutputParsingSplitParameters(TypedDict, total=False): + """Parameters for split output parsing. + + :ivar textSplitMode: The text split mode to use. Known values are: "pages" and "sentences". + :vartype textSplitMode: Union[str, "TextSplitMode"] + :ivar maximumPageLength: The maximum number of characters per page. + :vartype maximumPageLength: int + :ivar pageOverlapLength: The number of characters to overlap between pages. + :vartype pageOverlapLength: int + :ivar maximumPagesToTake: The maximum number of pages to take from the output. + :vartype maximumPagesToTake: int + :ivar defaultLanguageCode: 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 defaultLanguageCode: Union[str, "SplitSkillLanguage"] + """ + + textSplitMode: Union[str, "TextSplitMode"] + """The text split mode to use. Known values are: \"pages\" and \"sentences\".""" + maximumPageLength: int + """The maximum number of characters per page.""" + pageOverlapLength: int + """The number of characters to overlap between pages.""" + maximumPagesToTake: int + """The maximum number of pages to take from the output.""" + defaultLanguageCode: Union[str, "SplitSkillLanguage"] + """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\".""" + + +class McpServerSplitOutputParsing(TypedDict, total=False): + """Split the output into pages using the configured split parameters. + + :ivar kind: The discriminator value. Required. Split the output into pages using the configured + split parameters. + :vartype kind: Literal[McpServerOutputParsingKind.SPLIT] + :ivar splitParameters: Parameters for split output parsing. + :vartype splitParameters: "McpServerOutputParsingSplitParameters" + """ + + kind: Required[Literal[McpServerOutputParsingKind.SPLIT]] + """The discriminator value. Required. Split the output into pages using the configured split + parameters.""" + splitParameters: "McpServerOutputParsingSplitParameters" + """Parameters for split output parsing.""" + + +class McpServerStoredHeadersAuthentication(TypedDict, total=False): + """Authentication using stored HTTP headers. + + :ivar kind: The discriminator value. Required. Authenticate using stored HTTP headers. + :vartype kind: Literal[McpServerAuthenticationKind.STORED_HEADERS] + :ivar storedHeadersParameters: Parameters for stored headers authentication. Required. + :vartype storedHeadersParameters: "McpServerStoredHeadersParameters" + """ + + kind: Required[Literal[McpServerAuthenticationKind.STORED_HEADERS]] + """The discriminator value. Required. Authenticate using stored HTTP headers.""" + storedHeadersParameters: Required["McpServerStoredHeadersParameters"] + """Parameters for stored headers authentication. Required.""" + + +class McpServerStoredHeadersParameters(TypedDict, total=False): + """Parameters for stored headers authentication. + + :ivar headers: The stored HTTP headers to include in MCP server requests. + :vartype headers: "McpServerHeaders" + """ + + headers: "McpServerHeaders" + """The stored HTTP headers to include in MCP server requests.""" + + +class McpServerTool(TypedDict, total=False): + """Represents a single tool within an MCP server knowledge source. + + :ivar name: The name of the MCP tool to invoke. + :vartype name: str + :ivar outputParsing: Optional configuration for parsing the tool's output. + :vartype outputParsing: "McpServerOutputParsing" + :ivar resultsProcessing: Controls whether the parsed results from this tool are reranked. + Defaults to 'rerank' when not specified. Known values are: "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputTokens: Optional post-parsing token cap for this tool's output. Must be greater + than 0 when specified. + :vartype maxOutputTokens: int + """ + + name: str + """The name of the MCP tool to invoke.""" + outputParsing: "McpServerOutputParsing" + """Optional configuration for parsing the tool's output.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Controls whether the parsed results from this tool are reranked. Defaults to 'rerank' when not + specified. Known values are: \"rerank\" and \"none\".""" + maxOutputTokens: int + """Optional post-parsing token cap for this tool's output. Must be greater than 0 when specified.""" + + +MergeSkill = TypedDict( + "MergeSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "insertPreTag": str, + "insertPostTag": str, + "@odata.type": Required[Literal["#Microsoft.Skills.Text.MergeSkill"]], + }, + total=False, +) +MergeSkill.__doc__ = """A skill for merging two or more strings into a single unified string, with an optional +user-defined delimiter separating each component part. + +: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["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["OutputFieldMappingEntry"] +:ivar insertPreTag: The tag indicates the start of the merged text. By default, the tag is an + empty space. +:vartype insertPreTag: str +:ivar insertPostTag: The tag indicates the end of the merged text. By default, the tag is an + empty space. +:vartype insertPostTag: str +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.MergeSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.MergeSkill"] +""" + + +MicrosoftLanguageStemmingTokenizer = TypedDict( + "MicrosoftLanguageStemmingTokenizer", + { + "name": Required[str], + "maxTokenLength": int, + "isSearchTokenizer": bool, + "language": Union[str, "MicrosoftStemmingTokenizerLanguage"], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer"]], + }, + total=False, +) +MicrosoftLanguageStemmingTokenizer.__doc__ = """Divides text using language-specific rules and reduces words to their base forms. + +: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 maxTokenLength: The maximum token length. Tokens longer than the maximum length are + split. Maximum token length that can be used is 300 characters. Tokens longer than 300 + characters are first split into tokens of length 300 and then each of those tokens is split + based on the max token length set. Default is 255. +:vartype maxTokenLength: int +:ivar isSearchTokenizer: A value indicating how the tokenizer is used. Set to true if used as + the search tokenizer, set to false if used as the indexing tokenizer. Default is false. +:vartype isSearchTokenizer: bool +:ivar language: The language to use. The default is English. Known values are: "arabic", + "bangla", "bulgarian", "catalan", "croatian", "czech", "danish", "dutch", "english", + "estonian", "finnish", "french", "german", "greek", "gujarati", "hebrew", "hindi", "hungarian", + "icelandic", "indonesian", "italian", "kannada", "latvian", "lithuanian", "malay", "malayalam", + "marathi", "norwegianBokmaal", "polish", "portuguese", "portugueseBrazilian", "punjabi", + "romanian", "russian", "serbianCyrillic", "serbianLatin", "slovak", "slovenian", "spanish", + "swedish", "tamil", "telugu", "turkish", "ukrainian", and "urdu". +:vartype language: Union[str, "MicrosoftStemmingTokenizerLanguage"] +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.MicrosoftLanguageStemmingTokenizer"] +""" + + +MicrosoftLanguageTokenizer = TypedDict( + "MicrosoftLanguageTokenizer", + { + "name": Required[str], + "maxTokenLength": int, + "isSearchTokenizer": bool, + "language": Union[str, "MicrosoftTokenizerLanguage"], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.MicrosoftLanguageTokenizer"]], + }, + total=False, +) +MicrosoftLanguageTokenizer.__doc__ = """Divides text using language-specific rules. + +: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 maxTokenLength: The maximum token length. Tokens longer than the maximum length are + split. Maximum token length that can be used is 300 characters. Tokens longer than 300 + characters are first split into tokens of length 300 and then each of those tokens is split + based on the max token length set. Default is 255. +:vartype maxTokenLength: int +:ivar isSearchTokenizer: A value indicating how the tokenizer is used. Set to true if used as + the search tokenizer, set to false if used as the indexing tokenizer. Default is false. +:vartype isSearchTokenizer: bool +:ivar language: The language to use. The default is English. Known values are: "bangla", + "bulgarian", "catalan", "chineseSimplified", "chineseTraditional", "croatian", "czech", + "danish", "dutch", "english", "french", "german", "greek", "gujarati", "hindi", "icelandic", + "indonesian", "italian", "japanese", "kannada", "korean", "malay", "malayalam", "marathi", + "norwegianBokmaal", "polish", "portuguese", "portugueseBrazilian", "punjabi", "romanian", + "russian", "serbianCyrillic", "serbianLatin", "slovenian", "spanish", "swedish", "tamil", + "telugu", "thai", "ukrainian", "urdu", and "vietnamese". +:vartype language: Union[str, "MicrosoftTokenizerLanguage"] +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.MicrosoftLanguageTokenizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.MicrosoftLanguageTokenizer"] +""" + + +NativeBlobSoftDeleteDeletionDetectionPolicy = TypedDict( + "NativeBlobSoftDeleteDeletionDetectionPolicy", + { + "@odata.type": Required[Literal["#Microsoft.Azure.Search.NativeBlobSoftDeleteDeletionDetectionPolicy"]], + }, + total=False, +) +NativeBlobSoftDeleteDeletionDetectionPolicy.__doc__ = """Defines a data deletion detection policy utilizing Azure Blob Storage's native soft delete +feature for deletion detection. + +:ivar ``@odata.type``: A URI fragment specifying the type of data deletion detection policy. + Required. Default value is + "#Microsoft.Azure.Search.NativeBlobSoftDeleteDeletionDetectionPolicy". +:vartype ``@odata.type``: + Literal["#Microsoft.Azure.Search.NativeBlobSoftDeleteDeletionDetectionPolicy"] +""" + + +NGramTokenFilter = TypedDict( + "NGramTokenFilter", + { + "name": Required[str], + "minGram": int, + "maxGram": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.NGramTokenFilter"]], + }, + total=False, +) +NGramTokenFilter.__doc__ = """Generates n-grams of the given size(s). This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 minGram: The minimum n-gram length. Default is 1. Must be less than the value of maxGram. +:vartype minGram: int +:ivar maxGram: The maximum n-gram length. Default is 2. +:vartype maxGram: int +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.NGramTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.NGramTokenFilter"] +""" + + +NGramTokenFilterV2 = TypedDict( + "NGramTokenFilterV2", + { + "name": Required[str], + "minGram": int, + "maxGram": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.NGramTokenFilterV2"]], + }, + total=False, +) +NGramTokenFilterV2.__doc__ = """Generates n-grams of the given size(s). This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 minGram: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the + value of maxGram. +:vartype minGram: int +:ivar maxGram: The maximum n-gram length. Default is 2. Maximum is 300. +:vartype maxGram: int +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.NGramTokenFilterV2". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.NGramTokenFilterV2"] +""" + + +NGramTokenizer = TypedDict( + "NGramTokenizer", + { + "name": Required[str], + "minGram": int, + "maxGram": int, + "tokenChars": list[Union[str, "TokenCharacterKind"]], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.NGramTokenizer"]], + }, + total=False, +) +NGramTokenizer.__doc__ = """Tokenizes the input into n-grams of the given size(s). 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 minGram: The minimum n-gram length. Default is 1. Maximum is 300. Must be less than the + value of maxGram. +:vartype minGram: int +:ivar maxGram: The maximum n-gram length. Default is 2. Maximum is 300. +:vartype maxGram: int +:ivar tokenChars: Character classes to keep in the tokens. +:vartype tokenChars: list[Union[str, "TokenCharacterKind"]] +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.NGramTokenizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.NGramTokenizer"] +""" + + +OcrSkill = TypedDict( + "OcrSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultLanguageCode": Union[str, "OcrSkillLanguage"], + "detectOrientation": bool, + "lineEnding": Union[str, "OcrLineEnding"], + "@odata.type": Required[Literal["#Microsoft.Skills.Vision.OcrSkill"]], + }, + total=False, +) +OcrSkill.__doc__ = """A skill that extracts text from image files. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultLanguageCode: A value indicating which language code to use. Default is ``en``. + Known values are: "af", "sq", "anp", "ar", "ast", "awa", "az", "bfy", "eu", "be", "be-cyrl", + "be-latn", "bho", "bi", "brx", "bs", "bra", "br", "bg", "bns", "bua", "ca", "ceb", "rab", "ch", + "hne", "zh-Hans", "zh-Hant", "kw", "co", "crh", "hr", "cs", "da", "prs", "dhi", "doi", "nl", + "en", "myv", "et", "fo", "fj", "fil", "fi", "fr", "fur", "gag", "gl", "de", "gil", "gon", "el", + "kl", "gvr", "ht", "hlb", "hni", "bgc", "haw", "hi", "mww", "hoc", "hu", "is", "smn", "id", + "ia", "iu", "ga", "it", "ja", "Jns", "jv", "kea", "kac", "xnr", "krc", "kaa-cyrl", "kaa", + "csb", "kk-cyrl", "kk-latn", "klr", "kha", "quc", "ko", "kfq", "kpy", "kos", "kum", "ku-arab", + "ku-latn", "kru", "ky", "lkt", "la", "lt", "dsb", "smj", "lb", "bfz", "ms", "mt", "kmj", "gv", + "mi", "mr", "mn", "cnr-cyrl", "cnr-latn", "nap", "ne", "niu", "nog", "sme", "nb", "no", "oc", + "os", "ps", "fa", "pl", "pt", "pa", "ksh", "ro", "rm", "ru", "sck", "sm", "sa", "sat", "sco", + "gd", "sr", "sr-Cyrl", "sr-Latn", "xsr", "srx", "sms", "sk", "sl", "so", "sma", "es", "sw", + "sv", "tg", "tt", "tet", "thf", "to", "tr", "tk", "tyv", "hsb", "ur", "ug", "uz-arab", + "uz-cyrl", "uz", "vo", "wae", "cy", "fy", "yua", "za", "zu", and "unk". +:vartype defaultLanguageCode: Union[str, "OcrSkillLanguage"] +:ivar detectOrientation: A value indicating to turn orientation detection on or not. Default is + false. +:vartype detectOrientation: bool +:ivar lineEnding: Defines the sequence of characters to use between the lines of text + recognized by the OCR skill. The default value is "space". Known values are: "space", + "carriageReturn", "lineFeed", and "carriageReturnLineFeed". +:vartype lineEnding: Union[str, "OcrLineEnding"] +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Vision.OcrSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Vision.OcrSkill"] +""" + + +class OutputFieldMappingEntry(TypedDict, total=False): + """Output field mapping for a skill. + + :ivar name: The name of the output defined by the skill. Required. + :vartype name: str + :ivar targetName: The target name of the output. It is optional and default to name. + :vartype targetName: str + """ + + name: Required[str] + """The name of the output defined by the skill. Required.""" + targetName: str + """The target name of the output. It is optional and default to name.""" + + +PathHierarchyTokenizerV2 = TypedDict( + "PathHierarchyTokenizerV2", + { + "name": Required[str], + "delimiter": str, + "replacement": str, + "maxTokenLength": int, + "reverse": bool, + "skip": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.PathHierarchyTokenizerV2"]], + }, + total=False, +) +PathHierarchyTokenizerV2.__doc__ = """Tokenizer for path-like hierarchies. 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 delimiter: The delimiter character to use. Default is "/". +:vartype delimiter: str +:ivar replacement: A value that, if set, replaces the delimiter character. Default is "/". +:vartype replacement: str +:ivar maxTokenLength: The maximum token length. Default and maximum is 300. +:vartype maxTokenLength: int +:ivar reverse: A value indicating whether to generate tokens in reverse order. Default is + false. +:vartype reverse: bool +:ivar skip: The number of initial tokens to skip. Default is 0. +:vartype skip: int +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.PathHierarchyTokenizerV2". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.PathHierarchyTokenizerV2"] +""" + + +PatternAnalyzer = TypedDict( + "PatternAnalyzer", + { + "name": Required[str], + "lowercase": bool, + "pattern": str, + "flags": list[Union[str, "RegexFlags"]], + "stopwords": list[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.PatternAnalyzer"]], + }, + total=False, +) +PatternAnalyzer.__doc__ = """Flexibly separates text into terms via a regular expression pattern. This analyzer is +implemented using Apache Lucene. + +:ivar name: The name of the analyzer. 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 lowercase: A value indicating whether terms should be lower-cased. Default is true. +:vartype lowercase: bool +:ivar pattern: A regular expression pattern to match token separators. Default is an expression + that matches one or more non-word characters. +:vartype pattern: str +:ivar flags: Regular expression flags, specified as a '|' separated string of RegexFlags + values. +:vartype flags: list[Union[str, "RegexFlags"]] +:ivar stopwords: A list of stopwords. +:vartype stopwords: list[str] +:ivar ``@odata.type``: A URI fragment specifying the type of analyzer. Required. Default value + is "#Microsoft.Azure.Search.PatternAnalyzer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.PatternAnalyzer"] +""" + + +PatternCaptureTokenFilter = TypedDict( + "PatternCaptureTokenFilter", + { + "name": Required[str], + "patterns": Required[list[str]], + "preserveOriginal": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.PatternCaptureTokenFilter"]], + }, + total=False, +) +PatternCaptureTokenFilter.__doc__ = """Uses Java regexes to emit multiple tokens - one for each capture group in one or more patterns. +This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 patterns: A list of patterns to match against each token. Required. +:vartype patterns: list[str] +:ivar preserveOriginal: A value indicating whether to return the original token even if one of + the patterns matches. Default is true. +:vartype preserveOriginal: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.PatternCaptureTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.PatternCaptureTokenFilter"] +""" + + +PatternReplaceCharFilter = TypedDict( + "PatternReplaceCharFilter", + { + "name": Required[str], + "pattern": Required[str], + "replacement": Required[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.PatternReplaceCharFilter"]], + }, + total=False, +) +PatternReplaceCharFilter.__doc__ = """A character filter that replaces characters in the input string. It uses a regular expression +to identify character sequences to preserve and a replacement pattern to identify characters to +replace. For example, given the input text "aa bb aa bb", pattern "(aa)\\\\s+(bb)", and +replacement "$1#$2", the result would be "aa#bb aa#bb". 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 pattern: A regular expression pattern. Required. +:vartype pattern: str +:ivar replacement: The replacement text. Required. +:vartype replacement: str +:ivar ``@odata.type``: A URI fragment specifying the type of char filter. Required. Default + value is "#Microsoft.Azure.Search.PatternReplaceCharFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.PatternReplaceCharFilter"] +""" + + +PatternReplaceTokenFilter = TypedDict( + "PatternReplaceTokenFilter", + { + "name": Required[str], + "pattern": Required[str], + "replacement": Required[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.PatternReplaceTokenFilter"]], + }, + total=False, +) +PatternReplaceTokenFilter.__doc__ = """A character filter that replaces characters in the input string. It uses a regular expression +to identify character sequences to preserve and a replacement pattern to identify characters to +replace. For example, given the input text "aa bb aa bb", pattern "(aa)\\\\s+(bb)", and +replacement "$1#$2", the result would be "aa#bb aa#bb". This token filter is implemented using +Apache Lucene. + +:ivar name: The name of the token 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 pattern: A regular expression pattern. Required. +:vartype pattern: str +:ivar replacement: The replacement text. Required. +:vartype replacement: str +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.PatternReplaceTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.PatternReplaceTokenFilter"] +""" + + +PatternTokenizer = TypedDict( + "PatternTokenizer", + { + "name": Required[str], + "pattern": str, + "flags": list[Union[str, "RegexFlags"]], + "group": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.PatternTokenizer"]], + }, + total=False, +) +PatternTokenizer.__doc__ = """Tokenizer that uses regex pattern matching to construct distinct tokens. 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 pattern: A regular expression pattern to match token separators. Default is an expression + that matches one or more non-word characters. +:vartype pattern: str +:ivar flags: Regular expression flags, specified as a '|' separated string of RegexFlags + values. +:vartype flags: list[Union[str, "RegexFlags"]] +:ivar group: The zero-based ordinal of the matching group in the regular expression pattern to + extract into tokens. Use -1 if you want to use the entire pattern to split the input into + tokens, irrespective of matching groups. Default is -1. +:vartype group: int +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.PatternTokenizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.PatternTokenizer"] +""" + + +PhoneticTokenFilter = TypedDict( + "PhoneticTokenFilter", + { + "name": Required[str], + "encoder": Union[str, "PhoneticEncoder"], + "replace": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.PhoneticTokenFilter"]], + }, + total=False, +) +PhoneticTokenFilter.__doc__ = """Create tokens for phonetic matches. This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 encoder: The phonetic encoder to use. Default is "metaphone". Known values are: + "metaphone", "doubleMetaphone", "soundex", "refinedSoundex", "caverphone1", "caverphone2", + "cologne", "nysiis", "koelnerPhonetik", "haasePhonetik", and "beiderMorse". +:vartype encoder: Union[str, "PhoneticEncoder"] +:ivar replace: A value indicating whether encoded tokens should replace original tokens. If + false, encoded tokens are added as synonyms. Default is true. +:vartype replace: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.PhoneticTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.PhoneticTokenFilter"] +""" + + +PIIDetectionSkill = TypedDict( + "PIIDetectionSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultLanguageCode": Optional[str], + "minimumPrecision": float, + "maskingMode": Union[str, "PIIDetectionSkillMaskingMode"], + "maskingCharacter": str, + "modelVersion": Optional[str], + "piiCategories": list[str], + "domain": Optional[str], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.PIIDetectionSkill"]], + }, + total=False, +) +PIIDetectionSkill.__doc__ = """Using the Text Analytics API, extracts personal information from an input text and gives you +the option of masking it. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultLanguageCode: A value indicating which language code to use. Default is ``en``. +:vartype defaultLanguageCode: str +:ivar minimumPrecision: 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. +:vartype minimumPrecision: float +:ivar maskingMode: 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". +:vartype maskingMode: Union[str, "PIIDetectionSkillMaskingMode"] +:ivar maskingCharacter: The character used to mask the text if the maskingMode parameter is set + to replace. Default is '*'. +:vartype maskingCharacter: str +:ivar modelVersion: 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. +:vartype modelVersion: str +:ivar piiCategories: A list of PII entity categories that should be extracted and masked. +:vartype piiCategories: list[str] +:ivar domain: If specified, will set the PII domain to include only a subset of the entity + categories. Possible values include: 'phi', 'none'. Default is 'none'. +:vartype domain: str +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.PIIDetectionSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.PIIDetectionSkill"] +""" + + +RemoteSharePointKnowledgeSource = TypedDict( + "RemoteSharePointKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT]], + "remoteSharePointParameters": "RemoteSharePointKnowledgeSourceParameters", + }, + total=False, +) +RemoteSharePointKnowledgeSource.__doc__ = """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 resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: Required. A knowledge source that reads data from remote SharePoint. +:vartype kind: Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT] +:ivar remoteSharePointParameters: The parameters for the remote SharePoint knowledge source. +:vartype remoteSharePointParameters: "RemoteSharePointKnowledgeSourceParameters" +""" + + +class RemoteSharePointKnowledgeSourceParameters(TypedDict, total=False): # pylint: disable=name-too-long + """Parameters for remote SharePoint knowledge source. + + :ivar filterExpression: Keyword Query Language (KQL) expression with queryable SharePoint + properties and attributes to scope the retrieval before the query runs. + :vartype filterExpression: str + :ivar resourceMetadata: 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 resourceMetadata: list[str] + :ivar containerTypeId: Container ID for SharePoint Embedded connection. When this is null, it + will use SharePoint Online. + :vartype containerTypeId: str + """ + + filterExpression: str + """Keyword Query Language (KQL) expression with queryable SharePoint properties and attributes to + scope the retrieval before the query runs.""" + resourceMetadata: list[str] + """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.""" + containerTypeId: str + """Container ID for SharePoint Embedded connection. When this is null, it will use SharePoint + Online.""" + + +class RescoringOptions(TypedDict, total=False): + """Contains the options for rescoring. + + :ivar enableRescoring: If set to true, after the initial search on the compressed vectors, the + similarity scores are recalculated using the full-precision vectors. This will improve recall + at the expense of latency. + :vartype enableRescoring: bool + :ivar defaultOversampling: Default oversampling factor. Oversampling retrieves a greater set of + potential documents to offset the resolution loss due to quantization. This increases the set + of results that will be rescored on full-precision vectors. Minimum value is 1, meaning no + oversampling (1x). This parameter can only be set when 'enableRescoring' is true. Higher values + improve recall at the expense of latency. + :vartype defaultOversampling: float + :ivar rescoreStorageMethod: Controls the storage method for original vectors. This setting is + immutable. Known values are: "preserveOriginals" and "discardOriginals". + :vartype rescoreStorageMethod: Union[str, "VectorSearchCompressionRescoreStorageMethod"] + """ + + enableRescoring: Optional[bool] + """If set to true, after the initial search on the compressed vectors, the similarity scores are + recalculated using the full-precision vectors. This will improve recall at the expense of + latency.""" + defaultOversampling: Optional[float] + """Default oversampling factor. Oversampling retrieves a greater set of potential documents to + offset the resolution loss due to quantization. This increases the set of results that will be + rescored on full-precision vectors. Minimum value is 1, meaning no oversampling (1x). This + parameter can only be set when 'enableRescoring' is true. Higher values improve recall at the + expense of latency.""" + rescoreStorageMethod: Optional[Union[str, "VectorSearchCompressionRescoreStorageMethod"]] + """Controls the storage method for original vectors. This setting is immutable. Known values are: + \"preserveOriginals\" and \"discardOriginals\".""" + + +class ScalarQuantizationCompression(TypedDict, total=False): + """Contains configuration options specific to the scalar quantization compression method used + during indexing and querying. + + :ivar name: The name to associate with this particular configuration. Required. + :vartype name: str + :ivar rescoringOptions: Contains the options for rescoring. + :vartype rescoringOptions: "RescoringOptions" + :ivar truncationDimension: The number of dimensions to truncate the vectors to. Truncating the + vectors reduces the size of the vectors and the amount of data that needs to be transferred + during search. This can save storage cost and improve search performance at the expense of + recall. It should be only used for embeddings trained with Matryoshka Representation Learning + (MRL) such as OpenAI text-embedding-3-large (small). The default value is null, which means no + truncation. + :vartype truncationDimension: int + :ivar scalarQuantizationParameters: Contains the parameters specific to Scalar Quantization. + :vartype scalarQuantizationParameters: "ScalarQuantizationParameters" + :ivar kind: The name of the kind of compression method being configured for use with vector + search. Required. Scalar Quantization, a type of compression method. In scalar quantization, + the original vectors values are compressed to a narrower type by discretizing and representing + each component of a vector using a reduced set of quantized values, thereby reducing the + overall data size. + :vartype kind: Literal[VectorSearchCompressionKind.SCALAR_QUANTIZATION] + """ + + name: Required[str] + """The name to associate with this particular configuration. Required.""" + rescoringOptions: Optional["RescoringOptions"] + """Contains the options for rescoring.""" + truncationDimension: Optional[int] + """The number of dimensions to truncate the vectors to. Truncating the vectors reduces the size of + the vectors and the amount of data that needs to be transferred during search. This can save + storage cost and improve search performance at the expense of recall. It should be only used + for embeddings trained with Matryoshka Representation Learning (MRL) such as OpenAI + text-embedding-3-large (small). The default value is null, which means no truncation.""" + scalarQuantizationParameters: "ScalarQuantizationParameters" + """Contains the parameters specific to Scalar Quantization.""" + kind: Required[Literal[VectorSearchCompressionKind.SCALAR_QUANTIZATION]] + """The name of the kind of compression method being configured for use with vector search. + Required. Scalar Quantization, a type of compression method. In scalar quantization, the + original vectors values are compressed to a narrower type by discretizing and representing each + component of a vector using a reduced set of quantized values, thereby reducing the overall + data size.""" + + +class ScalarQuantizationParameters(TypedDict, total=False): + """Contains the parameters specific to Scalar Quantization. + + :ivar quantizedDataType: The quantized data type of compressed vector values. "int8" + :vartype quantizedDataType: Union[str, "VectorSearchCompressionTarget"] + """ + + quantizedDataType: Optional[Union[str, "VectorSearchCompressionTarget"]] + """The quantized data type of compressed vector values. \"int8\"""" + + +class ScoringProfile(TypedDict, total=False): + """Defines parameters for a search index that influence scoring in search queries. + + :ivar name: The name of the scoring profile. Required. + :vartype name: str + :ivar text: Parameters that boost scoring based on text matches in certain index fields. + :vartype text: "TextWeights" + :ivar functions: The collection of functions that influence the scoring of documents. + :vartype functions: list["ScoringFunction"] + :ivar functionAggregation: A value indicating how the results of individual scoring functions + should be combined. Defaults to "Sum". Ignored if there are no scoring functions. Known values + are: "sum", "average", "minimum", "maximum", "firstMatching", and "product". + :vartype functionAggregation: Union[str, "ScoringFunctionAggregation"] + """ + + name: Required[str] + """The name of the scoring profile. Required.""" + text: Optional["TextWeights"] + """Parameters that boost scoring based on text matches in certain index fields.""" + functions: list["ScoringFunction"] + """The collection of functions that influence the scoring of documents.""" + functionAggregation: Union[str, "ScoringFunctionAggregation"] + """A value indicating how the results of individual scoring functions should be combined. Defaults + to \"Sum\". Ignored if there are no scoring functions. Known values are: \"sum\", \"average\", + \"minimum\", \"maximum\", \"firstMatching\", and \"product\".""" + + +SearchAlias = TypedDict( + "SearchAlias", + { + "name": Required[str], + "indexes": Required[list[str]], + "@odata.etag": str, + }, + total=False, +) +SearchAlias.__doc__ = """Represents an index alias, which describes a mapping from the alias name to an index. The alias +name can be used in place of the index name for supported operations. + +:ivar name: The name of the alias. Required. +:vartype name: str +:ivar indexes: The name of the index this alias maps to. Only one index name may be specified. + Required. +:vartype indexes: list[str] +:ivar ``@odata.etag``: The ETag of the alias. +:vartype ``@odata.etag``: str +""" + + +class SearchField(TypedDict, total=False): + """Represents a field in an index definition, which describes the name, data type, and search + behavior of a field. + + :ivar name: The name of the field, which must be unique within the fields collection of the + index or parent field. Required. + :vartype name: str + :ivar type: The data type of the field. Required. Known values are: "Edm.String", "Edm.Int32", + "Edm.Int64", "Edm.Double", "Edm.Boolean", "Edm.DateTimeOffset", "Edm.GeographyPoint", + "Edm.ComplexType", "Edm.Single", "Edm.Half", "Edm.Int16", "Edm.SByte", and "Edm.Byte". + :vartype type: Union[str, "SearchFieldDataType"] + :ivar key: A value indicating whether the field uniquely identifies documents in the index. + Exactly one top-level field in each index must be chosen as the key field and it must be of + type Edm.String. Key fields can be used to look up documents directly and update or delete + specific documents. Default is false for simple fields and null for complex fields. + :vartype key: bool + :ivar retrievable: A value indicating whether the field can be returned in a search result. You + can disable this option if you want to use a field (for example, margin) as a filter, sorting, + or scoring mechanism but do not want the field to be visible to the end user. This property + must be true for key fields, and it must be null for complex fields. This property can be + changed on existing fields. Enabling this property does not cause any increase in index storage + requirements. Default is true for simple fields, false for vector fields, and null for complex + fields. + :vartype retrievable: bool + :ivar stored: An immutable value indicating whether the field will be persisted separately on + disk to be returned in a search result. You can disable this option if you don't plan to return + the field contents in a search response to save on storage overhead. This can only be set + during index creation and only for vector fields. This property cannot be changed for existing + fields or set as false for new fields. If this property is set as false, the property + 'retrievable' must also be set to false. This property must be true or unset for key fields, + for new fields, and for non-vector fields, and it must be null for complex fields. Disabling + this property will reduce index storage requirements. The default is true for vector fields. + :vartype stored: bool + :ivar searchable: A value indicating whether the field is full-text searchable. This means it + will undergo analysis such as word-breaking during indexing. If you set a searchable field to a + value like "sunny day", internally it will be split into the individual tokens "sunny" and + "day". This enables full-text searches for these terms. Fields of type Edm.String or + Collection(Edm.String) are searchable by default. This property must be false for simple fields + of other non-string data types, and it must be null for complex fields. Note: searchable fields + consume extra space in your index to accommodate additional tokenized versions of the field + value for full-text searches. If you want to save space in your index and you don't need a + field to be included in searches, set searchable to false. + :vartype searchable: bool + :ivar filterable: A value indicating whether to enable the field to be referenced in $filter + queries. filterable differs from searchable in how strings are handled. Fields of type + Edm.String or Collection(Edm.String) that are filterable do not undergo word-breaking, so + comparisons are for exact matches only. For example, if you set such a field f to "sunny day", + $filter=f eq 'sunny' will find no matches, but $filter=f eq 'sunny day' will. This property + must be null for complex fields. Default is true for simple fields and null for complex fields. + :vartype filterable: bool + :ivar sortable: A value indicating whether to enable the field to be referenced in $orderby + expressions. By default, the search engine sorts results by score, but in many experiences + users will want to sort by fields in the documents. A simple field can be sortable only if it + is single-valued (it has a single value in the scope of the parent document). Simple collection + fields cannot be sortable, since they are multi-valued. Simple sub-fields of complex + collections are also multi-valued, and therefore cannot be sortable. This is true whether it's + an immediate parent field, or an ancestor field, that's the complex collection. Complex fields + cannot be sortable and the sortable property must be null for such fields. The default for + sortable is true for single-valued simple fields, false for multi-valued simple fields, and + null for complex fields. + :vartype sortable: bool + :ivar facetable: A value indicating whether to enable the field to be referenced in facet + queries. Typically used in a presentation of search results that includes hit count by category + (for example, search for digital cameras and see hits by brand, by megapixels, by price, and so + on). This 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. + :vartype facetable: bool + :ivar permissionFilter: A value indicating whether the field should be used as a permission + filter. Known values are: "userIds", "groupIds", and "rbacScope". + :vartype permissionFilter: Union[str, "PermissionFilter"] + :ivar sensitivityLabelId: 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 sensitivityLabelId: bool + :ivar sensitivityLabelName: A value indicating whether the field contains the name of a + Microsoft Purview sensitivity label applied to the document. + :vartype sensitivityLabelName: bool + :ivar sourceDocumentId: A value indicating whether the field contains the source document + identifier used for Purview audit tracking. + :vartype sourceDocumentId: bool + :ivar sharepointSiteUrl: A value indicating whether the field contains a SharePoint site URL + used for SharePoint group-based filtering. + :vartype sharepointSiteUrl: bool + :ivar analyzer: 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 + for complex fields. Known values are: "ar.microsoft", "ar.lucene", "hy.lucene", "bn.microsoft", + "eu.lucene", "bg.microsoft", "bg.lucene", "ca.microsoft", "ca.lucene", "zh-Hans.microsoft", + "zh-Hans.lucene", "zh-Hant.microsoft", "zh-Hant.lucene", "hr.microsoft", "cs.microsoft", + "cs.lucene", "da.microsoft", "da.lucene", "nl.microsoft", "nl.lucene", "en.microsoft", + "en.lucene", "et.microsoft", "fi.microsoft", "fi.lucene", "fr.microsoft", "fr.lucene", + "gl.lucene", "de.microsoft", "de.lucene", "el.microsoft", "el.lucene", "gu.microsoft", + "he.microsoft", "hi.microsoft", "hi.lucene", "hu.microsoft", "hu.lucene", "is.microsoft", + "id.microsoft", "id.lucene", "ga.lucene", "it.microsoft", "it.lucene", "ja.microsoft", + "ja.lucene", "kn.microsoft", "ko.microsoft", "ko.lucene", "lv.microsoft", "lv.lucene", + "lt.microsoft", "ml.microsoft", "ms.microsoft", "mr.microsoft", "nb.microsoft", "no.lucene", + "fa.lucene", "pl.microsoft", "pl.lucene", "pt-BR.microsoft", "pt-BR.lucene", "pt-PT.microsoft", + "pt-PT.lucene", "pa.microsoft", "ro.microsoft", "ro.lucene", "ru.microsoft", "ru.lucene", + "sr-cyrillic.microsoft", "sr-latin.microsoft", "sk.microsoft", "sl.microsoft", "es.microsoft", + "es.lucene", "sv.microsoft", "sv.lucene", "ta.microsoft", "te.microsoft", "th.microsoft", + "th.lucene", "tr.microsoft", "tr.lucene", "uk.microsoft", "ur.microsoft", "vi.microsoft", + "standard.lucene", "standardasciifolding.lucene", "keyword", "pattern", "simple", "stop", and + "whitespace". + :vartype analyzer: Union[str, "LexicalAnalyzerName"] + :ivar searchAnalyzer: The name of the analyzer used at search time for the field. This option + can be used only with searchable fields. It must be set together with indexAnalyzer and it + cannot be set together with the analyzer option. This property cannot be set to the name of a + language analyzer; use the analyzer property instead if you need a language analyzer. This + analyzer can be updated on an existing field. Must be null for complex fields. Known values + are: "ar.microsoft", "ar.lucene", "hy.lucene", "bn.microsoft", "eu.lucene", "bg.microsoft", + "bg.lucene", "ca.microsoft", "ca.lucene", "zh-Hans.microsoft", "zh-Hans.lucene", + "zh-Hant.microsoft", "zh-Hant.lucene", "hr.microsoft", "cs.microsoft", "cs.lucene", + "da.microsoft", "da.lucene", "nl.microsoft", "nl.lucene", "en.microsoft", "en.lucene", + "et.microsoft", "fi.microsoft", "fi.lucene", "fr.microsoft", "fr.lucene", "gl.lucene", + "de.microsoft", "de.lucene", "el.microsoft", "el.lucene", "gu.microsoft", "he.microsoft", + "hi.microsoft", "hi.lucene", "hu.microsoft", "hu.lucene", "is.microsoft", "id.microsoft", + "id.lucene", "ga.lucene", "it.microsoft", "it.lucene", "ja.microsoft", "ja.lucene", + "kn.microsoft", "ko.microsoft", "ko.lucene", "lv.microsoft", "lv.lucene", "lt.microsoft", + "ml.microsoft", "ms.microsoft", "mr.microsoft", "nb.microsoft", "no.lucene", "fa.lucene", + "pl.microsoft", "pl.lucene", "pt-BR.microsoft", "pt-BR.lucene", "pt-PT.microsoft", + "pt-PT.lucene", "pa.microsoft", "ro.microsoft", "ro.lucene", "ru.microsoft", "ru.lucene", + "sr-cyrillic.microsoft", "sr-latin.microsoft", "sk.microsoft", "sl.microsoft", "es.microsoft", + "es.lucene", "sv.microsoft", "sv.lucene", "ta.microsoft", "te.microsoft", "th.microsoft", + "th.lucene", "tr.microsoft", "tr.lucene", "uk.microsoft", "ur.microsoft", "vi.microsoft", + "standard.lucene", "standardasciifolding.lucene", "keyword", "pattern", "simple", "stop", and + "whitespace". + :vartype searchAnalyzer: Union[str, "LexicalAnalyzerName"] + :ivar indexAnalyzer: The name of the analyzer used at indexing time for the field. This option + can be used only with searchable fields. It must be set together with searchAnalyzer and it + cannot be set together with the analyzer option. This property cannot be set to the name of a + language analyzer; use the analyzer property instead if you need a language analyzer. Once the + analyzer is chosen, it cannot be changed for the field. Must be null for complex fields. Known + values are: "ar.microsoft", "ar.lucene", "hy.lucene", "bn.microsoft", "eu.lucene", + "bg.microsoft", "bg.lucene", "ca.microsoft", "ca.lucene", "zh-Hans.microsoft", + "zh-Hans.lucene", "zh-Hant.microsoft", "zh-Hant.lucene", "hr.microsoft", "cs.microsoft", + "cs.lucene", "da.microsoft", "da.lucene", "nl.microsoft", "nl.lucene", "en.microsoft", + "en.lucene", "et.microsoft", "fi.microsoft", "fi.lucene", "fr.microsoft", "fr.lucene", + "gl.lucene", "de.microsoft", "de.lucene", "el.microsoft", "el.lucene", "gu.microsoft", + "he.microsoft", "hi.microsoft", "hi.lucene", "hu.microsoft", "hu.lucene", "is.microsoft", + "id.microsoft", "id.lucene", "ga.lucene", "it.microsoft", "it.lucene", "ja.microsoft", + "ja.lucene", "kn.microsoft", "ko.microsoft", "ko.lucene", "lv.microsoft", "lv.lucene", + "lt.microsoft", "ml.microsoft", "ms.microsoft", "mr.microsoft", "nb.microsoft", "no.lucene", + "fa.lucene", "pl.microsoft", "pl.lucene", "pt-BR.microsoft", "pt-BR.lucene", "pt-PT.microsoft", + "pt-PT.lucene", "pa.microsoft", "ro.microsoft", "ro.lucene", "ru.microsoft", "ru.lucene", + "sr-cyrillic.microsoft", "sr-latin.microsoft", "sk.microsoft", "sl.microsoft", "es.microsoft", + "es.lucene", "sv.microsoft", "sv.lucene", "ta.microsoft", "te.microsoft", "th.microsoft", + "th.lucene", "tr.microsoft", "tr.lucene", "uk.microsoft", "ur.microsoft", "vi.microsoft", + "standard.lucene", "standardasciifolding.lucene", "keyword", "pattern", "simple", "stop", and + "whitespace". + :vartype indexAnalyzer: Union[str, "LexicalAnalyzerName"] + :ivar normalizer: The name of the normalizer to use for the field. This option can be used only + with fields with filterable, sortable, or facetable enabled. Once the normalizer is chosen, it + cannot be changed for the field. Must be null for complex fields. Known values are: + "asciifolding", "elision", "lowercase", "standard", and "uppercase". + :vartype normalizer: Union[str, "LexicalNormalizerName"] + :ivar dimensions: The dimensionality of the vector field. + :vartype dimensions: int + :ivar vectorSearchProfile: The name of the vector search profile that specifies the algorithm + and vectorizer to use when searching the vector field. + :vartype vectorSearchProfile: str + :ivar vectorEncoding: The encoding format to interpret the field contents. "packedBit" + :vartype vectorEncoding: Union[str, "VectorEncodingFormat"] + :ivar synonymMaps: A list of the names of synonym maps to associate with this field. This + option can be used only with searchable fields. Currently only one synonym map per field is + supported. Assigning a synonym map to a field ensures that query terms targeting that field are + expanded at query-time using the rules in the synonym map. This attribute can be changed on + existing fields. Must be null or an empty collection for complex fields. + :vartype synonymMaps: list[str] + :ivar fields: A list of sub-fields if this is a field of type Edm.ComplexType or + Collection(Edm.ComplexType). Must be null or empty for simple fields. + :vartype fields: list["SearchField"] + """ + + name: Required[str] + """The name of the field, which must be unique within the fields collection of the index or parent + field. Required.""" + type: Required[Union[str, "SearchFieldDataType"]] + """The data type of the field. Required. Known values are: \"Edm.String\", \"Edm.Int32\", + \"Edm.Int64\", \"Edm.Double\", \"Edm.Boolean\", \"Edm.DateTimeOffset\", \"Edm.GeographyPoint\", + \"Edm.ComplexType\", \"Edm.Single\", \"Edm.Half\", \"Edm.Int16\", \"Edm.SByte\", and + \"Edm.Byte\".""" + key: bool + """A value indicating whether the field uniquely identifies documents in the index. Exactly one + top-level field in each index must be chosen as the key field and it must be of type + Edm.String. Key fields can be used to look up documents directly and update or delete specific + documents. Default is false for simple fields and null for complex fields.""" + retrievable: bool + """A value indicating whether the field can be returned in a search result. You can disable this + option if you want to use a field (for example, margin) as a filter, sorting, or scoring + mechanism but do not want the field to be visible to the end user. This property must be true + for key fields, and it must be null for complex fields. This property can be changed on + existing fields. Enabling this property does not cause any increase in index storage + requirements. Default is true for simple fields, false for vector fields, and null for complex + fields.""" + stored: bool + """An immutable value indicating whether the field will be persisted separately on disk to be + returned in a search result. You can disable this option if you don't plan to return the field + contents in a search response to save on storage overhead. This can only be set during index + creation and only for vector fields. This property cannot be changed for existing fields or set + as false for new fields. If this property is set as false, the property 'retrievable' must also + be set to false. This property must be true or unset for key fields, for new fields, and for + non-vector fields, and it must be null for complex fields. Disabling this property will reduce + index storage requirements. The default is true for vector fields.""" + searchable: bool + """A value indicating whether the field is full-text searchable. This means it will undergo + analysis such as word-breaking during indexing. If you set a searchable field to a value like + \"sunny day\", internally it will be split into the individual tokens \"sunny\" and \"day\". + This enables full-text searches for these terms. Fields of type Edm.String or + Collection(Edm.String) are searchable by default. This property must be false for simple fields + of other non-string data types, and it must be null for complex fields. Note: searchable fields + consume extra space in your index to accommodate additional tokenized versions of the field + value for full-text searches. If you want to save space in your index and you don't need a + field to be included in searches, set searchable to false.""" + filterable: bool + """A value indicating whether to enable the field to be referenced in $filter queries. filterable + differs from searchable in how strings are handled. Fields of type Edm.String or + Collection(Edm.String) that are filterable do not undergo word-breaking, so comparisons are for + exact matches only. For example, if you set such a field f to \"sunny day\", $filter=f eq + 'sunny' will find no matches, but $filter=f eq 'sunny day' will. This property must be null for + complex fields. Default is true for simple fields and null for complex fields.""" + sortable: bool + """A value indicating whether to enable the field to be referenced in $orderby expressions. By + default, the search engine sorts results by score, but in many experiences users will want to + sort by fields in the documents. A simple field can be sortable only if it is single-valued (it + has a single value in the scope of the parent document). Simple collection fields cannot be + sortable, since they are multi-valued. Simple sub-fields of complex collections are also + multi-valued, and therefore cannot be sortable. This is true whether it's an immediate parent + field, or an ancestor field, that's the complex collection. Complex fields cannot be sortable + and the sortable property must be null for such fields. The default for sortable is true for + single-valued simple fields, false for multi-valued simple fields, and null for complex fields.""" + facetable: bool + """A value indicating whether to enable the field to be referenced in facet queries. Typically + used in a presentation of search results that includes hit count by category (for example, + search for digital cameras and see hits by brand, by megapixels, by price, and so on). This + 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.""" + permissionFilter: Optional[Union[str, "PermissionFilter"]] + """A value indicating whether the field should be used as a permission filter. Known values are: + \"userIds\", \"groupIds\", and \"rbacScope\".""" + sensitivityLabelId: bool + """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.""" + sensitivityLabelName: bool + """A value indicating whether the field contains the name of a Microsoft Purview sensitivity label + applied to the document.""" + sourceDocumentId: bool + """A value indicating whether the field contains the source document identifier used for Purview + audit tracking.""" + sharepointSiteUrl: bool + """A value indicating whether the field contains a SharePoint site URL used for SharePoint + group-based filtering.""" + analyzer: Optional[Union[str, "LexicalAnalyzerName"]] + """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 for complex fields. Known + values are: \"ar.microsoft\", \"ar.lucene\", \"hy.lucene\", \"bn.microsoft\", \"eu.lucene\", + \"bg.microsoft\", \"bg.lucene\", \"ca.microsoft\", \"ca.lucene\", \"zh-Hans.microsoft\", + \"zh-Hans.lucene\", \"zh-Hant.microsoft\", \"zh-Hant.lucene\", \"hr.microsoft\", + \"cs.microsoft\", \"cs.lucene\", \"da.microsoft\", \"da.lucene\", \"nl.microsoft\", + \"nl.lucene\", \"en.microsoft\", \"en.lucene\", \"et.microsoft\", \"fi.microsoft\", + \"fi.lucene\", \"fr.microsoft\", \"fr.lucene\", \"gl.lucene\", \"de.microsoft\", \"de.lucene\", + \"el.microsoft\", \"el.lucene\", \"gu.microsoft\", \"he.microsoft\", \"hi.microsoft\", + \"hi.lucene\", \"hu.microsoft\", \"hu.lucene\", \"is.microsoft\", \"id.microsoft\", + \"id.lucene\", \"ga.lucene\", \"it.microsoft\", \"it.lucene\", \"ja.microsoft\", \"ja.lucene\", + \"kn.microsoft\", \"ko.microsoft\", \"ko.lucene\", \"lv.microsoft\", \"lv.lucene\", + \"lt.microsoft\", \"ml.microsoft\", \"ms.microsoft\", \"mr.microsoft\", \"nb.microsoft\", + \"no.lucene\", \"fa.lucene\", \"pl.microsoft\", \"pl.lucene\", \"pt-BR.microsoft\", + \"pt-BR.lucene\", \"pt-PT.microsoft\", \"pt-PT.lucene\", \"pa.microsoft\", \"ro.microsoft\", + \"ro.lucene\", \"ru.microsoft\", \"ru.lucene\", \"sr-cyrillic.microsoft\", + \"sr-latin.microsoft\", \"sk.microsoft\", \"sl.microsoft\", \"es.microsoft\", \"es.lucene\", + \"sv.microsoft\", \"sv.lucene\", \"ta.microsoft\", \"te.microsoft\", \"th.microsoft\", + \"th.lucene\", \"tr.microsoft\", \"tr.lucene\", \"uk.microsoft\", \"ur.microsoft\", + \"vi.microsoft\", \"standard.lucene\", \"standardasciifolding.lucene\", \"keyword\", + \"pattern\", \"simple\", \"stop\", and \"whitespace\".""" + searchAnalyzer: Optional[Union[str, "LexicalAnalyzerName"]] + """The name of the analyzer used at search time for the field. This option can be used only with + searchable fields. It must be set together with indexAnalyzer and it cannot be set together + with the analyzer option. This property cannot be set to the name of a language analyzer; use + the analyzer property instead if you need a language analyzer. This analyzer can be updated on + an existing field. Must be null for complex fields. Known values are: \"ar.microsoft\", + \"ar.lucene\", \"hy.lucene\", \"bn.microsoft\", \"eu.lucene\", \"bg.microsoft\", \"bg.lucene\", + \"ca.microsoft\", \"ca.lucene\", \"zh-Hans.microsoft\", \"zh-Hans.lucene\", + \"zh-Hant.microsoft\", \"zh-Hant.lucene\", \"hr.microsoft\", \"cs.microsoft\", \"cs.lucene\", + \"da.microsoft\", \"da.lucene\", \"nl.microsoft\", \"nl.lucene\", \"en.microsoft\", + \"en.lucene\", \"et.microsoft\", \"fi.microsoft\", \"fi.lucene\", \"fr.microsoft\", + \"fr.lucene\", \"gl.lucene\", \"de.microsoft\", \"de.lucene\", \"el.microsoft\", \"el.lucene\", + \"gu.microsoft\", \"he.microsoft\", \"hi.microsoft\", \"hi.lucene\", \"hu.microsoft\", + \"hu.lucene\", \"is.microsoft\", \"id.microsoft\", \"id.lucene\", \"ga.lucene\", + \"it.microsoft\", \"it.lucene\", \"ja.microsoft\", \"ja.lucene\", \"kn.microsoft\", + \"ko.microsoft\", \"ko.lucene\", \"lv.microsoft\", \"lv.lucene\", \"lt.microsoft\", + \"ml.microsoft\", \"ms.microsoft\", \"mr.microsoft\", \"nb.microsoft\", \"no.lucene\", + \"fa.lucene\", \"pl.microsoft\", \"pl.lucene\", \"pt-BR.microsoft\", \"pt-BR.lucene\", + \"pt-PT.microsoft\", \"pt-PT.lucene\", \"pa.microsoft\", \"ro.microsoft\", \"ro.lucene\", + \"ru.microsoft\", \"ru.lucene\", \"sr-cyrillic.microsoft\", \"sr-latin.microsoft\", + \"sk.microsoft\", \"sl.microsoft\", \"es.microsoft\", \"es.lucene\", \"sv.microsoft\", + \"sv.lucene\", \"ta.microsoft\", \"te.microsoft\", \"th.microsoft\", \"th.lucene\", + \"tr.microsoft\", \"tr.lucene\", \"uk.microsoft\", \"ur.microsoft\", \"vi.microsoft\", + \"standard.lucene\", \"standardasciifolding.lucene\", \"keyword\", \"pattern\", \"simple\", + \"stop\", and \"whitespace\".""" + indexAnalyzer: Optional[Union[str, "LexicalAnalyzerName"]] + """The name of the analyzer used at indexing time for the field. This option can be used only with + searchable fields. It must be set together with searchAnalyzer and it cannot be set together + with the analyzer option. This property cannot be set to the name of a language analyzer; use + the analyzer property instead if you need a language analyzer. Once the analyzer is chosen, it + cannot be changed for the field. Must be null for complex fields. Known values are: + \"ar.microsoft\", \"ar.lucene\", \"hy.lucene\", \"bn.microsoft\", \"eu.lucene\", + \"bg.microsoft\", \"bg.lucene\", \"ca.microsoft\", \"ca.lucene\", \"zh-Hans.microsoft\", + \"zh-Hans.lucene\", \"zh-Hant.microsoft\", \"zh-Hant.lucene\", \"hr.microsoft\", + \"cs.microsoft\", \"cs.lucene\", \"da.microsoft\", \"da.lucene\", \"nl.microsoft\", + \"nl.lucene\", \"en.microsoft\", \"en.lucene\", \"et.microsoft\", \"fi.microsoft\", + \"fi.lucene\", \"fr.microsoft\", \"fr.lucene\", \"gl.lucene\", \"de.microsoft\", \"de.lucene\", + \"el.microsoft\", \"el.lucene\", \"gu.microsoft\", \"he.microsoft\", \"hi.microsoft\", + \"hi.lucene\", \"hu.microsoft\", \"hu.lucene\", \"is.microsoft\", \"id.microsoft\", + \"id.lucene\", \"ga.lucene\", \"it.microsoft\", \"it.lucene\", \"ja.microsoft\", \"ja.lucene\", + \"kn.microsoft\", \"ko.microsoft\", \"ko.lucene\", \"lv.microsoft\", \"lv.lucene\", + \"lt.microsoft\", \"ml.microsoft\", \"ms.microsoft\", \"mr.microsoft\", \"nb.microsoft\", + \"no.lucene\", \"fa.lucene\", \"pl.microsoft\", \"pl.lucene\", \"pt-BR.microsoft\", + \"pt-BR.lucene\", \"pt-PT.microsoft\", \"pt-PT.lucene\", \"pa.microsoft\", \"ro.microsoft\", + \"ro.lucene\", \"ru.microsoft\", \"ru.lucene\", \"sr-cyrillic.microsoft\", + \"sr-latin.microsoft\", \"sk.microsoft\", \"sl.microsoft\", \"es.microsoft\", \"es.lucene\", + \"sv.microsoft\", \"sv.lucene\", \"ta.microsoft\", \"te.microsoft\", \"th.microsoft\", + \"th.lucene\", \"tr.microsoft\", \"tr.lucene\", \"uk.microsoft\", \"ur.microsoft\", + \"vi.microsoft\", \"standard.lucene\", \"standardasciifolding.lucene\", \"keyword\", + \"pattern\", \"simple\", \"stop\", and \"whitespace\".""" + normalizer: Optional[Union[str, "LexicalNormalizerName"]] + """The name of the normalizer to use for the field. This option can be used only with fields with + filterable, sortable, or facetable enabled. Once the normalizer is chosen, it cannot be changed + for the field. Must be null for complex fields. Known values are: \"asciifolding\", + \"elision\", \"lowercase\", \"standard\", and \"uppercase\".""" + dimensions: int + """The dimensionality of the vector field.""" + vectorSearchProfile: Optional[str] + """The name of the vector search profile that specifies the algorithm and vectorizer to use when + searching the vector field.""" + vectorEncoding: Optional[Union[str, "VectorEncodingFormat"]] + """The encoding format to interpret the field contents. \"packedBit\"""" + synonymMaps: list[str] + """A list of the names of synonym maps to associate with this field. This option can be used only + with searchable fields. Currently only one synonym map per field is supported. Assigning a + synonym map to a field ensures that query terms targeting that field are expanded at query-time + using the rules in the synonym map. This attribute can be changed on existing fields. Must be + null or an empty collection for complex fields.""" + fields: list["SearchField"] + """A list of sub-fields if this is a field of type Edm.ComplexType or Collection(Edm.ComplexType). + Must be null or empty for simple fields.""" + + +SearchIndex = TypedDict( + "SearchIndex", + { + "name": Required[str], + "description": str, + "fields": Required[list["SearchField"]], + "scoringProfiles": list["ScoringProfile"], + "defaultScoringProfile": str, + "corsOptions": Optional["CorsOptions"], + "suggesters": list["SearchSuggester"], + "analyzers": list["LexicalAnalyzer"], + "tokenizers": list["LexicalTokenizer"], + "tokenFilters": list["TokenFilter"], + "charFilters": list["CharFilter"], + "normalizers": list["LexicalNormalizer"], + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "similarity": "SimilarityAlgorithm", + "semantic": Optional["SemanticSearch"], + "vectorSearch": Optional["VectorSearch"], + "permissionFilterOption": Optional[Union[str, "SearchIndexPermissionFilterOption"]], + "purviewEnabled": Optional[bool], + "sharePointConnectorAppRegistration": "SharePointConnectorAppRegistration", + "@odata.etag": str, + }, + total=False, +) +SearchIndex.__doc__ = """Represents a search index definition, which describes the fields and search behavior of an +index. + +:ivar name: The name of the index. Required. +:vartype name: str +:ivar description: The description of the index. +:vartype description: str +:ivar fields: The fields of the index. Required. +:vartype fields: list["SearchField"] +:ivar scoringProfiles: The scoring profiles for the index. +:vartype scoringProfiles: list["ScoringProfile"] +:ivar defaultScoringProfile: The name of the scoring profile to use if none is specified in the + query. If this property is not set and no scoring profile is specified in the query, then + default scoring (tf-idf) will be used. +:vartype defaultScoringProfile: str +:ivar corsOptions: Options to control Cross-Origin Resource Sharing (CORS) for the index. +:vartype corsOptions: "CorsOptions" +:ivar suggesters: The suggesters for the index. +:vartype suggesters: list["SearchSuggester"] +:ivar analyzers: The analyzers for the index. +:vartype analyzers: list["LexicalAnalyzer"] +:ivar tokenizers: The tokenizers for the index. +:vartype tokenizers: list["LexicalTokenizer"] +:ivar tokenFilters: The token filters for the index. +:vartype tokenFilters: list["TokenFilter"] +:ivar charFilters: The character filters for the index. +:vartype charFilters: list["CharFilter"] +:ivar normalizers: The normalizers for the index. +:vartype normalizers: list["LexicalNormalizer"] +:ivar encryptionKey: 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 data when you + want full assurance that no one, not even Microsoft, can decrypt your data. Once you have + encrypted your data, 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 data 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar similarity: The type of similarity algorithm to be used when scoring and ranking the + documents matching a search query. The similarity algorithm can only be defined at index + creation time and cannot be modified on existing indexes. If null, the ClassicSimilarity + algorithm is used. +:vartype similarity: "SimilarityAlgorithm" +:ivar semantic: Defines parameters for a search index that influence semantic capabilities. +:vartype semantic: "SemanticSearch" +:ivar vectorSearch: Contains configuration options related to vector search. +:vartype vectorSearch: "VectorSearch" +:ivar permissionFilterOption: A value indicating whether permission filtering is enabled for + the index. Known values are: "enabled" and "disabled". +:vartype permissionFilterOption: Union[str, "SearchIndexPermissionFilterOption"] +:ivar purviewEnabled: A value indicating whether Purview is enabled for the index. +:vartype purviewEnabled: bool +:ivar sharePointConnectorAppRegistration: 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 sharePointConnectorAppRegistration: "SharePointConnectorAppRegistration" +:ivar ``@odata.etag``: The ETag of the index. +:vartype ``@odata.etag``: str +""" + + +SearchIndexer = TypedDict( + "SearchIndexer", + { + "name": Required[str], + "description": str, + "dataSourceName": Required[str], + "skillsetName": str, + "targetIndexName": Required[str], + "schedule": Optional["IndexingSchedule"], + "parameters": Optional["IndexingParameters"], + "fieldMappings": list["FieldMapping"], + "outputFieldMappings": list["FieldMapping"], + "disabled": Optional[bool], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "cache": Optional["SearchIndexerCache"], + }, + total=False, +) +SearchIndexer.__doc__ = """Represents an indexer. + +:ivar name: The name of the indexer. Required. +:vartype name: str +:ivar description: The description of the indexer. +:vartype description: str +:ivar dataSourceName: The name of the datasource from which this indexer reads data. Required. +:vartype dataSourceName: str +:ivar skillsetName: The name of the skillset executing with this indexer. +:vartype skillsetName: str +:ivar targetIndexName: The name of the index to which this indexer writes data. Required. +:vartype targetIndexName: str +:ivar schedule: The schedule for this indexer. +:vartype schedule: "IndexingSchedule" +:ivar parameters: Parameters for indexer execution. +:vartype parameters: "IndexingParameters" +:ivar fieldMappings: Defines mappings between fields in the data source and corresponding + target fields in the index. +:vartype fieldMappings: list["FieldMapping"] +:ivar outputFieldMappings: Output field mappings are applied after enrichment and immediately + before indexing. +:vartype outputFieldMappings: list["FieldMapping"] +:ivar disabled: A value indicating whether the indexer is disabled. Default is false. +:vartype disabled: bool +:ivar ``@odata.etag``: The ETag of the indexer. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 indexer + definition (as well as indexer execution status) when you want full assurance that no one, not + even Microsoft, can decrypt them. Once you have encrypted your indexer 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 indexer + definition (and 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. +:vartype encryptionKey: "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: "SearchIndexerCache" +""" + + +class SearchIndexerCache(TypedDict, total=False): + """The type of the cache. + + :ivar id: A guid for the SearchIndexerCache. + :vartype id: str + :ivar storageConnectionString: The connection string to the storage account where the cache + data will be persisted. + :vartype storageConnectionString: str + :ivar enableReprocessing: Specifies whether incremental reprocessing is enabled. + :vartype enableReprocessing: 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: "SearchIndexerDataIdentity" + """ + + id: str + """A guid for the SearchIndexerCache.""" + storageConnectionString: str + """The connection string to the storage account where the cache data will be persisted.""" + enableReprocessing: Optional[bool] + """Specifies whether incremental reprocessing is enabled.""" + identity: Optional["SearchIndexerDataIdentity"] + """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.""" + + +class SearchIndexerDataContainer(TypedDict, total=False): + """Represents information about the entity (such as Azure SQL table or CosmosDB collection) that + will be indexed. + + :ivar name: The name of the table or view (for Azure SQL data source) or collection (for + CosmosDB data source) that will be indexed. Required. + :vartype name: str + :ivar query: A query that is applied to this data container. The syntax and meaning of this + parameter is datasource-specific. Not supported by Azure SQL datasources. + :vartype query: str + """ + + name: Required[str] + """The name of the table or view (for Azure SQL data source) or collection (for CosmosDB data + source) that will be indexed. Required.""" + query: str + """A query that is applied to this data container. The syntax and meaning of this parameter is + datasource-specific. Not supported by Azure SQL datasources.""" + + +SearchIndexerDataNoneIdentity = TypedDict( + "SearchIndexerDataNoneIdentity", + { + "@odata.type": Required[Literal["#Microsoft.Azure.Search.DataNoneIdentity"]], + }, + total=False, +) +SearchIndexerDataNoneIdentity.__doc__ = """Clears the identity property of a datasource. + +:ivar ``@odata.type``: The discriminator for derived types. Required. Default value is + "#Microsoft.Azure.Search.DataNoneIdentity". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.DataNoneIdentity"] +""" + + +SearchIndexerDataSourceConnection = TypedDict( + "SearchIndexerDataSourceConnection", + { + "name": Required[str], + "description": str, + "type": Required[Union[str, "SearchIndexerDataSourceType"]], + "subType": str, + "credentials": Required["DataSourceCredentials"], + "container": Required["SearchIndexerDataContainer"], + "identity": Optional["SearchIndexerDataIdentity"], + "indexerPermissionOptions": Optional[list[Union[str, "IndexerPermissionOption"]]], + "dataChangeDetectionPolicy": Optional["DataChangeDetectionPolicy"], + "dataDeletionDetectionPolicy": Optional["DataDeletionDetectionPolicy"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + }, + total=False, +) +SearchIndexerDataSourceConnection.__doc__ = """Represents a datasource definition, which can be used to configure an indexer. + +:ivar name: The name of the datasource. Required. +:vartype name: str +:ivar description: The description of the datasource. +:vartype description: str +:ivar type: The type of the datasource. Required. Known values are: "azuresql", "cosmosdb", + "azureblob", "azuretable", "mysql", "adlsgen2", "onelake", and "sharepoint". +:vartype type: Union[str, "SearchIndexerDataSourceType"] +:ivar subType: A specific type of the data source, in case the resource is capable of different + modalities. For example, 'MongoDb' for certain 'cosmosDb' accounts. +:vartype subType: str +:ivar credentials: Credentials for the datasource. Required. +:vartype credentials: "DataSourceCredentials" +:ivar container: The data container for the datasource. Required. +:vartype container: "SearchIndexerDataContainer" +:ivar identity: 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. +:vartype identity: "SearchIndexerDataIdentity" +:ivar indexerPermissionOptions: Ingestion options with various types of permission data. +:vartype indexerPermissionOptions: list[Union[str, "IndexerPermissionOption"]] +:ivar dataChangeDetectionPolicy: The data change detection policy for the datasource. +:vartype dataChangeDetectionPolicy: "DataChangeDetectionPolicy" +:ivar dataDeletionDetectionPolicy: The data deletion detection policy for the datasource. +:vartype dataDeletionDetectionPolicy: "DataDeletionDetectionPolicy" +:ivar ``@odata.etag``: The ETag of the data source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 datasource + definition when you want full assurance that no one, not even Microsoft, can decrypt your data + source definition. Once you have encrypted your data 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 datasource 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 encryptionKey: "SearchResourceEncryptionKey" +""" + + +SearchIndexerDataUserAssignedIdentity = TypedDict( + "SearchIndexerDataUserAssignedIdentity", + { + "userAssignedIdentity": Required[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.DataUserAssignedIdentity"]], + "federatedIdentityClientId": str, + }, + total=False, +) +SearchIndexerDataUserAssignedIdentity.__doc__ = """Specifies the identity for a datasource to use. + +:ivar userAssignedIdentity: The fully qualified Azure resource Id of a user assigned managed + identity typically in the form + "/subscriptions/12345678-1234-1234-1234-1234567890ab/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId" + that should have been assigned to the search service. Required. +:vartype userAssignedIdentity: str +:ivar ``@odata.type``: A URI fragment specifying the type of identity. Required. Default value + is "#Microsoft.Azure.Search.DataUserAssignedIdentity". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.DataUserAssignedIdentity"] +:ivar federatedIdentityClientId: 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 federatedIdentityClientId: str +""" + + +class SearchIndexerIndexProjection(TypedDict, total=False): + """Definition of additional projections to secondary search indexes. + + :ivar selectors: A list of projections to be performed to secondary search indexes. Required. + :vartype selectors: list["SearchIndexerIndexProjectionSelector"] + :ivar parameters: A dictionary of index projection-specific configuration properties. Each name + is the name of a specific property. Each value must be of a primitive type. + :vartype parameters: "SearchIndexerIndexProjectionsParameters" + """ + + selectors: Required[list["SearchIndexerIndexProjectionSelector"]] + """A list of projections to be performed to secondary search indexes. Required.""" + parameters: "SearchIndexerIndexProjectionsParameters" + """A dictionary of index projection-specific configuration properties. Each name is the name of a + specific property. Each value must be of a primitive type.""" + + +class SearchIndexerIndexProjectionSelector(TypedDict, total=False): + """Description for what data to store in the designated search index. + + :ivar targetIndexName: Name of the search index to project to. Must have a key field with the + 'keyword' analyzer set. Required. + :vartype targetIndexName: str + :ivar parentKeyFieldName: Name of the field in the search index to map the parent document's + key value to. Must be a string field that is filterable and not the key field. Required. + :vartype parentKeyFieldName: str + :ivar sourceContext: Source context for the projections. Represents the cardinality at which + the document will be split into multiple sub documents. Required. + :vartype sourceContext: str + :ivar mappings: Mappings for the projection, or which source should be mapped to which field in + the target index. Required. + :vartype mappings: list["InputFieldMappingEntry"] + """ + + targetIndexName: Required[str] + """Name of the search index to project to. Must have a key field with the 'keyword' analyzer set. + Required.""" + parentKeyFieldName: Required[str] + """Name of the field in the search index to map the parent document's key value to. Must be a + string field that is filterable and not the key field. Required.""" + sourceContext: Required[str] + """Source context for the projections. Represents the cardinality at which the document will be + split into multiple sub documents. Required.""" + mappings: Required[list["InputFieldMappingEntry"]] + """Mappings for the projection, or which source should be mapped to which field in the target + index. Required.""" + + +class SearchIndexerIndexProjectionsParameters(TypedDict, total=False): + """A dictionary of index projection-specific configuration properties. Each name is the name of a + specific property. Each value must be of a primitive type. + + :ivar projectionMode: Defines behavior of the index projections in relation to the rest of the + indexer. Known values are: "skipIndexingParentDocuments" and "includeIndexingParentDocuments". + :vartype projectionMode: Union[str, "IndexProjectionMode"] + """ + + projectionMode: Union[str, "IndexProjectionMode"] + """Defines behavior of the index projections in relation to the rest of the indexer. Known values + are: \"skipIndexingParentDocuments\" and \"includeIndexingParentDocuments\".""" + + +class SearchIndexerKnowledgeStore(TypedDict, total=False): + """Definition of additional projections to azure blob, table, or files, of enriched data. + + :ivar storageConnectionString: The connection string to the storage account projections will be + stored in. Required. + :vartype storageConnectionString: str + :ivar projections: A list of additional projections to perform during indexing. Required. + :vartype projections: list["SearchIndexerKnowledgeStoreProjection"] + :ivar identity: The user-assigned managed identity used for connections to Azure Storage when + writing knowledge store projections. 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: "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: "SearchIndexerKnowledgeStoreParameters" + """ + + storageConnectionString: Required[str] + """The connection string to the storage account projections will be stored in. Required.""" + projections: Required[list["SearchIndexerKnowledgeStoreProjection"]] + """A list of additional projections to perform during indexing. Required.""" + identity: Optional["SearchIndexerDataIdentity"] + """The user-assigned managed identity used for connections to Azure Storage when writing knowledge + store projections. 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.""" + parameters: "SearchIndexerKnowledgeStoreParameters" + """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.""" + + +class SearchIndexerKnowledgeStoreProjectionSelector(TypedDict, total=False): # pylint: disable=name-too-long + """Abstract class to share properties between concrete selectors. + + :ivar referenceKeyName: Name of reference key to different projection. + :vartype referenceKeyName: str + :ivar generatedKeyName: Name of generated key to store projection under. + :vartype generatedKeyName: str + :ivar source: Source data to project. + :vartype source: str + :ivar sourceContext: Source context for complex projections. + :vartype sourceContext: str + :ivar inputs: Nested inputs for complex projections. + :vartype inputs: list["InputFieldMappingEntry"] + """ + + referenceKeyName: str + """Name of reference key to different projection.""" + generatedKeyName: str + """Name of generated key to store projection under.""" + source: str + """Source data to project.""" + sourceContext: str + """Source context for complex projections.""" + inputs: list["InputFieldMappingEntry"] + """Nested inputs for complex projections.""" + + +class SearchIndexerKnowledgeStoreBlobProjectionSelector( + SearchIndexerKnowledgeStoreProjectionSelector +): # pylint: disable=name-too-long + """Abstract class to share properties between concrete selectors. + + :ivar referenceKeyName: Name of reference key to different projection. + :vartype referenceKeyName: str + :ivar generatedKeyName: Name of generated key to store projection under. + :vartype generatedKeyName: str + :ivar source: Source data to project. + :vartype source: str + :ivar sourceContext: Source context for complex projections. + :vartype sourceContext: str + :ivar inputs: Nested inputs for complex projections. + :vartype inputs: list["InputFieldMappingEntry"] + :ivar storageContainer: Blob container to store projections in. Required. + :vartype storageContainer: str + """ + + storageContainer: Required[str] + """Blob container to store projections in. Required.""" + + +class SearchIndexerKnowledgeStoreFileProjectionSelector( + SearchIndexerKnowledgeStoreBlobProjectionSelector +): # pylint: disable=name-too-long + """Projection definition for what data to store in Azure Files. + + :ivar referenceKeyName: Name of reference key to different projection. + :vartype referenceKeyName: str + :ivar generatedKeyName: Name of generated key to store projection under. + :vartype generatedKeyName: str + :ivar source: Source data to project. + :vartype source: str + :ivar sourceContext: Source context for complex projections. + :vartype sourceContext: str + :ivar inputs: Nested inputs for complex projections. + :vartype inputs: list["InputFieldMappingEntry"] + :ivar storageContainer: Blob container to store projections in. Required. + :vartype storageContainer: str + """ + + +class SearchIndexerKnowledgeStoreObjectProjectionSelector( + SearchIndexerKnowledgeStoreBlobProjectionSelector +): # pylint: disable=name-too-long + """Projection definition for what data to store in Azure Blob. + + :ivar referenceKeyName: Name of reference key to different projection. + :vartype referenceKeyName: str + :ivar generatedKeyName: Name of generated key to store projection under. + :vartype generatedKeyName: str + :ivar source: Source data to project. + :vartype source: str + :ivar sourceContext: Source context for complex projections. + :vartype sourceContext: str + :ivar inputs: Nested inputs for complex projections. + :vartype inputs: list["InputFieldMappingEntry"] + :ivar storageContainer: Blob container to store projections in. Required. + :vartype storageContainer: str + """ + + +class SearchIndexerKnowledgeStoreParameters(TypedDict, total=False): + """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 synthesizeGeneratedKeyName: Whether or not projections should synthesize a generated key + name if one isn't already present. + :vartype synthesizeGeneratedKeyName: bool + """ + + synthesizeGeneratedKeyName: bool + """Whether or not projections should synthesize a generated key name if one isn't already present.""" + + +class SearchIndexerKnowledgeStoreProjection(TypedDict, total=False): + """Container object for various projection selectors. + + :ivar tables: Projections to Azure Table storage. + :vartype tables: list["SearchIndexerKnowledgeStoreTableProjectionSelector"] + :ivar objects: Projections to Azure Blob storage. + :vartype objects: list["SearchIndexerKnowledgeStoreObjectProjectionSelector"] + :ivar files: Projections to Azure File storage. + :vartype files: list["SearchIndexerKnowledgeStoreFileProjectionSelector"] + """ + + tables: list["SearchIndexerKnowledgeStoreTableProjectionSelector"] + """Projections to Azure Table storage.""" + objects: list["SearchIndexerKnowledgeStoreObjectProjectionSelector"] + """Projections to Azure Blob storage.""" + files: list["SearchIndexerKnowledgeStoreFileProjectionSelector"] + """Projections to Azure File storage.""" + + +class SearchIndexerKnowledgeStoreTableProjectionSelector(TypedDict, total=False): # pylint: disable=name-too-long + """Description for what data to store in Azure Tables. + + :ivar referenceKeyName: Name of reference key to different projection. + :vartype referenceKeyName: str + :ivar source: Source data to project. + :vartype source: str + :ivar sourceContext: Source context for complex projections. + :vartype sourceContext: str + :ivar inputs: Nested inputs for complex projections. + :vartype inputs: list["InputFieldMappingEntry"] + :ivar generatedKeyName: Name of generated key to store projection under. Required. + :vartype generatedKeyName: str + :ivar tableName: Name of the Azure table to store projected data in. Required. + :vartype tableName: str + """ + + referenceKeyName: str + """Name of reference key to different projection.""" + source: str + """Source data to project.""" + sourceContext: str + """Source context for complex projections.""" + inputs: list["InputFieldMappingEntry"] + """Nested inputs for complex projections.""" + generatedKeyName: Required[str] + """Name of generated key to store projection under. Required.""" + tableName: Required[str] + """Name of the Azure table to store projected data in. Required.""" + + +SearchIndexerSkillset = TypedDict( + "SearchIndexerSkillset", + { + "name": Required[str], + "description": str, + "skills": Required[list["SearchIndexerSkill"]], + "cognitiveServices": "CognitiveServicesAccount", + "knowledgeStore": "SearchIndexerKnowledgeStore", + "indexProjections": "SearchIndexerIndexProjection", + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + }, + total=False, +) +SearchIndexerSkillset.__doc__ = """A list of skills. + +:ivar name: The name of the skillset. Required. +:vartype name: str +:ivar description: The description of the skillset. +:vartype description: str +:ivar skills: A list of skills in the skillset. Required. +:vartype skills: list["SearchIndexerSkill"] +:ivar cognitiveServices: Details about the Azure AI service to be used when running skills. +:vartype cognitiveServices: "CognitiveServicesAccount" +:ivar knowledgeStore: Definition of additional projections to Azure blob, table, or files, of + enriched data. +:vartype knowledgeStore: "SearchIndexerKnowledgeStore" +:ivar indexProjections: Definition of additional projections to secondary search index(es). +:vartype indexProjections: "SearchIndexerIndexProjection" +:ivar ``@odata.etag``: The ETag of the skillset. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 skillset + definition when you want full assurance that no one, not even Microsoft, can decrypt your + skillset definition. Once you have encrypted your skillset 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 skillset 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 encryptionKey: "SearchResourceEncryptionKey" +""" + + +class SearchIndexFieldReference(TypedDict, total=False): + """Field reference for a search index. + + :ivar name: The name of the field. Required. + :vartype name: str + """ + + name: Required[str] + """The name of the field. Required.""" + + +SearchIndexKnowledgeSource = TypedDict( + "SearchIndexKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.SEARCH_INDEX]], + "searchIndexParameters": Required["SearchIndexKnowledgeSourceParameters"], + }, + total=False, +) +SearchIndexKnowledgeSource.__doc__ = """Knowledge Source targeting a search index. + +:ivar name: The name of the knowledge source. Required. +:vartype name: str +:ivar description: Optional user-defined description. +:vartype description: str +:ivar resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: Required. A knowledge source that reads data from a Search Index. +:vartype kind: Literal[KnowledgeSourceKind.SEARCH_INDEX] +:ivar searchIndexParameters: The parameters for the knowledge source. Required. +:vartype searchIndexParameters: "SearchIndexKnowledgeSourceParameters" +""" + + +class SearchIndexKnowledgeSourceFieldValueBoost(TypedDict, total=False): # pylint: disable=name-too-long + """A hint that boosts documents based on a field value. + + :ivar boostInstructions: Natural-language instructions that explain when and how to apply the + boost. + :vartype boostInstructions: str + :ivar kind: The discriminator value. Required. Boost documents based on a field value. + :vartype kind: Literal[SearchIndexKnowledgeSourceBoostKind.FIELD_VALUE] + :ivar field: The name of the search index field. Required. + :vartype field: str + :ivar fieldValues: Representative values for the field. + :vartype fieldValues: list[str] + :ivar boost: A multiplier for the document score. Must be a positive number not equal to 1.0. + Required. + :vartype boost: float + """ + + boostInstructions: str + """Natural-language instructions that explain when and how to apply the boost.""" + kind: Required[Literal[SearchIndexKnowledgeSourceBoostKind.FIELD_VALUE]] + """The discriminator value. Required. Boost documents based on a field value.""" + field: Required[str] + """The name of the search index field. Required.""" + fieldValues: list[str] + """Representative values for the field.""" + boost: Required[float] + """A multiplier for the document score. Must be a positive number not equal to 1.0. Required.""" + + +class SearchIndexKnowledgeSourceFilterHint(TypedDict, total=False): + """A hint that identifies a field and representative values the query planner can use when + constructing a filter. + + :ivar field: The name of the filterable search index field. Required. + :vartype field: str + :ivar fieldValues: Representative values for the field. Required. + :vartype fieldValues: list[str] + :ivar filterInstructions: Natural-language instructions that explain when and how to filter on + the field. + :vartype filterInstructions: str + """ + + field: Required[str] + """The name of the filterable search index field. Required.""" + fieldValues: Required[list[str]] + """Representative values for the field. Required.""" + filterInstructions: str + """Natural-language instructions that explain when and how to filter on the field.""" + + +class SearchIndexKnowledgeSourceMultiWordExpressionBoost(TypedDict, total=False): # pylint: disable=name-too-long + """A hint that boosts documents based on a multi-word expression. + + :ivar boostInstructions: Natural-language instructions that explain when and how to apply the + boost. + :vartype boostInstructions: str + :ivar kind: The discriminator value. Required. Boost documents based on a multi-word + expression. + :vartype kind: Literal[SearchIndexKnowledgeSourceBoostKind.MULTI_WORD_EXPRESSION] + :ivar fieldValues: Representative values for the boost. + :vartype fieldValues: list[str] + :ivar boost: A multiplier for the document score. Must be a positive number not equal to 1.0. + Required. + :vartype boost: float + """ + + boostInstructions: str + """Natural-language instructions that explain when and how to apply the boost.""" + kind: Required[Literal[SearchIndexKnowledgeSourceBoostKind.MULTI_WORD_EXPRESSION]] + """The discriminator value. Required. Boost documents based on a multi-word expression.""" + fieldValues: list[str] + """Representative values for the boost.""" + boost: Required[float] + """A multiplier for the document score. Must be a positive number not equal to 1.0. Required.""" + + +class SearchIndexKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for search index knowledge source. + + :ivar searchIndexName: The name of the Search index. Required. + :vartype searchIndexName: str + :ivar sourceDataFields: Used to request additional fields for referenced source data. + :vartype sourceDataFields: list["SearchIndexFieldReference"] + :ivar searchFields: Used to restrict which fields to search on the search index. + :vartype searchFields: list["SearchIndexFieldReference"] + :ivar semanticConfigurationName: Used to specify a different semantic configuration on the + target search index other than the default one. + :vartype semanticConfigurationName: str + :ivar baseFilter: 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 baseFilter: str + :ivar queryHints: Default hints that guide query planning toward useful filters and boosts for + this search index knowledge source. Request-time query hints replace these defaults as a + complete object. + :vartype queryHints: "SearchIndexKnowledgeSourceQueryHints" + """ + + searchIndexName: Required[str] + """The name of the Search index. Required.""" + sourceDataFields: list["SearchIndexFieldReference"] + """Used to request additional fields for referenced source data.""" + searchFields: list["SearchIndexFieldReference"] + """Used to restrict which fields to search on the search index.""" + semanticConfigurationName: str + """Used to specify a different semantic configuration on the target search index other than the + default one.""" + baseFilter: str + """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.""" + queryHints: "SearchIndexKnowledgeSourceQueryHints" + """Default hints that guide query planning toward useful filters and boosts for this search index + knowledge source. Request-time query hints replace these defaults as a complete object.""" + + +class SearchIndexKnowledgeSourceQueryHints(TypedDict, total=False): + """Hints that guide query planning toward useful filters and boosts for a search index knowledge + source. + + :ivar filters: Filter hints that identify fields and representative values the query planner + can use when constructing filters. + :vartype filters: list["SearchIndexKnowledgeSourceFilterHint"] + :ivar boosts: Boost hints that identify conditions the query planner can use to influence + document ranking. + :vartype boosts: list["SearchIndexKnowledgeSourceBoost"] + """ + + filters: list["SearchIndexKnowledgeSourceFilterHint"] + """Filter hints that identify fields and representative values the query planner can use when + constructing filters.""" + boosts: list["SearchIndexKnowledgeSourceBoost"] + """Boost hints that identify conditions the query planner can use to influence document ranking.""" + + +class SearchResourceEncryptionKey(TypedDict, total=False): + """A customer-managed encryption key in Azure Key Vault. Keys that you create and manage can be + used to encrypt or decrypt data-at-rest, such as indexes and synonym maps. + + :ivar keyVaultKeyName: The name of your Azure Key Vault key to be used to encrypt your data at + rest. Required. + :vartype keyVaultKeyName: str + :ivar keyVaultKeyVersion: The version of your Azure Key Vault key to be used to encrypt your + data at rest. + :vartype keyVaultKeyVersion: str + :ivar keyVaultUri: The URI of your Azure Key Vault, also referred to as DNS name, that contains + the key to be used to encrypt your data at rest. An example URI might be + ``https://my-keyvault-name.vault.azure.net``. Required. + :vartype keyVaultUri: str + :ivar accessCredentials: Optional Azure Active Directory credentials used for accessing your + Azure Key Vault. Not required if using managed identity instead. + :vartype accessCredentials: "AzureActiveDirectoryApplicationCredentials" + :ivar identity: An explicit managed identity to use for this encryption key. If not specified + and the access 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. + :vartype identity: "SearchIndexerDataIdentity" + :ivar isServiceLevelKey: An optional value indicating whether this key is a service-level key. + Default is false. + :vartype isServiceLevelKey: bool + """ + + keyVaultKeyName: Required[str] + """The name of your Azure Key Vault key to be used to encrypt your data at rest. Required.""" + keyVaultKeyVersion: str + """The version of your Azure Key Vault key to be used to encrypt your data at rest.""" + keyVaultUri: Required[str] + """The URI of your Azure Key Vault, also referred to as DNS name, that contains the key to be used + to encrypt your data at rest. An example URI might be + ``https://my-keyvault-name.vault.azure.net``. Required.""" + accessCredentials: "AzureActiveDirectoryApplicationCredentials" + """Optional Azure Active Directory credentials used for accessing your Azure Key Vault. Not + required if using managed identity instead.""" + identity: Optional["SearchIndexerDataIdentity"] + """An explicit managed identity to use for this encryption key. If not specified and the access + 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.""" + isServiceLevelKey: bool + """An optional value indicating whether this key is a service-level key. Default is false.""" + + +class SearchSuggester(TypedDict, total=False): + """Defines how the Suggest API should apply to a group of fields in the index. + + :ivar name: The name of the suggester. Required. + :vartype name: str + :ivar searchMode: A value indicating the capabilities of the suggester. Required. Default value + is "analyzingInfixMatching". + :vartype searchMode: Literal["analyzingInfixMatching"] + :ivar sourceFields: The list of field names to which the suggester applies. Each field must be + searchable. Required. + :vartype sourceFields: list[str] + """ + + name: Required[str] + """The name of the suggester. Required.""" + searchMode: Required[Literal["analyzingInfixMatching"]] + """A value indicating the capabilities of the suggester. Required. Default value is + \"analyzingInfixMatching\".""" + sourceFields: Required[list[str]] + """The list of field names to which the suggester applies. Each field must be searchable. + Required.""" + + +class SemanticConfiguration(TypedDict, total=False): + """Defines a specific configuration to be used in the context of semantic capabilities. + + :ivar name: The name of the semantic configuration. Required. + :vartype name: str + :ivar prioritizedFields: Describes the title, content, and keyword fields to be used for + semantic ranking, captions, highlights, and answers. At least one of the three sub properties + (titleField, prioritizedKeywordsFields and prioritizedContentFields) need to be set. Required. + :vartype prioritizedFields: "SemanticPrioritizedFields" + :ivar rankingOrder: Specifies the score type to be used for the sort order of the search + results. Known values are: "BoostedRerankerScore" and "RerankerScore". + :vartype rankingOrder: Union[str, "RankingOrder"] + :ivar flightingOptIn: Determines which semantic or query rewrite models to use during model + flighting/upgrades. + :vartype flightingOptIn: bool + """ + + name: Required[str] + """The name of the semantic configuration. Required.""" + prioritizedFields: Required["SemanticPrioritizedFields"] + """Describes the title, content, and keyword fields to be used for semantic ranking, captions, + highlights, and answers. At least one of the three sub properties (titleField, + prioritizedKeywordsFields and prioritizedContentFields) need to be set. Required.""" + rankingOrder: Optional[Union[str, "RankingOrder"]] + """Specifies the score type to be used for the sort order of the search results. Known values are: + \"BoostedRerankerScore\" and \"RerankerScore\".""" + flightingOptIn: bool + """Determines which semantic or query rewrite models to use during model flighting/upgrades.""" + + +class SemanticField(TypedDict, total=False): + """A field that is used as part of the semantic configuration. + + :ivar fieldName: File name. Required. + :vartype fieldName: str + """ + + fieldName: Required[str] + """File name. Required.""" + + +class SemanticPrioritizedFields(TypedDict, total=False): + """Describes the title, content, and keywords fields to be used for semantic ranking, captions, + highlights, and answers. + + :ivar titleField: Defines the title field to be used for semantic ranking, captions, + highlights, and answers. If you don't have a title field in your index, leave this blank. + :vartype titleField: "SemanticField" + :ivar prioritizedContentFields: Defines the content fields to be used for semantic ranking, + captions, highlights, and answers. For the best result, the selected fields should contain text + in natural language form. The order of the fields in the array represents their priority. + Fields with lower priority may get truncated if the content is long. + :vartype prioritizedContentFields: list["SemanticField"] + :ivar prioritizedKeywordsFields: Defines the keyword fields to be used for semantic ranking, + captions, highlights, and answers. For the best result, the selected fields should contain a + list of keywords. The order of the fields in the array represents their priority. Fields with + lower priority may get truncated if the content is long. + :vartype prioritizedKeywordsFields: list["SemanticField"] + """ + + titleField: "SemanticField" + """Defines the title field to be used for semantic ranking, captions, highlights, and answers. If + you don't have a title field in your index, leave this blank.""" + prioritizedContentFields: list["SemanticField"] + """Defines the content fields to be used for semantic ranking, captions, highlights, and answers. + For the best result, the selected fields should contain text in natural language form. The + order of the fields in the array represents their priority. Fields with lower priority may get + truncated if the content is long.""" + prioritizedKeywordsFields: list["SemanticField"] + """Defines the keyword fields to be used for semantic ranking, captions, highlights, and answers. + For the best result, the selected fields should contain a list of keywords. The order of the + fields in the array represents their priority. Fields with lower priority may get truncated if + the content is long.""" + + +class SemanticSearch(TypedDict, total=False): + """Defines parameters for a search index that influence semantic capabilities. + + :ivar defaultConfiguration: Allows you to set the name of a default semantic configuration in + your index, making it optional to pass it on as a query parameter every time. + :vartype defaultConfiguration: str + :ivar configurations: The semantic configurations for the index. + :vartype configurations: list["SemanticConfiguration"] + """ + + defaultConfiguration: str + """Allows you to set the name of a default semantic configuration in your index, making it + optional to pass it on as a query parameter every time.""" + configurations: list["SemanticConfiguration"] + """The semantic configurations for the index.""" + + +SentimentSkillV3 = TypedDict( + "SentimentSkillV3", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultLanguageCode": Optional[Union[str, "SentimentSkillLanguage"]], + "includeOpinionMining": bool, + "modelVersion": Optional[str], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.V3.SentimentSkill"]], + }, + total=False, +) +SentimentSkillV3.__doc__ = """Using the Text Analytics API, evaluates unstructured text and for each record, provides +sentiment labels (such as "negative", "neutral" and "positive") based on the highest confidence +score found by the service at a sentence and document-level. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultLanguageCode: A value indicating which language code to use. Default is ``en``. + Known values are: "da", "nl", "en", "fi", "fr", "de", "el", "it", "no", "pl", "pt-PT", "ru", + "es", "sv", and "tr". +:vartype defaultLanguageCode: Union[str, "SentimentSkillLanguage"] +:ivar includeOpinionMining: If set to true, the skill output will include information from Text + Analytics for opinion mining, namely targets (nouns or verbs) and their associated assessment + (adjective) in the text. Default is false. +:vartype includeOpinionMining: bool +:ivar modelVersion: 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. +:vartype modelVersion: str +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.V3.SentimentSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.V3.SentimentSkill"] +""" + + +ShaperSkill = TypedDict( + "ShaperSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "@odata.type": Required[Literal["#Microsoft.Skills.Util.ShaperSkill"]], + }, + total=False, +) +ShaperSkill.__doc__ = """A skill for reshaping the outputs. It creates a complex type to support composite fields (also +known as multipart fields). + +: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["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["OutputFieldMappingEntry"] +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Util.ShaperSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Util.ShaperSkill"] +""" + + +class SharePointConnectorAppRegistration(TypedDict, total=False): + """Configures a SharePoint connector app registration for the index, enabling document-level + permissions from SharePoint. + + :ivar applicationId: The application (client) ID of the app registration used to connect to + SharePoint. Required. + :vartype applicationId: str + :ivar federatedCredentialId: The federated credential ID configured on the app registration. + Required. + :vartype federatedCredentialId: str + :ivar tenantId: The tenant ID of the app registration. If not specified, the tenant of the + search service is used. + :vartype tenantId: str + """ + + applicationId: Required[str] + """The application (client) ID of the app registration used to connect to SharePoint. Required.""" + federatedCredentialId: Required[str] + """The federated credential ID configured on the app registration. Required.""" + tenantId: str + """The tenant ID of the app registration. If not specified, the tenant of the search service is + used.""" + + +ShingleTokenFilter = TypedDict( + "ShingleTokenFilter", + { + "name": Required[str], + "maxShingleSize": int, + "minShingleSize": int, + "outputUnigrams": bool, + "outputUnigramsIfNoShingles": bool, + "tokenSeparator": str, + "filterToken": str, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.ShingleTokenFilter"]], + }, + total=False, +) +ShingleTokenFilter.__doc__ = """Creates combinations of tokens as a single token. This token filter is implemented using Apache +Lucene. + +:ivar name: The name of the token 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 maxShingleSize: The maximum shingle size. Default and minimum value is 2. +:vartype maxShingleSize: int +:ivar minShingleSize: The minimum shingle size. Default and minimum value is 2. Must be less + than the value of maxShingleSize. +:vartype minShingleSize: int +:ivar outputUnigrams: A value indicating whether the output stream will contain the input + tokens (unigrams) as well as shingles. Default is true. +:vartype outputUnigrams: bool +:ivar outputUnigramsIfNoShingles: A value indicating whether to output unigrams for those times + when no shingles are available. This property takes precedence when outputUnigrams is set to + false. Default is false. +:vartype outputUnigramsIfNoShingles: bool +:ivar tokenSeparator: The string to use when joining adjacent tokens to form a shingle. Default + is a single space (" "). +:vartype tokenSeparator: str +:ivar filterToken: The string to insert for each position at which there is no token. Default + is an underscore ("_"). +:vartype filterToken: str +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.ShingleTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.ShingleTokenFilter"] +""" + + +class SkillNames(TypedDict, total=False): + """The type of the skill names. + + :ivar skillNames: the names of skills to be reset. + :vartype skillNames: list[str] + """ + + skillNames: list[str] + """the names of skills to be reset.""" + + +SnowballTokenFilter = TypedDict( + "SnowballTokenFilter", + { + "name": Required[str], + "language": Required[Union[str, "SnowballTokenFilterLanguage"]], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.SnowballTokenFilter"]], + }, + total=False, +) +SnowballTokenFilter.__doc__ = """A filter that stems words using a Snowball-generated stemmer. This token filter is implemented +using Apache Lucene. + +:ivar name: The name of the token 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 language: The language to use. Required. Known values are: "armenian", "basque", + "catalan", "danish", "dutch", "english", "finnish", "french", "german", "german2", "hungarian", + "italian", "kp", "lovins", "norwegian", "porter", "portuguese", "romanian", "russian", + "spanish", "swedish", and "turkish". +:vartype language: Union[str, "SnowballTokenFilterLanguage"] +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.SnowballTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.SnowballTokenFilter"] +""" + + +SoftDeleteColumnDeletionDetectionPolicy = TypedDict( + "SoftDeleteColumnDeletionDetectionPolicy", + { + "softDeleteColumnName": str, + "softDeleteMarkerValue": str, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy"]], + }, + total=False, +) +SoftDeleteColumnDeletionDetectionPolicy.__doc__ = """Defines a data deletion detection policy that implements a soft-deletion strategy. It +determines whether an item should be deleted based on the value of a designated 'soft delete' +column. + +:ivar softDeleteColumnName: The name of the column to use for soft-deletion detection. +:vartype softDeleteColumnName: str +:ivar softDeleteMarkerValue: The marker value that identifies an item as deleted. +:vartype softDeleteMarkerValue: str +:ivar ``@odata.type``: A URI fragment specifying the type of data deletion detection policy. + Required. Default value is "#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy". +:vartype ``@odata.type``: + Literal["#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy"] +""" + + +SplitSkill = TypedDict( + "SplitSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultLanguageCode": Union[str, "SplitSkillLanguage"], + "textSplitMode": Union[str, "TextSplitMode"], + "maximumPageLength": Optional[int], + "pageOverlapLength": Optional[int], + "maximumPagesToTake": Optional[int], + "unit": Optional[Union[str, "SplitSkillUnit"]], + "azureOpenAITokenizerParameters": Optional["AzureOpenAITokenizerParameters"], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.SplitSkill"]], + }, + total=False, +) +SplitSkill.__doc__ = """A skill to split a string into chunks of text. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultLanguageCode: 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 defaultLanguageCode: Union[str, "SplitSkillLanguage"] +:ivar textSplitMode: A value indicating which split mode to perform. Known values are: "pages" + and "sentences". +:vartype textSplitMode: Union[str, "TextSplitMode"] +:ivar maximumPageLength: The desired maximum page length. Default is 10000. +:vartype maximumPageLength: int +:ivar pageOverlapLength: Only applicable when textSplitMode is set to 'pages'. If specified, + n+1th chunk will start with this number of characters/tokens from the end of the nth chunk. +:vartype pageOverlapLength: int +:ivar maximumPagesToTake: 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. +:vartype maximumPagesToTake: 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: Union[str, "SplitSkillUnit"] +:ivar azureOpenAITokenizerParameters: 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 azureOpenAITokenizerParameters: "AzureOpenAITokenizerParameters" +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.SplitSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.SplitSkill"] +""" + + +SqlIntegratedChangeTrackingPolicy = TypedDict( + "SqlIntegratedChangeTrackingPolicy", + { + "@odata.type": Required[Literal["#Microsoft.Azure.Search.SqlIntegratedChangeTrackingPolicy"]], + }, + total=False, +) +SqlIntegratedChangeTrackingPolicy.__doc__ = """Defines a data change detection policy that captures changes using the Integrated Change +Tracking feature of Azure SQL Database. + +:ivar ``@odata.type``: A URI fragment specifying the type of data change detection policy. + Required. Default value is "#Microsoft.Azure.Search.SqlIntegratedChangeTrackingPolicy". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.SqlIntegratedChangeTrackingPolicy"] +""" + + +StemmerOverrideTokenFilter = TypedDict( + "StemmerOverrideTokenFilter", + { + "name": Required[str], + "rules": Required[list[str]], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.StemmerOverrideTokenFilter"]], + }, + total=False, +) +StemmerOverrideTokenFilter.__doc__ = """Provides the ability to override other stemming filters with custom dictionary-based stemming. +Any dictionary-stemmed terms will be marked as keywords so that they will not be stemmed with +stemmers down the chain. Must be placed before any stemming filters. This token filter is +implemented using Apache Lucene. See +`http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/miscellaneous/StemmerOverrideFilter.html +`_. + +:ivar name: The name of the token 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 rules: A list of stemming rules in the following format: "word => stem", for example: + "ran => run". Required. +:vartype rules: list[str] +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.StemmerOverrideTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.StemmerOverrideTokenFilter"] +""" + + +StemmerTokenFilter = TypedDict( + "StemmerTokenFilter", + { + "name": Required[str], + "language": Required[Union[str, "StemmerTokenFilterLanguage"]], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.StemmerTokenFilter"]], + }, + total=False, +) +StemmerTokenFilter.__doc__ = """Language specific stemming filter. This token filter is implemented using Apache Lucene. See +`https://learn.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search#TokenFilters +`_. + +:ivar name: The name of the token 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 language: The language to use. Required. Known values are: "arabic", "armenian", + "basque", "brazilian", "bulgarian", "catalan", "czech", "danish", "dutch", "dutchKp", + "english", "lightEnglish", "minimalEnglish", "possessiveEnglish", "porter2", "lovins", + "finnish", "lightFinnish", "french", "lightFrench", "minimalFrench", "galician", + "minimalGalician", "german", "german2", "lightGerman", "minimalGerman", "greek", "hindi", + "hungarian", "lightHungarian", "indonesian", "irish", "italian", "lightItalian", "sorani", + "latvian", "norwegian", "lightNorwegian", "minimalNorwegian", "lightNynorsk", "minimalNynorsk", + "portuguese", "lightPortuguese", "minimalPortuguese", "portugueseRslp", "romanian", "russian", + "lightRussian", "spanish", "lightSpanish", "swedish", "lightSwedish", and "turkish". +:vartype language: Union[str, "StemmerTokenFilterLanguage"] +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.StemmerTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.StemmerTokenFilter"] +""" + + +StopAnalyzer = TypedDict( + "StopAnalyzer", + { + "name": Required[str], + "stopwords": list[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.StopAnalyzer"]], + }, + total=False, +) +StopAnalyzer.__doc__ = """Divides text at non-letters; Applies the lowercase and stopword token filters. This analyzer is +implemented using Apache Lucene. + +:ivar name: The name of the analyzer. 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 stopwords: A list of stopwords. +:vartype stopwords: list[str] +:ivar ``@odata.type``: A URI fragment specifying the type of analyzer. Required. Default value + is "#Microsoft.Azure.Search.StopAnalyzer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.StopAnalyzer"] +""" + + +StopwordsTokenFilter = TypedDict( + "StopwordsTokenFilter", + { + "name": Required[str], + "stopwords": list[str], + "stopwordsList": Union[str, "StopwordsList"], + "ignoreCase": bool, + "removeTrailing": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.StopwordsTokenFilter"]], + }, + total=False, +) +StopwordsTokenFilter.__doc__ = """Removes stop words from a token stream. This token filter is implemented using Apache Lucene. +See +`http://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/core/StopFilter.html +`_. + +:ivar name: The name of the token 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 stopwords: The list of stopwords. This property and the stopwords list property cannot + both be set. +:vartype stopwords: list[str] +:ivar stopwordsList: A predefined list of stopwords to use. This property and the stopwords + property cannot both be set. Default is English. Known values are: "arabic", "armenian", + "basque", "brazilian", "bulgarian", "catalan", "czech", "danish", "dutch", "english", + "finnish", "french", "galician", "german", "greek", "hindi", "hungarian", "indonesian", + "irish", "italian", "latvian", "norwegian", "persian", "portuguese", "romanian", "russian", + "sorani", "spanish", "swedish", "thai", and "turkish". +:vartype stopwordsList: Union[str, "StopwordsList"] +:ivar ignoreCase: A value indicating whether to ignore case. If true, all words are converted + to lower case first. Default is false. +:vartype ignoreCase: bool +:ivar removeTrailing: A value indicating whether to ignore the last search term if it's a stop + word. Default is true. +:vartype removeTrailing: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.StopwordsTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.StopwordsTokenFilter"] +""" + + +SynonymMap = TypedDict( + "SynonymMap", + { + "name": Required[str], + "format": Required[Literal["solr"]], + "synonyms": Required[list[str]], + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "@odata.etag": str, + }, + total=False, +) +SynonymMap.__doc__ = """Represents a synonym map definition. + +:ivar name: The name of the synonym map. Required. +:vartype name: str +:ivar format: The format of the synonym map. Only the 'solr' format is currently supported. + Required. Default value is "solr". +:vartype format: Literal["solr"] +:ivar synonyms: A series of synonym rules in the specified synonym map format. The rules must + be separated by newlines. Required. +:vartype synonyms: list[str] +:ivar encryptionKey: 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 data when you + want full assurance that no one, not even Microsoft, can decrypt your data. Once you have + encrypted your data, 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 data 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar ``@odata.etag``: The ETag of the synonym map. +:vartype ``@odata.etag``: str +""" + + +SynonymTokenFilter = TypedDict( + "SynonymTokenFilter", + { + "name": Required[str], + "synonyms": Required[list[str]], + "ignoreCase": bool, + "expand": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.SynonymTokenFilter"]], + }, + total=False, +) +SynonymTokenFilter.__doc__ = """Matches single or multi-word synonyms in a token stream. This token filter is implemented using +Apache Lucene. + +:ivar name: The name of the token 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 synonyms: A list of synonyms in following one of two formats: 1. incredible, + unbelievable, fabulous => amazing - all terms on the left side of => symbol will be replaced + with all terms on its right side; 2. incredible, unbelievable, fabulous, amazing - comma + separated list of equivalent words. Set the expand option to change how this list is + interpreted. Required. +:vartype synonyms: list[str] +:ivar ignoreCase: A value indicating whether to case-fold input for matching. Default is false. +:vartype ignoreCase: bool +:ivar expand: A value indicating whether all words in the list of synonyms (if => notation is + not used) will map to one another. If true, all words in the list of synonyms (if => notation + is not used) will map to one another. The following list: incredible, unbelievable, fabulous, + amazing is equivalent to: incredible, unbelievable, fabulous, amazing => incredible, + unbelievable, fabulous, amazing. If false, the following list: incredible, unbelievable, + fabulous, amazing will be equivalent to: incredible, unbelievable, fabulous, amazing => + incredible. Default is true. +:vartype expand: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.SynonymTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.SynonymTokenFilter"] +""" + + +class TagScoringFunction(TypedDict, total=False): + """Defines a function that boosts scores of documents with string values matching a given list of + tags. + + :ivar fieldName: The name of the field used as input to the scoring function. Required. + :vartype fieldName: 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: Union[str, "ScoringFunctionInterpolation"] + :ivar tag: Parameter values for the tag scoring function. Required. + :vartype tag: "TagScoringParameters" + :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 "tag". + :vartype type: Literal["tag"] + """ + + fieldName: Required[str] + """The name of the field used as input to the scoring function. Required.""" + boost: Required[float] + """A multiplier for the raw score. Must be a positive number not equal to 1.0. Required.""" + interpolation: Union[str, "ScoringFunctionInterpolation"] + """A value indicating how boosting will be interpolated across document scores; defaults to + \"Linear\". Known values are: \"linear\", \"constant\", \"quadratic\", and \"logarithmic\".""" + tag: Required["TagScoringParameters"] + """Parameter values for the tag scoring function. Required.""" + type: Required[Literal["tag"]] + """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 \"tag\".""" + + +class TagScoringParameters(TypedDict, total=False): + """Provides parameter values to a tag scoring function. + + :ivar tagsParameter: The name of the parameter passed in search queries to specify the list of + tags to compare against the target field. Required. + :vartype tagsParameter: str + """ + + tagsParameter: Required[str] + """The name of the parameter passed in search queries to specify the list of tags to compare + against the target field. Required.""" + + +TextTranslationSkill = TypedDict( + "TextTranslationSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "defaultToLanguageCode": Required[Union[str, "TextTranslationSkillLanguage"]], + "defaultFromLanguageCode": Union[str, "TextTranslationSkillLanguage"], + "suggestedFrom": Optional[Union[str, "TextTranslationSkillLanguage"]], + "@odata.type": Required[Literal["#Microsoft.Skills.Text.TranslationSkill"]], + }, + total=False, +) +TextTranslationSkill.__doc__ = """A skill to translate text from one language to another. + +: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["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["OutputFieldMappingEntry"] +:ivar defaultToLanguageCode: The language code to translate documents into for documents that + don't specify the to language explicitly. Required. Known values are: "af", "ar", "bn", "bs", + "bg", "yue", "ca", "zh-Hans", "zh-Hant", "hr", "cs", "da", "nl", "en", "et", "fj", "fil", "fi", + "fr", "de", "el", "ht", "he", "hi", "mww", "hu", "is", "id", "it", "ja", "sw", "tlh", + "tlh-Latn", "tlh-Piqd", "ko", "lv", "lt", "mg", "ms", "mt", "nb", "fa", "pl", "pt", "pt-br", + "pt-PT", "otq", "ro", "ru", "sm", "sr-Cyrl", "sr-Latn", "sk", "sl", "es", "sv", "ty", "ta", + "te", "th", "to", "tr", "uk", "ur", "vi", "cy", "yua", "ga", "kn", "mi", "ml", and "pa". +:vartype defaultToLanguageCode: Union[str, "TextTranslationSkillLanguage"] +:ivar defaultFromLanguageCode: The language code to translate documents from for documents that + don't specify the from language explicitly. Known values are: "af", "ar", "bn", "bs", "bg", + "yue", "ca", "zh-Hans", "zh-Hant", "hr", "cs", "da", "nl", "en", "et", "fj", "fil", "fi", "fr", + "de", "el", "ht", "he", "hi", "mww", "hu", "is", "id", "it", "ja", "sw", "tlh", "tlh-Latn", + "tlh-Piqd", "ko", "lv", "lt", "mg", "ms", "mt", "nb", "fa", "pl", "pt", "pt-br", "pt-PT", + "otq", "ro", "ru", "sm", "sr-Cyrl", "sr-Latn", "sk", "sl", "es", "sv", "ty", "ta", "te", "th", + "to", "tr", "uk", "ur", "vi", "cy", "yua", "ga", "kn", "mi", "ml", and "pa". +:vartype defaultFromLanguageCode: Union[str, "TextTranslationSkillLanguage"] +:ivar suggestedFrom: The language code to translate documents from when neither the + fromLanguageCode input nor the defaultFromLanguageCode parameter are provided, and the + automatic language detection is unsuccessful. Default is ``en``. Known values are: "af", "ar", + "bn", "bs", "bg", "yue", "ca", "zh-Hans", "zh-Hant", "hr", "cs", "da", "nl", "en", "et", "fj", + "fil", "fi", "fr", "de", "el", "ht", "he", "hi", "mww", "hu", "is", "id", "it", "ja", "sw", + "tlh", "tlh-Latn", "tlh-Piqd", "ko", "lv", "lt", "mg", "ms", "mt", "nb", "fa", "pl", "pt", + "pt-br", "pt-PT", "otq", "ro", "ru", "sm", "sr-Cyrl", "sr-Latn", "sk", "sl", "es", "sv", "ty", + "ta", "te", "th", "to", "tr", "uk", "ur", "vi", "cy", "yua", "ga", "kn", "mi", "ml", and "pa". +:vartype suggestedFrom: Union[str, "TextTranslationSkillLanguage"] +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Text.TranslationSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Text.TranslationSkill"] +""" + + +class TextWeights(TypedDict, total=False): + """Defines weights on index fields for which matches should boost scoring in search queries. + + :ivar weights: The dictionary of per-field weights to boost document scoring. The keys are + field names and the values are the weights for each field. Required. + :vartype weights: dict[str, float] + """ + + weights: Required[dict[str, float]] + """The dictionary of per-field weights to boost document scoring. The keys are field names and the + values are the weights for each field. Required.""" + + +TruncateTokenFilter = TypedDict( + "TruncateTokenFilter", + { + "name": Required[str], + "length": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.TruncateTokenFilter"]], + }, + total=False, +) +TruncateTokenFilter.__doc__ = """Truncates the terms to a specific length. This token filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 length: The length at which terms will be truncated. Default and maximum is 300. +:vartype length: int +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.TruncateTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.TruncateTokenFilter"] +""" + + +UaxUrlEmailTokenizer = TypedDict( + "UaxUrlEmailTokenizer", + { + "name": Required[str], + "maxTokenLength": int, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.UaxUrlEmailTokenizer"]], + }, + total=False, +) +UaxUrlEmailTokenizer.__doc__ = """Tokenizes urls and emails as one token. 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 maxTokenLength: 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 maxTokenLength: int +:ivar ``@odata.type``: A URI fragment specifying the type of tokenizer. Required. Default value + is "#Microsoft.Azure.Search.UaxUrlEmailTokenizer". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.UaxUrlEmailTokenizer"] +""" + + +UniqueTokenFilter = TypedDict( + "UniqueTokenFilter", + { + "name": Required[str], + "onlyOnSamePosition": bool, + "@odata.type": Required[Literal["#Microsoft.Azure.Search.UniqueTokenFilter"]], + }, + total=False, +) +UniqueTokenFilter.__doc__ = """Filters out tokens with same text as the previous token. This token filter is implemented using +Apache Lucene. + +:ivar name: The name of the token 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 onlyOnSamePosition: A value indicating whether to remove duplicates only at the same + position. Default is false. +:vartype onlyOnSamePosition: bool +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.UniqueTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.UniqueTokenFilter"] +""" + + +class UpdateKnowledgeSourceFileRequest(TypedDict, total=False): + """Multipart request for updating a file in a File knowledge source. + + :ivar metadata: The JSON metadata describing the file. Required. + :vartype metadata: "FileUploadMetadata" + :ivar content: The raw file content. Required. + :vartype content: FileType + """ + + metadata: Required["FileUploadMetadata"] + """The JSON metadata describing the file. Required.""" + content: Required[FileType] + """The raw file content. Required.""" + + +class UploadKnowledgeSourceFileMultipartRequest(TypedDict, total=False): # pylint: disable=name-too-long + """Multipart request for uploading a file to a File knowledge source. + + :ivar metadata: The JSON metadata describing the file. Required. + :vartype metadata: "FileUploadMetadata" + :ivar content: The raw file content. Required. + :vartype content: FileType + """ + + metadata: Required["FileUploadMetadata"] + """The JSON metadata describing the file. Required.""" + content: Required[FileType] + """The raw file content. Required.""" + + +class VectorSearch(TypedDict, total=False): + """Contains configuration options related to vector search. + + :ivar profiles: Defines combinations of configurations to use with vector search. + :vartype profiles: list["VectorSearchProfile"] + :ivar algorithms: Contains configuration options specific to the algorithm used during indexing + or querying. + :vartype algorithms: list["VectorSearchAlgorithmConfiguration"] + :ivar vectorizers: Contains configuration options on how to vectorize text vector queries. + :vartype vectorizers: list["VectorSearchVectorizer"] + :ivar compressions: Contains configuration options specific to the compression method used + during indexing or querying. + :vartype compressions: list["VectorSearchCompression"] + """ + + profiles: list["VectorSearchProfile"] + """Defines combinations of configurations to use with vector search.""" + algorithms: list["VectorSearchAlgorithmConfiguration"] + """Contains configuration options specific to the algorithm used during indexing or querying.""" + vectorizers: list["VectorSearchVectorizer"] + """Contains configuration options on how to vectorize text vector queries.""" + compressions: list["VectorSearchCompression"] + """Contains configuration options specific to the compression method used during indexing or + querying.""" + + +class VectorSearchProfile(TypedDict, total=False): + """Defines a combination of configurations to use with vector search. + + :ivar name: The name to associate with this particular vector search profile. Required. + :vartype name: str + :ivar algorithm: The name of the vector search algorithm configuration that specifies the + algorithm and optional parameters. Required. + :vartype algorithm: str + :ivar vectorizer: The name of the vectorization being configured for use with vector search. + :vartype vectorizer: str + :ivar compression: The name of the compression method configuration that specifies the + compression method and optional parameters. + :vartype compression: str + """ + + name: Required[str] + """The name to associate with this particular vector search profile. Required.""" + algorithm: Required[str] + """The name of the vector search algorithm configuration that specifies the algorithm and optional + parameters. Required.""" + vectorizer: str + """The name of the vectorization being configured for use with vector search.""" + compression: str + """The name of the compression method configuration that specifies the compression method and + optional parameters.""" + + +VisionVectorizeSkill = TypedDict( + "VisionVectorizeSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "modelVersion": Required[Optional[str]], + "@odata.type": Required[Literal["#Microsoft.Skills.Vision.VectorizeSkill"]], + }, + total=False, +) +VisionVectorizeSkill.__doc__ = """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["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["OutputFieldMappingEntry"] +:ivar modelVersion: 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 modelVersion: str +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Vision.VectorizeSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Vision.VectorizeSkill"] +""" + + +class WebApiHttpHeaders(TypedDict, total=False): + """A dictionary of http request headers.""" + + +WebApiSkill = TypedDict( + "WebApiSkill", + { + "name": str, + "description": str, + "context": str, + "inputs": Required[list["InputFieldMappingEntry"]], + "outputs": Required[list["OutputFieldMappingEntry"]], + "uri": Required[str], + "httpHeaders": "WebApiHttpHeaders", + "httpMethod": str, + "timeout": str, + "batchSize": Optional[int], + "degreeOfParallelism": Optional[int], + "authResourceId": Optional[str], + "authIdentity": Optional["SearchIndexerDataIdentity"], + "@odata.type": Required[Literal["#Microsoft.Skills.Custom.WebApiSkill"]], + }, + total=False, +) +WebApiSkill.__doc__ = """A skill that can call a Web API endpoint, allowing you to extend a skillset by having it call +your custom code. + +: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["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["OutputFieldMappingEntry"] +:ivar uri: The url for the Web API. Required. +:vartype uri: str +:ivar httpHeaders: The headers required to make the http request. +:vartype httpHeaders: "WebApiHttpHeaders" +:ivar httpMethod: The method for the http request. +:vartype httpMethod: str +:ivar timeout: The desired timeout for the request. Default is 30 seconds. +:vartype timeout: str +:ivar batchSize: The desired batch size which indicates number of documents. +:vartype batchSize: int +:ivar degreeOfParallelism: If set, the number of parallel calls that can be made to the Web + API. +:vartype degreeOfParallelism: int +:ivar authResourceId: Applies to custom skills that connect to external code in an Azure + function or some other application that provides the transformations. This value should be the + application ID created for the function or app when it was registered with Azure Active + Directory. When specified, the custom skill connects to the function or app using a managed ID + (either system or user-assigned) of the search service and the access token of the function or + app, using this value as the resource id for creating the scope of the access token. +:vartype authResourceId: str +:ivar authIdentity: 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 indexer, if the identity is unspecified, the value remains unchanged. + If set to "none", the value of this property is cleared. +:vartype authIdentity: "SearchIndexerDataIdentity" +:ivar ``@odata.type``: A URI fragment specifying the type of skill. Required. Default value is + "#Microsoft.Skills.Custom.WebApiSkill". +:vartype ``@odata.type``: Literal["#Microsoft.Skills.Custom.WebApiSkill"] +""" + + +class WebApiVectorizer(TypedDict, total=False): + """Specifies a user-defined vectorizer for generating the vector embedding of a query string. + Integration of an external vectorizer is achieved using the custom Web API interface of a + skillset. + + :ivar name: The name to associate with this particular vectorization method. Required. + :vartype name: str + :ivar customWebApiParameters: Specifies the properties of the user-defined vectorizer. + :vartype customWebApiParameters: "WebApiVectorizerParameters" + :ivar kind: The name of the kind of vectorization method being configured for use with vector + search. Required. Generate embeddings using a custom web endpoint at query time. + :vartype kind: Literal[VectorSearchVectorizerKind.CUSTOM_WEB_API] + """ + + name: Required[str] + """The name to associate with this particular vectorization method. Required.""" + customWebApiParameters: "WebApiVectorizerParameters" + """Specifies the properties of the user-defined vectorizer.""" + kind: Required[Literal[VectorSearchVectorizerKind.CUSTOM_WEB_API]] + """The name of the kind of vectorization method being configured for use with vector search. + Required. Generate embeddings using a custom web endpoint at query time.""" + + +class WebApiVectorizerParameters(TypedDict, total=False): + """Specifies the properties for connecting to a user-defined vectorizer. + + :ivar uri: The URI of the Web API providing the vectorizer. + :vartype uri: str + :ivar httpHeaders: The headers required to make the HTTP request. + :vartype httpHeaders: dict[str, str] + :ivar httpMethod: The method for the HTTP request. + :vartype httpMethod: str + :ivar timeout: The desired timeout for the request. Default is 30 seconds. + :vartype timeout: str + :ivar authResourceId: Applies to custom endpoints that connect to external code in an Azure + function or some other application that provides the transformations. This value should be the + application ID created for the function or app when it was registered with Azure Active + Directory. When specified, the vectorization connects to the function or app using a managed ID + (either system or user-assigned) of the search service and the access token of the function or + app, using this value as the resource id for creating the scope of the access token. + :vartype authResourceId: str + :ivar authIdentity: 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 indexer, if the identity is unspecified, the value remains unchanged. + If set to "none", the value of this property is cleared. + :vartype authIdentity: "SearchIndexerDataIdentity" + """ + + uri: str + """The URI of the Web API providing the vectorizer.""" + httpHeaders: dict[str, str] + """The headers required to make the HTTP request.""" + httpMethod: str + """The method for the HTTP request.""" + timeout: str + """The desired timeout for the request. Default is 30 seconds.""" + authResourceId: Optional[str] + """Applies to custom endpoints that connect to external code in an Azure function or some other + application that provides the transformations. This value should be the application ID created + for the function or app when it was registered with Azure Active Directory. When specified, the + vectorization connects to the function or app using a managed ID (either system or + user-assigned) of the search service and the access token of the function or app, using this + value as the resource id for creating the scope of the access token.""" + authIdentity: Optional["SearchIndexerDataIdentity"] + """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 indexer, if the identity is unspecified, the value remains unchanged. If set to \"none\", + the value of this property is cleared.""" + + +WebKnowledgeSource = TypedDict( + "WebKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.WEB]], + "webParameters": "WebKnowledgeSourceParameters", + }, + total=False, +) +WebKnowledgeSource.__doc__ = """Knowledge Source targeting web results. + +:ivar name: The name of the knowledge source. Required. +:vartype name: str +:ivar description: Optional user-defined description. +:vartype description: str +:ivar resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: Required. A knowledge source that reads data from the web. +:vartype kind: Literal[KnowledgeSourceKind.WEB] +:ivar webParameters: The parameters for the web knowledge source. +:vartype webParameters: "WebKnowledgeSourceParameters" +""" + + +class WebKnowledgeSourceDomain(TypedDict, total=False): + """Configuration for web knowledge source domain. + + :ivar address: The address of the domain. Required. + :vartype address: str + :ivar includeSubpages: Whether or not to include subpages from this domain. + :vartype includeSubpages: bool + """ + + address: Required[str] + """The address of the domain. Required.""" + includeSubpages: bool + """Whether or not to include subpages from this domain.""" + + +class WebKnowledgeSourceDomains(TypedDict, total=False): + """Domain allow/block configuration for web knowledge source. + + :ivar allowedDomains: Domains that are allowed for web results. + :vartype allowedDomains: list["WebKnowledgeSourceDomain"] + :ivar blockedDomains: Domains that are blocked from web results. + :vartype blockedDomains: list["WebKnowledgeSourceDomain"] + """ + + allowedDomains: list["WebKnowledgeSourceDomain"] + """Domains that are allowed for web results.""" + blockedDomains: list["WebKnowledgeSourceDomain"] + """Domains that are blocked from web results.""" + + +class WebKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for web knowledge source. + + :ivar domains: Domain allow/block configuration for web results. + :vartype domains: "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: "WebKnowledgeSourceDomains" + """Domain allow/block configuration for web results.""" + language: str + """The default language for web results. Can be overridden at query time via knowledge source + runtime parameters.""" + market: str + """The default market for web results. Can be overridden at query time via knowledge source + runtime parameters.""" + count: int + """The default number of web results to return. Can be overridden at query time via knowledge + source runtime parameters.""" + freshness: str + """The default freshness filter for web results. Can be overridden at query time via knowledge + source runtime parameters.""" + + +WordDelimiterTokenFilter = TypedDict( + "WordDelimiterTokenFilter", + { + "name": Required[str], + "generateWordParts": bool, + "generateNumberParts": bool, + "catenateWords": bool, + "catenateNumbers": bool, + "catenateAll": bool, + "splitOnCaseChange": bool, + "preserveOriginal": bool, + "splitOnNumerics": bool, + "stemEnglishPossessive": bool, + "protectedWords": list[str], + "@odata.type": Required[Literal["#Microsoft.Azure.Search.WordDelimiterTokenFilter"]], + }, + total=False, +) +WordDelimiterTokenFilter.__doc__ = """Splits words into subwords and performs optional transformations on subword groups. This token +filter is implemented using Apache Lucene. + +:ivar name: The name of the token 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 generateWordParts: A value indicating whether to generate part words. If set, causes + parts of words to be generated; for example "AzureSearch" becomes "Azure" "Search". Default is + true. +:vartype generateWordParts: bool +:ivar generateNumberParts: A value indicating whether to generate number subwords. Default is + true. +:vartype generateNumberParts: bool +:ivar catenateWords: A value indicating whether maximum runs of word parts will be catenated. + For example, if this is set to true, "Azure-Search" becomes "AzureSearch". Default is false. +:vartype catenateWords: bool +:ivar catenateNumbers: A value indicating whether maximum runs of number parts will be + catenated. For example, if this is set to true, "1-2" becomes "12". Default is false. +:vartype catenateNumbers: bool +:ivar catenateAll: A value indicating whether all subword parts will be catenated. For example, + if this is set to true, "Azure-Search-1" becomes "AzureSearch1". Default is false. +:vartype catenateAll: bool +:ivar splitOnCaseChange: A value indicating whether to split words on caseChange. For example, + if this is set to true, "AzureSearch" becomes "Azure" "Search". Default is true. +:vartype splitOnCaseChange: bool +:ivar preserveOriginal: A value indicating whether original words will be preserved and added + to the subword list. Default is false. +:vartype preserveOriginal: bool +:ivar splitOnNumerics: A value indicating whether to split on numbers. For example, if this is + set to true, "Azure1Search" becomes "Azure" "1" "Search". Default is true. +:vartype splitOnNumerics: bool +:ivar stemEnglishPossessive: A value indicating whether to remove trailing "'s" for each + subword. Default is true. +:vartype stemEnglishPossessive: bool +:ivar protectedWords: A list of tokens to protect from being delimited. +:vartype protectedWords: list[str] +:ivar ``@odata.type``: A URI fragment specifying the type of token filter. Required. Default + value is "#Microsoft.Azure.Search.WordDelimiterTokenFilter". +:vartype ``@odata.type``: Literal["#Microsoft.Azure.Search.WordDelimiterTokenFilter"] +""" + + +WorkIQKnowledgeSource = TypedDict( + "WorkIQKnowledgeSource", + { + "name": Required[str], + "description": str, + "resultsProcessing": Union[str, "KnowledgeSourceResultsProcessing"], + "@odata.etag": str, + "encryptionKey": Optional["SearchResourceEncryptionKey"], + "kind": Required[Literal[KnowledgeSourceKind.WORK_IQ]], + "workIQParameters": Required["WorkIQKnowledgeSourceParameters"], + }, + total=False, +) +WorkIQKnowledgeSource.__doc__ = """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 resultsProcessing: Controls whether results from this knowledge source are reranked + before they are included in the final result set. Defaults to 'rerank' when not specified. + Known values are: "rerank" and "none". +:vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] +:ivar ``@odata.etag``: The ETag of the knowledge source. +:vartype ``@odata.etag``: str +:ivar encryptionKey: 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 encryptionKey: "SearchResourceEncryptionKey" +:ivar kind: The discriminator value. Required. A knowledge source that reads data from work IQ. +:vartype kind: Literal[KnowledgeSourceKind.WORK_IQ] +:ivar workIQParameters: The parameters for the WorkIQ knowledge source, including the + customer-owned Entra app configuration used for on-behalf-of authentication. Required. +:vartype workIQParameters: "WorkIQKnowledgeSourceParameters" +""" + + +class WorkIQKnowledgeSourceParameters(TypedDict, total=False): + """Parameters for a WorkIQ knowledge source. + + :ivar entraAppAuthentication: The customer-owned Microsoft Entra app registration configuration + used for on-behalf-of authentication to the Work IQ API. The customer registers a tenant-owned + Entra app, grants it the WorkIQAgent.Ask delegated permission, and configures a federated + credential so Azure AI Search can authenticate as that app without a stored client secret. + Required. + :vartype entraAppAuthentication: "EntraAppAuthentication" + """ + + entraAppAuthentication: Required["EntraAppAuthentication"] + """The customer-owned Microsoft Entra app registration configuration used for on-behalf-of + authentication to the Work IQ API. The customer registers a tenant-owned Entra app, grants it + the WorkIQAgent.Ask delegated permission, and configures a federated credential so Azure AI + Search can authenticate as that app without a stored client secret. Required.""" + + +CognitiveServicesAccount = Union[ + AIServicesAccountIdentity, AIServicesAccountKey, CognitiveServicesAccountKey, DefaultCognitiveServicesAccount +] +VectorSearchVectorizer = Union[ + AIServicesVisionVectorizer, AzureMachineLearningVectorizer, AzureOpenAIVectorizer, WebApiVectorizer +] +TokenFilter = Union[ + AsciiFoldingTokenFilter, + CjkBigramTokenFilter, + CommonGramTokenFilter, + DictionaryDecompounderTokenFilter, + EdgeNGramTokenFilter, + EdgeNGramTokenFilterV2, + ElisionTokenFilter, + KeepTokenFilter, + KeywordMarkerTokenFilter, + LengthTokenFilter, + LimitTokenFilter, + NGramTokenFilter, + NGramTokenFilterV2, + PatternCaptureTokenFilter, + PatternReplaceTokenFilter, + PhoneticTokenFilter, + ShingleTokenFilter, + SnowballTokenFilter, + StemmerOverrideTokenFilter, + StemmerTokenFilter, + StopwordsTokenFilter, + SynonymTokenFilter, + TruncateTokenFilter, + UniqueTokenFilter, + WordDelimiterTokenFilter, +] +KnowledgeSource = Union[ + AzureBlobKnowledgeSource, + FabricDataAgentKnowledgeSource, + FabricOntologyKnowledgeSource, + FileKnowledgeSource, + IndexedOneLakeKnowledgeSource, + IndexedSharePointKnowledgeSource, + IndexedSqlKnowledgeSource, + McpServerKnowledgeSource, + RemoteSharePointKnowledgeSource, + SearchIndexKnowledgeSource, + WebKnowledgeSource, + WorkIQKnowledgeSource, +] +SearchIndexerSkill = Union[ + AzureMachineLearningSkill, + ChatCompletionSkill, + WebApiSkill, + AzureOpenAIEmbeddingSkill, + CustomEntityLookupSkill, + KeyPhraseExtractionSkill, + LanguageDetectionSkill, + MergeSkill, + PIIDetectionSkill, + SplitSkill, + TextTranslationSkill, + EntityLinkingSkill, + EntityRecognitionSkillV3, + SentimentSkillV3, + ConditionalSkill, + ContentUnderstandingSkill, + DocumentExtractionSkill, + DocumentIntelligenceLayoutSkill, + ShaperSkill, + ImageAnalysisSkill, + OcrSkill, + VisionVectorizeSkill, +] +VectorSearchCompression = Union[BinaryQuantizationCompression, ScalarQuantizationCompression] +SimilarityAlgorithm = Union[BM25SimilarityAlgorithm, ClassicSimilarityAlgorithm] +CharFilter = Union[MappingCharFilter, PatternReplaceCharFilter] +LexicalTokenizer = Union[ + ClassicTokenizer, + EdgeNGramTokenizer, + KeywordTokenizer, + KeywordTokenizerV2, + MicrosoftLanguageStemmingTokenizer, + MicrosoftLanguageTokenizer, + NGramTokenizer, + PathHierarchyTokenizerV2, + PatternTokenizer, + LuceneStandardTokenizer, + LuceneStandardTokenizerV2, + UaxUrlEmailTokenizer, +] +LexicalAnalyzer = Union[CustomAnalyzer, PatternAnalyzer, LuceneStandardAnalyzer, StopAnalyzer] +LexicalNormalizer = Union[CustomNormalizer] +DataChangeDetectionPolicy = Union[HighWaterMarkChangeDetectionPolicy, SqlIntegratedChangeTrackingPolicy] +DataDeletionDetectionPolicy = Union[ + NativeBlobSoftDeleteDeletionDetectionPolicy, SoftDeleteColumnDeletionDetectionPolicy +] +ScoringFunction = Union[DistanceScoringFunction, FreshnessScoringFunction, MagnitudeScoringFunction, TagScoringFunction] +VectorSearchAlgorithmConfiguration = Union[ExhaustiveKnnAlgorithmConfiguration, HnswAlgorithmConfiguration] +KnowledgeBaseModel = Union[KnowledgeBaseAzureOpenAIModel] +McpServerAuthentication = Union[McpServerFoundryConnectionAuthentication, McpServerStoredHeadersAuthentication] +McpServerOutputParsing = Union[ + McpServerAutoOutputParsing, McpServerJsonOutputParsing, McpServerNoneOutputParsing, McpServerSplitOutputParsing +] +SearchIndexerDataIdentity = Union[SearchIndexerDataNoneIdentity, SearchIndexerDataUserAssignedIdentity] +SearchIndexKnowledgeSourceBoost = Union[ + SearchIndexKnowledgeSourceFieldValueBoost, SearchIndexKnowledgeSourceMultiWordExpressionBoost +] 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 7a5b0521fe82..bb73a0e5594f 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 @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,11 +19,18 @@ from ._configuration import KnowledgeBaseRetrievalClientConfiguration from ._operations import _KnowledgeBaseRetrievalClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential -class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin): +class KnowledgeBaseRetrievalClient( + _KnowledgeBaseRetrievalClientOperationsMixin +): # pylint: disable=docstring-keyword-should-match-keyword-only """KnowledgeBaseRetrievalClient. :param endpoint: The endpoint URL of the search service. Required. @@ -35,8 +42,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin) :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-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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 1d5627362187..d237ae4721ef 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -17,7 +18,7 @@ from azure.core.credentials import TokenCredential -class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long,docstring-keyword-should-match-keyword-only """Configuration for KnowledgeBaseRetrievalClient. Note that all parameters used to create this instance are saved as instance @@ -32,8 +33,9 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins :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-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -44,7 +46,7 @@ def __init__( knowledge_base_name: str, **kwargs: Any, ) -> None: - api_version: str = kwargs.pop("api_version", "2026-05-01-preview") + api_version: str = kwargs.pop("api_version", "2026-08-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 8d4903b5128c..39101cf02060 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 @@ -8,7 +8,7 @@ from collections.abc import MutableMapping from io import IOBase import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -26,7 +26,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict -from .. import models as _models1 +from .. import models as _models1, types as _types_models1 from ... import models as _models2 from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Serializer @@ -34,7 +34,6 @@ from ..._validation import api_version_validation from .._configuration import KnowledgeBaseRetrievalClientConfiguration -JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] @@ -43,13 +42,17 @@ def build_knowledge_base_retrieval_retrieve_request( # pylint: disable=name-too-long - knowledge_base_name: str, *, query_source_authorization: Optional[str] = None, **kwargs: Any + knowledge_base_name: str, + *, + query_source_authorization: Optional[str] = None, + query_work_iq_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-05-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-08-01-preview")) accept = _headers.pop("Accept", "application/json;odata.metadata=minimal") # Construct URL @@ -70,6 +73,51 @@ def build_knowledge_base_retrieval_retrieve_request( # pylint: disable=name-too _headers["x-ms-query-source-authorization"] = _SERIALIZER.header( "query_source_authorization", query_source_authorization, "str" ) + if query_work_iq_source_authorization is not None: + _headers["x-ms-query-work-iq-source-authorization"] = _SERIALIZER.header( + "query_work_iq_source_authorization", query_work_iq_source_authorization, "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_knowledge_base_retrieval_retrieve_stream_request( # pylint: disable=name-too-long + knowledge_base_name: str, + *, + query_source_authorization: Optional[str] = None, + query_work_iq_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-08-01-preview")) + accept = _headers.pop("Accept", "text/event-stream") + + # Construct URL + _url = "/knowledgebases('{knowledgeBaseName}')/retrieve" + path_format_arguments = { + "knowledgeBaseName": _SERIALIZER.url("knowledge_base_name", knowledge_base_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 + _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 query_work_iq_source_authorization is not None: + _headers["x-ms-query-work-iq-source-authorization"] = _SERIALIZER.header( + "query_work_iq_source_authorization", query_work_iq_source_authorization, "str" + ) if content_type is not None: _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") @@ -86,6 +134,7 @@ def retrieve( retrieval_request: _models1.KnowledgeBaseRetrievalRequest, *, query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, content_type: str = "application/json", **kwargs: Any ) -> _models1.KnowledgeBaseRetrievalResponse: @@ -98,6 +147,10 @@ def retrieve( executed. This token is used to enforce security restrictions on documents. Default value is None. :paramtype query_source_authorization: str + :keyword query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 @@ -110,20 +163,26 @@ def retrieve( @overload def retrieve( self, - retrieval_request: JSON, + retrieval_request: _types_models1.KnowledgeBaseRetrievalRequest, *, query_source_authorization: Optional[str] = None, + query_work_iq_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 + :type retrieval_request: + ~azure.search.documents.knowledgebases.types.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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 @@ -139,6 +198,7 @@ def retrieve( retrieval_request: IO[bytes], *, query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, content_type: str = "application/json", **kwargs: Any ) -> _models1.KnowledgeBaseRetrievalResponse: @@ -150,6 +210,10 @@ def retrieve( executed. This token is used to enforce security restrictions on documents. Default value is None. :paramtype query_source_authorization: str + :keyword query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 @@ -161,27 +225,37 @@ 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"], + params_added_on={ + "2026-05-01-preview": ["query_source_authorization"], + "2026-08-01-preview": ["query_work_iq_source_authorization"], + }, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) def retrieve( self, - retrieval_request: Union[_models1.KnowledgeBaseRetrievalRequest, JSON, IO[bytes]], + retrieval_request: Union[ + _models1.KnowledgeBaseRetrievalRequest, _types_models1.KnowledgeBaseRetrievalRequest, IO[bytes] + ], *, query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, **kwargs: Any ) -> _models1.KnowledgeBaseRetrievalResponse: """KnowledgeBase retrieves relevant data from backing stores. - :param retrieval_request: The retrieval request to process. Is one of the following types: - KnowledgeBaseRetrievalRequest, JSON, IO[bytes] Required. + :param retrieval_request: The retrieval request to process. Is either a + KnowledgeBaseRetrievalRequest type or a IO[bytes] type. Required. :type retrieval_request: - ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest or JSON or - IO[bytes] + ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest or + ~azure.search.documents.knowledgebases.types.KnowledgeBaseRetrievalRequest 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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_source_authorization: str :return: KnowledgeBaseRetrievalResponse. The KnowledgeBaseRetrievalResponse is compatible with MutableMapping :rtype: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse @@ -211,6 +285,7 @@ def retrieve( _request = build_knowledge_base_retrieval_retrieve_request( knowledge_base_name=self._config.knowledge_base_name, query_source_authorization=query_source_authorization, + query_work_iq_source_authorization=query_work_iq_source_authorization, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -252,3 +327,239 @@ def retrieve( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + @overload + def retrieve_stream( + self, + retrieval_request: _models1.KnowledgeBaseRetrievalRequest, + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Retrieves relevant data from backing stores and streams progress and results as server-sent + events. + + Process the response incrementally using server-sent event framing. Each event contains an + event name and a JSON-encoded data payload. The stream ends with either a + ``response.completed`` + event or an ``error`` event. OpenAPI 2.0 represents the response body as a string, so generated + clients may expose the raw response without typed event parsing. Do not deserialize the + complete response body as a single JSON document. + + :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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def retrieve_stream( + self, + retrieval_request: _types_models1.KnowledgeBaseRetrievalRequest, + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Retrieves relevant data from backing stores and streams progress and results as server-sent + events. + + Process the response incrementally using server-sent event framing. Each event contains an + event name and a JSON-encoded data payload. The stream ends with either a + ``response.completed`` + event or an ``error`` event. OpenAPI 2.0 represents the response body as a string, so generated + clients may expose the raw response without typed event parsing. Do not deserialize the + complete response body as a single JSON document. + + :param retrieval_request: The retrieval request to process. Required. + :type retrieval_request: + ~azure.search.documents.knowledgebases.types.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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def retrieve_stream( + self, + retrieval_request: IO[bytes], + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterator[bytes]: + """Retrieves relevant data from backing stores and streams progress and results as server-sent + events. + + Process the response incrementally using server-sent event framing. Each event contains an + event name and a JSON-encoded data payload. The stream ends with either a + ``response.completed`` + event or an ``error`` event. OpenAPI 2.0 represents the response body as a string, so generated + clients may expose the raw response without typed event parsing. Do not deserialize the + complete response body as a single JSON document. + + :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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": [ + "api_version", + "accept", + "knowledge_base_name", + "query_source_authorization", + "query_work_iq_source_authorization", + "client_request_id", + "content_type", + ] + }, + api_versions_list=["2026-08-01-preview"], + ) + def retrieve_stream( + self, + retrieval_request: Union[ + _models1.KnowledgeBaseRetrievalRequest, _types_models1.KnowledgeBaseRetrievalRequest, IO[bytes] + ], + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + """Retrieves relevant data from backing stores and streams progress and results as server-sent + events. + + Process the response incrementally using server-sent event framing. Each event contains an + event name and a JSON-encoded data payload. The stream ends with either a + ``response.completed`` + event or an ``error`` event. OpenAPI 2.0 represents the response body as a string, so generated + clients may expose the raw response without typed event parsing. Do not deserialize the + complete response body as a single JSON document. + + :param retrieval_request: The retrieval request to process. Is either a + KnowledgeBaseRetrievalRequest type or a IO[bytes] type. Required. + :type retrieval_request: + ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest or + ~azure.search.documents.knowledgebases.types.KnowledgeBaseRetrievalRequest 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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_source_authorization: str + :return: Iterator[bytes] + :rtype: Iterator[bytes] + :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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(retrieval_request, (IOBase, bytes)): + _content = retrieval_request + else: + _content = json.dumps(retrieval_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_knowledge_base_retrieval_retrieve_stream_request( + knowledge_base_name=self._config.knowledge_base_name, + query_source_authorization=query_source_authorization, + query_work_iq_source_authorization=query_work_iq_source_authorization, + 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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models2.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_operations/_patch.py @@ -8,7 +8,6 @@ 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 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 d1cbe84ce31d..0576879940f2 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 @@ -7,11 +7,15 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Any, Union + +from typing import Any, cast, IO, Optional, Union from azure.core.credentials import AzureKeyCredential, TokenCredential +from azure.core.tracing.decorator import distributed_trace from ._client import KnowledgeBaseRetrievalClient as _KnowledgeBaseRetrievalClient +from . import models, types +from ._stream import KnowledgeBaseRetrievalEvent, KnowledgeBaseRetrievalEventData, KnowledgeBaseRetrievalStream class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClient): @@ -26,9 +30,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClient): :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 - listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is - ``ApiVersion.V2026_05_01_PREVIEW``. Note that overriding this default value may - result in unsupported behavior. + listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is + ``ApiVersion.V2026_08_01_PREVIEW``. Note that overriding this default value may + result in unsupported behavior. :paramtype api_version: str or ~azure.search.documents.ApiVersion :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 @@ -41,9 +45,76 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, TokenCre kwargs.setdefault("credential_scopes", [audience.rstrip("/") + "/.default"]) super().__init__(endpoint=endpoint, credential=credential, **kwargs) + @distributed_trace + def retrieve_stream( # type: ignore[override] + self, + retrieval_request: Union[models.KnowledgeBaseRetrievalRequest, dict[str, Any], IO[bytes]], + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> KnowledgeBaseRetrievalStream: + """Retrieve relevant data and stream typed server-sent events. + + :param retrieval_request: The retrieval request to process. Required. + :type retrieval_request: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest + or dict or IO[bytes] + :keyword query_source_authorization: Token identifying the user for which the query is + executed. Default value is None. + :paramtype query_source_authorization: str + :keyword query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Default value is None. + :paramtype query_work_iq_source_authorization: str + :keyword content_type: Body parameter content type. Default value is "application/json". + :paramtype content_type: str + :return: A stream of typed knowledge base retrieval events. + :rtype: ~azure.search.documents.knowledgebases.KnowledgeBaseRetrievalStream + :raises ~azure.core.exceptions.HttpResponseError: + """ + custom_cls = kwargs.pop("cls", None) + callback_context: dict[str, Any] = {} + + def _wrap_stream(pipeline_response, raw_stream, response_headers): + stream = KnowledgeBaseRetrievalStream( + response=pipeline_response.http_response, + raw_stream=raw_stream, + ) + callback_context.update(pipeline_response=pipeline_response, response_headers=response_headers) + return stream + + typed_retrieval_request = cast( + Union[models.KnowledgeBaseRetrievalRequest, types.KnowledgeBaseRetrievalRequest, IO[bytes]], + retrieval_request, + ) + stream = cast( + KnowledgeBaseRetrievalStream, + super().retrieve_stream( + typed_retrieval_request, + query_source_authorization=query_source_authorization, + query_work_iq_source_authorization=query_work_iq_source_authorization, + content_type=content_type, + cls=_wrap_stream, + **kwargs, + ), + ) + if not custom_cls: + return stream + try: + return cast( + KnowledgeBaseRetrievalStream, + custom_cls(callback_context["pipeline_response"], stream, callback_context["response_headers"]), + ) + except Exception: + stream.close() + raise + __all__: list[str] = [ "KnowledgeBaseRetrievalClient", + "KnowledgeBaseRetrievalEvent", + "KnowledgeBaseRetrievalEventData", + "KnowledgeBaseRetrievalStream", ] @@ -54,3 +125,15 @@ def patch_sdk(): you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize """ + query_parameter_types = ( + types.AzureBlobKnowledgeSourceParams, + types.FileKnowledgeSourceParams, + types.IndexedOneLakeKnowledgeSourceParams, + types.IndexedSharePointKnowledgeSourceParams, + types.IndexedSqlKnowledgeSourceParams, + types.SearchIndexKnowledgeSourceParams, + ) + for parameter_type in query_parameter_types: + parameter_type.__annotations__["queryHintOverrides"] = ( + "azure.search.documents.indexes.types.SearchIndexKnowledgeSourceQueryHints" + ) diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_stream.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_stream.py new file mode 100644 index 000000000000..10e20086d7bb --- /dev/null +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_stream.py @@ -0,0 +1,314 @@ +# 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. +# -------------------------------------------------------------------------- + +from __future__ import annotations + +import codecs +import json +from types import TracebackType +from typing import Any, AsyncGenerator, AsyncIterator, Generator, Iterator, Optional, Tuple, Type, Union +from typing_extensions import Self + +from . import models +from ._utils.model_base import _deserialize + +_TERMINAL_EVENTS = {"error", "response.completed"} + +KnowledgeBaseRetrievalEventData = Union[ + models.KnowledgeBaseRetrievalStartedEvent, + models.KnowledgeBaseActivityStartedEvent, + models.KnowledgeBaseActivityRecord, + models.KnowledgeBaseAnswerCompletedEvent, + list[models.KnowledgeBaseReference], + models.KnowledgeBaseStreamErrorEvent, + models.KnowledgeBaseResponseCompletedEvent, + dict[str, Any], + list[Any], + str, + int, + float, + bool, + None, +] + + +class KnowledgeBaseRetrievalEvent: + """A typed event emitted by a knowledge base retrieval stream. + + :ivar event_type: The server-sent event name. + :vartype event_type: str + :ivar data: The deserialized event payload. + :vartype data: object + """ + + event_type: str + data: KnowledgeBaseRetrievalEventData + + def __init__(self, event_type: str, data: KnowledgeBaseRetrievalEventData) -> None: + self.event_type = event_type + self.data = data + + def __repr__(self) -> str: + return f"KnowledgeBaseRetrievalEvent(event_type={self.event_type!r}, data={self.data!r})" + + +KnowledgeBaseRetrievalEvent.__module__ = "azure.search.documents.knowledgebases" + + +def _split_sse_lines(buffer: str) -> Tuple[list[str], str]: + lines: list[str] = [] + start = 0 + index = 0 + while index < len(buffer): + char = buffer[index] + if char == "\n": + lines.append(buffer[start:index]) + index += 1 + start = index + elif char == "\r": + if index + 1 == len(buffer): + break + lines.append(buffer[start:index]) + index += 2 if buffer[index + 1] == "\n" else 1 + start = index + else: + index += 1 + return lines, buffer[start:] + + +def _iter_sse_lines(raw_stream: Iterator[bytes]) -> Iterator[str]: + decoder = codecs.getincrementaldecoder("utf-8-sig")(errors="replace") + buffer = "" + for chunk in raw_stream: + buffer += decoder.decode(chunk) + lines, buffer = _split_sse_lines(buffer) + yield from lines + buffer += decoder.decode(b"", final=True) + lines, remainder = _split_sse_lines(buffer) + yield from lines + if remainder: + yield remainder[:-1] if remainder.endswith("\r") else remainder + + +async def _aiter_sse_lines(raw_stream: AsyncIterator[bytes]) -> AsyncIterator[str]: + decoder = codecs.getincrementaldecoder("utf-8-sig")(errors="replace") + buffer = "" + async for chunk in raw_stream: + buffer += decoder.decode(chunk) + lines, buffer = _split_sse_lines(buffer) + for line in lines: + yield line + buffer += decoder.decode(b"", final=True) + lines, remainder = _split_sse_lines(buffer) + for line in lines: + yield line + if remainder: + yield remainder[:-1] if remainder.endswith("\r") else remainder + + +class _SSEEventBuilder: + def __init__(self) -> None: + self._event_type = "" + self._data: list[str] = [] + + def add_line(self, line: str) -> Optional[Tuple[str, str]]: + if line == "": + return self._dispatch() + if line.startswith(":"): + return None + + field, _, value = line.partition(":") + if value.startswith(" "): + value = value[1:] + if field == "event": + self._event_type = value + elif field == "data": + self._data.append(value) + return None + + def _dispatch(self) -> Optional[Tuple[str, str]]: + if not self._data: + self._event_type = "" + return None + event = (self._event_type or "message", "\n".join(self._data)) + self._event_type = "" + self._data = [] + return event + + +def _iter_sse_events(raw_stream: Iterator[bytes]) -> Iterator[Tuple[str, str]]: + builder = _SSEEventBuilder() + for line in _iter_sse_lines(raw_stream): + event = builder.add_line(line) + if event is not None: + yield event + + +async def _aiter_sse_events(raw_stream: AsyncIterator[bytes]) -> AsyncIterator[Tuple[str, str]]: + builder = _SSEEventBuilder() + async for line in _aiter_sse_lines(raw_stream): + event = builder.add_line(line) + if event is not None: + yield event + + +def _deserialize_event(event_type: str, data: str) -> KnowledgeBaseRetrievalEvent: + payload = json.loads(data) + if event_type == "activity.completed": + event_data = models.KnowledgeBaseActivityRecord._deserialize(payload, []) # pylint: disable=protected-access + return KnowledgeBaseRetrievalEvent(event_type, event_data) + if event_type == "references.completed": + references = [ + models.KnowledgeBaseReference._deserialize(item, []) for item in payload # pylint: disable=protected-access + ] + return KnowledgeBaseRetrievalEvent(event_type, references) + deserializer = { + "retrieval.started": models.KnowledgeBaseRetrievalStartedEvent, + "activity.started": models.KnowledgeBaseActivityStartedEvent, + "answer.completed": models.KnowledgeBaseAnswerCompletedEvent, + "error": models.KnowledgeBaseStreamErrorEvent, + "response.completed": models.KnowledgeBaseResponseCompletedEvent, + }.get(event_type) + event_data = _deserialize(deserializer, payload) if deserializer is not None else payload + return KnowledgeBaseRetrievalEvent(event_type, event_data) + + +class KnowledgeBaseRetrievalStream(Iterator[KnowledgeBaseRetrievalEvent]): + """A synchronous stream of typed knowledge base retrieval events.""" + + def __init__(self, *, response: Any, raw_stream: Iterator[bytes]) -> None: + self._response = response + self._raw_stream = raw_stream + self._closed = False + self._resources_closed = False + self._iterator = self._iterate() + + def __iter__(self) -> Self: + return self + + def __next__(self) -> KnowledgeBaseRetrievalEvent: + return next(self._iterator) + + def _iterate(self) -> Generator[KnowledgeBaseRetrievalEvent, None, None]: + try: + for event_type, data in _iter_sse_events(self._raw_stream): + event = _deserialize_event(event_type, data) + if event_type in _TERMINAL_EVENTS: + self._close_resources() + yield event + if event_type in _TERMINAL_EVENTS: + return + finally: + self._close_resources() + self._closed = True + + def _close_resources(self) -> None: + if self._resources_closed: + return + self._resources_closed = True + close = getattr(self._raw_stream, "close", None) + try: + if close is not None: + close() + finally: + self._response.close() + + def close(self) -> None: + """Close the stream and its underlying HTTP response.""" + + if self._closed: + return + self._closed = True + try: + self._iterator.close() + finally: + self._close_resources() + + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: Optional[Type[BaseException]] = None, + exc_value: Optional[BaseException] = None, + traceback: Optional[TracebackType] = None, + ) -> None: + self.close() + + +class AsyncKnowledgeBaseRetrievalStream(AsyncIterator[KnowledgeBaseRetrievalEvent]): + """An asynchronous stream of typed knowledge base retrieval events.""" + + def __init__(self, *, response: Any, raw_stream: AsyncIterator[bytes]) -> None: + self._response = response + self._raw_stream = raw_stream + self._closed = False + self._resources_closed = False + self._iterator = self._iterate() + + def __aiter__(self) -> Self: + return self + + async def __anext__(self) -> KnowledgeBaseRetrievalEvent: + return await self._iterator.__anext__() + + async def _iterate(self) -> AsyncGenerator[KnowledgeBaseRetrievalEvent, None]: + try: + async for event_type, data in _aiter_sse_events(self._raw_stream): + event = _deserialize_event(event_type, data) + if event_type in _TERMINAL_EVENTS: + await self._close_resources() + yield event + if event_type in _TERMINAL_EVENTS: + return + finally: + await self._close_resources() + self._closed = True + + async def _close_resources(self) -> None: + if self._resources_closed: + return + self._resources_closed = True + aclose = getattr(self._raw_stream, "aclose", None) + try: + if aclose is not None: + await aclose() + finally: + await self._response.close() + + async def close(self) -> None: + """Close the stream and its underlying HTTP response.""" + + if self._closed: + return + self._closed = True + try: + await self._iterator.aclose() + finally: + await self._close_resources() + + async def __aenter__(self) -> Self: + return self + + async def __aexit__( + self, + exc_type: Optional[Type[BaseException]] = None, + exc_value: Optional[BaseException] = None, + traceback: Optional[TracebackType] = None, + ) -> None: + await self.close() + + +KnowledgeBaseRetrievalStream.__module__ = "azure.search.documents.knowledgebases" +AsyncKnowledgeBaseRetrievalStream.__module__ = "azure.search.documents.knowledgebases.aio" + + +__all__ = [ + "AsyncKnowledgeBaseRetrievalStream", + "KnowledgeBaseRetrievalEvent", + "KnowledgeBaseRetrievalEventData", + "KnowledgeBaseRetrievalStream", +] 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 db24930fdca9..35d5fc024978 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 @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -104,6 +109,29 @@ def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: return encoded +def _serialize_duration(td: timedelta, format: typing.Optional[str] = None): + """Serialize a timedelta to its wire representation. + + For the ``seconds``/``milliseconds`` encodings the value is converted to a + numeric value, otherwise it falls back to an ISO 8601 duration string. + + :param timedelta td: The timedelta to serialize. + :param str format: The duration encoding format. + :rtype: int or float or str + :return: serialized duration + """ + seconds = td.total_seconds() + if format == "duration-seconds-int": + return int(seconds) + if format == "duration-seconds-float": + return seconds + if format == "duration-milliseconds-int": + return int(seconds * 1000) + if format == "duration-milliseconds-float": + return seconds * 1000 + return _timedelta_as_isostr(td) + + def _serialize_datetime(o, format: typing.Optional[str] = None): if hasattr(o, "year") and hasattr(o, "hour"): if format == "rfc7231": @@ -130,7 +158,15 @@ def _is_readonly(p): class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" + """A JSON encoder that's capable of serializing datetime objects and bytes. + + :param args: Additional positional arguments passed to the base ``JSONEncoder``. + :type args: typing.Any + :keyword exclude_readonly: Whether to exclude readonly properties. Defaults to False. + :paramtype exclude_readonly: bool + :keyword format: The format to use for serialization. Defaults to None. + :paramtype format: typing.Optional[str] + """ def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): super().__init__(*args, **kwargs) @@ -296,6 +332,12 @@ def _deserialize_duration(attr): return isodate.parse_duration(attr) +def _deserialize_duration_numeric(attr, unit): + if isinstance(attr, timedelta): + return attr + return timedelta(**{unit: float(attr)}) + + def _deserialize_decimal(attr): if isinstance(attr, decimal.Decimal): return attr @@ -308,6 +350,12 @@ def _deserialize_int_as_str(attr): return int(attr) +def _deserialize_bool_as_str(attr): + if isinstance(attr, bool): + return attr + return attr.lower() == "true" + + _DESERIALIZE_MAPPING = { datetime: _deserialize_datetime, date: _deserialize_date, @@ -325,12 +373,18 @@ def _deserialize_int_as_str(attr): "unix-timestamp": _deserialize_datetime_unix_timestamp, "base64": _deserialize_bytes, "base64url": _deserialize_bytes_base64, + "duration-seconds-int": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-seconds-float": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-milliseconds-int": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), + "duration-milliseconds-float": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), } def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): if annotation is int and rf and rf._format == "str": return _deserialize_int_as_str + if annotation is bool and rf and rf._format == "str": + return _deserialize_bool_as_str if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) if rf and rf._format: @@ -420,21 +474,21 @@ def __ne__(self, other: typing.Any) -> bool: def keys(self) -> typing.KeysView[str]: """ - :returns: a set-like object providing a view on D's keys + :returns: a set-like object providing a view on the mapping's keys :rtype: ~typing.KeysView """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: """ - :returns: an object providing a view on D's values + :returns: an object providing a view on the mapping's values :rtype: ~typing.ValuesView """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: """ - :returns: set-like object providing a view on D's items + :returns: a set-like object providing a view on the mapping's items :rtype: ~typing.ItemsView """ return self._data.items() @@ -444,7 +498,7 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ try: @@ -479,19 +533,19 @@ def popitem(self) -> tuple[str, typing.Any]: Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple - :raises KeyError: if D is empty. + :raises KeyError: if the dictionary is empty. """ return self._data.popitem() def clear(self) -> None: """ - Remove all items from D. + Remove all items from the dictionary. """ self._data.clear() def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ """ - Updates D from mapping/iterable E and F. + Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs. """ self._data.update(*args, **kwargs) @@ -504,10 +558,11 @@ def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: """ - Same as calling D.get(k, d), and setting D[k]=d if k not found + Return the value for key if key is in the dictionary; otherwise set the key to + default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ if default is _UNSET: @@ -559,7 +614,7 @@ def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-m pass # Last, try datetime.timedelta try: - return _timedelta_as_isostr(o) + return _serialize_duration(o, format) except AttributeError: # This will be raised when it hits value.total_seconds in the method above pass @@ -585,6 +640,239 @@ def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typin return _serialize(value, rf._format) +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param class Model(_MyMutableMapping): _is_model = True # label whether current class's _attr_to_rest_field has been calculated @@ -595,11 +883,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -619,9 +903,19 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: if v is not None } ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) super().__init__(dict_to_pass) - def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: """Deserialize an XML element into a dict mapping rest field names to values. :param ET.Element element: The XML element to deserialize from. @@ -629,53 +923,89 @@ def _init_from_xml(self, element: ET.Element) -> dict[str, typing.Any]: :rtype: dict """ result: dict[str, typing.Any] = {} - model_meta = getattr(self, "_xml", {}) existed_attr_keys: list[str] = [] - for rf in self._attr_to_rest_field.values(): - prop_meta = getattr(rf, "_xml", {}) - xml_name = prop_meta.get("name", rf._rest_name) - xml_ns = _resolve_xml_ns(prop_meta, model_meta) - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - - # attribute - if prop_meta.get("attribute", False) and element.get(xml_name) is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) - continue - - # unwrapped element is array - if prop_meta.get("unwrapped", False): - # unwrapped array could either use prop items meta/prop meta - _items_name = prop_meta.get("itemsName") - if _items_name: - xml_name = _items_name - _items_ns = prop_meta.get("itemsNs") - if _items_ns is not None: - xml_ns = _items_ns - if xml_ns: - xml_name = "{" + xml_ns + "}" + xml_name - items = element.findall(xml_name) # pyright: ignore - if len(items) > 0: + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, items) - elif not rf._is_optional: + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: existed_attr_keys.append(xml_name) - result[rf._rest_name] = [] - continue - - # text element is primitive type - if prop_meta.get("text", False): - if element.text is not None: - result[rf._rest_name] = _deserialize(rf._type, element.text) - continue - - # wrapped element could be normal property or array, it should only have one element - item = element.find(xml_name) - if item is not None: - existed_attr_keys.append(xml_name) - result[rf._rest_name] = _deserialize(rf._type, item) + result[rf._rest_name] = _deserialize(rf._type, item) # rest thing is additional properties for e in element: @@ -708,6 +1038,9 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: if not rf._rest_name_input: rf._rest_name_input = attr cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") return super().__new__(cls) @@ -1082,6 +1415,7 @@ def __init__( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ): self._type = type self._rest_name_input = name @@ -1094,6 +1428,7 @@ def __init__( self._format = format self._is_multipart_file_input = is_multipart_file_input self._xml = xml if xml is not None else {} + self._deserializer = deserializer @property def _class_type(self) -> typing.Any: @@ -1113,7 +1448,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: @@ -1126,7 +1464,11 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # Return the value from _data directly (it's been deserialized in place) return obj._data.get(self._rest_name) - deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) # For mutable types, store the deserialized value back in _data # so mutations directly affect _data @@ -1172,6 +1514,7 @@ def rest_field( format: typing.Optional[str] = None, is_multipart_file_input: bool = False, xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, ) -> typing.Any: return _RestField( name=name, @@ -1181,6 +1524,7 @@ def rest_field( format=format, is_multipart_file_input=is_multipart_file_input, xml=xml, + deserializer=deserializer, ) @@ -1414,6 +1758,8 @@ def _deserialize_xml( value: str, ) -> typing.Any: element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) return _deserialize(deserializer, element) diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/serialization.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/serialization.py index 81ec1de5922b..ae08f9d89f74 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/serialization.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -476,7 +480,11 @@ def _decode_attribute_map_key(key): class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" + """Request object model serializer. + + :param classes: Mapping of model names to model types, used to resolve models during serialization. + :type classes: typing.Optional[typing.Mapping[str, type]] + """ basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -516,6 +524,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Serializer.serialize_rfc, "unix-time": Serializer.serialize_unix, "duration": Serializer.serialize_duration, + "duration-seconds-int": Serializer.serialize_duration_seconds_int, + "duration-seconds-float": Serializer.serialize_duration_seconds_float, + "duration-milliseconds-int": Serializer.serialize_duration_milliseconds_int, + "duration-milliseconds-float": Serializer.serialize_duration_milliseconds_float, "date": Serializer.serialize_date, "time": Serializer.serialize_time, "decimal": Serializer.serialize_decimal, @@ -1105,6 +1117,61 @@ def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) + @staticmethod + def _serialize_duration_numeric(attr, scale, as_int): + """Serialize a TimeDelta into a numeric value scaled to the wire unit. + + :param TimeDelta attr: Object to be serialized. + :param int scale: Multiplier applied to total seconds (1 for seconds, 1000 for milliseconds). + :param bool as_int: Whether to truncate the result to an int. + :rtype: int or float + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + value = attr.total_seconds() * scale if isinstance(attr, datetime.timedelta) else attr + return int(value) if as_int else float(value) + + @staticmethod + def serialize_duration_seconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, True) + + @staticmethod + def serialize_duration_seconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, False) + + @staticmethod + def serialize_duration_milliseconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, True) + + @staticmethod + def serialize_duration_milliseconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, False) + @staticmethod def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. @@ -1377,6 +1444,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "rfc-1123": Deserializer.deserialize_rfc, "unix-time": Deserializer.deserialize_unix, "duration": Deserializer.deserialize_duration, + "duration-seconds-int": Deserializer.deserialize_duration_seconds, + "duration-seconds-float": Deserializer.deserialize_duration_seconds, + "duration-milliseconds-int": Deserializer.deserialize_duration_milliseconds, + "duration-milliseconds-float": Deserializer.deserialize_duration_milliseconds, "date": Deserializer.deserialize_date, "time": Deserializer.deserialize_time, "decimal": Deserializer.deserialize_decimal, @@ -1389,6 +1460,10 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: } self.deserialize_expected_types = { "duration": (isodate.Duration, datetime.timedelta), + "duration-seconds-int": (isodate.Duration, datetime.timedelta), + "duration-seconds-float": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-int": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-float": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } self.dependencies: dict[str, type] = dict(classes) if classes else {} @@ -1401,7 +1476,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1411,6 +1486,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) @@ -1929,6 +2025,48 @@ def deserialize_duration(attr): raise DeserializationError(msg) from err return duration + @staticmethod + def _deserialize_duration_numeric(attr, unit): + """Deserialize a numeric duration value into a TimeDelta object. + + :param float attr: response value to be deserialized. + :param str unit: The wire unit, used as the ``timedelta`` keyword + (``"seconds"`` or ``"milliseconds"``). + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = datetime.timedelta(**{unit: float(attr)}) # type: ignore + except (ValueError, OverflowError, TypeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_duration_seconds(attr): + """Deserialize a numeric number of seconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "seconds") + + @staticmethod + def deserialize_duration_milliseconds(attr): + """Deserialize a numeric number of milliseconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "milliseconds") + @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/utils.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/utils.py index 927adb7c8ae2..b0131200252f 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/utils.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/_utils/utils.py @@ -6,10 +6,14 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import Generic, Optional, TYPE_CHECKING, TypeVar +import json +import os +from typing import Any, Generic, IO, Mapping, Optional, TYPE_CHECKING, TypeVar, Union from azure.core import MatchConditions +from .._utils.model_base import Model, SdkJSONEncoder + if TYPE_CHECKING: from .serialization import Deserializer, Serializer @@ -55,3 +59,81 @@ def prep_if_none_match(etag: Optional[str], match_condition: Optional[MatchCondi if match_condition == MatchConditions.IfMissing: return "*" return None + + +# file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)` +FileContent = Union[str, bytes, IO[str], IO[bytes]] + +FileType = Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + tuple[Optional[str], FileContent], + # (filename, file (or bytes), content_type) + tuple[Optional[str], FileContent, Optional[str]], +] + + +def serialize_multipart_data_entry(data_entry: Any) -> Any: + if isinstance(data_entry, (list, tuple, dict, Model)): + return json.dumps(data_entry, cls=SdkJSONEncoder, exclude_readonly=True) + return data_entry + + +def _normalize_multipart_file_entry(field_name: str, entry: Any, index: int) -> Any: + """Ensure a multipart file entry carries a filename for Content-Disposition. + + Servers distinguish file parts from plain form fields by the presence of + ``filename=`` in the ``Content-Disposition`` header. When callers pass + bare bytes/str/IO the HTTP client omits the filename and the server may + reject the upload. This helper wraps bare values into a (filename, content) + tuple, deriving the name from IO.name when available. + + :param str field_name: The multipart field name used as a filename fallback. + :param entry: The user-provided file entry (tuple, bytes, str, or IO). + :type entry: any + :param int index: The positional index of the entry within the field, used + to disambiguate fallback filenames when multiple entries are provided. + :return: Either the original tuple entry, or a ``(filename, content)`` tuple + wrapping the bare value. + :rtype: any + """ + if isinstance(entry, tuple): + return entry + filename: Optional[str] = None + name_attr = getattr(entry, "name", None) + if isinstance(name_attr, str) and name_attr: + filename = os.path.basename(name_attr) + if not filename: + filename = f"{field_name}_{index}" if index else field_name + + # Return a 3-tuple with an explicit "application/octet-stream" content type. + # A 2-tuple (filename, content) would leave the part's Content-Type unset, and + # the sdk core library only defaults to "application/octet-stream" for bare + # (non-tuple) values - a tuple bypasses that default and falls back to the + # HTTP "text/plain" default instead. Setting it explicitly preserves the + # pre-existing behavior for bare bytes/IO across all transports. + return (filename, entry, "application/octet-stream") + + +def prepare_multipart_form_data( + body: Mapping[str, Any], multipart_fields: list[str], data_fields: list[str] +) -> list[FileType]: + files: list[FileType] = [] + + # Data fields first so streaming server-side parsers see metadata before + # binary file parts. + for data_field in data_fields: + data_entry = body.get(data_field) + if data_entry: + files.append((data_field, str(serialize_multipart_data_entry(data_entry)))) + + for multipart_field in multipart_fields: + multipart_entry = body.get(multipart_field) + if isinstance(multipart_entry, list): + for idx, e in enumerate(multipart_entry): + files.append((multipart_field, _normalize_multipart_file_entry(multipart_field, e, idx))) + elif multipart_entry is not None: + files.append((multipart_field, _normalize_multipart_file_entry(multipart_field, multipart_entry, 0))) + + return files 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 9fe2a69c6523..506e5b92cffc 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 @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,11 +19,18 @@ from ._configuration import KnowledgeBaseRetrievalClientConfiguration from ._operations import _KnowledgeBaseRetrievalClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential -class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin): +class KnowledgeBaseRetrievalClient( + _KnowledgeBaseRetrievalClientOperationsMixin +): # pylint: disable=docstring-keyword-should-match-keyword-only """KnowledgeBaseRetrievalClient. :param endpoint: The endpoint URL of the search service. Required. @@ -35,8 +42,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClientOperationsMixin) :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-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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 f9295f2485eb..31e873204bf9 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -17,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long,docstring-keyword-should-match-keyword-only """Configuration for KnowledgeBaseRetrievalClient. Note that all parameters used to create this instance are saved as instance @@ -32,8 +33,9 @@ class KnowledgeBaseRetrievalClientConfiguration: # pylint: disable=too-many-ins :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-05-01-preview". Default value is "2026-05-01-preview". Note that overriding this default - value may result in unsupported behavior. + "2026-08-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -44,7 +46,7 @@ def __init__( knowledge_base_name: str, **kwargs: Any, ) -> None: - api_version: str = kwargs.pop("api_version", "2026-05-01-preview") + api_version: str = kwargs.pop("api_version", "2026-08-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 2e656fd4c4da..02dfb1bdc0ef 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 @@ -9,7 +9,7 @@ from collections.abc import MutableMapping from io import IOBase import json -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -27,15 +27,17 @@ from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict -from ... import models as _models2 +from ... import models as _models2, types as _types_models2 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 ..._operations._operations import ( + build_knowledge_base_retrieval_retrieve_request, + build_knowledge_base_retrieval_retrieve_stream_request, +) from .._configuration import KnowledgeBaseRetrievalClientConfiguration -JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] @@ -50,6 +52,7 @@ async def retrieve( retrieval_request: _models2.KnowledgeBaseRetrievalRequest, *, query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, content_type: str = "application/json", **kwargs: Any ) -> _models2.KnowledgeBaseRetrievalResponse: @@ -62,6 +65,10 @@ async def retrieve( executed. This token is used to enforce security restrictions on documents. Default value is None. :paramtype query_source_authorization: str + :keyword query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 @@ -74,20 +81,26 @@ async def retrieve( @overload async def retrieve( self, - retrieval_request: JSON, + retrieval_request: _types_models2.KnowledgeBaseRetrievalRequest, *, query_source_authorization: Optional[str] = None, + query_work_iq_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 + :type retrieval_request: + ~azure.search.documents.knowledgebases.types.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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 @@ -103,6 +116,7 @@ async def retrieve( retrieval_request: IO[bytes], *, query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, content_type: str = "application/json", **kwargs: Any ) -> _models2.KnowledgeBaseRetrievalResponse: @@ -114,6 +128,10 @@ async def retrieve( executed. This token is used to enforce security restrictions on documents. Default value is None. :paramtype query_source_authorization: str + :keyword query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 @@ -125,27 +143,37 @@ 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"], + params_added_on={ + "2026-05-01-preview": ["query_source_authorization"], + "2026-08-01-preview": ["query_work_iq_source_authorization"], + }, + api_versions_list=["2025-11-01-preview", "2026-04-01", "2026-05-01-preview", "2026-08-01-preview"], ) async def retrieve( self, - retrieval_request: Union[_models2.KnowledgeBaseRetrievalRequest, JSON, IO[bytes]], + retrieval_request: Union[ + _models2.KnowledgeBaseRetrievalRequest, _types_models2.KnowledgeBaseRetrievalRequest, IO[bytes] + ], *, query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, **kwargs: Any ) -> _models2.KnowledgeBaseRetrievalResponse: """KnowledgeBase retrieves relevant data from backing stores. - :param retrieval_request: The retrieval request to process. Is one of the following types: - KnowledgeBaseRetrievalRequest, JSON, IO[bytes] Required. + :param retrieval_request: The retrieval request to process. Is either a + KnowledgeBaseRetrievalRequest type or a IO[bytes] type. Required. :type retrieval_request: - ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest or JSON or - IO[bytes] + ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest or + ~azure.search.documents.knowledgebases.types.KnowledgeBaseRetrievalRequest 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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_source_authorization: str :return: KnowledgeBaseRetrievalResponse. The KnowledgeBaseRetrievalResponse is compatible with MutableMapping :rtype: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse @@ -175,6 +203,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, + query_work_iq_source_authorization=query_work_iq_source_authorization, content_type=content_type, api_version=self._config.api_version, content=_content, @@ -216,3 +245,239 @@ async def retrieve( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + @overload + async def retrieve_stream( + self, + retrieval_request: _models2.KnowledgeBaseRetrievalRequest, + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Retrieves relevant data from backing stores and streams progress and results as server-sent + events. + + Process the response incrementally using server-sent event framing. Each event contains an + event name and a JSON-encoded data payload. The stream ends with either a + ``response.completed`` + event or an ``error`` event. OpenAPI 2.0 represents the response body as a string, so generated + clients may expose the raw response without typed event parsing. Do not deserialize the + complete response body as a single JSON document. + + :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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def retrieve_stream( + self, + retrieval_request: _types_models2.KnowledgeBaseRetrievalRequest, + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Retrieves relevant data from backing stores and streams progress and results as server-sent + events. + + Process the response incrementally using server-sent event framing. Each event contains an + event name and a JSON-encoded data payload. The stream ends with either a + ``response.completed`` + event or an ``error`` event. OpenAPI 2.0 represents the response body as a string, so generated + clients may expose the raw response without typed event parsing. Do not deserialize the + complete response body as a single JSON document. + + :param retrieval_request: The retrieval request to process. Required. + :type retrieval_request: + ~azure.search.documents.knowledgebases.types.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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def retrieve_stream( + self, + retrieval_request: IO[bytes], + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Retrieves relevant data from backing stores and streams progress and results as server-sent + events. + + Process the response incrementally using server-sent event framing. Each event contains an + event name and a JSON-encoded data payload. The stream ends with either a + ``response.completed`` + event or an ``error`` event. OpenAPI 2.0 represents the response body as a string, so generated + clients may expose the raw response without typed event parsing. Do not deserialize the + complete response body as a single JSON document. + + :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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_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 + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-08-01-preview", + params_added_on={ + "2026-08-01-preview": [ + "api_version", + "accept", + "knowledge_base_name", + "query_source_authorization", + "query_work_iq_source_authorization", + "client_request_id", + "content_type", + ] + }, + api_versions_list=["2026-08-01-preview"], + ) + async def retrieve_stream( + self, + retrieval_request: Union[ + _models2.KnowledgeBaseRetrievalRequest, _types_models2.KnowledgeBaseRetrievalRequest, IO[bytes] + ], + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + """Retrieves relevant data from backing stores and streams progress and results as server-sent + events. + + Process the response incrementally using server-sent event framing. Each event contains an + event name and a JSON-encoded data payload. The stream ends with either a + ``response.completed`` + event or an ``error`` event. OpenAPI 2.0 represents the response body as a string, so generated + clients may expose the raw response without typed event parsing. Do not deserialize the + complete response body as a single JSON document. + + :param retrieval_request: The retrieval request to process. Is either a + KnowledgeBaseRetrievalRequest type or a IO[bytes] type. Required. + :type retrieval_request: + ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest or + ~azure.search.documents.knowledgebases.types.KnowledgeBaseRetrievalRequest 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 query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Used for on-behalf-of authentication + to the Work IQ API. Default value is None. + :paramtype query_work_iq_source_authorization: str + :return: AsyncIterator[bytes] + :rtype: AsyncIterator[bytes] + :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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(retrieval_request, (IOBase, bytes)): + _content = retrieval_request + else: + _content = json.dumps(retrieval_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_knowledge_base_retrieval_retrieve_stream_request( + knowledge_base_name=self._config.knowledge_base_name, + query_source_authorization=query_source_authorization, + query_work_iq_source_authorization=query_work_iq_source_authorization, + 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) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", True) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models3.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_operations/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_operations/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/aio/_operations/_patch.py @@ -8,7 +8,6 @@ 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 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 122eb259d9ef..ff76fdfac44b 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 @@ -7,12 +7,16 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import Any, Union + +from typing import Any, cast, IO, Optional, Union from azure.core.credentials import AzureKeyCredential from azure.core.credentials_async import AsyncTokenCredential +from azure.core.tracing.decorator_async import distributed_trace_async from ._client import KnowledgeBaseRetrievalClient as _KnowledgeBaseRetrievalClient +from .. import models, types +from .._stream import AsyncKnowledgeBaseRetrievalStream, KnowledgeBaseRetrievalEvent, KnowledgeBaseRetrievalEventData class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClient): @@ -27,9 +31,9 @@ class KnowledgeBaseRetrievalClient(_KnowledgeBaseRetrievalClient): :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 - listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is - ``ApiVersion.V2026_05_01_PREVIEW``. Note that overriding this default value may - result in unsupported behavior. + listed on the :class:`~azure.search.documents.ApiVersion` enum. Default value is + ``ApiVersion.V2026_08_01_PREVIEW``. Note that overriding this default value may + result in unsupported behavior. :paramtype api_version: str or ~azure.search.documents.ApiVersion :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 @@ -44,9 +48,76 @@ def __init__( kwargs.setdefault("credential_scopes", [audience.rstrip("/") + "/.default"]) super().__init__(endpoint=endpoint, credential=credential, **kwargs) + @distributed_trace_async + async def retrieve_stream( # type: ignore[override] + self, + retrieval_request: Union[models.KnowledgeBaseRetrievalRequest, dict[str, Any], IO[bytes]], + *, + query_source_authorization: Optional[str] = None, + query_work_iq_source_authorization: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any, + ) -> AsyncKnowledgeBaseRetrievalStream: + """Retrieve relevant data and asynchronously stream typed server-sent events. + + :param retrieval_request: The retrieval request to process. Required. + :type retrieval_request: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalRequest + or dict or IO[bytes] + :keyword query_source_authorization: Token identifying the user for which the query is + executed. Default value is None. + :paramtype query_source_authorization: str + :keyword query_work_iq_source_authorization: User assertion token for a customer-owned Entra + app registration configured on a Work IQ knowledge source. Default value is None. + :paramtype query_work_iq_source_authorization: str + :keyword content_type: Body parameter content type. Default value is "application/json". + :paramtype content_type: str + :return: An asynchronous stream of typed knowledge base retrieval events. + :rtype: ~azure.search.documents.knowledgebases.aio.AsyncKnowledgeBaseRetrievalStream + :raises ~azure.core.exceptions.HttpResponseError: + """ + custom_cls = kwargs.pop("cls", None) + callback_context: dict[str, Any] = {} + + def _wrap_stream(pipeline_response, raw_stream, response_headers): + stream = AsyncKnowledgeBaseRetrievalStream( + response=pipeline_response.http_response, + raw_stream=raw_stream, + ) + callback_context.update(pipeline_response=pipeline_response, response_headers=response_headers) + return stream + + typed_retrieval_request = cast( + Union[models.KnowledgeBaseRetrievalRequest, types.KnowledgeBaseRetrievalRequest, IO[bytes]], + retrieval_request, + ) + stream = cast( + AsyncKnowledgeBaseRetrievalStream, + await super().retrieve_stream( + typed_retrieval_request, + query_source_authorization=query_source_authorization, + query_work_iq_source_authorization=query_work_iq_source_authorization, + content_type=content_type, + cls=_wrap_stream, + **kwargs, + ), + ) + if not custom_cls: + return stream + try: + return cast( + AsyncKnowledgeBaseRetrievalStream, + custom_cls(callback_context["pipeline_response"], stream, callback_context["response_headers"]), + ) + except Exception: + await stream.close() + raise + __all__: list[str] = [ + "AsyncKnowledgeBaseRetrievalStream", "KnowledgeBaseRetrievalClient", + "KnowledgeBaseRetrievalEvent", + "KnowledgeBaseRetrievalEventData", ] 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 cc9491bf92bb..a97f4d1ae08c 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 @@ -27,7 +27,10 @@ IndexedSharePointKnowledgeSourceParams, IndexedSqlKnowledgeSourceParams, KnowledgeBaseActivityRecord, + KnowledgeBaseActivityRecordModel, + KnowledgeBaseActivityStartedEvent, KnowledgeBaseAgenticReasoningActivityRecord, + KnowledgeBaseAnswerCompletedEvent, KnowledgeBaseAzureBlobActivityArguments, KnowledgeBaseAzureBlobActivityRecord, KnowledgeBaseAzureBlobReference, @@ -62,21 +65,26 @@ KnowledgeBaseModelAnswerSynthesisActivityRecord, KnowledgeBaseModelQueryPlanningActivityRecord, KnowledgeBaseModelWebSummarizationActivityRecord, + KnowledgeBaseQueryHintProcessing, KnowledgeBaseReference, KnowledgeBaseRemoteSharePointActivityArguments, KnowledgeBaseRemoteSharePointActivityRecord, KnowledgeBaseRemoteSharePointReference, + KnowledgeBaseResponseCompletedEvent, KnowledgeBaseRetrievalRequest, KnowledgeBaseRetrievalResponse, + KnowledgeBaseRetrievalStartedEvent, KnowledgeBaseSearchIndexActivityArguments, KnowledgeBaseSearchIndexActivityRecord, KnowledgeBaseSearchIndexReference, + KnowledgeBaseStreamErrorEvent, KnowledgeBaseWebActivityArguments, KnowledgeBaseWebActivityRecord, KnowledgeBaseWebReference, KnowledgeBaseWorkIQActivityArguments, KnowledgeBaseWorkIQActivityRecord, KnowledgeBaseWorkIQReference, + KnowledgeRetrievalAutoReasoningEffort, KnowledgeRetrievalIntent, KnowledgeRetrievalLowReasoningEffort, KnowledgeRetrievalMediumReasoningEffort, @@ -94,9 +102,9 @@ PurviewSensitivityLabelInfo, RemoteSharePointKnowledgeSourceParams, SearchIndexKnowledgeSourceParams, + ServedImage, SynchronizationState, WebKnowledgeSourceParams, - WorkIQAttribution, WorkIQKnowledgeSourceParams, ) @@ -104,9 +112,11 @@ KnowledgeBaseActivityRecordType, KnowledgeBaseMessageContentType, KnowledgeBaseReferenceType, + KnowledgeBaseRetrievalStatusCode, KnowledgeRetrievalIntentType, KnowledgeRetrievalOutputMode, KnowledgeRetrievalReasoningEffortKind, + KnowledgeSourceNetworkAccessMode, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -126,7 +136,10 @@ "IndexedSharePointKnowledgeSourceParams", "IndexedSqlKnowledgeSourceParams", "KnowledgeBaseActivityRecord", + "KnowledgeBaseActivityRecordModel", + "KnowledgeBaseActivityStartedEvent", "KnowledgeBaseAgenticReasoningActivityRecord", + "KnowledgeBaseAnswerCompletedEvent", "KnowledgeBaseAzureBlobActivityArguments", "KnowledgeBaseAzureBlobActivityRecord", "KnowledgeBaseAzureBlobReference", @@ -161,21 +174,26 @@ "KnowledgeBaseModelAnswerSynthesisActivityRecord", "KnowledgeBaseModelQueryPlanningActivityRecord", "KnowledgeBaseModelWebSummarizationActivityRecord", + "KnowledgeBaseQueryHintProcessing", "KnowledgeBaseReference", "KnowledgeBaseRemoteSharePointActivityArguments", "KnowledgeBaseRemoteSharePointActivityRecord", "KnowledgeBaseRemoteSharePointReference", + "KnowledgeBaseResponseCompletedEvent", "KnowledgeBaseRetrievalRequest", "KnowledgeBaseRetrievalResponse", + "KnowledgeBaseRetrievalStartedEvent", "KnowledgeBaseSearchIndexActivityArguments", "KnowledgeBaseSearchIndexActivityRecord", "KnowledgeBaseSearchIndexReference", + "KnowledgeBaseStreamErrorEvent", "KnowledgeBaseWebActivityArguments", "KnowledgeBaseWebActivityRecord", "KnowledgeBaseWebReference", "KnowledgeBaseWorkIQActivityArguments", "KnowledgeBaseWorkIQActivityRecord", "KnowledgeBaseWorkIQReference", + "KnowledgeRetrievalAutoReasoningEffort", "KnowledgeRetrievalIntent", "KnowledgeRetrievalLowReasoningEffort", "KnowledgeRetrievalMediumReasoningEffort", @@ -193,16 +211,18 @@ "PurviewSensitivityLabelInfo", "RemoteSharePointKnowledgeSourceParams", "SearchIndexKnowledgeSourceParams", + "ServedImage", "SynchronizationState", "WebKnowledgeSourceParams", - "WorkIQAttribution", "WorkIQKnowledgeSourceParams", "KnowledgeBaseActivityRecordType", "KnowledgeBaseMessageContentType", "KnowledgeBaseReferenceType", + "KnowledgeBaseRetrievalStatusCode", "KnowledgeRetrievalIntentType", "KnowledgeRetrievalOutputMode", "KnowledgeRetrievalReasoningEffortKind", + "KnowledgeSourceNetworkAccessMode", ] __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/knowledgebases/models/_enums.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_enums.py index 5463be6fe21f..0b8a246ba553 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 @@ -85,6 +85,15 @@ class KnowledgeBaseReferenceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indexed SQL document reference.""" +class KnowledgeBaseRetrievalStatusCode(int, Enum, metaclass=CaseInsensitiveEnumMeta): + """The semantic HTTP status of a completed streaming retrieval.""" + + OK = 200 + """The retrieval completed successfully.""" + PARTIAL_CONTENT = 206 + """The retrieval completed with partial results.""" + + class KnowledgeRetrievalIntentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of knowledge base configuration to use.""" @@ -110,3 +119,16 @@ class KnowledgeRetrievalReasoningEffortKind(str, Enum, metaclass=CaseInsensitive """Use low reasoning during retrieval.""" MEDIUM = "medium" """Use a moderate amount of reasoning during retrieval.""" + AUTO = "auto" + """Automatically select the reasoning effort during retrieval, escalating from the cheapest tier + only as far as needed.""" + + +class KnowledgeSourceNetworkAccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the network access mode for knowledge source ingestion. Default is 'public'.""" + + PUBLIC = "public" + """Ingestion runs in the standard, publicly reachable execution environment. This is the default.""" + PRIVATE = "private" + """Ingestion runs in a private execution environment so it can reach data sources and dependencies + over a private network (private endpoint / shared private link).""" 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 bd29b03d3aa1..226200b8c9ff 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 @@ -23,10 +23,11 @@ if TYPE_CHECKING: from .. import models as _models + from ... import models as _models2 from ...indexes import models as _indexes_models3 -class AIServices(_Model): +class AIServices(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for AI Services. :ivar uri: The URI of the AI Services endpoint. Required. @@ -59,7 +60,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssetStore(_Model): +class AssetStore(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Configuration for an asset store used to store extracted assets such as images. :ivar connection_string: The connection string for the asset store. Required. @@ -96,7 +97,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeSourceParams(_Model): +class KnowledgeSourceParams(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for knowledge source runtime parameters. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -118,12 +119,22 @@ class KnowledgeSourceParams(_Model): :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -156,6 +167,12 @@ class KnowledgeSourceParams(_Model): ) """Indicates that this knowledge source should bypass source selection and always be queried at retrieval time.""" + never_query_source: Optional[bool] = rest_field( + name="neverQuerySource", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" fail_on_error: Optional[bool] = rest_field( name="failOnError", visibility=["read", "create", "update", "delete", "query"] ) @@ -165,6 +182,11 @@ class KnowledgeSourceParams(_Model): name="rerankerThreshold", visibility=["read", "create", "update", "delete", "query"] ) """The reranker threshold all retrieved documents must meet to be included in the response.""" + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = rest_field( + name="resultsProcessing", visibility=["read", "create", "update", "delete", "query"] + ) + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" max_output_documents: Optional[int] = rest_field( name="maxOutputDocuments", visibility=["read", "create", "update", "delete", "query"] ) @@ -188,8 +210,10 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, ) -> None: ... @@ -205,7 +229,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AzureBlobKnowledgeSourceParams(KnowledgeSourceParams, discriminator="azureBlob"): +class AzureBlobKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="azureBlob" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a azure blob knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -219,12 +245,22 @@ class AzureBlobKnowledgeSourceParams(KnowledgeSourceParams, discriminator="azure :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -235,11 +271,21 @@ class AzureBlobKnowledgeSourceParams(KnowledgeSourceParams, discriminator="azure :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 + :ivar query_hint_overrides: Hints that guide query planning toward useful filters and boosts. + If specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype query_hint_overrides: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints """ kind: Literal[KnowledgeSourceKind.AZURE_BLOB] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The discriminator value. Required. A knowledge source that read and ingest data from Azure Blob Storage to a Search Index.""" + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHintOverrides", visibility=["read", "create", "update", "delete", "query"] + ) + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" @overload def __init__( @@ -249,10 +295,13 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -267,7 +316,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.AZURE_BLOB # type: ignore -class CompletedSynchronizationState(_Model): +class CompletedSynchronizationState(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the completed state of the last synchronization. :ivar start_time: The start time of the last completed synchronization. Required. @@ -325,7 +374,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FabricDataAgentKnowledgeSourceParams(KnowledgeSourceParams, discriminator="fabricDataAgent"): +class FabricDataAgentKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="fabricDataAgent" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a Fabric Data Agent knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -339,12 +390,22 @@ class FabricDataAgentKnowledgeSourceParams(KnowledgeSourceParams, discriminator= :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -369,8 +430,10 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, ) -> None: ... @@ -387,7 +450,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.FABRIC_DATA_AGENT # type: ignore -class FabricOntologyKnowledgeSourceParams(KnowledgeSourceParams, discriminator="fabricOntology"): +class FabricOntologyKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="fabricOntology" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a Fabric Ontology knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -401,12 +466,22 @@ class FabricOntologyKnowledgeSourceParams(KnowledgeSourceParams, discriminator=" :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -431,8 +506,10 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, ) -> None: ... @@ -449,7 +526,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.FABRIC_ONTOLOGY # type: ignore -class FileKnowledgeSourceParams(KnowledgeSourceParams, discriminator="file"): +class FileKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="file" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a File knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -463,12 +542,22 @@ class FileKnowledgeSourceParams(KnowledgeSourceParams, discriminator="file"): :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -479,11 +568,21 @@ class FileKnowledgeSourceParams(KnowledgeSourceParams, discriminator="file"): :ivar kind: The discriminator value. Required. A knowledge source that supports direct file upload and indexing. :vartype kind: str or ~azure.search.documents.indexes.models.FILE + :ivar query_hint_overrides: Hints that guide query planning toward useful filters and boosts. + If specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype query_hint_overrides: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints """ kind: Literal[KnowledgeSourceKind.FILE] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The discriminator value. Required. A knowledge source that supports direct file upload and indexing.""" + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHintOverrides", visibility=["read", "create", "update", "delete", "query"] + ) + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" @overload def __init__( @@ -493,10 +592,13 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -511,7 +613,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.FILE # type: ignore -class FreshnessPolicy(_Model): +class FreshnessPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Configuration for freshness-aware retrieval. When set, newer documents receive a ranking boost during retrieval. @@ -544,7 +646,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ImageServingStatistics(_Model): +class ImageServingStatistics(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Statistics about image serving during a retrieval activity. :ivar images_retrieved: The number of images retrieved from the asset store. @@ -556,6 +658,9 @@ class ImageServingStatistics(_Model): :ivar verbalization_used: Indicates whether image verbalization was used instead of direct image serving. :vartype verbalization_used: bool + :ivar served_images: The set of images the model selected to be served to the downstream model + for this retrieval activity. + :vartype served_images: list[~azure.search.documents.knowledgebases.models.ServedImage] """ images_retrieved: Optional[int] = rest_field( @@ -574,6 +679,11 @@ class ImageServingStatistics(_Model): name="verbalizationUsed", visibility=["read", "create", "update", "delete", "query"] ) """Indicates whether image verbalization was used instead of direct image serving.""" + served_images: Optional[list["_models.ServedImage"]] = rest_field( + name="servedImages", visibility=["read", "create", "update", "delete", "query"] + ) + """The set of images the model selected to be served to the downstream model for this retrieval + activity.""" @overload def __init__( @@ -583,6 +693,7 @@ def __init__( images_sent_to_model: Optional[int] = None, total_image_size_bytes: Optional[int] = None, verbalization_used: Optional[bool] = None, + served_images: Optional[list["_models.ServedImage"]] = None, ) -> None: ... @overload @@ -596,7 +707,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexedOneLakeKnowledgeSourceParams(KnowledgeSourceParams, discriminator="indexedOneLake"): +class IndexedOneLakeKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="indexedOneLake" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a indexed OneLake knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -610,12 +723,22 @@ class IndexedOneLakeKnowledgeSourceParams(KnowledgeSourceParams, discriminator=" :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -626,10 +749,20 @@ class IndexedOneLakeKnowledgeSourceParams(KnowledgeSourceParams, discriminator=" :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 + :ivar query_hint_overrides: Hints that guide query planning toward useful filters and boosts. + If specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype query_hint_overrides: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints """ kind: Literal[KnowledgeSourceKind.INDEXED_ONELAKE] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The discriminator value. Required. A knowledge source that reads data from indexed OneLake.""" + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHintOverrides", visibility=["read", "create", "update", "delete", "query"] + ) + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" @overload def __init__( @@ -639,10 +772,13 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -657,7 +793,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.INDEXED_ONELAKE # type: ignore -class IndexedSharePointKnowledgeSourceParams(KnowledgeSourceParams, discriminator="indexedSharePoint"): +class IndexedSharePointKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="indexedSharePoint" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a indexed SharePoint knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -671,12 +809,22 @@ class IndexedSharePointKnowledgeSourceParams(KnowledgeSourceParams, discriminato :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -687,10 +835,20 @@ class IndexedSharePointKnowledgeSourceParams(KnowledgeSourceParams, discriminato :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 + :ivar query_hint_overrides: Hints that guide query planning toward useful filters and boosts. + If specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype query_hint_overrides: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints """ 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.""" + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHintOverrides", visibility=["read", "create", "update", "delete", "query"] + ) + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" @overload def __init__( @@ -700,10 +858,13 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -718,7 +879,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.INDEXED_SHARE_POINT # type: ignore -class IndexedSqlKnowledgeSourceParams(KnowledgeSourceParams, discriminator="indexedSql"): +class IndexedSqlKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="indexedSql" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for an indexed SQL knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -732,12 +895,22 @@ class IndexedSqlKnowledgeSourceParams(KnowledgeSourceParams, discriminator="inde :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -748,11 +921,21 @@ class IndexedSqlKnowledgeSourceParams(KnowledgeSourceParams, discriminator="inde :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 query_hint_overrides: Hints that guide query planning toward useful filters and boosts. + If specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype query_hint_overrides: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints """ 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.""" + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHintOverrides", visibility=["read", "create", "update", "delete", "query"] + ) + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" @overload def __init__( @@ -762,10 +945,13 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -780,7 +966,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.INDEXED_SQL # type: ignore -class KnowledgeBaseActivityRecord(_Model): +class KnowledgeBaseActivityRecord(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for activity records. Tracks execution details, timing, and errors for knowledge base operations. @@ -803,6 +989,10 @@ class KnowledgeBaseActivityRecord(_Model): "modelAnswerSynthesis", "modelWebSummarization", and "agenticReasoning". :vartype type: str or ~azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecordType + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -823,6 +1013,14 @@ class KnowledgeBaseActivityRecord(_Model): \"fabricDataAgent\", \"fabricOntology\", \"mcpServer\", \"file\", \"indexedSql\", \"modelQueryPlanning\", \"modelAnswerSynthesis\", \"modelWebSummarization\", and \"agenticReasoning\".""" + started_at: Optional[datetime.datetime] = rest_field( + name="startedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time at which the activity started.""" + completed_at: Optional[datetime.datetime] = rest_field( + name="completedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time at which the activity completed.""" 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( @@ -840,6 +1038,8 @@ def __init__( *, id: int, # pylint: disable=redefined-builtin type: str, + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -856,13 +1056,113 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class KnowledgeBaseActivityRecordModel(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Represents the model used for a knowledge base LLM activity, including its model name and + deployment identifier. + + :ivar model_name: The name of the model used for the activity. Required. + :vartype model_name: str + :ivar deployment_id: The deployment identifier of the model used for the activity. + :vartype deployment_id: str + """ + + model_name: str = rest_field(name="modelName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the model used for the activity. Required.""" + deployment_id: Optional[str] = rest_field( + name="deploymentId", visibility=["read", "create", "update", "delete", "query"] + ) + """The deployment identifier of the model used for the activity.""" + + @overload + def __init__( + self, + *, + model_name: str, + deployment_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 KnowledgeBaseActivityStartedEvent(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Emitted immediately before an individual retrieval activity begins executing. + + :ivar id: The ID of the activity record, matching the ``id`` on the corresponding + ``activity.completed`` event. Required. + :vartype id: int + :ivar type: The type of the activity that has started. Required. Known values are: + "searchIndex", "azureBlob", "indexedSharePoint", "indexedOneLake", "web", "remoteSharePoint", + "workIQ", "fabricDataAgent", "fabricOntology", "mcpServer", "file", "indexedSql", + "modelQueryPlanning", "modelAnswerSynthesis", "modelWebSummarization", and "agenticReasoning". + :vartype type: str or + ~azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecordType + :ivar started_at: The time at which the activity started. Required. + :vartype started_at: ~datetime.datetime + :ivar knowledge_source_name: The knowledge source used by the activity, when the activity + targets a knowledge source. + :vartype knowledge_source_name: str + """ + + id: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the activity record, matching the ``id`` on the corresponding ``activity.completed`` + event. Required.""" + type: Union[str, "_models.KnowledgeBaseActivityRecordType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the activity that has started. Required. Known values are: \"searchIndex\", + \"azureBlob\", \"indexedSharePoint\", \"indexedOneLake\", \"web\", \"remoteSharePoint\", + \"workIQ\", \"fabricDataAgent\", \"fabricOntology\", \"mcpServer\", \"file\", \"indexedSql\", + \"modelQueryPlanning\", \"modelAnswerSynthesis\", \"modelWebSummarization\", and + \"agenticReasoning\".""" + started_at: datetime.datetime = rest_field( + name="startedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time at which the activity started. Required.""" + knowledge_source_name: Optional[str] = rest_field( + name="knowledgeSourceName", visibility=["read", "create", "update", "delete", "query"] + ) + """The knowledge source used by the activity, when the activity targets a knowledge source.""" + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + type: Union[str, "_models.KnowledgeBaseActivityRecordType"], + started_at: datetime.datetime, + knowledge_source_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) + + class KnowledgeBaseAgenticReasoningActivityRecord( KnowledgeBaseActivityRecord, discriminator="agenticReasoning" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents an agentic reasoning activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -879,6 +1179,11 @@ class KnowledgeBaseAgenticReasoningActivityRecord( :ivar retrieval_reasoning_effort: The retrieval reasoning effort configuration. :vartype retrieval_reasoning_effort: ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalReasoningEffort + :ivar logical_reasoning_effort: The logical reasoning effort requested by the customer. This is + distinct from ``retrievalReasoningEffort``, which reports the reasoning effort used for + billing. + :vartype logical_reasoning_effort: + ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalReasoningEffort """ type: Literal[KnowledgeBaseActivityRecordType.AGENTIC_REASONING] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -891,17 +1196,25 @@ class KnowledgeBaseAgenticReasoningActivityRecord( name="retrievalReasoningEffort", visibility=["read", "create", "update", "delete", "query"] ) """The retrieval reasoning effort configuration.""" + logical_reasoning_effort: Optional["_models.KnowledgeRetrievalReasoningEffort"] = rest_field( + name="logicalReasoningEffort", visibility=["read", "create", "update", "delete", "query"] + ) + """The logical reasoning effort requested by the customer. This is distinct from + ``retrievalReasoningEffort``, which reports the reasoning effort used for billing.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, 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, + logical_reasoning_effort: Optional["_models.KnowledgeRetrievalReasoningEffort"] = None, ) -> None: ... @overload @@ -916,7 +1229,41 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.AGENTIC_REASONING # type: ignore -class KnowledgeBaseAzureBlobActivityArguments(_Model): +class KnowledgeBaseAnswerCompletedEvent(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Emitted when a fully validated and post-processed synthesized answer is available. + + :ivar message_index: The zero-based index of the completed message in the final response array. + Required. + :vartype message_index: int + :ivar message: The completed answer message. Required. + :vartype message: ~azure.search.documents.knowledgebases.models.KnowledgeBaseMessage + """ + + message_index: int = rest_field(name="messageIndex", visibility=["read", "create", "update", "delete", "query"]) + """The zero-based index of the completed message in the final response array. Required.""" + message: "_models.KnowledgeBaseMessage" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The completed answer message. Required.""" + + @overload + def __init__( + self, + *, + message_index: int, + message: "_models.KnowledgeBaseMessage", + ) -> 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 KnowledgeBaseAzureBlobActivityArguments(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the arguments the azure blob retrieval activity was run with. :ivar search: The search string used to query blob contents. @@ -944,11 +1291,17 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseAzureBlobActivityRecord(KnowledgeBaseActivityRecord, discriminator="azureBlob"): +class KnowledgeBaseAzureBlobActivityRecord( + KnowledgeBaseActivityRecord, discriminator="azureBlob" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a azure blob retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -972,6 +1325,10 @@ class KnowledgeBaseAzureBlobActivityRecord(KnowledgeBaseActivityRecord, discrimi :ivar azure_blob_arguments: The azure blob arguments for the retrieval activity. :vartype azure_blob_arguments: ~azure.search.documents.knowledgebases.models.KnowledgeBaseAzureBlobActivityArguments + :ivar query_hint_processing: Details about the expressions generated from query hints for this + activity. + :vartype query_hint_processing: + ~azure.search.documents.knowledgebases.models.KnowledgeBaseQueryHintProcessing """ knowledge_source_name: Optional[str] = rest_field( @@ -995,12 +1352,18 @@ class KnowledgeBaseAzureBlobActivityRecord(KnowledgeBaseActivityRecord, discrimi name="azureBlobArguments", visibility=["read", "create", "update", "delete", "query"] ) """The azure blob arguments for the retrieval activity.""" + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = rest_field( + name="queryHintProcessing", visibility=["read", "create", "update", "delete", "query"] + ) + """Details about the expressions generated from query hints for this activity.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -1009,6 +1372,7 @@ def __init__( count: Optional[int] = None, image_serving: Optional["_models.ImageServingStatistics"] = None, azure_blob_arguments: Optional["_models.KnowledgeBaseAzureBlobActivityArguments"] = None, + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = None, ) -> None: ... @overload @@ -1023,7 +1387,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.AZURE_BLOB # type: ignore -class KnowledgeBaseReference(_Model): +class KnowledgeBaseReference(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Base type for references. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -1088,7 +1452,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseAzureBlobReference(KnowledgeBaseReference, discriminator="azureBlob"): +class KnowledgeBaseAzureBlobReference( + KnowledgeBaseReference, discriminator="azureBlob" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an Azure Blob Storage document reference. :ivar id: The ID of the reference. Required. @@ -1106,6 +1472,9 @@ class KnowledgeBaseAzureBlobReference(KnowledgeBaseReference, discriminator="azu :ivar search_sensitivity_label_info: The sensitivity label information for the reference. :vartype search_sensitivity_label_info: ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo + :ivar citation_url: A Search-owned URL that points at the backing document for this reference, + usable as a citation target. + :vartype citation_url: str """ type: Literal[KnowledgeBaseReferenceType.AZURE_BLOB] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -1116,6 +1485,11 @@ class KnowledgeBaseAzureBlobReference(KnowledgeBaseReference, discriminator="azu name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] ) """The sensitivity label information for the reference.""" + citation_url: Optional[str] = rest_field( + name="citationUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """A Search-owned URL that points at the backing document for this reference, usable as a citation + target.""" @overload def __init__( @@ -1127,6 +1501,7 @@ def __init__( reranker_score: Optional[float] = None, blob_url: Optional[str] = None, search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = None, + citation_url: Optional[str] = None, ) -> None: ... @overload @@ -1186,7 +1561,9 @@ class KnowledgeBaseErrorDetail(_Model): """The error additional info.""" -class KnowledgeBaseFabricDataAgentActivityArguments(_Model): # pylint: disable=name-too-long +class KnowledgeBaseFabricDataAgentActivityArguments( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents the arguments the Fabric Data Agent retrieval activity was run with. :ivar search: The search string used to query the Fabric Data Agent knowledge source. @@ -1216,11 +1593,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class KnowledgeBaseFabricDataAgentActivityRecord( KnowledgeBaseActivityRecord, discriminator="fabricDataAgent" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents a Fabric Data Agent retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -1273,6 +1654,8 @@ def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -1295,7 +1678,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.FABRIC_DATA_AGENT # type: ignore -class KnowledgeBaseFabricDataAgentReference(KnowledgeBaseReference, discriminator="fabricDataAgent"): +class KnowledgeBaseFabricDataAgentReference( + KnowledgeBaseReference, discriminator="fabricDataAgent" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a Fabric Data Agent document reference. :ivar id: The ID of the reference. Required. @@ -1349,7 +1734,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.FABRIC_DATA_AGENT # type: ignore -class KnowledgeBaseFabricOntologyActivityArguments(_Model): # pylint: disable=name-too-long +class KnowledgeBaseFabricOntologyActivityArguments( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents the arguments the Fabric Ontology retrieval activity was run with. :ivar search: The search string used to query the Fabric Ontology knowledge source. @@ -1379,11 +1766,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class KnowledgeBaseFabricOntologyActivityRecord( KnowledgeBaseActivityRecord, discriminator="fabricOntology" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents a Fabric Ontology retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -1436,6 +1827,8 @@ def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -1458,7 +1851,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.FABRIC_ONTOLOGY # type: ignore -class KnowledgeBaseFabricOntologyReference(KnowledgeBaseReference, discriminator="fabricOntology"): +class KnowledgeBaseFabricOntologyReference( + KnowledgeBaseReference, discriminator="fabricOntology" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a Fabric Ontology document reference. :ivar id: The ID of the reference. Required. @@ -1512,7 +1907,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.FABRIC_ONTOLOGY # type: ignore -class KnowledgeBaseFileActivityArguments(_Model): +class KnowledgeBaseFileActivityArguments(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the arguments the File retrieval activity was run with. :ivar search: The search string used to query file contents. @@ -1540,11 +1935,17 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseFileActivityRecord(KnowledgeBaseActivityRecord, discriminator="file"): +class KnowledgeBaseFileActivityRecord( + KnowledgeBaseActivityRecord, discriminator="file" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a File retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -1568,6 +1969,10 @@ class KnowledgeBaseFileActivityRecord(KnowledgeBaseActivityRecord, discriminator :ivar file_arguments: The File arguments for the retrieval activity. :vartype file_arguments: ~azure.search.documents.knowledgebases.models.KnowledgeBaseFileActivityArguments + :ivar query_hint_processing: Details about the expressions generated from query hints for this + activity. + :vartype query_hint_processing: + ~azure.search.documents.knowledgebases.models.KnowledgeBaseQueryHintProcessing """ knowledge_source_name: Optional[str] = rest_field( @@ -1591,12 +1996,18 @@ class KnowledgeBaseFileActivityRecord(KnowledgeBaseActivityRecord, discriminator name="fileArguments", visibility=["read", "create", "update", "delete", "query"] ) """The File arguments for the retrieval activity.""" + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = rest_field( + name="queryHintProcessing", visibility=["read", "create", "update", "delete", "query"] + ) + """Details about the expressions generated from query hints for this activity.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -1605,6 +2016,7 @@ def __init__( count: Optional[int] = None, image_serving: Optional["_models.ImageServingStatistics"] = None, file_arguments: Optional["_models.KnowledgeBaseFileActivityArguments"] = None, + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = None, ) -> None: ... @overload @@ -1619,7 +2031,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.FILE # type: ignore -class KnowledgeBaseFileReference(KnowledgeBaseReference, discriminator="file"): +class KnowledgeBaseFileReference( + KnowledgeBaseReference, discriminator="file" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a file document reference. :ivar id: The ID of the reference. Required. @@ -1634,12 +2048,20 @@ class KnowledgeBaseFileReference(KnowledgeBaseReference, discriminator="file"): :vartype type: str or ~azure.search.documents.knowledgebases.models.FILE :ivar doc_name: The document name for the reference. :vartype doc_name: str + :ivar citation_url: A Search-owned URL that points at the backing document for this reference, + usable as a citation target. + :vartype citation_url: str """ type: Literal[KnowledgeBaseReferenceType.FILE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The discriminator value. Required. File document reference.""" doc_name: Optional[str] = rest_field(name="docName", visibility=["read", "create", "update", "delete", "query"]) """The document name for the reference.""" + citation_url: Optional[str] = rest_field( + name="citationUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """A Search-owned URL that points at the backing document for this reference, usable as a citation + target.""" @overload def __init__( @@ -1650,6 +2072,7 @@ def __init__( source_data: Optional[dict[str, Any]] = None, reranker_score: Optional[float] = None, doc_name: Optional[str] = None, + citation_url: Optional[str] = None, ) -> None: ... @overload @@ -1664,7 +2087,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.FILE # type: ignore -class KnowledgeBaseImageContent(_Model): +class KnowledgeBaseImageContent(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Image content. :ivar url: The url of the image. Required. @@ -1692,7 +2115,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseIndexedOneLakeActivityArguments(_Model): # pylint: disable=name-too-long +class KnowledgeBaseIndexedOneLakeActivityArguments( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents the arguments the indexed OneLake retrieval activity was run with. :ivar search: The search string used to query indexed OneLake contents. @@ -1722,11 +2147,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class KnowledgeBaseIndexedOneLakeActivityRecord( KnowledgeBaseActivityRecord, discriminator="indexedOneLake" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents a indexed OneLake retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -1750,6 +2179,10 @@ class KnowledgeBaseIndexedOneLakeActivityRecord( :ivar indexed_one_lake_arguments: The indexed OneLake arguments for the retrieval activity. :vartype indexed_one_lake_arguments: ~azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedOneLakeActivityArguments + :ivar query_hint_processing: Details about the expressions generated from query hints for this + activity. + :vartype query_hint_processing: + ~azure.search.documents.knowledgebases.models.KnowledgeBaseQueryHintProcessing """ knowledge_source_name: Optional[str] = rest_field( @@ -1773,12 +2206,18 @@ class KnowledgeBaseIndexedOneLakeActivityRecord( name="indexedOneLakeArguments", visibility=["read", "create", "update", "delete", "query"] ) """The indexed OneLake arguments for the retrieval activity.""" + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = rest_field( + name="queryHintProcessing", visibility=["read", "create", "update", "delete", "query"] + ) + """Details about the expressions generated from query hints for this activity.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -1787,6 +2226,7 @@ def __init__( count: Optional[int] = None, image_serving: Optional["_models.ImageServingStatistics"] = None, indexed_one_lake_arguments: Optional["_models.KnowledgeBaseIndexedOneLakeActivityArguments"] = None, + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = None, ) -> None: ... @overload @@ -1801,7 +2241,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.INDEXED_ONELAKE # type: ignore -class KnowledgeBaseIndexedOneLakeReference(KnowledgeBaseReference, discriminator="indexedOneLake"): +class KnowledgeBaseIndexedOneLakeReference( + KnowledgeBaseReference, discriminator="indexedOneLake" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an indexed OneLake document reference. :ivar id: The ID of the reference. Required. @@ -1819,6 +2261,9 @@ class KnowledgeBaseIndexedOneLakeReference(KnowledgeBaseReference, discriminator :ivar search_sensitivity_label_info: The sensitivity label information for the reference. :vartype search_sensitivity_label_info: ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo + :ivar citation_url: A Search-owned URL that points at the backing document for this reference, + usable as a citation target. + :vartype citation_url: str """ type: Literal[KnowledgeBaseReferenceType.INDEXED_ONELAKE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -1829,6 +2274,11 @@ class KnowledgeBaseIndexedOneLakeReference(KnowledgeBaseReference, discriminator name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] ) """The sensitivity label information for the reference.""" + citation_url: Optional[str] = rest_field( + name="citationUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """A Search-owned URL that points at the backing document for this reference, usable as a citation + target.""" @overload def __init__( @@ -1840,6 +2290,7 @@ def __init__( reranker_score: Optional[float] = None, doc_url: Optional[str] = None, search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = None, + citation_url: Optional[str] = None, ) -> None: ... @overload @@ -1854,7 +2305,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.INDEXED_ONELAKE # type: ignore -class KnowledgeBaseIndexedSharePointActivityArguments(_Model): # pylint: disable=name-too-long +class KnowledgeBaseIndexedSharePointActivityArguments( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents the arguments the indexed SharePoint retrieval activity was run with. :ivar search: The search string used to query indexed SharePoint contents. @@ -1884,11 +2337,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class KnowledgeBaseIndexedSharePointActivityRecord( KnowledgeBaseActivityRecord, discriminator="indexedSharePoint" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents a indexed SharePoint retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -1913,6 +2370,10 @@ class KnowledgeBaseIndexedSharePointActivityRecord( activity. :vartype indexed_share_point_arguments: ~azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedSharePointActivityArguments + :ivar query_hint_processing: Details about the expressions generated from query hints for this + activity. + :vartype query_hint_processing: + ~azure.search.documents.knowledgebases.models.KnowledgeBaseQueryHintProcessing """ knowledge_source_name: Optional[str] = rest_field( @@ -1936,12 +2397,18 @@ class KnowledgeBaseIndexedSharePointActivityRecord( name="indexedSharePointArguments", visibility=["read", "create", "update", "delete", "query"] ) """The indexed SharePoint arguments for the retrieval activity.""" + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = rest_field( + name="queryHintProcessing", visibility=["read", "create", "update", "delete", "query"] + ) + """Details about the expressions generated from query hints for this activity.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -1950,6 +2417,7 @@ def __init__( count: Optional[int] = None, image_serving: Optional["_models.ImageServingStatistics"] = None, indexed_share_point_arguments: Optional["_models.KnowledgeBaseIndexedSharePointActivityArguments"] = None, + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = None, ) -> None: ... @overload @@ -1964,7 +2432,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.INDEXED_SHARE_POINT # type: ignore -class KnowledgeBaseIndexedSharePointReference(KnowledgeBaseReference, discriminator="indexedSharePoint"): +class KnowledgeBaseIndexedSharePointReference( + KnowledgeBaseReference, discriminator="indexedSharePoint" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an indexed SharePoint document reference. :ivar id: The ID of the reference. Required. @@ -1982,6 +2452,9 @@ class KnowledgeBaseIndexedSharePointReference(KnowledgeBaseReference, discrimina :ivar search_sensitivity_label_info: The sensitivity label information for the reference. :vartype search_sensitivity_label_info: ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo + :ivar citation_url: A Search-owned URL that points at the backing document for this reference, + usable as a citation target. + :vartype citation_url: str """ type: Literal[KnowledgeBaseReferenceType.INDEXED_SHARE_POINT] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -1992,6 +2465,11 @@ class KnowledgeBaseIndexedSharePointReference(KnowledgeBaseReference, discrimina name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] ) """The sensitivity label information for the reference.""" + citation_url: Optional[str] = rest_field( + name="citationUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """A Search-owned URL that points at the backing document for this reference, usable as a citation + target.""" @overload def __init__( @@ -2003,6 +2481,7 @@ def __init__( reranker_score: Optional[float] = None, doc_url: Optional[str] = None, search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = None, + citation_url: Optional[str] = None, ) -> None: ... @overload @@ -2017,7 +2496,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.INDEXED_SHARE_POINT # type: ignore -class KnowledgeBaseIndexedSqlActivityArguments(_Model): +class KnowledgeBaseIndexedSqlActivityArguments(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the arguments the indexed SQL retrieval activity was run with. :ivar search: The search string used to query indexed SQL contents. @@ -2045,11 +2524,17 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseIndexedSqlActivityRecord(KnowledgeBaseActivityRecord, discriminator="indexedSql"): +class KnowledgeBaseIndexedSqlActivityRecord( + KnowledgeBaseActivityRecord, discriminator="indexedSql" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an indexed SQL retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -2073,6 +2558,10 @@ class KnowledgeBaseIndexedSqlActivityRecord(KnowledgeBaseActivityRecord, discrim :ivar indexed_sql_arguments: The indexed SQL arguments for the retrieval activity. :vartype indexed_sql_arguments: ~azure.search.documents.knowledgebases.models.KnowledgeBaseIndexedSqlActivityArguments + :ivar query_hint_processing: Details about the expressions generated from query hints for this + activity. + :vartype query_hint_processing: + ~azure.search.documents.knowledgebases.models.KnowledgeBaseQueryHintProcessing """ knowledge_source_name: Optional[str] = rest_field( @@ -2096,12 +2585,18 @@ class KnowledgeBaseIndexedSqlActivityRecord(KnowledgeBaseActivityRecord, discrim name="indexedSqlArguments", visibility=["read", "create", "update", "delete", "query"] ) """The indexed SQL arguments for the retrieval activity.""" + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = rest_field( + name="queryHintProcessing", visibility=["read", "create", "update", "delete", "query"] + ) + """Details about the expressions generated from query hints for this activity.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -2110,6 +2605,7 @@ def __init__( count: Optional[int] = None, image_serving: Optional["_models.ImageServingStatistics"] = None, indexed_sql_arguments: Optional["_models.KnowledgeBaseIndexedSqlActivityArguments"] = None, + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = None, ) -> None: ... @overload @@ -2124,7 +2620,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.INDEXED_SQL # type: ignore -class KnowledgeBaseIndexedSqlReference(KnowledgeBaseReference, discriminator="indexedSql"): +class KnowledgeBaseIndexedSqlReference( + KnowledgeBaseReference, discriminator="indexedSql" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an Azure SQL document reference. :ivar id: The ID of the reference. Required. @@ -2139,12 +2637,20 @@ class KnowledgeBaseIndexedSqlReference(KnowledgeBaseReference, discriminator="in :vartype type: str or ~azure.search.documents.knowledgebases.models.INDEXED_SQL :ivar doc_url: The document URL for the reference. :vartype doc_url: str + :ivar citation_url: A Search-owned URL that points at the backing document for this reference, + usable as a citation target. + :vartype citation_url: str """ type: Literal[KnowledgeBaseReferenceType.INDEXED_SQL] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore """The discriminator value. Required. Indexed SQL document reference.""" doc_url: Optional[str] = rest_field(name="docUrl", visibility=["read", "create", "update", "delete", "query"]) """The document URL for the reference.""" + citation_url: Optional[str] = rest_field( + name="citationUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """A Search-owned URL that points at the backing document for this reference, usable as a citation + target.""" @overload def __init__( @@ -2155,6 +2661,7 @@ def __init__( source_data: Optional[dict[str, Any]] = None, reranker_score: Optional[float] = None, doc_url: Optional[str] = None, + citation_url: Optional[str] = None, ) -> None: ... @overload @@ -2169,7 +2676,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.INDEXED_SQL # type: ignore -class KnowledgeBaseMcpServerActivityArguments(_Model): +class KnowledgeBaseMcpServerActivityArguments(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the arguments the MCP server retrieval activity was run with. :ivar tool_name: The name of the MCP server tool used for the retrieval activity. @@ -2204,11 +2711,17 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseMcpServerActivityRecord(KnowledgeBaseActivityRecord, discriminator="mcpServer"): +class KnowledgeBaseMcpServerActivityRecord( + KnowledgeBaseActivityRecord, discriminator="mcpServer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an MCP server retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -2261,6 +2774,8 @@ def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -2283,7 +2798,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.MCP_SERVER # type: ignore -class KnowledgeBaseMcpServerReference(KnowledgeBaseReference, discriminator="mcpServer"): +class KnowledgeBaseMcpServerReference( + KnowledgeBaseReference, discriminator="mcpServer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an MCP server document reference. :ivar id: The ID of the reference. Required. @@ -2333,7 +2850,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.MCP_SERVER # type: ignore -class KnowledgeBaseMessage(_Model): +class KnowledgeBaseMessage(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The natural language message style object. :ivar role: The role of the tool response. @@ -2369,7 +2886,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseMessageContent(_Model): +class KnowledgeBaseMessageContent(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the type of the message content. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -2402,7 +2919,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseMessageImageContent(KnowledgeBaseMessageContent, discriminator="image"): +class KnowledgeBaseMessageImageContent( + KnowledgeBaseMessageContent, discriminator="image" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Image message type. :ivar type: The discriminator value. Required. Image message content kind. @@ -2435,7 +2954,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseMessageContentType.IMAGE # type: ignore -class KnowledgeBaseMessageTextContent(KnowledgeBaseMessageContent, discriminator="text"): +class KnowledgeBaseMessageTextContent( + KnowledgeBaseMessageContent, discriminator="text" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Text message type. :ivar type: The discriminator value. Required. Text message content kind. @@ -2470,11 +2991,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class KnowledgeBaseModelAnswerSynthesisActivityRecord( KnowledgeBaseActivityRecord, discriminator="modelAnswerSynthesis" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents an LLM answer synthesis activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -2490,8 +3015,8 @@ class KnowledgeBaseModelAnswerSynthesisActivityRecord( :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 + :ivar model: The model used for the LLM answer synthesis activity. + :vartype model: ~azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecordModel """ type: Literal[KnowledgeBaseActivityRecordType.MODEL_ANSWER_SYNTHESIS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -2504,20 +3029,24 @@ class KnowledgeBaseModelAnswerSynthesisActivityRecord( 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.""" + model: Optional["_models.KnowledgeBaseActivityRecordModel"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The model used for the LLM answer synthesis activity.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, 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, + model: Optional["_models.KnowledgeBaseActivityRecordModel"] = None, ) -> None: ... @overload @@ -2534,11 +3063,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class KnowledgeBaseModelQueryPlanningActivityRecord( KnowledgeBaseActivityRecord, discriminator="modelQueryPlanning" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents an LLM query planning activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -2554,8 +3087,8 @@ class KnowledgeBaseModelQueryPlanningActivityRecord( :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 + :ivar model: The model used for the LLM query planning activity. + :vartype model: ~azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecordModel """ type: Literal[KnowledgeBaseActivityRecordType.MODEL_QUERY_PLANNING] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -2568,20 +3101,24 @@ class KnowledgeBaseModelQueryPlanningActivityRecord( 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.""" + model: Optional["_models.KnowledgeBaseActivityRecordModel"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The model used for the LLM query planning activity.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, 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, + model: Optional["_models.KnowledgeBaseActivityRecordModel"] = None, ) -> None: ... @overload @@ -2598,11 +3135,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class KnowledgeBaseModelWebSummarizationActivityRecord( KnowledgeBaseActivityRecord, discriminator="modelWebSummarization" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents an LLM web summarization activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -2618,8 +3159,8 @@ class KnowledgeBaseModelWebSummarizationActivityRecord( :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 + :ivar model: The model used for the LLM web summarization activity. + :vartype model: ~azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecordModel """ type: Literal[KnowledgeBaseActivityRecordType.MODEL_WEB_SUMMARIZATION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -2632,20 +3173,24 @@ 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.""" + model: Optional["_models.KnowledgeBaseActivityRecordModel"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The model used for the LLM web summarization activity.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, 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, + model: Optional["_models.KnowledgeBaseActivityRecordModel"] = None, ) -> None: ... @overload @@ -2660,7 +3205,46 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.MODEL_WEB_SUMMARIZATION # type: ignore -class KnowledgeBaseRemoteSharePointActivityArguments(_Model): # pylint: disable=name-too-long +class KnowledgeBaseQueryHintProcessing(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Details about the expressions generated from query hints for a retrieval activity. + + :ivar generated_boost: The search clause generated from boost hints for this activity. + :vartype generated_boost: str + :ivar generated_filter: The filter expression generated from filter hints for this activity. + :vartype generated_filter: str + """ + + generated_boost: Optional[str] = rest_field( + name="generatedBoost", visibility=["read", "create", "update", "delete", "query"] + ) + """The search clause generated from boost hints for this activity.""" + generated_filter: Optional[str] = rest_field( + name="generatedFilter", visibility=["read", "create", "update", "delete", "query"] + ) + """The filter expression generated from filter hints for this activity.""" + + @overload + def __init__( + self, + *, + generated_boost: Optional[str] = None, + generated_filter: 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 KnowledgeBaseRemoteSharePointActivityArguments( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents the arguments the remote SharePoint retrieval activity was run with. :ivar search: The search string used to query the remote SharePoint knowledge source. @@ -2697,11 +3281,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class KnowledgeBaseRemoteSharePointActivityRecord( KnowledgeBaseActivityRecord, discriminator="remoteSharePoint" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents a remote SharePoint retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -2754,6 +3342,8 @@ def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -2776,7 +3366,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.REMOTE_SHARE_POINT # type: ignore -class KnowledgeBaseRemoteSharePointReference(KnowledgeBaseReference, discriminator="remoteSharePoint"): +class KnowledgeBaseRemoteSharePointReference( + KnowledgeBaseReference, discriminator="remoteSharePoint" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a remote SharePoint document reference. :ivar id: The ID of the reference. Required. @@ -2829,7 +3421,46 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.REMOTE_SHARE_POINT # type: ignore -class KnowledgeBaseRetrievalRequest(_Model): +class KnowledgeBaseResponseCompletedEvent(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Emitted after retrieval completes successfully. + + :ivar status_code: The semantic HTTP status of the completed retrieval. Required. Known values + are: 200 and 206. + :vartype status_code: int or + ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalStatusCode + :ivar response: The authoritative completed retrieval response. Required. + :vartype response: ~azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse + """ + + status_code: Union[int, "_models.KnowledgeBaseRetrievalStatusCode"] = rest_field( + name="statusCode", visibility=["read", "create", "update", "delete", "query"] + ) + """The semantic HTTP status of the completed retrieval. Required. Known values are: 200 and 206.""" + response: "_models.KnowledgeBaseRetrievalResponse" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The authoritative completed retrieval response. Required.""" + + @overload + def __init__( + self, + *, + status_code: Union[int, "_models.KnowledgeBaseRetrievalStatusCode"], + response: "_models.KnowledgeBaseRetrievalResponse", + ) -> 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 KnowledgeBaseRetrievalRequest(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The input contract for the retrieval request. :ivar messages: A list of chat message style input. @@ -2927,7 +3558,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseRetrievalResponse(_Model): +class KnowledgeBaseRetrievalResponse(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The output contract for the retrieval response. :ivar response: The response messages. @@ -2981,7 +3612,63 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseSearchIndexActivityArguments(_Model): # pylint: disable=name-too-long +class KnowledgeBaseRetrievalStartedEvent(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Emitted once retrieval preflight validation completes, before any activity begins. + + :ivar request_id: A service-generated identifier that correlates all events in this retrieval + stream. Required. + :vartype request_id: str + :ivar knowledge_base_name: The name of the knowledge base being queried. Required. + :vartype knowledge_base_name: str + :ivar output_mode: The effective output mode for this retrieval. Required. Known values are: + "extractiveData" and "answerSynthesis". + :vartype output_mode: str or + ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalOutputMode + :ivar reasoning_effort: The effective reasoning effort for this retrieval. Required. + :vartype reasoning_effort: + ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalReasoningEffort + """ + + request_id: str = rest_field(name="requestId", visibility=["read", "create", "update", "delete", "query"]) + """A service-generated identifier that correlates all events in this retrieval stream. Required.""" + knowledge_base_name: str = rest_field( + name="knowledgeBaseName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the knowledge base being queried. Required.""" + output_mode: Union[str, "_models.KnowledgeRetrievalOutputMode"] = rest_field( + name="outputMode", visibility=["read", "create", "update", "delete", "query"] + ) + """The effective output mode for this retrieval. Required. Known values are: \"extractiveData\" + and \"answerSynthesis\".""" + reasoning_effort: "_models.KnowledgeRetrievalReasoningEffort" = rest_field( + name="reasoningEffort", visibility=["read", "create", "update", "delete", "query"] + ) + """The effective reasoning effort for this retrieval. Required.""" + + @overload + def __init__( + self, + *, + request_id: str, + knowledge_base_name: str, + output_mode: Union[str, "_models.KnowledgeRetrievalOutputMode"], + reasoning_effort: "_models.KnowledgeRetrievalReasoningEffort", + ) -> 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 KnowledgeBaseSearchIndexActivityArguments( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Represents the arguments the search index retrieval activity was run with. :ivar search: The search string used to query the search index. @@ -2995,6 +3682,9 @@ class KnowledgeBaseSearchIndexActivityArguments(_Model): # pylint: disable=name :vartype search_fields: list[~azure.search.documents.indexes.models.SearchIndexFieldReference] :ivar semantic_configuration_name: What semantic configuration was used from the search index. :vartype semantic_configuration_name: str + :ivar query_type: The query syntax used to execute the search. Query hints can cause semantic + queries to use full query syntax. Known values are: "simple", "full", and "semantic". + :vartype query_type: str or ~azure.search.documents.models.QueryType """ search: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -3013,6 +3703,11 @@ class KnowledgeBaseSearchIndexActivityArguments(_Model): # pylint: disable=name name="semanticConfigurationName", visibility=["read", "create", "update", "delete", "query"] ) """What semantic configuration was used from the search index.""" + query_type: Optional[Union[str, "_models2.QueryType"]] = rest_field( + name="queryType", visibility=["read", "create", "update", "delete", "query"] + ) + """The query syntax used to execute the search. Query hints can cause semantic queries to use full + query syntax. Known values are: \"simple\", \"full\", and \"semantic\".""" @overload def __init__( @@ -3023,6 +3718,7 @@ def __init__( source_data_fields: Optional[list["_indexes_models3.SearchIndexFieldReference"]] = None, search_fields: Optional[list["_indexes_models3.SearchIndexFieldReference"]] = None, semantic_configuration_name: Optional[str] = None, + query_type: Optional[Union[str, "_models2.QueryType"]] = None, ) -> None: ... @overload @@ -3036,11 +3732,17 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseSearchIndexActivityRecord(KnowledgeBaseActivityRecord, discriminator="searchIndex"): +class KnowledgeBaseSearchIndexActivityRecord( + KnowledgeBaseActivityRecord, discriminator="searchIndex" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a search index retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -3064,6 +3766,10 @@ class KnowledgeBaseSearchIndexActivityRecord(KnowledgeBaseActivityRecord, discri :ivar search_index_arguments: The search index arguments for the retrieval activity. :vartype search_index_arguments: ~azure.search.documents.knowledgebases.models.KnowledgeBaseSearchIndexActivityArguments + :ivar query_hint_processing: Details about the expressions generated from query hints for this + activity. + :vartype query_hint_processing: + ~azure.search.documents.knowledgebases.models.KnowledgeBaseQueryHintProcessing """ knowledge_source_name: Optional[str] = rest_field( @@ -3087,12 +3793,18 @@ class KnowledgeBaseSearchIndexActivityRecord(KnowledgeBaseActivityRecord, discri name="searchIndexArguments", visibility=["read", "create", "update", "delete", "query"] ) """The search index arguments for the retrieval activity.""" + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = rest_field( + name="queryHintProcessing", visibility=["read", "create", "update", "delete", "query"] + ) + """Details about the expressions generated from query hints for this activity.""" @overload def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -3101,6 +3813,7 @@ def __init__( count: Optional[int] = None, image_serving: Optional["_models.ImageServingStatistics"] = None, search_index_arguments: Optional["_models.KnowledgeBaseSearchIndexActivityArguments"] = None, + query_hint_processing: Optional["_models.KnowledgeBaseQueryHintProcessing"] = None, ) -> None: ... @overload @@ -3115,7 +3828,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.SEARCH_INDEX # type: ignore -class KnowledgeBaseSearchIndexReference(KnowledgeBaseReference, discriminator="searchIndex"): +class KnowledgeBaseSearchIndexReference( + KnowledgeBaseReference, discriminator="searchIndex" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an Azure Search document reference. :ivar id: The ID of the reference. Required. @@ -3133,6 +3848,9 @@ class KnowledgeBaseSearchIndexReference(KnowledgeBaseReference, discriminator="s :ivar search_sensitivity_label_info: The sensitivity label information for the reference. :vartype search_sensitivity_label_info: ~azure.search.documents.knowledgebases.models.PurviewSensitivityLabelInfo + :ivar citation_url: A Search-owned URL that points at the backing document for this reference, + usable as a citation target. + :vartype citation_url: str """ type: Literal[KnowledgeBaseReferenceType.SEARCH_INDEX] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -3143,6 +3861,11 @@ class KnowledgeBaseSearchIndexReference(KnowledgeBaseReference, discriminator="s name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] ) """The sensitivity label information for the reference.""" + citation_url: Optional[str] = rest_field( + name="citationUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """A Search-owned URL that points at the backing document for this reference, usable as a citation + target.""" @overload def __init__( @@ -3154,6 +3877,7 @@ def __init__( reranker_score: Optional[float] = None, doc_key: Optional[str] = None, search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = None, + citation_url: Optional[str] = None, ) -> None: ... @overload @@ -3168,7 +3892,43 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.SEARCH_INDEX # type: ignore -class KnowledgeBaseWebActivityArguments(_Model): +class KnowledgeBaseStreamErrorEvent(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Emitted in place of ``response.completed`` if retrieval fails after the stream starts. + + :ivar error: The error detail explaining why the retrieval stream failed. Required. + :vartype error: ~azure.search.documents.knowledgebases.models.KnowledgeBaseErrorDetail + :ivar activity: Activity records that completed before the retrieval failed. + :vartype activity: + list[~azure.search.documents.knowledgebases.models.KnowledgeBaseActivityRecord] + """ + + error: "_models.KnowledgeBaseErrorDetail" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error detail explaining why the retrieval stream failed. Required.""" + activity: Optional[list["_models.KnowledgeBaseActivityRecord"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Activity records that completed before the retrieval failed.""" + + @overload + def __init__( + self, + *, + error: "_models.KnowledgeBaseErrorDetail", + activity: Optional[list["_models.KnowledgeBaseActivityRecord"]] = 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 KnowledgeBaseWebActivityArguments(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the arguments the web retrieval activity was run with. :ivar search: The search string used to query the web. @@ -3216,11 +3976,17 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseWebActivityRecord(KnowledgeBaseActivityRecord, discriminator="web"): +class KnowledgeBaseWebActivityRecord( + KnowledgeBaseActivityRecord, discriminator="web" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a web retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -3273,6 +4039,8 @@ def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -3295,7 +4063,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.WEB # type: ignore -class KnowledgeBaseWebReference(KnowledgeBaseReference, discriminator="web"): +class KnowledgeBaseWebReference( + KnowledgeBaseReference, discriminator="web" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a web document reference. :ivar id: The ID of the reference. Required. @@ -3345,7 +4115,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.WEB # type: ignore -class KnowledgeBaseWorkIQActivityArguments(_Model): +class KnowledgeBaseWorkIQActivityArguments(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the arguments the WorkIQ retrieval activity was run with. :ivar search: The search string used to query the WorkIQ knowledge source. @@ -3373,11 +4143,17 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeBaseWorkIQActivityRecord(KnowledgeBaseActivityRecord, discriminator="workIQ"): +class KnowledgeBaseWorkIQActivityRecord( + KnowledgeBaseActivityRecord, discriminator="workIQ" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a WorkIQ retrieval activity record. :ivar id: The ID of the activity record. Required. :vartype id: int + :ivar started_at: The time at which the activity started. + :vartype started_at: ~datetime.datetime + :ivar completed_at: The time at which the activity completed. + :vartype completed_at: ~datetime.datetime :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 @@ -3430,6 +4206,8 @@ def __init__( self, *, id: int, # pylint: disable=redefined-builtin + started_at: Optional[datetime.datetime] = None, + completed_at: Optional[datetime.datetime] = None, elapsed_ms: Optional[int] = None, error: Optional["_models.KnowledgeBaseErrorDetail"] = None, warning: Optional[str] = None, @@ -3452,7 +4230,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseActivityRecordType.WORK_IQ # type: ignore -class KnowledgeBaseWorkIQReference(KnowledgeBaseReference, discriminator="workIQ"): +class KnowledgeBaseWorkIQReference( + KnowledgeBaseReference, discriminator="workIQ" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a WorkIQ document reference. :ivar id: The ID of the reference. Required. @@ -3465,16 +4245,17 @@ class KnowledgeBaseWorkIQReference(KnowledgeBaseReference, discriminator="workIQ :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] + :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.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"] + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = rest_field( + name="searchSensitivityLabelInfo", visibility=["read", "create", "update", "delete", "query"] ) - """The attributions for the reference.""" + """The sensitivity label information for the reference.""" @overload def __init__( @@ -3484,7 +4265,7 @@ def __init__( activity_source: int, source_data: Optional[dict[str, Any]] = None, reranker_score: Optional[float] = None, - attributions: Optional[list["_models.WorkIQAttribution"]] = None, + search_sensitivity_label_info: Optional["_models.PurviewSensitivityLabelInfo"] = None, ) -> None: ... @overload @@ -3499,26 +4280,29 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeBaseReferenceType.WORK_IQ # type: ignore -class KnowledgeRetrievalIntent(_Model): - """An intended query to execute without model query planning. +class KnowledgeRetrievalReasoningEffort(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Base type for reasoning effort. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - KnowledgeRetrievalSemanticIntent + KnowledgeRetrievalAutoReasoningEffort, KnowledgeRetrievalLowReasoningEffort, + KnowledgeRetrievalMediumReasoningEffort, KnowledgeRetrievalMinimalReasoningEffort - :ivar type: The type of the intent. Required. "semantic" - :vartype type: str or - ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalIntentType + :ivar kind: The kind of reasoning effort. Required. Known values are: "minimal", "low", + "medium", and "auto". + :vartype kind: str or + ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalReasoningEffortKind """ __mapping__: dict[str, _Model] = {} - type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) - """The type of the intent. Required. \"semantic\"""" + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """The kind of reasoning effort. Required. Known values are: \"minimal\", \"low\", \"medium\", and + \"auto\".""" @overload def __init__( self, *, - type: str, + kind: str, ) -> None: ... @overload @@ -3532,28 +4316,57 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeRetrievalReasoningEffort(_Model): - """Base type for reasoning effort. +class KnowledgeRetrievalAutoReasoningEffort(KnowledgeRetrievalReasoningEffort, discriminator="auto"): + """Automatically select the reasoning effort during retrieval. The service seeds every request at + the cheapest tier and escalates only as far as needed, up to the service's maximum available + tier. + + :ivar kind: The discriminator value. Required. Automatically select the reasoning effort during + retrieval, escalating from the cheapest tier only as far as needed. + :vartype kind: str or ~azure.search.documents.knowledgebases.models.AUTO + """ + + kind: Literal[KnowledgeRetrievalReasoningEffortKind.AUTO] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The discriminator value. Required. Automatically select the reasoning effort during retrieval, + escalating from the cheapest tier only as far as needed.""" + + @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.AUTO # type: ignore + + +class KnowledgeRetrievalIntent(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An intended query to execute without model query planning. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - KnowledgeRetrievalLowReasoningEffort, KnowledgeRetrievalMediumReasoningEffort, - KnowledgeRetrievalMinimalReasoningEffort + KnowledgeRetrievalSemanticIntent - :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 + :ivar type: The type of the intent. Required. "semantic" + :vartype type: str or + ~azure.search.documents.knowledgebases.models.KnowledgeRetrievalIntentType """ __mapping__: dict[str, _Model] = {} - kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) - """The kind of reasoning effort. Required. Known values are: \"minimal\", \"low\", and \"medium\".""" + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """The type of the intent. Required. \"semantic\"""" @overload def __init__( self, *, - kind: str, + type: str, ) -> None: ... @overload @@ -3651,7 +4464,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeRetrievalReasoningEffortKind.MINIMAL # type: ignore -class KnowledgeRetrievalSemanticIntent(KnowledgeRetrievalIntent, discriminator="semantic"): +class KnowledgeRetrievalSemanticIntent( + KnowledgeRetrievalIntent, discriminator="semantic" +): # pylint: disable=docstring-keyword-should-match-keyword-only """A semantic query intent. :ivar type: The discriminator value. Required. A natural language semantic query intent. @@ -3684,7 +4499,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.type = KnowledgeRetrievalIntentType.SEMANTIC # type: ignore -class KnowledgeSourceVectorizer(_Model): +class KnowledgeSourceVectorizer(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the vectorization method to be used for knowledge source embedding model. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -3720,7 +4535,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeSourceAzureOpenAIVectorizer(KnowledgeSourceVectorizer, discriminator="azureOpenAI"): +class KnowledgeSourceAzureOpenAIVectorizer( + KnowledgeSourceVectorizer, discriminator="azureOpenAI" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies the Azure OpenAI resource used to vectorize a query string. :ivar kind: The discriminator value. Required. Generate embeddings using an Azure OpenAI @@ -3759,7 +4576,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorSearchVectorizerKind.AZURE_OPEN_AI # type: ignore -class KnowledgeSourceIngestionParameters(_Model): +class KnowledgeSourceIngestionParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Consolidates all general ingestion settings for knowledge sources. :ivar identity: An explicit identity to use for this knowledge source. @@ -3790,6 +4607,12 @@ class KnowledgeSourceIngestionParameters(_Model): :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 + :ivar network_access_mode: Optional network access mode for ingestion. Set to 'private' to run + ingestion in a private execution environment that can reach data sources and dependencies over + a private network. Default is 'public'. This is a create-time setting and cannot be changed + after the knowledge source is created. Known values are: "public" and "private". + :vartype network_access_mode: str or + ~azure.search.documents.knowledgebases.models.KnowledgeSourceNetworkAccessMode """ identity: Optional["_indexes_models3.SearchIndexerDataIdentity"] = rest_field( @@ -3834,6 +4657,13 @@ class KnowledgeSourceIngestionParameters(_Model): name="freshnessPolicy", visibility=["read", "create", "update", "delete", "query"] ) """Optional freshness policy for biasing retrieval toward newer documents.""" + network_access_mode: Optional[Union[str, "_models.KnowledgeSourceNetworkAccessMode"]] = rest_field( + name="networkAccessMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional network access mode for ingestion. Set to 'private' to run ingestion in a private + execution environment that can reach data sources and dependencies over a private network. + Default is 'public'. This is a create-time setting and cannot be changed after the knowledge + source is created. Known values are: \"public\" and \"private\".""" @overload def __init__( @@ -3851,6 +4681,7 @@ def __init__( ai_services: Optional["_models.AIServices"] = None, asset_store: Optional["_models.AssetStore"] = None, freshness_policy: Optional["_models.FreshnessPolicy"] = None, + network_access_mode: Optional[Union[str, "_models.KnowledgeSourceNetworkAccessMode"]] = None, ) -> None: ... @overload @@ -3864,7 +4695,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeSourceStatistics(_Model): +class KnowledgeSourceStatistics(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Statistical information about knowledge source synchronization history. :ivar total_synchronization: Total number of synchronizations. Required. @@ -3910,7 +4741,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeSourceStatus(_Model): +class KnowledgeSourceStatus(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the status and synchronization history of a knowledge source. :ivar kind: Identifies the Knowledge Source kind directly from the Status response. Known @@ -3990,7 +4821,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class KnowledgeSourceSynchronizationError(_Model): +class KnowledgeSourceSynchronizationError(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a document-level indexing error encountered during a knowledge source synchronization run. @@ -4049,7 +4880,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class McpServerKnowledgeSourceParams(KnowledgeSourceParams, discriminator="mcpServer"): +class McpServerKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="mcpServer" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for an MCP server knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -4063,12 +4896,22 @@ class McpServerKnowledgeSourceParams(KnowledgeSourceParams, discriminator="mcpSe :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -4093,8 +4936,10 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, ) -> None: ... @@ -4111,7 +4956,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.MCP_SERVER # type: ignore -class PurviewSensitivityLabelInfo(_Model): +class PurviewSensitivityLabelInfo(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Information about the sensitivity label applied to a document. :ivar display_name: The display name for the sensitivity label. @@ -4170,7 +5015,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RemoteSharePointKnowledgeSourceParams(KnowledgeSourceParams, discriminator="remoteSharePoint"): +class RemoteSharePointKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="remoteSharePoint" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a remote SharePoint knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -4184,12 +5031,22 @@ class RemoteSharePointKnowledgeSourceParams(KnowledgeSourceParams, discriminator :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -4223,8 +5080,10 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, filter_expression_add_on: Optional[str] = None, @@ -4242,7 +5101,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.REMOTE_SHARE_POINT # type: ignore -class SearchIndexKnowledgeSourceParams(KnowledgeSourceParams, discriminator="searchIndex"): +class SearchIndexKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="searchIndex" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a search index knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -4256,12 +5117,22 @@ class SearchIndexKnowledgeSourceParams(KnowledgeSourceParams, discriminator="sea :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -4274,6 +5145,11 @@ class SearchIndexKnowledgeSourceParams(KnowledgeSourceParams, discriminator="sea :vartype kind: str or ~azure.search.documents.indexes.models.SEARCH_INDEX :ivar filter_add_on: A filter condition applied to the index (e.g., 'State eq VA'). :vartype filter_add_on: str + :ivar query_hint_overrides: Hints that guide query planning toward useful filters and boosts. + If specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype query_hint_overrides: + ~azure.search.documents.indexes.models.SearchIndexKnowledgeSourceQueryHints """ kind: Literal[KnowledgeSourceKind.SEARCH_INDEX] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -4282,6 +5158,11 @@ class SearchIndexKnowledgeSourceParams(KnowledgeSourceParams, discriminator="sea name="filterAddOn", visibility=["read", "create", "update", "delete", "query"] ) """A filter condition applied to the index (e.g., 'State eq VA').""" + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = rest_field( + name="queryHintOverrides", visibility=["read", "create", "update", "delete", "query"] + ) + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" @overload def __init__( @@ -4291,11 +5172,14 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, filter_add_on: Optional[str] = None, + query_hint_overrides: Optional["_indexes_models3.SearchIndexKnowledgeSourceQueryHints"] = None, ) -> None: ... @overload @@ -4310,7 +5194,47 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = KnowledgeSourceKind.SEARCH_INDEX # type: ignore -class SynchronizationState(_Model): +class ServedImage(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Describes a single image that the model selected to be served during a retrieval activity. + + :ivar image_id: The image label extracted from the source document by Content Understanding + enrichment. Corresponds to the figure numbering in the original document. + :vartype image_id: str + :ivar image_path: The relative path to the image within the asset store. Required. + :vartype image_path: str + :ivar size_bytes: The size in bytes of this image as sent to the model. Required. + :vartype size_bytes: int + """ + + image_id: Optional[str] = rest_field(name="imageId", visibility=["read", "create", "update", "delete", "query"]) + """The image label extracted from the source document by Content Understanding enrichment. + Corresponds to the figure numbering in the original document.""" + image_path: str = rest_field(name="imagePath", visibility=["read", "create", "update", "delete", "query"]) + """The relative path to the image within the asset store. Required.""" + size_bytes: int = rest_field(name="sizeBytes", visibility=["read", "create", "update", "delete", "query"]) + """The size in bytes of this image as sent to the model. Required.""" + + @overload + def __init__( + self, + *, + image_path: str, + size_bytes: int, + image_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 SynchronizationState(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents the current state of an ongoing synchronization that spans multiple indexer runs. :ivar start_time: The start time of the current synchronization. Required. @@ -4371,7 +5295,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class WebKnowledgeSourceParams(KnowledgeSourceParams, discriminator="web"): +class WebKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="web" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a web knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -4385,12 +5311,22 @@ class WebKnowledgeSourceParams(KnowledgeSourceParams, discriminator="web"): :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -4429,8 +5365,10 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, language: Optional[str] = None, @@ -4451,37 +5389,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: 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"): +class WorkIQKnowledgeSourceParams( + KnowledgeSourceParams, discriminator="workIQ" +): # pylint: disable=docstring-keyword-should-match-keyword-only """Specifies runtime parameters for a WorkIQ knowledge source. :ivar knowledge_source_name: The name of the index the params apply to. Required. @@ -4495,12 +5405,22 @@ class WorkIQKnowledgeSourceParams(KnowledgeSourceParams, discriminator="workIQ") :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 never_query_source: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype never_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 results_processing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype results_processing: str or + ~azure.search.documents.indexes.models.KnowledgeSourceResultsProcessing :ivar max_output_documents: Limits the maximum number of documents returned from this knowledge source. :vartype max_output_documents: int @@ -4523,8 +5443,10 @@ def __init__( include_references: Optional[bool] = None, include_reference_source_data: Optional[bool] = None, always_query_source: Optional[bool] = None, + never_query_source: Optional[bool] = None, fail_on_error: Optional[bool] = None, reranker_threshold: Optional[float] = None, + results_processing: Optional[Union[str, "_indexes_models3.KnowledgeSourceResultsProcessing"]] = None, max_output_documents: Optional[int] = None, enable_image_serving: Optional[bool] = None, ) -> None: ... diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_patch.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_patch.py +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/models/_patch.py @@ -8,7 +8,6 @@ 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 diff --git a/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/types.py b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/types.py new file mode 100644 index 000000000000..ac3703cb3c23 --- /dev/null +++ b/sdk/search/azure-search-documents/azure/search/documents/knowledgebases/types.py @@ -0,0 +1,1156 @@ +# pylint: disable=too-many-lines +# 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 typing import Literal, TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +from ..indexes.models._enums import KnowledgeSourceKind +from .models._enums import ( + KnowledgeBaseMessageContentType, + KnowledgeRetrievalIntentType, + KnowledgeRetrievalReasoningEffortKind, +) + +if TYPE_CHECKING: + from ..indexes.types import SearchIndexKnowledgeSourceQueryHints + from ..indexes.models import KnowledgeSourceResultsProcessing + from .models import KnowledgeRetrievalOutputMode + + +class AzureBlobKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a azure blob knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: 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: Literal[KnowledgeSourceKind.AZURE_BLOB] + :ivar queryHintOverrides: Hints that guide query planning toward useful filters and boosts. If + specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.AZURE_BLOB]] + """The discriminator value. Required. A knowledge source that read and ingest data from Azure Blob + Storage to a Search Index.""" + queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" + + +class FabricDataAgentKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a Fabric Data Agent knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source that retrieves data from a + Fabric Data Agent. + :vartype kind: Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT] + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.FABRIC_DATA_AGENT]] + """The discriminator value. Required. A knowledge source that retrieves data from a Fabric Data + Agent.""" + + +class FabricOntologyKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a Fabric Ontology knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source that retrieves data from + Microsoft Fabric Ontology ontologies. + :vartype kind: Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY] + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.FABRIC_ONTOLOGY]] + """The discriminator value. Required. A knowledge source that retrieves data from Microsoft Fabric + Ontology ontologies.""" + + +class FileKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a File knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source that supports direct file + upload and indexing. + :vartype kind: Literal[KnowledgeSourceKind.FILE] + :ivar queryHintOverrides: Hints that guide query planning toward useful filters and boosts. If + specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.FILE]] + """The discriminator value. Required. A knowledge source that supports direct file upload and + indexing.""" + queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" + + +class IndexedOneLakeKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a indexed OneLake knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source that reads data from indexed + OneLake. + :vartype kind: Literal[KnowledgeSourceKind.INDEXED_ONELAKE] + :ivar queryHintOverrides: Hints that guide query planning toward useful filters and boosts. If + specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.INDEXED_ONELAKE]] + """The discriminator value. Required. A knowledge source that reads data from indexed OneLake.""" + queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" + + +class IndexedSharePointKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a indexed SharePoint knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source that reads data from indexed + SharePoint. + :vartype kind: Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT] + :ivar queryHintOverrides: Hints that guide query planning toward useful filters and boosts. If + specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.INDEXED_SHARE_POINT]] + """The discriminator value. Required. A knowledge source that reads data from indexed SharePoint.""" + queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" + + +class IndexedSqlKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for an indexed SQL knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :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: Literal[KnowledgeSourceKind.INDEXED_SQL] + :ivar queryHintOverrides: Hints that guide query planning toward useful filters and boosts. If + specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.INDEXED_SQL]] + """The discriminator value. Required. A knowledge source that retrieves and ingests data from + Azure SQL Database or SQL Managed Instance to a Search Index.""" + queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" + + +class KnowledgeBaseImageContent(TypedDict, total=False): + """Image content. + + :ivar url: The url of the image. Required. + :vartype url: str + """ + + url: Required[str] + """The url of the image. Required.""" + + +class KnowledgeBaseMessage(TypedDict, total=False): + """The natural language message style object. + + :ivar role: The role of the tool response. + :vartype role: str + :ivar content: The content of the message. Required. + :vartype content: list["KnowledgeBaseMessageContent"] + """ + + role: str + """The role of the tool response.""" + content: Required[list["KnowledgeBaseMessageContent"]] + """The content of the message. Required.""" + + +class KnowledgeBaseMessageImageContent(TypedDict, total=False): + """Image message type. + + :ivar type: The discriminator value. Required. Image message content kind. + :vartype type: Literal[KnowledgeBaseMessageContentType.IMAGE] + :ivar image: The image content. Required. + :vartype image: "KnowledgeBaseImageContent" + """ + + type: Required[Literal[KnowledgeBaseMessageContentType.IMAGE]] + """The discriminator value. Required. Image message content kind.""" + image: Required["KnowledgeBaseImageContent"] + """The image content. Required.""" + + +class KnowledgeBaseMessageTextContent(TypedDict, total=False): + """Text message type. + + :ivar type: The discriminator value. Required. Text message content kind. + :vartype type: Literal[KnowledgeBaseMessageContentType.TEXT] + :ivar text: The text content. Required. + :vartype text: str + """ + + type: Required[Literal[KnowledgeBaseMessageContentType.TEXT]] + """The discriminator value. Required. Text message content kind.""" + text: Required[str] + """The text content. Required.""" + + +class KnowledgeBaseRetrievalRequest(TypedDict, total=False): + """The input contract for the retrieval request. + + :ivar messages: A list of chat message style input. + :vartype messages: list["KnowledgeBaseMessage"] + :ivar intents: A list of intended queries to execute without model query planning. + :vartype intents: list["KnowledgeRetrievalIntent"] + :ivar maxRuntimeInSeconds: The maximum runtime in seconds. + :vartype maxRuntimeInSeconds: int + :ivar maxOutputSize: Limits the maximum size of the content in the output. + :vartype maxOutputSize: int + :ivar maxOutputDocuments: Limits the maximum number of documents in the output. + :vartype maxOutputDocuments: int + :ivar maxOutputSizeInTokens: Limits the maximum size of the content in the output. + :vartype maxOutputSizeInTokens: int + :ivar retrievalReasoningEffort: The retrieval reasoning effort configuration. + :vartype retrievalReasoningEffort: "KnowledgeRetrievalReasoningEffort" + :ivar includeActivity: Indicates retrieval results should include activity information. + :vartype includeActivity: bool + :ivar outputMode: The output configuration for this retrieval. Known values are: + "extractiveData" and "answerSynthesis". + :vartype outputMode: Union[str, "KnowledgeRetrievalOutputMode"] + :ivar knowledgeSourceParams: A list of runtime parameters for the knowledge sources. + :vartype knowledgeSourceParams: list["KnowledgeSourceParams"] + """ + + messages: list["KnowledgeBaseMessage"] + """A list of chat message style input.""" + intents: list["KnowledgeRetrievalIntent"] + """A list of intended queries to execute without model query planning.""" + maxRuntimeInSeconds: int + """The maximum runtime in seconds.""" + maxOutputSize: int + """Limits the maximum size of the content in the output.""" + maxOutputDocuments: int + """Limits the maximum number of documents in the output.""" + maxOutputSizeInTokens: int + """Limits the maximum size of the content in the output.""" + retrievalReasoningEffort: "KnowledgeRetrievalReasoningEffort" + """The retrieval reasoning effort configuration.""" + includeActivity: bool + """Indicates retrieval results should include activity information.""" + outputMode: Union[str, "KnowledgeRetrievalOutputMode"] + """The output configuration for this retrieval. Known values are: \"extractiveData\" and + \"answerSynthesis\".""" + knowledgeSourceParams: list["KnowledgeSourceParams"] + """A list of runtime parameters for the knowledge sources.""" + + +class KnowledgeRetrievalAutoReasoningEffort(TypedDict, total=False): + """Automatically select the reasoning effort during retrieval. The service seeds every request at + the cheapest tier and escalates only as far as needed, up to the service's maximum available + tier. + + :ivar kind: The discriminator value. Required. Automatically select the reasoning effort during + retrieval, escalating from the cheapest tier only as far as needed. + :vartype kind: Literal[KnowledgeRetrievalReasoningEffortKind.AUTO] + """ + + kind: Required[Literal[KnowledgeRetrievalReasoningEffortKind.AUTO]] + """The discriminator value. Required. Automatically select the reasoning effort during retrieval, + escalating from the cheapest tier only as far as needed.""" + + +class KnowledgeRetrievalLowReasoningEffort(TypedDict, total=False): + """Run knowledge retrieval with low reasoning effort. + + :ivar kind: The discriminator value. Required. Use low reasoning during retrieval. + :vartype kind: Literal[KnowledgeRetrievalReasoningEffortKind.LOW] + """ + + kind: Required[Literal[KnowledgeRetrievalReasoningEffortKind.LOW]] + """The discriminator value. Required. Use low reasoning during retrieval.""" + + +class KnowledgeRetrievalMediumReasoningEffort(TypedDict, total=False): + """Run knowledge retrieval with medium reasoning effort. + + :ivar kind: The discriminator value. Required. Use a moderate amount of reasoning during + retrieval. + :vartype kind: Literal[KnowledgeRetrievalReasoningEffortKind.MEDIUM] + """ + + kind: Required[Literal[KnowledgeRetrievalReasoningEffortKind.MEDIUM]] + """The discriminator value. Required. Use a moderate amount of reasoning during retrieval.""" + + +class KnowledgeRetrievalMinimalReasoningEffort(TypedDict, total=False): + """Run knowledge retrieval with minimal reasoning effort. + + :ivar kind: The discriminator value. Required. Does not perform any source selections, query + planning, or iterative search. + :vartype kind: Literal[KnowledgeRetrievalReasoningEffortKind.MINIMAL] + """ + + kind: Required[Literal[KnowledgeRetrievalReasoningEffortKind.MINIMAL]] + """The discriminator value. Required. Does not perform any source selections, query planning, or + iterative search.""" + + +class KnowledgeRetrievalSemanticIntent(TypedDict, total=False): + """A semantic query intent. + + :ivar type: The discriminator value. Required. A natural language semantic query intent. + :vartype type: Literal[KnowledgeRetrievalIntentType.SEMANTIC] + :ivar search: The semantic query to execute. Required. + :vartype search: str + """ + + type: Required[Literal[KnowledgeRetrievalIntentType.SEMANTIC]] + """The discriminator value. Required. A natural language semantic query intent.""" + search: Required[str] + """The semantic query to execute. Required.""" + + +class McpServerKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for an MCP server knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source backed by an MCP (Model + Context Protocol) server. + :vartype kind: Literal[KnowledgeSourceKind.MCP_SERVER] + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.MCP_SERVER]] + """The discriminator value. Required. A knowledge source backed by an MCP (Model Context Protocol) + server.""" + + +class RemoteSharePointKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a remote SharePoint knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source that reads data from remote + SharePoint. + :vartype kind: Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT] + :ivar filterExpressionAddOn: 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 filterExpressionAddOn: str + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.REMOTE_SHARE_POINT]] + """The discriminator value. Required. A knowledge source that reads data from remote SharePoint.""" + filterExpressionAddOn: str + """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.""" + + +class SearchIndexKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a search index knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source that reads data from a Search + Index. + :vartype kind: Literal[KnowledgeSourceKind.SEARCH_INDEX] + :ivar filterAddOn: A filter condition applied to the index (e.g., 'State eq VA'). + :vartype filterAddOn: str + :ivar queryHintOverrides: Hints that guide query planning toward useful filters and boosts. If + specified, this object replaces the complete set of query hints configured on the knowledge + source. + :vartype queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.SEARCH_INDEX]] + """The discriminator value. Required. A knowledge source that reads data from a Search Index.""" + filterAddOn: str + """A filter condition applied to the index (e.g., 'State eq VA').""" + queryHintOverrides: "SearchIndexKnowledgeSourceQueryHints" + """Hints that guide query planning toward useful filters and boosts. If specified, this object + replaces the complete set of query hints configured on the knowledge source.""" + + +class WebKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a web knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source that reads data from the web. + :vartype kind: Literal[KnowledgeSourceKind.WEB] + :ivar language: The language of the web results. + :vartype language: str + :ivar market: The market of the web results. + :vartype market: str + :ivar count: The number of web results to return. + :vartype count: int + :ivar freshness: The freshness of web results. + :vartype freshness: str + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.WEB]] + """The discriminator value. Required. A knowledge source that reads data from the web.""" + language: str + """The language of the web results.""" + market: str + """The market of the web results.""" + count: int + """The number of web results to return.""" + freshness: str + """The freshness of web results.""" + + +class WorkIQKnowledgeSourceParams(TypedDict, total=False): + """Specifies runtime parameters for a WorkIQ knowledge source. + + :ivar knowledgeSourceName: The name of the index the params apply to. Required. + :vartype knowledgeSourceName: str + :ivar includeReferences: Indicates whether references should be included for data retrieved + from this source. + :vartype includeReferences: bool + :ivar includeReferenceSourceData: Indicates whether references should include the structured + data obtained during retrieval in their payload. + :vartype includeReferenceSourceData: bool + :ivar alwaysQuerySource: Indicates that this knowledge source should bypass source selection + and always be queried at retrieval time. + :vartype alwaysQuerySource: bool + :ivar neverQuerySource: Indicates that this knowledge source should be excluded from the + request's candidate set and never queried at retrieval time. The exclusion is request-local and + does not modify knowledge base membership. Cannot be combined with alwaysQuerySource on the + same knowledge source. + :vartype neverQuerySource: bool + :ivar failOnError: Indicates that the entire retrieval request should fail if retrieval from + this knowledge source encounters an error. Defaults to false. + :vartype failOnError: bool + :ivar rerankerThreshold: The reranker threshold all retrieved documents must meet to be + included in the response. + :vartype rerankerThreshold: float + :ivar resultsProcessing: Overrides the knowledge source's stored resultsProcessing for this + retrieve call only. When omitted, the stored knowledge source value applies. Known values are: + "rerank" and "none". + :vartype resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + :ivar maxOutputDocuments: Limits the maximum number of documents returned from this knowledge + source. + :vartype maxOutputDocuments: int + :ivar enableImageServing: 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 enableImageServing: bool + :ivar kind: The discriminator value. Required. A knowledge source that reads data from work IQ. + :vartype kind: Literal[KnowledgeSourceKind.WORK_IQ] + """ + + knowledgeSourceName: Required[str] + """The name of the index the params apply to. Required.""" + includeReferences: bool + """Indicates whether references should be included for data retrieved from this source.""" + includeReferenceSourceData: bool + """Indicates whether references should include the structured data obtained during retrieval in + their payload.""" + alwaysQuerySource: bool + """Indicates that this knowledge source should bypass source selection and always be queried at + retrieval time.""" + neverQuerySource: bool + """Indicates that this knowledge source should be excluded from the request's candidate set and + never queried at retrieval time. The exclusion is request-local and does not modify knowledge + base membership. Cannot be combined with alwaysQuerySource on the same knowledge source.""" + failOnError: bool + """Indicates that the entire retrieval request should fail if retrieval from this knowledge source + encounters an error. Defaults to false.""" + rerankerThreshold: float + """The reranker threshold all retrieved documents must meet to be included in the response.""" + resultsProcessing: Union[str, "KnowledgeSourceResultsProcessing"] + """Overrides the knowledge source's stored resultsProcessing for this retrieve call only. When + omitted, the stored knowledge source value applies. Known values are: \"rerank\" and \"none\".""" + maxOutputDocuments: int + """Limits the maximum number of documents returned from this knowledge source.""" + enableImageServing: bool + """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.""" + kind: Required[Literal[KnowledgeSourceKind.WORK_IQ]] + """The discriminator value. Required. A knowledge source that reads data from work IQ.""" + + +KnowledgeSourceParams = Union[ + AzureBlobKnowledgeSourceParams, + FabricDataAgentKnowledgeSourceParams, + FabricOntologyKnowledgeSourceParams, + FileKnowledgeSourceParams, + IndexedOneLakeKnowledgeSourceParams, + IndexedSharePointKnowledgeSourceParams, + IndexedSqlKnowledgeSourceParams, + McpServerKnowledgeSourceParams, + RemoteSharePointKnowledgeSourceParams, + SearchIndexKnowledgeSourceParams, + WebKnowledgeSourceParams, + WorkIQKnowledgeSourceParams, +] +KnowledgeBaseMessageContent = Union[KnowledgeBaseMessageImageContent, KnowledgeBaseMessageTextContent] +KnowledgeRetrievalReasoningEffort = Union[ + KnowledgeRetrievalAutoReasoningEffort, + KnowledgeRetrievalLowReasoningEffort, + KnowledgeRetrievalMediumReasoningEffort, + KnowledgeRetrievalMinimalReasoningEffort, +] +KnowledgeRetrievalIntent = Union[KnowledgeRetrievalSemanticIntent] 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 410fa28d8250..64dc155e8927 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 @@ -66,6 +66,7 @@ SemanticErrorMode, SemanticErrorReason, SemanticFieldState, + SemanticQueryRewritesResultType, SemanticSearchResultsType, VectorFilterMode, VectorQueryKind, @@ -125,6 +126,7 @@ "SemanticErrorMode", "SemanticErrorReason", "SemanticFieldState", + "SemanticQueryRewritesResultType", "SemanticSearchResultsType", "VectorFilterMode", "VectorQueryKind", 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 511f83418935..84eda0b76d8e 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 @@ -128,7 +128,7 @@ class ErrorDetail(_Model): """The error additional info.""" -class ErrorResponse(_Model): +class ErrorResponse(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -198,7 +198,7 @@ class FacetResult(_Model): for each faceted field; null if the query did not contain any nested facets.""" -class HybridSearch(_Model): +class HybridSearch(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The query parameters to configure hybrid search behaviors. :ivar max_text_recall_size: Determines the maximum number of documents to be retrieved by the @@ -249,7 +249,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexAction(_Model): +class IndexAction(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents an index action that operates on a document. :ivar action_type: The operation to perform on a document in an indexing batch. Known values @@ -281,7 +281,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IndexDocumentsBatch(_Model): +class IndexDocumentsBatch(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Contains a batch of document write actions to send to the index. :ivar actions: The actions in the batch. Required. @@ -607,7 +607,7 @@ class SearchDocumentsResult(_Model): """Type of query rewrite that was used to retrieve documents. \"originalQueryOnly\"""" -class SearchRequest(_Model): +class SearchRequest(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters for filtering, sorting, faceting, paging, and other search query behaviors. :ivar include_total_count: A value that specifies whether to fetch the total count of results. @@ -1021,7 +1021,7 @@ class SearchResult(_Model): """Contains debugging information that can be used to further explore your search results.""" -class VectorThreshold(_Model): +class VectorThreshold(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The threshold used for vector queries. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -1054,7 +1054,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SearchScoreThreshold(VectorThreshold, discriminator="searchScore"): +class SearchScoreThreshold( + VectorThreshold, discriminator="searchScore" +): # pylint: disable=docstring-keyword-should-match-keyword-only """The results of the vector query will filter based on the '. :ivar value: The threshold will filter based on the '. Required. @@ -1187,7 +1189,7 @@ class TextResult(_Model): """The BM25 or Classic score for the text portion of the query.""" -class VectorQuery(_Model): +class VectorQuery(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The query parameters for vector and hybrid search queries. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -1301,7 +1303,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VectorizableImageBinaryQuery(VectorQuery, discriminator="imageBinary"): +class VectorizableImageBinaryQuery( + VectorQuery, discriminator="imageBinary" +): # pylint: disable=docstring-keyword-should-match-keyword-only """The query parameters to use for vector search when a base 64 encoded binary of an image that needs to be vectorized is provided. @@ -1381,7 +1385,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorQueryKind.IMAGE_BINARY # type: ignore -class VectorizableImageUrlQuery(VectorQuery, discriminator="imageUrl"): +class VectorizableImageUrlQuery( + VectorQuery, discriminator="imageUrl" +): # pylint: disable=docstring-keyword-should-match-keyword-only """The query parameters to use for vector search when an url that represents an image value that needs to be vectorized is provided. @@ -1458,7 +1464,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorQueryKind.IMAGE_URL # type: ignore -class VectorizableTextQuery(VectorQuery, discriminator="text"): +class VectorizableTextQuery( + VectorQuery, discriminator="text" +): # pylint: disable=docstring-keyword-should-match-keyword-only """The query parameters to use for vector search when a text value that needs to be vectorized is provided. @@ -1544,7 +1552,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.kind = VectorQueryKind.TEXT # type: ignore -class VectorizedQuery(VectorQuery, discriminator="vector"): +class VectorizedQuery( + VectorQuery, discriminator="vector" +): # pylint: disable=docstring-keyword-should-match-keyword-only """The query parameters to use for vector search when a raw vector value is provided. :ivar k_nearest_neighbors: Number of nearest neighbors to return as top hits. @@ -1633,7 +1643,9 @@ class VectorsDebugInfo(_Model): method such as RRF.""" -class VectorSimilarityThreshold(VectorThreshold, discriminator="vectorSimilarity"): +class VectorSimilarityThreshold( + VectorThreshold, discriminator="vectorSimilarity" +): # pylint: disable=docstring-keyword-should-match-keyword-only """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 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 ec5d6fa0da16..c60a96e989c9 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 @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List, Tuple, Union, cast, Optional from azure.core.exceptions import HttpResponseError diff --git a/sdk/search/azure-search-documents/azure/search/documents/types.py b/sdk/search/azure-search-documents/azure/search/documents/types.py new file mode 100644 index 000000000000..a7722aa2dda5 --- /dev/null +++ b/sdk/search/azure-search-documents/azure/search/documents/types.py @@ -0,0 +1,897 @@ +# 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 typing import Literal, TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +from .models._enums import VectorQueryKind, VectorThresholdKind + +if TYPE_CHECKING: + from .models import ( + AutocompleteMode, + HybridCountAndFacetMode, + IndexActionType, + QueryAnswerType, + QueryCaptionType, + QueryDebugMode, + QueryLanguage, + QueryRewritesType, + QuerySpellerType, + QueryType, + ScoringStatistics, + SearchMode, + SemanticErrorMode, + VectorFilterMode, + ) + + +class HybridSearch(TypedDict, total=False): + """The query parameters to configure hybrid search behaviors. + + :ivar maxTextRecallSize: 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 maxTextRecallSize: int + :ivar countAndFacetMode: 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 countAndFacetMode: Union[str, "HybridCountAndFacetMode"] + """ + + maxTextRecallSize: int + """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.""" + countAndFacetMode: Union[str, "HybridCountAndFacetMode"] + """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\".""" + + +IndexAction = TypedDict( + "IndexAction", + { + "@search.action": Union[str, "IndexActionType"], + }, + total=False, +) +IndexAction.__doc__ = """Represents an index action that operates on a document. + +:ivar ``@search.action``: The operation to perform on a document in an indexing batch. Known + values are: "upload", "merge", "mergeOrUpload", and "delete". +:vartype ``@search.action``: Union[str, "IndexActionType"] +""" + + +class IndexDocumentsBatch(TypedDict, total=False): + """Contains a batch of document write actions to send to the index. + + :ivar value: The actions in the batch. Required. + :vartype value: list["IndexAction"] + """ + + value: Required[list["IndexAction"]] + """The actions in the batch. Required.""" + + +class SearchScoreThreshold(TypedDict, total=False): + """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: Literal[VectorThresholdKind.SEARCH_SCORE] + """ + + value: Required[float] + """The threshold will filter based on the '. Required.""" + kind: Required[Literal[VectorThresholdKind.SEARCH_SCORE]] + """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.""" + + +class VectorizableImageBinaryQuery(TypedDict, total=False): + """The query parameters to use for vector search when a base 64 encoded binary of an image that + needs to be vectorized is provided. + + :ivar k: Number of nearest neighbors to return as top hits. + :vartype k: int + :ivar fields: Vector Fields of type Collection(Edm.Single) to be included in the vector + searched. + :vartype fields: str + :ivar exhaustive: When true, triggers an exhaustive k-nearest neighbor search across all + vectors within the vector index. Useful for scenarios where exact matches are critical, such as + determining ground truth values. + :vartype exhaustive: bool + :ivar oversampling: Oversampling factor. Minimum value is 1. It overrides the + 'defaultOversampling' parameter configured in the index definition. It can be set only when + 'rerankWithOriginalVectors' is true. This parameter is only permitted when a compression method + is used on the underlying vector field. + :vartype oversampling: float + :ivar weight: Relative weight of the vector query when compared to other vector query and/or + the text query within the same search request. This value is used when combining the results of + multiple 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. + :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: "VectorThreshold" + :ivar filterOverride: 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 filterOverride: str + :ivar perDocumentVectorLimit: 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 perDocumentVectorLimit: int + :ivar base64Image: The base 64 encoded binary of an image to be vectorized to perform a vector + search query. + :vartype base64Image: str + :ivar kind: The kind of vector query being performed. Required. Vector query where a base 64 + encoded binary of an image that needs to be vectorized is provided. + :vartype kind: Literal[VectorQueryKind.IMAGE_BINARY] + """ + + k: int + """Number of nearest neighbors to return as top hits.""" + fields: str + """Vector Fields of type Collection(Edm.Single) to be included in the vector searched.""" + exhaustive: bool + """When true, triggers an exhaustive k-nearest neighbor search across all vectors within the + vector index. Useful for scenarios where exact matches are critical, such as determining ground + truth values.""" + oversampling: float + """Oversampling factor. Minimum value is 1. It overrides the 'defaultOversampling' parameter + configured in the index definition. It can be set only when 'rerankWithOriginalVectors' is + true. This parameter is only permitted when a compression method is used on the underlying + vector field.""" + weight: float + """Relative weight of the vector query when compared to other vector query and/or the text query + within the same search request. This value is used when combining the results of multiple + 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: "VectorThreshold" + """The threshold used for vector queries. Note this can only be set if all 'fields' use the same + similarity metric.""" + filterOverride: str + """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.""" + perDocumentVectorLimit: int + """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.""" + base64Image: str + """The base 64 encoded binary of an image to be vectorized to perform a vector search query.""" + kind: Required[Literal[VectorQueryKind.IMAGE_BINARY]] + """The kind of vector query being performed. Required. Vector query where a base 64 encoded binary + of an image that needs to be vectorized is provided.""" + + +class VectorizableImageUrlQuery(TypedDict, total=False): + """The query parameters to use for vector search when an url that represents an image value that + needs to be vectorized is provided. + + :ivar k: Number of nearest neighbors to return as top hits. + :vartype k: int + :ivar fields: Vector Fields of type Collection(Edm.Single) to be included in the vector + searched. + :vartype fields: str + :ivar exhaustive: When true, triggers an exhaustive k-nearest neighbor search across all + vectors within the vector index. Useful for scenarios where exact matches are critical, such as + determining ground truth values. + :vartype exhaustive: bool + :ivar oversampling: Oversampling factor. Minimum value is 1. It overrides the + 'defaultOversampling' parameter configured in the index definition. It can be set only when + 'rerankWithOriginalVectors' is true. This parameter is only permitted when a compression method + is used on the underlying vector field. + :vartype oversampling: float + :ivar weight: Relative weight of the vector query when compared to other vector query and/or + the text query within the same search request. This value is used when combining the results of + multiple 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. + :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: "VectorThreshold" + :ivar filterOverride: 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 filterOverride: str + :ivar perDocumentVectorLimit: 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 perDocumentVectorLimit: 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 + represents an image value that needs to be vectorized is provided. + :vartype kind: Literal[VectorQueryKind.IMAGE_URL] + """ + + k: int + """Number of nearest neighbors to return as top hits.""" + fields: str + """Vector Fields of type Collection(Edm.Single) to be included in the vector searched.""" + exhaustive: bool + """When true, triggers an exhaustive k-nearest neighbor search across all vectors within the + vector index. Useful for scenarios where exact matches are critical, such as determining ground + truth values.""" + oversampling: float + """Oversampling factor. Minimum value is 1. It overrides the 'defaultOversampling' parameter + configured in the index definition. It can be set only when 'rerankWithOriginalVectors' is + true. This parameter is only permitted when a compression method is used on the underlying + vector field.""" + weight: float + """Relative weight of the vector query when compared to other vector query and/or the text query + within the same search request. This value is used when combining the results of multiple + 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: "VectorThreshold" + """The threshold used for vector queries. Note this can only be set if all 'fields' use the same + similarity metric.""" + filterOverride: str + """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.""" + perDocumentVectorLimit: int + """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.""" + url: str + """The URL of an image to be vectorized to perform a vector search query.""" + kind: Required[Literal[VectorQueryKind.IMAGE_URL]] + """The kind of vector query being performed. Required. Vector query where an url that represents + an image value that needs to be vectorized is provided.""" + + +class VectorizableTextQuery(TypedDict, total=False): + """The query parameters to use for vector search when a text value that needs to be vectorized is + provided. + + :ivar k: Number of nearest neighbors to return as top hits. + :vartype k: int + :ivar fields: Vector Fields of type Collection(Edm.Single) to be included in the vector + searched. + :vartype fields: str + :ivar exhaustive: When true, triggers an exhaustive k-nearest neighbor search across all + vectors within the vector index. Useful for scenarios where exact matches are critical, such as + determining ground truth values. + :vartype exhaustive: bool + :ivar oversampling: Oversampling factor. Minimum value is 1. It overrides the + 'defaultOversampling' parameter configured in the index definition. It can be set only when + 'rerankWithOriginalVectors' is true. This parameter is only permitted when a compression method + is used on the underlying vector field. + :vartype oversampling: float + :ivar weight: Relative weight of the vector query when compared to other vector query and/or + the text query within the same search request. This value is used when combining the results of + multiple 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. + :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: "VectorThreshold" + :ivar filterOverride: 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 filterOverride: str + :ivar perDocumentVectorLimit: 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 perDocumentVectorLimit: int + :ivar text: The text to be vectorized to perform a vector search query. Required. + :vartype text: str + :ivar queryRewrites: Can be configured to let a generative model rewrite the query before + sending it to be vectorized. Known values are: "none" and "generative". + :vartype queryRewrites: Union[str, "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: Literal[VectorQueryKind.TEXT] + """ + + k: int + """Number of nearest neighbors to return as top hits.""" + fields: str + """Vector Fields of type Collection(Edm.Single) to be included in the vector searched.""" + exhaustive: bool + """When true, triggers an exhaustive k-nearest neighbor search across all vectors within the + vector index. Useful for scenarios where exact matches are critical, such as determining ground + truth values.""" + oversampling: float + """Oversampling factor. Minimum value is 1. It overrides the 'defaultOversampling' parameter + configured in the index definition. It can be set only when 'rerankWithOriginalVectors' is + true. This parameter is only permitted when a compression method is used on the underlying + vector field.""" + weight: float + """Relative weight of the vector query when compared to other vector query and/or the text query + within the same search request. This value is used when combining the results of multiple + 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: "VectorThreshold" + """The threshold used for vector queries. Note this can only be set if all 'fields' use the same + similarity metric.""" + filterOverride: str + """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.""" + perDocumentVectorLimit: int + """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.""" + text: Required[str] + """The text to be vectorized to perform a vector search query. Required.""" + queryRewrites: Union[str, "QueryRewritesType"] + """Can be configured to let a generative model rewrite the query before sending it to be + vectorized. Known values are: \"none\" and \"generative\".""" + kind: Required[Literal[VectorQueryKind.TEXT]] + """The kind of vector query being performed. Required. Vector query where a text value that needs + to be vectorized is provided.""" + + +class VectorizedQuery(TypedDict, total=False): + """The query parameters to use for vector search when a raw vector value is provided. + + :ivar k: Number of nearest neighbors to return as top hits. + :vartype k: int + :ivar fields: Vector Fields of type Collection(Edm.Single) to be included in the vector + searched. + :vartype fields: str + :ivar exhaustive: When true, triggers an exhaustive k-nearest neighbor search across all + vectors within the vector index. Useful for scenarios where exact matches are critical, such as + determining ground truth values. + :vartype exhaustive: bool + :ivar oversampling: Oversampling factor. Minimum value is 1. It overrides the + 'defaultOversampling' parameter configured in the index definition. It can be set only when + 'rerankWithOriginalVectors' is true. This parameter is only permitted when a compression method + is used on the underlying vector field. + :vartype oversampling: float + :ivar weight: Relative weight of the vector query when compared to other vector query and/or + the text query within the same search request. This value is used when combining the results of + multiple 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. + :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: "VectorThreshold" + :ivar filterOverride: 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 filterOverride: str + :ivar perDocumentVectorLimit: 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 perDocumentVectorLimit: 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 + value is provided. + :vartype kind: Literal[VectorQueryKind.VECTOR] + """ + + k: int + """Number of nearest neighbors to return as top hits.""" + fields: str + """Vector Fields of type Collection(Edm.Single) to be included in the vector searched.""" + exhaustive: bool + """When true, triggers an exhaustive k-nearest neighbor search across all vectors within the + vector index. Useful for scenarios where exact matches are critical, such as determining ground + truth values.""" + oversampling: float + """Oversampling factor. Minimum value is 1. It overrides the 'defaultOversampling' parameter + configured in the index definition. It can be set only when 'rerankWithOriginalVectors' is + true. This parameter is only permitted when a compression method is used on the underlying + vector field.""" + weight: float + """Relative weight of the vector query when compared to other vector query and/or the text query + within the same search request. This value is used when combining the results of multiple + 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: "VectorThreshold" + """The threshold used for vector queries. Note this can only be set if all 'fields' use the same + similarity metric.""" + filterOverride: str + """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.""" + perDocumentVectorLimit: int + """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.""" + vector: Required[list[float]] + """The vector representation of a search query. Required.""" + kind: Required[Literal[VectorQueryKind.VECTOR]] + """The kind of vector query being performed. Required. Vector query where a raw vector value is + provided.""" + + +class VectorSimilarityThreshold(TypedDict, total=False): + """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: Literal[VectorThresholdKind.VECTOR_SIMILARITY] + """ + + value: Required[float] + """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: Required[Literal[VectorThresholdKind.VECTOR_SIMILARITY]] + """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.""" + + +class SearchPostRequest(TypedDict, total=False): + """SearchPostRequest. + + :ivar 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. + :vartype count: bool + :ivar facets: The list of facet expressions to apply to the search query. Each facet expression + contains a field name, optionally followed by a comma-separated list of name:value pairs. + :vartype facets: list[str] + :ivar filter: The OData $filter expression to apply to the search query. + :vartype filter: str + :ivar highlight: The comma-separated list of field names to use for hit highlights. Only + searchable fields can be used for hit highlighting. + :vartype highlight: list[str] + :ivar highlightPostTag: A string tag that is appended to hit highlights. Must be set with + highlightPreTag. Default is </em>. + :vartype highlightPostTag: str + :ivar highlightPreTag: A string tag that is prepended to hit highlights. Must be set with + highlightPostTag. Default is <em>. + :vartype highlightPreTag: str + :ivar minimumCoverage: A number between 0 and 100 indicating the percentage of the index that + must be covered by a search query in order for the query to be reported as a success. This + parameter can be useful for ensuring search availability even for services with only one + replica. The default is 100. + :vartype minimumCoverage: float + :ivar orderby: The comma-separated list of OData $orderby expressions by which to sort the + results. Each expression can be either a field name or a call to either the geo.distance() or + the search.score() functions. Each expression can be followed by asc to indicate ascending, or + desc to indicate descending. The default is ascending order. Ties will be broken by the match + scores of documents. If no $orderby is specified, the default sort order is descending by + document match score. There can be at most 32 $orderby clauses. + :vartype orderby: list[str] + :ivar queryType: A value that specifies the syntax of the search query. The default is + 'simple'. Use 'full' if your query uses the Lucene query syntax. Known values are: "simple", + "full", and "semantic". + :vartype queryType: Union[str, "QueryType"] + :ivar scoringStatistics: A value that specifies whether we want to calculate scoring statistics + (such as document frequency) globally for more consistent scoring, or locally, for lower + latency. The default is 'local'. Use 'global' to aggregate scoring statistics globally before + scoring. Using global scoring statistics can increase latency of search queries. Known values + are: "local" and "global". + :vartype scoringStatistics: Union[str, "ScoringStatistics"] + :ivar sessionId: A value to be used to create a sticky session, which can help getting more + consistent results. As long as the same sessionId is used, a best-effort attempt will be made + to target the same replica set. Be wary that reusing the same sessionID values repeatedly can + interfere with the load balancing of the requests across replicas and adversely affect the + performance of the search service. The value used as sessionId cannot start with a '_' + character. + :vartype sessionId: str + :ivar scoringParameters: The list of parameter values to be used in scoring functions (for + example, referencePointParameter) using the format name-values. For example, if the scoring + profile defines a function with a parameter called 'mylocation' the parameter string would be + "mylocation--122.2,44.8" (without the quotes). + :vartype scoringParameters: list[str] + :ivar scoringProfile: The name of a scoring profile to evaluate match scores for matching + documents in order to sort the results. + :vartype scoringProfile: str + :ivar debug: Enables a debugging tool that can be used to further explore your reranked + results. Known values are: "disabled", "semantic", "vector", "queryRewrites", "innerHits", and + "all". + :vartype debug: Union[str, "QueryDebugMode"] + :ivar search: A full-text search query expression; Use "*" or omit this parameter to match all + documents. + :vartype search: str + :ivar searchFields: The comma-separated list of field names to which to scope the full-text + search. When using fielded search (fieldName:searchExpression) in a full Lucene query, the + field names of each fielded search expression take precedence over any field names listed in + this parameter. + :vartype searchFields: list[str] + :ivar searchMode: 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 searchMode: Union[str, "SearchMode"] + :ivar queryLanguage: 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 queryLanguage: Union[str, "QueryLanguage"] + :ivar 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 speller: Union[str, "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] + :ivar skip: The number of search results to skip. This value cannot be greater than 100,000. If + you need to scan documents in sequence, but cannot use skip due to this limitation, consider + using orderby on a totally-ordered key and filter with a range query instead. + :vartype skip: int + :ivar top: The number of search results to retrieve. This can be used in conjunction with $skip + to implement client-side paging of search results. If results are truncated due to server-side + paging, the response will include a continuation token that can be used to issue another Search + request for the next page of results. + :vartype top: int + :ivar semanticConfiguration: The name of a semantic configuration that will be used when + processing documents for queries of type semantic. + :vartype semanticConfiguration: str + :ivar semanticErrorHandling: Allows the user to choose whether a semantic call should fail + completely (default / current behavior), or to return partial results. Known values are: + "partial" and "fail". + :vartype semanticErrorHandling: Union[str, "SemanticErrorMode"] + :ivar semanticMaxWaitInMilliseconds: 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. + :vartype semanticMaxWaitInMilliseconds: int + :ivar semanticQuery: Allows setting a separate search query that will be solely used for + semantic reranking, semantic captions and semantic answers. Is useful for scenarios where there + is a need to use different queries between the base retrieval and ranking phase, and the L2 + semantic phase. + :vartype semanticQuery: str + :ivar answers: A value that specifies whether answers should be returned as part of the search + response. Known values are: "none" and "extractive". + :vartype answers: Union[str, "QueryAnswerType"] + :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: Union[str, "QueryCaptionType"] + :ivar queryRewrites: A value that specifies whether query rewrites should be generated to + augment the search query. Known values are: "none" and "generative". + :vartype queryRewrites: Union[str, "QueryRewritesType"] + :ivar semanticFields: The comma-separated list of field names used for semantic ranking. + :vartype semanticFields: list[str] + :ivar vectorQueries: The query parameters for vector and hybrid search queries. + :vartype vectorQueries: list["VectorQuery"] + :ivar vectorFilterMode: 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 vectorFilterMode: Union[str, "VectorFilterMode"] + :ivar hybridSearch: The query parameters to configure hybrid search behaviors. + :vartype hybridSearch: "HybridSearch" + """ + + count: bool + """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.""" + facets: list[str] + """The list of facet expressions to apply to the search query. Each facet expression contains a + field name, optionally followed by a comma-separated list of name:value pairs.""" + filter: str + """The OData $filter expression to apply to the search query.""" + highlight: list[str] + """The comma-separated list of field names to use for hit highlights. Only searchable fields can + be used for hit highlighting.""" + highlightPostTag: str + """A string tag that is appended to hit highlights. Must be set with highlightPreTag. Default is + </em>.""" + highlightPreTag: str + """A string tag that is prepended to hit highlights. Must be set with highlightPostTag. Default is + <em>.""" + minimumCoverage: float + """A number between 0 and 100 indicating the percentage of the index that must be covered by a + search query in order for the query to be reported as a success. This parameter can be useful + for ensuring search availability even for services with only one replica. The default is 100.""" + orderby: list[str] + """The comma-separated list of OData $orderby expressions by which to sort the results. Each + expression can be either a field name or a call to either the geo.distance() or the + search.score() functions. Each expression can be followed by asc to indicate ascending, or desc + to indicate descending. The default is ascending order. Ties will be broken by the match scores + of documents. If no $orderby is specified, the default sort order is descending by document + match score. There can be at most 32 $orderby clauses.""" + queryType: Union[str, "QueryType"] + """A value that specifies the syntax of the search query. The default is 'simple'. Use 'full' if + your query uses the Lucene query syntax. Known values are: \"simple\", \"full\", and + \"semantic\".""" + scoringStatistics: Union[str, "ScoringStatistics"] + """A value that specifies whether we want to calculate scoring statistics (such as document + frequency) globally for more consistent scoring, or locally, for lower latency. The default is + 'local'. Use 'global' to aggregate scoring statistics globally before scoring. Using global + scoring statistics can increase latency of search queries. Known values are: \"local\" and + \"global\".""" + sessionId: str + """A value to be used to create a sticky session, which can help getting more consistent results. + As long as the same sessionId is used, a best-effort attempt will be made to target the same + replica set. Be wary that reusing the same sessionID values repeatedly can interfere with the + load balancing of the requests across replicas and adversely affect the performance of the + search service. The value used as sessionId cannot start with a '_' character.""" + scoringParameters: list[str] + """The list of parameter values to be used in scoring functions (for example, + referencePointParameter) using the format name-values. For example, if the scoring profile + defines a function with a parameter called 'mylocation' the parameter string would be + \"mylocation--122.2,44.8\" (without the quotes).""" + scoringProfile: str + """The name of a scoring profile to evaluate match scores for matching documents in order to sort + the results.""" + debug: Union[str, "QueryDebugMode"] + """Enables a debugging tool that can be used to further explore your reranked results. Known + values are: \"disabled\", \"semantic\", \"vector\", \"queryRewrites\", \"innerHits\", and + \"all\".""" + search: str + """A full-text search query expression; Use \"*\" or omit this parameter to match all documents.""" + searchFields: list[str] + """The comma-separated list of field names to which to scope the full-text search. When using + fielded search (fieldName:searchExpression) in a full Lucene query, the field names of each + fielded search expression take precedence over any field names listed in this parameter.""" + searchMode: Union[str, "SearchMode"] + """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\".""" + queryLanguage: Union[str, "QueryLanguage"] + """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\".""" + speller: Union[str, "QuerySpellerType"] + """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: list[str] + """The comma-separated list of fields to retrieve. If unspecified, all fields marked as + retrievable in the schema are included.""" + skip: int + """The number of search results to skip. This value cannot be greater than 100,000. If you need to + scan documents in sequence, but cannot use skip due to this limitation, consider using orderby + on a totally-ordered key and filter with a range query instead.""" + top: int + """The number of search results to retrieve. This can be used in conjunction with $skip to + implement client-side paging of search results. If results are truncated due to server-side + paging, the response will include a continuation token that can be used to issue another Search + request for the next page of results.""" + semanticConfiguration: str + """The name of a semantic configuration that will be used when processing documents for queries of + type semantic.""" + semanticErrorHandling: Union[str, "SemanticErrorMode"] + """Allows the user to choose whether a semantic call should fail completely (default / current + behavior), or to return partial results. Known values are: \"partial\" and \"fail\".""" + semanticMaxWaitInMilliseconds: int + """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.""" + semanticQuery: str + """Allows setting a separate search query that will be solely used for semantic reranking, + semantic captions and semantic answers. Is useful for scenarios where there is a need to use + different queries between the base retrieval and ranking phase, and the L2 semantic phase.""" + answers: Union[str, "QueryAnswerType"] + """A value that specifies whether answers should be returned as part of the search response. Known + values are: \"none\" and \"extractive\".""" + captions: Union[str, "QueryCaptionType"] + """A value that specifies whether captions should be returned as part of the search response. + Known values are: \"none\" and \"extractive\".""" + queryRewrites: Union[str, "QueryRewritesType"] + """A value that specifies whether query rewrites should be generated to augment the search query. + Known values are: \"none\" and \"generative\".""" + semanticFields: list[str] + """The comma-separated list of field names used for semantic ranking.""" + vectorQueries: list["VectorQuery"] + """The query parameters for vector and hybrid search queries.""" + vectorFilterMode: Union[str, "VectorFilterMode"] + """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\".""" + hybridSearch: "HybridSearch" + """The query parameters to configure hybrid search behaviors.""" + + +class SuggestPostRequest(TypedDict, total=False): + """SuggestPostRequest. + + :ivar filter: An OData expression that filters the documents considered for suggestions. + :vartype filter: str + :ivar fuzzy: A value indicating whether to use fuzzy matching for the suggestion query. Default + is false. When set to true, the query will find suggestions even if there's a substituted or + missing character in the search text. While this provides a better experience in some + scenarios, it comes at a performance cost as fuzzy suggestion searches are slower and consume + more resources. + :vartype fuzzy: bool + :ivar highlightPostTag: A string tag that is appended to hit highlights. Must be set with + highlightPreTag. If omitted, hit highlighting of suggestions is disabled. + :vartype highlightPostTag: str + :ivar highlightPreTag: A string tag that is prepended to hit highlights. Must be set with + highlightPostTag. If omitted, hit highlighting of suggestions is disabled. + :vartype highlightPreTag: str + :ivar minimumCoverage: A number between 0 and 100 indicating the percentage of the index that + must be covered by a suggestion query in order for the query to be reported as a success. This + parameter can be useful for ensuring search availability even for services with only one + replica. The default is 80. + :vartype minimumCoverage: float + :ivar orderby: The comma-separated list of OData $orderby expressions by which to sort the + results. Each expression can be either a field name or a call to either the geo.distance() or + the search.score() functions. Each expression can be followed by asc to indicate ascending, or + desc to indicate descending. The default is ascending order. Ties will be broken by the match + scores of documents. If no $orderby is specified, the default sort order is descending by + document match score. There can be at most 32 $orderby clauses. + :vartype orderby: list[str] + :ivar search: The search text to use to suggest documents. Must be at least 1 character, and no + more than 100 characters. Required. + :vartype search: str + :ivar searchFields: The comma-separated list of field names to search for the specified search + text. Target fields must be included in the specified suggester. + :vartype searchFields: list[str] + :ivar select: The comma-separated list of fields to retrieve. If unspecified, only the key + field will be included in the results. + :vartype select: list[str] + :ivar suggesterName: The name of the suggester as specified in the suggesters collection that's + part of the index definition. Required. + :vartype suggesterName: str + :ivar top: The number of suggestions to retrieve. This must be a value between 1 and 100. The + default is 5. + :vartype top: int + """ + + filter: str + """An OData expression that filters the documents considered for suggestions.""" + fuzzy: bool + """A value indicating whether to use fuzzy matching for the suggestion query. Default is false. + When set to true, the query will find suggestions even if there's a substituted or missing + character in the search text. While this provides a better experience in some scenarios, it + comes at a performance cost as fuzzy suggestion searches are slower and consume more resources.""" + highlightPostTag: str + """A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, + hit highlighting of suggestions is disabled.""" + highlightPreTag: str + """A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If + omitted, hit highlighting of suggestions is disabled.""" + minimumCoverage: float + """A number between 0 and 100 indicating the percentage of the index that must be covered by a + suggestion query in order for the query to be reported as a success. This parameter can be + useful for ensuring search availability even for services with only one replica. The default is + 80.""" + orderby: list[str] + """The comma-separated list of OData $orderby expressions by which to sort the results. Each + expression can be either a field name or a call to either the geo.distance() or the + search.score() functions. Each expression can be followed by asc to indicate ascending, or desc + to indicate descending. The default is ascending order. Ties will be broken by the match scores + of documents. If no $orderby is specified, the default sort order is descending by document + match score. There can be at most 32 $orderby clauses.""" + search: Required[str] + """The search text to use to suggest documents. Must be at least 1 character, and no more than 100 + characters. Required.""" + searchFields: list[str] + """The comma-separated list of field names to search for the specified search text. Target fields + must be included in the specified suggester.""" + select: list[str] + """The comma-separated list of fields to retrieve. If unspecified, only the key field will be + included in the results.""" + suggesterName: Required[str] + """The name of the suggester as specified in the suggesters collection that's part of the index + definition. Required.""" + top: int + """The number of suggestions to retrieve. This must be a value between 1 and 100. The default is + 5.""" + + +class AutocompletePostRequest(TypedDict, total=False): + """AutocompletePostRequest. + + :ivar search: The search text on which to base autocomplete results. Required. + :vartype search: str + :ivar autocompleteMode: Specifies the mode for Autocomplete. The default is 'oneTerm'. Use + 'twoTerms' to get shingles and 'oneTermWithContext' to use the current context while producing + auto-completed terms. Known values are: "oneTerm", "twoTerms", and "oneTermWithContext". + :vartype autocompleteMode: Union[str, "AutocompleteMode"] + :ivar filter: An OData expression that filters the documents used to produce completed terms + for the Autocomplete result. + :vartype filter: str + :ivar fuzzy: A value indicating whether to use fuzzy matching for the autocomplete query. + Default is false. When set to true, the query will autocomplete terms even if there's a + substituted or missing character in the search text. While this provides a better experience in + some scenarios, it comes at a performance cost as fuzzy autocomplete queries are slower and + consume more resources. + :vartype fuzzy: bool + :ivar highlightPostTag: A string tag that is appended to hit highlights. Must be set with + highlightPreTag. If omitted, hit highlighting is disabled. + :vartype highlightPostTag: str + :ivar highlightPreTag: A string tag that is prepended to hit highlights. Must be set with + highlightPostTag. If omitted, hit highlighting is disabled. + :vartype highlightPreTag: str + :ivar minimumCoverage: A number between 0 and 100 indicating the percentage of the index that + must be covered by an autocomplete query in order for the query to be reported as a success. + This parameter can be useful for ensuring search availability even for services with only one + replica. The default is 80. + :vartype minimumCoverage: float + :ivar searchFields: The comma-separated list of field names to consider when querying for + auto-completed terms. Target fields must be included in the specified suggester. + :vartype searchFields: list[str] + :ivar suggesterName: The name of the suggester as specified in the suggesters collection that's + part of the index definition. Required. + :vartype suggesterName: str + :ivar top: The number of auto-completed terms to retrieve. This must be a value between 1 and + 100. The default is 5. + :vartype top: int + """ + + search: Required[str] + """The search text on which to base autocomplete results. Required.""" + autocompleteMode: Union[str, "AutocompleteMode"] + """Specifies the mode for Autocomplete. The default is 'oneTerm'. Use 'twoTerms' to get shingles + and 'oneTermWithContext' to use the current context while producing auto-completed terms. Known + values are: \"oneTerm\", \"twoTerms\", and \"oneTermWithContext\".""" + filter: str + """An OData expression that filters the documents used to produce completed terms for the + Autocomplete result.""" + fuzzy: bool + """A value indicating whether to use fuzzy matching for the autocomplete query. Default is false. + When set to true, the query will autocomplete terms even if there's a substituted or missing + character in the search text. While this provides a better experience in some scenarios, it + comes at a performance cost as fuzzy autocomplete queries are slower and consume more + resources.""" + highlightPostTag: str + """A string tag that is appended to hit highlights. Must be set with highlightPreTag. If omitted, + hit highlighting is disabled.""" + highlightPreTag: str + """A string tag that is prepended to hit highlights. Must be set with highlightPostTag. If + omitted, hit highlighting is disabled.""" + minimumCoverage: float + """A number between 0 and 100 indicating the percentage of the index that must be covered by an + autocomplete query in order for the query to be reported as a success. This parameter can be + useful for ensuring search availability even for services with only one replica. The default is + 80.""" + searchFields: list[str] + """The comma-separated list of field names to consider when querying for auto-completed terms. + Target fields must be included in the specified suggester.""" + suggesterName: Required[str] + """The name of the suggester as specified in the suggesters collection that's part of the index + definition. Required.""" + top: int + """The number of auto-completed terms to retrieve. This must be a value between 1 and 100. The + default is 5.""" + + +VectorThreshold = Union[SearchScoreThreshold, VectorSimilarityThreshold] +VectorQuery = Union[VectorizableImageBinaryQuery, VectorizableImageUrlQuery, VectorizableTextQuery, VectorizedQuery] diff --git a/sdk/search/azure-search-documents/doc/azure.search.documents.aio.rst b/sdk/search/azure-search-documents/doc/azure.search.documents.aio.rst new file mode 100644 index 000000000000..a4707262ef64 --- /dev/null +++ b/sdk/search/azure-search-documents/doc/azure.search.documents.aio.rst @@ -0,0 +1,7 @@ +azure.search.documents.aio package +================================== + +.. automodule:: azure.search.documents.aio + :members: + :show-inheritance: + :undoc-members: \ No newline at end of file diff --git a/sdk/search/azure-search-documents/doc/azure.search.documents.indexes.aio.rst b/sdk/search/azure-search-documents/doc/azure.search.documents.indexes.aio.rst new file mode 100644 index 000000000000..2324697ab8b0 --- /dev/null +++ b/sdk/search/azure-search-documents/doc/azure.search.documents.indexes.aio.rst @@ -0,0 +1,7 @@ +azure.search.documents.indexes.aio package +========================================== + +.. automodule:: azure.search.documents.indexes.aio + :members: + :show-inheritance: + :undoc-members: \ No newline at end of file diff --git a/sdk/search/azure-search-documents/doc/azure.search.documents.indexes.models.rst b/sdk/search/azure-search-documents/doc/azure.search.documents.indexes.models.rst new file mode 100644 index 000000000000..647284b0da43 --- /dev/null +++ b/sdk/search/azure-search-documents/doc/azure.search.documents.indexes.models.rst @@ -0,0 +1,7 @@ +azure.search.documents.indexes.models package +============================================= + +.. automodule:: azure.search.documents.indexes.models + :members: + :show-inheritance: + :undoc-members: \ No newline at end of file diff --git a/sdk/search/azure-search-documents/doc/azure.search.documents.indexes.rst b/sdk/search/azure-search-documents/doc/azure.search.documents.indexes.rst new file mode 100644 index 000000000000..179b2a5c2182 --- /dev/null +++ b/sdk/search/azure-search-documents/doc/azure.search.documents.indexes.rst @@ -0,0 +1,30 @@ +azure.search.documents.indexes package +====================================== + +.. automodule:: azure.search.documents.indexes + :members: + :show-inheritance: + :undoc-members: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + azure.search.documents.indexes.aio + azure.search.documents.indexes.models + +Submodules +---------- + +azure.search.documents.indexes.types module +------------------------------------------- + +.. TEMPORARY: Remove exclude-members after upgrading the Python emitter to a + version that escapes at-prefixed wire names in docstrings. +.. automodule:: azure.search.documents.indexes.types + :members: + :exclude-members: @odata.etag,@odata.type + :show-inheritance: + :undoc-members: \ No newline at end of file diff --git a/sdk/search/azure-search-documents/doc/azure.search.documents.knowledgebases.aio.rst b/sdk/search/azure-search-documents/doc/azure.search.documents.knowledgebases.aio.rst new file mode 100644 index 000000000000..ce66912f8513 --- /dev/null +++ b/sdk/search/azure-search-documents/doc/azure.search.documents.knowledgebases.aio.rst @@ -0,0 +1,7 @@ +azure.search.documents.knowledgebases.aio package +================================================= + +.. automodule:: azure.search.documents.knowledgebases.aio + :members: + :show-inheritance: + :undoc-members: \ No newline at end of file diff --git a/sdk/search/azure-search-documents/doc/azure.search.documents.knowledgebases.models.rst b/sdk/search/azure-search-documents/doc/azure.search.documents.knowledgebases.models.rst new file mode 100644 index 000000000000..ec2dfb20f695 --- /dev/null +++ b/sdk/search/azure-search-documents/doc/azure.search.documents.knowledgebases.models.rst @@ -0,0 +1,7 @@ +azure.search.documents.knowledgebases.models package +==================================================== + +.. automodule:: azure.search.documents.knowledgebases.models + :members: + :show-inheritance: + :undoc-members: \ No newline at end of file diff --git a/sdk/search/azure-search-documents/doc/azure.search.documents.knowledgebases.rst b/sdk/search/azure-search-documents/doc/azure.search.documents.knowledgebases.rst new file mode 100644 index 000000000000..b90a8dab3cf1 --- /dev/null +++ b/sdk/search/azure-search-documents/doc/azure.search.documents.knowledgebases.rst @@ -0,0 +1,27 @@ +azure.search.documents.knowledgebases package +============================================= + +.. automodule:: azure.search.documents.knowledgebases + :members: + :show-inheritance: + :undoc-members: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + azure.search.documents.knowledgebases.aio + azure.search.documents.knowledgebases.models + +Submodules +---------- + +azure.search.documents.knowledgebases.types module +-------------------------------------------------- + +.. automodule:: azure.search.documents.knowledgebases.types + :members: + :show-inheritance: + :undoc-members: \ No newline at end of file diff --git a/sdk/search/azure-search-documents/doc/azure.search.documents.models.rst b/sdk/search/azure-search-documents/doc/azure.search.documents.models.rst new file mode 100644 index 000000000000..6333fe0416d8 --- /dev/null +++ b/sdk/search/azure-search-documents/doc/azure.search.documents.models.rst @@ -0,0 +1,7 @@ +azure.search.documents.models package +===================================== + +.. automodule:: azure.search.documents.models + :members: + :show-inheritance: + :undoc-members: \ No newline at end of file diff --git a/sdk/search/azure-search-documents/doc/azure.search.documents.rst b/sdk/search/azure-search-documents/doc/azure.search.documents.rst new file mode 100644 index 000000000000..9591ab0ed4d3 --- /dev/null +++ b/sdk/search/azure-search-documents/doc/azure.search.documents.rst @@ -0,0 +1,32 @@ +azure.search.documents package +============================== + +.. automodule:: azure.search.documents + :members: + :show-inheritance: + :undoc-members: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + azure.search.documents.aio + azure.search.documents.indexes + azure.search.documents.knowledgebases + azure.search.documents.models + +Submodules +---------- + +azure.search.documents.types module +----------------------------------- + +.. TEMPORARY: Remove exclude-members after upgrading the Python emitter to a + version that escapes at-prefixed wire names in docstrings. +.. automodule:: azure.search.documents.types + :members: + :exclude-members: @odata.count,@odata.nextLink,@search.action,@search.answers,@search.captions,@search.coverage,@search.debug,@search.documentDebugInfo,@search.facets,@search.highlights,@search.nextPageParameters,@search.rerankerBoostedScore,@search.rerankerScore,@search.score,@search.semanticPartialResponseReason,@search.semanticPartialResponseType,@search.semanticQueryRewritesResultType,@search.text + :show-inheritance: + :undoc-members: \ No newline at end of file diff --git a/sdk/search/azure-search-documents/pyproject.toml b/sdk/search/azure-search-documents/pyproject.toml index 3bf87af09a10..17c12b7e0389 100644 --- a/sdk/search/azure-search-documents/pyproject.toml +++ b/sdk/search/azure-search-documents/pyproject.toml @@ -21,13 +21,13 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/sdk/search/azure-search-documents/samples/README.md b/sdk/search/azure-search-documents/samples/README.md index 1a5880fb4f59..7c7681fd6ade 100644 --- a/sdk/search/azure-search-documents/samples/README.md +++ b/sdk/search/azure-search-documents/samples/README.md @@ -65,22 +65,24 @@ pip install azure-search-documents * Custom HTTP requests (SearchIndexClient): [sample_index_client_custom_request.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_index_client_custom_request.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_index_client_custom_request_async.py)) * Knowledge base agentic retrieval: [sample_agentic_retrieval.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_agentic_retrieval.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_agentic_retrieval_async.py)) -### Preview samples (2026-05-01-preview) +### Preview samples (2026-08-01-preview) -The following samples target an `azure-search-documents` build whose default API version is `2026-05-01-preview`. Behavior of preview APIs may change before GA. +The following samples target an `azure-search-documents` build whose default API version is `2026-08-01-preview`. Behavior of preview APIs may change before GA. Knowledge base and retrieval: -* Knowledge base preview configuration (CORS, model, retrieval defaults): [sample_knowledge_base_configuration_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview_async.py)) -* Retrieve response (activity model_name, Purview labels, output modes): [sample_knowledge_retrieval_response_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview_async.py)) -* Service stats with knowledge base / source counters: [sample_knowledge_service_stats_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview_async.py)) +* Knowledge base CRUD with tags metadata and cursor pagination: [sample_knowledge_base_crud.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud_async.py)) +* Knowledge base preview configuration with reasoning precedence, retrieval defaults, CORS, tags, and query hints: [sample_knowledge_base_configuration_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview_async.py)) +* Retrieve responses with Search-owned citation URLs, results processing, and typed server-sent events: [sample_knowledge_retrieval_response_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview_async.py)) +* Service stats with knowledge base / source counters and the per-index vector-size limit: [sample_knowledge_service_stats_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview_async.py)) * Source attach-time defaults (`enable_freshness`, `enable_image_serving`): [sample_knowledge_source_freshness_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview_async.py)) Knowledge source kinds: -* File knowledge source: [sample_knowledge_source_file_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview_async.py)) +* Knowledge source CRUD with query hints, private Blob ingestion, analyzer verification, and cursor pagination: [sample_knowledge_source_crud.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud_async.py)) +* File knowledge source lifecycle with relative-path metadata, multipart update, prefix paging, deletion, and service-selected modes: [sample_knowledge_source_file_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview_async.py)) * MCP server knowledge source: [sample_knowledge_source_mcp_server_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview_async.py)) -* WorkIQ knowledge source: [sample_knowledge_source_workiq_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview_async.py)) +* Work IQ knowledge source with customer-owned Entra app authentication, optional tenant behavior, and separate authorization channels: [sample_knowledge_source_workiq_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview_async.py)) * Fabric ontology knowledge source: [sample_knowledge_source_fabric_ontology_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview_async.py)) * Fabric data agent knowledge source: [sample_knowledge_source_fabric_data_agent_preview.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview.py) ([async version](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview_async.py)) diff --git a/sdk/search/azure-search-documents/samples/sample_index_alias_crud.py b/sdk/search/azure-search-documents/samples/sample_index_alias_crud.py index 43f26b5c2dfa..59d2c8ddfe15 100644 --- a/sdk/search/azure-search-documents/samples/sample_index_alias_crud.py +++ b/sdk/search/azure-search-documents/samples/sample_index_alias_crud.py @@ -19,7 +19,6 @@ 3) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") """ - import os service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] diff --git a/sdk/search/azure-search-documents/samples/sample_index_alias_crud_async.py b/sdk/search/azure-search-documents/samples/sample_index_alias_crud_async.py index 543cca24c8e2..831b5252e5dc 100644 --- a/sdk/search/azure-search-documents/samples/sample_index_alias_crud_async.py +++ b/sdk/search/azure-search-documents/samples/sample_index_alias_crud_async.py @@ -19,7 +19,6 @@ 3) AZURE_SEARCH_INDEX_NAME - target search index name (e.g., "hotels-sample-index") """ - import asyncio import os diff --git a/sdk/search/azure-search-documents/samples/sample_index_crud.py b/sdk/search/azure-search-documents/samples/sample_index_crud.py index f918dd4771bd..a4bed32ee5ec 100644 --- a/sdk/search/azure-search-documents/samples/sample_index_crud.py +++ b/sdk/search/azure-search-documents/samples/sample_index_crud.py @@ -18,7 +18,6 @@ 2) AZURE_SEARCH_API_KEY - the admin key for your search service """ - import os from typing import List @@ -131,11 +130,16 @@ def list_index_names(): # [START list_index_names] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import ListingSearchType index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - print("Listing all index names:") - for name in index_client.list_index_names(): + print("Listing matching index names:") + for name in index_client.list_index_names( + search="hotels-sample", + page_size=10, + search_type=ListingSearchType.PREFIX, + ): print(f" - {name}") # [END list_index_names] diff --git a/sdk/search/azure-search-documents/samples/sample_index_crud_async.py b/sdk/search/azure-search-documents/samples/sample_index_crud_async.py index f01c2f21bf02..8ff4bad51b55 100644 --- a/sdk/search/azure-search-documents/samples/sample_index_crud_async.py +++ b/sdk/search/azure-search-documents/samples/sample_index_crud_async.py @@ -18,7 +18,6 @@ 2) AZURE_SEARCH_API_KEY - the admin key for your search service """ - import os import asyncio from typing import List @@ -133,6 +132,24 @@ async def update_index_async(): # [END update_index_async] +async def list_index_names_async(): + # [START list_index_names_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import ListingSearchType + + index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) + print("Listing matching index names:") + async with index_client: + async for name in index_client.list_index_names( + search="hotels-sample", + page_size=10, + search_type=ListingSearchType.PREFIX, + ): + print(f" - {name}") + # [END list_index_names_async] + + async def delete_index_async(): # [START delete_index_async] from azure.core.credentials import AzureKeyCredential @@ -149,4 +166,5 @@ async def delete_index_async(): asyncio.run(create_index_async()) asyncio.run(get_index_async()) asyncio.run(update_index_async()) + asyncio.run(list_index_names_async()) asyncio.run(delete_index_async()) diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview.py b/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview.py index aea4d8bbf1d3..d0bd6e1653c1 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview.py @@ -30,7 +30,6 @@ setup_hotel_index, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() @@ -51,15 +50,20 @@ def main(): CorsOptions, KnowledgeBase, KnowledgeBaseAzureOpenAIModel, + KnowledgeBaseRetrieveDefaults, KnowledgeSourceReference, SearchIndexKnowledgeSource, + SearchIndexKnowledgeSourceFieldValueBoost, + SearchIndexKnowledgeSourceFilterHint, SearchIndexKnowledgeSourceParameters, + SearchIndexKnowledgeSourceQueryHints, ) from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient from azure.search.documents.knowledgebases.models import ( KnowledgeBaseMessage, KnowledgeBaseMessageTextContent, KnowledgeBaseRetrievalRequest, + KnowledgeRetrievalAutoReasoningEffort, KnowledgeRetrievalLowReasoningEffort, ) @@ -67,9 +71,27 @@ def main(): knowledge_source = SearchIndexKnowledgeSource( name=knowledge_source_name, description="Hotel knowledge source with default parking filter", + results_processing="rerank", search_index_parameters=SearchIndexKnowledgeSourceParameters( search_index_name=index_name, base_filter="ParkingIncluded eq true and IsDeleted eq false", + query_hints=SearchIndexKnowledgeSourceQueryHints( + filters=[ + SearchIndexKnowledgeSourceFilterHint( + field="Category", + field_values=["Luxury", "Boutique"], + filter_instructions="Use this field when the user asks for a hotel category.", + ) + ], + boosts=[ + SearchIndexKnowledgeSourceFieldValueBoost( + field="Rating", + field_values=["4", "5"], + boost=2.0, + boost_instructions="Prefer highly rated hotels.", + ) + ], + ), ), ) index_client.create_or_update_knowledge_source(knowledge_source) @@ -79,6 +101,7 @@ def main(): knowledge_base = KnowledgeBase( name=knowledge_base_name, description="Hotel knowledge base with preview configuration", + tags={"scenario": "hotel-search", "environment": "sample"}, knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], cors_options=CorsOptions(allowed_origins=["https://app.contoso.com"], max_age_in_seconds=300), models=[ @@ -91,13 +114,22 @@ def main(): ) ) ], - retrieval_reasoning_effort=KnowledgeRetrievalLowReasoningEffort(), + retrieval_reasoning_effort=KnowledgeRetrievalAutoReasoningEffort(), output_mode="answerSynthesis", + retrieve_defaults=KnowledgeBaseRetrieveDefaults( + max_runtime_in_seconds=60, + max_output_documents=20, + max_output_size_in_tokens=5000, + ), ) created_knowledge_base = index_client.create_or_update_knowledge_base(knowledge_base) print(f"Created: knowledge base '{created_knowledge_base.name}'") retrieved_knowledge_base = index_client.get_knowledge_base(knowledge_base_name) print(f"Retrieved: knowledge base '{retrieved_knowledge_base.name}'") + assert retrieved_knowledge_base.retrieval_reasoning_effort is not None + assert retrieved_knowledge_base.retrieve_defaults is not None + assert retrieved_knowledge_base.retrieval_reasoning_effort.kind == "auto" + assert retrieved_knowledge_base.retrieve_defaults.max_output_size_in_tokens == 5000 retrieval_client = KnowledgeBaseRetrievalClient( service_endpoint, AzureKeyCredential(key), knowledge_base_name=knowledge_base_name @@ -105,6 +137,10 @@ def main(): try: request = KnowledgeBaseRetrievalRequest( include_activity=True, + retrieval_reasoning_effort=KnowledgeRetrievalLowReasoningEffort(), + max_runtime_in_seconds=30, + max_output_documents=5, + max_output_size=5000, messages=[ KnowledgeBaseMessage( role="user", @@ -112,6 +148,8 @@ def main(): ) ], ) + assert request.retrieval_reasoning_effort is not None + assert request.retrieval_reasoning_effort.kind == "low" retrieval_result = retrieval_client.retrieve(request) finally: retrieval_client.close() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview_async.py index 023dde0ffb88..ea45fb98e6bf 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_base_configuration_preview_async.py @@ -31,7 +31,6 @@ setup_hotel_index_async, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() @@ -50,15 +49,20 @@ async def main(): CorsOptions, KnowledgeBase, KnowledgeBaseAzureOpenAIModel, + KnowledgeBaseRetrieveDefaults, KnowledgeSourceReference, SearchIndexKnowledgeSource, + SearchIndexKnowledgeSourceFieldValueBoost, + SearchIndexKnowledgeSourceFilterHint, SearchIndexKnowledgeSourceParameters, + SearchIndexKnowledgeSourceQueryHints, ) from azure.search.documents.knowledgebases.aio import KnowledgeBaseRetrievalClient from azure.search.documents.knowledgebases.models import ( KnowledgeBaseMessage, KnowledgeBaseMessageTextContent, KnowledgeBaseRetrievalRequest, + KnowledgeRetrievalAutoReasoningEffort, KnowledgeRetrievalLowReasoningEffort, ) @@ -68,9 +72,27 @@ async def main(): knowledge_source = SearchIndexKnowledgeSource( name=knowledge_source_name, description="Hotel knowledge source with default parking filter", + results_processing="rerank", search_index_parameters=SearchIndexKnowledgeSourceParameters( search_index_name=index_name, base_filter="ParkingIncluded eq true and IsDeleted eq false", + query_hints=SearchIndexKnowledgeSourceQueryHints( + filters=[ + SearchIndexKnowledgeSourceFilterHint( + field="Category", + field_values=["Luxury", "Boutique"], + filter_instructions="Use this field when the user asks for a hotel category.", + ) + ], + boosts=[ + SearchIndexKnowledgeSourceFieldValueBoost( + field="Rating", + field_values=["4", "5"], + boost=2.0, + boost_instructions="Prefer highly rated hotels.", + ) + ], + ), ), ) await index_client.create_or_update_knowledge_source(knowledge_source) @@ -80,6 +102,7 @@ async def main(): knowledge_base = KnowledgeBase( name=knowledge_base_name, description="Hotel knowledge base with preview configuration", + tags={"scenario": "hotel-search", "environment": "sample"}, knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], cors_options=CorsOptions(allowed_origins=["https://app.contoso.com"], max_age_in_seconds=300), models=[ @@ -92,13 +115,22 @@ async def main(): ) ) ], - retrieval_reasoning_effort=KnowledgeRetrievalLowReasoningEffort(), + retrieval_reasoning_effort=KnowledgeRetrievalAutoReasoningEffort(), output_mode="answerSynthesis", + retrieve_defaults=KnowledgeBaseRetrieveDefaults( + max_runtime_in_seconds=60, + max_output_documents=20, + max_output_size_in_tokens=5000, + ), ) created_knowledge_base = await index_client.create_or_update_knowledge_base(knowledge_base) print(f"Created: knowledge base '{created_knowledge_base.name}'") retrieved_knowledge_base = await index_client.get_knowledge_base(knowledge_base_name) print(f"Retrieved: knowledge base '{retrieved_knowledge_base.name}'") + assert retrieved_knowledge_base.retrieval_reasoning_effort is not None + assert retrieved_knowledge_base.retrieve_defaults is not None + assert retrieved_knowledge_base.retrieval_reasoning_effort.kind == "auto" + assert retrieved_knowledge_base.retrieve_defaults.max_output_size_in_tokens == 5000 retrieval_client = KnowledgeBaseRetrievalClient( service_endpoint, AzureKeyCredential(key), knowledge_base_name=knowledge_base_name @@ -106,6 +138,10 @@ async def main(): try: request = KnowledgeBaseRetrievalRequest( include_activity=True, + retrieval_reasoning_effort=KnowledgeRetrievalLowReasoningEffort(), + max_runtime_in_seconds=30, + max_output_documents=5, + max_output_size=5000, messages=[ KnowledgeBaseMessage( role="user", @@ -113,6 +149,8 @@ async def main(): ) ], ) + assert request.retrieval_reasoning_effort is not None + assert request.retrieval_reasoning_effort.kind == "low" retrieval_result = await retrieval_client.retrieve(request) finally: await retrieval_client.close() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud.py b/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud.py index f4fc34b99410..6c3ca9cb9d65 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud.py @@ -25,7 +25,6 @@ 2) AZURE_SEARCH_API_KEY - the admin key for your search service """ - import os service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] @@ -48,9 +47,11 @@ def create_knowledge_base(): knowledge_base = KnowledgeBase( name=knowledge_base_name, knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], + tags={"environment": "sample", "owner": "search-team"}, ) result = index_client.create_or_update_knowledge_base(knowledge_base=knowledge_base) + assert result.tags == {"environment": "sample", "owner": "search-team"} print(f"Created: knowledge base '{result.name}'") # [END create_knowledge_base] @@ -63,6 +64,7 @@ def get_knowledge_base(): index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) result = index_client.get_knowledge_base(knowledge_base_name) + assert result.tags == {"environment": "sample", "owner": "search-team"} print(f"Retrieved: knowledge base '{result.name}'") # [END get_knowledge_base] @@ -71,20 +73,12 @@ def update_knowledge_base(): # [START update_knowledge_base] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient - from azure.search.documents.indexes.models import ( - KnowledgeBase, - KnowledgeSourceReference, - ) - index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - knowledge_base = KnowledgeBase( - name=knowledge_base_name, - description="Updated knowledge base", - knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], - ) - + knowledge_base = index_client.get_knowledge_base(knowledge_base_name) + knowledge_base.tags = {"environment": "sample", "owner": "retrieval-team"} result = index_client.create_or_update_knowledge_base(knowledge_base=knowledge_base) + assert result.tags == {"environment": "sample", "owner": "retrieval-team"} + print("Tags are metadata labels; this sample does not use them for billing attribution.") print(f"Updated: knowledge base '{result.name}'") # [END update_knowledge_base] @@ -93,11 +87,29 @@ def list_knowledge_bases(): # [START list_knowledge_bases] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - for kb in index_client.list_knowledge_bases(): - print(f"Listed: knowledge base '{kb.name}'") + companion_name = f"{knowledge_base_name}-page" + companion = KnowledgeBase( + name=companion_name, + knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], + ) + index_client.create_or_update_knowledge_base(companion) + try: + knowledge_bases = list( + index_client.list_knowledge_bases( + search=knowledge_base_name, + page_size=1, + search_type="prefix", + ) + ) + knowledge_base_names = [knowledge_base.name for knowledge_base in knowledge_bases] + assert set(knowledge_base_names) == {knowledge_base_name, companion_name} + assert len(knowledge_base_names) == len(set(knowledge_base_names)) + print(f"Paged through {len(knowledge_bases)} knowledge bases without duplicates") + finally: + index_client.delete_knowledge_base(companion_name) # [END list_knowledge_bases] diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud_async.py index 8dfe8e09f5fc..caf8330e79af 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_base_crud_async.py @@ -25,7 +25,6 @@ 2) AZURE_SEARCH_API_KEY - the admin key for your search service """ - import asyncio import os @@ -49,10 +48,12 @@ async def create_knowledge_base_async(): knowledge_base = KnowledgeBase( name=knowledge_base_name, knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], + tags={"environment": "sample", "owner": "search-team"}, ) async with index_client: result = await index_client.create_or_update_knowledge_base(knowledge_base=knowledge_base) + assert result.tags == {"environment": "sample", "owner": "search-team"} print(f"Created: knowledge base '{result.name}'") # [END create_knowledge_base_async] @@ -66,6 +67,7 @@ async def get_knowledge_base_async(): async with index_client: result = await index_client.get_knowledge_base(knowledge_base_name) + assert result.tags == {"environment": "sample", "owner": "search-team"} print(f"Retrieved: knowledge base '{result.name}'") # [END get_knowledge_base_async] @@ -74,21 +76,13 @@ async def update_knowledge_base_async(): # [START update_knowledge_base_async] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes.aio import SearchIndexClient - from azure.search.documents.indexes.models import ( - KnowledgeBase, - KnowledgeSourceReference, - ) - index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - knowledge_base = KnowledgeBase( - name=knowledge_base_name, - description="Updated knowledge base", - knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], - ) - async with index_client: + knowledge_base = await index_client.get_knowledge_base(knowledge_base_name) + knowledge_base.tags = {"environment": "sample", "owner": "retrieval-team"} result = await index_client.create_or_update_knowledge_base(knowledge_base=knowledge_base) + assert result.tags == {"environment": "sample", "owner": "retrieval-team"} + print("Tags are metadata labels; this sample does not use them for billing attribution.") print(f"Updated: knowledge base '{result.name}'") # [END update_knowledge_base_async] @@ -97,12 +91,31 @@ async def list_knowledge_bases_async(): # [START list_knowledge_bases_async] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - + companion_name = f"{knowledge_base_name}-page" + companion = KnowledgeBase( + name=companion_name, + knowledge_sources=[KnowledgeSourceReference(name=knowledge_source_name)], + ) async with index_client: - async for kb in index_client.list_knowledge_bases(): - print(f"Listed: knowledge base '{kb.name}'") + await index_client.create_or_update_knowledge_base(companion) + try: + knowledge_bases = [ + knowledge_base + async for knowledge_base in index_client.list_knowledge_bases( + search=knowledge_base_name, + page_size=1, + search_type="prefix", + ) + ] + knowledge_base_names = [knowledge_base.name for knowledge_base in knowledge_bases] + assert set(knowledge_base_names) == {knowledge_base_name, companion_name} + assert len(knowledge_base_names) == len(set(knowledge_base_names)) + print(f"Paged through {len(knowledge_bases)} knowledge bases without duplicates") + finally: + await index_client.delete_knowledge_base(companion_name) # [END list_knowledge_bases_async] diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview.py b/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview.py index 39d0a784dbea..de810b01eeb2 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview.py @@ -22,6 +22,7 @@ """ import os +from urllib.parse import urlparse from sample_utils import ( cleanup_resources, @@ -30,7 +31,6 @@ setup_hotel_index, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() @@ -59,7 +59,11 @@ def main(): from azure.search.documents.knowledgebases.models import ( KnowledgeBaseMessage, KnowledgeBaseMessageTextContent, + KnowledgeBaseResponseCompletedEvent, + KnowledgeBaseRetrievalStartedEvent, KnowledgeBaseRetrievalRequest, + KnowledgeBaseSearchIndexReference, + KnowledgeBaseStreamErrorEvent, KnowledgeRetrievalLowReasoningEffort, KnowledgeRetrievalSemanticIntent, SearchIndexKnowledgeSourceParams, @@ -69,6 +73,7 @@ def main(): knowledge_source = SearchIndexKnowledgeSource( name=knowledge_source_name, description="Hotel knowledge source for retrieval response preview", + results_processing="rerank", search_index_parameters=SearchIndexKnowledgeSourceParameters( search_index_name=index_name, source_data_fields=[ @@ -118,6 +123,27 @@ def main(): semantic_result = retrieval_client.retrieve(semantic_request) print_retrieval_summary(semantic_result) + stream_event_types = [] + stream_request_id = None + with retrieval_client.retrieve_stream(semantic_request) as stream: + for event in stream: + stream_event_types.append(event.event_type) + if event.event_type == "retrieval.started" and isinstance( + event.data, KnowledgeBaseRetrievalStartedEvent + ): + stream_request_id = event.data.request_id + elif event.event_type == "response.completed" and isinstance( + event.data, KnowledgeBaseResponseCompletedEvent + ): + assert event.data.status_code in {200, 206} + print_retrieval_summary(event.data.response) + elif event.event_type == "error" and isinstance(event.data, KnowledgeBaseStreamErrorEvent): + error_message = event.data.error.message if event.data.error else "Retrieval failed" + raise RuntimeError(f"Streaming retrieval error: {error_message}") + assert stream_event_types[0] == "retrieval.started" + assert stream_event_types[-1] == "response.completed" + assert stream_request_id + message_request = KnowledgeBaseRetrievalRequest( include_activity=True, messages=[ @@ -131,12 +157,40 @@ def main(): knowledge_source_name=knowledge_source_name, include_references=True, include_reference_source_data=True, + results_processing="rerank", max_output_documents=50, ) ], ) message_result = retrieval_client.retrieve(message_request) print_retrieval_summary(message_result) + search_references = [ + reference + for reference in message_result.references or [] + if isinstance(reference, KnowledgeBaseSearchIndexReference) + ] + assert search_references + search_host = urlparse(service_endpoint).netloc + for reference in search_references: + assert reference.citation_url is not None + citation = urlparse(reference.citation_url) + assert citation.scheme == "https" + assert citation.netloc == search_host + + no_rerank_request = KnowledgeBaseRetrievalRequest( + include_activity=True, + intents=[KnowledgeRetrievalSemanticIntent(search="Which hotels include parking?")], + knowledge_source_params=[ + SearchIndexKnowledgeSourceParams( + knowledge_source_name=knowledge_source_name, + include_references=True, + results_processing="none", + max_output_documents=50, + ) + ], + ) + no_rerank_result = retrieval_client.retrieve(no_rerank_request) + assert all(reference.reranker_score is None for reference in no_rerank_result.references or []) finally: retrieval_client.close() # [END sample_knowledge_retrieval_response_preview] diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview_async.py index d0fd5ef6ae11..2765eb425a3b 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_retrieval_response_preview_async.py @@ -23,6 +23,7 @@ import asyncio import os +from urllib.parse import urlparse from sample_utils import ( cleanup_resources_async, @@ -31,7 +32,6 @@ setup_hotel_index_async, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() @@ -58,7 +58,11 @@ async def main(): from azure.search.documents.knowledgebases.models import ( KnowledgeBaseMessage, KnowledgeBaseMessageTextContent, + KnowledgeBaseResponseCompletedEvent, + KnowledgeBaseRetrievalStartedEvent, KnowledgeBaseRetrievalRequest, + KnowledgeBaseSearchIndexReference, + KnowledgeBaseStreamErrorEvent, KnowledgeRetrievalLowReasoningEffort, KnowledgeRetrievalSemanticIntent, SearchIndexKnowledgeSourceParams, @@ -70,6 +74,7 @@ async def main(): knowledge_source = SearchIndexKnowledgeSource( name=knowledge_source_name, description="Hotel knowledge source for retrieval response preview", + results_processing="rerank", search_index_parameters=SearchIndexKnowledgeSourceParameters( search_index_name=index_name, source_data_fields=[ @@ -119,6 +124,28 @@ async def main(): semantic_result = await retrieval_client.retrieve(semantic_request) print_retrieval_summary(semantic_result) + stream_event_types = [] + stream_request_id = None + stream = await retrieval_client.retrieve_stream(semantic_request) + async with stream: + async for event in stream: + stream_event_types.append(event.event_type) + if event.event_type == "retrieval.started" and isinstance( + event.data, KnowledgeBaseRetrievalStartedEvent + ): + stream_request_id = event.data.request_id + elif event.event_type == "response.completed" and isinstance( + event.data, KnowledgeBaseResponseCompletedEvent + ): + assert event.data.status_code in {200, 206} + print_retrieval_summary(event.data.response) + elif event.event_type == "error" and isinstance(event.data, KnowledgeBaseStreamErrorEvent): + error_message = event.data.error.message if event.data.error else "Retrieval failed" + raise RuntimeError(f"Streaming retrieval error: {error_message}") + assert stream_event_types[0] == "retrieval.started" + assert stream_event_types[-1] == "response.completed" + assert stream_request_id + message_request = KnowledgeBaseRetrievalRequest( include_activity=True, messages=[ @@ -132,12 +159,40 @@ async def main(): knowledge_source_name=knowledge_source_name, include_references=True, include_reference_source_data=True, + results_processing="rerank", max_output_documents=50, ) ], ) message_result = await retrieval_client.retrieve(message_request) print_retrieval_summary(message_result) + search_references = [ + reference + for reference in message_result.references or [] + if isinstance(reference, KnowledgeBaseSearchIndexReference) + ] + assert search_references + search_host = urlparse(service_endpoint).netloc + for reference in search_references: + assert reference.citation_url is not None + citation = urlparse(reference.citation_url) + assert citation.scheme == "https" + assert citation.netloc == search_host + + no_rerank_request = KnowledgeBaseRetrievalRequest( + include_activity=True, + intents=[KnowledgeRetrievalSemanticIntent(search="Which hotels include parking?")], + knowledge_source_params=[ + SearchIndexKnowledgeSourceParams( + knowledge_source_name=knowledge_source_name, + include_references=True, + results_processing="none", + max_output_documents=50, + ) + ], + ) + no_rerank_result = await retrieval_client.retrieve(no_rerank_request) + assert all(reference.reranker_score is None for reference in no_rerank_result.references or []) finally: await retrieval_client.close() # [END sample_knowledge_retrieval_response_preview_async] diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview.py b/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview.py index f7315e8fd2c2..6200132e0017 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview.py @@ -32,6 +32,12 @@ def main(): stats = index_client.get_service_statistics() print(f"Knowledge bases: {stats.counters.knowledge_base_counter.usage}") print(f"Knowledge sources: {stats.counters.knowledge_source_counter.usage}") + vector_limit = stats.limits.max_vector_index_size_per_index_in_bytes + if vector_limit is None: + print("Maximum vector index size per index: not reported by this service tier") + else: + print(f"Maximum vector index size per index: {vector_limit} bytes") + print("This is a per-index limit, not current usage or a per-partition quota.") # [END sample_knowledge_service_stats_preview] diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview_async.py index 4e7e27e554ce..37d5c8818762 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_service_stats_preview_async.py @@ -34,6 +34,12 @@ async def main(): stats = await index_client.get_service_statistics() print(f"Knowledge bases: {stats.counters.knowledge_base_counter.usage}") print(f"Knowledge sources: {stats.counters.knowledge_source_counter.usage}") + vector_limit = stats.limits.max_vector_index_size_per_index_in_bytes + if vector_limit is None: + print("Maximum vector index size per index: not reported by this service tier") + else: + print(f"Maximum vector index size per index: {vector_limit} bytes") + print("This is a per-index limit, not current usage or a per-partition quota.") # [END sample_knowledge_service_stats_preview_async] diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud.py index 709a7ae751a4..fec5727e2d9e 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud.py @@ -17,14 +17,25 @@ USAGE: python sample_knowledge_source_crud.py - Set the following environment variables before running the sample: + Set the following environment variables before running the standard CRUD scenarios: 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service (e.g., https://.search.windows.net) 2) AZURE_SEARCH_API_KEY - the admin key for your search service 3) AZURE_SEARCH_INDEX_NAME - target search index name. The index must have a semantic configuration (e.g., "hotels-sample-index"). -""" + The private Blob ingestion scenario runs only when all of these optional variables are set: + 4) AZURE_STORAGE_RESOURCE_ID_CONNECTION_STRING - ResourceId connection string for private Blob ingestion + 5) AZURE_STORAGE_CONTAINER - Blob container with supported and fallback language fixtures + 6) AZURE_SEARCH_USER_ASSIGNED_IDENTITY - user-assigned identity assigned to the Search service + 7) AZURE_AI_SERVICES_ENDPOINT - AI Services endpoint used for language detection + 8) AZURE_AI_SERVICES_API_KEY - AI Services API key + 9) AZURE_SEARCH_EXPECTED_ANALYZER - analyzer expected for the supported-language fixture + 10) AZURE_SEARCH_EXPECTED_FALLBACK_ANALYZER - analyzer expected for the fallback fixture + + The storage and AI Services shared private links must already be approved. Shared private-link + resources are control-plane resources and are not configured by this data-plane sample. +""" import os @@ -32,6 +43,16 @@ index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] key = os.environ["AZURE_SEARCH_API_KEY"] knowledge_source_name = "hotels-sample-knowledge-source" +private_blob_source_name = "hotels-private-blob-knowledge-source" +private_blob_environment_variables = ( + "AZURE_STORAGE_RESOURCE_ID_CONNECTION_STRING", + "AZURE_STORAGE_CONTAINER", + "AZURE_SEARCH_USER_ASSIGNED_IDENTITY", + "AZURE_AI_SERVICES_ENDPOINT", + "AZURE_AI_SERVICES_API_KEY", + "AZURE_SEARCH_EXPECTED_ANALYZER", + "AZURE_SEARCH_EXPECTED_FALLBACK_ANALYZER", +) def create_knowledge_source(): @@ -76,7 +97,9 @@ def update_knowledge_source(): from azure.search.documents.indexes.models import ( SearchIndexFieldReference, SearchIndexKnowledgeSource, + SearchIndexKnowledgeSourceFilterHint, SearchIndexKnowledgeSourceParameters, + SearchIndexKnowledgeSourceQueryHints, ) index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) @@ -90,6 +113,15 @@ def update_knowledge_source(): SearchIndexFieldReference(name="HotelId"), SearchIndexFieldReference(name="HotelName"), ], + query_hints=SearchIndexKnowledgeSourceQueryHints( + filters=[ + SearchIndexKnowledgeSourceFilterHint( + field="Category", + field_values=["Luxury", "Boutique"], + filter_instructions="Use Category when the user asks for a hotel type.", + ) + ] + ), ), ) @@ -102,14 +134,102 @@ def list_knowledge_sources(): # [START list_knowledge_sources] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient + from azure.search.documents.indexes.models import SearchIndexKnowledgeSource, SearchIndexKnowledgeSourceParameters index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - - for ks in index_client.list_knowledge_sources(): - print(f"Listed: knowledge source '{ks.name}'") + companion_name = f"{knowledge_source_name}-page" + companion = SearchIndexKnowledgeSource( + name=companion_name, + search_index_parameters=SearchIndexKnowledgeSourceParameters(search_index_name=index_name), + ) + index_client.create_or_update_knowledge_source(companion) + try: + sources = list( + index_client.list_knowledge_sources( + search=knowledge_source_name, + page_size=1, + search_type="prefix", + ) + ) + source_names = [source.name for source in sources] + assert set(source_names) == {knowledge_source_name, companion_name} + assert len(source_names) == len(set(source_names)) + print(f"Paged through {len(sources)} knowledge sources without duplicates") + finally: + index_client.delete_knowledge_source(companion_name) # [END list_knowledge_sources] +def create_private_blob_knowledge_source(): # pylint: disable=too-many-locals + missing_variables = [name for name in private_blob_environment_variables if not os.environ.get(name)] + if missing_variables: + print( + "Skipping private Blob knowledge source scenario; set these optional variables: " + + ", ".join(missing_variables) + ) + return + + # [START create_private_blob_knowledge_source] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes import SearchIndexClient, SearchIndexerClient + from azure.search.documents.indexes.models import ( + AzureBlobKnowledgeSource, + AzureBlobKnowledgeSourceParameters, + SearchIndexerDataUserAssignedIdentity, + ) + from azure.search.documents.knowledgebases.models import AIServices, KnowledgeSourceIngestionParameters + + credential = AzureKeyCredential(key) + index_client = SearchIndexClient(service_endpoint, credential) + indexer_client = SearchIndexerClient(service_endpoint, credential) + private_source = AzureBlobKnowledgeSource( + name=private_blob_source_name, + azure_blob_parameters=AzureBlobKnowledgeSourceParameters( + connection_string=os.environ["AZURE_STORAGE_RESOURCE_ID_CONNECTION_STRING"], + container_name=os.environ["AZURE_STORAGE_CONTAINER"], + ingestion_parameters=KnowledgeSourceIngestionParameters( + identity=SearchIndexerDataUserAssignedIdentity( + resource_id=os.environ["AZURE_SEARCH_USER_ASSIGNED_IDENTITY"] + ), + content_extraction_mode="minimal", + ai_services=AIServices( + uri=os.environ["AZURE_AI_SERVICES_ENDPOINT"], + api_key=os.environ["AZURE_AI_SERVICES_API_KEY"], + ), + network_access_mode="private", + ), + ), + ) + try: + created = index_client.create_or_update_knowledge_source(private_source) + assert isinstance(created, AzureBlobKnowledgeSource) + assert created.azure_blob_parameters.ingestion_parameters is not None + assert created.azure_blob_parameters.ingestion_parameters.network_access_mode == "private" + resources = created.azure_blob_parameters.created_resources + assert resources is not None + data_source_name = resources.get("datasource") + indexer_name = resources.get("indexer") + generated_index_name = resources.get("index") + assert data_source_name and indexer_name and generated_index_name + + assert indexer_client.get_data_source_connection(data_source_name).name == data_source_name + assert indexer_client.get_indexer_status(indexer_name).status is not None + generated_index = index_client.get_index(generated_index_name) + analyzers = { + str(field.analyzer_name) + for field in generated_index.fields + if field.analyzer_name is not None + } + assert os.environ["AZURE_SEARCH_EXPECTED_ANALYZER"] in analyzers + assert os.environ["AZURE_SEARCH_EXPECTED_FALLBACK_ANALYZER"] in analyzers + print(f"Verified generated resources and analyzers: {sorted(analyzers)}") + finally: + index_client.delete_knowledge_source(private_blob_source_name) + indexer_client.close() + index_client.close() + # [END create_private_blob_knowledge_source] + + def delete_knowledge_source(): # [START delete_knowledge_source] from azure.core.credentials import AzureKeyCredential @@ -127,4 +247,5 @@ def delete_knowledge_source(): get_knowledge_source() update_knowledge_source() list_knowledge_sources() + create_private_blob_knowledge_source() delete_knowledge_source() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud_async.py index e32a0e020a9d..fcf8e32d5fcd 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_crud_async.py @@ -17,14 +17,25 @@ USAGE: python sample_knowledge_source_crud_async.py - Set the following environment variables before running the sample: + Set the following environment variables before running the standard CRUD scenarios: 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service (e.g., https://.search.windows.net) 2) AZURE_SEARCH_API_KEY - the admin key for your search service 3) AZURE_SEARCH_INDEX_NAME - target search index name. The index must have a semantic configuration (e.g., "hotels-sample-index"). -""" + The private Blob ingestion scenario runs only when all of these optional variables are set: + 4) AZURE_STORAGE_RESOURCE_ID_CONNECTION_STRING - ResourceId connection string for private Blob ingestion + 5) AZURE_STORAGE_CONTAINER - Blob container with supported and fallback language fixtures + 6) AZURE_SEARCH_USER_ASSIGNED_IDENTITY - user-assigned identity assigned to the Search service + 7) AZURE_AI_SERVICES_ENDPOINT - AI Services endpoint used for language detection + 8) AZURE_AI_SERVICES_API_KEY - AI Services API key + 9) AZURE_SEARCH_EXPECTED_ANALYZER - analyzer expected for the supported-language fixture + 10) AZURE_SEARCH_EXPECTED_FALLBACK_ANALYZER - analyzer expected for the fallback fixture + + The storage and AI Services shared private links must already be approved. Shared private-link + resources are control-plane resources and are not configured by this data-plane sample. +""" import asyncio import os @@ -33,6 +44,16 @@ index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] key = os.environ["AZURE_SEARCH_API_KEY"] knowledge_source_name = "hotels-sample-knowledge-source" +private_blob_source_name = "hotels-private-blob-knowledge-source" +private_blob_environment_variables = ( + "AZURE_STORAGE_RESOURCE_ID_CONNECTION_STRING", + "AZURE_STORAGE_CONTAINER", + "AZURE_SEARCH_USER_ASSIGNED_IDENTITY", + "AZURE_AI_SERVICES_ENDPOINT", + "AZURE_AI_SERVICES_API_KEY", + "AZURE_SEARCH_EXPECTED_ANALYZER", + "AZURE_SEARCH_EXPECTED_FALLBACK_ANALYZER", +) async def create_knowledge_source_async(): @@ -79,7 +100,9 @@ async def update_knowledge_source_async(): from azure.search.documents.indexes.models import ( SearchIndexFieldReference, SearchIndexKnowledgeSource, + SearchIndexKnowledgeSourceFilterHint, SearchIndexKnowledgeSourceParameters, + SearchIndexKnowledgeSourceQueryHints, ) index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) @@ -93,6 +116,15 @@ async def update_knowledge_source_async(): SearchIndexFieldReference(name="HotelId"), SearchIndexFieldReference(name="HotelName"), ], + query_hints=SearchIndexKnowledgeSourceQueryHints( + filters=[ + SearchIndexKnowledgeSourceFilterHint( + field="Category", + field_values=["Luxury", "Boutique"], + filter_instructions="Use Category when the user asks for a hotel type.", + ) + ] + ), ), ) @@ -106,15 +138,103 @@ async def list_knowledge_sources_async(): # [START list_knowledge_sources_async] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes.aio import SearchIndexClient + from azure.search.documents.indexes.models import SearchIndexKnowledgeSource, SearchIndexKnowledgeSourceParameters index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) - + companion_name = f"{knowledge_source_name}-page" + companion = SearchIndexKnowledgeSource( + name=companion_name, + search_index_parameters=SearchIndexKnowledgeSourceParameters(search_index_name=index_name), + ) async with index_client: - async for ks in index_client.list_knowledge_sources(): - print(f"Listed: knowledge source '{ks.name}'") + await index_client.create_or_update_knowledge_source(companion) + try: + sources = [ + source + async for source in index_client.list_knowledge_sources( + search=knowledge_source_name, + page_size=1, + search_type="prefix", + ) + ] + source_names = [source.name for source in sources] + assert set(source_names) == {knowledge_source_name, companion_name} + assert len(source_names) == len(set(source_names)) + print(f"Paged through {len(sources)} knowledge sources without duplicates") + finally: + await index_client.delete_knowledge_source(companion_name) # [END list_knowledge_sources_async] +async def create_private_blob_knowledge_source_async(): # pylint: disable=too-many-locals + missing_variables = [name for name in private_blob_environment_variables if not os.environ.get(name)] + if missing_variables: + print( + "Skipping private Blob knowledge source scenario; set these optional variables: " + + ", ".join(missing_variables) + ) + return + + # [START create_private_blob_knowledge_source_async] + from azure.core.credentials import AzureKeyCredential + from azure.search.documents.indexes.aio import SearchIndexClient, SearchIndexerClient + from azure.search.documents.indexes.models import ( + AzureBlobKnowledgeSource, + AzureBlobKnowledgeSourceParameters, + SearchIndexerDataUserAssignedIdentity, + ) + from azure.search.documents.knowledgebases.models import AIServices, KnowledgeSourceIngestionParameters + + credential = AzureKeyCredential(key) + index_client = SearchIndexClient(service_endpoint, credential) + indexer_client = SearchIndexerClient(service_endpoint, credential) + private_source = AzureBlobKnowledgeSource( + name=private_blob_source_name, + azure_blob_parameters=AzureBlobKnowledgeSourceParameters( + connection_string=os.environ["AZURE_STORAGE_RESOURCE_ID_CONNECTION_STRING"], + container_name=os.environ["AZURE_STORAGE_CONTAINER"], + ingestion_parameters=KnowledgeSourceIngestionParameters( + identity=SearchIndexerDataUserAssignedIdentity( + resource_id=os.environ["AZURE_SEARCH_USER_ASSIGNED_IDENTITY"] + ), + content_extraction_mode="minimal", + ai_services=AIServices( + uri=os.environ["AZURE_AI_SERVICES_ENDPOINT"], + api_key=os.environ["AZURE_AI_SERVICES_API_KEY"], + ), + network_access_mode="private", + ), + ), + ) + async with index_client, indexer_client: + try: + created = await index_client.create_or_update_knowledge_source(private_source) + assert isinstance(created, AzureBlobKnowledgeSource) + assert created.azure_blob_parameters.ingestion_parameters is not None + assert created.azure_blob_parameters.ingestion_parameters.network_access_mode == "private" + resources = created.azure_blob_parameters.created_resources + assert resources is not None + data_source_name = resources.get("datasource") + indexer_name = resources.get("indexer") + generated_index_name = resources.get("index") + assert data_source_name and indexer_name and generated_index_name + + assert (await indexer_client.get_data_source_connection(data_source_name)).name == data_source_name + assert (await indexer_client.get_indexer_status(indexer_name)).status is not None + generated_index = await index_client.get_index(generated_index_name) + analyzers = { + str(field.analyzer_name) + for field in generated_index.fields + if field.analyzer_name is not None + } + assert os.environ["AZURE_SEARCH_EXPECTED_ANALYZER"] in analyzers + assert os.environ["AZURE_SEARCH_EXPECTED_FALLBACK_ANALYZER"] in analyzers + print(f"Verified generated resources and analyzers: {sorted(analyzers)}") + finally: + await index_client.delete_knowledge_source(private_blob_source_name) + # [END create_private_blob_knowledge_source_async] + + async def delete_knowledge_source_async(): # [START delete_knowledge_source_async] from azure.core.credentials import AzureKeyCredential @@ -133,4 +253,5 @@ async def delete_knowledge_source_async(): asyncio.run(get_knowledge_source_async()) asyncio.run(update_knowledge_source_async()) asyncio.run(list_knowledge_sources_async()) + asyncio.run(create_private_blob_knowledge_source_async()) asyncio.run(delete_knowledge_source_async()) diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview.py index eded6470ceed..af38d7304d7c 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview.py @@ -32,7 +32,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview_async.py index dc0574cba0da..d10b7650d3bb 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_data_agent_preview_async.py @@ -33,7 +33,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview.py index 1ba4a0b1cf35..1234fe46623d 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview.py @@ -32,7 +32,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview_async.py index 34cd9ab49f5e..1f0b5f583fa8 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_fabric_ontology_preview_async.py @@ -33,7 +33,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview.py index f624240acb54..e3401f6e6d11 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview.py @@ -28,7 +28,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() @@ -37,16 +36,19 @@ upload_file_name = "hotels.txt" -def main(): +def main(): # pylint: disable=too-many-locals # [START sample_knowledge_source_file_preview] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient from azure.search.documents.indexes.models import ( AzureOpenAIVectorizerParameters, + FileUploadMetadata, FileKnowledgeSource, FileKnowledgeSourceParameters, KnowledgeBase, KnowledgeSourceReference, + UpdateKnowledgeSourceFileRequest, + UploadKnowledgeSourceFileMultipartRequest, ) from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient from azure.search.documents.knowledgebases.models import ( @@ -66,6 +68,7 @@ def main(): file_parameters=FileKnowledgeSourceParameters( ingestion_parameters=KnowledgeSourceIngestionParameters( content_extraction_mode="minimal", + network_access_mode="public", embedding_model=KnowledgeSourceAzureOpenAIVectorizer( azure_open_ai_parameters=AzureOpenAIVectorizerParameters( resource_url=os.environ["AZURE_OPENAI_ENDPOINT"], @@ -91,6 +94,64 @@ def main(): ) index_client.create_or_update_knowledge_base(knowledge_base) + file_content = b"Historic Harbor Hotel has free parking and a rooftop restaurant." + file_metadata = FileUploadMetadata( + file_name=f"hotels/{upload_file_name}", + metadata={"category": "hotel", "city": "Seattle"}, + ) + uploaded_file = index_client.upload_knowledge_source_file_multipart( + name=knowledge_source_name, + body=UploadKnowledgeSourceFileMultipartRequest( + metadata=file_metadata, + content=(upload_file_name, file_content, "text/plain"), + ), + ) + print(f"Uploaded: file '{uploaded_file.file_name}'") + assert uploaded_file.file_id is not None + + annex_file = index_client.upload_knowledge_source_file_multipart( + name=knowledge_source_name, + body=UploadKnowledgeSourceFileMultipartRequest( + metadata=FileUploadMetadata( + file_name="hotels/annex.txt", + metadata={"category": "hotel", "city": "Portland"}, + ), + content=("annex.txt", b"Harbor Hotel Annex has meeting rooms.", "text/plain"), + ), + ) + assert annex_file.file_id is not None + + updated_file = index_client.update_knowledge_source_file( + file_id=uploaded_file.file_id, + name=knowledge_source_name, + body=UpdateKnowledgeSourceFileRequest( + metadata=file_metadata, + content=( + upload_file_name, + b"Historic Harbor Hotel has free parking, free Wi-Fi, and a rooftop restaurant.", + "text/plain", + ), + ), + ) + print(f"Updated: file '{updated_file.file_name}'") + assert updated_file.metadata == {"category": "hotel", "city": "Seattle"} + assert updated_file.parsing_mode is not None + assert updated_file.extraction_mode in {"minimal", "standard"} + + files = list( + index_client.list_knowledge_source_files( + knowledge_source_name, + prefix="hotels/", + search="hotels", + page_size=1, + search_type="prefix", + ) + ) + file_ids = [file.file_id for file in files] + assert set(file_ids) == {uploaded_file.file_id, annex_file.file_id} + assert len(file_ids) == len(set(file_ids)) + print(f"Paged through {len(files)} files without duplicates") + retrieval_client = KnowledgeBaseRetrievalClient( service_endpoint, AzureKeyCredential(key), knowledge_base_name=knowledge_base_name ) @@ -111,17 +172,9 @@ def main(): finally: retrieval_client.close() - file_content = b"Historic Harbor Hotel has free parking and a rooftop restaurant." - uploaded_file = index_client.upload_knowledge_source_file( - knowledge_source_name, - file_content, - filename=upload_file_name, - content_type="application/octet-stream", - ) - print(f"Uploaded: file '{uploaded_file.file_name}'") - - files = list(index_client.list_knowledge_source_files(knowledge_source_name)) - print(f"Files: {len(files)}") + index_client.delete_knowledge_source_file(knowledge_source_name, uploaded_file.file_id) + index_client.delete_knowledge_source_file(knowledge_source_name, annex_file.file_id) + print("Deleted both uploaded files") # [END sample_knowledge_source_file_preview] finally: cleanup_resources( diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview_async.py index 4b80f069f772..f5fd14d16f9d 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_file_preview_async.py @@ -29,7 +29,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() @@ -38,16 +37,19 @@ upload_file_name = "hotels.txt" -async def main(): +async def main(): # pylint: disable=too-many-locals # [START sample_knowledge_source_file_preview_async] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes.aio import SearchIndexClient from azure.search.documents.indexes.models import ( AzureOpenAIVectorizerParameters, + FileUploadMetadata, FileKnowledgeSource, FileKnowledgeSourceParameters, KnowledgeBase, KnowledgeSourceReference, + UpdateKnowledgeSourceFileRequest, + UploadKnowledgeSourceFileMultipartRequest, ) from azure.search.documents.knowledgebases.aio import KnowledgeBaseRetrievalClient from azure.search.documents.knowledgebases.models import ( @@ -68,6 +70,7 @@ async def main(): file_parameters=FileKnowledgeSourceParameters( ingestion_parameters=KnowledgeSourceIngestionParameters( content_extraction_mode="minimal", + network_access_mode="public", embedding_model=KnowledgeSourceAzureOpenAIVectorizer( azure_open_ai_parameters=AzureOpenAIVectorizerParameters( resource_url=os.environ["AZURE_OPENAI_ENDPOINT"], @@ -93,6 +96,65 @@ async def main(): ) await index_client.create_or_update_knowledge_base(knowledge_base) + file_content = b"Historic Harbor Hotel has free parking and a rooftop restaurant." + file_metadata = FileUploadMetadata( + file_name=f"hotels/{upload_file_name}", + metadata={"category": "hotel", "city": "Seattle"}, + ) + uploaded_file = await index_client.upload_knowledge_source_file_multipart( + name=knowledge_source_name, + body=UploadKnowledgeSourceFileMultipartRequest( + metadata=file_metadata, + content=(upload_file_name, file_content, "text/plain"), + ), + ) + print(f"Uploaded: file '{uploaded_file.file_name}'") + assert uploaded_file.file_id is not None + + annex_file = await index_client.upload_knowledge_source_file_multipart( + name=knowledge_source_name, + body=UploadKnowledgeSourceFileMultipartRequest( + metadata=FileUploadMetadata( + file_name="hotels/annex.txt", + metadata={"category": "hotel", "city": "Portland"}, + ), + content=("annex.txt", b"Harbor Hotel Annex has meeting rooms.", "text/plain"), + ), + ) + assert annex_file.file_id is not None + + updated_file = await index_client.update_knowledge_source_file( + file_id=uploaded_file.file_id, + name=knowledge_source_name, + body=UpdateKnowledgeSourceFileRequest( + metadata=file_metadata, + content=( + upload_file_name, + b"Historic Harbor Hotel has free parking, free Wi-Fi, and a rooftop restaurant.", + "text/plain", + ), + ), + ) + print(f"Updated: file '{updated_file.file_name}'") + assert updated_file.metadata == {"category": "hotel", "city": "Seattle"} + assert updated_file.parsing_mode is not None + assert updated_file.extraction_mode in {"minimal", "standard"} + + files = [ + file + async for file in index_client.list_knowledge_source_files( + knowledge_source_name, + prefix="hotels/", + search="hotels", + page_size=1, + search_type="prefix", + ) + ] + file_ids = [file.file_id for file in files] + assert set(file_ids) == {uploaded_file.file_id, annex_file.file_id} + assert len(file_ids) == len(set(file_ids)) + print(f"Paged through {len(files)} files without duplicates") + retrieval_client = KnowledgeBaseRetrievalClient( service_endpoint, AzureKeyCredential(key), knowledge_base_name=knowledge_base_name ) @@ -113,17 +175,9 @@ async def main(): finally: await retrieval_client.close() - file_content = b"Historic Harbor Hotel has free parking and a rooftop restaurant." - uploaded_file = await index_client.upload_knowledge_source_file( - knowledge_source_name, - file_content, - filename=upload_file_name, - content_type="application/octet-stream", - ) - print(f"Uploaded: file '{uploaded_file.file_name}'") - - files = [file async for file in index_client.list_knowledge_source_files(knowledge_source_name)] - print(f"Files: {len(files)}") + await index_client.delete_knowledge_source_file(knowledge_source_name, uploaded_file.file_id) + await index_client.delete_knowledge_source_file(knowledge_source_name, annex_file.file_id) + print("Deleted both uploaded files") # [END sample_knowledge_source_file_preview_async] finally: await cleanup_resources_async( diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview.py index 959f4fb989ea..91e19d6e8533 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview.py @@ -26,7 +26,6 @@ setup_hotel_index, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview_async.py index 23bd233179cc..6ed44fe3a34b 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_freshness_preview_async.py @@ -27,7 +27,6 @@ setup_hotel_index_async, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview.py index d9fd53c7eb6c..487f403d38fe 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview.py @@ -31,7 +31,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview_async.py index 75bdac090f00..4fa4eeb10c25 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_mcp_server_preview_async.py @@ -32,7 +32,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview.py index 69ef63f6db0a..f977ba54f5e2 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview.py @@ -7,7 +7,9 @@ """ DESCRIPTION: - Demonstrates preview Work IQ knowledge source setup and retrieval. + Demonstrates preview Work IQ knowledge source setup and retrieval. The federated credential + must trust the managed identity used by the Search service, and the Entra app must have the + WorkIQAgent.Ask delegated permission before this sample runs. USAGE: python sample_knowledge_source_workiq_preview.py @@ -15,7 +17,10 @@ Set the following environment variables before running the sample: 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service 2) AZURE_SEARCH_API_KEY - the admin key for your search service - 3) AZURE_SEARCH_QUERY_SOURCE_AUTHORIZATION - raw bearer token for query source access + 3) AZURE_WORKIQ_APPLICATION_ID - application ID of the customer-owned Entra app + 4) AZURE_WORKIQ_FEDERATED_CREDENTIAL_ID - federated credential ID configured on the app + 5) AZURE_WORKIQ_TENANT_ID - tenant ID of the app registration (optional for same-tenant apps) + 6) AZURE_SEARCH_QUERY_WORK_IQ_SOURCE_AUTHORIZATION - user assertion token for Work IQ access """ import os @@ -26,7 +31,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() @@ -38,7 +42,13 @@ def main(): # [START sample_knowledge_source_workiq_preview] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes import SearchIndexClient - from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference, WorkIQKnowledgeSource + from azure.search.documents.indexes.models import ( + EntraAppAuthentication, + KnowledgeBase, + KnowledgeSourceReference, + WorkIQKnowledgeSource, + WorkIQKnowledgeSourceParameters, + ) from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient from azure.search.documents.knowledgebases.models import ( KnowledgeBaseRetrievalRequest, @@ -49,14 +59,31 @@ def main(): index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) try: + tenant_id = os.getenv("AZURE_WORKIQ_TENANT_ID") + entra_authentication = EntraAppAuthentication( + application_id=os.environ["AZURE_WORKIQ_APPLICATION_ID"], + federated_credential_id=os.environ["AZURE_WORKIQ_FEDERATED_CREDENTIAL_ID"], + tenant_id=tenant_id, + ) + if tenant_id is None: + assert entra_authentication.tenant_id is None + print("Tenant omitted: Search uses the Search service tenant.") + knowledge_source = WorkIQKnowledgeSource( name=knowledge_source_name, description="Hotel Work IQ knowledge source", + work_iq_parameters=WorkIQKnowledgeSourceParameters( + entra_app_authentication=entra_authentication, + ), ) created_knowledge_source = index_client.create_or_update_knowledge_source(knowledge_source) print(f"Created: knowledge source '{created_knowledge_source.name}'") retrieved_knowledge_source = index_client.get_knowledge_source(knowledge_source_name) + assert isinstance(retrieved_knowledge_source, WorkIQKnowledgeSource) + assert retrieved_knowledge_source.work_iq_parameters.entra_app_authentication.application_id == ( + os.environ["AZURE_WORKIQ_APPLICATION_ID"] + ) print(f"Retrieved: knowledge source '{retrieved_knowledge_source.name}'") knowledge_base = KnowledgeBase( @@ -84,9 +111,10 @@ def main(): ) ], ) + work_iq_user_assertion = os.environ["AZURE_SEARCH_QUERY_WORK_IQ_SOURCE_AUTHORIZATION"] retrieval_result = retrieval_client.retrieve( request, - query_source_authorization=os.environ["AZURE_SEARCH_QUERY_SOURCE_AUTHORIZATION"], + query_work_iq_source_authorization=work_iq_user_assertion, ) finally: retrieval_client.close() diff --git a/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview_async.py b/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview_async.py index 50f9bf465f4e..1ac458ed8d28 100644 --- a/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview_async.py +++ b/sdk/search/azure-search-documents/samples/sample_knowledge_source_workiq_preview_async.py @@ -7,7 +7,9 @@ """ DESCRIPTION: - Demonstrates preview Work IQ knowledge source setup and retrieval using async clients. + Demonstrates preview Work IQ knowledge source setup and retrieval using async clients. The + federated credential must trust the managed identity used by the Search service, and the Entra + app must have the WorkIQAgent.Ask delegated permission before this sample runs. USAGE: python sample_knowledge_source_workiq_preview_async.py @@ -15,7 +17,10 @@ Set the following environment variables before running the sample: 1) AZURE_SEARCH_SERVICE_ENDPOINT - base URL of your Azure AI Search service 2) AZURE_SEARCH_API_KEY - the admin key for your search service - 3) AZURE_SEARCH_QUERY_SOURCE_AUTHORIZATION - raw bearer token for query source access + 3) AZURE_WORKIQ_APPLICATION_ID - application ID of the customer-owned Entra app + 4) AZURE_WORKIQ_FEDERATED_CREDENTIAL_ID - federated credential ID configured on the app + 5) AZURE_WORKIQ_TENANT_ID - tenant ID of the app registration (optional for same-tenant apps) + 6) AZURE_SEARCH_QUERY_WORK_IQ_SOURCE_AUTHORIZATION - user assertion token for Work IQ access """ import asyncio @@ -27,7 +32,6 @@ print_retrieval_summary, ) - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] key = os.environ["AZURE_SEARCH_API_KEY"] run_tag = get_sample_run_tag() @@ -39,7 +43,13 @@ async def main(): # [START sample_knowledge_source_workiq_preview_async] from azure.core.credentials import AzureKeyCredential from azure.search.documents.indexes.aio import SearchIndexClient - from azure.search.documents.indexes.models import KnowledgeBase, KnowledgeSourceReference, WorkIQKnowledgeSource + from azure.search.documents.indexes.models import ( + EntraAppAuthentication, + KnowledgeBase, + KnowledgeSourceReference, + WorkIQKnowledgeSource, + WorkIQKnowledgeSourceParameters, + ) from azure.search.documents.knowledgebases.aio import KnowledgeBaseRetrievalClient from azure.search.documents.knowledgebases.models import ( KnowledgeBaseRetrievalRequest, @@ -51,14 +61,31 @@ async def main(): index_client = SearchIndexClient(service_endpoint, AzureKeyCredential(key)) async with index_client: try: + tenant_id = os.getenv("AZURE_WORKIQ_TENANT_ID") + entra_authentication = EntraAppAuthentication( + application_id=os.environ["AZURE_WORKIQ_APPLICATION_ID"], + federated_credential_id=os.environ["AZURE_WORKIQ_FEDERATED_CREDENTIAL_ID"], + tenant_id=tenant_id, + ) + if tenant_id is None: + assert entra_authentication.tenant_id is None + print("Tenant omitted: Search uses the Search service tenant.") + knowledge_source = WorkIQKnowledgeSource( name=knowledge_source_name, description="Hotel Work IQ knowledge source", + work_iq_parameters=WorkIQKnowledgeSourceParameters( + entra_app_authentication=entra_authentication, + ), ) created_knowledge_source = await index_client.create_or_update_knowledge_source(knowledge_source) print(f"Created: knowledge source '{created_knowledge_source.name}'") retrieved_knowledge_source = await index_client.get_knowledge_source(knowledge_source_name) + assert isinstance(retrieved_knowledge_source, WorkIQKnowledgeSource) + assert retrieved_knowledge_source.work_iq_parameters.entra_app_authentication.application_id == ( + os.environ["AZURE_WORKIQ_APPLICATION_ID"] + ) print(f"Retrieved: knowledge source '{retrieved_knowledge_source.name}'") knowledge_base = KnowledgeBase( @@ -86,9 +113,10 @@ async def main(): ) ], ) + work_iq_user_assertion = os.environ["AZURE_SEARCH_QUERY_WORK_IQ_SOURCE_AUTHORIZATION"] retrieval_result = await retrieval_client.retrieve( request, - query_source_authorization=os.environ["AZURE_SEARCH_QUERY_SOURCE_AUTHORIZATION"], + query_work_iq_source_authorization=work_iq_user_assertion, ) finally: await retrieval_client.close() diff --git a/sdk/search/azure-search-documents/samples/sample_query_autocomplete_async.py b/sdk/search/azure-search-documents/samples/sample_query_autocomplete_async.py index 454d19538e74..8235906e7d78 100644 --- a/sdk/search/azure-search-documents/samples/sample_query_autocomplete_async.py +++ b/sdk/search/azure-search-documents/samples/sample_query_autocomplete_async.py @@ -22,7 +22,6 @@ import os import asyncio - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] key = os.environ["AZURE_SEARCH_API_KEY"] diff --git a/sdk/search/azure-search-documents/samples/sample_query_facets_async.py b/sdk/search/azure-search-documents/samples/sample_query_facets_async.py index 39a98cc94f0b..7baa17ae97be 100644 --- a/sdk/search/azure-search-documents/samples/sample_query_facets_async.py +++ b/sdk/search/azure-search-documents/samples/sample_query_facets_async.py @@ -22,7 +22,6 @@ import os import asyncio - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] key = os.environ["AZURE_SEARCH_API_KEY"] diff --git a/sdk/search/azure-search-documents/samples/sample_query_filter_async.py b/sdk/search/azure-search-documents/samples/sample_query_filter_async.py index 4083b2446be1..6e48d0b0b599 100644 --- a/sdk/search/azure-search-documents/samples/sample_query_filter_async.py +++ b/sdk/search/azure-search-documents/samples/sample_query_filter_async.py @@ -22,7 +22,6 @@ import os import asyncio - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] key = os.environ["AZURE_SEARCH_API_KEY"] diff --git a/sdk/search/azure-search-documents/samples/sample_query_simple_async.py b/sdk/search/azure-search-documents/samples/sample_query_simple_async.py index 8bc4efba8373..be949499ed27 100644 --- a/sdk/search/azure-search-documents/samples/sample_query_simple_async.py +++ b/sdk/search/azure-search-documents/samples/sample_query_simple_async.py @@ -20,7 +20,6 @@ import os import asyncio - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] key = os.environ["AZURE_SEARCH_API_KEY"] diff --git a/sdk/search/azure-search-documents/samples/sample_query_suggestions_async.py b/sdk/search/azure-search-documents/samples/sample_query_suggestions_async.py index cc70c799b77c..7a67ed9141aa 100644 --- a/sdk/search/azure-search-documents/samples/sample_query_suggestions_async.py +++ b/sdk/search/azure-search-documents/samples/sample_query_suggestions_async.py @@ -20,7 +20,6 @@ import os import asyncio - service_endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] index_name = os.environ["AZURE_SEARCH_INDEX_NAME"] key = os.environ["AZURE_SEARCH_API_KEY"] diff --git a/sdk/search/azure-search-documents/tests/_capabilities.py b/sdk/search/azure-search-documents/tests/_capabilities.py index 88862c6b9be3..fd74ecc968e2 100644 --- a/sdk/search/azure-search-documents/tests/_capabilities.py +++ b/sdk/search/azure-search-documents/tests/_capabilities.py @@ -17,6 +17,7 @@ import pytest PREVIEW = "2026-05-01-preview" +PREVIEW_2026_08_01 = "2026-08-01-preview" def _surface(owner: str, kwargs: tuple = (), available_from: str = PREVIEW) -> Mapping[str, Any]: @@ -57,7 +58,11 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: # File f"{_IM}.FileKnowledgeSource", f"{_IM}.FileKnowledgeSourceParameters", + f"{_IM}.FileUploadMetadata", + f"{_IM}.UpdateKnowledgeSourceFileRequest", + f"{_IM}.UploadKnowledgeSourceFileMultipartRequest", f"{_KBM}.FileKnowledgeSourceParams", + f"{_KBM}.KnowledgeSourceAzureOpenAIVectorizer", # MCP server f"{_IM}.McpServerKnowledgeSource", f"{_IM}.McpServerKnowledgeSourceParameters", @@ -113,7 +118,6 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: f"{_KBM}.KnowledgeBaseModelAnswerSynthesisActivityRecord", f"{_KBM}.KnowledgeBaseModelWebSummarizationActivityRecord", f"{_KBM}.KnowledgeBaseWorkIQReference", - f"{_KBM}.WorkIQAttribution", f"{_KBM}.PurviewSensitivityLabelInfo", # Permission filter and option types f"{_IM}.SearchIndexPermissionFilterOption", @@ -128,6 +132,15 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: for dotted in new_classes: entries[dotted] = _surface(dotted) + for dotted in [ + f"{_KBM}.KnowledgeBaseRetrievalStartedEvent", + f"{_KBM}.KnowledgeBaseActivityStartedEvent", + f"{_KBM}.KnowledgeBaseAnswerCompletedEvent", + f"{_KBM}.KnowledgeBaseResponseCompletedEvent", + f"{_KBM}.KnowledgeBaseStreamErrorEvent", + ]: + entries[dotted] = _surface(dotted, available_from=PREVIEW_2026_08_01) + # New fields on existing models. Key = ".", owner = dotted-class, kwargs = (field,). field_additions = [ (f"{_IM}.SearchIndex", "cors_options"), @@ -147,7 +160,6 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: (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"), @@ -180,6 +192,7 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: (f"{_KBM}.KnowledgeBaseIndexedSharePointReference", "search_sensitivity_label_info"), (f"{_KBM}.KnowledgeBaseRemoteSharePointReference", "search_sensitivity_label_info"), (f"{_KBM}.KnowledgeBaseSearchIndexReference", "search_sensitivity_label_info"), + (f"{_KBM}.KnowledgeBaseWorkIQReference", "search_sensitivity_label_info"), (f"{_KBM}.KnowledgeSourceParams", "always_query_source"), (f"{_KBM}.KnowledgeSourceParams", "fail_on_error"), (f"{_KBM}.KnowledgeSourceParams", "max_output_documents"), @@ -237,8 +250,6 @@ def _model_capabilities() -> Mapping[str, Mapping[str, Any]]: (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"), @@ -275,6 +286,8 @@ def _client_capabilities() -> Mapping[str, Mapping[str, Any]]: f"{_IDX}.SearchIndexClient.get_knowledge_source", f"{_IDX}.SearchIndexClient.get_knowledge_source_status", f"{_IDX}.SearchIndexClient.upload_knowledge_source_file", + f"{_IDX}.SearchIndexClient.upload_knowledge_source_file_multipart", + f"{_IDX}.SearchIndexClient.update_knowledge_source_file", f"{_IDX}.SearchIndexClient.list_knowledge_source_files", f"{_IDX}.SearchIndexClient.delete_knowledge_source_file", f"{_IDX}.SearchIndexClient.list_knowledge_bases", @@ -293,6 +306,8 @@ def _client_capabilities() -> Mapping[str, Mapping[str, Any]]: f"{_IDX}.aio.SearchIndexClient.get_knowledge_source", f"{_IDX}.aio.SearchIndexClient.get_knowledge_source_status", f"{_IDX}.aio.SearchIndexClient.upload_knowledge_source_file", + f"{_IDX}.aio.SearchIndexClient.upload_knowledge_source_file_multipart", + f"{_IDX}.aio.SearchIndexClient.update_knowledge_source_file", f"{_IDX}.aio.SearchIndexClient.list_knowledge_source_files", f"{_IDX}.aio.SearchIndexClient.delete_knowledge_source_file", f"{_IDX}.aio.SearchIndexClient.list_knowledge_bases", @@ -305,6 +320,12 @@ def _client_capabilities() -> Mapping[str, Mapping[str, Any]]: for dotted in method_existence: entries[dotted] = _surface(dotted) + for dotted in [ + f"{_KB}.KnowledgeBaseRetrievalClient.retrieve_stream", + f"{_KB}.aio.KnowledgeBaseRetrievalClient.retrieve_stream", + ]: + entries[dotted] = _surface(dotted, available_from=PREVIEW_2026_08_01) + method_kwargs = [ ( f"{_IDX}.SearchIndexerClient.create_or_update_data_source_connection", @@ -318,8 +339,20 @@ def _client_capabilities() -> Mapping[str, Mapping[str, Any]]: 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}.SearchIndexClient.list_indexes", ("search", "page_size", "search_type")), + (f"{_IDX}.SearchIndexClient.list_index_names", ("search", "page_size", "search_type")), + (f"{_IDX}.SearchIndexClient.list_aliases", ("search", "page_size", "search_type")), + (f"{_IDX}.SearchIndexClient.list_index_stats_summary", ("search", "page_size", "search_type")), + (f"{_IDX}.SearchIndexClient.list_knowledge_bases", ("search", "page_size", "search_type")), + (f"{_IDX}.SearchIndexClient.list_knowledge_sources", ("search", "page_size", "search_type")), + ( + f"{_IDX}.SearchIndexClient.list_knowledge_source_files", + ("prefix", "search", "page_size", "search_type"), + ), + (f"{_IDX}.SearchIndexClient.get_synonym_maps", ("search", "page_size", "search_type")), + (f"{_IDX}.SearchIndexerClient.get_data_source_connections", ("search", "page_size", "search_type")), + (f"{_IDX}.SearchIndexerClient.get_indexers", ("search", "page_size", "search_type")), + (f"{_IDX}.SearchIndexerClient.get_skillsets", ("search", "page_size", "search_type")), ( f"{_IDX}.aio.SearchIndexerClient.create_or_update_data_source_connection", ("skip_indexer_reset_requirement_for_cache",), @@ -332,8 +365,31 @@ def _client_capabilities() -> Mapping[str, Mapping[str, Any]]: 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")), + (f"{_IDX}.aio.SearchIndexClient.list_indexes", ("search", "page_size", "search_type")), + (f"{_IDX}.aio.SearchIndexClient.list_index_names", ("search", "page_size", "search_type")), + (f"{_IDX}.aio.SearchIndexClient.list_aliases", ("search", "page_size", "search_type")), + (f"{_IDX}.aio.SearchIndexClient.list_index_stats_summary", ("search", "page_size", "search_type")), + (f"{_IDX}.aio.SearchIndexClient.list_knowledge_bases", ("search", "page_size", "search_type")), + (f"{_IDX}.aio.SearchIndexClient.list_knowledge_sources", ("search", "page_size", "search_type")), + ( + f"{_IDX}.aio.SearchIndexClient.list_knowledge_source_files", + ("prefix", "search", "page_size", "search_type"), + ), + (f"{_IDX}.aio.SearchIndexClient.get_synonym_maps", ("search", "page_size", "search_type")), + ( + f"{_IDX}.aio.SearchIndexerClient.get_data_source_connections", + ("search", "page_size", "search_type"), + ), + (f"{_IDX}.aio.SearchIndexerClient.get_indexers", ("search", "page_size", "search_type")), + (f"{_IDX}.aio.SearchIndexerClient.get_skillsets", ("search", "page_size", "search_type")), + ( + f"{_KB}.KnowledgeBaseRetrievalClient.retrieve_stream", + ("query_source_authorization", "query_work_iq_source_authorization"), + ), + ( + f"{_KB}.aio.KnowledgeBaseRetrievalClient.retrieve_stream", + ("query_source_authorization", "query_work_iq_source_authorization"), + ), ] for dotted, kwargs in method_kwargs: for kw in kwargs: @@ -378,6 +434,18 @@ def _client_capabilities() -> Mapping[str, Mapping[str, Any]]: "KnowledgeBaseRetrievalClient.aio": _surface( "azure.search.documents.knowledgebases.aio.KnowledgeBaseRetrievalClient" ), + "KnowledgeBaseRetrievalEvent": _surface( + "azure.search.documents.knowledgebases.KnowledgeBaseRetrievalEvent", + available_from=PREVIEW_2026_08_01, + ), + "KnowledgeBaseRetrievalStream": _surface( + "azure.search.documents.knowledgebases.KnowledgeBaseRetrievalStream", + available_from=PREVIEW_2026_08_01, + ), + "AsyncKnowledgeBaseRetrievalStream": _surface( + "azure.search.documents.knowledgebases.aio.AsyncKnowledgeBaseRetrievalStream", + available_from=PREVIEW_2026_08_01, + ), } _CAPS.update(_model_capabilities()) _CAPS.update(_client_capabilities()) @@ -423,6 +491,7 @@ def _has_capability_attr(owner: Any, name: str) -> bool: def require_capability(*names: str) -> None: for name in names: + owner: Any = None try: cap = CAPABILITIES[name] except KeyError: # pragma: no cover - misuse @@ -431,6 +500,7 @@ def require_capability(*names: str) -> None: owner = _resolve(cap["owner"]) except (ImportError, AttributeError) as exc: pytest.skip(f"{name} unavailable: owner {cap['owner']!r} cannot be resolved ({exc})") + assert owner is not None if not cap["kwargs"]: # Existence of owner is the capability. continue 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 96de51e55e44..30d627650b90 100644 --- a/sdk/search/azure-search-documents/tests/_search_helpers_async.py +++ b/sdk/search/azure-search-documents/tests/_search_helpers_async.py @@ -36,7 +36,6 @@ build_knowledge_source, ) - # --------------------------------------------------------------------------- # Shared operations # --------------------------------------------------------------------------- diff --git a/sdk/search/azure-search-documents/tests/conftest.py b/sdk/search/azure-search-documents/tests/conftest.py index bedf8b84d11c..a2b9c3a39153 100644 --- a/sdk/search/azure-search-documents/tests/conftest.py +++ b/sdk/search/azure-search-documents/tests/conftest.py @@ -19,12 +19,17 @@ def add_sanitizers(test_proxy): # Ensure all search service endpoint names are mocked to "test-service" add_general_regex_sanitizer( value="://fakesearchendpoint.search.windows.net", - regex=r"://(.+).search.windows.net", + regex=r"://([^/\"]+)\.search\.windows\.net", ) # Remove storage connection strings from recordings add_general_regex_sanitizer(value="AccountKey=FAKE;", regex=r"AccountKey=([^;]+);") # Remove storage account names from recordings add_general_regex_sanitizer(value="AccountName=fakestoragecs;", regex=r"AccountName=([^;]+);") + # Remove Azure OpenAI resource names from File knowledge source recordings + add_general_regex_sanitizer( + value="https://fake-openai.openai.azure.com", + regex=r"https://[^\"/]+\.openai\.azure\.com", + ) # Remove the following sanitizers since certain fields are needed in tests and are non-sensitive: # - AZSDK3493: $..name remove_batch_sanitizers(["AZSDK3493"]) diff --git a/sdk/search/azure-search-documents/tests/search_service_preparer.py b/sdk/search/azure-search-documents/tests/search_service_preparer.py index 03bcfed029e4..f9eb7872978c 100644 --- a/sdk/search/azure-search-documents/tests/search_service_preparer.py +++ b/sdk/search/azure-search-documents/tests/search_service_preparer.py @@ -18,6 +18,9 @@ "DefaultEndpointsProtocol=https;AccountName=fakestoragecs;AccountKey=FAKE;EndpointSuffix=core.windows.net" ) FAKE_STORAGE_CONTAINER_NAME = "fakestoragecontainer" +FAKE_AZURE_OPENAI_ENDPOINT = "https://fake-openai.openai.azure.com/" +FAKE_AZURE_OPENAI_EMBEDDING_DEPLOYMENT = "text-embedding-3-small" +FAKE_AZURE_OPENAI_EMBEDDING_MODEL = "text-embedding-3-small" SKILLSET_NOT_ENABLED_MESSAGE = "skillset related operations are not enabled in this region" SearchEnvVarPreparer = functools.partial( @@ -27,6 +30,9 @@ search_service_name=FAKE_SEARCH_SERVICE_NAME, search_storage_connection_string=FAKE_STORAGE_CONNECTION_STRING, search_storage_container_name=FAKE_STORAGE_CONTAINER_NAME, + search_azure_openai_endpoint=FAKE_AZURE_OPENAI_ENDPOINT, + search_azure_openai_embedding_deployment=FAKE_AZURE_OPENAI_EMBEDDING_DEPLOYMENT, + search_azure_openai_embedding_model=FAKE_AZURE_OPENAI_EMBEDDING_MODEL, ) diff --git a/sdk/search/azure-search-documents/tests/test_capabilities.py b/sdk/search/azure-search-documents/tests/test_capabilities.py new file mode 100644 index 000000000000..0e59caddc9ce --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_capabilities.py @@ -0,0 +1,22 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Tests for the current preview capability registry.""" + +from _capabilities import CAPABILITIES, _has_capability_attr, _resolve + + +def test_all_registered_capabilities_match_current_public_surface(): + unresolved = [] + + for name, capability in CAPABILITIES.items(): + try: + owner = _resolve(capability["owner"]) + except (ImportError, AttributeError): + unresolved.append(name) + continue + if any(not _has_capability_attr(owner, item) for item in capability["kwargs"]): + unresolved.append(name) + + assert unresolved == [] \ No newline at end of file diff --git a/sdk/search/azure-search-documents/tests/test_generator_workarounds.py b/sdk/search/azure-search-documents/tests/test_generator_workarounds.py new file mode 100644 index 000000000000..19f6b1d90612 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_generator_workarounds.py @@ -0,0 +1,24 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Tests for package-owned post-generation workarounds.""" + +from pathlib import Path +import subprocess +import sys + + +def test_generator_workarounds_are_applied(): + package_root = Path(__file__).resolve().parents[1] + script = package_root / ".github/skills/azure-search-documents/scripts/apply_generator_workarounds.py" + + result = subprocess.run( + [sys.executable, str(script), "--check"], + cwd=package_root, + check=False, + capture_output=True, + text=True, + ) + + assert result.returncode == 0, result.stdout + result.stderr \ No newline at end of file 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 index 8b04832ceaee..8c2e4c5e48e1 100644 --- 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 @@ -4,6 +4,11 @@ # ------------------------------------ """Unit tests for ``KnowledgeBaseRetrievalClient`` patched public behavior.""" +import json +from types import SimpleNamespace +from unittest import mock + +import pytest from azure.core.credentials import AzureKeyCredential from _capabilities import require_capability @@ -14,6 +19,33 @@ AUDIENCE = "https://search.azure.com/" +class _Response: + def __init__(self): + self.closed = False + + def close(self): + self.closed = True + + +class _RawStream: + def __init__(self, chunks): + self._chunks = iter(chunks) + self.closed = False + + def __iter__(self): + return self + + def __next__(self): + return next(self._chunks) + + def close(self): + self.closed = True + + +def _frame(event_type, payload): + return f"event: {event_type}\ndata: {json.dumps(payload)}\n\n".encode() + + class TestKnowledgeBaseRetrievalClientConstructor: def test_constructor_translates_audience_to_credential_scope(self): require_capability("KnowledgeBaseRetrievalClient") @@ -29,3 +61,177 @@ def test_constructor_translates_audience_to_credential_scope(self): assert client._config.endpoint == ENDPOINT assert client._config.knowledge_base_name == KNOWLEDGE_BASE_NAME assert client._config.credential_scopes == ["https://search.azure.com/.default"] + + +class TestKnowledgeBaseRetrievalStream: + def test_stream_deserializes_all_known_event_types(self): + require_capability("KnowledgeBaseRetrievalEvent", "KnowledgeBaseRetrievalStream") + from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalStream + from azure.search.documents.knowledgebases.models import ( + KnowledgeBaseActivityStartedEvent, + KnowledgeBaseAnswerCompletedEvent, + KnowledgeBaseResponseCompletedEvent, + KnowledgeBaseRetrievalStartedEvent, + KnowledgeBaseSearchIndexActivityRecord, + KnowledgeBaseSearchIndexReference, + KnowledgeBaseStreamErrorEvent, + ) + + chunks = [ + _frame( + "retrieval.started", + { + "requestId": "request-id", + "knowledgeBaseName": KNOWLEDGE_BASE_NAME, + "outputMode": "extractiveData", + "reasoningEffort": {"kind": "minimal"}, + }, + ), + _frame( + "activity.started", + {"id": 1, "type": "searchIndex", "startedAt": "2026-08-10T00:00:00Z"}, + ), + _frame("activity.completed", {"id": 1, "type": "searchIndex"}), + _frame("answer.completed", {"messageIndex": 0, "message": {"role": "assistant", "content": []}}), + _frame("references.completed", [{"type": "searchIndex", "id": "doc-1", "activitySource": 1}]), + _frame("error", {"error": {"code": "Failed", "message": "retrieval failed"}}), + _frame("response.completed", {"statusCode": 200, "response": {}}), + ] + response = _Response() + raw_stream = _RawStream(chunks) + stream = KnowledgeBaseRetrievalStream(response=response, raw_stream=raw_stream) + + events = list(stream) + + assert [event.event_type for event in events] == [ + "retrieval.started", + "activity.started", + "activity.completed", + "answer.completed", + "references.completed", + "error", + ] + assert isinstance(events[0].data, KnowledgeBaseRetrievalStartedEvent) + assert isinstance(events[1].data, KnowledgeBaseActivityStartedEvent) + assert isinstance(events[2].data, KnowledgeBaseSearchIndexActivityRecord) + assert isinstance(events[3].data, KnowledgeBaseAnswerCompletedEvent) + assert isinstance(events[4].data[0], KnowledgeBaseSearchIndexReference) + assert isinstance(events[5].data, KnowledgeBaseStreamErrorEvent) + assert response.closed + assert raw_stream.closed + + success_stream = KnowledgeBaseRetrievalStream( + response=_Response(), + raw_stream=_RawStream([_frame("response.completed", {"statusCode": 200, "response": {}})]), + ) + assert isinstance(next(success_stream).data, KnowledgeBaseResponseCompletedEvent) + + @pytest.mark.parametrize("chunk_size", [1, 2, 5, 512]) + def test_stream_handles_fragmented_utf8_line_endings_comments_and_unknown_events(self, chunk_size): + from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalStream + + payload = ( + b"\xef\xbb\xbf: keep-alive\r\n" + b"event: future.event\r" + b'data: {"message":\r\n' + b'data: "caf\xc3\xa9"}\r\n\r\n' + ) + chunks = [payload[index : index + chunk_size] for index in range(0, len(payload), chunk_size)] + response = _Response() + + with KnowledgeBaseRetrievalStream(response=response, raw_stream=_RawStream(chunks)) as stream: + event = next(stream) + + assert event.event_type == "future.event" + assert event.data == {"message": "caf\u00e9"} + assert response.closed + + def test_stream_closes_on_malformed_json_and_explicit_close(self): + from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalStream + + response = _Response() + raw_stream = _RawStream([b"event: retrieval.started\ndata: {invalid}\n\n"]) + stream = KnowledgeBaseRetrievalStream(response=response, raw_stream=raw_stream) + + with pytest.raises(json.JSONDecodeError): + next(stream) + assert response.closed + assert raw_stream.closed + + response = _Response() + raw_stream = _RawStream([]) + stream = KnowledgeBaseRetrievalStream(response=response, raw_stream=raw_stream) + stream.close() + stream.close() + assert response.closed + assert raw_stream.closed + + def test_client_wraps_generated_stream_and_composes_cls(self): + require_capability( + "azure.search.documents.knowledgebases.KnowledgeBaseRetrievalClient.retrieve_stream", + "KnowledgeBaseRetrievalStream", + ) + from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient, KnowledgeBaseRetrievalStream + from azure.search.documents.knowledgebases.models import KnowledgeBaseRetrievalRequest + + response = _Response() + raw_stream = _RawStream([_frame("response.completed", {"statusCode": 200, "response": {}})]) + pipeline_response = SimpleNamespace(http_response=response) + generated_kwargs = {} + + def generated_retrieve_stream(_self, _request, **kwargs): + generated_kwargs.update(kwargs) + return kwargs["cls"](pipeline_response, raw_stream, {"content-type": "text/event-stream"}) + + client = KnowledgeBaseRetrievalClient( + ENDPOINT, AzureKeyCredential(KEY), knowledge_base_name=KNOWLEDGE_BASE_NAME + ) + with mock.patch( + "azure.search.documents.knowledgebases._patch._KnowledgeBaseRetrievalClient.retrieve_stream", + new=generated_retrieve_stream, + ): + stream = client.retrieve_stream( + KnowledgeBaseRetrievalRequest(), + query_source_authorization="query-token", + query_work_iq_source_authorization="work-iq-token", + ) + assert isinstance(stream, KnowledgeBaseRetrievalStream) + assert generated_kwargs["query_source_authorization"] == "query-token" + assert generated_kwargs["query_work_iq_source_authorization"] == "work-iq-token" + assert KnowledgeBaseRetrievalStream.__module__ == "azure.search.documents.knowledgebases" + stream.close() + + observed = {} + + def custom_cls(received_pipeline_response, typed_stream, headers): + observed.update(pipeline_response=received_pipeline_response, stream=typed_stream, headers=headers) + return "custom-result" + + response = _Response() + raw_stream = _RawStream([]) + pipeline_response = SimpleNamespace(http_response=response) + with mock.patch( + "azure.search.documents.knowledgebases._patch._KnowledgeBaseRetrievalClient.retrieve_stream", + new=generated_retrieve_stream, + ): + result = client.retrieve_stream(KnowledgeBaseRetrievalRequest(), cls=custom_cls) + assert result == "custom-result" + assert isinstance(observed["stream"], KnowledgeBaseRetrievalStream) + observed["stream"].close() + + response = _Response() + raw_stream = _RawStream([]) + pipeline_response = SimpleNamespace(http_response=response) + + def raising_cls(_pipeline_response, _typed_stream, _headers): + raise RuntimeError("custom callback failed") + + with mock.patch( + "azure.search.documents.knowledgebases._patch._KnowledgeBaseRetrievalClient.retrieve_stream", + new=generated_retrieve_stream, + ): + with pytest.raises(RuntimeError, match="custom callback failed"): + client.retrieve_stream(KnowledgeBaseRetrievalRequest(), cls=raising_cls) + assert response.closed + assert raw_stream.closed + client.close() 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 index cfe44a6c9af5..70aa1557bf62 100644 --- 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 @@ -4,6 +4,11 @@ # ------------------------------------ """Async unit tests for ``KnowledgeBaseRetrievalClient`` patched public behavior.""" +import asyncio +import json +from types import SimpleNamespace +from unittest import mock + import pytest from azure.core.credentials import AzureKeyCredential @@ -15,6 +20,41 @@ AUDIENCE = "https://search.azure.com/" +class _AsyncResponse: + def __init__(self): + self.closed = False + + async def close(self): + self.closed = True + + +class _AsyncRawStream: + def __init__(self, chunks, error=None): + self._chunks = iter(chunks) + self._error = error + self.closed = False + + def __aiter__(self): + return self + + async def __anext__(self): + if self._error is not None: + error = self._error + self._error = None + raise error + try: + return next(self._chunks) + except StopIteration as exc: + raise StopAsyncIteration from exc + + async def aclose(self): + self.closed = True + + +def _frame(event_type, payload): + return f"event: {event_type}\ndata: {json.dumps(payload)}\n\n".encode() + + @pytest.mark.asyncio class TestKnowledgeBaseRetrievalClientConstructorAsync: async def test_constructor_translates_audience_to_credential_scope(self): @@ -32,3 +72,168 @@ async def test_constructor_translates_audience_to_credential_scope(self): assert client._config.knowledge_base_name == KNOWLEDGE_BASE_NAME assert client._config.credential_scopes == ["https://search.azure.com/.default"] await client.close() + + +@pytest.mark.asyncio +class TestKnowledgeBaseRetrievalStreamAsync: + async def test_stream_deserializes_all_known_event_types(self): + require_capability("AsyncKnowledgeBaseRetrievalStream", "KnowledgeBaseRetrievalEvent") + from azure.search.documents.knowledgebases.aio import AsyncKnowledgeBaseRetrievalStream + from azure.search.documents.knowledgebases.models import ( + KnowledgeBaseActivityStartedEvent, + KnowledgeBaseAnswerCompletedEvent, + KnowledgeBaseRetrievalStartedEvent, + KnowledgeBaseSearchIndexActivityRecord, + KnowledgeBaseSearchIndexReference, + KnowledgeBaseStreamErrorEvent, + ) + + raw_stream = _AsyncRawStream( + [ + _frame( + "retrieval.started", + { + "requestId": "request-id", + "knowledgeBaseName": KNOWLEDGE_BASE_NAME, + "outputMode": "extractiveData", + "reasoningEffort": {"kind": "minimal"}, + }, + ), + _frame("activity.started", {"id": 1, "type": "searchIndex", "startedAt": "2026-08-10T00:00:00Z"}), + _frame("activity.completed", {"id": 1, "type": "searchIndex"}), + _frame("answer.completed", {"messageIndex": 0, "message": {"role": "assistant", "content": []}}), + _frame("references.completed", [{"type": "searchIndex", "id": "doc-1", "activitySource": 1}]), + _frame("error", {"error": {"code": "Failed", "message": "retrieval failed"}}), + ] + ) + stream = AsyncKnowledgeBaseRetrievalStream(response=_AsyncResponse(), raw_stream=raw_stream) + events = [event async for event in stream] + + assert isinstance(events[0].data, KnowledgeBaseRetrievalStartedEvent) + assert isinstance(events[1].data, KnowledgeBaseActivityStartedEvent) + assert isinstance(events[2].data, KnowledgeBaseSearchIndexActivityRecord) + assert isinstance(events[3].data, KnowledgeBaseAnswerCompletedEvent) + assert isinstance(events[4].data[0], KnowledgeBaseSearchIndexReference) + assert isinstance(events[5].data, KnowledgeBaseStreamErrorEvent) + assert AsyncKnowledgeBaseRetrievalStream.__module__ == "azure.search.documents.knowledgebases.aio" + + async def test_stream_handles_fragmented_events_and_terminal_cleanup(self): + require_capability("AsyncKnowledgeBaseRetrievalStream", "KnowledgeBaseRetrievalEvent") + from azure.search.documents.knowledgebases.aio import AsyncKnowledgeBaseRetrievalStream + from azure.search.documents.knowledgebases.models import KnowledgeBaseResponseCompletedEvent + + payload = ( + b": keep-alive\r\n" + b"event: response.completed\r\n" + b'data: {"statusCode":200,"response":{}}\r\n\r\nignored' + ) + raw_stream = _AsyncRawStream([payload[index : index + 2] for index in range(0, len(payload), 2)]) + response = _AsyncResponse() + stream = AsyncKnowledgeBaseRetrievalStream(response=response, raw_stream=raw_stream) + + event = await stream.__anext__() + + assert event.event_type == "response.completed" + assert isinstance(event.data, KnowledgeBaseResponseCompletedEvent) + assert response.closed + assert raw_stream.closed + with pytest.raises(StopAsyncIteration): + await stream.__anext__() + + async def test_stream_closes_on_cancellation_malformed_json_and_context_exit(self): + from azure.search.documents.knowledgebases.aio import AsyncKnowledgeBaseRetrievalStream + + response = _AsyncResponse() + raw_stream = _AsyncRawStream([], error=asyncio.CancelledError()) + stream = AsyncKnowledgeBaseRetrievalStream(response=response, raw_stream=raw_stream) + with pytest.raises(asyncio.CancelledError): + await stream.__anext__() + assert response.closed + assert raw_stream.closed + + response = _AsyncResponse() + raw_stream = _AsyncRawStream([b"event: error\ndata: {invalid}\n\n"]) + stream = AsyncKnowledgeBaseRetrievalStream(response=response, raw_stream=raw_stream) + with pytest.raises(json.JSONDecodeError): + await stream.__anext__() + assert response.closed + assert raw_stream.closed + + response = _AsyncResponse() + raw_stream = _AsyncRawStream([]) + async with AsyncKnowledgeBaseRetrievalStream(response=response, raw_stream=raw_stream): + pass + assert response.closed + assert raw_stream.closed + + async def test_client_wraps_generated_stream_and_composes_cls(self): + require_capability( + "azure.search.documents.knowledgebases.aio.KnowledgeBaseRetrievalClient.retrieve_stream", + "AsyncKnowledgeBaseRetrievalStream", + ) + from azure.search.documents.knowledgebases.aio import ( + AsyncKnowledgeBaseRetrievalStream, + KnowledgeBaseRetrievalClient, + ) + from azure.search.documents.knowledgebases.models import KnowledgeBaseRetrievalRequest + + response = _AsyncResponse() + raw_stream = _AsyncRawStream([_frame("response.completed", {"statusCode": 200, "response": {}})]) + pipeline_response = SimpleNamespace(http_response=response) + generated_kwargs = {} + + async def generated_retrieve_stream(_self, _request, **kwargs): + generated_kwargs.update(kwargs) + return kwargs["cls"](pipeline_response, raw_stream, {"content-type": "text/event-stream"}) + + client = KnowledgeBaseRetrievalClient( + ENDPOINT, AzureKeyCredential(KEY), knowledge_base_name=KNOWLEDGE_BASE_NAME + ) + with mock.patch( + "azure.search.documents.knowledgebases.aio._patch._KnowledgeBaseRetrievalClient.retrieve_stream", + new=generated_retrieve_stream, + ): + stream = await client.retrieve_stream( + KnowledgeBaseRetrievalRequest(), + query_source_authorization="query-token", + query_work_iq_source_authorization="work-iq-token", + ) + assert isinstance(stream, AsyncKnowledgeBaseRetrievalStream) + assert generated_kwargs["query_source_authorization"] == "query-token" + assert generated_kwargs["query_work_iq_source_authorization"] == "work-iq-token" + await stream.close() + + observed = {} + + def custom_cls(received_pipeline_response, typed_stream, headers): + observed.update(pipeline_response=received_pipeline_response, stream=typed_stream, headers=headers) + return "custom-result" + + response = _AsyncResponse() + raw_stream = _AsyncRawStream([]) + pipeline_response = SimpleNamespace(http_response=response) + with mock.patch( + "azure.search.documents.knowledgebases.aio._patch._KnowledgeBaseRetrievalClient.retrieve_stream", + new=generated_retrieve_stream, + ): + result = await client.retrieve_stream(KnowledgeBaseRetrievalRequest(), cls=custom_cls) + assert result == "custom-result" + assert isinstance(observed["stream"], AsyncKnowledgeBaseRetrievalStream) + await observed["stream"].close() + + response = _AsyncResponse() + raw_stream = _AsyncRawStream([]) + pipeline_response = SimpleNamespace(http_response=response) + + def raising_cls(_pipeline_response, _typed_stream, _headers): + raise RuntimeError("custom callback failed") + + with mock.patch( + "azure.search.documents.knowledgebases.aio._patch._KnowledgeBaseRetrievalClient.retrieve_stream", + new=generated_retrieve_stream, + ): + with pytest.raises(RuntimeError, match="custom callback failed"): + await client.retrieve_stream(KnowledgeBaseRetrievalRequest(), cls=raising_cls) + assert response.closed + assert raw_stream.closed + await client.close() diff --git a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live.py b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live.py index 850b09fc6944..a502835b66bc 100644 --- a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live.py +++ b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live.py @@ -33,6 +33,13 @@ "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse", "azure.search.documents.knowledgebases.models.KnowledgeRetrievalSemanticIntent", ) +_STREAM_CAPABILITIES = ( + "azure.search.documents.knowledgebases.KnowledgeBaseRetrievalClient.retrieve_stream", + "KnowledgeBaseRetrievalEvent", + "KnowledgeBaseRetrievalStream", + "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalStartedEvent", + "azure.search.documents.knowledgebases.models.KnowledgeBaseResponseCompletedEvent", +) class TestKnowledgeBaseRetrievalClient(AzureRecordedTestCase): @@ -71,3 +78,48 @@ def test_retrieve_returns_knowledge_base_response(self, endpoint: str) -> None: assert isinstance(result, KnowledgeBaseRetrievalResponse) assert hasattr(result, "response") assert hasattr(result, "references") + + @live_test() + def test_retrieve_stream_returns_typed_lifecycle_events(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + *_RETRIEVAL_CAPABILITIES, + *_STREAM_CAPABILITIES, + ) + from azure.search.documents.knowledgebases import KnowledgeBaseRetrievalClient + from azure.search.documents.knowledgebases.models import ( + KnowledgeBaseResponseCompletedEvent, + KnowledgeBaseRetrievalRequest, + KnowledgeBaseRetrievalResponse, + KnowledgeBaseRetrievalStartedEvent, + KnowledgeRetrievalMinimalReasoningEffort, + KnowledgeRetrievalSemanticIntent, + ) + + with knowledge_base_resources( + self, + endpoint, + prefix="knowledge-base-retrieve-stream", + wait_for_active=True, + description=KNOWLEDGE_BASE_RETRIEVAL_DESCRIPTION, + source_description=KNOWLEDGE_SOURCE_RETRIEVAL_DESCRIPTION, + ) as context: + retrieval_request = KnowledgeBaseRetrievalRequest( + intents=[KnowledgeRetrievalSemanticIntent(search=RETRIEVAL_QUERY)], + retrieval_reasoning_effort=KnowledgeRetrievalMinimalReasoningEffort(), + ) + + with KnowledgeBaseRetrievalClient( + endpoint, + credential=context.credential, + knowledge_base_name=context.knowledge_base_name, + ) as client: + with client.retrieve_stream(retrieval_request) as stream: + events = list(stream) + + assert events[0].event_type == "retrieval.started" + assert isinstance(events[0].data, KnowledgeBaseRetrievalStartedEvent) + assert events[-1].event_type == "response.completed" + assert isinstance(events[-1].data, KnowledgeBaseResponseCompletedEvent) + assert isinstance(events[-1].data.response, KnowledgeBaseRetrievalResponse) + assert sum(event.event_type in ("response.completed", "error") for event in events) == 1 diff --git a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live_async.py b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live_async.py index ec1f4890f028..d94afbe04d38 100644 --- a/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_retrieve_live_async.py @@ -33,6 +33,13 @@ "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalResponse", "azure.search.documents.knowledgebases.models.KnowledgeRetrievalSemanticIntent", ) +_STREAM_CAPABILITIES = ( + "azure.search.documents.knowledgebases.aio.KnowledgeBaseRetrievalClient.retrieve_stream", + "KnowledgeBaseRetrievalEvent", + "AsyncKnowledgeBaseRetrievalStream", + "azure.search.documents.knowledgebases.models.KnowledgeBaseRetrievalStartedEvent", + "azure.search.documents.knowledgebases.models.KnowledgeBaseResponseCompletedEvent", +) class TestKnowledgeBaseRetrievalClientAsync(AzureRecordedTestCase): @@ -71,3 +78,49 @@ async def test_retrieve_returns_knowledge_base_response(self, endpoint: str) -> assert isinstance(result, KnowledgeBaseRetrievalResponse) assert hasattr(result, "response") assert hasattr(result, "references") + + @live_test() + async def test_retrieve_stream_returns_typed_lifecycle_events(self, endpoint: str) -> None: + require_capability( + *_KNOWLEDGE_BASE_RESOURCE_CAPABILITIES, + *_RETRIEVAL_CAPABILITIES, + *_STREAM_CAPABILITIES, + ) + from azure.search.documents.knowledgebases.aio import KnowledgeBaseRetrievalClient + from azure.search.documents.knowledgebases.models import ( + KnowledgeBaseResponseCompletedEvent, + KnowledgeBaseRetrievalRequest, + KnowledgeBaseRetrievalResponse, + KnowledgeBaseRetrievalStartedEvent, + KnowledgeRetrievalMinimalReasoningEffort, + KnowledgeRetrievalSemanticIntent, + ) + + async with knowledge_base_resources( + self, + endpoint, + prefix="knowledge-base-retrieve-stream", + wait_for_active=True, + description=KNOWLEDGE_BASE_RETRIEVAL_DESCRIPTION, + source_description=KNOWLEDGE_SOURCE_RETRIEVAL_DESCRIPTION, + ) as context: + retrieval_request = KnowledgeBaseRetrievalRequest( + intents=[KnowledgeRetrievalSemanticIntent(search=RETRIEVAL_QUERY)], + retrieval_reasoning_effort=KnowledgeRetrievalMinimalReasoningEffort(), + ) + + async with KnowledgeBaseRetrievalClient( + endpoint, + credential=context.credential, + knowledge_base_name=context.knowledge_base_name, + ) as client: + stream = await client.retrieve_stream(retrieval_request) + async with stream: + events = [event async for event in stream] + + assert events[0].event_type == "retrieval.started" + assert isinstance(events[0].data, KnowledgeBaseRetrievalStartedEvent) + assert events[-1].event_type == "response.completed" + assert isinstance(events[-1].data, KnowledgeBaseResponseCompletedEvent) + assert isinstance(events[-1].data.response, KnowledgeBaseRetrievalResponse) + assert sum(event.event_type in ("response.completed", "error") for event in events) == 1 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 b42360d19ad0..d06de5be633a 100644 --- a/sdk/search/azure-search-documents/tests/test_search_client.py +++ b/sdk/search/azure-search-documents/tests/test_search_client.py @@ -12,7 +12,12 @@ from azure.core.credentials import AzureKeyCredential from azure.core.paging import ItemPaged -from azure.search.documents import ApiVersion, IndexDocumentsBatch, RequestEntityTooLargeError, SearchClient +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 @@ -93,6 +98,14 @@ def test_constructor_accepts_supported_api_version_enum(self): assert client._config.api_version == ApiVersion.V2020_06_30 + def test_api_version_enum_includes_2026_08_01_preview(self): + assert ApiVersion.V2026_08_01_PREVIEW == "2026-08-01-preview" + + def test_constructor_accepts_2026_08_01_preview_api_version_enum(self): + client = create_search_client(api_version=ApiVersion.V2026_08_01_PREVIEW) + + assert client._config.api_version == "2026-08-01-preview" + class TestSearchRequestBuilding: @mock.patch("azure.search.documents._operations._operations._SearchClientOperationsMixin._search_post") 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 index 08c95aad08f9..ce9222042155 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client.py @@ -61,20 +61,20 @@ class TestListIndexes: "azure.search.documents.indexes._operations._operations._SearchIndexClientOperationsMixin._list_indexes", side_effect=_empty_pager, ) - def test_list_indexes_forwards_top_skip_count(self, mock_list): + def test_list_indexes_forwards_search_paging(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", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.search", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.page_size", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.search_type", ) - list(_client().list_indexes(top=10, skip=5, count=True)) + list(_client().list_indexes(search="hot", page_size=10, search_type="prefix")) mock_list.assert_called_once() kwargs = mock_list.call_args.kwargs - assert kwargs["top"] == 10 - assert kwargs["skip"] == 5 - assert kwargs["count"] is True + assert kwargs["search"] == "hot" + assert kwargs["page_size"] == 10 + assert kwargs["search_type"] == "prefix" @mock.patch( "azure.search.documents.indexes._operations._operations." @@ -83,22 +83,22 @@ def test_list_indexes_forwards_top_skip_count(self, mock_list): ) 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", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.search", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.page_size", + "azure.search.documents.indexes.SearchIndexClient.list_indexes.search_type", "azure.search.documents.indexes.models.SearchIndex.cors_options", "azure.search.documents.indexes.models.SearchIndex.permission_filter_option", "azure.search.documents.indexes.models.SearchIndex.purview_enabled", ) - list(_client().list_indexes(select=["name"], top=3, skip=1, count=False)) + list(_client().list_indexes(select=["name"], search="hot", page_size=3, search_type="prefix")) 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 + assert kwargs["search"] == "hot" + assert kwargs["page_size"] == 3 + assert kwargs["search_type"] == "prefix" converted = kwargs["cls"]([_index_response_stub()]) assert isinstance(converted[0], SearchIndex) assert converted[0].name == "hotels" @@ -109,20 +109,20 @@ class TestListIndexNames: "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): + def test_list_index_names_forwards_search_paging(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", + "azure.search.documents.indexes.SearchIndexClient.list_index_names.search", + "azure.search.documents.indexes.SearchIndexClient.list_index_names.page_size", + "azure.search.documents.indexes.SearchIndexClient.list_index_names.search_type", ) - list(_client().list_index_names(top=20, skip=0, count=True)) + list(_client().list_index_names(search="hot", page_size=20, search_type="prefix")) 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 kwargs["search"] == "hot" + assert kwargs["page_size"] == 20 + assert kwargs["search_type"] == "prefix" # The names projection passes a `cls` callback that maps to .name strings. assert callable(kwargs["cls"]) @@ -185,3 +185,55 @@ def test_delete_knowledge_source_file_forwards_file_id(self, mock_delete): kwargs = mock_delete.call_args.kwargs assert kwargs["name"] == "files-source" assert kwargs["file_id"] == "file-1" + + @mock.patch( + "azure.search.documents.indexes._operations._operations." + "_SearchIndexClientOperationsMixin.update_knowledge_source_file" + ) + def test_update_knowledge_source_file_uses_name_first_and_forwards_by_keyword(self, mock_update): + require_capability("azure.search.documents.indexes.SearchIndexClient.update_knowledge_source_file") + from azure.search.documents.indexes.models import UpdateKnowledgeSourceFileRequest + + body = UpdateKnowledgeSourceFileRequest({"metadata": {"fileName": "updated.txt"}, "content": b"updated"}) + + _client().update_knowledge_source_file("files-source", "file-1", body) + + mock_update.assert_called_once_with(name="files-source", file_id="file-1", body=body) + + +@pytest.mark.parametrize( + ("public_method", "generated_method"), + [ + ("get_synonym_maps", "_get_synonym_maps"), + ("get_data_source_connections", "_get_data_source_connections"), + ("get_indexers", "_get_indexers"), + ("get_skillsets", "_get_skillsets"), + ], +) +def test_custom_list_wrappers_forward_search_paging(public_method, generated_method): + from azure.search.documents.indexes import SearchIndexerClient + + client = _client() if public_method == "get_synonym_maps" else SearchIndexerClient(ENDPOINT, AzureKeyCredential(KEY)) + generated_owner = ( + "_SearchIndexClientOperationsMixin" if public_method == "get_synonym_maps" else "_SearchIndexerClientOperationsMixin" + ) + patch_target = ( + "azure.search.documents.indexes._operations._operations." + f"{generated_owner}.{generated_method}" + ) + + with mock.patch(patch_target, return_value=[]) as mock_list: + result = getattr(client, public_method)( + select=["name"], + search="hot", + page_size=2, + search_type="prefix", + ) + + assert result == [] + mock_list.assert_called_once_with( + select=["name"], + search="hot", + page_size=2, + search_type="prefix", + ) diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live.py b/sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live.py index 839697b1ad19..0e012cd2f1bc 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ """Live tests for ``SearchIndexClient`` alias operations.""" + from __future__ import annotations import pytest diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live_async.py b/sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live_async.py index 79f21e605558..3df5c1e77113 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live_async.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live_async.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ """Async live tests for ``SearchIndexClient`` alias operations.""" + from __future__ import annotations import pytest 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 index 5666e59edfc0..29706ea4777d 100644 --- 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 @@ -62,11 +62,11 @@ def _index_response_stub(name="hotels"): @pytest.mark.asyncio class TestListIndexesAsync: - async def test_list_indexes_forwards_top_skip_count(self): + async def test_list_indexes_forwards_search_paging(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", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.search", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.page_size", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.search_type", ) with mock.patch( @@ -74,21 +74,21 @@ async def test_list_indexes_forwards_top_skip_count(self): "_SearchIndexClientOperationsMixin._list_indexes", side_effect=_empty_async_pager, ) as mock_list: - pager = _client().list_indexes(top=10, skip=5, count=True) + pager = _client().list_indexes(search="hot", page_size=10, search_type="prefix") 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 + assert kwargs["search"] == "hot" + assert kwargs["page_size"] == 10 + assert kwargs["search_type"] == "prefix" 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", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.search", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.page_size", + "azure.search.documents.indexes.aio.SearchIndexClient.list_indexes.search_type", "azure.search.documents.indexes.models.SearchIndex.cors_options", "azure.search.documents.indexes.models.SearchIndex.permission_filter_option", "azure.search.documents.indexes.models.SearchIndex.purview_enabled", @@ -99,16 +99,16 @@ async def test_list_indexes_with_select_forwards_paging_kwargs(self): "_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) + pager = _client().list_indexes(select=["name"], search="hot", page_size=3, search_type="prefix") 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 + assert kwargs["search"] == "hot" + assert kwargs["page_size"] == 3 + assert kwargs["search_type"] == "prefix" converted = kwargs["cls"]([_index_response_stub()]) assert isinstance(converted[0], SearchIndex) assert converted[0].name == "hotels" @@ -116,11 +116,11 @@ async def test_list_indexes_with_select_forwards_paging_kwargs(self): @pytest.mark.asyncio class TestListIndexNamesAsync: - async def test_list_index_names_forwards_top_skip_count(self): + async def test_list_index_names_forwards_search_paging(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", + "azure.search.documents.indexes.aio.SearchIndexClient.list_index_names.search", + "azure.search.documents.indexes.aio.SearchIndexClient.list_index_names.page_size", + "azure.search.documents.indexes.aio.SearchIndexClient.list_index_names.search_type", ) with mock.patch( @@ -128,15 +128,15 @@ async def test_list_index_names_forwards_top_skip_count(self): "_SearchIndexClientOperationsMixin._list_indexes", side_effect=_empty_async_pager, ) as mock_list: - pager = _client().list_index_names(top=20, skip=0, count=True) + pager = _client().list_index_names(search="hot", page_size=20, search_type="prefix") 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 kwargs["search"] == "hot" + assert kwargs["page_size"] == 20 + assert kwargs["search_type"] == "prefix" assert callable(kwargs["cls"]) @@ -202,3 +202,56 @@ async def test_delete_knowledge_source_file_forwards_file_id(self): kwargs = mock_delete.call_args.kwargs assert kwargs["name"] == "files-source" assert kwargs["file_id"] == "file-1" + + async def test_update_knowledge_source_file_uses_name_first_and_forwards_by_keyword(self): + require_capability("azure.search.documents.indexes.aio.SearchIndexClient.update_knowledge_source_file") + from azure.search.documents.indexes.models import UpdateKnowledgeSourceFileRequest + + body = UpdateKnowledgeSourceFileRequest({"metadata": {"fileName": "updated.txt"}, "content": b"updated"}) + with mock.patch( + "azure.search.documents.indexes.aio._operations._operations." + "_SearchIndexClientOperationsMixin.update_knowledge_source_file", + new_callable=mock.AsyncMock, + ) as mock_update: + await _client().update_knowledge_source_file("files-source", "file-1", body) + + mock_update.assert_awaited_once_with(name="files-source", file_id="file-1", body=body) + + +@pytest.mark.asyncio +@pytest.mark.parametrize( + ("public_method", "generated_method"), + [ + ("get_synonym_maps", "_get_synonym_maps"), + ("get_data_source_connections", "_get_data_source_connections"), + ("get_indexers", "_get_indexers"), + ("get_skillsets", "_get_skillsets"), + ], +) +async def test_custom_list_wrappers_forward_search_paging(public_method, generated_method): + from azure.search.documents.indexes.aio import SearchIndexerClient + + client = _client() if public_method == "get_synonym_maps" else SearchIndexerClient(ENDPOINT, AzureKeyCredential(KEY)) + generated_owner = ( + "_SearchIndexClientOperationsMixin" if public_method == "get_synonym_maps" else "_SearchIndexerClientOperationsMixin" + ) + patch_target = ( + "azure.search.documents.indexes.aio._operations._operations." + f"{generated_owner}.{generated_method}" + ) + + with mock.patch(patch_target, side_effect=_empty_async_pager) as mock_list: + result = await getattr(client, public_method)( + select=["name"], + search="hot", + page_size=2, + search_type="prefix", + ) + + assert result == [] + mock_list.assert_called_once_with( + select=["name"], + search="hot", + page_size=2, + search_type="prefix", + ) 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 f5b118b02e0f..b1bbb5e7684a 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 @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ """Live tests for ``SearchIndexClient`` index operations.""" + from __future__ import annotations from datetime import timedelta 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 e1de9580fe7a..89877443eabf 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 @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ """Async live tests for ``SearchIndexClient`` index operations.""" + from __future__ import annotations from datetime import timedelta diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_source_files_live.py b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_source_files_live.py new file mode 100644 index 000000000000..a72122a06398 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_source_files_live.py @@ -0,0 +1,155 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Live tests for synchronous File knowledge source operations.""" + +from __future__ import annotations + +from devtools_testutils import AzureRecordedTestCase + +from _capabilities import require_capability +from _search_helpers import live_test, make_index_client, safe_delete + +_FILE_CAPABILITIES = ( + "azure.search.documents.indexes.SearchIndexClient.create_or_update_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.SearchIndexClient.upload_knowledge_source_file_multipart", + "azure.search.documents.indexes.SearchIndexClient.update_knowledge_source_file", + "azure.search.documents.indexes.SearchIndexClient.list_knowledge_source_files", + "azure.search.documents.indexes.SearchIndexClient.delete_knowledge_source_file", + "azure.search.documents.indexes.models.FileKnowledgeSource", + "azure.search.documents.indexes.models.FileKnowledgeSourceParameters", + "azure.search.documents.indexes.models.FileUploadMetadata", + "azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest", + "azure.search.documents.indexes.models.UploadKnowledgeSourceFileMultipartRequest", + "azure.search.documents.knowledgebases.models.KnowledgeSourceAzureOpenAIVectorizer", + "azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters", +) + + +def _build_file_knowledge_source(name, endpoint, deployment, model): + from azure.search.documents.indexes.models import ( + AzureOpenAIVectorizerParameters, + FileKnowledgeSource, + FileKnowledgeSourceParameters, + ) + from azure.search.documents.knowledgebases.models import ( + KnowledgeSourceAzureOpenAIVectorizer, + KnowledgeSourceIngestionParameters, + ) + + return FileKnowledgeSource( + name=name, + file_parameters=FileKnowledgeSourceParameters( + ingestion_parameters=KnowledgeSourceIngestionParameters( + content_extraction_mode="minimal", + embedding_model=KnowledgeSourceAzureOpenAIVectorizer( + azure_open_ai_parameters=AzureOpenAIVectorizerParameters( + resource_url=endpoint, + deployment_name=deployment, + model_name=model, + ) + ), + ) + ), + ) + + +class TestSearchIndexClientKnowledgeSourceFiles(AzureRecordedTestCase): + @live_test() + def test_multipart_upload_update_list_and_delete( + self, + endpoint: str, + search_azure_openai_endpoint: str, + search_azure_openai_embedding_deployment: str, + search_azure_openai_embedding_model: str, + ) -> None: + require_capability(*_FILE_CAPABILITIES) + from azure.search.documents.indexes.models import ( + FileUploadMetadata, + UpdateKnowledgeSourceFileRequest, + UploadKnowledgeSourceFileMultipartRequest, + ) + + source_name = self.get_resource_name("knowledge-source-files") + primary_id = None + annex_id = None + + with make_index_client(endpoint) as client: + try: + client.create_or_update_knowledge_source( + _build_file_knowledge_source( + source_name, + search_azure_openai_endpoint, + search_azure_openai_embedding_deployment, + search_azure_openai_embedding_model, + ) + ) + + primary_metadata = FileUploadMetadata( + file_name="hotels/primary.txt", + metadata={"category": "hotel", "city": "Seattle"}, + ) + primary = client.upload_knowledge_source_file_multipart( + source_name, + UploadKnowledgeSourceFileMultipartRequest( + metadata=primary_metadata, + content=("primary.txt", b"Historic Harbor Hotel has free parking.", "text/plain"), + ), + ) + primary_id = primary.file_id + assert primary_id is not None + + annex = client.upload_knowledge_source_file_multipart( + source_name, + UploadKnowledgeSourceFileMultipartRequest( + metadata=FileUploadMetadata( + file_name="hotels/annex.txt", + metadata={"category": "hotel", "city": "Portland"}, + ), + content=("annex.txt", b"Harbor Hotel Annex has meeting rooms.", "text/plain"), + ), + ) + annex_id = annex.file_id + assert annex_id is not None + + updated = client.update_knowledge_source_file( + source_name, + primary_id, + UpdateKnowledgeSourceFileRequest( + metadata=primary_metadata, + content=( + "primary.txt", + b"Historic Harbor Hotel has free parking and free Wi-Fi.", + "text/plain", + ), + ), + ) + assert updated.file_id == primary_id + assert updated.metadata == {"category": "hotel", "city": "Seattle"} + + files = list( + client.list_knowledge_source_files( + source_name, + prefix="hotels/", + search="hotels", + page_size=1, + search_type="prefix", + ) + ) + file_ids = [file.file_id for file in files] + assert set(file_ids) == {primary_id, annex_id} + assert len(file_ids) == len(set(file_ids)) + + client.delete_knowledge_source_file(source_name, primary_id) + primary_id = None + client.delete_knowledge_source_file(source_name, annex_id) + annex_id = None + assert list(client.list_knowledge_source_files(source_name, prefix="hotels/")) == [] + finally: + if primary_id is not None: + safe_delete(client.delete_knowledge_source_file, source_name, primary_id) + if annex_id is not None: + safe_delete(client.delete_knowledge_source_file, source_name, annex_id) + safe_delete(client.delete_knowledge_source, source_name) \ No newline at end of file diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_source_files_live_async.py b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_source_files_live_async.py new file mode 100644 index 000000000000..02f25f139341 --- /dev/null +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_source_files_live_async.py @@ -0,0 +1,156 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Live tests for asynchronous File knowledge source operations.""" + +from __future__ import annotations + +from devtools_testutils import AzureRecordedTestCase + +from _capabilities import require_capability +from _search_helpers_async import live_test, make_index_client, safe_delete + +_FILE_CAPABILITIES = ( + "azure.search.documents.indexes.aio.SearchIndexClient.create_or_update_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source", + "azure.search.documents.indexes.aio.SearchIndexClient.upload_knowledge_source_file_multipart", + "azure.search.documents.indexes.aio.SearchIndexClient.update_knowledge_source_file", + "azure.search.documents.indexes.aio.SearchIndexClient.list_knowledge_source_files", + "azure.search.documents.indexes.aio.SearchIndexClient.delete_knowledge_source_file", + "azure.search.documents.indexes.models.FileKnowledgeSource", + "azure.search.documents.indexes.models.FileKnowledgeSourceParameters", + "azure.search.documents.indexes.models.FileUploadMetadata", + "azure.search.documents.indexes.models.UpdateKnowledgeSourceFileRequest", + "azure.search.documents.indexes.models.UploadKnowledgeSourceFileMultipartRequest", + "azure.search.documents.knowledgebases.models.KnowledgeSourceAzureOpenAIVectorizer", + "azure.search.documents.knowledgebases.models.KnowledgeSourceIngestionParameters", +) + + +def _build_file_knowledge_source(name, endpoint, deployment, model): + from azure.search.documents.indexes.models import ( + AzureOpenAIVectorizerParameters, + FileKnowledgeSource, + FileKnowledgeSourceParameters, + ) + from azure.search.documents.knowledgebases.models import ( + KnowledgeSourceAzureOpenAIVectorizer, + KnowledgeSourceIngestionParameters, + ) + + return FileKnowledgeSource( + name=name, + file_parameters=FileKnowledgeSourceParameters( + ingestion_parameters=KnowledgeSourceIngestionParameters( + content_extraction_mode="minimal", + embedding_model=KnowledgeSourceAzureOpenAIVectorizer( + azure_open_ai_parameters=AzureOpenAIVectorizerParameters( + resource_url=endpoint, + deployment_name=deployment, + model_name=model, + ) + ), + ) + ), + ) + + +class TestSearchIndexClientKnowledgeSourceFilesAsync(AzureRecordedTestCase): + @live_test() + async def test_multipart_upload_update_list_and_delete( + self, + endpoint: str, + search_azure_openai_endpoint: str, + search_azure_openai_embedding_deployment: str, + search_azure_openai_embedding_model: str, + ) -> None: + require_capability(*_FILE_CAPABILITIES) + from azure.search.documents.indexes.models import ( + FileUploadMetadata, + UpdateKnowledgeSourceFileRequest, + UploadKnowledgeSourceFileMultipartRequest, + ) + + source_name = self.get_resource_name("knowledge-source-files") + primary_id = None + annex_id = None + + async with make_index_client(endpoint) as client: + try: + await client.create_or_update_knowledge_source( + _build_file_knowledge_source( + source_name, + search_azure_openai_endpoint, + search_azure_openai_embedding_deployment, + search_azure_openai_embedding_model, + ) + ) + + primary_metadata = FileUploadMetadata( + file_name="hotels/primary.txt", + metadata={"category": "hotel", "city": "Seattle"}, + ) + primary = await client.upload_knowledge_source_file_multipart( + source_name, + UploadKnowledgeSourceFileMultipartRequest( + metadata=primary_metadata, + content=("primary.txt", b"Historic Harbor Hotel has free parking.", "text/plain"), + ), + ) + primary_id = primary.file_id + assert primary_id is not None + + annex = await client.upload_knowledge_source_file_multipart( + source_name, + UploadKnowledgeSourceFileMultipartRequest( + metadata=FileUploadMetadata( + file_name="hotels/annex.txt", + metadata={"category": "hotel", "city": "Portland"}, + ), + content=("annex.txt", b"Harbor Hotel Annex has meeting rooms.", "text/plain"), + ), + ) + annex_id = annex.file_id + assert annex_id is not None + + updated = await client.update_knowledge_source_file( + source_name, + primary_id, + UpdateKnowledgeSourceFileRequest( + metadata=primary_metadata, + content=( + "primary.txt", + b"Historic Harbor Hotel has free parking and free Wi-Fi.", + "text/plain", + ), + ), + ) + assert updated.file_id == primary_id + assert updated.metadata == {"category": "hotel", "city": "Seattle"} + + files = [ + file + async for file in client.list_knowledge_source_files( + source_name, + prefix="hotels/", + search="hotels", + page_size=1, + search_type="prefix", + ) + ] + file_ids = [file.file_id for file in files] + assert set(file_ids) == {primary_id, annex_id} + assert len(file_ids) == len(set(file_ids)) + + await client.delete_knowledge_source_file(source_name, primary_id) + primary_id = None + await client.delete_knowledge_source_file(source_name, annex_id) + annex_id = None + assert [file async for file in client.list_knowledge_source_files(source_name, prefix="hotels/")] == [] + finally: + if primary_id is not None: + await safe_delete(client.delete_knowledge_source_file, source_name, primary_id) + if annex_id is not None: + await safe_delete(client.delete_knowledge_source_file, source_name, annex_id) + await safe_delete(client.delete_knowledge_source, source_name) \ No newline at end of file diff --git a/sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live.py b/sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live.py index 0e81944c6f8b..c2f153d9b9b0 100644 --- a/sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live.py +++ b/sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ """Live tests for ``SearchIndexClient`` synonym map operations.""" + from __future__ import annotations import pytest 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 1d6744a6a503..7a2cc5cc9b0c 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 @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ """Async live tests for ``SearchIndexClient`` synonym map operations.""" + from __future__ import annotations import pytest 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 2281186ae7bc..56fa6ae6c16b 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 @@ -14,7 +14,6 @@ SimpleField, ) - INDEX_NAME = "hotels" 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 7ea6774019d5..9dcb2075336b 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 @@ -29,7 +29,6 @@ from _capabilities import require_capability - DATA_SOURCE_NAME = "hotel-data-source" CONNECTION_STRING = ( "ResourceId=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/search/" diff --git a/sdk/search/azure-search-documents/tsp-location.yaml b/sdk/search/azure-search-documents/tsp-location.yaml index 0d61dee0e1df..372652855f81 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: 8be8c75d9bb11ea95d8a7e251db74aa78b5cd76c +commit: c195a3fe73b28cd90bf8a302944b2c0ec3d80def repo: Azure/azure-rest-api-specs