diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md index d853440eb951..4d96ae9573ca 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md @@ -7,10 +7,12 @@ ### Breaking Changes - Renamed `begin_create_composed_model()` on `DocumentModelAdministrationClient` to `begin_compose_model()`. -- Renamed `get_account_info()` on `DocumentModelAdministrationClient` to `get_resource_info()`. -- Renamed `AccountInfo` model to `ResourceInfo`. +- Renamed `get_account_info()` on `DocumentModelAdministrationClient` to `get_resource_details()`. +- Renamed `AccountInfo` model to `ResourceDetails`. - Renamed `DocumentModelInfo` model to `DocumentModelSummary`. -- Renamed `DocumentModel` to `DocumentModelInfo`. +- Renamed `DocumentModel` to `DocumentModelDetails`. +- Renamed `ModelOperation` to `ModelOperationDetails`. +- Renamed `ModelOperationInfo` to `ModelOperationSummary`. - Renamed `model` parameter to `model_id` on `begin_analyze_document()` and `begin_analyze_document_from_url()`. - Removed `continuation_token` keyword from `begin_analyze_document()` and `begin_analyze_document_from_url()` on `DocumentAnalysisClient` and from `begin_build_model()`, `begin_compose_model()` and `begin_copy_model_to()` on `DocumentModelAdministrationClient`. - Changed return type of `get_copy_authorization()` from `dict[str, str]` to `TargetAuthorization`. diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md index f911602b695d..88a5daf36748 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md @@ -166,7 +166,7 @@ More information about analyzing documents, including supported features, locale ### DocumentModelAdministrationClient `DocumentModelAdministrationClient` provides operations for: -- Building custom models to analyze specific fields you specify by labeling your custom documents. A `DocumentModelInfo` is returned indicating the document type(s) the model can analyze, as well as the estimated confidence for each field. See the [service documentation][fr-build-model] for a more detailed explanation. +- Building custom models to analyze specific fields you specify by labeling your custom documents. A `DocumentModelDetails` is returned indicating the document type(s) the model can analyze, as well as the estimated confidence for each field. See the [service documentation][fr-build-model] for a more detailed explanation. - Creating a composed model from a collection of existing models. - Managing models created in your account. - Listing document model operations or getting a specific model operation created within the last 24 hours. @@ -518,7 +518,7 @@ credential = AzureKeyCredential("") document_model_admin_client = DocumentModelAdministrationClient(endpoint, credential) -account_info = document_model_admin_client.get_resource_info() +account_info = document_model_admin_client.get_resource_details() print("Our account has {} custom models, and we can have at most {} custom models".format( account_info.document_model_count, account_info.document_model_limit )) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py index 935f310ae704..516e2a115865 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py @@ -55,12 +55,12 @@ DocumentTable, DocumentTableCell, DocumentWord, - ModelOperationInfo, - ModelOperation, - DocumentModelInfo, + ModelOperationSummary, + ModelOperationDetails, + DocumentModelDetails, DocumentModelSummary, DocTypeInfo, - ResourceInfo, + ResourceDetails, DocumentAnalysisError, DocumentAnalysisInnerError, TargetAuthorization, @@ -120,13 +120,13 @@ "DocumentTableCell", "DocumentWord", "DocumentModelAdministrationLROPoller", - "ModelOperationInfo", - "ModelOperation", + "ModelOperationSummary", + "ModelOperationDetails", "DocumentAnalysisApiVersion", - "DocumentModelInfo", + "DocumentModelDetails", "DocumentModelSummary", "DocTypeInfo", - "ResourceInfo", + "ResourceDetails", "DocumentAnalysisError", "DocumentAnalysisInnerError", "TargetAuthorization", diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_document_model_administration_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_document_model_administration_client.py index 92913692764f..1c6b6f00b168 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_document_model_administration_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_document_model_administration_client.py @@ -26,11 +26,11 @@ from ._document_analysis_client import DocumentAnalysisClient from ._models import ( DocumentBuildMode, - DocumentModelInfo, + DocumentModelDetails, DocumentModelSummary, - ModelOperation, - ModelOperationInfo, - ResourceInfo, + ModelOperationDetails, + ModelOperationSummary, + ResourceDetails, TargetAuthorization, ) @@ -94,7 +94,7 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, TokenCre @distributed_trace def begin_build_model( self, source: str, build_mode: Union[str, DocumentBuildMode], **kwargs: Any - ) -> DocumentModelAdministrationLROPoller[DocumentModelInfo]: + ) -> DocumentModelAdministrationLROPoller[DocumentModelDetails]: """Build a custom model. The request must include a `source` parameter that is an @@ -119,8 +119,8 @@ def begin_build_model( :keyword tags: List of user defined key-value tag attributes associated with the model. :paramtype tags: dict[str, str] :return: An instance of an DocumentModelAdministrationLROPoller. Call `result()` on the poller - object to return a :class:`~azure.ai.formrecognizer.DocumentModelInfo`. - :rtype: ~azure.ai.formrecognizer.DocumentModelAdministrationLROPoller[DocumentModelInfo] + object to return a :class:`~azure.ai.formrecognizer.DocumentModelDetails`. + :rtype: ~azure.ai.formrecognizer.DocumentModelAdministrationLROPoller[DocumentModelDetails] :raises ~azure.core.exceptions.HttpResponseError: .. versionadded:: v2022-01-30-preview @@ -143,7 +143,7 @@ def callback(raw_response, _, headers): # pylint: disable=unused-argument model_info = self._deserialize( self._generated_models.ModelInfo, op_response.result ) - return DocumentModelInfo._from_generated(model_info) + return DocumentModelDetails._from_generated(model_info) description = kwargs.pop("description", None) model_id = kwargs.pop("model_id", None) @@ -181,7 +181,7 @@ def callback(raw_response, _, headers): # pylint: disable=unused-argument @distributed_trace def begin_compose_model( self, component_model_ids: List[str], **kwargs: Any - ) -> DocumentModelAdministrationLROPoller[DocumentModelInfo]: + ) -> DocumentModelAdministrationLROPoller[DocumentModelDetails]: """Creates a composed model from a collection of existing models. A composed model allows multiple models to be called with a single model ID. When a document is @@ -195,8 +195,8 @@ def begin_compose_model( :keyword tags: List of user defined key-value tag attributes associated with the model. :paramtype tags: dict[str, str] :return: An instance of an DocumentModelAdministrationLROPoller. Call `result()` on the poller - object to return a :class:`~azure.ai.formrecognizer.DocumentModelInfo`. - :rtype: ~azure.ai.formrecognizer.DocumentModelAdministrationLROPoller[DocumentModelInfo] + object to return a :class:`~azure.ai.formrecognizer.DocumentModelDetails`. + :rtype: ~azure.ai.formrecognizer.DocumentModelAdministrationLROPoller[DocumentModelDetails] :raises ~azure.core.exceptions.HttpResponseError: .. versionadded:: v2022-01-30-preview @@ -221,7 +221,7 @@ def _compose_callback( model_info = self._deserialize( self._generated_models.ModelInfo, op_response.result ) - return DocumentModelInfo._from_generated(model_info) + return DocumentModelDetails._from_generated(model_info) model_id = kwargs.pop("model_id", None) description = kwargs.pop("description", None) @@ -298,7 +298,7 @@ def begin_copy_model_to( model_id: str, target: TargetAuthorization, **kwargs: Any - ) -> DocumentModelAdministrationLROPoller[DocumentModelInfo]: + ) -> DocumentModelAdministrationLROPoller[DocumentModelDetails]: """Copy a model stored in this resource (the source) to the user specified target Form Recognizer resource. @@ -311,8 +311,8 @@ def begin_copy_model_to( The copy authorization generated from the target resource's call to :func:`~get_copy_authorization()`. :return: An instance of a DocumentModelAdministrationLROPoller. Call `result()` on the poller - object to return a :class:`~azure.ai.formrecognizer.DocumentModelInfo`. - :rtype: ~azure.ai.formrecognizer.DocumentModelAdministrationLROPoller[DocumentModelInfo] + object to return a :class:`~azure.ai.formrecognizer.DocumentModelDetails`. + :rtype: ~azure.ai.formrecognizer.DocumentModelAdministrationLROPoller[DocumentModelDetails] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -332,7 +332,7 @@ def _copy_callback(raw_response, _, headers): # pylint: disable=unused-argument model_info = self._deserialize( self._generated_models.ModelInfo, op_response.result ) - return DocumentModelInfo._from_generated(model_info) + return DocumentModelDetails._from_generated(model_info) if not model_id: raise ValueError("model_id cannot be None or empty.") @@ -416,33 +416,33 @@ def list_models(self, **kwargs: Any) -> ItemPaged[DocumentModelSummary]: ) @distributed_trace - def get_resource_info(self, **kwargs: Any) -> ResourceInfo: + def get_resource_details(self, **kwargs: Any) -> ResourceDetails: """Get information about the models under the Form Recognizer resource. :return: Summary of models under the resource - model count and limit. - :rtype: ~azure.ai.formrecognizer.ResourceInfo + :rtype: ~azure.ai.formrecognizer.ResourceDetails :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: .. literalinclude:: ../samples/v3.2-beta/sample_manage_models.py - :start-after: [START get_resource_info] - :end-before: [END get_resource_info] + :start-after: [START get_resource_details] + :end-before: [END get_resource_details] :language: python :dedent: 4 :caption: Get model counts and limits under the Form Recognizer resource. """ response = self._client.get_info(**kwargs) - return ResourceInfo._from_generated(response.custom_document_models) + return ResourceDetails._from_generated(response.custom_document_models) @distributed_trace - def get_model(self, model_id: str, **kwargs: Any) -> DocumentModelInfo: + def get_model(self, model_id: str, **kwargs: Any) -> DocumentModelDetails: """Get a model by its ID. :param str model_id: Model identifier. - :return: DocumentModelInfo - :rtype: ~azure.ai.formrecognizer.DocumentModelInfo + :return: DocumentModelDetails + :rtype: ~azure.ai.formrecognizer.DocumentModelDetails :raises ~azure.core.exceptions.HttpResponseError or ~azure.core.exceptions.ResourceNotFoundError: .. admonition:: Example: @@ -459,18 +459,18 @@ def get_model(self, model_id: str, **kwargs: Any) -> DocumentModelInfo: raise ValueError("model_id cannot be None or empty.") response = self._client.get_model(model_id=model_id, **kwargs) - return DocumentModelInfo._from_generated(response) + return DocumentModelDetails._from_generated(response) @distributed_trace - def list_operations(self, **kwargs: Any) -> ItemPaged[ModelOperationInfo]: + def list_operations(self, **kwargs: Any) -> ItemPaged[ModelOperationSummary]: """List information for each document model operation. Lists all document model operations associated with the Form Recognizer resource. Note that operation information only persists for 24 hours. If the operation was successful, the document model can be accessed using the :func:`~get_model` or :func:`~list_models` APIs. - :return: A pageable of ModelOperationInfo. - :rtype: ~azure.core.paging.ItemPaged[ModelOperationInfo] + :return: A pageable of ModelOperationSummary. + :rtype: ~azure.core.paging.ItemPaged[ModelOperationSummary] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -486,13 +486,13 @@ def list_operations(self, **kwargs: Any) -> ItemPaged[ModelOperationInfo]: return self._client.get_operations( # type: ignore cls=kwargs.pop( "cls", - lambda objs: [ModelOperationInfo._from_generated(x) for x in objs], + lambda objs: [ModelOperationSummary._from_generated(x) for x in objs], ), **kwargs ) @distributed_trace - def get_operation(self, operation_id: str, **kwargs: Any) -> ModelOperation: + def get_operation(self, operation_id: str, **kwargs: Any) -> ModelOperationDetails: """Get a document model operation by its ID. Get a document model operation associated with the Form Recognizer resource. @@ -500,8 +500,8 @@ def get_operation(self, operation_id: str, **kwargs: Any) -> ModelOperation: the document model can be accessed using the :func:`~get_model` or :func:`~list_models` APIs. :param str operation_id: The operation ID. - :return: ModelOperation - :rtype: ~azure.ai.formrecognizer.ModelOperation + :return: ModelOperationDetails + :rtype: ~azure.ai.formrecognizer.ModelOperationDetails :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -517,7 +517,7 @@ def get_operation(self, operation_id: str, **kwargs: Any) -> ModelOperation: if not operation_id: raise ValueError("'operation_id' cannot be None or empty.") - return ModelOperation._from_generated( + return ModelOperationDetails._from_generated( self._client.get_operation(operation_id, **kwargs), api_version=self._api_version, ) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py index 155adae96300..3c9854283c64 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -5,7 +5,7 @@ # pylint: disable=protected-access, too-many-lines -from typing import Any, Dict, Iterable, List, NewType +from typing import Dict, Iterable, List, NewType from enum import Enum from collections import namedtuple from azure.core import CaseInsensitiveEnumMeta @@ -2717,7 +2717,7 @@ def from_dict(cls, data: dict) -> "DocumentLine": else [], ) - def get_words(self, **kwargs: Any) -> Iterable["DocumentWord"]: # pylint: disable=unused-argument + def get_words(self) -> Iterable["DocumentWord"]: """Get the words found in the spans of this DocumentLine. :return: iterable[DocumentWord] @@ -3268,7 +3268,7 @@ def from_dict(cls, data: dict) -> "DocumentTableCell": ) -class ModelOperationInfo: +class ModelOperationSummary: """Model operation information, including the kind and status of the operation, when it was created, and more. @@ -3314,14 +3314,14 @@ def __init__(self, **kwargs): def __repr__(self): return ( - f"ModelOperationInfo(operation_id={self.operation_id}, status={self.status}, " + f"ModelOperationSummary(operation_id={self.operation_id}, status={self.status}, " f"percent_completed={self.percent_completed}, created_on={self.created_on}, " f"last_updated_on={self.last_updated_on}, kind={self.kind}, " f"resource_location={self.resource_location}, api_version={self.api_version}, tags={self.tags})" ) def to_dict(self) -> dict: - """Returns a dict representation of ModelOperationInfo. + """Returns a dict representation of ModelOperationSummary. :return: dict :rtype: dict @@ -3339,12 +3339,12 @@ def to_dict(self) -> dict: } @classmethod - def from_dict(cls, data: dict) -> "ModelOperationInfo": - """Converts a dict in the shape of a ModelOperationInfo to the model itself. + def from_dict(cls, data: dict) -> "ModelOperationSummary": + """Converts a dict in the shape of a ModelOperationSummary to the model itself. - :param dict data: A dictionary in the shape of ModelOperationInfo. - :return: ModelOperationInfo - :rtype: ModelOperationInfo + :param dict data: A dictionary in the shape of ModelOperationSummary. + :return: ModelOperationSummary + :rtype: ModelOperationSummary """ return cls( operation_id=data.get("operation_id", None), @@ -3373,8 +3373,8 @@ def _from_generated(cls, op): ) -class ModelOperation(ModelOperationInfo): - """ModelOperation consists of information about the model operation, including the result or +class ModelOperationDetails(ModelOperationSummary): + """ModelOperationDetails consists of information about the model operation, including the result or error of the operation if it has completed. Note that operation information only persists for 24 hours. If the operation was successful, @@ -3399,10 +3399,10 @@ class ModelOperation(ModelOperationInfo): :ivar error: Encountered error, includes the error code, message, and details for why the operation failed. :vartype error: Optional[~azure.ai.formrecognizer.DocumentAnalysisError] - :ivar result: Operation result upon success. Returns a DocumentModelInfo which contains + :ivar result: Operation result upon success. Returns a DocumentModelDetails which contains all information about the model including the doc types and fields it can analyze from documents. - :vartype result: Optional[~azure.ai.formrecognizer.DocumentModelInfo] + :vartype result: Optional[~azure.ai.formrecognizer.DocumentModelDetails] :ivar api_version: API version used to create this operation. :vartype api_version: Optional[str] :ivar tags: List of user defined key-value tag attributes associated with the model. @@ -3419,7 +3419,7 @@ def __init__(self, **kwargs): def __repr__(self): return ( - f"ModelOperation(operation_id={self.operation_id}, status={self.status}, " + f"ModelOperationDetails(operation_id={self.operation_id}, status={self.status}, " f"percent_completed={self.percent_completed}, created_on={self.created_on}, " f"last_updated_on={self.last_updated_on}, kind={self.kind}, " f"resource_location={self.resource_location}, result={repr(self.result)}, " @@ -3427,7 +3427,7 @@ def __repr__(self): ) def to_dict(self) -> dict: - """Returns a dict representation of ModelOperation. + """Returns a dict representation of ModelOperationDetails. :return: dict :rtype: dict @@ -3447,12 +3447,12 @@ def to_dict(self) -> dict: } @classmethod - def from_dict(cls, data: dict) -> "ModelOperation": - """Converts a dict in the shape of a ModelOperation to the model itself. + def from_dict(cls, data: dict) -> "ModelOperationDetails": + """Converts a dict in the shape of a ModelOperationDetails to the model itself. - :param dict data: A dictionary in the shape of ModelOperation. - :return: ModelOperation - :rtype: ModelOperation + :param dict data: A dictionary in the shape of ModelOperationDetails. + :return: ModelOperationDetails + :rtype: ModelOperationDetails """ return cls( operation_id=data.get("operation_id", None), @@ -3462,7 +3462,7 @@ def from_dict(cls, data: dict) -> "ModelOperation": last_updated_on=data.get("last_updated_on", None), kind=data.get("kind", None), resource_location=data.get("resource_location", None), - result=DocumentModelInfo.from_dict(data.get("result")) if data.get("result") else None, # type: ignore + result=DocumentModelDetails.from_dict(data.get("result")) if data.get("result") else None, # type: ignore error=DocumentAnalysisError.from_dict(data.get("error")) if data.get("error") else None, # type: ignore api_version=data.get("api_version", None), tags=data.get("tags", {}), @@ -3479,7 +3479,7 @@ def _from_generated(cls, op, api_version): # pylint: disable=arguments-differ last_updated_on=op.last_updated_date_time, kind=op.kind, resource_location=op.resource_location, - result=DocumentModelInfo._from_generated(deserialize(ModelInfo, op.result)) + result=DocumentModelDetails._from_generated(deserialize(ModelInfo, op.result)) if op.result else None, error=DocumentAnalysisError._from_generated(deserialize(Error, op.error)) if op.error else None, @@ -3787,7 +3787,7 @@ def from_dict(cls, data: dict) -> "DocumentModelSummary": ) -class DocumentModelInfo(DocumentModelSummary): +class DocumentModelDetails(DocumentModelSummary): """Document model information. Includes the doc types that the model can analyze. :ivar str model_id: Unique model id. @@ -3814,7 +3814,7 @@ def __init__( def __repr__(self): return ( - f"DocumentModelInfo(model_id={self.model_id}, description={self.description}, " + f"DocumentModelDetails(model_id={self.model_id}, description={self.description}, " f"created_on={self.created_on}, api_version={self.api_version}, tags={self.tags}, " f"doc_types={repr(self.doc_types)})" ) @@ -3832,7 +3832,7 @@ def _from_generated(cls, model): ) def to_dict(self) -> dict: - """Returns a dict representation of DocumentModelInfo. + """Returns a dict representation of DocumentModelDetails. :return: dict :rtype: dict @@ -3847,12 +3847,12 @@ def to_dict(self) -> dict: } @classmethod - def from_dict(cls, data: dict) -> "DocumentModelInfo": - """Converts a dict in the shape of a DocumentModelInfo to the model itself. + def from_dict(cls, data: dict) -> "DocumentModelDetails": + """Converts a dict in the shape of a DocumentModelDetails to the model itself. - :param dict data: A dictionary in the shape of DocumentModelInfo. - :return: DocumentModelInfo - :rtype: DocumentModelInfo + :param dict data: A dictionary in the shape of DocumentModelDetails. + :return: DocumentModelDetails + :rtype: DocumentModelDetails """ return cls( model_id=data.get("model_id", None), @@ -3937,8 +3937,8 @@ def from_dict(cls, data: dict) -> "DocTypeInfo": ) -class ResourceInfo: - """Info regarding models under the Form Recognizer resource. +class ResourceDetails: + """Details regarding models under the Form Recognizer resource. :ivar int document_model_count: Number of custom models in the current resource. :ivar int document_model_limit: Maximum number of custom models supported in the current resource. @@ -3953,7 +3953,7 @@ def __init__( def __repr__(self): return ( - f"ResourceInfo(document_model_count={self.document_model_count}, " + f"ResourceDetails(document_model_count={self.document_model_count}, " f"document_model_limit={self.document_model_limit})" ) @@ -3966,7 +3966,7 @@ def _from_generated(cls, info): def to_dict(self) -> dict: - """Returns a dict representation of ResourceInfo. + """Returns a dict representation of ResourceDetails. :return: dict :rtype: dict @@ -3977,12 +3977,12 @@ def to_dict(self) -> dict: } @classmethod - def from_dict(cls, data: dict) -> "ResourceInfo": - """Converts a dict in the shape of a ResourceInfo to the model itself. + def from_dict(cls, data: dict) -> "ResourceDetails": + """Converts a dict in the shape of a ResourceDetails to the model itself. - :param dict data: A dictionary in the shape of ResourceInfo. - :return: ResourceInfo - :rtype: ResourceInfo + :param dict data: A dictionary in the shape of ResourceDetails. + :return: ResourceDetails + :rtype: ResourceDetails """ return cls( document_model_count=data.get("document_model_count", None), diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_polling.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_polling.py index cd8a9061f6ce..fbcbcd161487 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_polling.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_polling.py @@ -80,7 +80,7 @@ def remove_done_callback(self, func: Callable) -> None: # pylint: disable=no-se class DocumentModelAdministrationClientLROPoller(LROPoller[PollingReturnType]): """Custom poller for model build operations. Call `result()` on the poller to return - a :class:`~azure.ai.formrecognizer.DocumentModelInfo`. + a :class:`~azure.ai.formrecognizer.DocumentModelDetails`. .. versionadded:: 2021-09-30-preview The *DocumentModelAdministrationLROPoller* poller object diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_document_model_administration_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_document_model_administration_client_async.py index 4b7b0b58e6a6..78eb46dea277 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_document_model_administration_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_document_model_administration_client_async.py @@ -26,11 +26,11 @@ from .._polling import DocumentModelAdministrationPolling from .._models import ( DocumentBuildMode, - DocumentModelInfo, + DocumentModelDetails, DocumentModelSummary, - ModelOperation, - ModelOperationInfo, - ResourceInfo, + ModelOperationDetails, + ModelOperationSummary, + ResourceDetails, TargetAuthorization, ) @@ -99,7 +99,7 @@ def __init__( @distributed_trace_async async def begin_build_model( self, source: str, build_mode: Union[str, DocumentBuildMode], **kwargs: Any - ) -> AsyncDocumentModelAdministrationLROPoller[DocumentModelInfo]: + ) -> AsyncDocumentModelAdministrationLROPoller[DocumentModelDetails]: """Build a custom model. The request must include a `source` parameter that is an @@ -124,8 +124,8 @@ async def begin_build_model( :keyword tags: List of user defined key-value tag attributes associated with the model. :paramtype tags: dict[str, str] :return: An instance of an AsyncDocumentModelAdministrationLROPoller. Call `result()` on the poller - object to return a :class:`~azure.ai.formrecognizer.DocumentModelInfo`. - :rtype: ~azure.ai.formrecognizer.aio.AsyncDocumentModelAdministrationLROPoller[DocumentModelInfo] + object to return a :class:`~azure.ai.formrecognizer.DocumentModelDetails`. + :rtype: ~azure.ai.formrecognizer.aio.AsyncDocumentModelAdministrationLROPoller[DocumentModelDetails] :raises ~azure.core.exceptions.HttpResponseError: .. versionadded:: v2022-01-30-preview @@ -148,7 +148,7 @@ def callback(raw_response, _, headers): # pylint: disable=unused-argument model_info = self._deserialize( self._generated_models.ModelInfo, op_response.result ) - return DocumentModelInfo._from_generated(model_info) + return DocumentModelDetails._from_generated(model_info) description = kwargs.pop("description", None) model_id = kwargs.pop("model_id", None) @@ -186,7 +186,7 @@ def callback(raw_response, _, headers): # pylint: disable=unused-argument @distributed_trace_async async def begin_compose_model( self, component_model_ids: List[str], **kwargs: Any - ) -> AsyncDocumentModelAdministrationLROPoller[DocumentModelInfo]: + ) -> AsyncDocumentModelAdministrationLROPoller[DocumentModelDetails]: """Creates a composed model from a collection of existing models. A composed model allows multiple models to be called with a single model ID. When a document is @@ -200,8 +200,8 @@ async def begin_compose_model( :keyword tags: List of user defined key-value tag attributes associated with the model. :paramtype tags: dict[str, str] :return: An instance of an AsyncDocumentModelAdministrationLROPoller. Call `result()` on the poller - object to return a :class:`~azure.ai.formrecognizer.DocumentModelInfo`. - :rtype: ~azure.ai.formrecognizer.aio.AsyncDocumentModelAdministrationLROPoller[DocumentModelInfo] + object to return a :class:`~azure.ai.formrecognizer.DocumentModelDetails`. + :rtype: ~azure.ai.formrecognizer.aio.AsyncDocumentModelAdministrationLROPoller[DocumentModelDetails] :raises ~azure.core.exceptions.HttpResponseError: .. versionadded:: v2022-01-30-preview @@ -226,7 +226,7 @@ def _compose_callback( model_info = self._deserialize( self._generated_models.ModelInfo, op_response.result ) - return DocumentModelInfo._from_generated(model_info) + return DocumentModelDetails._from_generated(model_info) model_id = kwargs.pop("model_id", None) description = kwargs.pop("description", None) @@ -300,7 +300,7 @@ async def get_copy_authorization(self, **kwargs: Any) -> TargetAuthorization: @distributed_trace_async async def begin_copy_model_to( self, model_id: str, target: TargetAuthorization, **kwargs: Any - ) -> AsyncDocumentModelAdministrationLROPoller[DocumentModelInfo]: + ) -> AsyncDocumentModelAdministrationLROPoller[DocumentModelDetails]: """Copy a model stored in this resource (the source) to the user specified target Form Recognizer resource. @@ -313,8 +313,8 @@ async def begin_copy_model_to( The copy authorization generated from the target resource's call to :func:`~get_copy_authorization()`. :return: An instance of a AsyncDocumentModelAdministrationLROPoller. Call `result()` on the poller - object to return a :class:`~azure.ai.formrecognizer.DocumentModelInfo`. - :rtype: ~azure.ai.formrecognizer.aio.AsyncDocumentModelAdministrationLROPoller[DocumentModelInfo] + object to return a :class:`~azure.ai.formrecognizer.DocumentModelDetails`. + :rtype: ~azure.ai.formrecognizer.aio.AsyncDocumentModelAdministrationLROPoller[DocumentModelDetails] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -334,7 +334,7 @@ def _copy_callback(raw_response, _, headers): # pylint: disable=unused-argument model_info = self._deserialize( self._generated_models.ModelInfo, op_response.result ) - return DocumentModelInfo._from_generated(model_info) + return DocumentModelDetails._from_generated(model_info) if not model_id: raise ValueError("model_id cannot be None or empty.") @@ -418,33 +418,33 @@ def list_models(self, **kwargs: Any) -> AsyncItemPaged[DocumentModelSummary]: ) @distributed_trace_async - async def get_resource_info(self, **kwargs: Any) -> ResourceInfo: + async def get_resource_details(self, **kwargs: Any) -> ResourceDetails: """Get information about the models under the Form Recognizer resource. :return: Summary of models under the resource - model count and limit. - :rtype: ~azure.ai.formrecognizer.ResourceInfo + :rtype: ~azure.ai.formrecognizer.ResourceDetails :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: .. literalinclude:: ../samples/v3.2-beta/async_samples/sample_manage_models_async.py - :start-after: [START get_resource_info_async] - :end-before: [END get_resource_info_async] + :start-after: [START get_resource_details_async] + :end-before: [END get_resource_details_async] :language: python :dedent: 4 :caption: Get model counts and limits under the Form Recognizer resource. """ response = await self._client.get_info(**kwargs) - return ResourceInfo._from_generated(response.custom_document_models) + return ResourceDetails._from_generated(response.custom_document_models) @distributed_trace_async - async def get_model(self, model_id: str, **kwargs: Any) -> DocumentModelInfo: + async def get_model(self, model_id: str, **kwargs: Any) -> DocumentModelDetails: """Get a model by its ID. :param str model_id: Model identifier. - :return: DocumentModelInfo - :rtype: ~azure.ai.formrecognizer.DocumentModelInfo + :return: DocumentModelDetails + :rtype: ~azure.ai.formrecognizer.DocumentModelDetails :raises ~azure.core.exceptions.HttpResponseError or ~azure.core.exceptions.ResourceNotFoundError: .. admonition:: Example: @@ -461,18 +461,18 @@ async def get_model(self, model_id: str, **kwargs: Any) -> DocumentModelInfo: raise ValueError("model_id cannot be None or empty.") response = await self._client.get_model(model_id=model_id, **kwargs) - return DocumentModelInfo._from_generated(response) + return DocumentModelDetails._from_generated(response) @distributed_trace - def list_operations(self, **kwargs: Any) -> AsyncItemPaged[ModelOperationInfo]: + def list_operations(self, **kwargs: Any) -> AsyncItemPaged[ModelOperationSummary]: """List information for each document model operation. Lists all document model operations associated with the Form Recognizer resource. Note that operation information only persists for 24 hours. If the operation was successful, the document model can be accessed using the :func:`~get_model` or :func:`~list_models` APIs. - :return: A pageable of ModelOperationInfo. - :rtype: ~azure.core.async_paging.AsyncItemPaged[ModelOperationInfo] + :return: A pageable of ModelOperationSummary. + :rtype: ~azure.core.async_paging.AsyncItemPaged[ModelOperationSummary] :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -488,13 +488,13 @@ def list_operations(self, **kwargs: Any) -> AsyncItemPaged[ModelOperationInfo]: return self._client.get_operations( # type: ignore cls=kwargs.pop( "cls", - lambda objs: [ModelOperationInfo._from_generated(x) for x in objs], + lambda objs: [ModelOperationSummary._from_generated(x) for x in objs], ), **kwargs ) @distributed_trace_async - async def get_operation(self, operation_id: str, **kwargs: Any) -> ModelOperation: + async def get_operation(self, operation_id: str, **kwargs: Any) -> ModelOperationDetails: """Get a document model operation by its ID. Get a document model operation associated with the Form Recognizer resource. @@ -502,8 +502,8 @@ async def get_operation(self, operation_id: str, **kwargs: Any) -> ModelOperatio the document model can be accessed using the :func:`~get_model` or :func:`~list_models` APIs. :param str operation_id: The operation ID. - :return: ModelOperation - :rtype: ~azure.ai.formrecognizer.ModelOperation + :return: ModelOperationDetails + :rtype: ~azure.ai.formrecognizer.ModelOperationDetails :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -519,7 +519,7 @@ async def get_operation(self, operation_id: str, **kwargs: Any) -> ModelOperatio if not operation_id: raise ValueError("'operation_id' cannot be None or empty.") - return ModelOperation._from_generated( + return ModelOperationDetails._from_generated( await self._client.get_operation(operation_id, **kwargs), api_version=self._api_version, ) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_authentication_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_authentication_async.py index 933ab52d1436..8037e62667cd 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_authentication_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_authentication_async.py @@ -84,7 +84,7 @@ async def authentication_with_api_key_credential_document_model_admin_client_asy document_model_admin_client = DocumentModelAdministrationClient(endpoint, AzureKeyCredential(key)) # [END create_dt_client_with_key_async] async with document_model_admin_client: - info = await document_model_admin_client.get_resource_info() + info = await document_model_admin_client.get_resource_details() async def authentication_with_azure_active_directory_document_model_admin_client_async(): @@ -101,7 +101,7 @@ async def authentication_with_azure_active_directory_document_model_admin_client document_model_admin_client = DocumentModelAdministrationClient(endpoint, credential) # [END create_dt_client_with_aad_async] async with document_model_admin_client: - info = await document_model_admin_client.get_resource_info() + info = await document_model_admin_client.get_resource_details() async def main(): diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_manage_models_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_manage_models_async.py index 9f14c56726ac..d0cecd4e092a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_manage_models_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/async_samples/sample_manage_models_async.py @@ -36,15 +36,15 @@ async def sample_manage_models_async(): key = os.environ["AZURE_FORM_RECOGNIZER_KEY"] container_sas_url = os.environ["CONTAINER_SAS_URL"] - # [START get_resource_info_async] + # [START get_resource_details_async] document_model_admin_client = DocumentModelAdministrationClient(endpoint=endpoint, credential=AzureKeyCredential(key)) async with document_model_admin_client: - account_info = await document_model_admin_client.get_resource_info() + account_info = await document_model_admin_client.get_resource_details() print("Our resource has {} custom models, and we can have at most {} custom models\n".format( account_info.document_model_count, account_info.document_model_limit )) - # [END get_resource_info_async] + # [END get_resource_details_async] # Next, we get a paged list of all of our custom models # [START list_models_async] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_authentication.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_authentication.py index ec055352e3b1..474d593e82a5 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_authentication.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_authentication.py @@ -80,7 +80,7 @@ def authentication_with_api_key_credential_document_model_admin_client(): document_model_admin_client = DocumentModelAdministrationClient(endpoint, AzureKeyCredential(key)) # [END create_dt_client_with_key] - info = document_model_admin_client.get_resource_info() + info = document_model_admin_client.get_resource_details() def authentication_with_azure_active_directory_document_model_admin_client(): @@ -96,7 +96,7 @@ def authentication_with_azure_active_directory_document_model_admin_client(): document_model_admin_client = DocumentModelAdministrationClient(endpoint, credential) # [END create_dt_client_with_aad] - info = document_model_admin_client.get_resource_info() + info = document_model_admin_client.get_resource_details() if __name__ == "__main__": diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_manage_models.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_manage_models.py index 3972eb79a30d..f5c48cc32803 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_manage_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_manage_models.py @@ -34,14 +34,14 @@ def sample_manage_models(): key = os.environ["AZURE_FORM_RECOGNIZER_KEY"] container_sas_url = os.environ["CONTAINER_SAS_URL"] - # [START get_resource_info] + # [START get_resource_details] document_model_admin_client = DocumentModelAdministrationClient(endpoint=endpoint, credential=AzureKeyCredential(key)) - account_info = document_model_admin_client.get_resource_info() + account_info = document_model_admin_client.get_resource_details() print("Our resource has {} custom models, and we can have at most {} custom models\n".format( account_info.document_model_count, account_info.document_model_limit )) - # [END get_resource_info] + # [END get_resource_details] # Next, we get a paged list of all of our custom models # [START list_models] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_compose_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_compose_model.py index f6aca8833317..b6a5ba1a5cd6 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_compose_model.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_compose_model.py @@ -8,7 +8,7 @@ import uuid import functools from devtools_testutils import recorded_by_proxy, set_bodiless_matcher -from azure.ai.formrecognizer import DocumentModelAdministrationClient, DocumentModelInfo, DocumentModelAdministrationLROPoller +from azure.ai.formrecognizer import DocumentModelAdministrationClient, DocumentModelDetails, DocumentModelAdministrationLROPoller from azure.ai.formrecognizer._generated.v2022_06_30_preview.models import GetOperationResponse, ModelInfo from testcase import FormRecognizerTest from preparers import GlobalClientPreparer as _GlobalClientPreparer @@ -66,7 +66,7 @@ def test_compose_model_transform(self, client, formrecognizer_storage_container_ def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) @@ -78,7 +78,7 @@ def callback(response, _, headers): self.assertModelTransformCorrect(document_model, generated) document_model_dict = document_model.to_dict() - document_model_from_dict = DocumentModelInfo.from_dict(document_model_dict) + document_model_from_dict = DocumentModelDetails.from_dict(document_model_dict) self.assertModelTransformCorrect(document_model_from_dict, generated) @pytest.mark.live_test_only diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_compose_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_compose_model_async.py index f70ee5734d80..d3ea60a4f5ca 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_compose_model_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_compose_model_async.py @@ -10,7 +10,7 @@ from devtools_testutils.aio import recorded_by_proxy_async from devtools_testutils import set_bodiless_matcher from azure.ai.formrecognizer.aio import DocumentModelAdministrationClient, AsyncDocumentModelAdministrationLROPoller -from azure.ai.formrecognizer import DocumentModelInfo +from azure.ai.formrecognizer import DocumentModelDetails from azure.ai.formrecognizer._generated.v2022_06_30_preview.models import GetOperationResponse, ModelInfo from preparers import FormRecognizerPreparer from preparers import GlobalClientPreparer as _GlobalClientPreparer @@ -62,7 +62,7 @@ async def test_compose_model_transform(self, client, formrecognizer_storage_cont def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) @@ -81,7 +81,7 @@ def callback(response, _, headers): self.assertModelTransformCorrect(document_model, generated) document_model_dict = document_model.to_dict() - document_model_from_dict = DocumentModelInfo.from_dict(document_model_dict) + document_model_from_dict = DocumentModelDetails.from_dict(document_model_dict) self.assertModelTransformCorrect(document_model_from_dict, generated) @pytest.mark.live_test_only diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_copy_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_copy_model.py index d252a1249f4c..3e0c336ae7a1 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_copy_model.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_copy_model.py @@ -10,7 +10,7 @@ from devtools_testutils import recorded_by_proxy, set_bodiless_matcher from azure.core.exceptions import HttpResponseError from azure.ai.formrecognizer._generated.v2022_06_30_preview.models import GetOperationResponse, ModelInfo -from azure.ai.formrecognizer import DocumentModelInfo,DocumentModelAdministrationClient, DocumentModelAdministrationLROPoller +from azure.ai.formrecognizer import DocumentModelDetails, DocumentModelAdministrationClient, DocumentModelAdministrationLROPoller from testcase import FormRecognizerTest from preparers import GlobalClientPreparer as _GlobalClientPreparer from preparers import FormRecognizerPreparer @@ -118,7 +118,7 @@ def test_copy_model_transform(self, client, formrecognizer_storage_container_sas def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_copy_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_copy_model_async.py index 97e6606a5b22..83fc6e8bf3fb 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_copy_model_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_copy_model_async.py @@ -11,7 +11,7 @@ from devtools_testutils.aio import recorded_by_proxy_async from azure.core.exceptions import HttpResponseError from azure.ai.formrecognizer._generated.v2022_06_30_preview.models import GetOperationResponse, ModelInfo -from azure.ai.formrecognizer import DocumentModelInfo +from azure.ai.formrecognizer import DocumentModelDetails from azure.ai.formrecognizer.aio import DocumentModelAdministrationClient, AsyncDocumentModelAdministrationLROPoller from preparers import FormRecognizerPreparer from asynctestcase import AsyncFormRecognizerTest @@ -120,7 +120,7 @@ async def test_copy_model_transform(self, client, formrecognizer_storage_contain def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_mgmt.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_mgmt.py index fdf8632b9ba3..cea5e84bd16b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_mgmt.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_mgmt.py @@ -13,7 +13,7 @@ from azure.ai.formrecognizer import ( DocumentModelAdministrationClient, DocumentAnalysisApiVersion, - ModelOperation + ModelOperationDetails ) from testcase import FormRecognizerTest from preparers import GlobalClientPreparer as _GlobalClientPreparer @@ -31,7 +31,7 @@ def test_active_directory_auth(self): token = self.generate_oauth_token() endpoint = self.get_oauth_endpoint() client = DocumentModelAdministrationClient(endpoint, token) - info = client.get_resource_info() + info = client.get_resource_details() assert info @FormRecognizerPreparer() @@ -39,7 +39,7 @@ def test_active_directory_auth(self): def test_dmac_auth_bad_key(self, formrecognizer_test_endpoint, formrecognizer_test_api_key, **kwargs): client = DocumentModelAdministrationClient(formrecognizer_test_endpoint, AzureKeyCredential("xxxx")) with pytest.raises(ClientAuthenticationError): - result = client.get_resource_info() + result = client.get_resource_details() @FormRecognizerPreparer() @DocumentModelAdministrationClientPreparer() @@ -73,7 +73,7 @@ def test_delete_model_empty_model_id(self, **kwargs): @DocumentModelAdministrationClientPreparer() @recorded_by_proxy def test_account_info(self, client): - info = client.get_resource_info() + info = client.get_resource_details() assert info.document_model_limit assert info.document_model_count @@ -154,7 +154,7 @@ def test_get_list_operations(self, client, **kwargs): # assert op.tags is None # test to/from dict op_dict = op.to_dict() - op = ModelOperation.from_dict(op_dict) + op = ModelOperationDetails.from_dict(op_dict) assert op.error is None model = op.result assert model.model_id @@ -174,7 +174,7 @@ def test_get_list_operations(self, client, **kwargs): op = client.get_operation(failed_op.operation_id) # test to/from dict op_dict = op.to_dict() - op = ModelOperation.from_dict(op_dict) + op = ModelOperationDetails.from_dict(op_dict) assert op.result is None error = op.error @@ -198,11 +198,11 @@ def test_get_document_analysis_client(self, formrecognizer_test_endpoint, formre dtc = DocumentModelAdministrationClient(endpoint=formrecognizer_test_endpoint, credential=AzureKeyCredential(formrecognizer_test_api_key), transport=transport) with dtc: - dtc.get_resource_info() + dtc.get_resource_details() assert transport.session is not None with dtc.get_document_analysis_client() as dac: assert transport.session is not None dac.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg).wait() assert dac._api_version == DocumentAnalysisApiVersion.V2022_06_30_PREVIEW - dtc.get_resource_info() + dtc.get_resource_details() assert transport.session is not None diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_mgmt_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_mgmt_async.py index 16f1b0056dc0..d651f59e97a3 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_mgmt_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_mgmt_async.py @@ -14,7 +14,7 @@ from azure.ai.formrecognizer import ( DocumentModelAdministrationClient, DocumentAnalysisApiVersion, - ModelOperation + ModelOperationDetails ) from azure.ai.formrecognizer.aio import DocumentModelAdministrationClient from preparers import FormRecognizerPreparer @@ -34,7 +34,7 @@ async def test_active_directory_auth_async(self): endpoint = self.get_oauth_endpoint() client = DocumentModelAdministrationClient(endpoint, token) async with client: - info = await client.get_resource_info() + info = await client.get_resource_details() assert info @FormRecognizerPreparer() @@ -43,7 +43,7 @@ async def test_dmac_auth_bad_key(self, formrecognizer_test_endpoint, formrecogni client = DocumentModelAdministrationClient(formrecognizer_test_endpoint, AzureKeyCredential("xxxx")) with pytest.raises(ClientAuthenticationError): async with client: - result = await client.get_resource_info() + result = await client.get_resource_details() @FormRecognizerPreparer() @DocumentModelAdministrationClientPreparer() @@ -82,7 +82,7 @@ async def test_delete_model_empty_model_id(self, **kwargs): @recorded_by_proxy_async async def test_account_info(self, client): async with client: - info = await client.get_resource_info() + info = await client.get_resource_details() assert info.document_model_limit assert info.document_model_count @@ -161,7 +161,7 @@ async def test_get_list_operations(self, client): op = await client.get_operation(successful_op.operation_id) # test to/from dict op_dict = op.to_dict() - op = ModelOperation.from_dict(op_dict) + op = ModelOperationDetails.from_dict(op_dict) assert op.error is None model = op.result assert model.model_id @@ -181,7 +181,7 @@ async def test_get_list_operations(self, client): op = await client.get_operation(failed_op.operation_id) # test to/from dict op_dict = op.to_dict() - op = ModelOperation.from_dict(op_dict) + op = ModelOperationDetails.from_dict(op_dict) error = op.error assert op.result is None @@ -209,11 +209,11 @@ async def test_get_document_analysis_client(self, formrecognizer_test_endpoint, dtc = DocumentModelAdministrationClient(endpoint=formrecognizer_test_endpoint, credential=AzureKeyCredential(formrecognizer_test_api_key), transport=transport) async with dtc: - await dtc.get_resource_info() + await dtc.get_resource_details() assert transport.session is not None async with dtc.get_document_analysis_client() as dac: assert transport.session is not None await (await dac.begin_analyze_document_from_url("prebuilt-receipt", self.receipt_url_jpg)).wait() assert dac._api_version == DocumentAnalysisApiVersion.V2022_06_30_PREVIEW - await dtc.get_resource_info() + await dtc.get_resource_details() assert transport.session is not None diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_training.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_training.py index 25c2f35afb40..7b71953952f6 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_training.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_training.py @@ -11,7 +11,7 @@ from azure.core.credentials import AzureKeyCredential from azure.core.exceptions import ClientAuthenticationError, HttpResponseError from azure.ai.formrecognizer._generated.v2022_06_30_preview.models import GetOperationResponse, ModelInfo -from azure.ai.formrecognizer import DocumentModelAdministrationClient, DocumentModelInfo, DocumentModelAdministrationLROPoller +from azure.ai.formrecognizer import DocumentModelAdministrationClient, DocumentModelDetails, DocumentModelAdministrationLROPoller from testcase import FormRecognizerTest from preparers import GlobalClientPreparer as _GlobalClientPreparer from preparers import FormRecognizerPreparer @@ -139,7 +139,7 @@ def test_build_model_transform(self, client, formrecognizer_storage_container_sa def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) @@ -151,7 +151,7 @@ def callback(response, _, headers): self.assertModelTransformCorrect(document_model, raw_model) document_model_dict = document_model.to_dict() - document_model_from_dict = DocumentModelInfo.from_dict(document_model_dict) + document_model_from_dict = DocumentModelDetails.from_dict(document_model_dict) assert document_model_from_dict.model_id == document_model.model_id self.assertModelTransformCorrect(document_model_from_dict, raw_model) @@ -166,7 +166,7 @@ def test_build_model_multipage_transform(self, client, formrecognizer_multipage_ def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) @@ -188,7 +188,7 @@ def test_build_model_nested_schema_transform(self, client, formrecognizer_table_ def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) @@ -201,7 +201,7 @@ def callback(response, _, headers): document_model_dict = document_model.to_dict() - document_model_from_dict = DocumentModelInfo.from_dict(document_model_dict) + document_model_from_dict = DocumentModelDetails.from_dict(document_model_dict) assert document_model_from_dict.model_id == document_model.model_id self.assertModelTransformCorrect(document_model_from_dict, raw_model) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_training_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_training_async.py index 5e545d4e5882..02ceee7c7ad3 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_training_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_dmac_training_async.py @@ -13,7 +13,7 @@ from azure.core.exceptions import ClientAuthenticationError, HttpResponseError from azure.ai.formrecognizer._generated.v2022_06_30_preview.models import GetOperationResponse, ModelInfo from azure.ai.formrecognizer.aio import DocumentModelAdministrationClient, AsyncDocumentModelAdministrationLROPoller -from azure.ai.formrecognizer import DocumentModelInfo +from azure.ai.formrecognizer import DocumentModelDetails from preparers import FormRecognizerPreparer from asynctestcase import AsyncFormRecognizerTest from preparers import GlobalClientPreparer as _GlobalClientPreparer @@ -147,7 +147,7 @@ async def test_build_model_transform(self, client, formrecognizer_storage_contai def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) @@ -160,7 +160,7 @@ def callback(response, _, headers): self.assertModelTransformCorrect(document_model, raw_model) document_model_dict = document_model.to_dict() - document_model_from_dict = DocumentModelInfo.from_dict(document_model_dict) + document_model_from_dict = DocumentModelDetails.from_dict(document_model_dict) assert document_model_from_dict.model_id == document_model.model_id self.assertModelTransformCorrect(document_model_from_dict, raw_model) @@ -175,7 +175,7 @@ async def test_build_model_multipage_transform(self, client, formrecognizer_mult def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) @@ -198,7 +198,7 @@ async def test_build_model_nested_schema_transform(self, client, formrecognizer_ def callback(response, _, headers): op_response = client._deserialize(GetOperationResponse, response) model_info = client._deserialize(ModelInfo, op_response.result) - document_model = DocumentModelInfo._from_generated(model_info) + document_model = DocumentModelDetails._from_generated(model_info) raw_response.append(model_info) raw_response.append(document_model) @@ -212,7 +212,7 @@ def callback(response, _, headers): document_model_dict = document_model.to_dict() - document_model_from_dict = DocumentModelInfo.from_dict(document_model_dict) + document_model_from_dict = DocumentModelDetails.from_dict(document_model_dict) assert document_model_from_dict.model_id == document_model.model_id self.assertModelTransformCorrect(document_model_from_dict, raw_model) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging.py index 5aa69bedf7b6..600eb3e561d4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging.py @@ -65,7 +65,7 @@ def test_logging_info_dmac_client(self, **kwargs): logger.addHandler(mock_handler) logger.setLevel(logging.INFO) - result = client.get_resource_info() + result = client.get_resource_details() for message in mock_handler.messages: if message.levelname == "INFO": diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging_async.py index b650a68788a1..4de9dcffc272 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_logging_async.py @@ -100,7 +100,7 @@ async def test_logging_info_dmac_client(self, **kwargs): logger.addHandler(mock_handler) logger.setLevel(logging.INFO) async with client: - result = await client.get_resource_info() + result = await client.get_resource_details() for message in mock_handler.messages: if message.levelname == "INFO": diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py index fd7a7e3fb01c..f8cf4b2a41b4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py @@ -380,7 +380,7 @@ def doc_type_info(): @pytest.fixture def document_model(doc_type_info): - model = _models.DocumentModelInfo( + model = _models.DocumentModelDetails( api_version="2022-06-30-preview", tags={"awesome": "tag"}, description="my description", @@ -388,7 +388,7 @@ def document_model(doc_type_info): model_id="prebuilt-invoice", doc_types={"prebuilt-invoice": doc_type_info[0]} ) - model_repr = "DocumentModelInfo(model_id={}, description={}, created_on={}, api_version={}, tags={}, doc_types={{'prebuilt-invoice': {}}})".format( + model_repr = "DocumentModelDetails(model_id={}, description={}, created_on={}, api_version={}, tags={}, doc_types={{'prebuilt-invoice': {}}})".format( "prebuilt-invoice", "my description", datetime.datetime(2021, 9, 16, 10, 10, 59, 342380), @@ -511,7 +511,7 @@ def test_analyze_result(self, document_page, document_table, document_key_value_ assert repr(model) == model_repr def test_model_operation(self, document_analysis_error, document_model): - model = _models.ModelOperation( + model = _models.ModelOperationDetails( api_version="2022-06-30-preview", tags={"awesome": "tag"}, operation_id="id", @@ -524,7 +524,7 @@ def test_model_operation(self, document_analysis_error, document_model): error=document_analysis_error[0], result=document_model[0], ) - model_repr = "ModelOperation(operation_id={}, status={}, percent_completed={}, created_on={}, last_updated_on={}, kind={}, resource_location={}, result={}, error={}, api_version={}, tags={})".format( + model_repr = "ModelOperationDetails(operation_id={}, status={}, percent_completed={}, created_on={}, last_updated_on={}, kind={}, resource_location={}, result={}, error={}, api_version={}, tags={})".format( "id", "succeeded", 99, @@ -540,7 +540,7 @@ def test_model_operation(self, document_analysis_error, document_model): assert repr(model) == model_repr def test_model_operation_info(self): - model = _models.ModelOperationInfo( + model = _models.ModelOperationSummary( operation_id="id", status="succeeded", percent_completed=100, @@ -551,7 +551,7 @@ def test_model_operation_info(self): api_version="2022-06-30-preview", tags={"test": "value"}, ) - model_repr = "ModelOperationInfo(operation_id={}, status={}, percent_completed={}, created_on={}, last_updated_on={}, kind={}, resource_location={}, api_version={}, tags={})".format( + model_repr = "ModelOperationSummary(operation_id={}, status={}, percent_completed={}, created_on={}, last_updated_on={}, kind={}, resource_location={}, api_version={}, tags={})".format( "id", "succeeded", 100, @@ -565,7 +565,7 @@ def test_model_operation_info(self): assert repr(model) == model_repr def test_document_model(self, doc_type_info): - model = _models.DocumentModelInfo( + model = _models.DocumentModelDetails( description="my description", created_on=datetime.datetime(2021, 9, 16, 10, 10, 59, 342380), model_id="prebuilt-invoice", @@ -575,7 +575,7 @@ def test_document_model(self, doc_type_info): "prebuilt-invoice": doc_type_info[0], } ) - model_repr = "DocumentModelInfo(model_id={}, description={}, created_on={}, api_version={}, tags={}, doc_types={{'prebuilt-invoice': {}}})".format( + model_repr = "DocumentModelDetails(model_id={}, description={}, created_on={}, api_version={}, tags={}, doc_types={{'prebuilt-invoice': {}}})".format( "prebuilt-invoice", "my description", datetime.datetime(2021, 9, 16, 10, 10, 59, 342380), @@ -603,10 +603,10 @@ def test_document_model_info(self): assert repr(model) == model_repr def test_account_info(self): - model = _models.ResourceInfo( + model = _models.ResourceDetails( document_model_limit=5000, document_model_count=10 ) - model_repr = "ResourceInfo(document_model_count={}, document_model_limit={})".format( + model_repr = "ResourceDetails(document_model_count={}, document_model_limit={})".format( 10, 5000 ) assert repr(model) == model_repr diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_to_dict_v3.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_to_dict_v3.py index e6f6a47c9a6f..744d83d4b272 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_to_dict_v3.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_to_dict_v3.py @@ -910,7 +910,7 @@ def test_document_table_cell_to_dict_use_defaults(self): assert d == final def test_model_operation_info_to_dict(self): - model = _models.ModelOperationInfo( + model = _models.ModelOperationSummary( operation_id="id123", status="succeeded", percent_completed=100, @@ -1503,7 +1503,7 @@ def test_analyze_result_to_dict(self): assert d == final def test_model_operation_to_dict(self): - model = _models.ModelOperation( + model = _models.ModelOperationDetails( api_version="2022-06-30-preview", tags={}, operation_id="id123", @@ -1513,7 +1513,7 @@ def test_model_operation_to_dict(self): last_updated_on="1994-11-05T13:20:30Z", kind="documentModelBuild", resource_location="https://contoso.com/resource", - result=_models.DocumentModelInfo( + result=_models.DocumentModelDetails( api_version="2022-06-30-preview", tags={}, description="my description", @@ -1802,7 +1802,7 @@ def test_doc_type_info_to_dict(self): assert d == final def test_document_model_to_dict(self): - model = _models.DocumentModelInfo( + model = _models.DocumentModelDetails( description="my description", created_on="1994-11-05T13:15:30Z", model_id="prebuilt-invoice", @@ -1950,7 +1950,7 @@ def test_document_model_info_to_dict(self): assert d == final def test_account_info_to_dict(self): - model = _models.ResourceInfo(document_model_limit=5000, document_model_count=10) + model = _models.ResourceDetails(document_model_limit=5000, document_model_count=10) d = model.to_dict()