Skip to content

Conversation

@catalinaperalta
Copy link
Member

@catalinaperalta catalinaperalta commented Mar 6, 2025

Fix polling and deserialization for copy operations. Using the same logic that we used in the azure-ai-formrecognizer sdk.

Follow up issue: #39974

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@catalinaperalta catalinaperalta marked this pull request as ready for review March 7, 2025 20:37
Copilot AI review requested due to automatic review settings March 7, 2025 20:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR fixes the polling behavior and deserialization for copy operations in the Document Intelligence SDK. Key changes include updating the changelog for version 1.0.1, modifying synchronous polling and deserialization logic, and applying similar changes in the asynchronous patch to incorporate the new DocumentModelAdministrationPolling.

Reviewed Changes

File Description
sdk/documentintelligence/azure-ai-documentintelligence/CHANGELOG.md Added changelog entry for version 1.0.1 with details on the polling fix.
sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_operations/_patch.py Introduced DocumentModelAdministrationPolling and updated deserialization and polling method construction.
sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_operations/_patch.py Updated asynchronous polling and deserialization logic to match the synchronous changes.

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

Comments suppressed due to low confidence (2)

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_operations/_patch.py:298

  • Ensure that the 'result' key exists in the response JSON before deserialization to avoid a potential KeyError.
deserialized = _deserialize(_models.DocumentModelDetails, response.json()["result"])

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/aio/_operations/_patch.py:268

  • Consider verifying the presence of the 'result' key in the response JSON to prevent runtime errors during deserialization.
deserialized = _deserialize(_models.DocumentModelDetails, response.json()["result"])

@catalinaperalta catalinaperalta merged commit 7f21254 into main Mar 7, 2025
21 checks passed
@catalinaperalta catalinaperalta deleted the di-copy-fix branch March 7, 2025 22:22
allenkim0129 pushed a commit to allenkim0129/azure-sdk-for-python that referenced this pull request Mar 11, 2025
* fix polling for copy operation

* update changelog

* update changelog

* async operation

* update changelog date

* pylint

---------

Co-authored-by: catalinaperalta <caperal@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants