Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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",
Expand Down
Loading