From 5ccfd9bb824732ee1da22ef86631d7ef644d0261 Mon Sep 17 00:00:00 2001 From: anhtnt90dev <124683165+anhtnt90dev@users.noreply.github.com> Date: Wed, 27 May 2026 01:28:28 +0700 Subject: [PATCH 1/3] Clarify update analyzer sample docs --- .../azure-ai-contentunderstanding/samples/README.md | 4 ++-- .../async_samples/sample_update_analyzer_async.py | 10 +++++++--- .../samples/sample_update_analyzer.py | 10 +++++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/README.md b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/README.md index 0c01125e5cec..ce0211fd72f1 100644 --- a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/README.md +++ b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/README.md @@ -119,13 +119,13 @@ Lists all available analyzers in your Microsoft Foundry resource. Shows how to d ### Sample 08: Update Analyzer #### `sample_update_analyzer.py` / `sample_update_analyzer_async.py` -Updates an existing custom analyzer's description and tags. Shows how to modify analyzer properties. +Updates an existing custom analyzer's description and tags. Only `description` and `tags` can be updated with `update_analyzer`; use `begin_create_analyzer` with `allow_replace=True` to change create-only properties such as `models`, `field_schema`, `config`, `base_analyzer_id`, `dynamic_field_schema`, `processing_location`, or `knowledge_sources`. **Key concepts:** - Updating analyzer description - Adding, updating, and removing tags - Verifying analyzer updates -- Modifying analyzer properties +- Replacing create-only analyzer properties with `begin_create_analyzer(..., allow_replace=True)` ### Sample 09: Delete Analyzer diff --git a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/async_samples/sample_update_analyzer_async.py b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/async_samples/sample_update_analyzer_async.py index 84fefbc0d401..8a59881fc862 100644 --- a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/async_samples/sample_update_analyzer_async.py +++ b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/async_samples/sample_update_analyzer_async.py @@ -11,11 +11,14 @@ This sample demonstrates how to update an existing custom analyzer, including updating its description and tags. - The update_analyzer method allows you to modify certain properties of an existing analyzer. - The following properties can be updated: + The update_analyzer method allows you to modify only these properties of an existing analyzer: - Description: Update the analyzer's description - Tags: Add or update tags + To change create-only properties such as models, field_schema, config, base_analyzer_id, + dynamic_field_schema, processing_location, or knowledge_sources, use begin_create_analyzer + with allow_replace=True. + USAGE: python sample_update_analyzer_async.py @@ -94,7 +97,8 @@ async def main() -> None: tags_str = ", ".join(f"{k}={v}" for k, v in current_analyzer.tags.items()) print(f" Tags: {tags_str}") - # Create an updated analyzer with new description and tags + # Create an updated analyzer with the properties supported by update_analyzer. + # Other analyzer properties are create-only and require begin_create_analyzer(..., allow_replace=True). updated_analyzer = ContentAnalyzer( base_analyzer_id=current_analyzer.base_analyzer_id, description="Updated description", diff --git a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/sample_update_analyzer.py b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/sample_update_analyzer.py index 70b1410f419f..3febf4920612 100644 --- a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/sample_update_analyzer.py +++ b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/sample_update_analyzer.py @@ -11,11 +11,14 @@ This sample demonstrates how to update an existing custom analyzer, including updating its description and tags. - The update_analyzer method allows you to modify certain properties of an existing analyzer. - The following properties can be updated: + The update_analyzer method allows you to modify only these properties of an existing analyzer: - Description: Update the analyzer's description - Tags: Add or update tags + To change create-only properties such as models, field_schema, config, base_analyzer_id, + dynamic_field_schema, processing_location, or knowledge_sources, use begin_create_analyzer + with allow_replace=True. + USAGE: python sample_update_analyzer.py @@ -92,7 +95,8 @@ def main() -> None: tags_str = ", ".join(f"{k}={v}" for k, v in current_analyzer.tags.items()) print(f" Tags: {tags_str}") - # Create an updated analyzer with new description and tags + # Create an updated analyzer with the properties supported by update_analyzer. + # Other analyzer properties are create-only and require begin_create_analyzer(..., allow_replace=True). updated_analyzer = ContentAnalyzer( base_analyzer_id=current_analyzer.base_analyzer_id, description="Updated description", From 0dc8bb3beb1034187281e97b099ff22e083ce766 Mon Sep 17 00:00:00 2001 From: anhtnt90dev <124683165+anhtnt90dev@users.noreply.github.com> Date: Thu, 28 May 2026 17:57:53 +0700 Subject: [PATCH 2/3] Stabilize content understanding playback URLs --- .../azure-ai-contentunderstanding/tests/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk/contentunderstanding/azure-ai-contentunderstanding/tests/conftest.py b/sdk/contentunderstanding/azure-ai-contentunderstanding/tests/conftest.py index 70599b28e003..194281c87674 100644 --- a/sdk/contentunderstanding/azure-ai-contentunderstanding/tests/conftest.py +++ b/sdk/contentunderstanding/azure-ai-contentunderstanding/tests/conftest.py @@ -111,6 +111,11 @@ def add_sanitizers(test_proxy): value="https://Sanitized.services.ai.azure.com", regex=r"https://[a-zA-Z0-9\-]+\.services\.ai\.azure\.com", ) + # Keep playback stable when recorded endpoints include a trailing slash. + add_uri_regex_sanitizer( + regex=r"//contentunderstanding", + value="/contentunderstanding", + ) # Sanitize Ocp-Apim-Subscription-Key header (where the API key is sent) add_header_regex_sanitizer(key="Ocp-Apim-Subscription-Key", value="fake-api-key", regex=".*") From ef1541a48e7f486640e6abe3c620ac2e84c1538a Mon Sep 17 00:00:00 2001 From: anhtnt90dev <124683165+anhtnt90dev@users.noreply.github.com> Date: Thu, 28 May 2026 17:59:29 +0700 Subject: [PATCH 3/3] Clarify update analyzer base analyzer guidance --- .../azure-ai-contentunderstanding/samples/README.md | 6 +++++- .../samples/async_samples/sample_update_analyzer_async.py | 8 +++++--- .../samples/sample_update_analyzer.py | 8 +++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/README.md b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/README.md index ce0211fd72f1..54518fa86d02 100644 --- a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/README.md +++ b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/README.md @@ -119,7 +119,11 @@ Lists all available analyzers in your Microsoft Foundry resource. Shows how to d ### Sample 08: Update Analyzer #### `sample_update_analyzer.py` / `sample_update_analyzer_async.py` -Updates an existing custom analyzer's description and tags. Only `description` and `tags` can be updated with `update_analyzer`; use `begin_create_analyzer` with `allow_replace=True` to change create-only properties such as `models`, `field_schema`, `config`, `base_analyzer_id`, `dynamic_field_schema`, `processing_location`, or `knowledge_sources`. +Updates an existing custom analyzer's description and tags. Only `description` and `tags` can be updated +with `update_analyzer`. Use `begin_create_analyzer` with `allow_replace=True` to change create-only +properties such as `models`, `field_schema`, `config`, `dynamic_field_schema`, `processing_location`, or +`knowledge_sources`. If `base_analyzer_id` is included in an update request, it must match the existing +analyzer. **Key concepts:** - Updating analyzer description diff --git a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/async_samples/sample_update_analyzer_async.py b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/async_samples/sample_update_analyzer_async.py index 8a59881fc862..9d866fe20cda 100644 --- a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/async_samples/sample_update_analyzer_async.py +++ b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/async_samples/sample_update_analyzer_async.py @@ -15,9 +15,10 @@ - Description: Update the analyzer's description - Tags: Add or update tags - To change create-only properties such as models, field_schema, config, base_analyzer_id, + To change create-only properties such as models, field_schema, config, dynamic_field_schema, processing_location, or knowledge_sources, use begin_create_analyzer - with allow_replace=True. + with allow_replace=True. If base_analyzer_id is included in an update request, it must + match the existing analyzer. USAGE: python sample_update_analyzer_async.py @@ -98,7 +99,8 @@ async def main() -> None: print(f" Tags: {tags_str}") # Create an updated analyzer with the properties supported by update_analyzer. - # Other analyzer properties are create-only and require begin_create_analyzer(..., allow_replace=True). + # Keep base_analyzer_id unchanged; other create-only properties require + # begin_create_analyzer(..., allow_replace=True). updated_analyzer = ContentAnalyzer( base_analyzer_id=current_analyzer.base_analyzer_id, description="Updated description", diff --git a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/sample_update_analyzer.py b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/sample_update_analyzer.py index 3febf4920612..f72b89fe32a8 100644 --- a/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/sample_update_analyzer.py +++ b/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/sample_update_analyzer.py @@ -15,9 +15,10 @@ - Description: Update the analyzer's description - Tags: Add or update tags - To change create-only properties such as models, field_schema, config, base_analyzer_id, + To change create-only properties such as models, field_schema, config, dynamic_field_schema, processing_location, or knowledge_sources, use begin_create_analyzer - with allow_replace=True. + with allow_replace=True. If base_analyzer_id is included in an update request, it must + match the existing analyzer. USAGE: python sample_update_analyzer.py @@ -96,7 +97,8 @@ def main() -> None: print(f" Tags: {tags_str}") # Create an updated analyzer with the properties supported by update_analyzer. - # Other analyzer properties are create-only and require begin_create_analyzer(..., allow_replace=True). + # Keep base_analyzer_id unchanged; other create-only properties require + # begin_create_analyzer(..., allow_replace=True). updated_analyzer = ContentAnalyzer( base_analyzer_id=current_analyzer.base_analyzer_id, description="Updated description",