Skip to content

[AutoPR azure-ai-contentsafety]-generated-from-SDK Generation - Python-6640811 - #48375

Open
azure-sdk-automation[bot] wants to merge 6 commits into
mainfrom
sdkauto/azure-ai-contentsafety-6640811
Open

[AutoPR azure-ai-contentsafety]-generated-from-SDK Generation - Python-6640811#48375
azure-sdk-automation[bot] wants to merge 6 commits into
mainfrom
sdkauto/azure-ai-contentsafety-6640811

Conversation

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

Configurations: 'specification/cognitiveservices/ContentSafety/tspconfig.yaml', API Version: 2026-07-01-preview, SDK Release Type: beta, and CommitSHA: '829ccecea7e9c1609881104b9a8d0f8cb65ce644' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6640811 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. Release plan link: https://azsdk-releaseplan-dashboard-hveph5aqhhcfhtgu.westus-01.azurewebsites.net/?releaseplan=2242 Submitted by: Connor.Wood@microsoft.com

…fig.yaml', API Version: 2026-07-01-preview, SDK Release Type: beta, and CommitSHA: '829ccecea7e9c1609881104b9a8d0f8cb65ce644' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6640811 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.
Copilot AI review requested due to automatic review settings July 30, 2026 17:21
@azure-sdk-automation
azure-sdk-automation Bot requested a review from mengaims as a code owner July 30, 2026 17:21
@azure-sdk-automation azure-sdk-automation Bot added the auto-release When merged to main, release pipelines for this PR's changed packages trigger automatically. label Jul 30, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.

Updates the azure-ai-contentsafety Python SDK to a newer REST spec commit and regenerates the client to include new preview APIs (Content Provenance, Shield Prompt, protected material), along with modernized packaging metadata.

Changes:

  • Bumps generated code/spec commit and package version to 1.1.0b1, adding Content Provenance Detection, Shield Prompt, and protected-material APIs.
  • Migrates packaging from setup.py/sdk_packaging.toml to PEP 621 pyproject.toml and updates dependencies / supported Python versions.
  • Adds generated samples/tests plus new sanitizer setup for recordings.

Reviewed changes

Copilot reviewed 62 out of 63 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml Updates swagger/spec commit reference; adjusts additional directory config.
sdk/contentsafety/azure-ai-contentsafety/tests/conftest.py Minor formatting change in test proxy fixture file.
sdk/contentsafety/azure-ai-contentsafety/setup.py Removes legacy setuptools build script (migration to pyproject).
sdk/contentsafety/azure-ai-contentsafety/sdk_packaging.toml Removes old packaging config (moved into pyproject).
sdk/contentsafety/azure-ai-contentsafety/samples/sample_manage_blocklist.py Adds pylint disables for generated-sample linting.
sdk/contentsafety/azure-ai-contentsafety/pyproject.toml Introduces PEP 621 metadata / build-system; moves packaging config.
sdk/contentsafety/azure-ai-contentsafety/generated_tests/testpreparer_async.py Adds generated async test base/preparer helpers.
sdk/contentsafety/azure-ai-contentsafety/generated_tests/testpreparer.py Adds generated sync test base/preparer helpers.
sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_safety_async.py Adds generated async tests (currently skipped).
sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_safety.py Adds generated sync tests (currently skipped).
sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_provenance_async.py Adds generated async tests for provenance APIs (skipped).
sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_provenance.py Adds generated sync tests for provenance APIs (skipped).
sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_blocklist_async.py Adds generated async tests for blocklist APIs (skipped).
sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_blocklist.py Adds generated sync tests for blocklist APIs (skipped).
sdk/contentsafety/azure-ai-contentsafety/generated_tests/conftest.py Adds sanitizer/test-proxy setup for generated recordings.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/shield_prompt.py Adds generated sample for Shield Prompt API.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/remove_blocklist_items.py Adds generated sample for removing blocklist items.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/provenance_get_operation_status.py Adds generated sample for querying provenance LRO status.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/provenance_detect.py Adds generated sample for starting provenance detection LRO.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/list_text_blocklists.py Adds generated sample for listing blocklists.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/list_text_blocklist_items.py Adds generated sample for listing blocklist items.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/get_text_blocklist_item.py Adds generated sample for fetching a blocklist item.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/get_text_blocklist.py Adds generated sample for fetching a blocklist.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/detect_text_protected_material.py Adds generated sample for protected-material detection API.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/delete_text_blocklist.py Adds generated sample for deleting a blocklist.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/create_or_update_text_blocklist.py Adds generated sample for creating/updating a blocklist.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/analyze_text.py Adds generated sample for text analysis API.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/analyze_image.py Adds generated sample for image analysis API.
sdk/contentsafety/azure-ai-contentsafety/generated_samples/add_or_update_blocklist_items.py Adds generated sample for adding/updating blocklist items.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/types.py Adds TypedDict request/shape types for the public surface.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_patch.py Updates patch header and __all__ typing style.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_models.py Regenerates models, adds provenance + shield/protected-material models, migrates model base/util imports.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_enums.py Adds provenance/polling enums; improves enum docstrings.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/init.py Exposes new models/enums and updates import/patch mechanics.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_vendor.py Removes legacy typing-only vendor mixins (replaced by shared utils).
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_patch.py Updates patch header and __all__ typing style.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_operations/_patch.py Updates patch header and __all__ typing style.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_operations/_operations.py Adds provenance/shield/protected-material ops; refactors mixins and streaming/decompression handling.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_operations/init.py Updates exports/import pattern for operations mixins.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_configuration.py Adds ContentProvenance config; updates api version defaults.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/_client.py Adds async ContentProvenanceClient and refactors mixin inheritance; adds Self typing.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/aio/init.py Exposes ContentProvenanceClient from aio namespace.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_version.py Bumps package version to 1.1.0b1.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_vendor.py Removes legacy typing-only vendor mixins (replaced by shared utils).
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_validation.py Adds API-version gating decorator used by new preview operations.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_utils/utils.py Adds shared internal ClientMixin ABC to replace vendor files.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_utils/init.py Adds utils package init for internal helpers.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_patch.py Updates patch header and __all__ typing style.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_operations/_patch.py Updates patch header and __all__ typing style.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_operations/init.py Updates exports/import pattern for operations mixins.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_model_base.py Removes legacy model base implementation (replaced by new utils model base).
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_configuration.py Adds ContentProvenance config; updates api version defaults.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_client.py Adds sync ContentProvenanceClient and refactors mixin inheritance; adds Self typing.
sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/init.py Exposes ContentProvenanceClient from sync namespace.
sdk/contentsafety/azure-ai-contentsafety/apiview-properties.json Adds APIView cross-language metadata mappings for new surface area.
sdk/contentsafety/azure-ai-contentsafety/api.metadata.yml Adds API parser metadata captured during generation.
sdk/contentsafety/azure-ai-contentsafety/api.md Adds regenerated API signature document for review/validation.
sdk/contentsafety/azure-ai-contentsafety/_metadata.json Adds generation metadata (api version, emitter version, spec commit).
sdk/contentsafety/azure-ai-contentsafety/MANIFEST.in Minor formatting update.
sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md Adds 1.1.0b1 entry placeholder text.
Comments suppressed due to low confidence (5)

sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml:1

  • additionalDirectories: is now an explicit null value, whereas previously it was an empty list ([]). If tooling expects a list, this can break spec resolution; set this back to additionalDirectories: [] (or provide a proper YAML list).
    sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:1
  • PEP 621 project.license is not a plain string; it should be a table (e.g., license = { text = \"MIT\" }) or license = { file = \"LICENSE\" }. As-is, some build backends may reject this metadata.
    sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:1
  • [tool.setuptools.package-data] keys must be package names (or \"*\"), not an arbitrary label. This likely prevents py.typed from being included in the built wheel. Use the actual package (e.g. azure.ai.contentsafety) or \"*\" to include py.typed.
    sdk/contentsafety/azure-ai-contentsafety/generated_samples/analyze_text.py:1
  • Using bool as a sample value will serialize as a Python type object and will fail JSON serialization (TypeError: Object of type type is not JSON serializable) if the sample is run. Replace with a real boolean placeholder (e.g. True/False) to keep samples runnable.
    sdk/contentsafety/azure-ai-contentsafety/generated_samples/shield_prompt.py:1
  • These samples construct clients with credential as a plain string, but the SDK expects an AzureKeyCredential or token credential type. Update the sample to show correct credential creation (e.g. AzureKeyCredential(...) or DefaultAzureCredential()), otherwise the sample will fail at runtime.

Comment on lines +30 to +62
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
# this assumes the client has an _api_version attribute
client = args[0]
client_api_version = client._config.api_version # pylint: disable=protected-access
except AttributeError:
return func(*args, **kwargs)

if _index_with_default(method_added_on) > _index_with_default(client_api_version):
raise ValueError(
f"'{func.__name__}' is not available in API version "
f"{client_api_version}. Pass service API version {method_added_on} or newer to your client."
)

unsupported = {
parameter: api_version
for api_version, parameters in params_added_on.items()
for parameter in parameters
if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version)
}
if unsupported:
raise ValueError(
"".join(
[
f"'{param}' is not available in API version {client_api_version}. "
f"Use service API version {version} or newer.\n"
for param, version in unsupported.items()
]
)
)
return func(*args, **kwargs)
Comment on lines +130 to +133
"""Analyze Image.

A synchronous API for the analysis of potentially harmful image content. Currently, it supports
four categories: Hate, SelfHarm, Sexual, and Violence.
Comment on lines +3 to +5
## 1.1.0b1 (2026-07-30)

skip changelog generation for data-plane package and please add changelog manually.
@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings July 31, 2026 06:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 61 out of 62 changed files in this pull request and generated no new comments.

Suppressed comments (6)

sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:16

  • The release version is 1.1.0b1, but this metadata advertises the distribution as Production/Stable. Beta package versions in this repository use Development Status :: 4 - Beta (for example, sdk/search/azure-search-documents/pyproject.toml:20), so PyPI metadata would otherwise misrepresent this release.
    sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:26
  • This raises the minimum Python version from 3.7 to 3.10, but the new changelog entry does not disclose that 3.7–3.9 support is dropped, and README.md:21 still says Python 3.7 is supported. Update both user-facing documents so affected users are warned before upgrading.
    sdk/contentsafety/azure-ai-contentsafety/generated_tests/test_content_provenance.py:14
  • This class-level skip leaves both new provenance operations entirely untested; the existing package tests cover only Content Safety and Blocklist clients, while the async generated counterpart is also skipped. Add runnable sync and async coverage for starting, polling, and retrieving a provenance operation before releasing the new client.
    sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/types.py:201
  • blocklistItemId is service-generated and read-only (the generated model also gives it visibility=["read"]), so requiring it in this request TypedDict rejects valid request dictionaries during type checking and led the generated sample to send a fabricated ID. Exclude the read-only field from the input shape and update the generated API artifacts/sample accordingly.
    sdk/contentsafety/azure-ai-contentsafety/CHANGELOG.md:12
  • The release also exposes the new DetectOutcome enum, but this enum list omits it. Include it so the release notes accurately describe the provenance API surface.
- Added enums `DetectedProvenanceType` and `ProvenanceOperationKind`.

sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_models.py:786

  • The public model documentation uses the plural “properties” after the singular article “An.” Fix the source description to “An optional property…” and regenerate so the duplicate generated docstrings stay consistent.

Copilot AI review requested due to automatic review settings July 31, 2026 06:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 61 out of 62 changed files in this pull request and generated no new comments.

Suppressed comments (5)

sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:1

  • [tool.setuptools.package-data] keys are package names, but pytyped is not a package. This will likely prevent py.typed from being included in the built wheel/sdist. Use the actual package name key (e.g., azure.ai.contentsafety) for the py.typed entry so typing markers are shipped correctly.
    sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/models/_models.py:1
  • ODataV4Format is referenced in docstrings/types as azure.core.ODataV4Format, but it's imported from azure.core.exceptions. This is likely an import-path bug that can raise ImportError at runtime. Import ODataV4Format from the correct azure.core module/path that actually defines it (and keep the annotation consistent).
    sdk/contentsafety/azure-ai-contentsafety/tsp-location.yaml:1
  • additionalDirectories: is now present without a value, which parses as null (not a list). Tooling that expects a list (previously []) can break. Set it explicitly to an empty list (additionalDirectories: []) or provide the intended list values.
    sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/types.py:1
  • The TypedDict field is named blocklistItems, but the docstring documents blocklist_items. This mismatch makes the public typing/docs confusing. Update the docstring to document the actual key name(s) supported by the TypedDict (blocklistItems, and optionally any snake_case alias if intentionally supported).
    sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_validation.py:36
  • api_version_validation always wraps with a sync def wrapper, even when decorating async def APIs. When stacked with @distributed_trace_async, this can break coroutine detection/async tracing behavior because the wrapped callable is no longer an iscoroutinefunction. Consider generating an async def wrapper when func is async (e.g., via inspect.iscoroutinefunction(func)) and await func(...) to preserve async semantics and tracing compatibility.
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            try:
                # this assumes the client has an _api_version attribute
                client = args[0]
                client_api_version = client._config.api_version  # pylint: disable=protected-access

@github-actions

This comment has been minimized.

Copilot AI review requested due to automatic review settings July 31, 2026 15:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 61 out of 62 changed files in this pull request and generated no new comments.

Suppressed comments (3)

sdk/contentsafety/azure-ai-contentsafety/pyproject.toml:16

  • This release is explicitly beta and _version.py sets 1.1.0b1, but this classifier advertises the distribution as production/stable on package indexes. Use the Beta classifier, as other beta packages do (for example sdk/search/azure-search-documents/pyproject.toml:20 and sdk/identity/azure-identity/pyproject.toml:15).
    sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/types.py:201
  • blocklistItemId is server-generated and read-only in the source contract, yet this request TypedDict makes it required. Consequently, the dictionary overload cannot type-check the valid create shape used by the existing model-based tests without supplying a read-only value, and plain dictionaries will serialize that value instead of filtering it. Generate a request shape that omits this read-only property (and refresh the derived API snapshot/samples).
    sdk/contentsafety/azure-ai-contentsafety/azure/ai/contentsafety/_client.py:120
  • The maintained test suite covers the existing clients but has no executable coverage for this new provenance client or its LRO behavior. Add sync coverage for begin_detect/polling and get_operation_status (and async coverage where supported), including response deserialization and failure paths, before releasing the new API.
class ContentProvenanceClient(_ContentProvenanceClientOperationsMixin):

@github-actions

Copy link
Copy Markdown
Contributor
[Pilot] PR Pipeline Failure Analysis

A CI pipeline failed on this pull request. Here is an automated analysis of what went wrong and how to get the build green.

What failed

Two categories of failures were detected in the pipeline run:

  1. Validation failure (verifysdist)azure-ai-contentsafety version 1.1.0b1 is a beta release but its package classifier is set to Development Status :: 5 - Production/Stable. The tool expected Development Status :: 4 - Beta. This caused the verifysdist check to fail with exit code 1.

  2. Test failures — The full TestBlocklistCase and TestContentSafetyCase test suites failed across all platforms (macOS Python 3.11, Ubuntu Python 3.10/3.13/3.14, Windows Python 3.12) in sdist, whl, and mindependency configurations (12 tests × multiple platforms).

Both failures share the same root cause: the package metadata (pyproject.toml) appears to declare a stable classifier while the version is a beta (b1), and the tests may be failing downstream as a result of the broken package installation/configuration.

Recommended next steps

  • Fix the classifier mismatch: In sdk/contentsafety/azure-ai-contentsafety/pyproject.toml, change the classifiers entry from "Development Status :: 5 - Production/Stable" to "Development Status :: 4 - Beta", and ensure is_stable = false is set (per SDK conventions for bN versions).
  • Re-run the pipeline after the fix to confirm the verifysdist check and tests pass.
  • See the CI troubleshooting guide: https://aka.ms/ci-fix
  • Push new commits to address the failures; this comment updates automatically on the next failing run.
Raw pipeline analysis (azsdk ci analyze)
Failed Tests: 12 tests in TestBlocklistCase and TestContentSafetyCase across all platforms
(macOS311, Ubuntu2404_310/313/314, ubuntu2404_310_coverage, windows2022_312)
in sdist, whl, and mindependency configurations.

Failed Tasks:
  verifysdist FAIL(1) for azure-ai-contentsafety

Key error from verifysdist:
  azure-ai-contentsafety has version 1.1.0b1 and is a beta release,
  but has development status 'Development Status :: 5 - Production/Stable'.
  Expected 'Development Status :: 4 - Beta' ONLY.

Pipeline: https://dev.azure.com/azure-sdk/public/_build/results?buildId=6645596

@copilot Copilot detected the failing pipeline and generated the analysis above. To have it attempt a fix automatically, reply with `@copilot please fix the failing pipeline on this PR`.

Generated by Pipeline Analysis - Next Steps · 31.6 AIC · ⌖ 6.1 AIC · ⊞ 6.6K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-release When merged to main, release pipelines for this PR's changed packages trigger automatically. Cognitive - Content Safety

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants