From 549d69bff117cc125457a24f66f0bb9519358583 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 24 Sep 2020 19:02:55 -0700 Subject: [PATCH 01/18] initial model compose --- .../azure/ai/formrecognizer/__init__.py | 6 +- .../formrecognizer/_form_training_client.py | 43 +++++ .../azure/ai/formrecognizer/_models.py | 149 +++++++++++++++--- .../ai/formrecognizer/_response_handlers.py | 20 ++- .../aio/_form_training_client_async.py | 42 +++++ .../sample_create_composed_model_async.py | 81 ++++++++++ .../sample_manage_custom_models_async.py | 2 + .../sample_recognize_custom_forms_async.py | 2 + .../sample_train_model_with_labels_async.py | 7 +- ...sample_train_model_without_labels_async.py | 1 + .../samples/sample_create_composed_model.py | 74 +++++++++ .../samples/sample_manage_custom_models.py | 2 + .../samples/sample_recognize_custom_forms.py | 2 + .../samples/sample_train_model_with_labels.py | 7 +- .../sample_train_model_without_labels.py | 1 + 15 files changed, 412 insertions(+), 27 deletions(-) create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py 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 5add9ba012b7..10fcb5bfdd37 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/__init__.py @@ -31,7 +31,8 @@ CustomFormModel, CustomFormSubmodel, CustomFormModelField, - FieldValueType + FieldValueType, + CustomFormModelProperties, ) from ._api_versions import FormRecognizerApiVersion @@ -62,7 +63,8 @@ 'CustomFormModel', 'CustomFormSubmodel', 'CustomFormModelField', - 'FieldValueType' + 'FieldValueType', + 'CustomFormModelProperties', ] __VERSION__ = VERSION diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py index 7ba856b0e071..77a934efdb9f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py @@ -11,6 +11,7 @@ Any, Dict, Union, + List, TYPE_CHECKING, ) from azure.core.tracing.decorator import distributed_trace @@ -119,6 +120,7 @@ def begin_training(self, training_files_url, use_training_labels, **kwargs): :keyword bool include_subfolders: A flag to indicate if subfolders within the set of prefix folders will also need to be included when searching for content to be preprocessed. Not supported if training with labels. + :keyword str display_name: A display name for your model. :keyword int polling_interval: Waiting time between two polls for LRO operations if no Retry-After header is present. Defaults to 5 seconds. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -128,6 +130,8 @@ def begin_training(self, training_files_url, use_training_labels, **kwargs): :raises ~azure.core.exceptions.HttpResponseError: Note that if the training fails, the exception is raised, but a model with an "invalid" status is still created. You can delete this model by calling :func:`~delete_model()` + .. versionadded:: v2.1-preview + The *display_name* keyword argument .. admonition:: Example: @@ -148,6 +152,7 @@ def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument return CustomFormModel._from_generated(model) cls = kwargs.pop("cls", None) + display_name = kwargs.pop("display_name", None) continuation_token = kwargs.pop("continuation_token", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) @@ -193,6 +198,7 @@ def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument prefix=kwargs.pop("prefix", ""), include_sub_folders=kwargs.pop("include_subfolders", False), ), + model_name=display_name ), cls=deserialization_callback, continuation_token=continuation_token, @@ -406,6 +412,43 @@ def _copy_callback(raw_response, _, headers): # pylint: disable=unused-argument **kwargs ) + @distributed_trace + def begin_create_composed_model( + self, + model_ids, + **kwargs + ): + # type: (List[str], Any) -> LROPoller[CustomFormModel] + """Begin create composed model + + :param list[str] model_ids: List of model IDs that were trained with labels. + :keyword str display_name: Optional model display name. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if + no Retry-After header is present. + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :return: An instance of an LROPoller. Call `result()` on the poller + object to return a :class:`~azure.ai.formrecognizer.CustomFormModel`. + :rtype: ~azure.core.polling.LROPoller[~azure.ai.formrecognizer.CustomFormModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argument + model = self._deserialize(self._generated_models.Model, raw_response) + return CustomFormModel._from_generated_composed(model) + + display_name = kwargs.pop("display_name", None) + polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) + continuation_token = kwargs.pop("continuation_token", None) + + return self._client.begin_compose_custom_models_async( + {"model_ids": model_ids, "model_name": display_name}, + cls=kwargs.pop("cls", _compose_callback), + polling=LROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), + error_map=error_map, + continuation_token=continuation_token, + **kwargs + ) + def get_form_recognizer_client(self, **kwargs): # type: (Any) -> FormRecognizerClient """Get an instance of a FormRecognizerClient from FormTrainingClient. 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 b0c95e6ffd4c..dbab7ce43f61 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -168,6 +168,11 @@ class RecognizedForm(object): :ivar str form_type: The type of form the model identified the submitted form to be. + :ivar str form_type_confidence: + Confidence of the type of form the model identified the submitted form to be. + :ivar str model_id: + Model identifier of model used to analyze form if not using a prebuilt + model. :ivar fields: A dictionary of the fields found on the form. The fields dictionary keys are the `name` of the field. For models trained with labels, @@ -179,20 +184,27 @@ class RecognizedForm(object): :ivar list[~azure.ai.formrecognizer.FormPage] pages: A list of pages recognized from the input document. Contains lines, words, tables and page metadata. + .. versionadded:: v2.1-preview + The *form_type_confidence* and *model_id* properties """ def __init__(self, **kwargs): self.fields = kwargs.get("fields", None) self.form_type = kwargs.get("form_type", None) self.page_range = kwargs.get("page_range", None) self.pages = kwargs.get("pages", None) + self.model_id = kwargs.get('model_id', None) + self.form_type_confidence = kwargs.get('form_type_confidence', None) def __repr__(self): - return "RecognizedForm(form_type={}, fields={}, page_range={}, pages={})" \ + return "RecognizedForm(form_type={}, fields={}, page_range={}, pages={}, form_type_confidence={}," \ + "model_id={})" \ .format( self.form_type, repr(self.fields), repr(self.page_range), - repr(self.pages) + repr(self.pages), + self.form_type_confidence, + self.model_id )[:1024] @@ -586,6 +598,11 @@ class CustomFormModel(object): List of any training errors. :ivar list[~azure.ai.formrecognizer.TrainingDocumentInfo] training_documents: Metadata about each of the documents used to train the model. + :ivar str display_name: Optional user defined model name (max length: 1024). + :ivar properties: Optional model properties. + :vartype properties: ~azure.ai.formrecognizer.CustomFormModelProperties + .. versionadded:: v2.1-preview + The *display_name* and *properties* properties. """ def __init__(self, **kwargs): @@ -596,6 +613,8 @@ def __init__(self, **kwargs): self.submodels = kwargs.get("submodels", None) self.errors = kwargs.get("errors", None) self.training_documents = kwargs.get("training_documents", None) + self.display_name = kwargs.get("display_name", None) + self.properties = kwargs.get("properties", None) @classmethod def _from_generated(cls, model): @@ -609,12 +628,27 @@ def _from_generated(cls, model): errors=FormRecognizerError._from_generated(model.train_result.errors) if model.train_result else None, training_documents=TrainingDocumentInfo._from_generated(model.train_result) - if model.train_result else None + if model.train_result else None, + properties=CustomFormModelProperties._from_generated(model.model_info), + display_name=model.model_info.model_name + ) + + @classmethod + def _from_generated_composed(cls, model): + return cls( + model_id=model.model_info.model_id, + status=model.model_info.status, + training_started_on=model.model_info.created_date_time, + training_completed_on=model.model_info.last_updated_date_time, + submodels=CustomFormSubmodel._from_generated_composed(model), + training_documents=TrainingDocumentInfo._from_generated_composed(model), + properties=CustomFormModelProperties._from_generated(model.model_info), + display_name=model.model_info.model_name ) def __repr__(self): return "CustomFormModel(model_id={}, status={}, training_started_on={}, training_completed_on={}, " \ - "submodels={}, errors={}, training_documents={})" \ + "submodels={}, errors={}, training_documents={}, display_name={}, properties={})" \ .format( self.model_id, self.status, @@ -622,13 +656,16 @@ def __repr__(self): self.training_completed_on, repr(self.submodels), repr(self.errors), - repr(self.training_documents) + repr(self.training_documents), + self.display_name, + repr(self.properties) )[:1024] class CustomFormSubmodel(object): """Represents a submodel that extracts fields from a specific type of form. + :ivar str model_id: Model identifier of the submodel. :ivar float accuracy: The mean of the model's field accuracies. :ivar fields: A dictionary of the fields that this submodel will recognize from the input document. The fields dictionary keys are the `name` of @@ -639,6 +676,7 @@ class CustomFormSubmodel(object): :ivar str form_type: Type of form this submodel recognizes. """ def __init__(self, **kwargs): + self.model_id = kwargs.get("model_id", None) self.accuracy = kwargs.get("accuracy", None) self.fields = kwargs.get("fields", None) self.form_type = kwargs.get("form_type", None) @@ -647,6 +685,7 @@ def __init__(self, **kwargs): def _from_generated_unlabeled(cls, model): return [ cls( + model_id=model.model_info.model_id, accuracy=None, fields=CustomFormModelField._from_generated_unlabeled(fields), form_type="form-" + cluster_id @@ -657,6 +696,7 @@ def _from_generated_unlabeled(cls, model): def _from_generated_labeled(cls, model): return [ cls( + model_id=model.model_info.model_id, accuracy=model.train_result.average_model_accuracy, fields={field.field_name: CustomFormModelField._from_generated_labeled(field) for field in model.train_result.fields} if model.train_result.fields else None, @@ -664,12 +704,25 @@ def _from_generated_labeled(cls, model): ) ] if model.train_result else None + @classmethod + def _from_generated_composed(cls, model): + return [ + cls( + accuracy=train_result.average_model_accuracy, + fields={field.field_name: CustomFormModelField._from_generated_labeled(field) + for field in train_result.fields} if train_result.fields else None, + form_type="form-" + train_result.model_id, # FIXME? + model_id=train_result.model_id + ) for train_result in model.composed_train_results + ] + def __repr__(self): - return "CustomFormSubmodel(accuracy={}, fields={}, form_type={})" \ + return "CustomFormSubmodel(accuracy={}, fields={}, form_type={}, model_id={})" \ .format( self.accuracy, repr(self.fields), - self.form_type + self.form_type, + self.model_id )[:1024] @@ -724,6 +777,8 @@ class TrainingDocumentInfo(object): Total number of pages trained. :ivar list[~azure.ai.formrecognizer.FormRecognizerError] errors: List of any errors for document. + :ivar str model_id: + The model ID that used the document to train. """ def __init__(self, **kwargs): @@ -731,6 +786,7 @@ def __init__(self, **kwargs): self.status = kwargs.get("status", None) self.page_count = kwargs.get("page_count", None) self.errors = kwargs.get("errors", None) + self.model_id = kwargs.get("model_id", None) @classmethod def _from_generated(cls, train_result): @@ -739,17 +795,35 @@ def _from_generated(cls, train_result): name=doc.document_name, status=doc.status, page_count=doc.pages, - errors=FormRecognizerError._from_generated(doc.errors) + errors=FormRecognizerError._from_generated(doc.errors), + model_id=train_result.model_id ) for doc in train_result.training_documents ] if train_result.training_documents else None + @classmethod + def _from_generated_composed(cls, model): + training_document_info = [] + for train_result in model.composed_train_results: + for doc in train_result.training_documents: + training_document_info.append( + cls( + name=doc.document_name, + status=doc.status, + page_count=doc.pages, + errors=FormRecognizerError._from_generated(doc.errors), + model_id=train_result.model_id + ) + ) + return training_document_info + def __repr__(self): - return "TrainingDocumentInfo(name={}, status={}, page_count={}, errors={})" \ + return "TrainingDocumentInfo(name={}, status={}, page_count={}, errors={}, model_id={})" \ .format( self.name, self.status, self.page_count, - repr(self.errors) + repr(self.errors), + self.model_id )[:1024] @@ -785,6 +859,12 @@ class CustomFormModelInfo(object): Date and time (UTC) when model training was started. :ivar ~datetime.datetime training_completed_on: Date and time (UTC) when model training completed. + :ivar display_name: Optional user defined model name (max length: 1024). + :vartype display_name: str + :ivar properties: Optional model properties. + :vartype properties: ~azure.ai.formrecognizer.CustomFormModelProperties + .. versionadded:: v2.1-preview + The *display_name* and *properties* properties """ def __init__(self, **kwargs): @@ -792,6 +872,8 @@ def __init__(self, **kwargs): self.status = kwargs.get("status", None) self.training_started_on = kwargs.get("training_started_on", None) self.training_completed_on = kwargs.get("training_completed_on", None) + self.display_name = kwargs.get("display_name", None) + self.properties = kwargs.get("properties", None) @classmethod def _from_generated(cls, model, model_id=None): @@ -801,17 +883,22 @@ def _from_generated(cls, model, model_id=None): model_id=model_id if model_id else model.model_id, status=model.status, training_started_on=model.created_date_time, - training_completed_on=model.last_updated_date_time + training_completed_on=model.last_updated_date_time, + properties=CustomFormModelProperties._from_generated(model), + display_name=model.model_name ) def __repr__(self): - return "CustomFormModelInfo(model_id={}, status={}, training_started_on={}, training_completed_on={})" \ - .format( - self.model_id, - self.status, - self.training_started_on, - self.training_completed_on - )[:1024] + return "CustomFormModelInfo(model_id={}, status={}, training_started_on={}, training_completed_on={}, " \ + "properties={}, display_name={})" \ + .format( + self.model_id, + self.status, + self.training_started_on, + self.training_completed_on, + repr(self.properties), + self.display_name + )[:1024] class AccountProperties(object): @@ -838,3 +925,29 @@ def __repr__(self): self.custom_model_count, self.custom_model_limit )[:1024] + + +class CustomFormModelProperties(object): + """Optional model properties. + + :ivar bool is_composed_model: Is this model composed? (default: false). + """ + + def __init__( + self, + **kwargs + ): + self.is_composed_model = kwargs.get('is_composed_model', False) + + @classmethod + def _from_generated(cls, model_info): + if model_info.attributes: + return cls( + is_composed_model=model_info.attributes.is_composed + ) + return cls( + is_composed_model=False + ) + + def __repr__(self): + return "CustomFormModelProperties(is_composed_model={})".format(self.is_composed_model) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_response_handlers.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_response_handlers.py index e735bb0c1ac1..1d244f64d886 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_response_handlers.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_response_handlers.py @@ -34,7 +34,9 @@ def prepare_receipt(response): fields={ key: FormField._from_generated(key, value, read_result) for key, value in page.fields.items() - } if page.fields else None + } if page.fields else None, + form_type_confidence=page.doc_type_confidence, + model_id=page.model_id ) receipts.append(receipt) @@ -78,10 +80,10 @@ def prepare_form_result(response, model_id): document_result = response.analyze_result.document_results if document_result: return prepare_labeled_result(response, model_id) - return prepare_unlabeled_result(response) + return prepare_unlabeled_result(response, model_id) -def prepare_unlabeled_result(response): +def prepare_unlabeled_result(response, model_id): result = [] form_pages = prepare_content_result(response) read_result = response.analyze_result.read_results @@ -99,7 +101,9 @@ def prepare_unlabeled_result(response): ), fields=unlabeled_fields, form_type="form-" + str(page.cluster_id) if page.cluster_id is not None else None, - pages=[form_pages[index]] + pages=[form_pages[index]], + model_id=model_id, + form_type_confidence=None ) result.append(form) @@ -110,6 +114,10 @@ def prepare_labeled_result(response, model_id): read_result = response.analyze_result.read_results form_pages = prepare_content_result(response) + form_type = None + if response.analyze_result.version == "2.0.0": + form_type = "form-" + model_id + result = [] for doc in response.analyze_result.document_results: form = RecognizedForm( @@ -122,7 +130,9 @@ def prepare_labeled_result(response, model_id): for label, value in doc.fields.items() }, pages=form_pages[doc.page_range[0]-1:doc.page_range[1]], - form_type="form-" + model_id, + form_type=form_type if form_type else doc.doc_type, + form_type_confidence=doc.doc_type_confidence, + model_id=doc.model_id ) result.append(form) return result diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py index 3e2942d14b9a..84a9b2e81c70 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py @@ -11,6 +11,7 @@ Any, Dict, Union, + List, TYPE_CHECKING, ) from azure.core.polling import AsyncLROPoller @@ -126,6 +127,7 @@ async def begin_training( :keyword bool include_subfolders: A flag to indicate if subfolders within the set of prefix folders will also need to be included when searching for content to be preprocessed. Not supported if training with labels. + :keyword str display_name: A display name for your model. :keyword int polling_interval: Waiting time between two polls for LRO operations if no Retry-After header is present. Defaults to 5 seconds. :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -135,6 +137,8 @@ async def begin_training( :raises ~azure.core.exceptions.HttpResponseError: Note that if the training fails, the exception is raised, but a model with an "invalid" status is still created. You can delete this model by calling :func:`~delete_model()` + .. versionadded:: v2.1-preview + The *display_name* keyword argument .. admonition:: Example: @@ -155,6 +159,7 @@ def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument return CustomFormModel._from_generated(model) cls = kwargs.pop("cls", None) + display_name = kwargs.pop("display_name", None) continuation_token = kwargs.pop("continuation_token", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) @@ -206,6 +211,7 @@ def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument prefix=kwargs.pop("prefix", ""), include_sub_folders=kwargs.pop("include_subfolders", False), ), + model_name=display_name ), cls=deserialization_callback, continuation_token=continuation_token, @@ -427,6 +433,42 @@ def _copy_callback(raw_response, _, headers): # pylint: disable=unused-argument **kwargs ) + @distributed_trace_async + async def begin_create_composed_model( + self, + model_ids: List[str], + **kwargs: Any + ) -> AsyncLROPoller[CustomFormModel]: + """Begin create composed model + + :param list[str] model_ids: List of model IDs that were trained with labels. + :keyword str display_name: Optional model display name. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if + no Retry-After header is present. + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :return: An instance of an AsyncLROPoller. Call `result()` on the poller + object to return a :class:`~azure.ai.formrecognizer.CustomFormModel`. + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.formrecognizer.CustomFormModel] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argument + model = self._deserialize(self._generated_models.Model, raw_response) + return CustomFormModel._from_generated_composed(model) + + display_name = kwargs.pop("display_name", None) + polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) + continuation_token = kwargs.pop("continuation_token", None) + + return await self._client.begin_compose_custom_models_async( + {"model_ids": model_ids, "model_name": display_name}, + cls=kwargs.pop("cls", _compose_callback), + polling=AsyncLROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), + error_map=error_map, + continuation_token=continuation_token, + **kwargs + ) + def get_form_recognizer_client(self, **kwargs: Any) -> FormRecognizerClient: """Get an instance of a FormRecognizerClient from FormTrainingClient. diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py new file mode 100644 index 000000000000..3633174b607a --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: sample_create_composed_model_async.py + +DESCRIPTION: + This sample demonstrates how to create a composite model using existing custom models that + were trained with labels. + +USAGE: + python sample_create_composed_model_async.py + + Set the environment variables with your own values before running the sample: + 1) AZURE_FORM_RECOGNIZER_ENDPOINT - the endpoint to your Cognitive Services resource. + 2) AZURE_FORM_RECOGNIZER_KEY - your Form Recognizer API key +""" + +import os +import asyncio + + +class ComposedModelSampleAsync(object): + + async def create_composed_model_async(self): + from azure.core.credentials import AzureKeyCredential + from azure.ai.formrecognizer.aio import FormTrainingClient + + endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"] + key = os.environ["AZURE_FORM_RECOGNIZER_KEY"] + + form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key)) + + models_trained_with_labels = ["6f4f1583-8f73-4be8-9337-ccc105f1fdff", "4408815d-b870-4b15-86b0-fb1ea69f9853"] + async with form_training_client: + poller = await form_training_client.begin_create_composed_model( + models_trained_with_labels, display_name="my_composed_model" + ) + model = await poller.result() + + # Custom model information + print("Model ID: {}".format(model.model_id)) + print("Model display name: {}".format(model.display_name)) + print("Is this a composite model?: {}".format(model.properties.is_composed_model)) + print("Status: {}".format(model.status)) + print("Composed model creation started on: {}".format(model.training_started_on)) + print("Creation completed on: {}".format(model.training_completed_on)) + + print("Recognized fields:") + for submodel in model.submodels: + print("The submodel has model ID: {}".format(submodel.model_id)) + print("...The submodel with form type {} has an average accuracy '{}'".format( + submodel.form_type, submodel.accuracy + )) + for name, field in submodel.fields.items(): + print("...The model found the field '{}' with an accuracy of {}".format( + name, field.accuracy + )) + + # Training result information + for doc in model.training_documents: + print("Document was used to train model with ID: {}".format(doc.model_id)) + print("Document name: {}".format(doc.name)) + print("Document status: {}".format(doc.status)) + print("Document page count: {}".format(doc.page_count)) + print("Document errors: {}".format(doc.errors)) + + +async def main(): + sample = ComposedModelSampleAsync() + await sample.create_composed_model_async() + + +if __name__ == '__main__': + loop = asyncio.get_event_loop() + loop.run_until_complete(main()) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_manage_custom_models_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_manage_custom_models_async.py index faa669345343..232b5dcf355b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_manage_custom_models_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_manage_custom_models_async.py @@ -64,6 +64,8 @@ async def manage_custom_models(self): custom_model = await form_training_client.get_custom_model(model_id=first_model.model_id) print("\nModel ID: {}".format(custom_model.model_id)) print("Status: {}".format(custom_model.status)) + print("Model display name: {}".format(custom_model.display_name)) + print("Is this a composite model?: {}".format(custom_model.properties.is_composed_model)) print("Training started on: {}".format(custom_model.training_started_on)) print("Training completed on: {}".format(custom_model.training_completed_on)) # [END get_custom_model_async] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_custom_forms_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_custom_forms_async.py index 1e2e01824d4d..e22c99e6327f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_custom_forms_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_recognize_custom_forms_async.py @@ -55,6 +55,8 @@ async def recognize_custom_forms(self): for idx, form in enumerate(forms): print("--------Recognizing Form #{}--------".format(idx+1)) print("Form has type {}".format(form.form_type)) + print("Form has form type confidence {}".format(form.form_type_confidence)) + print("Form was analyzed with model with ID {}".format(form.model_id)) for name, field in form.fields.items(): # each field is of type FormField # label_data is populated if you are using a model trained without labels, diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py index 38905d837546..d17aee0bf97d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py @@ -53,12 +53,16 @@ async def train_model_with_labels(self): ) async with form_training_client: - poller = await form_training_client.begin_training(container_sas_url, use_training_labels=True) + poller = await form_training_client.begin_training( + container_sas_url, use_training_labels=True, display_name="mymodel" + ) model = await poller.result() # Custom model information print("Model ID: {}".format(model.model_id)) print("Status: {}".format(model.status)) + print("Model display name: {}".format(model.display_name)) + print("Is this a composite model?: {}".format(model.properties.is_composed_model)) print("Training started on: {}".format(model.training_started_on)) print("Training completed on: {}".format(model.training_completed_on)) @@ -66,6 +70,7 @@ async def train_model_with_labels(self): # looping through the submodels, which contains the fields they were trained on # The labels are based on the ones you gave the training document. for submodel in model.submodels: + print("...The submodel has model ID: {}".format(submodel.model_id)) print("...The submodel with form type {} has an average accuracy '{}'".format( submodel.form_type, submodel.accuracy )) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_without_labels_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_without_labels_async.py index fb86fc022906..f1f25f679dd3 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_without_labels_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_without_labels_async.py @@ -56,6 +56,7 @@ async def train_model_without_labels(self): # Custom model information print("Model ID: {}".format(model.model_id)) print("Status: {}".format(model.status)) + print("Model display name: {}".format(model.display_name)) print("Training started on: {}".format(model.training_started_on)) print("Training completed on: {}".format(model.training_completed_on)) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py new file mode 100644 index 000000000000..269b475a0c2d --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: sample_create_composed_model.py + +DESCRIPTION: + This sample demonstrates how to create a composite model using existing custom models that + were trained with labels. + +USAGE: + python sample_create_composed_model.py + + Set the environment variables with your own values before running the sample: + 1) AZURE_FORM_RECOGNIZER_ENDPOINT - the endpoint to your Cognitive Services resource. + 2) AZURE_FORM_RECOGNIZER_KEY - your Form Recognizer API key +""" + +import os + + +class ComposedModelSample(object): + + def create_composed_model(self): + from azure.core.credentials import AzureKeyCredential + from azure.ai.formrecognizer import FormTrainingClient + + endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"] + key = os.environ["AZURE_FORM_RECOGNIZER_KEY"] + + form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key)) + + models_trained_with_labels = ["6f4f1583-8f73-4be8-9337-ccc105f1fdff", "4408815d-b870-4b15-86b0-fb1ea69f9853"] + poller = form_training_client.begin_create_composed_model( + models_trained_with_labels, display_name="my_composed_model" + ) + model = poller.result() + + # Custom model information + print("Model ID: {}".format(model.model_id)) + print("Model display name: {}".format(model.display_name)) + print("Is this a composite model?: {}".format(model.properties.is_composed_model)) + print("Status: {}".format(model.status)) + print("Composed model creation started on: {}".format(model.training_started_on)) + print("Creation completed on: {}".format(model.training_completed_on)) + + print("Recognized fields:") + for submodel in model.submodels: + print("The submodel has model ID: {}".format(submodel.model_id)) + print("...The submodel with form type {} has an average accuracy '{}'".format( + submodel.form_type, submodel.accuracy + )) + for name, field in submodel.fields.items(): + print("...The model found the field '{}' with an accuracy of {}".format( + name, field.accuracy + )) + + # Training result information + for doc in model.training_documents: + print("Document was used to train model with ID: {}".format(doc.model_id)) + print("Document name: {}".format(doc.name)) + print("Document status: {}".format(doc.status)) + print("Document page count: {}".format(doc.page_count)) + print("Document errors: {}".format(doc.errors)) + + +if __name__ == '__main__': + sample = ComposedModelSample() + sample.create_composed_model() diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_manage_custom_models.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_manage_custom_models.py index 69386f19c103..8a1755bfb0e4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_manage_custom_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_manage_custom_models.py @@ -61,6 +61,8 @@ def manage_custom_models(self): custom_model = form_training_client.get_custom_model(model_id=first_model.model_id) print("\nModel ID: {}".format(custom_model.model_id)) print("Status: {}".format(custom_model.status)) + print("Model display name: {}".format(custom_model.display_name)) + print("Is this a composite model?: {}".format(custom_model.properties.is_composed_model)) print("Training started on: {}".format(custom_model.training_started_on)) print("Training completed on: {}".format(custom_model.training_completed_on)) # [END get_custom_model] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_custom_forms.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_custom_forms.py index 223388f9ccf0..6e55a8764007 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_custom_forms.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_custom_forms.py @@ -54,6 +54,8 @@ def recognize_custom_forms(self): for idx, form in enumerate(forms): print("--------Recognizing Form #{}--------".format(idx+1)) print("Form has type {}".format(form.form_type)) + print("Form has form type confidence {}".format(form.form_type_confidence)) + print("Form was analyzed with model with ID {}".format(form.model_id)) for name, field in form.fields.items(): # each field is of type FormField # label_data is populated if you are using a model trained without labels, diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py index 31c7cdae2a67..2b5b467c88a0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py @@ -48,12 +48,16 @@ def train_model_with_labels(self): container_sas_url = os.environ["CONTAINER_SAS_URL"] form_training_client = FormTrainingClient(endpoint, AzureKeyCredential(key)) - poller = form_training_client.begin_training(container_sas_url, use_training_labels=True) + poller = form_training_client.begin_training( + container_sas_url, use_training_labels=True, display_name="mymodel" + ) model = poller.result() # Custom model information print("Model ID: {}".format(model.model_id)) print("Status: {}".format(model.status)) + print("Model display name: {}".format(model.display_name)) + print("Is this a composite model?: {}".format(model.properties.is_composed_model)) print("Training started on: {}".format(model.training_started_on)) print("Training completed on: {}".format(model.training_completed_on)) @@ -61,6 +65,7 @@ def train_model_with_labels(self): # looping through the submodels, which contains the fields they were trained on # The labels are based on the ones you gave the training document. for submodel in model.submodels: + print("...The submodel has model ID: {}".format(submodel.model_id)) print("...The submodel with form type {} has an average accuracy '{}'".format( submodel.form_type, submodel.accuracy )) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_without_labels.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_without_labels.py index 875c8ff42059..bb698ed575ba 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_without_labels.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_without_labels.py @@ -52,6 +52,7 @@ def train_model_without_labels(self): # Custom model information print("Model ID: {}".format(model.model_id)) print("Status: {}".format(model.status)) + print("Model display name: {}".format(model.display_name)) print("Training started on: {}".format(model.training_started_on)) print("Training completed on: {}".format(model.training_completed_on)) From dc7fe098e3774c0f8360a9585a8960645042aa1a Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 24 Sep 2020 19:37:16 -0700 Subject: [PATCH 02/18] fix tests for composed model and repr --- .../azure/ai/formrecognizer/_models.py | 16 +++++--- .../tests/test_custom_forms.py | 10 ++--- .../tests/test_custom_forms_async.py | 10 ++--- .../tests/test_custom_forms_from_url.py | 10 ++--- .../tests/test_custom_forms_from_url_async.py | 10 ++--- .../tests/test_repr.py | 38 ++++++++++++------- 6 files changed, 56 insertions(+), 38 deletions(-) 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 dbab7ce43f61..0f370c5b62d0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -196,7 +196,7 @@ def __init__(self, **kwargs): self.form_type_confidence = kwargs.get('form_type_confidence', None) def __repr__(self): - return "RecognizedForm(form_type={}, fields={}, page_range={}, pages={}, form_type_confidence={}," \ + return "RecognizedForm(form_type={}, fields={}, page_range={}, pages={}, form_type_confidence={}, " \ "model_id={})" \ .format( self.form_type, @@ -717,12 +717,12 @@ def _from_generated_composed(cls, model): ] def __repr__(self): - return "CustomFormSubmodel(accuracy={}, fields={}, form_type={}, model_id={})" \ + return "CustomFormSubmodel(accuracy={}, model_id={}, fields={}, form_type={})" \ .format( self.accuracy, + self.model_id, repr(self.fields), self.form_type, - self.model_id )[:1024] @@ -879,13 +879,19 @@ def __init__(self, **kwargs): def _from_generated(cls, model, model_id=None): if model.status == "succeeded": # map copy status to model status model.status = "ready" + + properties, display_name = None, None + if hasattr(model, "attributes"): + properties = CustomFormModelProperties._from_generated(model) + if hasattr(model, "model_name"): + display_name = model.model_name return cls( model_id=model_id if model_id else model.model_id, status=model.status, training_started_on=model.created_date_time, training_completed_on=model.last_updated_date_time, - properties=CustomFormModelProperties._from_generated(model), - display_name=model.model_name + properties=properties, + display_name=display_name ) def __repr__(self): diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py index c210f0af8db5..2f69368afa77 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py @@ -191,7 +191,7 @@ def test_custom_form_labeled(self, client, container_sas_url): poller = fr_client.begin_recognize_custom_forms(model.model_id, myfile, content_type=FormContentType.IMAGE_JPEG) form = poller.result() - self.assertEqual(form[0].form_type, "form-"+model.model_id) + self.assertEqual(form[0].form_type, "custom:"+model.model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -221,7 +221,7 @@ def test_custom_form_multipage_labeled(self, client, container_sas_url): forms = poller.result() for form in forms: - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -377,7 +377,7 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -441,7 +441,7 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -480,5 +480,5 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py index 25ad211cb985..16b3abe977e1 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py @@ -211,7 +211,7 @@ async def test_custom_form_labeled(self, client, container_sas_url): poller = await fr_client.begin_recognize_custom_forms(model.model_id, myfile, content_type=FormContentType.IMAGE_JPEG) form = await poller.result() - self.assertEqual(form[0].form_type, "form-"+model.model_id) + self.assertEqual(form[0].form_type, "custom:"+model.model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -242,7 +242,7 @@ async def test_custom_form_multipage_labeled(self, client, container_sas_url): forms = await poller.result() for form in forms: - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -411,7 +411,7 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -480,7 +480,7 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -521,5 +521,5 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py index dd1d8696dd35..c089f8d165bc 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py @@ -147,7 +147,7 @@ def test_custom_form_labeled(self, client, container_sas_url): poller = fr_client.begin_recognize_custom_forms_from_url(model.model_id, self.form_url_jpg) form = poller.result() - self.assertEqual(form[0].form_type, "form-"+model.model_id) + self.assertEqual(form[0].form_type, "custom:"+model.model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -173,7 +173,7 @@ def test_form_multipage_labeled(self, client, container_sas_url, blob_sas_url): forms = poller.result() for form in forms: - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -319,7 +319,7 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -379,7 +379,7 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -415,5 +415,5 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py index 53411cfe41f9..31cbede03912 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py @@ -168,7 +168,7 @@ async def test_form_labeled(self, client, container_sas_url): poller = await fr_client.begin_recognize_custom_forms_from_url(model.model_id, self.form_url_jpg) form = await poller.result() - self.assertEqual(form[0].form_type, "form-"+model.model_id) + self.assertEqual(form[0].form_type, "custom:"+model.model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -196,7 +196,7 @@ async def test_form_multipage_labeled(self, client, container_sas_url, blob_sas_ forms = await poller.result() for form in forms: - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -351,7 +351,7 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -414,7 +414,7 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -452,5 +452,5 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, document_results): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "form-"+model.model_id) + self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py index c8da3a6c2a8d..ba062db90ce3 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_repr.py @@ -104,8 +104,8 @@ def custom_form_model_field(): @pytest.fixture def custom_form_sub_model(custom_form_model_field): - model = _models.CustomFormSubmodel(accuracy=0.99, fields={"name": custom_form_model_field[0]}, form_type="Itemized") - model_repr = "CustomFormSubmodel(accuracy=0.99, fields={{'name': {}}}, form_type=Itemized)".format(custom_form_model_field[1])[:1024] + model = _models.CustomFormSubmodel(accuracy=0.99, model_id=1, fields={"name": custom_form_model_field[0]}, form_type="Itemized") + model_repr = "CustomFormSubmodel(accuracy=0.99, model_id=1, fields={{'name': {}}}, form_type=Itemized)".format(custom_form_model_field[1])[:1024] assert repr(model) == model_repr return model, model_repr @@ -118,8 +118,15 @@ def form_recognizer_error(): @pytest.fixture def training_document_info(form_recognizer_error): - model = _models.TrainingDocumentInfo(name="name", status=_models.TrainingStatus.PARTIALLY_SUCCEEDED, page_count=5, errors=[form_recognizer_error[0]]) - model_repr = "TrainingDocumentInfo(name=name, status=partiallySucceeded, page_count=5, errors=[{}])".format(form_recognizer_error[1])[:1024] + model = _models.TrainingDocumentInfo(name="name", status=_models.TrainingStatus.PARTIALLY_SUCCEEDED, page_count=5, errors=[form_recognizer_error[0]], model_id=1) + model_repr = "TrainingDocumentInfo(name=name, status=partiallySucceeded, page_count=5, errors=[{}], model_id=1)".format(form_recognizer_error[1])[:1024] + assert repr(model) == model_repr + return model, model_repr + +@pytest.fixture +def custom_form_model_properties(): + model = _models.CustomFormModelProperties(is_composed_model=True) + model_repr = "CustomFormModelProperties(is_composed_model=True)" assert repr(model) == model_repr return model, model_repr @@ -128,13 +135,13 @@ class TestRepr(): # Not inheriting form FormRecognizerTest because that doesn't allow me to define pytest fixtures in the same file # Not worth moving pytest fixture definitions to conftest since all I would use is assertEqual and I can just use assert def test_recognized_form(self, form_field_one, page_range, form_page): - model = _models.RecognizedForm(form_type="receipt", fields={"one": form_field_one[0]}, page_range=page_range[0], pages=[form_page[0]]) - model_repr = "RecognizedForm(form_type=receipt, fields={{'one': {}}}, page_range={}, pages=[{}])".format( + model = _models.RecognizedForm(form_type="receipt", form_type_confidence=1.0, model_id=1, fields={"one": form_field_one[0]}, page_range=page_range[0], pages=[form_page[0]]) + model_repr = "RecognizedForm(form_type=receipt, fields={{'one': {}}}, page_range={}, pages=[{}], form_type_confidence=1.0, model_id=1)".format( form_field_one[1], page_range[1], form_page[1] )[:1024] assert repr(model) == model_repr - def test_custom_form_model(self, custom_form_sub_model, form_recognizer_error, training_document_info): + def test_custom_form_model(self, custom_form_sub_model, custom_form_model_properties, form_recognizer_error, training_document_info): model = _models.CustomFormModel( model_id=1, status=_models.CustomFormModelStatus.CREATING, @@ -142,21 +149,26 @@ def test_custom_form_model(self, custom_form_sub_model, form_recognizer_error, t training_completed_on=datetime.datetime(1, 1, 1), submodels=[custom_form_sub_model[0], custom_form_sub_model[0]], errors=[form_recognizer_error[0]], - training_documents=[training_document_info[0], training_document_info[0]] + training_documents=[training_document_info[0], training_document_info[0]], + properties=custom_form_model_properties[0], + display_name="my model" ) model_repr = "CustomFormModel(model_id=1, status=creating, training_started_on=0001-01-01 00:00:00, " \ - "training_completed_on=0001-01-01 00:00:00, submodels=[{}, {}], errors=[{}], training_documents=[{}, {}])".format( - custom_form_sub_model[1], custom_form_sub_model[1], form_recognizer_error[1], training_document_info[1], training_document_info[1] + "training_completed_on=0001-01-01 00:00:00, submodels=[{}, {}], errors=[{}], training_documents=[{}, {}], " \ + "display_name=my model, properties={})".format( + custom_form_sub_model[1], custom_form_sub_model[1], form_recognizer_error[1], training_document_info[1], training_document_info[1], + custom_form_model_properties[1] )[:1024] assert repr(model) == model_repr - def test_custom_form_model_info(self): + def test_custom_form_model_info(self, custom_form_model_properties): model = _models.CustomFormModelInfo( - model_id=1, status=_models.CustomFormModelStatus.READY, training_started_on=datetime.datetime(1, 1, 1), training_completed_on=datetime.datetime(1, 1, 1) + model_id=1, status=_models.CustomFormModelStatus.READY, training_started_on=datetime.datetime(1, 1, 1), training_completed_on=datetime.datetime(1, 1, 1), + properties=custom_form_model_properties[0], display_name="my model" ) - model_repr = "CustomFormModelInfo(model_id=1, status=ready, training_started_on=0001-01-01 00:00:00, training_completed_on=0001-01-01 00:00:00)"[:1024] + model_repr = "CustomFormModelInfo(model_id=1, status=ready, training_started_on=0001-01-01 00:00:00, training_completed_on=0001-01-01 00:00:00, properties={}, display_name=my model)".format(custom_form_model_properties[1])[:1024] assert repr(model) == model_repr def test_account_properties(self): From 9c404a3f65c5d3b369ec1d8a539226ecb6022c86 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 24 Sep 2020 19:52:52 -0700 Subject: [PATCH 03/18] mypy --- .../azure/ai/formrecognizer/aio/_form_training_client_async.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py index 84a9b2e81c70..79684a0f935f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py @@ -460,7 +460,7 @@ def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argum polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) continuation_token = kwargs.pop("continuation_token", None) - return await self._client.begin_compose_custom_models_async( + return await self._client.begin_compose_custom_models_async( # type: ignore {"model_ids": model_ids, "model_name": display_name}, cls=kwargs.pop("cls", _compose_callback), polling=AsyncLROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), From b2a85026e1f91a688a51f1acee9720519aeef9b5 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 28 Sep 2020 17:19:22 -0700 Subject: [PATCH 04/18] fix comments --- .../azure/ai/formrecognizer/_models.py | 4 +++- .../azure/ai/formrecognizer/_response_handlers.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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 0f370c5b62d0..a1944cdc9484 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -880,9 +880,11 @@ def _from_generated(cls, model, model_id=None): if model.status == "succeeded": # map copy status to model status model.status = "ready" - properties, display_name = None, None + display_name = None if hasattr(model, "attributes"): properties = CustomFormModelProperties._from_generated(model) + else: + properties = CustomFormModelProperties(is_composed_model=False) if hasattr(model, "model_name"): display_name = model.model_name return cls( diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_response_handlers.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_response_handlers.py index 1d244f64d886..15dd61b5b102 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_response_handlers.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_response_handlers.py @@ -6,7 +6,7 @@ # pylint: disable=protected-access -from ._helpers import adjust_text_angle +from ._helpers import adjust_text_angle, adjust_confidence from ._models import ( FormField, FormPage, @@ -131,7 +131,7 @@ def prepare_labeled_result(response, model_id): }, pages=form_pages[doc.page_range[0]-1:doc.page_range[1]], form_type=form_type if form_type else doc.doc_type, - form_type_confidence=doc.doc_type_confidence, + form_type_confidence=adjust_confidence(doc.doc_type_confidence), model_id=doc.model_id ) result.append(form) From 45a10d5e7df78556a3dd5c2377cf7d64d5b0a550 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 29 Sep 2020 08:24:34 -0700 Subject: [PATCH 05/18] add fixmes --- .../azure/ai/formrecognizer/_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 a1944cdc9484..96dc31473c70 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -700,7 +700,7 @@ def _from_generated_labeled(cls, model): accuracy=model.train_result.average_model_accuracy, fields={field.field_name: CustomFormModelField._from_generated_labeled(field) for field in model.train_result.fields} if model.train_result.fields else None, - form_type="form-" + model.model_info.model_id + form_type="form-" + model.model_info.model_id # FIXME: should match form_type in RecognizedForm ) ] if model.train_result else None @@ -711,7 +711,7 @@ def _from_generated_composed(cls, model): accuracy=train_result.average_model_accuracy, fields={field.field_name: CustomFormModelField._from_generated_labeled(field) for field in train_result.fields} if train_result.fields else None, - form_type="form-" + train_result.model_id, # FIXME? + form_type="form-" + train_result.model_id, # FIXME: should match form_type in RecognizedForm model_id=train_result.model_id ) for train_result in model.composed_train_results ] From 58cbecb8207bc8fc2a89c9e0b26620d9b4a498b5 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 30 Sep 2020 09:25:24 -0700 Subject: [PATCH 06/18] set form_type on CustomFormSubmodel correctly --- .../formrecognizer/_form_training_client.py | 6 +++--- .../azure/ai/formrecognizer/_models.py | 19 ++++++++++++++----- .../aio/_form_training_client_async.py | 6 +++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py index 77a934efdb9f..99cc84909863 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py @@ -145,11 +145,11 @@ def begin_training(self, training_files_url, use_training_labels, **kwargs): def callback_v2_0(raw_response): model = self._deserialize(self._generated_models.Model, raw_response) - return CustomFormModel._from_generated(model) + return CustomFormModel._from_generated(model, api_version=self.api_version) def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument model = self._deserialize(self._generated_models.Model, raw_response) - return CustomFormModel._from_generated(model) + return CustomFormModel._from_generated(model, api_version=self.api_version) cls = kwargs.pop("cls", None) display_name = kwargs.pop("display_name", None) @@ -309,7 +309,7 @@ def get_custom_model(self, model_id, **kwargs): raise ValueError("model_id cannot be None or empty.") response = self._client.get_custom_model(model_id=model_id, include_keys=True, error_map=error_map, **kwargs) - return CustomFormModel._from_generated(response) + return CustomFormModel._from_generated(response, api_version=self.api_version) @distributed_trace def get_copy_authorization(self, resource_id, resource_region, **kwargs): 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 96dc31473c70..45a1a53cf375 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -617,14 +617,16 @@ def __init__(self, **kwargs): self.properties = kwargs.get("properties", None) @classmethod - def _from_generated(cls, model): + def _from_generated(cls, model, api_version): return cls( model_id=model.model_info.model_id, status=model.model_info.status, training_started_on=model.model_info.created_date_time, training_completed_on=model.model_info.last_updated_date_time, submodels=CustomFormSubmodel._from_generated_unlabeled(model) - if model.keys else CustomFormSubmodel._from_generated_labeled(model), + if model.keys else CustomFormSubmodel._from_generated_labeled( + model, api_version, display_name=model.model_info.model_name + ), errors=FormRecognizerError._from_generated(model.train_result.errors) if model.train_result else None, training_documents=TrainingDocumentInfo._from_generated(model.train_result) @@ -693,14 +695,21 @@ def _from_generated_unlabeled(cls, model): ] @classmethod - def _from_generated_labeled(cls, model): + def _from_generated_labeled(cls, model, api_version, display_name): + if api_version == "2.0": + form_type = "form-" + model.model_info.model_id + elif display_name: + form_type = "custom:" + display_name + else: + form_type = "custom:" + model.model_info.model_id + return [ cls( model_id=model.model_info.model_id, accuracy=model.train_result.average_model_accuracy, fields={field.field_name: CustomFormModelField._from_generated_labeled(field) for field in model.train_result.fields} if model.train_result.fields else None, - form_type="form-" + model.model_info.model_id # FIXME: should match form_type in RecognizedForm + form_type=form_type ) ] if model.train_result else None @@ -711,7 +720,7 @@ def _from_generated_composed(cls, model): accuracy=train_result.average_model_accuracy, fields={field.field_name: CustomFormModelField._from_generated_labeled(field) for field in train_result.fields} if train_result.fields else None, - form_type="form-" + train_result.model_id, # FIXME: should match form_type in RecognizedForm + form_type="custom:" + train_result.model_id, model_id=train_result.model_id ) for train_result in model.composed_train_results ] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py index 79684a0f935f..92981ea551a8 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py @@ -152,11 +152,11 @@ async def begin_training( def callback_v2_0(raw_response): model = self._deserialize(self._generated_models.Model, raw_response) - return CustomFormModel._from_generated(model) + return CustomFormModel._from_generated(model, api_version=self.api_version) def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument model = self._deserialize(self._generated_models.Model, raw_response) - return CustomFormModel._from_generated(model) + return CustomFormModel._from_generated(model, api_version=self.api_version) cls = kwargs.pop("cls", None) display_name = kwargs.pop("display_name", None) @@ -323,7 +323,7 @@ async def get_custom_model(self, model_id: str, **kwargs: Any) -> CustomFormMode error_map=error_map, **kwargs ) - return CustomFormModel._from_generated(response) + return CustomFormModel._from_generated(response, api_version=self.api_version) @distributed_trace_async async def get_copy_authorization( From 380be3c41ec7b314717e07043b178692f8f6325b Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 30 Sep 2020 09:33:53 -0700 Subject: [PATCH 07/18] fix training tests --- .../azure-ai-formrecognizer/tests/test_training.py | 8 ++++---- .../azure-ai-formrecognizer/tests/test_training_async.py | 8 ++++---- .../azure-ai-formrecognizer/tests/testcase.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py index 4fe0e83f6a6d..95f664ca030f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py @@ -108,7 +108,7 @@ def test_training_transform(self, client, container_sas_url): def callback(response, _, headers): raw_model = client._deserialize(Model, response) - custom_model = CustomFormModel._from_generated(raw_model) + custom_model = CustomFormModel._from_generated(raw_model, client.api_version) raw_response.append(raw_model) raw_response.append(custom_model) @@ -127,7 +127,7 @@ def test_training_multipage_transform(self, client, container_sas_url): def callback(response, _, headers): raw_model = client._deserialize(Model, response) - custom_model = CustomFormModel._from_generated(raw_model) + custom_model = CustomFormModel._from_generated(raw_model, client.api_version) raw_response.append(raw_model) raw_response.append(custom_model) @@ -194,7 +194,7 @@ def test_training_with_labels_transform(self, client, container_sas_url): def callback(response, _, headers): raw_model = client._deserialize(Model, response) - custom_model = CustomFormModel._from_generated(raw_model) + custom_model = CustomFormModel._from_generated(raw_model, client.api_version) raw_response.append(raw_model) raw_response.append(custom_model) @@ -213,7 +213,7 @@ def test_train_multipage_w_labels_transform(self, client, container_sas_url): def callback(response, _, headers): raw_model = client._deserialize(Model, response) - custom_model = CustomFormModel._from_generated(raw_model) + custom_model = CustomFormModel._from_generated(raw_model, client.api_version) raw_response.append(raw_model) raw_response.append(custom_model) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py index c6b55dac1976..90cc9f7a0a98 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py @@ -115,7 +115,7 @@ async def test_training_transform(self, client, container_sas_url): def callback(response, _, headers): raw_model = client._deserialize(Model, response) - custom_model = CustomFormModel._from_generated(raw_model) + custom_model = CustomFormModel._from_generated(raw_model, client.api_version) raw_response.append(raw_model) raw_response.append(custom_model) @@ -138,7 +138,7 @@ async def test_training_multipage_transform(self, client, container_sas_url): def callback(response, _, headers): raw_model = client._deserialize(Model, response) - custom_model = CustomFormModel._from_generated(raw_model) + custom_model = CustomFormModel._from_generated(raw_model, client.api_version) raw_response.append(raw_model) raw_response.append(custom_model) @@ -205,7 +205,7 @@ async def test_training_with_labels_transform(self, client, container_sas_url): def callback(response, _, headers): raw_model = client._deserialize(Model, response) - custom_model = CustomFormModel._from_generated(raw_model) + custom_model = CustomFormModel._from_generated(raw_model, client.api_version) raw_response.append(raw_model) raw_response.append(custom_model) @@ -225,7 +225,7 @@ async def test_train_multipage_w_lbls_trnsfrm(self, client, container_sas_url): def callback(response, _, headers): raw_model = client._deserialize(Model, response) - custom_model = CustomFormModel._from_generated(raw_model) + custom_model = CustomFormModel._from_generated(raw_model, client.api_version) raw_response.append(raw_model) raw_response.append(custom_model) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py index 11bb8dff5cc6..ec4b51013b90 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py @@ -157,7 +157,7 @@ def assertModelTransformCorrect(self, model, actual, unlabeled=False): for a in actual.train_result.fields: self.assertEqual(model.submodels[0].fields[a.field_name].name, a.field_name) self.assertEqual(model.submodels[0].fields[a.field_name].accuracy, a.accuracy) - self.assertEqual(model.submodels[0].form_type, "form-"+model.model_id) + self.assertEqual(model.submodels[0].form_type, "custom:"+model.model_id) self.assertEqual(model.submodels[0].accuracy, actual.train_result.average_model_accuracy) def assertFormPagesTransformCorrect(self, pages, actual_read, page_result=None, **kwargs): From f5cd77deec481c7986269fb1fbc16d8c7f22a918 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 5 Oct 2020 14:47:08 -0700 Subject: [PATCH 08/18] remove error map/cont token from compose model --- .../azure/ai/formrecognizer/_form_training_client.py | 3 --- .../azure/ai/formrecognizer/aio/_form_training_client_async.py | 3 --- 2 files changed, 6 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py index 2efa34962107..357d40ac3a3c 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py @@ -403,14 +403,11 @@ def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argum display_name = kwargs.pop("display_name", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) - continuation_token = kwargs.pop("continuation_token", None) return self._client.begin_compose_custom_models_async( {"model_ids": model_ids, "model_name": display_name}, cls=kwargs.pop("cls", _compose_callback), polling=LROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), - error_map=error_map, - continuation_token=continuation_token, **kwargs ) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py index 22912934d668..db5086582c9a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py @@ -414,14 +414,11 @@ def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argum display_name = kwargs.pop("display_name", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) - continuation_token = kwargs.pop("continuation_token", None) return await self._client.begin_compose_custom_models_async( # type: ignore {"model_ids": model_ids, "model_name": display_name}, cls=kwargs.pop("cls", _compose_callback), polling=AsyncLROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), - error_map=error_map, - continuation_token=continuation_token, **kwargs ) From f4537ac8d0ace81ef73ea9e9cfdf99dca5972de4 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 5 Oct 2020 18:24:05 -0700 Subject: [PATCH 09/18] add composed model tests --- .../formrecognizer/_form_training_client.py | 4 +- .../aio/_form_training_client_async.py | 4 +- ...test_compose_model.test_compose_model.yaml | 285 ++++++++++++++ ...odel.test_compose_model_invalid_model.yaml | 41 ++ ...ompose_model_invalid_unlabeled_models.yaml | 355 ++++++++++++++++++ ...ompose_model_async.test_compose_model.yaml | 219 +++++++++++ ...sync.test_compose_model_invalid_model.yaml | 31 ++ ...ompose_model_invalid_unlabeled_models.yaml | 253 +++++++++++++ .../tests/test_compose_model.py | 79 ++++ .../tests/test_compose_model_async.py | 81 ++++ .../azure-ai-formrecognizer/tests/testcase.py | 33 ++ 11 files changed, 1383 insertions(+), 2 deletions(-) create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model.yaml create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_invalid_model.yaml create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_invalid_unlabeled_models.yaml create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model.yaml create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_invalid_model.yaml create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_invalid_unlabeled_models.yaml create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py index 357d40ac3a3c..83537fdddcd0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py @@ -384,7 +384,7 @@ def begin_create_composed_model( **kwargs ): # type: (List[str], Any) -> LROPoller[CustomFormModel] - """Begin create composed model + """Creates a composed model from a collection of existing trained models with labels. :param list[str] model_ids: List of model IDs that were trained with labels. :keyword str display_name: Optional model display name. @@ -403,11 +403,13 @@ def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argum display_name = kwargs.pop("display_name", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) + continuation_token = kwargs.pop("continuation_token", None) return self._client.begin_compose_custom_models_async( {"model_ids": model_ids, "model_name": display_name}, cls=kwargs.pop("cls", _compose_callback), polling=LROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), + continuation_token=continuation_token, **kwargs ) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py index db5086582c9a..d1589609dc6b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py @@ -395,7 +395,7 @@ async def begin_create_composed_model( model_ids: List[str], **kwargs: Any ) -> AsyncLROPoller[CustomFormModel]: - """Begin create composed model + """Creates a composed model from a collection of existing trained models with labels. :param list[str] model_ids: List of model IDs that were trained with labels. :keyword str display_name: Optional model display name. @@ -414,11 +414,13 @@ def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argum display_name = kwargs.pop("display_name", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) + continuation_token = kwargs.pop("continuation_token", None) return await self._client.begin_compose_custom_models_async( # type: ignore {"model_ids": model_ids, "model_name": display_name}, cls=kwargs.pop("cls", _compose_callback), polling=AsyncLROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), + continuation_token=continuation_token, **kwargs ) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model.yaml new file mode 100644 index 000000000000..a3aa268fe8ba --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model.yaml @@ -0,0 +1,285 @@ +interactions: +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '287' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: + - 031dccc0-be47-4bd9-9e92-b5846ede307e + content-length: + - '0' + date: + - Mon, 05 Oct 2020 23:55:20 GMT + location: + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/24837f23-2249-4d9a-a356-8ebac73891fb + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '42' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/24837f23-2249-4d9a-a356-8ebac73891fb?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "24837f23-2249-4d9a-a356-8ebac73891fb", "attributes": + {"isComposed": false}, "status": "ready", "createdDateTime": "2020-10-05T23:55:21Z", + "lastUpdatedDateTime": "2020-10-05T23:55:23Z"}, "trainResult": {"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "errors": []}}' + headers: + apim-request-id: + - 7f2f9b2d-4c40-43ee-b29f-8078fa2a451c + content-type: + - application/json; charset=utf-8 + date: + - Mon, 05 Oct 2020 23:55:26 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '17' + status: + code: 200 + message: OK +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true, "modelName": "second-labeled-model"}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '324' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: + - 73a3cc92-bfea-4fce-be42-78ea64f7ca56 + content-length: + - '0' + date: + - Mon, 05 Oct 2020 23:55:26 GMT + location: + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/d1a69df1-4d35-48cc-9cb9-08df78904098 + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '60' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/d1a69df1-4d35-48cc-9cb9-08df78904098?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "d1a69df1-4d35-48cc-9cb9-08df78904098", "modelName": + "second-labeled-model", "attributes": {"isComposed": false}, "status": "ready", + "createdDateTime": "2020-10-05T23:55:26Z", "lastUpdatedDateTime": "2020-10-05T23:55:29Z"}, + "trainResult": {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": + "Form_1.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], + "fields": [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": + "CompanyName", "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": + 1.0}, {"fieldName": "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": + 0.8}, {"fieldName": "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", + "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": + "Quantity", "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, + {"fieldName": "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": + 1.0}, {"fieldName": "Total", "accuracy": 1.0}, {"fieldName": "VendorName", + "accuracy": 1.0}, {"fieldName": "Website", "accuracy": 1.0}], "errors": []}}' + headers: + apim-request-id: + - 69f29fe3-590a-45b9-a559-608c2ec6b8ec + content-type: + - application/json; charset=utf-8 + date: + - Mon, 05 Oct 2020 23:55:31 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '19' + status: + code: 200 + message: OK +- request: + body: 'b''{"modelIds": ["24837f23-2249-4d9a-a356-8ebac73891fb", "d1a69df1-4d35-48cc-9cb9-08df78904098"], + "modelName": "my composed model"}''' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '128' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/compose + response: + body: + string: '' + headers: + apim-request-id: + - bb0763ca-f552-4dfd-bdbf-54826ba12a27 + content-length: + - '0' + date: + - Mon, 05 Oct 2020 23:55:31 GMT + location: + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d6fd659-35d0-436d-908f-97bfb08314ce + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '168' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d6fd659-35d0-436d-908f-97bfb08314ce?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "2d6fd659-35d0-436d-908f-97bfb08314ce", "modelName": + "my composed model", "attributes": {"isComposed": true}, "status": "ready", + "createdDateTime": "2020-10-05T23:55:32Z", "lastUpdatedDateTime": "2020-10-05T23:55:32Z"}, + "composedTrainResults": [{"averageModelAccuracy": 0.96, "trainingDocuments": + [{"documentName": "Form_1.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_2.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_4.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", "pages": 1, "status": + "succeeded"}], "fields": [{"fieldName": "CompanyAddress", "accuracy": 0.8}, + {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", + "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": 1.0}, {"fieldName": + "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": 1.0}, {"fieldName": + "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", "accuracy": + 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": "Signature", + "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, {"fieldName": + "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": 1.0}, {"fieldName": + "VendorName", "accuracy": 1.0}, {"fieldName": "Website", "accuracy": 1.0}], + "modelId": "24837f23-2249-4d9a-a356-8ebac73891fb", "errors": []}, {"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "modelId": "d1a69df1-4d35-48cc-9cb9-08df78904098", "errors": + []}]}' + headers: + apim-request-id: + - c0c5a9bf-0e81-40d3-89b0-d1a82982cf24 + content-type: + - application/json; charset=utf-8 + date: + - Mon, 05 Oct 2020 23:55:37 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '16' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_invalid_model.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_invalid_model.yaml new file mode 100644 index 000000000000..32fdccea16cc --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_invalid_model.yaml @@ -0,0 +1,41 @@ +interactions: +- request: + body: 'b''{"modelIds": ["00000000-0000-0000-0000-000000000000"]}''' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '54' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/compose + response: + body: + string: '{"error": {"code": "1001", "message": "Parameter ''ModelIds'' is either + null or has less than two unique models."}}' + headers: + apim-request-id: + - 0f62befa-3e35-4879-9df8-78873ddee878 + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 00:06:58 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '2' + status: + code: 400 + message: Bad Request +version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_invalid_unlabeled_models.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_invalid_unlabeled_models.yaml new file mode 100644 index 000000000000..e4385be91c59 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_invalid_unlabeled_models.yaml @@ -0,0 +1,355 @@ +interactions: +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '288' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: + - 3b18bdb2-9339-4a8a-b190-607836b29f6e + content-length: + - '0' + date: + - Tue, 06 Oct 2020 00:02:05 GMT + location: + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/652c03ee-9d6a-4291-bb36-9b653107a2fd + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '42' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/652c03ee-9d6a-4291-bb36-9b653107a2fd?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "652c03ee-9d6a-4291-bb36-9b653107a2fd", "status": + "creating", "createdDateTime": "2020-10-06T00:02:05Z", "lastUpdatedDateTime": + "2020-10-06T00:02:05Z"}}' + headers: + apim-request-id: + - a216ecb8-82e0-4a9d-a80c-67f0f037964f + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 00:02:11 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '42' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/652c03ee-9d6a-4291-bb36-9b653107a2fd?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "652c03ee-9d6a-4291-bb36-9b653107a2fd", "status": + "creating", "createdDateTime": "2020-10-06T00:02:05Z", "lastUpdatedDateTime": + "2020-10-06T00:02:05Z"}}' + headers: + apim-request-id: + - 44f9be3e-1015-437a-8ecd-9d780e0b9e51 + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 00:02:15 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '99' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/652c03ee-9d6a-4291-bb36-9b653107a2fd?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "652c03ee-9d6a-4291-bb36-9b653107a2fd", "status": + "ready", "createdDateTime": "2020-10-06T00:02:05Z", "lastUpdatedDateTime": + "2020-10-06T00:02:19Z"}, "keys": {"clusters": {"0": ["Additional Notes:", + "Address:", "Company Name:", "Company Phone:", "Dated As:", "Details", "Email:", + "Ft Lauderdale, FL Phone:", "Hero Limited", "Name:", "Phone:", "Purchase Order", + "Purchase Order #:", "Quantity", "SUBTOTAL", "Seattle, WA 93849 Phone:", "Shipped + From", "Shipped To", "TAX", "TOTAL", "Total", "Unit Price", "Vendor Name:", + "Website:"]}}, "trainResult": {"trainingDocuments": [{"documentName": "Form_1.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_3.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_4.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "errors": [], "status": "succeeded"}], "errors": []}}' + headers: + apim-request-id: + - e5d63bf4-e202-425a-ba7a-fbcf9c39e3e3 + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 00:02:21 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '51' + status: + code: 200 + message: OK +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '288' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: + - 8aac2d2a-510f-4485-a4fe-3c204a5f30aa + content-length: + - '0' + date: + - Tue, 06 Oct 2020 00:02:21 GMT + location: + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1a3447aa-5b94-4360-9830-9267309ced37 + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '65' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1a3447aa-5b94-4360-9830-9267309ced37?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "1a3447aa-5b94-4360-9830-9267309ced37", "status": + "creating", "createdDateTime": "2020-10-06T00:02:21Z", "lastUpdatedDateTime": + "2020-10-06T00:02:21Z"}}' + headers: + apim-request-id: + - 29eb25e5-546e-4c46-8c84-a48f0a16b54e + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 00:02:26 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '80' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1a3447aa-5b94-4360-9830-9267309ced37?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "1a3447aa-5b94-4360-9830-9267309ced37", "status": + "creating", "createdDateTime": "2020-10-06T00:02:21Z", "lastUpdatedDateTime": + "2020-10-06T00:02:21Z"}}' + headers: + apim-request-id: + - 454cdfb0-6573-4346-becf-432df96b912d + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 00:02:32 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '49' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1a3447aa-5b94-4360-9830-9267309ced37?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "1a3447aa-5b94-4360-9830-9267309ced37", "status": + "ready", "createdDateTime": "2020-10-06T00:02:21Z", "lastUpdatedDateTime": + "2020-10-06T00:02:36Z"}, "keys": {"clusters": {"0": ["Additional Notes:", + "Address:", "Company Name:", "Company Phone:", "Dated As:", "Details", "Email:", + "Ft Lauderdale, FL Phone:", "Hero Limited", "Name:", "Phone:", "Purchase Order", + "Purchase Order #:", "Quantity", "SUBTOTAL", "Seattle, WA 93849 Phone:", "Shipped + From", "Shipped To", "TAX", "TOTAL", "Total", "Unit Price", "Vendor Name:", + "Website:"]}}, "trainResult": {"trainingDocuments": [{"documentName": "Form_1.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_3.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_4.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "errors": [], "status": "succeeded"}], "errors": []}}' + headers: + apim-request-id: + - cd5341ea-7c54-464e-8ba3-5131438a66bf + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 00:02:37 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '48' + status: + code: 200 + message: OK +- request: + body: 'b''{"modelIds": ["652c03ee-9d6a-4291-bb36-9b653107a2fd", "1a3447aa-5b94-4360-9830-9267309ced37"]}''' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '94' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/compose + response: + body: + string: '{"error": {"code": "1001", "message": "Specified model not found or + not ready or has incompatible API version, Model Id: 1a3447aa-5b94-4360-9830-9267309ced37"}}' + headers: + apim-request-id: + - 42f7bd87-0ea2-479d-ae7f-351fa8921c60 + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 00:02:37 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '39' + status: + code: 400 + message: Bad Request +version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model.yaml new file mode 100644 index 000000000000..a3ab5e3c8a0f --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model.yaml @@ -0,0 +1,219 @@ +interactions: +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true}''' + headers: + Accept: + - application/json + Content-Length: + - '287' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: 1b3fbe89-e775-4525-83e9-07460ec9db61 + content-length: '0' + date: Tue, 06 Oct 2020 01:18:52 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2f9de7a7-9d86-41a4-a708-59b05462f90b + strict-transport-security: max-age=31536000; includeSubDomains; preload + x-content-type-options: nosniff + x-envoy-upstream-service-time: '82' + status: + code: 201 + message: Created + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2f9de7a7-9d86-41a4-a708-59b05462f90b?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "2f9de7a7-9d86-41a4-a708-59b05462f90b", "attributes": + {"isComposed": false}, "status": "ready", "createdDateTime": "2020-10-06T01:18:52Z", + "lastUpdatedDateTime": "2020-10-06T01:18:54Z"}, "trainResult": {"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "errors": []}}' + headers: + apim-request-id: 1ba37eef-4c4d-447e-8dff-51b3fe0fbb3c + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:18:57 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '20' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2f9de7a7-9d86-41a4-a708-59b05462f90b?includeKeys=true +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true, "modelName": "second-labeled-model"}''' + headers: + Accept: + - application/json + Content-Length: + - '324' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: ab7aaa1e-ea45-4540-accf-fb10d1bf9542 + content-length: '0' + date: Tue, 06 Oct 2020 01:18:57 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ec84ffb2-7e17-4d2c-bc83-d0fe20673f20 + strict-transport-security: max-age=31536000; includeSubDomains; preload + x-content-type-options: nosniff + x-envoy-upstream-service-time: '46' + status: + code: 201 + message: Created + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ec84ffb2-7e17-4d2c-bc83-d0fe20673f20?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "ec84ffb2-7e17-4d2c-bc83-d0fe20673f20", "modelName": + "second-labeled-model", "attributes": {"isComposed": false}, "status": "ready", + "createdDateTime": "2020-10-06T01:18:58Z", "lastUpdatedDateTime": "2020-10-06T01:18:59Z"}, + "trainResult": {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": + "Form_1.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], + "fields": [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": + "CompanyName", "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": + 1.0}, {"fieldName": "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": + 0.8}, {"fieldName": "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", + "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": + "Quantity", "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, + {"fieldName": "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": + 1.0}, {"fieldName": "Total", "accuracy": 1.0}, {"fieldName": "VendorName", + "accuracy": 1.0}, {"fieldName": "Website", "accuracy": 1.0}], "errors": []}}' + headers: + apim-request-id: f4335511-5a6a-49a9-ab2b-b6b6469ca82d + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:03 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ec84ffb2-7e17-4d2c-bc83-d0fe20673f20?includeKeys=true +- request: + body: 'b''{"modelIds": ["2f9de7a7-9d86-41a4-a708-59b05462f90b", "ec84ffb2-7e17-4d2c-bc83-d0fe20673f20"], + "modelName": "my composed model"}''' + headers: + Accept: + - application/json, text/json + Content-Length: + - '128' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/compose + response: + body: + string: '' + headers: + apim-request-id: 16b1c148-c790-4f7c-bace-0f0de8a6d281 + content-length: '0' + date: Tue, 06 Oct 2020 01:19:03 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/b4f831a4-8c3a-4f4f-8cfe-f47e36db4a9b + strict-transport-security: max-age=31536000; includeSubDomains; preload + x-content-type-options: nosniff + x-envoy-upstream-service-time: '144' + status: + code: 201 + message: Created + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/compose +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/b4f831a4-8c3a-4f4f-8cfe-f47e36db4a9b?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "b4f831a4-8c3a-4f4f-8cfe-f47e36db4a9b", "modelName": + "my composed model", "attributes": {"isComposed": true}, "status": "ready", + "createdDateTime": "2020-10-06T01:19:03Z", "lastUpdatedDateTime": "2020-10-06T01:19:03Z"}, + "composedTrainResults": [{"averageModelAccuracy": 0.96, "trainingDocuments": + [{"documentName": "Form_1.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_2.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_4.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", "pages": 1, "status": + "succeeded"}], "fields": [{"fieldName": "CompanyAddress", "accuracy": 0.8}, + {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", + "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": 1.0}, {"fieldName": + "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": 1.0}, {"fieldName": + "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", "accuracy": + 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": "Signature", + "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, {"fieldName": + "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": 1.0}, {"fieldName": + "VendorName", "accuracy": 1.0}, {"fieldName": "Website", "accuracy": 1.0}], + "modelId": "2f9de7a7-9d86-41a4-a708-59b05462f90b", "errors": []}, {"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "modelId": "ec84ffb2-7e17-4d2c-bc83-d0fe20673f20", "errors": + []}]}' + headers: + apim-request-id: 678b3c48-f17b-4fda-ace3-2693e7260c3e + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:08 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '18' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/b4f831a4-8c3a-4f4f-8cfe-f47e36db4a9b?includeKeys=true +version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_invalid_model.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_invalid_model.yaml new file mode 100644 index 000000000000..063f59d856ed --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_invalid_model.yaml @@ -0,0 +1,31 @@ +interactions: +- request: + body: 'b''{"modelIds": ["00000000-0000-0000-0000-000000000000"]}''' + headers: + Accept: + - application/json, text/json + Content-Length: + - '54' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/compose + response: + body: + string: '{"error": {"code": "1001", "message": "Parameter ''ModelIds'' is either + null or has less than two unique models."}}' + headers: + apim-request-id: 1b11bfe6-4c7d-45b1-9d2b-5fe8bc4dc6ff + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:08 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '2' + status: + code: 400 + message: Bad Request + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/compose +version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_invalid_unlabeled_models.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_invalid_unlabeled_models.yaml new file mode 100644 index 000000000000..f19b3ed9b9ec --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_invalid_unlabeled_models.yaml @@ -0,0 +1,253 @@ +interactions: +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false}''' + headers: + Accept: + - application/json + Content-Length: + - '288' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: e12d0b95-4e36-487c-b1f4-7c5f5baca14a + content-length: '0' + date: Tue, 06 Oct 2020 01:19:09 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/45d5a31b-5702-409f-8ee3-8cf7a094b4d4 + strict-transport-security: max-age=31536000; includeSubDomains; preload + x-content-type-options: nosniff + x-envoy-upstream-service-time: '44' + status: + code: 201 + message: Created + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/45d5a31b-5702-409f-8ee3-8cf7a094b4d4?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "45d5a31b-5702-409f-8ee3-8cf7a094b4d4", "status": + "creating", "createdDateTime": "2020-10-06T01:19:09Z", "lastUpdatedDateTime": + "2020-10-06T01:19:09Z"}}' + headers: + apim-request-id: 4e608fcb-801b-4618-aabf-e1ef24f6f22a + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:13 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/45d5a31b-5702-409f-8ee3-8cf7a094b4d4?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/45d5a31b-5702-409f-8ee3-8cf7a094b4d4?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "45d5a31b-5702-409f-8ee3-8cf7a094b4d4", "status": + "creating", "createdDateTime": "2020-10-06T01:19:09Z", "lastUpdatedDateTime": + "2020-10-06T01:19:09Z"}}' + headers: + apim-request-id: 819971ac-2849-4f53-98d9-f10b54714042 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:19 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '14' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/45d5a31b-5702-409f-8ee3-8cf7a094b4d4?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/45d5a31b-5702-409f-8ee3-8cf7a094b4d4?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "45d5a31b-5702-409f-8ee3-8cf7a094b4d4", "status": + "ready", "createdDateTime": "2020-10-06T01:19:09Z", "lastUpdatedDateTime": + "2020-10-06T01:19:22Z"}, "keys": {"clusters": {"0": ["Additional Notes:", + "Address:", "Company Name:", "Company Phone:", "Dated As:", "Details", "Email:", + "Ft Lauderdale, FL Phone:", "Hero Limited", "Name:", "Phone:", "Purchase Order", + "Purchase Order #:", "Quantity", "SUBTOTAL", "Seattle, WA 93849 Phone:", "Shipped + From", "Shipped To", "TAX", "TOTAL", "Total", "Unit Price", "Vendor Name:", + "Website:"]}}, "trainResult": {"trainingDocuments": [{"documentName": "Form_1.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_3.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_4.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "errors": [], "status": "succeeded"}], "errors": []}}' + headers: + apim-request-id: a22bb881-8ec7-4f0f-9242-dca7ec91bc27 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:24 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '15' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/45d5a31b-5702-409f-8ee3-8cf7a094b4d4?includeKeys=true +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false}''' + headers: + Accept: + - application/json + Content-Length: + - '288' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: 9377244a-c75e-48f3-8f1c-ac235513e13f + content-length: '0' + date: Tue, 06 Oct 2020 01:19:24 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/a1591bd0-8fe6-400f-9c21-ce0e57c2cea4 + strict-transport-security: max-age=31536000; includeSubDomains; preload + x-content-type-options: nosniff + x-envoy-upstream-service-time: '44' + status: + code: 201 + message: Created + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/a1591bd0-8fe6-400f-9c21-ce0e57c2cea4?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "a1591bd0-8fe6-400f-9c21-ce0e57c2cea4", "status": + "creating", "createdDateTime": "2020-10-06T01:19:25Z", "lastUpdatedDateTime": + "2020-10-06T01:19:25Z"}}' + headers: + apim-request-id: bb1b178f-37f2-479c-be8d-6c8f87f013ef + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:30 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/a1591bd0-8fe6-400f-9c21-ce0e57c2cea4?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/a1591bd0-8fe6-400f-9c21-ce0e57c2cea4?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "a1591bd0-8fe6-400f-9c21-ce0e57c2cea4", "status": + "creating", "createdDateTime": "2020-10-06T01:19:25Z", "lastUpdatedDateTime": + "2020-10-06T01:19:25Z"}}' + headers: + apim-request-id: 349d8492-87f2-4df0-9fc6-67a9805cd8f5 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:34 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/a1591bd0-8fe6-400f-9c21-ce0e57c2cea4?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/a1591bd0-8fe6-400f-9c21-ce0e57c2cea4?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "a1591bd0-8fe6-400f-9c21-ce0e57c2cea4", "status": + "ready", "createdDateTime": "2020-10-06T01:19:25Z", "lastUpdatedDateTime": + "2020-10-06T01:19:38Z"}, "keys": {"clusters": {"0": ["Additional Notes:", + "Address:", "Company Name:", "Company Phone:", "Dated As:", "Details", "Email:", + "Ft Lauderdale, FL Phone:", "Hero Limited", "Name:", "Phone:", "Purchase Order", + "Purchase Order #:", "Quantity", "SUBTOTAL", "Seattle, WA 93849 Phone:", "Shipped + From", "Shipped To", "TAX", "TOTAL", "Total", "Unit Price", "Vendor Name:", + "Website:"]}}, "trainResult": {"trainingDocuments": [{"documentName": "Form_1.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_3.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_4.jpg", + "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "errors": [], "status": "succeeded"}], "errors": []}}' + headers: + apim-request-id: e95c5e7e-b1bf-48d7-84ea-cb50c8b4a3e2 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:40 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '16' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/a1591bd0-8fe6-400f-9c21-ce0e57c2cea4?includeKeys=true +- request: + body: 'b''{"modelIds": ["45d5a31b-5702-409f-8ee3-8cf7a094b4d4", "a1591bd0-8fe6-400f-9c21-ce0e57c2cea4"]}''' + headers: + Accept: + - application/json, text/json + Content-Length: + - '94' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/compose + response: + body: + string: '{"error": {"code": "1001", "message": "Specified model not found or + not ready or has incompatible API version, Model Id: 45d5a31b-5702-409f-8ee3-8cf7a094b4d4"}}' + headers: + apim-request-id: 80614999-e390-42ef-98ec-2b3b843a211c + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:19:40 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '18' + status: + code: 400 + message: Bad Request + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/compose +version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py new file mode 100644 index 000000000000..537843a33a1c --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +import pytest +import functools +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError +from azure.ai.formrecognizer import FormTrainingClient +from testcase import FormRecognizerTest, GlobalFormRecognizerAccountPreparer +from testcase import GlobalClientPreparer as _GlobalClientPreparer + + +GlobalClientPreparer = functools.partial(_GlobalClientPreparer, FormTrainingClient) + +class TestTraining(FormRecognizerTest): + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + def test_compose_model(self, client, container_sas_url): + + poller = client.begin_training(container_sas_url, use_training_labels=True) + model_1 = poller.result() + + poller = client.begin_training(container_sas_url, use_training_labels=True, display_name="second-labeled-model") + model_2 = poller.result() + + poller = client.begin_create_composed_model([model_1.model_id, model_2.model_id], display_name="my composed model") + + composed_model = poller.result() + self.assertEqual(composed_model.display_name, "my composed model") + self.assertComposedModelHasValues(composed_model, model_1, model_2) + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + def test_compose_model_invalid_unlabeled_models(self, client, container_sas_url): + + poller = client.begin_training(container_sas_url, use_training_labels=False) + model_1 = poller.result() + + poller = client.begin_training(container_sas_url, use_training_labels=False) + model_2 = poller.result() + + with pytest.raises(HttpResponseError) as e: + poller = client.begin_create_composed_model([model_1.model_id, model_2.model_id]) + composed_model = poller.result() + self.assertEqual(e.value.error.code, "1001") + self.assertIsNotNone(e.value.error.message) + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + def test_compose_model_invalid_model(self, client, container_sas_url): + + with pytest.raises(HttpResponseError) as e: + poller = client.begin_create_composed_model(["00000000-0000-0000-0000-000000000000"]) + composed_model = poller.result() + self.assertEqual(e.value.error.code, "1001") + self.assertIsNotNone(e.value.error.message) + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + @pytest.mark.live_test_only + def test_compose_continuation_token(self, client, container_sas_url): + + poller = client.begin_training(container_sas_url, use_training_labels=True) + model_1 = poller.result() + + poller = client.begin_training(container_sas_url, use_training_labels=True) + model_2 = poller.result() + + initial_poller = client.begin_create_composed_model([model_1.model_id, model_2.model_id]) + cont_token = initial_poller.continuation_token() + + poller = client.begin_create_composed_model([model_1.model_id, model_2.model_id], continuation_token=cont_token) + result = poller.result() + self.assertIsNotNone(result) + + initial_poller.wait() # necessary so azure-devtools doesn't throw assertion error diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py new file mode 100644 index 000000000000..821bee722d16 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ + +import pytest +import functools +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError +from azure.ai.formrecognizer.aio import FormTrainingClient +from testcase import FormRecognizerTest, GlobalFormRecognizerAccountPreparer +from testcase import GlobalClientPreparer as _GlobalClientPreparer +from asynctestcase import AsyncFormRecognizerTest + + +GlobalClientPreparer = functools.partial(_GlobalClientPreparer, FormTrainingClient) + + +class TestTrainingAsync(AsyncFormRecognizerTest): + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + async def test_compose_model(self, client, container_sas_url): + async with client: + poller = await client.begin_training(container_sas_url, use_training_labels=True) + model_1 = await poller.result() + + poller = await client.begin_training(container_sas_url, use_training_labels=True, display_name="second-labeled-model") + model_2 = await poller.result() + + poller = await client.begin_create_composed_model([model_1.model_id, model_2.model_id], display_name="my composed model") + + composed_model = await poller.result() + self.assertEqual(composed_model.display_name, "my composed model") + self.assertComposedModelHasValues(composed_model, model_1, model_2) + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + async def test_compose_model_invalid_unlabeled_models(self, client, container_sas_url): + async with client: + poller = await client.begin_training(container_sas_url, use_training_labels=False) + model_1 = await poller.result() + + poller = await client.begin_training(container_sas_url, use_training_labels=False) + model_2 = await poller.result() + + with pytest.raises(HttpResponseError) as e: + poller = await client.begin_create_composed_model([model_1.model_id, model_2.model_id]) + composed_model = await poller.result() + self.assertEqual(e.value.error.code, "1001") + self.assertIsNotNone(e.value.error.message) + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + async def test_compose_model_invalid_model(self, client, container_sas_url): + async with client: + with pytest.raises(HttpResponseError) as e: + poller = await client.begin_create_composed_model(["00000000-0000-0000-0000-000000000000"]) + composed_model = await poller.result() + self.assertEqual(e.value.error.code, "1001") + self.assertIsNotNone(e.value.error.message) + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + @pytest.mark.live_test_only + async def test_compose_continuation_token(self, client, container_sas_url): + async with client: + poller = await client.begin_training(container_sas_url, use_training_labels=True) + model_1 = await poller.result() + + poller = await client.begin_training(container_sas_url, use_training_labels=True) + model_2 = await poller.result() + + initial_poller = await client.begin_create_composed_model([model_1.model_id, model_2.model_id]) + cont_token = initial_poller.continuation_token() + + poller = await client.begin_create_composed_model([model_1.model_id, model_2.model_id], continuation_token=cont_token) + result = await poller.result() + self.assertIsNotNone(result) + + await initial_poller.wait() # necessary so azure-devtools doesn't throw assertion error diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py index ec4b51013b90..627e80f5cd8f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py @@ -403,6 +403,39 @@ def assertFieldElementsHasValues(self, elements, page_number): for word in elements: self.assertFormWordHasValues(word, page_number) + def assertComposedModelHasValues(self, composed, model_1, model_2): + self.assertIsNotNone(composed.model_id) + self.assertIsNone(composed.errors) + self.assertTrue(composed.properties.is_composed_model) + self.assertIsNotNone(composed.status) + self.assertIsNotNone(composed.training_started_on) + self.assertIsNotNone(composed.training_completed_on) + + all_training_documents = model_1.training_documents + model_2.training_documents + for doc, composed_doc in zip(all_training_documents, composed.training_documents): + self.assertEqual(doc.name, composed_doc.name) + self.assertEqual(doc.status, composed_doc.status) + self.assertEqual(doc.page_count, composed_doc.page_count) + self.assertEqual(doc.errors, composed_doc.errors) + + for model in model_1.submodels: + if not model_1.display_name: + self.assertEqual(model.form_type, composed.submodels[0].form_type) + self.assertEqual(model.accuracy, composed.submodels[0].accuracy) + self.assertEqual(model.model_id, composed.submodels[0].model_id) + for field, value in model.fields.items(): + self.assertEqual(value.name, composed.submodels[0].fields[field].name) + self.assertEqual(value.accuracy, composed.submodels[0].fields[field].accuracy) + + for model in model_2.submodels: + if not model_2.display_name: + self.assertEqual(model.form_type, composed.submodels[0].form_type) + self.assertEqual(model.accuracy, composed.submodels[1].accuracy) + self.assertEqual(model.model_id, composed.submodels[1].model_id) + for field, value in model.fields.items(): + self.assertEqual(value.name, composed.submodels[0].fields[field].name) + self.assertEqual(value.accuracy, composed.submodels[0].fields[field].accuracy) + class GlobalResourceGroupPreparer(AzureMgmtPreparer): def __init__(self): From 3b598bde4934a8c44a7104828631626366b38fd0 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 5 Oct 2020 19:51:31 -0700 Subject: [PATCH 10/18] adding more tests for new fields --- ...custom_forms.test_custom_form_labeled.yaml | 190 ++--- ...tipage_vendor_set_unlabeled_transform.yaml | 259 +++---- ..._forms_async.test_custom_form_labeled.yaml | 188 +++-- ...tipage_vendor_set_unlabeled_transform.yaml | 279 +++---- ...rms_from_url.test_custom_form_labeled.yaml | 187 ++--- ...tipage_vendor_set_unlabeled_transform.yaml | 261 +++---- ...tipage_vendor_set_unlabeled_transform.yaml | 313 ++++---- ...orms_from_url_async.test_form_labeled.yaml | 186 ++--- .../test_training.test_training.yaml | 56 +- ...st_training.test_training_with_labels.yaml | 56 +- .../test_training_async.test_training.yaml | 730 +++++++++++++++++- ...ining_async.test_training_with_labels.yaml | 58 +- .../tests/test_custom_forms.py | 35 +- .../tests/test_custom_forms_async.py | 34 +- .../tests/test_custom_forms_from_url.py | 35 +- .../tests/test_custom_forms_from_url_async.py | 34 +- .../tests/test_training.py | 6 +- .../tests/test_training_async.py | 7 +- 18 files changed, 1702 insertions(+), 1212 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms.test_custom_form_labeled.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms.test_custom_form_labeled.yaml index 6d2ad0d9ee9b..572f5882cf05 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms.test_custom_form_labeled.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms.test_custom_form_labeled.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": true}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true, "modelName": "labeled"}''' headers: Accept: - application/json @@ -10,7 +10,7 @@ interactions: Connection: - keep-alive Content-Length: - - '287' + - '311' Content-Type: - application/json User-Agent: @@ -22,19 +22,19 @@ interactions: string: '' headers: apim-request-id: - - 947031d4-2a42-489f-85e7-806f886cf038 + - 873a0aee-56ac-4beb-bc17-e203ef382e0a content-length: - '0' date: - - Mon, 14 Sep 2020 19:45:29 GMT + - Tue, 06 Oct 2020 01:56:24 GMT location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/7613eee5-0acf-450b-8dd4-74a605f72706 + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/8d8ccd27-1f6b-4435-bb5e-c3e03c8aa0e8 strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '44' + - '43' status: code: 201 message: Created @@ -50,33 +50,33 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/7613eee5-0acf-450b-8dd4-74a605f72706?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/8d8ccd27-1f6b-4435-bb5e-c3e03c8aa0e8?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "7613eee5-0acf-450b-8dd4-74a605f72706", "attributes": - {"isComposed": false}, "status": "ready", "createdDateTime": "2020-09-14T19:45:29Z", - "lastUpdatedDateTime": "2020-09-14T19:45:32Z"}, "trainResult": {"averageModelAccuracy": - 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": - "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, - {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": - "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", - "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", - "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": - "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": - 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": - 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", - "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": - "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, - {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": - 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", - "accuracy": 1.0}], "errors": []}}' + string: '{"modelInfo": {"modelId": "8d8ccd27-1f6b-4435-bb5e-c3e03c8aa0e8", "modelName": + "labeled", "attributes": {"isComposed": false}, "status": "ready", "createdDateTime": + "2020-10-06T01:56:25Z", "lastUpdatedDateTime": "2020-10-06T01:56:27Z"}, "trainResult": + {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], "fields": + [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": "CompanyName", + "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": + "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": + "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, + {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": "Quantity", + "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, {"fieldName": + "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": + "Total", "accuracy": 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": + "Website", "accuracy": 1.0}], "errors": []}}' headers: apim-request-id: - - 48834b5f-a618-405c-936a-13c394a10b7b + - 007f7cf4-f1bd-4c38-90d4-c281e4f74d16 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:45:34 GMT + - Tue, 06 Oct 2020 01:56:30 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -84,7 +84,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '16' + - '15' status: code: 200 message: OK @@ -8513,25 +8513,25 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: POST - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/7613eee5-0acf-450b-8dd4-74a605f72706/analyze?includeTextDetails=false + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/8d8ccd27-1f6b-4435-bb5e-c3e03c8aa0e8/analyze?includeTextDetails=false response: body: string: '' headers: apim-request-id: - - b8fb3806-20cb-4d3f-8b81-2aca120c66ee + - 6a75d677-d1eb-4de1-b2ac-94dca6395530 content-length: - '0' date: - - Mon, 14 Sep 2020 19:45:36 GMT + - Tue, 06 Oct 2020 01:56:30 GMT operation-location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/7613eee5-0acf-450b-8dd4-74a605f72706/analyzeresults/5b2ac53c-b8ca-4a04-a76b-c4f13bd4090c + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/8d8ccd27-1f6b-4435-bb5e-c3e03c8aa0e8/analyzeresults/0529b126-5e0c-4b7e-9cbe-0d00656abd89 strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '55' + - '56' status: code: 202 message: Accepted @@ -8547,46 +8547,11 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/7613eee5-0acf-450b-8dd4-74a605f72706/analyzeresults/5b2ac53c-b8ca-4a04-a76b-c4f13bd4090c + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/8d8ccd27-1f6b-4435-bb5e-c3e03c8aa0e8/analyzeresults/0529b126-5e0c-4b7e-9cbe-0d00656abd89 response: body: - string: '{"status": "notStarted", "createdDateTime": "2020-09-14T19:45:36Z", - "lastUpdatedDateTime": "2020-09-14T19:45:40Z"}' - headers: - apim-request-id: - - 0b2242c1-995c-4e3b-ba21-80c7377fbd8e - content-length: - - '109' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 14 Sep 2020 19:45:41 GMT - strict-transport-security: - - max-age=31536000; includeSubDomains; preload - x-content-type-options: - - nosniff - x-envoy-upstream-service-time: - - '37' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/7613eee5-0acf-450b-8dd4-74a605f72706/analyzeresults/5b2ac53c-b8ca-4a04-a76b-c4f13bd4090c - response: - body: - string: '{"status": "succeeded", "createdDateTime": "2020-09-14T19:45:36Z", - "lastUpdatedDateTime": "2020-09-14T19:45:43Z", "analyzeResult": {"version": + string: '{"status": "succeeded", "createdDateTime": "2020-10-06T01:56:31Z", + "lastUpdatedDateTime": "2020-10-06T01:56:35Z", "analyzeResult": {"version": "2.1.0", "readResults": [{"page": 1, "angle": 0, "width": 1700, "height": 2200, "unit": "pixel", "selectionMarks": [{"boundingBox": [2, 2060, 195, 2060, 195, 2200, 2, 2200], "confidence": 0.881, "state": "unselected"}]}], "pageResults": @@ -8632,62 +8597,61 @@ interactions: {"rowIndex": 4, "columnIndex": 2, "text": "5.00", "boundingBox": [1072, 1216, 1309, 1216, 1309, 1260, 1072, 1260]}, {"rowIndex": 4, "columnIndex": 3, "text": "100.00", "boundingBox": [1309, 1216, 1544, 1216, 1544, 1260, 1309, 1260]}]}]}], - "documentResults": [{"docType": "custom:7613eee5-0acf-450b-8dd4-74a605f72706", - "modelId": "7613eee5-0acf-450b-8dd4-74a605f72706", "pageRange": [1, 1], "fields": - {"PurchaseOrderNumber": {"type": "string", "valueString": "948284", "text": - "948284", "page": 1, "boundingBox": [1277.0, 461.0, 1376.0, 461.0, 1376.0, - 489.0, 1277.0, 489.0], "confidence": 0.94}, "Merchant": {"type": "string", - "valueString": "Hero Limited", "text": "Hero Limited", "page": 1, "boundingBox": - [620.0, 205.0, 1075.0, 205.0, 1075.0, 266.0, 620.0, 266.0], "confidence": - 0.97}, "Total": {"type": "string", "valueString": "$144.00", "text": "$144.00", - "page": 1, "boundingBox": [1427.0, 1669.0, 1529.0, 1669.0, 1529.0, 1698.0, - 1427.0, 1698.0], "confidence": 0.991}, "Quantity": {"type": "number", "text": - "20", "page": 1, "boundingBox": [861.0, 1094.0, 892.0, 1094.0, 892.0, 1119.0, - 861.0, 1119.0], "confidence": 0.962}, "Website": {"type": "string", "valueString": - "www.herolimited.com", "text": "www.herolimited.com", "page": 1, "boundingBox": - [273.0, 393.0, 531.0, 393.0, 531.0, 418.0, 273.0, 418.0], "confidence": 0.95}, + "documentResults": [{"docType": "custom:labeled", "modelId": "8d8ccd27-1f6b-4435-bb5e-c3e03c8aa0e8", + "pageRange": [1, 1], "fields": {"CompanyAddress": {"type": "string", "valueString": + "938 NE Burner Road Boulder City, CO 92848", "text": "938 NE Burner Road Boulder + City, CO 92848", "page": 1, "boundingBox": [273.0, 685.0, 565.0, 685.0, 565.0, + 751.0, 273.0, 751.0], "confidence": 1.0}, "PurchaseOrderNumber": {"type": + "string", "valueString": "948284", "text": "948284", "page": 1, "boundingBox": + [1277.0, 461.0, 1376.0, 461.0, 1376.0, 489.0, 1277.0, 489.0], "confidence": + 0.94}, "Subtotal": {"type": "string", "valueString": "$140.00", "text": "$140.00", + "page": 1, "boundingBox": [1426.0, 1572.0, 1531.0, 1572.0, 1531.0, 1599.0, + 1426.0, 1599.0], "confidence": 0.984}, "Signature": {"type": "string", "valueString": + "Bernie Sanders", "text": "Bernie Sanders", "page": 1, "boundingBox": [489.0, + 1670.0, 765.0, 1670.0, 765.0, 1708.0, 489.0, 1708.0], "confidence": 0.998}, "Tax": {"type": "string", "valueString": "$4.00", "text": "$4.00", "page": 1, "boundingBox": [1458.0, 1615.0, 1529.0, 1615.0, 1529.0, 1643.0, 1458.0, - 1643.0], "confidence": 0.994}, "Subtotal": {"type": "string", "valueString": - "$140.00", "text": "$140.00", "page": 1, "boundingBox": [1426.0, 1572.0, 1531.0, - 1572.0, 1531.0, 1599.0, 1426.0, 1599.0], "confidence": 0.984}, "Email": {"type": - "string", "valueString": "accounts@herolimited.com", "text": "accounts@herolimited.com", - "page": 1, "boundingBox": [164.0, 479.0, 478.0, 479.0, 478.0, 503.0, 164.0, - 503.0], "confidence": 1.0}, "PhoneNumber": {"type": "string", "valueString": + 1643.0], "confidence": 0.994}, "PhoneNumber": {"type": "string", "valueString": "555-348-6512", "text": "555-348-6512", "page": 1, "boundingBox": [364.0, - 351.0, 528.0, 351.0, 528.0, 378.0, 364.0, 378.0], "confidence": 0.89}, "VendorName": - {"type": "string", "valueString": "Hillary Swank", "text": "Hillary Swank", - "page": 1, "boundingBox": [349.0, 609.0, 521.0, 609.0, 521.0, 639.0, 349.0, - 639.0], "confidence": 0.93}, "CompanyPhoneNumber": {"type": "string", "valueString": - "938-294-2949", "text": "938-294-2949", "page": 1, "boundingBox": [708.0, - 722.0, 885.0, 722.0, 885.0, 749.0, 708.0, 749.0], "confidence": 1.0}, "DatedAs": - {"type": "string", "valueString": "12/20/2020", "text": "12/20/2020", "page": - 1, "boundingBox": [1165.0, 420.0, 1317.0, 420.0, 1317.0, 449.0, 1165.0, 449.0], - "confidence": 0.99}, "Signature": {"type": "string", "valueString": "Bernie - Sanders", "text": "Bernie Sanders", "page": 1, "boundingBox": [489.0, 1670.0, - 765.0, 1670.0, 765.0, 1708.0, 489.0, 1708.0], "confidence": 0.998}, "CompanyAddress": - {"type": "string", "valueString": "938 NE Burner Road Boulder City, CO 92848", - "text": "938 NE Burner Road Boulder City, CO 92848", "page": 1, "boundingBox": - [273.0, 685.0, 565.0, 685.0, 565.0, 751.0, 273.0, 751.0], "confidence": 1.0}, - "CompanyName": {"type": "string", "valueString": "Higgly Wiggly Books", "text": - "Higgly Wiggly Books", "page": 1, "boundingBox": [375.0, 646.0, 629.0, 646.0, - 629.0, 679.0, 375.0, 679.0], "confidence": 0.95}}, "docTypeConfidence": 1.0}], - "errors": []}}' + 351.0, 528.0, 351.0, 528.0, 378.0, 364.0, 378.0], "confidence": 0.89}, "Quantity": + {"type": "number", "text": "20", "page": 1, "boundingBox": [861.0, 1094.0, + 892.0, 1094.0, 892.0, 1119.0, 861.0, 1119.0], "confidence": 0.962}, "CompanyPhoneNumber": + {"type": "string", "valueString": "938-294-2949", "text": "938-294-2949", + "page": 1, "boundingBox": [708.0, 722.0, 885.0, 722.0, 885.0, 749.0, 708.0, + 749.0], "confidence": 1.0}, "Website": {"type": "string", "valueString": "www.herolimited.com", + "text": "www.herolimited.com", "page": 1, "boundingBox": [273.0, 393.0, 531.0, + 393.0, 531.0, 418.0, 273.0, 418.0], "confidence": 0.95}, "DatedAs": {"type": + "string", "valueString": "12/20/2020", "text": "12/20/2020", "page": 1, "boundingBox": + [1165.0, 420.0, 1317.0, 420.0, 1317.0, 449.0, 1165.0, 449.0], "confidence": + 0.99}, "CompanyName": {"type": "string", "valueString": "Higgly Wiggly Books", + "text": "Higgly Wiggly Books", "page": 1, "boundingBox": [375.0, 646.0, 629.0, + 646.0, 629.0, 679.0, 375.0, 679.0], "confidence": 0.95}, "VendorName": {"type": + "string", "valueString": "Hillary Swank", "text": "Hillary Swank", "page": + 1, "boundingBox": [349.0, 609.0, 521.0, 609.0, 521.0, 639.0, 349.0, 639.0], + "confidence": 0.93}, "Email": {"type": "string", "valueString": "accounts@herolimited.com", + "text": "accounts@herolimited.com", "page": 1, "boundingBox": [164.0, 479.0, + 478.0, 479.0, 478.0, 503.0, 164.0, 503.0], "confidence": 1.0}, "Merchant": + {"type": "string", "valueString": "Hero Limited", "text": "Hero Limited", + "page": 1, "boundingBox": [620.0, 205.0, 1075.0, 205.0, 1075.0, 266.0, 620.0, + 266.0], "confidence": 0.97}, "Total": {"type": "string", "valueString": "$144.00", + "text": "$144.00", "page": 1, "boundingBox": [1427.0, 1669.0, 1529.0, 1669.0, + 1529.0, 1698.0, 1427.0, 1698.0], "confidence": 0.991}}, "docTypeConfidence": + 1.0}], "errors": []}}' headers: apim-request-id: - - a702fbe4-4402-4221-9c1e-8ff48842ff88 + - ff5b384d-0836-4dc1-aa36-f32488a5b6b6 content-length: - - '6054' + - '6025' content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:45:46 GMT + - Tue, 06 Oct 2020 01:56:36 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '21' + - '20' status: code: 200 message: OK diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml index e004f2463d64..f7a76f3389d7 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": false}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false}''' headers: Accept: - application/json @@ -22,19 +22,19 @@ interactions: string: '' headers: apim-request-id: - - fee2d0c7-b88d-4a18-8886-17b16897b98e + - 8ac39cc3-d8a3-46dd-84a0-7129ce48603d content-length: - '0' date: - - Mon, 14 Sep 2020 19:46:56 GMT + - Tue, 06 Oct 2020 02:08:42 GMT location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0 strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '344' + - '180' status: code: 201 message: Created @@ -50,19 +50,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "c35ac888-c3d6-4259-807b-d24f2b063daf", "status": - "creating", "createdDateTime": "2020-09-14T19:46:57Z", "lastUpdatedDateTime": - "2020-09-14T19:46:57Z"}}' + string: '{"modelInfo": {"modelId": "59755a80-6b24-4d90-96f2-81d486d44ef0", "status": + "creating", "createdDateTime": "2020-10-06T02:08:42Z", "lastUpdatedDateTime": + "2020-10-06T02:08:42Z"}}' headers: apim-request-id: - - b4f58e3f-9c10-4035-828b-33c2b6462187 + - 47d5c547-51c8-4e5c-bd1d-45f40203a54c content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:47:01 GMT + - Tue, 06 Oct 2020 02:08:47 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -86,19 +86,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "c35ac888-c3d6-4259-807b-d24f2b063daf", "status": - "creating", "createdDateTime": "2020-09-14T19:46:57Z", "lastUpdatedDateTime": - "2020-09-14T19:46:57Z"}}' + string: '{"modelInfo": {"modelId": "59755a80-6b24-4d90-96f2-81d486d44ef0", "status": + "creating", "createdDateTime": "2020-10-06T02:08:42Z", "lastUpdatedDateTime": + "2020-10-06T02:08:42Z"}}' headers: apim-request-id: - - 23810cee-73d3-4c3d-8e5c-e40a0e10aeaf + - d151a0a7-9988-4cc0-b368-f448cf35ea73 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:47:07 GMT + - Tue, 06 Oct 2020 02:08:52 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -106,7 +106,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '16' + - '15' status: code: 200 message: OK @@ -122,19 +122,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "c35ac888-c3d6-4259-807b-d24f2b063daf", "status": - "creating", "createdDateTime": "2020-09-14T19:46:57Z", "lastUpdatedDateTime": - "2020-09-14T19:46:57Z"}}' + string: '{"modelInfo": {"modelId": "59755a80-6b24-4d90-96f2-81d486d44ef0", "status": + "creating", "createdDateTime": "2020-10-06T02:08:42Z", "lastUpdatedDateTime": + "2020-10-06T02:08:42Z"}}' headers: apim-request-id: - - dcce6a96-b94e-42db-a78b-99c64e88ceea + - dc78c154-6282-47fa-9e63-90bbfcd6cad5 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:47:13 GMT + - Tue, 06 Oct 2020 02:08:58 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -142,7 +142,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '16' + - '17' status: code: 200 message: OK @@ -158,19 +158,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "c35ac888-c3d6-4259-807b-d24f2b063daf", "status": - "creating", "createdDateTime": "2020-09-14T19:46:57Z", "lastUpdatedDateTime": - "2020-09-14T19:46:57Z"}}' + string: '{"modelInfo": {"modelId": "59755a80-6b24-4d90-96f2-81d486d44ef0", "status": + "creating", "createdDateTime": "2020-10-06T02:08:42Z", "lastUpdatedDateTime": + "2020-10-06T02:08:42Z"}}' headers: apim-request-id: - - 7866afc9-7910-415a-aaee-ddd2e3e51ee8 + - d8397a9a-b3fc-452b-b922-19a1de4d70c3 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:47:18 GMT + - Tue, 06 Oct 2020 02:09:03 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -178,7 +178,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '15' + - '18' status: code: 200 message: OK @@ -194,15 +194,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "c35ac888-c3d6-4259-807b-d24f2b063daf", "status": - "ready", "createdDateTime": "2020-09-14T19:46:57Z", "lastUpdatedDateTime": - "2020-09-14T19:47:21Z"}, "keys": {"clusters": {"0": ["Contoso Ltd. Conference - will be held on May 28-29, 2020 at the Elm Conference Center in", "Included", - "Maple City, Massachusetts. The conference has sold out of its 1,500 tickets, - with a 400 person", "Package", "Price", "Rates:", "Vendor #:", "Vendor Registration", + string: '{"modelInfo": {"modelId": "59755a80-6b24-4d90-96f2-81d486d44ef0", "status": + "ready", "createdDateTime": "2020-10-06T02:08:42Z", "lastUpdatedDateTime": + "2020-10-06T02:09:07Z"}, "keys": {"clusters": {"0": ["25% discount on program + guide", "50% discount on program guide", "Bronze Sponsor", "Contoso Ltd. Conference + will be held on May 28-29, 2020 at the Elm Conference Center in", "Full Booth", + "Full booth", "Full page ad in program guide", "Gold Sponsor", "Half Booth", + "Half page ad in program guide", "Included", "Logo on poster", "Maple City, + Massachusetts. The conference has sold out of its 1,500 tickets, with a 400 + person", "Package", "Post-keynote thank you", "Pre-keynote thank you", "Price", + "Rates:", "Silver Sponsor", "Vendor #:", "Vendor Registration", "advertisements", "below, and attach a check made out to:", "waitlist. Vendor applications are being accepted through Feb 28, 2020. Please fill in the form"], "1": ["Company Name:", "Contact:", "Preferred Package:", "Special Requests:", "Vendor #:", @@ -215,11 +219,11 @@ interactions: []}}' headers: apim-request-id: - - 2a54cd8e-eb54-4b13-b158-c48a55a8e189 + - f0d1999b-61b0-465c-b046-8dff1181abb3 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:47:22 GMT + - Tue, 06 Oct 2020 02:09:08 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -227,7 +231,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '19' + - '16' status: code: 200 message: OK @@ -12732,25 +12736,25 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: POST - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf/analyze?includeTextDetails=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0/analyze?includeTextDetails=true response: body: string: '' headers: apim-request-id: - - 11b8027e-66c1-4dad-ad48-1f2e6bc27caf + - 4a79bfb8-33bf-4388-be38-64af5871fcfa content-length: - '0' date: - - Mon, 14 Sep 2020 19:47:24 GMT + - Tue, 06 Oct 2020 02:09:09 GMT operation-location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf/analyzeresults/c9f3ed4e-cca5-4244-aa9f-15c7d0834e2f + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0/analyzeresults/8f52b846-ad6c-4454-a794-9ef789dccd6c strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '55' + - '69' status: code: 202 message: Accepted @@ -12766,26 +12770,26 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf/analyzeresults/c9f3ed4e-cca5-4244-aa9f-15c7d0834e2f + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0/analyzeresults/8f52b846-ad6c-4454-a794-9ef789dccd6c response: body: - string: '{"status": "running", "createdDateTime": "2020-09-14T19:47:24Z", "lastUpdatedDateTime": - "2020-09-14T19:47:25Z", "analyzeResult": null}' + string: '{"status": "running", "createdDateTime": "2020-10-06T02:09:09Z", "lastUpdatedDateTime": + "2020-10-06T02:09:10Z", "analyzeResult": null}' headers: apim-request-id: - - 1e069880-0506-4009-a67d-fd8c0fd0d0dc + - ac2ba18f-837c-46cf-b7e9-c161344bf7c3 content-length: - '134' content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:47:29 GMT + - Tue, 06 Oct 2020 02:09:14 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '18' + - '19' status: code: 200 message: OK @@ -12801,26 +12805,26 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf/analyzeresults/c9f3ed4e-cca5-4244-aa9f-15c7d0834e2f + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0/analyzeresults/8f52b846-ad6c-4454-a794-9ef789dccd6c response: body: - string: '{"status": "running", "createdDateTime": "2020-09-14T19:47:24Z", "lastUpdatedDateTime": - "2020-09-14T19:47:25Z", "analyzeResult": null}' + string: '{"status": "running", "createdDateTime": "2020-10-06T02:09:09Z", "lastUpdatedDateTime": + "2020-10-06T02:09:10Z", "analyzeResult": null}' headers: apim-request-id: - - d92e6080-45cd-4bfb-b784-c337c849861d + - f0c639ee-6830-47f9-b8fd-4f4f0d25d408 content-length: - '134' content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:47:34 GMT + - Tue, 06 Oct 2020 02:09:20 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '16' + - '28' status: code: 200 message: OK @@ -12836,11 +12840,11 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c35ac888-c3d6-4259-807b-d24f2b063daf/analyzeresults/c9f3ed4e-cca5-4244-aa9f-15c7d0834e2f + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/59755a80-6b24-4d90-96f2-81d486d44ef0/analyzeresults/8f52b846-ad6c-4454-a794-9ef789dccd6c response: body: - string: '{"status": "succeeded", "createdDateTime": "2020-09-14T19:47:24Z", - "lastUpdatedDateTime": "2020-09-14T19:47:36Z", "analyzeResult": {"version": + string: '{"status": "succeeded", "createdDateTime": "2020-10-06T02:09:09Z", + "lastUpdatedDateTime": "2020-10-06T02:09:22Z", "analyzeResult": {"version": "2.1.0", "readResults": [{"page": 1, "angle": 0, "width": 8.5, "height": 11.0, "unit": "inch", "lines": [{"text": "Vendor #:", "boundingBox": [6.1278, 1.0688, 7.1514, 1.0688, 7.1514, 1.24, 6.1278, 1.24], "words": [{"text": "Vendor", @@ -13135,98 +13139,35 @@ interactions: "#/readResults/0/lines/0/words/1"]}, "value": {"text": "121", "boundingBox": [7.1514, 1.076, 7.4833, 1.076, 7.4833, 1.2392, 7.1514, 1.2392], "elements": ["#/readResults/0/lines/1/words/0"]}, "confidence": 1.0}, {"key": {"text": - "__Address__1", "boundingBox": null, "elements": null}, "value": {"text": - "Contoso Ltd. 2345 Dogwood Lane Birch, Kansas 98123", "boundingBox": [1.0069, - 3.5781, 2.3764, 3.5781, 2.3764, 4.1379, 1.0069, 4.1379], "elements": ["#/readResults/0/lines/7/words/0", - "#/readResults/0/lines/7/words/1", "#/readResults/0/lines/8/words/0", "#/readResults/0/lines/8/words/1", - "#/readResults/0/lines/8/words/2", "#/readResults/0/lines/9/words/0", "#/readResults/0/lines/9/words/1", - "#/readResults/0/lines/9/words/2"]}, "confidence": 1.0}], "tables": [{"rows": - 6, "columns": 3, "cells": [{"text": "Package", "rowIndex": 0, "columnIndex": - 0, "boundingBox": [1.0931, 4.6986, 1.6236, 4.6986, 1.6236, 4.8427, 1.0931, - 4.8427], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/11/words/0"], - "isHeader": true, "isFooter": false}, {"text": "Included", "rowIndex": 0, - "columnIndex": 1, "boundingBox": [2.7125, 4.6986, 3.2708, 4.6986, 3.2708, - 4.8146, 2.7125, 4.8146], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/12/words/0"], "isHeader": true, "isFooter": - false}, {"text": "Price", "rowIndex": 0, "columnIndex": 2, "boundingBox": - [5.8375, 4.7038, 6.1514, 4.7038, 6.1514, 4.8146, 5.8375, 4.8146], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/13/words/0"], - "isHeader": true, "isFooter": false}, {"text": "Gold Sponsor", "rowIndex": - 1, "columnIndex": 0, "boundingBox": [1.0861, 4.9125, 1.9833, 4.9125, 1.9833, - 5.042, 1.0861, 5.042], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": - ["#/readResults/0/lines/14/words/0", "#/readResults/0/lines/14/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Pre-keynote thank - you Logo on poster Full page ad in program guide", "rowIndex": 1, "columnIndex": - 1, "boundingBox": [3.2139, 4.917, 5.2014, 4.917, 5.2014, 5.6885, 3.2139, 5.6885], - "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/15/words/0", - "#/readResults/0/lines/15/words/1", "#/readResults/0/lines/17/words/0", "#/readResults/0/lines/17/words/1", - "#/readResults/0/lines/17/words/2", "#/readResults/0/lines/18/words/0", "#/readResults/0/lines/18/words/1", - "#/readResults/0/lines/18/words/2", "#/readResults/0/lines/19/words/0", "#/readResults/0/lines/19/words/1", - "#/readResults/0/lines/19/words/2", "#/readResults/0/lines/19/words/3", "#/readResults/0/lines/19/words/4", - "#/readResults/0/lines/19/words/5"], "isHeader": false, "isFooter": false}, - {"text": "$1,500", "rowIndex": 1, "columnIndex": 2, "boundingBox": [5.8319, - 4.8976, 6.2833, 4.8976, 6.2833, 5.0469, 5.8319, 5.0469], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/16/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Silver Sponsor", "rowIndex": - 2, "columnIndex": 0, "boundingBox": [1.0833, 5.982, 2.0333, 5.982, 2.0333, - 6.1098, 1.0833, 6.1098], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/20/words/0", "#/readResults/0/lines/20/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Post-keynote thank - you Logo on poster Half page ad in program guide", "rowIndex": 2, "columnIndex": - 1, "boundingBox": [3.2139, 5.9868, 5.2306, 5.9868, 5.2306, 6.7569, 3.2139, - 6.7569], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/21/words/0", - "#/readResults/0/lines/21/words/1", "#/readResults/0/lines/23/words/0", "#/readResults/0/lines/23/words/1", - "#/readResults/0/lines/23/words/2", "#/readResults/0/lines/24/words/0", "#/readResults/0/lines/24/words/1", - "#/readResults/0/lines/24/words/2", "#/readResults/0/lines/25/words/0", "#/readResults/0/lines/25/words/1", - "#/readResults/0/lines/25/words/2", "#/readResults/0/lines/25/words/3", "#/readResults/0/lines/25/words/4", - "#/readResults/0/lines/25/words/5"], "isHeader": false, "isFooter": false}, - {"text": "$1,200", "rowIndex": 2, "columnIndex": 2, "boundingBox": [5.8319, - 5.9677, 6.2833, 5.9677, 6.2833, 6.1167, 5.8319, 6.1167], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/22/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Bronze Sponsor", "rowIndex": - 3, "columnIndex": 0, "boundingBox": [1.0931, 6.8407, 2.1361, 6.8407, 2.1361, - 6.9647, 1.0931, 6.9647], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/26/words/0", "#/readResults/0/lines/26/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Logo on poster - 50% discount on program guide advertisements", "rowIndex": 3, "columnIndex": - 1, "boundingBox": [3.2069, 6.842, 5.3417, 6.842, 5.3417, 7.5865, 3.2069, 7.5865], - "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/27/words/0", - "#/readResults/0/lines/27/words/1", "#/readResults/0/lines/29/words/0", "#/readResults/0/lines/29/words/1", - "#/readResults/0/lines/29/words/2", "#/readResults/0/lines/30/words/0", "#/readResults/0/lines/30/words/1", - "#/readResults/0/lines/30/words/2", "#/readResults/0/lines/30/words/3", "#/readResults/0/lines/30/words/4", - "#/readResults/0/lines/31/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$1,000", "rowIndex": 3, "columnIndex": 2, "boundingBox": [5.8319, - 6.8226, 6.2833, 6.8226, 6.2833, 6.9719, 5.8319, 6.9719], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/28/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Full Booth", "rowIndex": - 4, "columnIndex": 0, "boundingBox": [1.0931, 7.6819, 1.7542, 7.6819, 1.7542, - 7.7979, 1.0931, 7.7979], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/32/words/0", "#/readResults/0/lines/32/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth 50% discount on - program guide advertisements", "rowIndex": 4, "columnIndex": 1, "boundingBox": - [3.2069, 7.6903, 5.3417, 7.6903, 5.3417, 8.2212, 3.2069, 8.2212], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/33/words/0", - "#/readResults/0/lines/33/words/1", "#/readResults/0/lines/35/words/0", "#/readResults/0/lines/35/words/1", - "#/readResults/0/lines/35/words/2", "#/readResults/0/lines/35/words/3", "#/readResults/0/lines/35/words/4", - "#/readResults/0/lines/36/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$600", "rowIndex": 4, "columnIndex": 2, "boundingBox": [5.8319, - 7.6712, 6.1583, 7.6712, 6.1583, 7.8167, 5.8319, 7.8167], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/34/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Half Booth", "rowIndex": - 5, "columnIndex": 0, "boundingBox": [1.0931, 8.3167, 1.7861, 8.3167, 1.7861, - 8.433, 1.0931, 8.433], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": - ["#/readResults/0/lines/37/words/0", "#/readResults/0/lines/37/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth 25% discount on - program guide advertisements", "rowIndex": 5, "columnIndex": 1, "boundingBox": - [3.2069, 8.3253, 5.3417, 8.3253, 5.3417, 8.8563, 3.2069, 8.8563], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/38/words/0", - "#/readResults/0/lines/38/words/1", "#/readResults/0/lines/40/words/0", "#/readResults/0/lines/40/words/1", - "#/readResults/0/lines/40/words/2", "#/readResults/0/lines/40/words/3", "#/readResults/0/lines/40/words/4", - "#/readResults/0/lines/41/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$350", "rowIndex": 5, "columnIndex": 2, "boundingBox": [5.8319, - 8.3062, 6.1583, 8.3062, 6.1583, 8.4514, 5.8319, 8.4514], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/39/words/0"], - "isHeader": false, "isFooter": false}]}], "clusterId": 0}, {"page": 2, "keyValuePairs": + "Full Booth", "boundingBox": [3.2139, 4.917, 3.8722, 4.917, 3.8722, 5.033, + 3.2139, 5.033], "elements": ["#/readResults/0/lines/15/words/0", "#/readResults/0/lines/15/words/1"]}, + "value": {"text": "$1,500", "boundingBox": [5.8319, 4.8976, 6.2833, 4.8976, + 6.2833, 5.0469, 5.8319, 5.0469], "elements": ["#/readResults/0/lines/16/words/0"]}, + "confidence": 0.36}, {"key": {"text": "Full Booth", "boundingBox": [3.2139, + 5.9868, 3.8722, 5.9868, 3.8722, 6.1031, 3.2139, 6.1031], "elements": ["#/readResults/0/lines/21/words/0", + "#/readResults/0/lines/21/words/1"]}, "value": {"text": "$1,200", "boundingBox": + [5.8319, 5.9677, 6.2833, 5.9677, 6.2833, 6.1167, 5.8319, 6.1167], "elements": + ["#/readResults/0/lines/22/words/0"]}, "confidence": 0.36}, {"key": {"text": + "Full Booth", "boundingBox": [3.2139, 6.842, 3.8722, 6.842, 3.8722, 6.958, + 3.2139, 6.958], "elements": ["#/readResults/0/lines/27/words/0", "#/readResults/0/lines/27/words/1"]}, + "value": {"text": "$1,000", "boundingBox": [5.8319, 6.8226, 6.2833, 6.8226, + 6.2833, 6.9719, 5.8319, 6.9719], "elements": ["#/readResults/0/lines/28/words/0"]}, + "confidence": 0.36}, {"key": {"text": "Full Booth", "boundingBox": [3.2139, + 7.6903, 3.8722, 7.6903, 3.8722, 7.8063, 3.2139, 7.8063], "elements": ["#/readResults/0/lines/33/words/0", + "#/readResults/0/lines/33/words/1"]}, "value": {"text": "$600", "boundingBox": + [5.8319, 7.6712, 6.1583, 7.6712, 6.1583, 7.8167, 5.8319, 7.8167], "elements": + ["#/readResults/0/lines/34/words/0"]}, "confidence": 0.36}, {"key": {"text": + "Full Booth", "boundingBox": [3.2139, 8.3253, 3.8722, 8.3253, 3.8722, 8.4413, + 3.2139, 8.4413], "elements": ["#/readResults/0/lines/38/words/0", "#/readResults/0/lines/38/words/1"]}, + "value": {"text": "$350", "boundingBox": [5.8319, 8.3062, 6.1583, 8.3062, + 6.1583, 8.4514, 5.8319, 8.4514], "elements": ["#/readResults/0/lines/39/words/0"]}, + "confidence": 0.36}, {"key": {"text": "__Address__1", "boundingBox": null, + "elements": null}, "value": {"text": "Contoso Ltd. 2345 Dogwood Lane Birch, + Kansas 98123", "boundingBox": [1.0069, 3.5781, 2.3764, 3.5781, 2.3764, 4.1379, + 1.0069, 4.1379], "elements": ["#/readResults/0/lines/7/words/0", "#/readResults/0/lines/7/words/1", + "#/readResults/0/lines/8/words/0", "#/readResults/0/lines/8/words/1", "#/readResults/0/lines/8/words/2", + "#/readResults/0/lines/9/words/0", "#/readResults/0/lines/9/words/1", "#/readResults/0/lines/9/words/2"]}, + "confidence": 1.0}], "tables": [], "clusterId": 0}, {"page": 2, "keyValuePairs": [{"key": {"text": "Vendor #:", "boundingBox": [6.1278, 1.0688, 7.1514, 1.0688, 7.1514, 1.24, 6.1278, 1.24], "elements": ["#/readResults/1/lines/0/words/0", "#/readResults/1/lines/0/words/1"]}, "value": {"text": "121", "boundingBox": @@ -13254,19 +13195,19 @@ interactions: "clusterId": 1}], "documentResults": [], "errors": []}}' headers: apim-request-id: - - 45d7dfc4-2efe-4009-8ab6-17a3effacf7c + - 561889e8-4ad1-4534-9613-180b45e71430 content-length: - - '32950' + - '27606' content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 19:47:40 GMT + - Tue, 06 Oct 2020 02:09:25 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '24' + - '22' status: code: 200 message: OK diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_async.test_custom_form_labeled.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_async.test_custom_form_labeled.yaml index 6b298720c634..14892246c57f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_async.test_custom_form_labeled.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_async.test_custom_form_labeled.yaml @@ -1,12 +1,12 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": true}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true, "modelName": "labeled"}''' headers: Accept: - application/json Content-Length: - - '287' + - '311' Content-Type: - application/json User-Agent: @@ -17,13 +17,13 @@ interactions: body: string: '' headers: - apim-request-id: a6eeb21b-3382-4bba-b83c-63bf31e2a842 + apim-request-id: fbca460c-8f2c-4288-9c18-286385f8395d content-length: '0' - date: Mon, 14 Sep 2020 19:50:22 GMT - location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2c5bc7ae-9ed2-451a-b6a7-9170f8196f91 + date: Tue, 06 Oct 2020 02:33:22 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '39' + x-envoy-upstream-service-time: '77' status: code: 201 message: Created @@ -34,38 +34,38 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2c5bc7ae-9ed2-451a-b6a7-9170f8196f91?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "2c5bc7ae-9ed2-451a-b6a7-9170f8196f91", "attributes": - {"isComposed": false}, "status": "ready", "createdDateTime": "2020-09-14T19:50:22Z", - "lastUpdatedDateTime": "2020-09-14T19:50:24Z"}, "trainResult": {"averageModelAccuracy": - 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": - "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, - {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": - "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", - "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", - "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": - "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": - 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": - 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", - "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": - "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, - {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": - 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", - "accuracy": 1.0}], "errors": []}}' + string: '{"modelInfo": {"modelId": "2013bef3-1c61-4d2f-83fe-d897f0cc4d6a", "modelName": + "labeled", "attributes": {"isComposed": false}, "status": "ready", "createdDateTime": + "2020-10-06T02:33:23Z", "lastUpdatedDateTime": "2020-10-06T02:33:25Z"}, "trainResult": + {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], "fields": + [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": "CompanyName", + "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": + "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": + "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, + {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": "Quantity", + "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, {"fieldName": + "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": + "Total", "accuracy": 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": + "Website", "accuracy": 1.0}], "errors": []}}' headers: - apim-request-id: 86271ed1-60de-4584-b430-ec96291de505 + apim-request-id: b46f96bf-7a2d-430f-a7d4-13ecb90f42c9 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:50:26 GMT + date: Tue, 06 Oct 2020 02:33:28 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '14' + x-envoy-upstream-service-time: '149' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2c5bc7ae-9ed2-451a-b6a7-9170f8196f91?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a?includeKeys=true - request: body: !!binary | /9j/4AAQSkZJRgABAQEAyADIAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA @@ -8485,33 +8485,56 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: POST - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2c5bc7ae-9ed2-451a-b6a7-9170f8196f91/analyze?includeTextDetails=false + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a/analyze?includeTextDetails=false response: body: string: '' headers: - apim-request-id: 662bba78-4078-45cd-8e6c-8556a202c8d1 + apim-request-id: b6803347-231a-496b-888f-a2da48f41a66 content-length: '0' - date: Mon, 14 Sep 2020 19:50:27 GMT - operation-location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2c5bc7ae-9ed2-451a-b6a7-9170f8196f91/analyzeresults/1da2c8a6-0ba3-4758-9b25-70346f208926 + date: Tue, 06 Oct 2020 02:33:28 GMT + operation-location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a/analyzeresults/437da7b1-eada-478a-bee8-eccdbae52cd0 strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '60' + x-envoy-upstream-service-time: '120' status: code: 202 message: Accepted - url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/2c5bc7ae-9ed2-451a-b6a7-9170f8196f91/analyze?includeTextDetails=false + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a/analyze?includeTextDetails=false - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2c5bc7ae-9ed2-451a-b6a7-9170f8196f91/analyzeresults/1da2c8a6-0ba3-4758-9b25-70346f208926 + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a/analyzeresults/437da7b1-eada-478a-bee8-eccdbae52cd0 response: body: - string: '{"status": "succeeded", "createdDateTime": "2020-09-14T19:50:28Z", - "lastUpdatedDateTime": "2020-09-14T19:50:32Z", "analyzeResult": {"version": + string: '{"status": "notStarted", "createdDateTime": "2020-10-06T02:33:29Z", + "lastUpdatedDateTime": "2020-10-06T02:33:33Z"}' + headers: + apim-request-id: 218dfb08-1080-4387-a57c-248a1146b3df + content-length: '109' + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 02:33:33 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + x-content-type-options: nosniff + x-envoy-upstream-service-time: '18' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a/analyzeresults/437da7b1-eada-478a-bee8-eccdbae52cd0 +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a/analyzeresults/437da7b1-eada-478a-bee8-eccdbae52cd0 + response: + body: + string: '{"status": "succeeded", "createdDateTime": "2020-10-06T02:33:29Z", + "lastUpdatedDateTime": "2020-10-06T02:33:36Z", "analyzeResult": {"version": "2.1.0", "readResults": [{"page": 1, "angle": 0, "width": 1700, "height": 2200, "unit": "pixel", "selectionMarks": [{"boundingBox": [2, 2060, 195, 2060, 195, 2200, 2, 2200], "confidence": 0.881, "state": "unselected"}]}], "pageResults": @@ -8557,57 +8580,56 @@ interactions: {"rowIndex": 4, "columnIndex": 2, "text": "5.00", "boundingBox": [1072, 1216, 1309, 1216, 1309, 1260, 1072, 1260]}, {"rowIndex": 4, "columnIndex": 3, "text": "100.00", "boundingBox": [1309, 1216, 1544, 1216, 1544, 1260, 1309, 1260]}]}]}], - "documentResults": [{"docType": "custom:2c5bc7ae-9ed2-451a-b6a7-9170f8196f91", - "modelId": "2c5bc7ae-9ed2-451a-b6a7-9170f8196f91", "pageRange": [1, 1], "fields": - {"Tax": {"type": "string", "valueString": "$4.00", "text": "$4.00", "page": - 1, "boundingBox": [1458.0, 1615.0, 1529.0, 1615.0, 1529.0, 1643.0, 1458.0, - 1643.0], "confidence": 0.994}, "CompanyAddress": {"type": "string", "valueString": - "938 NE Burner Road Boulder City, CO 92848", "text": "938 NE Burner Road Boulder - City, CO 92848", "page": 1, "boundingBox": [273.0, 685.0, 565.0, 685.0, 565.0, - 751.0, 273.0, 751.0], "confidence": 1.0}, "CompanyPhoneNumber": {"type": "string", - "valueString": "938-294-2949", "text": "938-294-2949", "page": 1, "boundingBox": - [708.0, 722.0, 885.0, 722.0, 885.0, 749.0, 708.0, 749.0], "confidence": 1.0}, - "PhoneNumber": {"type": "string", "valueString": "555-348-6512", "text": "555-348-6512", - "page": 1, "boundingBox": [364.0, 351.0, 528.0, 351.0, 528.0, 378.0, 364.0, - 378.0], "confidence": 0.89}, "Signature": {"type": "string", "valueString": - "Bernie Sanders", "text": "Bernie Sanders", "page": 1, "boundingBox": [489.0, - 1670.0, 765.0, 1670.0, 765.0, 1708.0, 489.0, 1708.0], "confidence": 0.998}, - "Email": {"type": "string", "valueString": "accounts@herolimited.com", "text": - "accounts@herolimited.com", "page": 1, "boundingBox": [164.0, 479.0, 478.0, - 479.0, 478.0, 503.0, 164.0, 503.0], "confidence": 1.0}, "Subtotal": {"type": - "string", "valueString": "$140.00", "text": "$140.00", "page": 1, "boundingBox": - [1426.0, 1572.0, 1531.0, 1572.0, 1531.0, 1599.0, 1426.0, 1599.0], "confidence": - 0.984}, "PurchaseOrderNumber": {"type": "string", "valueString": "948284", - "text": "948284", "page": 1, "boundingBox": [1277.0, 461.0, 1376.0, 461.0, - 1376.0, 489.0, 1277.0, 489.0], "confidence": 0.94}, "Website": {"type": "string", - "valueString": "www.herolimited.com", "text": "www.herolimited.com", "page": - 1, "boundingBox": [273.0, 393.0, 531.0, 393.0, 531.0, 418.0, 273.0, 418.0], - "confidence": 0.95}, "Quantity": {"type": "number", "text": "20", "page": - 1, "boundingBox": [861.0, 1094.0, 892.0, 1094.0, 892.0, 1119.0, 861.0, 1119.0], - "confidence": 0.962}, "Total": {"type": "string", "valueString": "$144.00", - "text": "$144.00", "page": 1, "boundingBox": [1427.0, 1669.0, 1529.0, 1669.0, - 1529.0, 1698.0, 1427.0, 1698.0], "confidence": 0.991}, "VendorName": {"type": - "string", "valueString": "Hillary Swank", "text": "Hillary Swank", "page": - 1, "boundingBox": [349.0, 609.0, 521.0, 609.0, 521.0, 639.0, 349.0, 639.0], - "confidence": 0.93}, "Merchant": {"type": "string", "valueString": "Hero Limited", - "text": "Hero Limited", "page": 1, "boundingBox": [620.0, 205.0, 1075.0, 205.0, - 1075.0, 266.0, 620.0, 266.0], "confidence": 0.97}, "DatedAs": {"type": "string", - "valueString": "12/20/2020", "text": "12/20/2020", "page": 1, "boundingBox": - [1165.0, 420.0, 1317.0, 420.0, 1317.0, 449.0, 1165.0, 449.0], "confidence": - 0.99}, "CompanyName": {"type": "string", "valueString": "Higgly Wiggly Books", - "text": "Higgly Wiggly Books", "page": 1, "boundingBox": [375.0, 646.0, 629.0, - 646.0, 629.0, 679.0, 375.0, 679.0], "confidence": 0.95}}, "docTypeConfidence": + "documentResults": [{"docType": "custom:labeled", "modelId": "2013bef3-1c61-4d2f-83fe-d897f0cc4d6a", + "pageRange": [1, 1], "fields": {"Total": {"type": "string", "valueString": + "$144.00", "text": "$144.00", "page": 1, "boundingBox": [1427.0, 1669.0, 1529.0, + 1669.0, 1529.0, 1698.0, 1427.0, 1698.0], "confidence": 0.991}, "CompanyAddress": + {"type": "string", "valueString": "938 NE Burner Road Boulder City, CO 92848", + "text": "938 NE Burner Road Boulder City, CO 92848", "page": 1, "boundingBox": + [273.0, 685.0, 565.0, 685.0, 565.0, 751.0, 273.0, 751.0], "confidence": 1.0}, + "CompanyPhoneNumber": {"type": "string", "valueString": "938-294-2949", "text": + "938-294-2949", "page": 1, "boundingBox": [708.0, 722.0, 885.0, 722.0, 885.0, + 749.0, 708.0, 749.0], "confidence": 1.0}, "Quantity": {"type": "number", "text": + "20", "page": 1, "boundingBox": [861.0, 1094.0, 892.0, 1094.0, 892.0, 1119.0, + 861.0, 1119.0], "confidence": 0.962}, "Subtotal": {"type": "string", "valueString": + "$140.00", "text": "$140.00", "page": 1, "boundingBox": [1426.0, 1572.0, 1531.0, + 1572.0, 1531.0, 1599.0, 1426.0, 1599.0], "confidence": 0.984}, "Email": {"type": + "string", "valueString": "accounts@herolimited.com", "text": "accounts@herolimited.com", + "page": 1, "boundingBox": [164.0, 479.0, 478.0, 479.0, 478.0, 503.0, 164.0, + 503.0], "confidence": 1.0}, "Tax": {"type": "string", "valueString": "$4.00", + "text": "$4.00", "page": 1, "boundingBox": [1458.0, 1615.0, 1529.0, 1615.0, + 1529.0, 1643.0, 1458.0, 1643.0], "confidence": 0.994}, "Merchant": {"type": + "string", "valueString": "Hero Limited", "text": "Hero Limited", "page": 1, + "boundingBox": [620.0, 205.0, 1075.0, 205.0, 1075.0, 266.0, 620.0, 266.0], + "confidence": 0.97}, "DatedAs": {"type": "string", "valueString": "12/20/2020", + "text": "12/20/2020", "page": 1, "boundingBox": [1165.0, 420.0, 1317.0, 420.0, + 1317.0, 449.0, 1165.0, 449.0], "confidence": 0.99}, "PurchaseOrderNumber": + {"type": "string", "valueString": "948284", "text": "948284", "page": 1, "boundingBox": + [1277.0, 461.0, 1376.0, 461.0, 1376.0, 489.0, 1277.0, 489.0], "confidence": + 0.94}, "PhoneNumber": {"type": "string", "valueString": "555-348-6512", "text": + "555-348-6512", "page": 1, "boundingBox": [364.0, 351.0, 528.0, 351.0, 528.0, + 378.0, 364.0, 378.0], "confidence": 0.89}, "Signature": {"type": "string", + "valueString": "Bernie Sanders", "text": "Bernie Sanders", "page": 1, "boundingBox": + [489.0, 1670.0, 765.0, 1670.0, 765.0, 1708.0, 489.0, 1708.0], "confidence": + 0.998}, "Website": {"type": "string", "valueString": "www.herolimited.com", + "text": "www.herolimited.com", "page": 1, "boundingBox": [273.0, 393.0, 531.0, + 393.0, 531.0, 418.0, 273.0, 418.0], "confidence": 0.95}, "CompanyName": {"type": + "string", "valueString": "Higgly Wiggly Books", "text": "Higgly Wiggly Books", + "page": 1, "boundingBox": [375.0, 646.0, 629.0, 646.0, 629.0, 679.0, 375.0, + 679.0], "confidence": 0.95}, "VendorName": {"type": "string", "valueString": + "Hillary Swank", "text": "Hillary Swank", "page": 1, "boundingBox": [349.0, + 609.0, 521.0, 609.0, 521.0, 639.0, 349.0, 639.0], "confidence": 0.93}}, "docTypeConfidence": 1.0}], "errors": []}}' headers: - apim-request-id: 920f126d-6f57-4134-a32c-9bf33ac5ffe4 - content-length: '6054' + apim-request-id: 22007f20-bda0-482d-96b5-6dbf175f3acc + content-length: '6025' content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:50:33 GMT + date: Tue, 06 Oct 2020 02:33:39 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '36' + x-envoy-upstream-service-time: '22' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2c5bc7ae-9ed2-451a-b6a7-9170f8196f91/analyzeresults/1da2c8a6-0ba3-4758-9b25-70346f208926 + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2013bef3-1c61-4d2f-83fe-d897f0cc4d6a/analyzeresults/437da7b1-eada-478a-bee8-eccdbae52cd0 version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_async.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_async.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml index 5e7080ac8eba..91c08c948b55 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_async.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_async.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": false}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false}''' headers: Accept: - application/json @@ -17,13 +17,13 @@ interactions: body: string: '' headers: - apim-request-id: 5b9e3ad8-eb10-4283-8df9-02168dea3c4d + apim-request-id: 69720a11-33f7-45f0-9d84-82b1170b3aa7 content-length: '0' - date: Mon, 14 Sep 2020 19:51:12 GMT - location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16 + date: Tue, 06 Oct 2020 02:31:07 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154 strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '41' + x-envoy-upstream-service-time: '48' status: code: 201 message: Created @@ -34,111 +34,115 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "208757b6-34ba-4e01-98dd-4624ae384e16", "status": - "creating", "createdDateTime": "2020-09-14T19:51:13Z", "lastUpdatedDateTime": - "2020-09-14T19:51:13Z"}}' + string: '{"modelInfo": {"modelId": "61ed6945-fde5-43dc-81b2-de8fd5953154", "status": + "creating", "createdDateTime": "2020-10-06T02:31:08Z", "lastUpdatedDateTime": + "2020-10-06T02:31:08Z"}}' headers: - apim-request-id: 173be977-4e33-49ea-936e-0c79f884e1dc + apim-request-id: 6da0c5cd-a76a-4319-a0c0-da919c4659e6 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:51:18 GMT + date: Tue, 06 Oct 2020 02:31:12 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '14' + x-envoy-upstream-service-time: '17' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "208757b6-34ba-4e01-98dd-4624ae384e16", "status": - "creating", "createdDateTime": "2020-09-14T19:51:13Z", "lastUpdatedDateTime": - "2020-09-14T19:51:13Z"}}' + string: '{"modelInfo": {"modelId": "61ed6945-fde5-43dc-81b2-de8fd5953154", "status": + "creating", "createdDateTime": "2020-10-06T02:31:08Z", "lastUpdatedDateTime": + "2020-10-06T02:31:08Z"}}' headers: - apim-request-id: 8b53368a-425c-4ddf-ab0a-eb928795dcae + apim-request-id: fcdb9a8a-6079-409a-9637-36322ab084f7 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:51:22 GMT + date: Tue, 06 Oct 2020 02:31:18 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '13' + x-envoy-upstream-service-time: '18' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "208757b6-34ba-4e01-98dd-4624ae384e16", "status": - "creating", "createdDateTime": "2020-09-14T19:51:13Z", "lastUpdatedDateTime": - "2020-09-14T19:51:13Z"}}' + string: '{"modelInfo": {"modelId": "61ed6945-fde5-43dc-81b2-de8fd5953154", "status": + "creating", "createdDateTime": "2020-10-06T02:31:08Z", "lastUpdatedDateTime": + "2020-10-06T02:31:08Z"}}' headers: - apim-request-id: 0fff8d49-2090-4672-9945-9603f1fcf118 + apim-request-id: 4767e41a-71b5-4a44-b6b0-b9286a38d965 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:51:27 GMT + date: Tue, 06 Oct 2020 02:31:23 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '15' + x-envoy-upstream-service-time: '13' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "208757b6-34ba-4e01-98dd-4624ae384e16", "status": - "creating", "createdDateTime": "2020-09-14T19:51:13Z", "lastUpdatedDateTime": - "2020-09-14T19:51:13Z"}}' + string: '{"modelInfo": {"modelId": "61ed6945-fde5-43dc-81b2-de8fd5953154", "status": + "creating", "createdDateTime": "2020-10-06T02:31:08Z", "lastUpdatedDateTime": + "2020-10-06T02:31:08Z"}}' headers: - apim-request-id: 31e0d596-8f53-46fb-ae89-68bbafeed478 + apim-request-id: 680d9057-67cd-45cc-889b-fcac64e25e50 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:51:33 GMT + date: Tue, 06 Oct 2020 02:31:27 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '23' + x-envoy-upstream-service-time: '15' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "208757b6-34ba-4e01-98dd-4624ae384e16", "status": - "ready", "createdDateTime": "2020-09-14T19:51:13Z", "lastUpdatedDateTime": - "2020-09-14T19:51:38Z"}, "keys": {"clusters": {"0": ["Contoso Ltd. Conference - will be held on May 28-29, 2020 at the Elm Conference Center in", "Included", - "Maple City, Massachusetts. The conference has sold out of its 1,500 tickets, - with a 400 person", "Package", "Price", "Rates:", "Vendor #:", "Vendor Registration", + string: '{"modelInfo": {"modelId": "61ed6945-fde5-43dc-81b2-de8fd5953154", "status": + "ready", "createdDateTime": "2020-10-06T02:31:08Z", "lastUpdatedDateTime": + "2020-10-06T02:31:32Z"}, "keys": {"clusters": {"0": ["25% discount on program + guide", "50% discount on program guide", "Bronze Sponsor", "Contoso Ltd. Conference + will be held on May 28-29, 2020 at the Elm Conference Center in", "Full Booth", + "Full booth", "Full page ad in program guide", "Gold Sponsor", "Half Booth", + "Half page ad in program guide", "Included", "Logo on poster", "Maple City, + Massachusetts. The conference has sold out of its 1,500 tickets, with a 400 + person", "Package", "Post-keynote thank you", "Pre-keynote thank you", "Price", + "Rates:", "Silver Sponsor", "Vendor #:", "Vendor Registration", "advertisements", "below, and attach a check made out to:", "waitlist. Vendor applications are being accepted through Feb 28, 2020. Please fill in the form"], "1": ["Company Name:", "Contact:", "Preferred Package:", "Special Requests:", "Vendor #:", @@ -150,17 +154,17 @@ interactions: "multi5.pdf", "pages": 2, "errors": [], "status": "succeeded"}], "errors": []}}' headers: - apim-request-id: 0dd94499-5c2b-4cc3-bf3d-2fd158d20a77 + apim-request-id: 261359b4-74a6-4b4c-a796-513ba8b62d87 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:51:38 GMT + date: Tue, 06 Oct 2020 02:31:33 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '15' + x-envoy-upstream-service-time: '13' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154?includeKeys=true - request: body: !!binary | JVBERi0xLjcKCjQgMCBvYmoKKElkZW50aXR5KQplbmRvYmoKNSAwIG9iagooQWRvYmUpCmVuZG9i @@ -12656,79 +12660,79 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: POST - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16/analyze?includeTextDetails=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154/analyze?includeTextDetails=true response: body: string: '' headers: - apim-request-id: 68b4318d-9274-4306-8c4d-27e2578119ed + apim-request-id: 6215117f-a61e-4c94-99aa-83a5f9f3e32b content-length: '0' - date: Mon, 14 Sep 2020 19:51:40 GMT - operation-location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16/analyzeresults/d7cda754-0efb-4a12-b555-2c4047d11cf7 + date: Tue, 06 Oct 2020 02:31:34 GMT + operation-location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154/analyzeresults/2705f443-80f5-4974-a018-6329fe3258a9 strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '58' + x-envoy-upstream-service-time: '63' status: code: 202 message: Accepted - url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16/analyze?includeTextDetails=true + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154/analyze?includeTextDetails=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16/analyzeresults/d7cda754-0efb-4a12-b555-2c4047d11cf7 + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154/analyzeresults/2705f443-80f5-4974-a018-6329fe3258a9 response: body: - string: '{"status": "running", "createdDateTime": "2020-09-14T19:51:40Z", "lastUpdatedDateTime": - "2020-09-14T19:51:41Z", "analyzeResult": null}' + string: '{"status": "running", "createdDateTime": "2020-10-06T02:31:35Z", "lastUpdatedDateTime": + "2020-10-06T02:31:35Z", "analyzeResult": null}' headers: - apim-request-id: 0411e4af-1aac-49c6-ac52-5da16b4f4a74 + apim-request-id: 1c5e489d-6d66-4479-9179-47164a39ffc9 content-length: '134' content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:51:45 GMT + date: Tue, 06 Oct 2020 02:31:40 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '14' + x-envoy-upstream-service-time: '19' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16/analyzeresults/d7cda754-0efb-4a12-b555-2c4047d11cf7 + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154/analyzeresults/2705f443-80f5-4974-a018-6329fe3258a9 - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16/analyzeresults/d7cda754-0efb-4a12-b555-2c4047d11cf7 + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154/analyzeresults/2705f443-80f5-4974-a018-6329fe3258a9 response: body: - string: '{"status": "running", "createdDateTime": "2020-09-14T19:51:40Z", "lastUpdatedDateTime": - "2020-09-14T19:51:41Z", "analyzeResult": null}' + string: '{"status": "running", "createdDateTime": "2020-10-06T02:31:35Z", "lastUpdatedDateTime": + "2020-10-06T02:31:35Z", "analyzeResult": null}' headers: - apim-request-id: a5c49a11-d8e0-4b0a-9cfc-b6ca5536df31 + apim-request-id: 38ee4508-87e9-4d01-b59b-e7e9e006a73a content-length: '134' content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:51:50 GMT + date: Tue, 06 Oct 2020 02:31:45 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '12' + x-envoy-upstream-service-time: '19' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16/analyzeresults/d7cda754-0efb-4a12-b555-2c4047d11cf7 + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154/analyzeresults/2705f443-80f5-4974-a018-6329fe3258a9 - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16/analyzeresults/d7cda754-0efb-4a12-b555-2c4047d11cf7 + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154/analyzeresults/2705f443-80f5-4974-a018-6329fe3258a9 response: body: - string: '{"status": "succeeded", "createdDateTime": "2020-09-14T19:51:40Z", - "lastUpdatedDateTime": "2020-09-14T19:51:52Z", "analyzeResult": {"version": + string: '{"status": "succeeded", "createdDateTime": "2020-10-06T02:31:35Z", + "lastUpdatedDateTime": "2020-10-06T02:31:48Z", "analyzeResult": {"version": "2.1.0", "readResults": [{"page": 1, "angle": 0, "width": 8.5, "height": 11.0, "unit": "inch", "lines": [{"text": "Vendor #:", "boundingBox": [6.1278, 1.0688, 7.1514, 1.0688, 7.1514, 1.24, 6.1278, 1.24], "words": [{"text": "Vendor", @@ -13023,98 +13027,35 @@ interactions: "#/readResults/0/lines/0/words/1"]}, "value": {"text": "121", "boundingBox": [7.1514, 1.076, 7.4833, 1.076, 7.4833, 1.2392, 7.1514, 1.2392], "elements": ["#/readResults/0/lines/1/words/0"]}, "confidence": 1.0}, {"key": {"text": - "__Address__1", "boundingBox": null, "elements": null}, "value": {"text": - "Contoso Ltd. 2345 Dogwood Lane Birch, Kansas 98123", "boundingBox": [1.0069, - 3.5781, 2.3764, 3.5781, 2.3764, 4.1379, 1.0069, 4.1379], "elements": ["#/readResults/0/lines/7/words/0", - "#/readResults/0/lines/7/words/1", "#/readResults/0/lines/8/words/0", "#/readResults/0/lines/8/words/1", - "#/readResults/0/lines/8/words/2", "#/readResults/0/lines/9/words/0", "#/readResults/0/lines/9/words/1", - "#/readResults/0/lines/9/words/2"]}, "confidence": 1.0}], "tables": [{"rows": - 6, "columns": 3, "cells": [{"text": "Package", "rowIndex": 0, "columnIndex": - 0, "boundingBox": [1.0931, 4.6986, 1.6236, 4.6986, 1.6236, 4.8427, 1.0931, - 4.8427], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/11/words/0"], - "isHeader": true, "isFooter": false}, {"text": "Included", "rowIndex": 0, - "columnIndex": 1, "boundingBox": [2.7125, 4.6986, 3.2708, 4.6986, 3.2708, - 4.8146, 2.7125, 4.8146], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/12/words/0"], "isHeader": true, "isFooter": - false}, {"text": "Price", "rowIndex": 0, "columnIndex": 2, "boundingBox": - [5.8375, 4.7038, 6.1514, 4.7038, 6.1514, 4.8146, 5.8375, 4.8146], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/13/words/0"], - "isHeader": true, "isFooter": false}, {"text": "Gold Sponsor", "rowIndex": - 1, "columnIndex": 0, "boundingBox": [1.0861, 4.9125, 1.9833, 4.9125, 1.9833, - 5.042, 1.0861, 5.042], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": - ["#/readResults/0/lines/14/words/0", "#/readResults/0/lines/14/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Pre-keynote thank - you Logo on poster Full page ad in program guide", "rowIndex": 1, "columnIndex": - 1, "boundingBox": [3.2139, 4.917, 5.2014, 4.917, 5.2014, 5.6885, 3.2139, 5.6885], - "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/15/words/0", - "#/readResults/0/lines/15/words/1", "#/readResults/0/lines/17/words/0", "#/readResults/0/lines/17/words/1", - "#/readResults/0/lines/17/words/2", "#/readResults/0/lines/18/words/0", "#/readResults/0/lines/18/words/1", - "#/readResults/0/lines/18/words/2", "#/readResults/0/lines/19/words/0", "#/readResults/0/lines/19/words/1", - "#/readResults/0/lines/19/words/2", "#/readResults/0/lines/19/words/3", "#/readResults/0/lines/19/words/4", - "#/readResults/0/lines/19/words/5"], "isHeader": false, "isFooter": false}, - {"text": "$1,500", "rowIndex": 1, "columnIndex": 2, "boundingBox": [5.8319, - 4.8976, 6.2833, 4.8976, 6.2833, 5.0469, 5.8319, 5.0469], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/16/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Silver Sponsor", "rowIndex": - 2, "columnIndex": 0, "boundingBox": [1.0833, 5.982, 2.0333, 5.982, 2.0333, - 6.1098, 1.0833, 6.1098], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/20/words/0", "#/readResults/0/lines/20/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Post-keynote thank - you Logo on poster Half page ad in program guide", "rowIndex": 2, "columnIndex": - 1, "boundingBox": [3.2139, 5.9868, 5.2306, 5.9868, 5.2306, 6.7569, 3.2139, - 6.7569], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/21/words/0", - "#/readResults/0/lines/21/words/1", "#/readResults/0/lines/23/words/0", "#/readResults/0/lines/23/words/1", - "#/readResults/0/lines/23/words/2", "#/readResults/0/lines/24/words/0", "#/readResults/0/lines/24/words/1", - "#/readResults/0/lines/24/words/2", "#/readResults/0/lines/25/words/0", "#/readResults/0/lines/25/words/1", - "#/readResults/0/lines/25/words/2", "#/readResults/0/lines/25/words/3", "#/readResults/0/lines/25/words/4", - "#/readResults/0/lines/25/words/5"], "isHeader": false, "isFooter": false}, - {"text": "$1,200", "rowIndex": 2, "columnIndex": 2, "boundingBox": [5.8319, - 5.9677, 6.2833, 5.9677, 6.2833, 6.1167, 5.8319, 6.1167], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/22/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Bronze Sponsor", "rowIndex": - 3, "columnIndex": 0, "boundingBox": [1.0931, 6.8407, 2.1361, 6.8407, 2.1361, - 6.9647, 1.0931, 6.9647], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/26/words/0", "#/readResults/0/lines/26/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Logo on poster - 50% discount on program guide advertisements", "rowIndex": 3, "columnIndex": - 1, "boundingBox": [3.2069, 6.842, 5.3417, 6.842, 5.3417, 7.5865, 3.2069, 7.5865], - "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/27/words/0", - "#/readResults/0/lines/27/words/1", "#/readResults/0/lines/29/words/0", "#/readResults/0/lines/29/words/1", - "#/readResults/0/lines/29/words/2", "#/readResults/0/lines/30/words/0", "#/readResults/0/lines/30/words/1", - "#/readResults/0/lines/30/words/2", "#/readResults/0/lines/30/words/3", "#/readResults/0/lines/30/words/4", - "#/readResults/0/lines/31/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$1,000", "rowIndex": 3, "columnIndex": 2, "boundingBox": [5.8319, - 6.8226, 6.2833, 6.8226, 6.2833, 6.9719, 5.8319, 6.9719], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/28/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Full Booth", "rowIndex": - 4, "columnIndex": 0, "boundingBox": [1.0931, 7.6819, 1.7542, 7.6819, 1.7542, - 7.7979, 1.0931, 7.7979], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/32/words/0", "#/readResults/0/lines/32/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth 50% discount on - program guide advertisements", "rowIndex": 4, "columnIndex": 1, "boundingBox": - [3.2069, 7.6903, 5.3417, 7.6903, 5.3417, 8.2212, 3.2069, 8.2212], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/33/words/0", - "#/readResults/0/lines/33/words/1", "#/readResults/0/lines/35/words/0", "#/readResults/0/lines/35/words/1", - "#/readResults/0/lines/35/words/2", "#/readResults/0/lines/35/words/3", "#/readResults/0/lines/35/words/4", - "#/readResults/0/lines/36/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$600", "rowIndex": 4, "columnIndex": 2, "boundingBox": [5.8319, - 7.6712, 6.1583, 7.6712, 6.1583, 7.8167, 5.8319, 7.8167], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/34/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Half Booth", "rowIndex": - 5, "columnIndex": 0, "boundingBox": [1.0931, 8.3167, 1.7861, 8.3167, 1.7861, - 8.433, 1.0931, 8.433], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": - ["#/readResults/0/lines/37/words/0", "#/readResults/0/lines/37/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth 25% discount on - program guide advertisements", "rowIndex": 5, "columnIndex": 1, "boundingBox": - [3.2069, 8.3253, 5.3417, 8.3253, 5.3417, 8.8563, 3.2069, 8.8563], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/38/words/0", - "#/readResults/0/lines/38/words/1", "#/readResults/0/lines/40/words/0", "#/readResults/0/lines/40/words/1", - "#/readResults/0/lines/40/words/2", "#/readResults/0/lines/40/words/3", "#/readResults/0/lines/40/words/4", - "#/readResults/0/lines/41/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$350", "rowIndex": 5, "columnIndex": 2, "boundingBox": [5.8319, - 8.3062, 6.1583, 8.3062, 6.1583, 8.4514, 5.8319, 8.4514], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/39/words/0"], - "isHeader": false, "isFooter": false}]}], "clusterId": 0}, {"page": 2, "keyValuePairs": + "Full Booth", "boundingBox": [3.2139, 4.917, 3.8722, 4.917, 3.8722, 5.033, + 3.2139, 5.033], "elements": ["#/readResults/0/lines/15/words/0", "#/readResults/0/lines/15/words/1"]}, + "value": {"text": "$1,500", "boundingBox": [5.8319, 4.8976, 6.2833, 4.8976, + 6.2833, 5.0469, 5.8319, 5.0469], "elements": ["#/readResults/0/lines/16/words/0"]}, + "confidence": 0.36}, {"key": {"text": "Full Booth", "boundingBox": [3.2139, + 5.9868, 3.8722, 5.9868, 3.8722, 6.1031, 3.2139, 6.1031], "elements": ["#/readResults/0/lines/21/words/0", + "#/readResults/0/lines/21/words/1"]}, "value": {"text": "$1,200", "boundingBox": + [5.8319, 5.9677, 6.2833, 5.9677, 6.2833, 6.1167, 5.8319, 6.1167], "elements": + ["#/readResults/0/lines/22/words/0"]}, "confidence": 0.36}, {"key": {"text": + "Full Booth", "boundingBox": [3.2139, 6.842, 3.8722, 6.842, 3.8722, 6.958, + 3.2139, 6.958], "elements": ["#/readResults/0/lines/27/words/0", "#/readResults/0/lines/27/words/1"]}, + "value": {"text": "$1,000", "boundingBox": [5.8319, 6.8226, 6.2833, 6.8226, + 6.2833, 6.9719, 5.8319, 6.9719], "elements": ["#/readResults/0/lines/28/words/0"]}, + "confidence": 0.36}, {"key": {"text": "Full Booth", "boundingBox": [3.2139, + 7.6903, 3.8722, 7.6903, 3.8722, 7.8063, 3.2139, 7.8063], "elements": ["#/readResults/0/lines/33/words/0", + "#/readResults/0/lines/33/words/1"]}, "value": {"text": "$600", "boundingBox": + [5.8319, 7.6712, 6.1583, 7.6712, 6.1583, 7.8167, 5.8319, 7.8167], "elements": + ["#/readResults/0/lines/34/words/0"]}, "confidence": 0.36}, {"key": {"text": + "Full Booth", "boundingBox": [3.2139, 8.3253, 3.8722, 8.3253, 3.8722, 8.4413, + 3.2139, 8.4413], "elements": ["#/readResults/0/lines/38/words/0", "#/readResults/0/lines/38/words/1"]}, + "value": {"text": "$350", "boundingBox": [5.8319, 8.3062, 6.1583, 8.3062, + 6.1583, 8.4514, 5.8319, 8.4514], "elements": ["#/readResults/0/lines/39/words/0"]}, + "confidence": 0.36}, {"key": {"text": "__Address__1", "boundingBox": null, + "elements": null}, "value": {"text": "Contoso Ltd. 2345 Dogwood Lane Birch, + Kansas 98123", "boundingBox": [1.0069, 3.5781, 2.3764, 3.5781, 2.3764, 4.1379, + 1.0069, 4.1379], "elements": ["#/readResults/0/lines/7/words/0", "#/readResults/0/lines/7/words/1", + "#/readResults/0/lines/8/words/0", "#/readResults/0/lines/8/words/1", "#/readResults/0/lines/8/words/2", + "#/readResults/0/lines/9/words/0", "#/readResults/0/lines/9/words/1", "#/readResults/0/lines/9/words/2"]}, + "confidence": 1.0}], "tables": [], "clusterId": 0}, {"page": 2, "keyValuePairs": [{"key": {"text": "Vendor #:", "boundingBox": [6.1278, 1.0688, 7.1514, 1.0688, 7.1514, 1.24, 6.1278, 1.24], "elements": ["#/readResults/1/lines/0/words/0", "#/readResults/1/lines/0/words/1"]}, "value": {"text": "121", "boundingBox": @@ -13141,15 +13082,15 @@ interactions: ["#/readResults/1/lines/10/words/0"]}, "confidence": 0.53}], "tables": [], "clusterId": 1}], "documentResults": [], "errors": []}}' headers: - apim-request-id: c37c6d0f-1baf-4a94-9c53-5e65d6a2ee0a - content-length: '32950' + apim-request-id: 948d7edf-4aec-41ac-9e8c-5f57bb527bc8 + content-length: '27606' content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 19:51:55 GMT + date: Tue, 06 Oct 2020 02:31:50 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '20' + x-envoy-upstream-service-time: '26' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/208757b6-34ba-4e01-98dd-4624ae384e16/analyzeresults/d7cda754-0efb-4a12-b555-2c4047d11cf7 + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/61ed6945-fde5-43dc-81b2-de8fd5953154/analyzeresults/2705f443-80f5-4974-a018-6329fe3258a9 version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url.test_custom_form_labeled.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url.test_custom_form_labeled.yaml index 6e0e0d1b2675..a9554201282e 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url.test_custom_form_labeled.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url.test_custom_form_labeled.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": true}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true, "modelName": "labeled"}''' headers: Accept: - application/json @@ -10,7 +10,7 @@ interactions: Connection: - keep-alive Content-Length: - - '287' + - '311' Content-Type: - application/json User-Agent: @@ -22,19 +22,19 @@ interactions: string: '' headers: apim-request-id: - - a4112bda-d1a6-42f9-860a-5460cf4bac9f + - 61848459-fe5e-442e-8ade-6ed84541a890 content-length: - '0' date: - - Mon, 14 Sep 2020 20:13:20 GMT + - Tue, 06 Oct 2020 02:26:31 GMT location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c7c7774b-6fad-405c-8c3f-7b5e91bd58eb + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/16c671d0-6226-4306-a1b0-a0338ad4eb73 strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '65' + - '41' status: code: 201 message: Created @@ -50,33 +50,33 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c7c7774b-6fad-405c-8c3f-7b5e91bd58eb?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/16c671d0-6226-4306-a1b0-a0338ad4eb73?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "c7c7774b-6fad-405c-8c3f-7b5e91bd58eb", "attributes": - {"isComposed": false}, "status": "ready", "createdDateTime": "2020-09-14T20:13:21Z", - "lastUpdatedDateTime": "2020-09-14T20:13:24Z"}, "trainResult": {"averageModelAccuracy": - 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": - "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, - {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": - "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", - "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", - "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": - "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": - 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": - 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", - "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": - "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, - {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": - 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", - "accuracy": 1.0}], "errors": []}}' + string: '{"modelInfo": {"modelId": "16c671d0-6226-4306-a1b0-a0338ad4eb73", "modelName": + "labeled", "attributes": {"isComposed": false}, "status": "ready", "createdDateTime": + "2020-10-06T02:26:31Z", "lastUpdatedDateTime": "2020-10-06T02:26:34Z"}, "trainResult": + {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], "fields": + [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": "CompanyName", + "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": + "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": + "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, + {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": "Quantity", + "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, {"fieldName": + "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": + "Total", "accuracy": 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": + "Website", "accuracy": 1.0}], "errors": []}}' headers: apim-request-id: - - 8575b4be-e827-4dee-b9c5-45db4f0fa32c + - 2f0f8830-f5f4-4f10-8e66-945a127e58cf content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:13:26 GMT + - Tue, 06 Oct 2020 02:26:36 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -84,7 +84,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '17' + - '16' status: code: 200 message: OK @@ -104,25 +104,25 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: POST - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c7c7774b-6fad-405c-8c3f-7b5e91bd58eb/analyze?includeTextDetails=false + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/16c671d0-6226-4306-a1b0-a0338ad4eb73/analyze?includeTextDetails=false response: body: string: '' headers: apim-request-id: - - 0cf0204d-11a4-46a1-b8dd-e2f5efbe40e5 + - a8f45970-2798-4e22-81bd-74e4bc47cf6d content-length: - '0' date: - - Mon, 14 Sep 2020 20:13:26 GMT + - Tue, 06 Oct 2020 02:26:36 GMT operation-location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c7c7774b-6fad-405c-8c3f-7b5e91bd58eb/analyzeresults/cb251eb9-eba1-4343-9565-409c0da613b4 + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/16c671d0-6226-4306-a1b0-a0338ad4eb73/analyzeresults/f0730702-327f-446c-9962-ad3dcf3cad03 strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '74' + - '68' status: code: 202 message: Accepted @@ -138,46 +138,11 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c7c7774b-6fad-405c-8c3f-7b5e91bd58eb/analyzeresults/cb251eb9-eba1-4343-9565-409c0da613b4 + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/16c671d0-6226-4306-a1b0-a0338ad4eb73/analyzeresults/f0730702-327f-446c-9962-ad3dcf3cad03 response: body: - string: '{"status": "notStarted", "createdDateTime": "2020-09-14T20:13:26Z", - "lastUpdatedDateTime": "2020-09-14T20:13:30Z"}' - headers: - apim-request-id: - - c5e4b6e4-8343-4d32-b726-e90c851b7b53 - content-length: - - '109' - content-type: - - application/json; charset=utf-8 - date: - - Mon, 14 Sep 2020 20:13:31 GMT - strict-transport-security: - - max-age=31536000; includeSubDomains; preload - x-content-type-options: - - nosniff - x-envoy-upstream-service-time: - - '37' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/c7c7774b-6fad-405c-8c3f-7b5e91bd58eb/analyzeresults/cb251eb9-eba1-4343-9565-409c0da613b4 - response: - body: - string: '{"status": "succeeded", "createdDateTime": "2020-09-14T20:13:26Z", - "lastUpdatedDateTime": "2020-09-14T20:13:34Z", "analyzeResult": {"version": + string: '{"status": "succeeded", "createdDateTime": "2020-10-06T02:26:37Z", + "lastUpdatedDateTime": "2020-10-06T02:26:41Z", "analyzeResult": {"version": "2.1.0", "readResults": [{"page": 1, "angle": 0, "width": 1700, "height": 2200, "unit": "pixel", "selectionMarks": [{"boundingBox": [2, 2060, 195, 2060, 195, 2200, 2, 2200], "confidence": 0.881, "state": "unselected"}]}], "pageResults": @@ -223,61 +188,61 @@ interactions: {"rowIndex": 4, "columnIndex": 2, "text": "5.00", "boundingBox": [1072, 1216, 1309, 1216, 1309, 1260, 1072, 1260]}, {"rowIndex": 4, "columnIndex": 3, "text": "100.00", "boundingBox": [1309, 1216, 1544, 1216, 1544, 1260, 1309, 1260]}]}]}], - "documentResults": [{"docType": "custom:c7c7774b-6fad-405c-8c3f-7b5e91bd58eb", - "modelId": "c7c7774b-6fad-405c-8c3f-7b5e91bd58eb", "pageRange": [1, 1], "fields": - {"Subtotal": {"type": "string", "valueString": "$140.00", "text": "$140.00", - "page": 1, "boundingBox": [1426.0, 1572.0, 1531.0, 1572.0, 1531.0, 1599.0, - 1426.0, 1599.0], "confidence": 0.984}, "Email": {"type": "string", "valueString": - "accounts@herolimited.com", "text": "accounts@herolimited.com", "page": 1, - "boundingBox": [164.0, 479.0, 478.0, 479.0, 478.0, 503.0, 164.0, 503.0], "confidence": - 1.0}, "CompanyAddress": {"type": "string", "valueString": "938 NE Burner Road - Boulder City, CO 92848", "text": "938 NE Burner Road Boulder City, CO 92848", - "page": 1, "boundingBox": [273.0, 685.0, 565.0, 685.0, 565.0, 751.0, 273.0, - 751.0], "confidence": 1.0}, "Merchant": {"type": "string", "valueString": - "Hero Limited", "text": "Hero Limited", "page": 1, "boundingBox": [620.0, - 205.0, 1075.0, 205.0, 1075.0, 266.0, 620.0, 266.0], "confidence": 0.97}, "PurchaseOrderNumber": - {"type": "string", "valueString": "948284", "text": "948284", "page": 1, "boundingBox": - [1277.0, 461.0, 1376.0, 461.0, 1376.0, 489.0, 1277.0, 489.0], "confidence": - 0.94}, "Total": {"type": "string", "valueString": "$144.00", "text": "$144.00", - "page": 1, "boundingBox": [1427.0, 1669.0, 1529.0, 1669.0, 1529.0, 1698.0, - 1427.0, 1698.0], "confidence": 0.991}, "Tax": {"type": "string", "valueString": - "$4.00", "text": "$4.00", "page": 1, "boundingBox": [1458.0, 1615.0, 1529.0, - 1615.0, 1529.0, 1643.0, 1458.0, 1643.0], "confidence": 0.994}, "Quantity": - {"type": "number", "text": "20", "page": 1, "boundingBox": [861.0, 1094.0, - 892.0, 1094.0, 892.0, 1119.0, 861.0, 1119.0], "confidence": 0.962}, "DatedAs": + "documentResults": [{"docType": "custom:labeled", "modelId": "16c671d0-6226-4306-a1b0-a0338ad4eb73", + "pageRange": [1, 1], "fields": {"Tax": {"type": "string", "valueString": "$4.00", + "text": "$4.00", "page": 1, "boundingBox": [1458.0, 1615.0, 1529.0, 1615.0, + 1529.0, 1643.0, 1458.0, 1643.0], "confidence": 0.994}, "CompanyAddress": {"type": + "string", "valueString": "938 NE Burner Road Boulder City, CO 92848", "text": + "938 NE Burner Road Boulder City, CO 92848", "page": 1, "boundingBox": [273.0, + 685.0, 565.0, 685.0, 565.0, 751.0, 273.0, 751.0], "confidence": 1.0}, "DatedAs": {"type": "string", "valueString": "12/20/2020", "text": "12/20/2020", "page": 1, "boundingBox": [1165.0, 420.0, 1317.0, 420.0, 1317.0, 449.0, 1165.0, 449.0], - "confidence": 0.99}, "Signature": {"type": "string", "valueString": "Bernie - Sanders", "text": "Bernie Sanders", "page": 1, "boundingBox": [489.0, 1670.0, - 765.0, 1670.0, 765.0, 1708.0, 489.0, 1708.0], "confidence": 0.998}, "CompanyName": - {"type": "string", "valueString": "Higgly Wiggly Books", "text": "Higgly Wiggly - Books", "page": 1, "boundingBox": [375.0, 646.0, 629.0, 646.0, 629.0, 679.0, - 375.0, 679.0], "confidence": 0.95}, "CompanyPhoneNumber": {"type": "string", - "valueString": "938-294-2949", "text": "938-294-2949", "page": 1, "boundingBox": - [708.0, 722.0, 885.0, 722.0, 885.0, 749.0, 708.0, 749.0], "confidence": 1.0}, + "confidence": 0.99}, "Subtotal": {"type": "string", "valueString": "$140.00", + "text": "$140.00", "page": 1, "boundingBox": [1426.0, 1572.0, 1531.0, 1572.0, + 1531.0, 1599.0, 1426.0, 1599.0], "confidence": 0.984}, "Merchant": {"type": + "string", "valueString": "Hero Limited", "text": "Hero Limited", "page": 1, + "boundingBox": [620.0, 205.0, 1075.0, 205.0, 1075.0, 266.0, 620.0, 266.0], + "confidence": 0.97}, "Quantity": {"type": "number", "text": "20", "page": + 1, "boundingBox": [861.0, 1094.0, 892.0, 1094.0, 892.0, 1119.0, 861.0, 1119.0], + "confidence": 0.962}, "Email": {"type": "string", "valueString": "accounts@herolimited.com", + "text": "accounts@herolimited.com", "page": 1, "boundingBox": [164.0, 479.0, + 478.0, 479.0, 478.0, 503.0, 164.0, 503.0], "confidence": 1.0}, "PurchaseOrderNumber": + {"type": "string", "valueString": "948284", "text": "948284", "page": 1, "boundingBox": + [1277.0, 461.0, 1376.0, 461.0, 1376.0, 489.0, 1277.0, 489.0], "confidence": + 0.94}, "Signature": {"type": "string", "valueString": "Bernie Sanders", "text": + "Bernie Sanders", "page": 1, "boundingBox": [489.0, 1670.0, 765.0, 1670.0, + 765.0, 1708.0, 489.0, 1708.0], "confidence": 0.998}, "CompanyName": {"type": + "string", "valueString": "Higgly Wiggly Books", "text": "Higgly Wiggly Books", + "page": 1, "boundingBox": [375.0, 646.0, 629.0, 646.0, 629.0, 679.0, 375.0, + 679.0], "confidence": 0.95}, "Website": {"type": "string", "valueString": + "www.herolimited.com", "text": "www.herolimited.com", "page": 1, "boundingBox": + [273.0, 393.0, 531.0, 393.0, 531.0, 418.0, 273.0, 418.0], "confidence": 0.95}, + "CompanyPhoneNumber": {"type": "string", "valueString": "938-294-2949", "text": + "938-294-2949", "page": 1, "boundingBox": [708.0, 722.0, 885.0, 722.0, 885.0, + 749.0, 708.0, 749.0], "confidence": 1.0}, "PhoneNumber": {"type": "string", + "valueString": "555-348-6512", "text": "555-348-6512", "page": 1, "boundingBox": + [364.0, 351.0, 528.0, 351.0, 528.0, 378.0, 364.0, 378.0], "confidence": 0.89}, "VendorName": {"type": "string", "valueString": "Hillary Swank", "text": "Hillary Swank", "page": 1, "boundingBox": [349.0, 609.0, 521.0, 609.0, 521.0, 639.0, - 349.0, 639.0], "confidence": 0.93}, "PhoneNumber": {"type": "string", "valueString": - "555-348-6512", "text": "555-348-6512", "page": 1, "boundingBox": [364.0, - 351.0, 528.0, 351.0, 528.0, 378.0, 364.0, 378.0], "confidence": 0.89}, "Website": - {"type": "string", "valueString": "www.herolimited.com", "text": "www.herolimited.com", - "page": 1, "boundingBox": [273.0, 393.0, 531.0, 393.0, 531.0, 418.0, 273.0, - 418.0], "confidence": 0.95}}, "docTypeConfidence": 1.0}], "errors": []}}' + 349.0, 639.0], "confidence": 0.93}, "Total": {"type": "string", "valueString": + "$144.00", "text": "$144.00", "page": 1, "boundingBox": [1427.0, 1669.0, 1529.0, + 1669.0, 1529.0, 1698.0, 1427.0, 1698.0], "confidence": 0.991}}, "docTypeConfidence": + 1.0}], "errors": []}}' headers: apim-request-id: - - d25d289b-e4aa-47bb-bd71-275a08c07349 + - 0fbca3b7-942f-46f9-9798-d35aa81b4787 content-length: - - '6054' + - '6025' content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:13:37 GMT + - Tue, 06 Oct 2020 02:26:41 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '107' + - '21' status: code: 200 message: OK diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml index 8300da821b67..23277e092548 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": false}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false}''' headers: Accept: - application/json @@ -22,19 +22,19 @@ interactions: string: '' headers: apim-request-id: - - 1c8559fc-fe88-4b8c-a535-b2fd8a1ace06 + - 9bfd5e0d-6b17-4d4f-80ab-f82174df14b0 content-length: - '0' date: - - Mon, 14 Sep 2020 20:13:37 GMT + - Tue, 06 Oct 2020 02:28:51 GMT location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2 + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22 strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '42' + - '41' status: code: 201 message: Created @@ -50,19 +50,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "e501142e-58a0-486b-bd20-3ccf4423b7e2", "status": - "creating", "createdDateTime": "2020-09-14T20:13:37Z", "lastUpdatedDateTime": - "2020-09-14T20:13:37Z"}}' + string: '{"modelInfo": {"modelId": "2d45b391-b04c-4bc5-972b-06ad0b8feb22", "status": + "creating", "createdDateTime": "2020-10-06T02:28:51Z", "lastUpdatedDateTime": + "2020-10-06T02:28:51Z"}}' headers: apim-request-id: - - 4c0fb411-4956-42da-add5-9d20e81d4041 + - 31372362-6ec7-4b1e-9b61-97323e2f6b98 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:13:42 GMT + - Tue, 06 Oct 2020 02:28:55 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -70,7 +70,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '15' + - '14' status: code: 200 message: OK @@ -86,19 +86,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "e501142e-58a0-486b-bd20-3ccf4423b7e2", "status": - "creating", "createdDateTime": "2020-09-14T20:13:37Z", "lastUpdatedDateTime": - "2020-09-14T20:13:37Z"}}' + string: '{"modelInfo": {"modelId": "2d45b391-b04c-4bc5-972b-06ad0b8feb22", "status": + "creating", "createdDateTime": "2020-10-06T02:28:51Z", "lastUpdatedDateTime": + "2020-10-06T02:28:51Z"}}' headers: apim-request-id: - - 86f1d467-5fb8-494e-a5e4-6eaf9d800813 + - 41d43400-6513-46c7-a8c9-260abcc3c1b1 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:13:47 GMT + - Tue, 06 Oct 2020 02:29:01 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -106,7 +106,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '35' + - '17' status: code: 200 message: OK @@ -122,19 +122,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "e501142e-58a0-486b-bd20-3ccf4423b7e2", "status": - "creating", "createdDateTime": "2020-09-14T20:13:37Z", "lastUpdatedDateTime": - "2020-09-14T20:13:37Z"}}' + string: '{"modelInfo": {"modelId": "2d45b391-b04c-4bc5-972b-06ad0b8feb22", "status": + "creating", "createdDateTime": "2020-10-06T02:28:51Z", "lastUpdatedDateTime": + "2020-10-06T02:28:51Z"}}' headers: apim-request-id: - - 3fdd55e8-b2df-4ca1-aaf9-beb50ef10580 + - 5b38cae1-2a6a-4943-b32c-0e04e634bb13 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:13:53 GMT + - Tue, 06 Oct 2020 02:29:06 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -142,7 +142,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '112' + - '16' status: code: 200 message: OK @@ -158,19 +158,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "e501142e-58a0-486b-bd20-3ccf4423b7e2", "status": - "creating", "createdDateTime": "2020-09-14T20:13:37Z", "lastUpdatedDateTime": - "2020-09-14T20:13:37Z"}}' + string: '{"modelInfo": {"modelId": "2d45b391-b04c-4bc5-972b-06ad0b8feb22", "status": + "creating", "createdDateTime": "2020-10-06T02:28:51Z", "lastUpdatedDateTime": + "2020-10-06T02:28:51Z"}}' headers: apim-request-id: - - 3a4c6d8a-a023-4104-8129-2455385af296 + - 60199a2b-eea7-4aac-b181-0bc4b60da539 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:13:58 GMT + - Tue, 06 Oct 2020 02:29:11 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -194,15 +194,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "e501142e-58a0-486b-bd20-3ccf4423b7e2", "status": - "ready", "createdDateTime": "2020-09-14T20:13:37Z", "lastUpdatedDateTime": - "2020-09-14T20:13:58Z"}, "keys": {"clusters": {"0": ["Contoso Ltd. Conference - will be held on May 28-29, 2020 at the Elm Conference Center in", "Included", - "Maple City, Massachusetts. The conference has sold out of its 1,500 tickets, - with a 400 person", "Package", "Price", "Rates:", "Vendor #:", "Vendor Registration", + string: '{"modelInfo": {"modelId": "2d45b391-b04c-4bc5-972b-06ad0b8feb22", "status": + "ready", "createdDateTime": "2020-10-06T02:28:51Z", "lastUpdatedDateTime": + "2020-10-06T02:29:16Z"}, "keys": {"clusters": {"0": ["25% discount on program + guide", "50% discount on program guide", "Bronze Sponsor", "Contoso Ltd. Conference + will be held on May 28-29, 2020 at the Elm Conference Center in", "Full Booth", + "Full booth", "Full page ad in program guide", "Gold Sponsor", "Half Booth", + "Half page ad in program guide", "Included", "Logo on poster", "Maple City, + Massachusetts. The conference has sold out of its 1,500 tickets, with a 400 + person", "Package", "Post-keynote thank you", "Pre-keynote thank you", "Price", + "Rates:", "Silver Sponsor", "Vendor #:", "Vendor Registration", "advertisements", "below, and attach a check made out to:", "waitlist. Vendor applications are being accepted through Feb 28, 2020. Please fill in the form"], "1": ["Company Name:", "Contact:", "Preferred Package:", "Special Requests:", "Vendor #:", @@ -215,11 +219,11 @@ interactions: []}}' headers: apim-request-id: - - 5e8bf3a9-2f89-492b-b28f-aec7d2704bce + - 4adb6e98-179d-4243-ba71-69d36541e2e6 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:14:02 GMT + - Tue, 06 Oct 2020 02:29:17 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -227,12 +231,12 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '17' + - '14' status: code: 200 message: OK - request: - body: 'b''b\''{"source": "blob_sas_url"}\''''' + body: 'b''{"source": "blob_sas_url"}''' headers: Accept: - application/json @@ -247,25 +251,25 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: POST - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2/analyze?includeTextDetails=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22/analyze?includeTextDetails=true response: body: string: '' headers: apim-request-id: - - ba9ba590-3989-4d0e-b234-cac001491243 + - 05b3d60d-5902-42a1-9558-4261733d0d1b content-length: - '0' date: - - Mon, 14 Sep 2020 20:14:02 GMT + - Tue, 06 Oct 2020 02:29:17 GMT operation-location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2/analyzeresults/42c42a3b-621d-427f-be39-0076164e077b + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22/analyzeresults/2b281b76-117c-425a-8e49-0cc0f01f6a0a strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '47' + - '49' status: code: 202 message: Accepted @@ -281,26 +285,26 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2/analyzeresults/42c42a3b-621d-427f-be39-0076164e077b + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22/analyzeresults/2b281b76-117c-425a-8e49-0cc0f01f6a0a response: body: - string: '{"status": "running", "createdDateTime": "2020-09-14T20:14:03Z", "lastUpdatedDateTime": - "2020-09-14T20:14:06Z", "analyzeResult": null}' + string: '{"status": "running", "createdDateTime": "2020-10-06T02:29:17Z", "lastUpdatedDateTime": + "2020-10-06T02:29:18Z", "analyzeResult": null}' headers: apim-request-id: - - bba36821-cc96-4c22-81f9-a213f0f7f347 + - b532e067-a310-405c-aff9-9c4840b6bb1d content-length: - '134' content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:14:08 GMT + - Tue, 06 Oct 2020 02:29:21 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '13' + - '20' status: code: 200 message: OK @@ -316,26 +320,26 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2/analyzeresults/42c42a3b-621d-427f-be39-0076164e077b + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22/analyzeresults/2b281b76-117c-425a-8e49-0cc0f01f6a0a response: body: - string: '{"status": "running", "createdDateTime": "2020-09-14T20:14:03Z", "lastUpdatedDateTime": - "2020-09-14T20:14:06Z", "analyzeResult": null}' + string: '{"status": "running", "createdDateTime": "2020-10-06T02:29:17Z", "lastUpdatedDateTime": + "2020-10-06T02:29:18Z", "analyzeResult": null}' headers: apim-request-id: - - 5211cde8-8ecb-4b18-9ee4-29f94d6e4153 + - 695ab5ae-17a6-4a02-bda0-89c694de7070 content-length: - '134' content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:14:13 GMT + - Tue, 06 Oct 2020 02:29:28 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '13' + - '21' status: code: 200 message: OK @@ -351,11 +355,11 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e501142e-58a0-486b-bd20-3ccf4423b7e2/analyzeresults/42c42a3b-621d-427f-be39-0076164e077b + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2d45b391-b04c-4bc5-972b-06ad0b8feb22/analyzeresults/2b281b76-117c-425a-8e49-0cc0f01f6a0a response: body: - string: '{"status": "succeeded", "createdDateTime": "2020-09-14T20:14:03Z", - "lastUpdatedDateTime": "2020-09-14T20:14:17Z", "analyzeResult": {"version": + string: '{"status": "succeeded", "createdDateTime": "2020-10-06T02:29:17Z", + "lastUpdatedDateTime": "2020-10-06T02:29:31Z", "analyzeResult": {"version": "2.1.0", "readResults": [{"page": 1, "angle": 0, "width": 8.5, "height": 11.0, "unit": "inch", "lines": [{"text": "Vendor #:", "boundingBox": [6.1278, 1.0688, 7.1514, 1.0688, 7.1514, 1.24, 6.1278, 1.24], "words": [{"text": "Vendor", @@ -650,98 +654,35 @@ interactions: "#/readResults/0/lines/0/words/1"]}, "value": {"text": "121", "boundingBox": [7.1514, 1.076, 7.4833, 1.076, 7.4833, 1.2392, 7.1514, 1.2392], "elements": ["#/readResults/0/lines/1/words/0"]}, "confidence": 1.0}, {"key": {"text": - "__Address__1", "boundingBox": null, "elements": null}, "value": {"text": - "Contoso Ltd. 2345 Dogwood Lane Birch, Kansas 98123", "boundingBox": [1.0069, - 3.5781, 2.3764, 3.5781, 2.3764, 4.1379, 1.0069, 4.1379], "elements": ["#/readResults/0/lines/7/words/0", - "#/readResults/0/lines/7/words/1", "#/readResults/0/lines/8/words/0", "#/readResults/0/lines/8/words/1", - "#/readResults/0/lines/8/words/2", "#/readResults/0/lines/9/words/0", "#/readResults/0/lines/9/words/1", - "#/readResults/0/lines/9/words/2"]}, "confidence": 1.0}], "tables": [{"rows": - 6, "columns": 3, "cells": [{"text": "Package", "rowIndex": 0, "columnIndex": - 0, "boundingBox": [1.0931, 4.6986, 1.6236, 4.6986, 1.6236, 4.8427, 1.0931, - 4.8427], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/11/words/0"], - "isHeader": true, "isFooter": false}, {"text": "Included", "rowIndex": 0, - "columnIndex": 1, "boundingBox": [2.7125, 4.6986, 3.2708, 4.6986, 3.2708, - 4.8146, 2.7125, 4.8146], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/12/words/0"], "isHeader": true, "isFooter": - false}, {"text": "Price", "rowIndex": 0, "columnIndex": 2, "boundingBox": - [5.8375, 4.7038, 6.1514, 4.7038, 6.1514, 4.8146, 5.8375, 4.8146], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/13/words/0"], - "isHeader": true, "isFooter": false}, {"text": "Gold Sponsor", "rowIndex": - 1, "columnIndex": 0, "boundingBox": [1.0861, 4.9125, 1.9833, 4.9125, 1.9833, - 5.042, 1.0861, 5.042], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": - ["#/readResults/0/lines/14/words/0", "#/readResults/0/lines/14/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Pre-keynote thank - you Logo on poster Full page ad in program guide", "rowIndex": 1, "columnIndex": - 1, "boundingBox": [3.2139, 4.917, 5.2014, 4.917, 5.2014, 5.6885, 3.2139, 5.6885], - "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/15/words/0", - "#/readResults/0/lines/15/words/1", "#/readResults/0/lines/17/words/0", "#/readResults/0/lines/17/words/1", - "#/readResults/0/lines/17/words/2", "#/readResults/0/lines/18/words/0", "#/readResults/0/lines/18/words/1", - "#/readResults/0/lines/18/words/2", "#/readResults/0/lines/19/words/0", "#/readResults/0/lines/19/words/1", - "#/readResults/0/lines/19/words/2", "#/readResults/0/lines/19/words/3", "#/readResults/0/lines/19/words/4", - "#/readResults/0/lines/19/words/5"], "isHeader": false, "isFooter": false}, - {"text": "$1,500", "rowIndex": 1, "columnIndex": 2, "boundingBox": [5.8319, - 4.8976, 6.2833, 4.8976, 6.2833, 5.0469, 5.8319, 5.0469], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/16/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Silver Sponsor", "rowIndex": - 2, "columnIndex": 0, "boundingBox": [1.0833, 5.982, 2.0333, 5.982, 2.0333, - 6.1098, 1.0833, 6.1098], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/20/words/0", "#/readResults/0/lines/20/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Post-keynote thank - you Logo on poster Half page ad in program guide", "rowIndex": 2, "columnIndex": - 1, "boundingBox": [3.2139, 5.9868, 5.2306, 5.9868, 5.2306, 6.7569, 3.2139, - 6.7569], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/21/words/0", - "#/readResults/0/lines/21/words/1", "#/readResults/0/lines/23/words/0", "#/readResults/0/lines/23/words/1", - "#/readResults/0/lines/23/words/2", "#/readResults/0/lines/24/words/0", "#/readResults/0/lines/24/words/1", - "#/readResults/0/lines/24/words/2", "#/readResults/0/lines/25/words/0", "#/readResults/0/lines/25/words/1", - "#/readResults/0/lines/25/words/2", "#/readResults/0/lines/25/words/3", "#/readResults/0/lines/25/words/4", - "#/readResults/0/lines/25/words/5"], "isHeader": false, "isFooter": false}, - {"text": "$1,200", "rowIndex": 2, "columnIndex": 2, "boundingBox": [5.8319, - 5.9677, 6.2833, 5.9677, 6.2833, 6.1167, 5.8319, 6.1167], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/22/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Bronze Sponsor", "rowIndex": - 3, "columnIndex": 0, "boundingBox": [1.0931, 6.8407, 2.1361, 6.8407, 2.1361, - 6.9647, 1.0931, 6.9647], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/26/words/0", "#/readResults/0/lines/26/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Logo on poster - 50% discount on program guide advertisements", "rowIndex": 3, "columnIndex": - 1, "boundingBox": [3.2069, 6.842, 5.3417, 6.842, 5.3417, 7.5865, 3.2069, 7.5865], - "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/27/words/0", - "#/readResults/0/lines/27/words/1", "#/readResults/0/lines/29/words/0", "#/readResults/0/lines/29/words/1", - "#/readResults/0/lines/29/words/2", "#/readResults/0/lines/30/words/0", "#/readResults/0/lines/30/words/1", - "#/readResults/0/lines/30/words/2", "#/readResults/0/lines/30/words/3", "#/readResults/0/lines/30/words/4", - "#/readResults/0/lines/31/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$1,000", "rowIndex": 3, "columnIndex": 2, "boundingBox": [5.8319, - 6.8226, 6.2833, 6.8226, 6.2833, 6.9719, 5.8319, 6.9719], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/28/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Full Booth", "rowIndex": - 4, "columnIndex": 0, "boundingBox": [1.0931, 7.6819, 1.7542, 7.6819, 1.7542, - 7.7979, 1.0931, 7.7979], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/32/words/0", "#/readResults/0/lines/32/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth 50% discount on - program guide advertisements", "rowIndex": 4, "columnIndex": 1, "boundingBox": - [3.2069, 7.6903, 5.3417, 7.6903, 5.3417, 8.2212, 3.2069, 8.2212], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/33/words/0", - "#/readResults/0/lines/33/words/1", "#/readResults/0/lines/35/words/0", "#/readResults/0/lines/35/words/1", - "#/readResults/0/lines/35/words/2", "#/readResults/0/lines/35/words/3", "#/readResults/0/lines/35/words/4", - "#/readResults/0/lines/36/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$600", "rowIndex": 4, "columnIndex": 2, "boundingBox": [5.8319, - 7.6712, 6.1583, 7.6712, 6.1583, 7.8167, 5.8319, 7.8167], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/34/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Half Booth", "rowIndex": - 5, "columnIndex": 0, "boundingBox": [1.0931, 8.3167, 1.7861, 8.3167, 1.7861, - 8.433, 1.0931, 8.433], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": - ["#/readResults/0/lines/37/words/0", "#/readResults/0/lines/37/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth 25% discount on - program guide advertisements", "rowIndex": 5, "columnIndex": 1, "boundingBox": - [3.2069, 8.3253, 5.3417, 8.3253, 5.3417, 8.8563, 3.2069, 8.8563], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/38/words/0", - "#/readResults/0/lines/38/words/1", "#/readResults/0/lines/40/words/0", "#/readResults/0/lines/40/words/1", - "#/readResults/0/lines/40/words/2", "#/readResults/0/lines/40/words/3", "#/readResults/0/lines/40/words/4", - "#/readResults/0/lines/41/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$350", "rowIndex": 5, "columnIndex": 2, "boundingBox": [5.8319, - 8.3062, 6.1583, 8.3062, 6.1583, 8.4514, 5.8319, 8.4514], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/39/words/0"], - "isHeader": false, "isFooter": false}]}], "clusterId": 0}, {"page": 2, "keyValuePairs": + "Full Booth", "boundingBox": [3.2139, 4.917, 3.8722, 4.917, 3.8722, 5.033, + 3.2139, 5.033], "elements": ["#/readResults/0/lines/15/words/0", "#/readResults/0/lines/15/words/1"]}, + "value": {"text": "$1,500", "boundingBox": [5.8319, 4.8976, 6.2833, 4.8976, + 6.2833, 5.0469, 5.8319, 5.0469], "elements": ["#/readResults/0/lines/16/words/0"]}, + "confidence": 0.36}, {"key": {"text": "Full Booth", "boundingBox": [3.2139, + 5.9868, 3.8722, 5.9868, 3.8722, 6.1031, 3.2139, 6.1031], "elements": ["#/readResults/0/lines/21/words/0", + "#/readResults/0/lines/21/words/1"]}, "value": {"text": "$1,200", "boundingBox": + [5.8319, 5.9677, 6.2833, 5.9677, 6.2833, 6.1167, 5.8319, 6.1167], "elements": + ["#/readResults/0/lines/22/words/0"]}, "confidence": 0.36}, {"key": {"text": + "Full Booth", "boundingBox": [3.2139, 6.842, 3.8722, 6.842, 3.8722, 6.958, + 3.2139, 6.958], "elements": ["#/readResults/0/lines/27/words/0", "#/readResults/0/lines/27/words/1"]}, + "value": {"text": "$1,000", "boundingBox": [5.8319, 6.8226, 6.2833, 6.8226, + 6.2833, 6.9719, 5.8319, 6.9719], "elements": ["#/readResults/0/lines/28/words/0"]}, + "confidence": 0.36}, {"key": {"text": "Full Booth", "boundingBox": [3.2139, + 7.6903, 3.8722, 7.6903, 3.8722, 7.8063, 3.2139, 7.8063], "elements": ["#/readResults/0/lines/33/words/0", + "#/readResults/0/lines/33/words/1"]}, "value": {"text": "$600", "boundingBox": + [5.8319, 7.6712, 6.1583, 7.6712, 6.1583, 7.8167, 5.8319, 7.8167], "elements": + ["#/readResults/0/lines/34/words/0"]}, "confidence": 0.36}, {"key": {"text": + "Full Booth", "boundingBox": [3.2139, 8.3253, 3.8722, 8.3253, 3.8722, 8.4413, + 3.2139, 8.4413], "elements": ["#/readResults/0/lines/38/words/0", "#/readResults/0/lines/38/words/1"]}, + "value": {"text": "$350", "boundingBox": [5.8319, 8.3062, 6.1583, 8.3062, + 6.1583, 8.4514, 5.8319, 8.4514], "elements": ["#/readResults/0/lines/39/words/0"]}, + "confidence": 0.36}, {"key": {"text": "__Address__1", "boundingBox": null, + "elements": null}, "value": {"text": "Contoso Ltd. 2345 Dogwood Lane Birch, + Kansas 98123", "boundingBox": [1.0069, 3.5781, 2.3764, 3.5781, 2.3764, 4.1379, + 1.0069, 4.1379], "elements": ["#/readResults/0/lines/7/words/0", "#/readResults/0/lines/7/words/1", + "#/readResults/0/lines/8/words/0", "#/readResults/0/lines/8/words/1", "#/readResults/0/lines/8/words/2", + "#/readResults/0/lines/9/words/0", "#/readResults/0/lines/9/words/1", "#/readResults/0/lines/9/words/2"]}, + "confidence": 1.0}], "tables": [], "clusterId": 0}, {"page": 2, "keyValuePairs": [{"key": {"text": "Vendor #:", "boundingBox": [6.1278, 1.0688, 7.1514, 1.0688, 7.1514, 1.24, 6.1278, 1.24], "elements": ["#/readResults/1/lines/0/words/0", "#/readResults/1/lines/0/words/1"]}, "value": {"text": "121", "boundingBox": @@ -769,19 +710,19 @@ interactions: "clusterId": 1}], "documentResults": [], "errors": []}}' headers: apim-request-id: - - 7c068639-a782-47ab-8570-d341fabb4ecf + - 80adc637-ab89-4c42-8cb9-94c941f4bf74 content-length: - - '32950' + - '27606' content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 20:14:18 GMT + - Tue, 06 Oct 2020 02:29:33 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '20' + - '28' status: code: 200 message: OK diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url_async.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url_async.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml index 41cde1867de2..7f03a6f8cc32 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url_async.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url_async.test_custom_form_multipage_vendor_set_unlabeled_transform.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": false}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false}''' headers: Accept: - application/json @@ -17,13 +17,13 @@ interactions: body: string: '' headers: - apim-request-id: 92d6c71f-801c-48f1-abd1-4a2b141f2dec + apim-request-id: ac8e5f3f-7eff-4b3f-b40e-1035bdfe8095 content-length: '0' - date: Mon, 14 Sep 2020 20:21:33 GMT - location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4 + date: Tue, 06 Oct 2020 02:38:16 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '43' + x-envoy-upstream-service-time: '39' status: code: 201 message: Created @@ -34,87 +34,139 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "012fe63e-d924-4b66-a7bf-af6c471b6ad4", "status": - "creating", "createdDateTime": "2020-09-14T20:21:33Z", "lastUpdatedDateTime": - "2020-09-14T20:21:33Z"}}' + string: '{"modelInfo": {"modelId": "2747a551-978f-4ce2-a204-0dbaadb2628b", "status": + "creating", "createdDateTime": "2020-10-06T02:38:16Z", "lastUpdatedDateTime": + "2020-10-06T02:38:16Z"}}' headers: - apim-request-id: 1e903b0f-d95b-4321-b86d-494af868ed7b + apim-request-id: c0b6b677-0259-448b-aec6-e3a00412a5c5 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:21:38 GMT + date: Tue, 06 Oct 2020 02:38:21 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '13' + x-envoy-upstream-service-time: '14' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "012fe63e-d924-4b66-a7bf-af6c471b6ad4", "status": - "creating", "createdDateTime": "2020-09-14T20:21:33Z", "lastUpdatedDateTime": - "2020-09-14T20:21:33Z"}}' + string: '{"modelInfo": {"modelId": "2747a551-978f-4ce2-a204-0dbaadb2628b", "status": + "creating", "createdDateTime": "2020-10-06T02:38:16Z", "lastUpdatedDateTime": + "2020-10-06T02:38:16Z"}}' headers: - apim-request-id: e06436db-a49d-4562-b9bf-e22ea38f7579 + apim-request-id: ccb58c95-d6bb-4706-89ff-9170296d7c73 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:21:44 GMT + date: Tue, 06 Oct 2020 02:38:26 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '14' + x-envoy-upstream-service-time: '12' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "2747a551-978f-4ce2-a204-0dbaadb2628b", "status": + "creating", "createdDateTime": "2020-10-06T02:38:16Z", "lastUpdatedDateTime": + "2020-10-06T02:38:16Z"}}' + headers: + apim-request-id: 4cc72291-d7e9-44d5-8170-e1d33e8a0924 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 02:38:32 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '20' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "012fe63e-d924-4b66-a7bf-af6c471b6ad4", "status": - "creating", "createdDateTime": "2020-09-14T20:21:33Z", "lastUpdatedDateTime": - "2020-09-14T20:21:33Z"}}' + string: '{"modelInfo": {"modelId": "2747a551-978f-4ce2-a204-0dbaadb2628b", "status": + "creating", "createdDateTime": "2020-10-06T02:38:16Z", "lastUpdatedDateTime": + "2020-10-06T02:38:16Z"}}' headers: - apim-request-id: 3322a28b-3015-4de8-b77f-bceec431807d + apim-request-id: ef0dd982-5317-4c5b-b307-c31cab8cb3b7 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:21:48 GMT + date: Tue, 06 Oct 2020 02:38:37 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '13' + x-envoy-upstream-service-time: '15' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "012fe63e-d924-4b66-a7bf-af6c471b6ad4", "status": - "ready", "createdDateTime": "2020-09-14T20:21:33Z", "lastUpdatedDateTime": - "2020-09-14T20:21:53Z"}, "keys": {"clusters": {"0": ["Contoso Ltd. Conference - will be held on May 28-29, 2020 at the Elm Conference Center in", "Included", - "Maple City, Massachusetts. The conference has sold out of its 1,500 tickets, - with a 400 person", "Package", "Price", "Rates:", "Vendor #:", "Vendor Registration", + string: '{"modelInfo": {"modelId": "2747a551-978f-4ce2-a204-0dbaadb2628b", "status": + "creating", "createdDateTime": "2020-10-06T02:38:16Z", "lastUpdatedDateTime": + "2020-10-06T02:38:16Z"}}' + headers: + apim-request-id: 7aa94823-902e-4a84-b030-1a43ecf90338 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 02:38:42 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "2747a551-978f-4ce2-a204-0dbaadb2628b", "status": + "ready", "createdDateTime": "2020-10-06T02:38:16Z", "lastUpdatedDateTime": + "2020-10-06T02:38:42Z"}, "keys": {"clusters": {"0": ["25% discount on program + guide", "50% discount on program guide", "Bronze Sponsor", "Contoso Ltd. Conference + will be held on May 28-29, 2020 at the Elm Conference Center in", "Full Booth", + "Full booth", "Full page ad in program guide", "Gold Sponsor", "Half Booth", + "Half page ad in program guide", "Included", "Logo on poster", "Maple City, + Massachusetts. The conference has sold out of its 1,500 tickets, with a 400 + person", "Package", "Post-keynote thank you", "Pre-keynote thank you", "Price", + "Rates:", "Silver Sponsor", "Vendor #:", "Vendor Registration", "advertisements", "below, and attach a check made out to:", "waitlist. Vendor applications are being accepted through Feb 28, 2020. Please fill in the form"], "1": ["Company Name:", "Contact:", "Preferred Package:", "Special Requests:", "Vendor #:", @@ -126,19 +178,19 @@ interactions: "multi5.pdf", "pages": 2, "errors": [], "status": "succeeded"}], "errors": []}}' headers: - apim-request-id: ddf11b77-8e66-4d06-bd51-0bfdf52c708f + apim-request-id: 6fc512d4-27e1-4cb9-91db-d4df909f1c59 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:21:54 GMT + date: Tue, 06 Oct 2020 02:38:46 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '15' + x-envoy-upstream-service-time: '16' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b?includeKeys=true - request: - body: 'b''b\''{"source": "blob_sas_url"}\''''' + body: 'b''{"source": "blob_sas_url"}''' headers: Accept: - application/json @@ -149,79 +201,79 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: POST - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4/analyze?includeTextDetails=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b/analyze?includeTextDetails=true response: body: string: '' headers: - apim-request-id: 85f80475-7421-4de4-ad92-531da998a375 + apim-request-id: 8b1f482a-85a9-430f-b453-dad268b284a8 content-length: '0' - date: Mon, 14 Sep 2020 20:21:54 GMT - operation-location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4/analyzeresults/d26d8a95-bd93-4108-9310-6e1649dd4dda + date: Tue, 06 Oct 2020 02:38:46 GMT + operation-location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b/analyzeresults/a1f44677-602c-4cd0-b3b9-fa3893c66d80 strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '43' + x-envoy-upstream-service-time: '54' status: code: 202 message: Accepted - url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4/analyze?includeTextDetails=true + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b/analyze?includeTextDetails=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4/analyzeresults/d26d8a95-bd93-4108-9310-6e1649dd4dda + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b/analyzeresults/a1f44677-602c-4cd0-b3b9-fa3893c66d80 response: body: - string: '{"status": "running", "createdDateTime": "2020-09-14T20:21:54Z", "lastUpdatedDateTime": - "2020-09-14T20:21:55Z", "analyzeResult": null}' + string: '{"status": "running", "createdDateTime": "2020-10-06T02:38:47Z", "lastUpdatedDateTime": + "2020-10-06T02:38:49Z", "analyzeResult": null}' headers: - apim-request-id: b835b17c-0843-40bb-96b7-a1d95bb508ab + apim-request-id: c681a25e-95c7-456b-b575-5166e56d6e33 content-length: '134' content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:21:59 GMT + date: Tue, 06 Oct 2020 02:38:52 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '14' + x-envoy-upstream-service-time: '155' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4/analyzeresults/d26d8a95-bd93-4108-9310-6e1649dd4dda + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b/analyzeresults/a1f44677-602c-4cd0-b3b9-fa3893c66d80 - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4/analyzeresults/d26d8a95-bd93-4108-9310-6e1649dd4dda + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b/analyzeresults/a1f44677-602c-4cd0-b3b9-fa3893c66d80 response: body: - string: '{"status": "running", "createdDateTime": "2020-09-14T20:21:54Z", "lastUpdatedDateTime": - "2020-09-14T20:21:55Z", "analyzeResult": null}' + string: '{"status": "running", "createdDateTime": "2020-10-06T02:38:47Z", "lastUpdatedDateTime": + "2020-10-06T02:38:49Z", "analyzeResult": null}' headers: - apim-request-id: 1f837b46-5a1b-403d-a961-bea45deb7911 + apim-request-id: f00e8376-967a-49cd-aacd-397b646e1af7 content-length: '134' content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:22:04 GMT + date: Tue, 06 Oct 2020 02:38:57 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '17' + x-envoy-upstream-service-time: '47' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4/analyzeresults/d26d8a95-bd93-4108-9310-6e1649dd4dda + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b/analyzeresults/a1f44677-602c-4cd0-b3b9-fa3893c66d80 - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4/analyzeresults/d26d8a95-bd93-4108-9310-6e1649dd4dda + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b/analyzeresults/a1f44677-602c-4cd0-b3b9-fa3893c66d80 response: body: - string: '{"status": "succeeded", "createdDateTime": "2020-09-14T20:21:54Z", - "lastUpdatedDateTime": "2020-09-14T20:22:07Z", "analyzeResult": {"version": + string: '{"status": "succeeded", "createdDateTime": "2020-10-06T02:38:47Z", + "lastUpdatedDateTime": "2020-10-06T02:39:02Z", "analyzeResult": {"version": "2.1.0", "readResults": [{"page": 1, "angle": 0, "width": 8.5, "height": 11.0, "unit": "inch", "lines": [{"text": "Vendor #:", "boundingBox": [6.1278, 1.0688, 7.1514, 1.0688, 7.1514, 1.24, 6.1278, 1.24], "words": [{"text": "Vendor", @@ -516,98 +568,35 @@ interactions: "#/readResults/0/lines/0/words/1"]}, "value": {"text": "121", "boundingBox": [7.1514, 1.076, 7.4833, 1.076, 7.4833, 1.2392, 7.1514, 1.2392], "elements": ["#/readResults/0/lines/1/words/0"]}, "confidence": 1.0}, {"key": {"text": - "__Address__1", "boundingBox": null, "elements": null}, "value": {"text": - "Contoso Ltd. 2345 Dogwood Lane Birch, Kansas 98123", "boundingBox": [1.0069, - 3.5781, 2.3764, 3.5781, 2.3764, 4.1379, 1.0069, 4.1379], "elements": ["#/readResults/0/lines/7/words/0", - "#/readResults/0/lines/7/words/1", "#/readResults/0/lines/8/words/0", "#/readResults/0/lines/8/words/1", - "#/readResults/0/lines/8/words/2", "#/readResults/0/lines/9/words/0", "#/readResults/0/lines/9/words/1", - "#/readResults/0/lines/9/words/2"]}, "confidence": 1.0}], "tables": [{"rows": - 6, "columns": 3, "cells": [{"text": "Package", "rowIndex": 0, "columnIndex": - 0, "boundingBox": [1.0931, 4.6986, 1.6236, 4.6986, 1.6236, 4.8427, 1.0931, - 4.8427], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/11/words/0"], - "isHeader": true, "isFooter": false}, {"text": "Included", "rowIndex": 0, - "columnIndex": 1, "boundingBox": [2.7125, 4.6986, 3.2708, 4.6986, 3.2708, - 4.8146, 2.7125, 4.8146], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/12/words/0"], "isHeader": true, "isFooter": - false}, {"text": "Price", "rowIndex": 0, "columnIndex": 2, "boundingBox": - [5.8375, 4.7038, 6.1514, 4.7038, 6.1514, 4.8146, 5.8375, 4.8146], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/13/words/0"], - "isHeader": true, "isFooter": false}, {"text": "Gold Sponsor", "rowIndex": - 1, "columnIndex": 0, "boundingBox": [1.0861, 4.9125, 1.9833, 4.9125, 1.9833, - 5.042, 1.0861, 5.042], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": - ["#/readResults/0/lines/14/words/0", "#/readResults/0/lines/14/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Pre-keynote thank - you Logo on poster Full page ad in program guide", "rowIndex": 1, "columnIndex": - 1, "boundingBox": [3.2139, 4.917, 5.2014, 4.917, 5.2014, 5.6885, 3.2139, 5.6885], - "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/15/words/0", - "#/readResults/0/lines/15/words/1", "#/readResults/0/lines/17/words/0", "#/readResults/0/lines/17/words/1", - "#/readResults/0/lines/17/words/2", "#/readResults/0/lines/18/words/0", "#/readResults/0/lines/18/words/1", - "#/readResults/0/lines/18/words/2", "#/readResults/0/lines/19/words/0", "#/readResults/0/lines/19/words/1", - "#/readResults/0/lines/19/words/2", "#/readResults/0/lines/19/words/3", "#/readResults/0/lines/19/words/4", - "#/readResults/0/lines/19/words/5"], "isHeader": false, "isFooter": false}, - {"text": "$1,500", "rowIndex": 1, "columnIndex": 2, "boundingBox": [5.8319, - 4.8976, 6.2833, 4.8976, 6.2833, 5.0469, 5.8319, 5.0469], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/16/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Silver Sponsor", "rowIndex": - 2, "columnIndex": 0, "boundingBox": [1.0833, 5.982, 2.0333, 5.982, 2.0333, - 6.1098, 1.0833, 6.1098], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/20/words/0", "#/readResults/0/lines/20/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Post-keynote thank - you Logo on poster Half page ad in program guide", "rowIndex": 2, "columnIndex": - 1, "boundingBox": [3.2139, 5.9868, 5.2306, 5.9868, 5.2306, 6.7569, 3.2139, - 6.7569], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/21/words/0", - "#/readResults/0/lines/21/words/1", "#/readResults/0/lines/23/words/0", "#/readResults/0/lines/23/words/1", - "#/readResults/0/lines/23/words/2", "#/readResults/0/lines/24/words/0", "#/readResults/0/lines/24/words/1", - "#/readResults/0/lines/24/words/2", "#/readResults/0/lines/25/words/0", "#/readResults/0/lines/25/words/1", - "#/readResults/0/lines/25/words/2", "#/readResults/0/lines/25/words/3", "#/readResults/0/lines/25/words/4", - "#/readResults/0/lines/25/words/5"], "isHeader": false, "isFooter": false}, - {"text": "$1,200", "rowIndex": 2, "columnIndex": 2, "boundingBox": [5.8319, - 5.9677, 6.2833, 5.9677, 6.2833, 6.1167, 5.8319, 6.1167], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/22/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Bronze Sponsor", "rowIndex": - 3, "columnIndex": 0, "boundingBox": [1.0931, 6.8407, 2.1361, 6.8407, 2.1361, - 6.9647, 1.0931, 6.9647], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/26/words/0", "#/readResults/0/lines/26/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth Logo on poster - 50% discount on program guide advertisements", "rowIndex": 3, "columnIndex": - 1, "boundingBox": [3.2069, 6.842, 5.3417, 6.842, 5.3417, 7.5865, 3.2069, 7.5865], - "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/27/words/0", - "#/readResults/0/lines/27/words/1", "#/readResults/0/lines/29/words/0", "#/readResults/0/lines/29/words/1", - "#/readResults/0/lines/29/words/2", "#/readResults/0/lines/30/words/0", "#/readResults/0/lines/30/words/1", - "#/readResults/0/lines/30/words/2", "#/readResults/0/lines/30/words/3", "#/readResults/0/lines/30/words/4", - "#/readResults/0/lines/31/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$1,000", "rowIndex": 3, "columnIndex": 2, "boundingBox": [5.8319, - 6.8226, 6.2833, 6.8226, 6.2833, 6.9719, 5.8319, 6.9719], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/28/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Full Booth", "rowIndex": - 4, "columnIndex": 0, "boundingBox": [1.0931, 7.6819, 1.7542, 7.6819, 1.7542, - 7.7979, 1.0931, 7.7979], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, - "elements": ["#/readResults/0/lines/32/words/0", "#/readResults/0/lines/32/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth 50% discount on - program guide advertisements", "rowIndex": 4, "columnIndex": 1, "boundingBox": - [3.2069, 7.6903, 5.3417, 7.6903, 5.3417, 8.2212, 3.2069, 8.2212], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/33/words/0", - "#/readResults/0/lines/33/words/1", "#/readResults/0/lines/35/words/0", "#/readResults/0/lines/35/words/1", - "#/readResults/0/lines/35/words/2", "#/readResults/0/lines/35/words/3", "#/readResults/0/lines/35/words/4", - "#/readResults/0/lines/36/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$600", "rowIndex": 4, "columnIndex": 2, "boundingBox": [5.8319, - 7.6712, 6.1583, 7.6712, 6.1583, 7.8167, 5.8319, 7.8167], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/34/words/0"], - "isHeader": false, "isFooter": false}, {"text": "Half Booth", "rowIndex": - 5, "columnIndex": 0, "boundingBox": [1.0931, 8.3167, 1.7861, 8.3167, 1.7861, - 8.433, 1.0931, 8.433], "confidence": 1.0, "rowSpan": 1, "columnSpan": 1, "elements": - ["#/readResults/0/lines/37/words/0", "#/readResults/0/lines/37/words/1"], - "isHeader": false, "isFooter": false}, {"text": "Full booth 25% discount on - program guide advertisements", "rowIndex": 5, "columnIndex": 1, "boundingBox": - [3.2069, 8.3253, 5.3417, 8.3253, 5.3417, 8.8563, 3.2069, 8.8563], "confidence": - 1.0, "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/38/words/0", - "#/readResults/0/lines/38/words/1", "#/readResults/0/lines/40/words/0", "#/readResults/0/lines/40/words/1", - "#/readResults/0/lines/40/words/2", "#/readResults/0/lines/40/words/3", "#/readResults/0/lines/40/words/4", - "#/readResults/0/lines/41/words/0"], "isHeader": false, "isFooter": false}, - {"text": "$350", "rowIndex": 5, "columnIndex": 2, "boundingBox": [5.8319, - 8.3062, 6.1583, 8.3062, 6.1583, 8.4514, 5.8319, 8.4514], "confidence": 1.0, - "rowSpan": 1, "columnSpan": 1, "elements": ["#/readResults/0/lines/39/words/0"], - "isHeader": false, "isFooter": false}]}], "clusterId": 0}, {"page": 2, "keyValuePairs": + "Full Booth", "boundingBox": [3.2139, 4.917, 3.8722, 4.917, 3.8722, 5.033, + 3.2139, 5.033], "elements": ["#/readResults/0/lines/15/words/0", "#/readResults/0/lines/15/words/1"]}, + "value": {"text": "$1,500", "boundingBox": [5.8319, 4.8976, 6.2833, 4.8976, + 6.2833, 5.0469, 5.8319, 5.0469], "elements": ["#/readResults/0/lines/16/words/0"]}, + "confidence": 0.36}, {"key": {"text": "Full Booth", "boundingBox": [3.2139, + 5.9868, 3.8722, 5.9868, 3.8722, 6.1031, 3.2139, 6.1031], "elements": ["#/readResults/0/lines/21/words/0", + "#/readResults/0/lines/21/words/1"]}, "value": {"text": "$1,200", "boundingBox": + [5.8319, 5.9677, 6.2833, 5.9677, 6.2833, 6.1167, 5.8319, 6.1167], "elements": + ["#/readResults/0/lines/22/words/0"]}, "confidence": 0.36}, {"key": {"text": + "Full Booth", "boundingBox": [3.2139, 6.842, 3.8722, 6.842, 3.8722, 6.958, + 3.2139, 6.958], "elements": ["#/readResults/0/lines/27/words/0", "#/readResults/0/lines/27/words/1"]}, + "value": {"text": "$1,000", "boundingBox": [5.8319, 6.8226, 6.2833, 6.8226, + 6.2833, 6.9719, 5.8319, 6.9719], "elements": ["#/readResults/0/lines/28/words/0"]}, + "confidence": 0.36}, {"key": {"text": "Full Booth", "boundingBox": [3.2139, + 7.6903, 3.8722, 7.6903, 3.8722, 7.8063, 3.2139, 7.8063], "elements": ["#/readResults/0/lines/33/words/0", + "#/readResults/0/lines/33/words/1"]}, "value": {"text": "$600", "boundingBox": + [5.8319, 7.6712, 6.1583, 7.6712, 6.1583, 7.8167, 5.8319, 7.8167], "elements": + ["#/readResults/0/lines/34/words/0"]}, "confidence": 0.36}, {"key": {"text": + "Full Booth", "boundingBox": [3.2139, 8.3253, 3.8722, 8.3253, 3.8722, 8.4413, + 3.2139, 8.4413], "elements": ["#/readResults/0/lines/38/words/0", "#/readResults/0/lines/38/words/1"]}, + "value": {"text": "$350", "boundingBox": [5.8319, 8.3062, 6.1583, 8.3062, + 6.1583, 8.4514, 5.8319, 8.4514], "elements": ["#/readResults/0/lines/39/words/0"]}, + "confidence": 0.36}, {"key": {"text": "__Address__1", "boundingBox": null, + "elements": null}, "value": {"text": "Contoso Ltd. 2345 Dogwood Lane Birch, + Kansas 98123", "boundingBox": [1.0069, 3.5781, 2.3764, 3.5781, 2.3764, 4.1379, + 1.0069, 4.1379], "elements": ["#/readResults/0/lines/7/words/0", "#/readResults/0/lines/7/words/1", + "#/readResults/0/lines/8/words/0", "#/readResults/0/lines/8/words/1", "#/readResults/0/lines/8/words/2", + "#/readResults/0/lines/9/words/0", "#/readResults/0/lines/9/words/1", "#/readResults/0/lines/9/words/2"]}, + "confidence": 1.0}], "tables": [], "clusterId": 0}, {"page": 2, "keyValuePairs": [{"key": {"text": "Vendor #:", "boundingBox": [6.1278, 1.0688, 7.1514, 1.0688, 7.1514, 1.24, 6.1278, 1.24], "elements": ["#/readResults/1/lines/0/words/0", "#/readResults/1/lines/0/words/1"]}, "value": {"text": "121", "boundingBox": @@ -634,15 +623,15 @@ interactions: ["#/readResults/1/lines/10/words/0"]}, "confidence": 0.53}], "tables": [], "clusterId": 1}], "documentResults": [], "errors": []}}' headers: - apim-request-id: cb4557ba-a8ab-4b2e-a042-064b6c570c36 - content-length: '32950' + apim-request-id: 16f55f33-d2b2-4a48-97f1-30460c93e413 + content-length: '27606' content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:22:09 GMT + date: Tue, 06 Oct 2020 02:39:02 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '23' + x-envoy-upstream-service-time: '114' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/012fe63e-d924-4b66-a7bf-af6c471b6ad4/analyzeresults/d26d8a95-bd93-4108-9310-6e1649dd4dda + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/2747a551-978f-4ce2-a204-0dbaadb2628b/analyzeresults/a1f44677-602c-4cd0-b3b9-fa3893c66d80 version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url_async.test_form_labeled.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url_async.test_form_labeled.yaml index 7c161eaeaf0a..123485e1c530 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url_async.test_form_labeled.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_custom_forms_from_url_async.test_form_labeled.yaml @@ -1,12 +1,12 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": true}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true, "modelName": "labeled"}''' headers: Accept: - application/json Content-Length: - - '287' + - '311' Content-Type: - application/json User-Agent: @@ -17,13 +17,13 @@ interactions: body: string: '' headers: - apim-request-id: 65469484-240d-493f-abe8-4984ae2e4c49 + apim-request-id: d16a0e86-3bfc-4a3e-81f0-c4c492455653 content-length: '0' - date: Mon, 14 Sep 2020 20:22:23 GMT - location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af + date: Tue, 06 Oct 2020 02:36:25 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ffe147da-671a-44f1-ad35-fec1b85cd927 strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '39' + x-envoy-upstream-service-time: '43' status: code: 201 message: Created @@ -34,30 +34,30 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ffe147da-671a-44f1-ad35-fec1b85cd927?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "f0aaa053-5bf3-482b-aa99-d8e0fe7f09af", "attributes": - {"isComposed": false}, "status": "ready", "createdDateTime": "2020-09-14T20:22:23Z", - "lastUpdatedDateTime": "2020-09-14T20:22:26Z"}, "trainResult": {"averageModelAccuracy": - 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": - "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, - {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": - "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", - "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", - "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": - "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": - 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": - 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", - "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": - "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, - {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": - 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", - "accuracy": 1.0}], "errors": []}}' + string: '{"modelInfo": {"modelId": "ffe147da-671a-44f1-ad35-fec1b85cd927", "modelName": + "labeled", "attributes": {"isComposed": false}, "status": "ready", "createdDateTime": + "2020-10-06T02:36:26Z", "lastUpdatedDateTime": "2020-10-06T02:36:28Z"}, "trainResult": + {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], "fields": + [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": "CompanyName", + "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": + "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": + "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, + {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": "Quantity", + "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, {"fieldName": + "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": + "Total", "accuracy": 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": + "Website", "accuracy": 1.0}], "errors": []}}' headers: - apim-request-id: 033497bc-eb74-4ba2-8883-e2c7cb59c61b + apim-request-id: f410fee6-6d5c-422d-995c-9a20b2b8f872 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:22:28 GMT + date: Tue, 06 Oct 2020 02:36:31 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff @@ -65,7 +65,7 @@ interactions: status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ffe147da-671a-44f1-ad35-fec1b85cd927?includeKeys=true - request: body: 'b''{"source": "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/master/sdk/formrecognizer/azure-ai-formrecognizer/tests/sample_forms/forms/Form_1.jpg"}''' headers: @@ -78,56 +78,33 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: POST - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af/analyze?includeTextDetails=false + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ffe147da-671a-44f1-ad35-fec1b85cd927/analyze?includeTextDetails=false response: body: string: '' headers: - apim-request-id: c91fb430-3138-45b0-8d79-c850279c3c36 + apim-request-id: 5f759df0-0500-4d1d-b4a2-931099675fb2 content-length: '0' - date: Mon, 14 Sep 2020 20:22:28 GMT - operation-location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af/analyzeresults/c85793b0-80ec-4a73-9652-20d781d16b96 + date: Tue, 06 Oct 2020 02:36:31 GMT + operation-location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ffe147da-671a-44f1-ad35-fec1b85cd927/analyzeresults/3783283b-3536-48f9-a361-5380ce998f73 strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '72' + x-envoy-upstream-service-time: '48' status: code: 202 message: Accepted - url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af/analyze?includeTextDetails=false + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/ffe147da-671a-44f1-ad35-fec1b85cd927/analyze?includeTextDetails=false - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af/analyzeresults/c85793b0-80ec-4a73-9652-20d781d16b96 + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ffe147da-671a-44f1-ad35-fec1b85cd927/analyzeresults/3783283b-3536-48f9-a361-5380ce998f73 response: body: - string: '{"status": "notStarted", "createdDateTime": "2020-09-14T20:22:28Z", - "lastUpdatedDateTime": "2020-09-14T20:22:33Z"}' - headers: - apim-request-id: dcfa475e-dd39-426f-b11e-9358fa105ba1 - content-length: '109' - content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:22:33 GMT - strict-transport-security: max-age=31536000; includeSubDomains; preload - x-content-type-options: nosniff - x-envoy-upstream-service-time: '19' - status: - code: 200 - message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af/analyzeresults/c85793b0-80ec-4a73-9652-20d781d16b96 -- request: - body: null - headers: - User-Agent: - - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af/analyzeresults/c85793b0-80ec-4a73-9652-20d781d16b96 - response: - body: - string: '{"status": "succeeded", "createdDateTime": "2020-09-14T20:22:28Z", - "lastUpdatedDateTime": "2020-09-14T20:22:36Z", "analyzeResult": {"version": + string: '{"status": "succeeded", "createdDateTime": "2020-10-06T02:36:31Z", + "lastUpdatedDateTime": "2020-10-06T02:36:35Z", "analyzeResult": {"version": "2.1.0", "readResults": [{"page": 1, "angle": 0, "width": 1700, "height": 2200, "unit": "pixel", "selectionMarks": [{"boundingBox": [2, 2060, 195, 2060, 195, 2200, 2, 2200], "confidence": 0.881, "state": "unselected"}]}], "pageResults": @@ -173,57 +150,56 @@ interactions: {"rowIndex": 4, "columnIndex": 2, "text": "5.00", "boundingBox": [1072, 1216, 1309, 1216, 1309, 1260, 1072, 1260]}, {"rowIndex": 4, "columnIndex": 3, "text": "100.00", "boundingBox": [1309, 1216, 1544, 1216, 1544, 1260, 1309, 1260]}]}]}], - "documentResults": [{"docType": "custom:f0aaa053-5bf3-482b-aa99-d8e0fe7f09af", - "modelId": "f0aaa053-5bf3-482b-aa99-d8e0fe7f09af", "pageRange": [1, 1], "fields": - {"Tax": {"type": "string", "valueString": "$4.00", "text": "$4.00", "page": - 1, "boundingBox": [1458.0, 1615.0, 1529.0, 1615.0, 1529.0, 1643.0, 1458.0, - 1643.0], "confidence": 0.994}, "CompanyAddress": {"type": "string", "valueString": - "938 NE Burner Road Boulder City, CO 92848", "text": "938 NE Burner Road Boulder - City, CO 92848", "page": 1, "boundingBox": [273.0, 685.0, 565.0, 685.0, 565.0, - 751.0, 273.0, 751.0], "confidence": 1.0}, "CompanyPhoneNumber": {"type": "string", - "valueString": "938-294-2949", "text": "938-294-2949", "page": 1, "boundingBox": - [708.0, 722.0, 885.0, 722.0, 885.0, 749.0, 708.0, 749.0], "confidence": 1.0}, - "PhoneNumber": {"type": "string", "valueString": "555-348-6512", "text": "555-348-6512", - "page": 1, "boundingBox": [364.0, 351.0, 528.0, 351.0, 528.0, 378.0, 364.0, - 378.0], "confidence": 0.89}, "Signature": {"type": "string", "valueString": - "Bernie Sanders", "text": "Bernie Sanders", "page": 1, "boundingBox": [489.0, - 1670.0, 765.0, 1670.0, 765.0, 1708.0, 489.0, 1708.0], "confidence": 0.998}, - "Email": {"type": "string", "valueString": "accounts@herolimited.com", "text": - "accounts@herolimited.com", "page": 1, "boundingBox": [164.0, 479.0, 478.0, - 479.0, 478.0, 503.0, 164.0, 503.0], "confidence": 1.0}, "Subtotal": {"type": - "string", "valueString": "$140.00", "text": "$140.00", "page": 1, "boundingBox": - [1426.0, 1572.0, 1531.0, 1572.0, 1531.0, 1599.0, 1426.0, 1599.0], "confidence": - 0.984}, "PurchaseOrderNumber": {"type": "string", "valueString": "948284", - "text": "948284", "page": 1, "boundingBox": [1277.0, 461.0, 1376.0, 461.0, - 1376.0, 489.0, 1277.0, 489.0], "confidence": 0.94}, "Website": {"type": "string", - "valueString": "www.herolimited.com", "text": "www.herolimited.com", "page": - 1, "boundingBox": [273.0, 393.0, 531.0, 393.0, 531.0, 418.0, 273.0, 418.0], - "confidence": 0.95}, "Quantity": {"type": "number", "text": "20", "page": + "documentResults": [{"docType": "custom:labeled", "modelId": "ffe147da-671a-44f1-ad35-fec1b85cd927", + "pageRange": [1, 1], "fields": {"Email": {"type": "string", "valueString": + "accounts@herolimited.com", "text": "accounts@herolimited.com", "page": 1, + "boundingBox": [164.0, 479.0, 478.0, 479.0, 478.0, 503.0, 164.0, 503.0], "confidence": + 1.0}, "PhoneNumber": {"type": "string", "valueString": "555-348-6512", "text": + "555-348-6512", "page": 1, "boundingBox": [364.0, 351.0, 528.0, 351.0, 528.0, + 378.0, 364.0, 378.0], "confidence": 0.89}, "CompanyPhoneNumber": {"type": + "string", "valueString": "938-294-2949", "text": "938-294-2949", "page": 1, + "boundingBox": [708.0, 722.0, 885.0, 722.0, 885.0, 749.0, 708.0, 749.0], "confidence": + 1.0}, "Merchant": {"type": "string", "valueString": "Hero Limited", "text": + "Hero Limited", "page": 1, "boundingBox": [620.0, 205.0, 1075.0, 205.0, 1075.0, + 266.0, 620.0, 266.0], "confidence": 0.97}, "CompanyAddress": {"type": "string", + "valueString": "938 NE Burner Road Boulder City, CO 92848", "text": "938 NE + Burner Road Boulder City, CO 92848", "page": 1, "boundingBox": [273.0, 685.0, + 565.0, 685.0, 565.0, 751.0, 273.0, 751.0], "confidence": 1.0}, "PurchaseOrderNumber": + {"type": "string", "valueString": "948284", "text": "948284", "page": 1, "boundingBox": + [1277.0, 461.0, 1376.0, 461.0, 1376.0, 489.0, 1277.0, 489.0], "confidence": + 0.94}, "Total": {"type": "string", "valueString": "$144.00", "text": "$144.00", + "page": 1, "boundingBox": [1427.0, 1669.0, 1529.0, 1669.0, 1529.0, 1698.0, + 1427.0, 1698.0], "confidence": 0.991}, "VendorName": {"type": "string", "valueString": + "Hillary Swank", "text": "Hillary Swank", "page": 1, "boundingBox": [349.0, + 609.0, 521.0, 609.0, 521.0, 639.0, 349.0, 639.0], "confidence": 0.93}, "Subtotal": + {"type": "string", "valueString": "$140.00", "text": "$140.00", "page": 1, + "boundingBox": [1426.0, 1572.0, 1531.0, 1572.0, 1531.0, 1599.0, 1426.0, 1599.0], + "confidence": 0.984}, "CompanyName": {"type": "string", "valueString": "Higgly + Wiggly Books", "text": "Higgly Wiggly Books", "page": 1, "boundingBox": [375.0, + 646.0, 629.0, 646.0, 629.0, 679.0, 375.0, 679.0], "confidence": 0.95}, "DatedAs": + {"type": "string", "valueString": "12/20/2020", "text": "12/20/2020", "page": + 1, "boundingBox": [1165.0, 420.0, 1317.0, 420.0, 1317.0, 449.0, 1165.0, 449.0], + "confidence": 0.99}, "Quantity": {"type": "number", "text": "20", "page": 1, "boundingBox": [861.0, 1094.0, 892.0, 1094.0, 892.0, 1119.0, 861.0, 1119.0], - "confidence": 0.962}, "Total": {"type": "string", "valueString": "$144.00", - "text": "$144.00", "page": 1, "boundingBox": [1427.0, 1669.0, 1529.0, 1669.0, - 1529.0, 1698.0, 1427.0, 1698.0], "confidence": 0.991}, "VendorName": {"type": - "string", "valueString": "Hillary Swank", "text": "Hillary Swank", "page": - 1, "boundingBox": [349.0, 609.0, 521.0, 609.0, 521.0, 639.0, 349.0, 639.0], - "confidence": 0.93}, "Merchant": {"type": "string", "valueString": "Hero Limited", - "text": "Hero Limited", "page": 1, "boundingBox": [620.0, 205.0, 1075.0, 205.0, - 1075.0, 266.0, 620.0, 266.0], "confidence": 0.97}, "DatedAs": {"type": "string", - "valueString": "12/20/2020", "text": "12/20/2020", "page": 1, "boundingBox": - [1165.0, 420.0, 1317.0, 420.0, 1317.0, 449.0, 1165.0, 449.0], "confidence": - 0.99}, "CompanyName": {"type": "string", "valueString": "Higgly Wiggly Books", - "text": "Higgly Wiggly Books", "page": 1, "boundingBox": [375.0, 646.0, 629.0, - 646.0, 629.0, 679.0, 375.0, 679.0], "confidence": 0.95}}, "docTypeConfidence": - 1.0}], "errors": []}}' + "confidence": 0.962}, "Website": {"type": "string", "valueString": "www.herolimited.com", + "text": "www.herolimited.com", "page": 1, "boundingBox": [273.0, 393.0, 531.0, + 393.0, 531.0, 418.0, 273.0, 418.0], "confidence": 0.95}, "Signature": {"type": + "string", "valueString": "Bernie Sanders", "text": "Bernie Sanders", "page": + 1, "boundingBox": [489.0, 1670.0, 765.0, 1670.0, 765.0, 1708.0, 489.0, 1708.0], + "confidence": 0.998}, "Tax": {"type": "string", "valueString": "$4.00", "text": + "$4.00", "page": 1, "boundingBox": [1458.0, 1615.0, 1529.0, 1615.0, 1529.0, + 1643.0, 1458.0, 1643.0], "confidence": 0.994}}, "docTypeConfidence": 1.0}], + "errors": []}}' headers: - apim-request-id: d77eea12-34d5-44d1-b3d1-8e3d591adca1 - content-length: '6054' + apim-request-id: a00ba433-1991-4c37-b90c-10beb81ddc79 + content-length: '6025' content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 20:22:38 GMT + date: Tue, 06 Oct 2020 02:36:36 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '15' + x-envoy-upstream-service-time: '21' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f0aaa053-5bf3-482b-aa99-d8e0fe7f09af/analyzeresults/c85793b0-80ec-4a73-9652-20d781d16b96 + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ffe147da-671a-44f1-ad35-fec1b85cd927/analyzeresults/3783283b-3536-48f9-a361-5380ce998f73 version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training.test_training.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training.test_training.yaml index 903ef4e46a5d..5610a11c73b7 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training.test_training.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training.test_training.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": false}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false, "modelName": "my unlabeled model"}''' headers: Accept: - application/json @@ -10,7 +10,7 @@ interactions: Connection: - keep-alive Content-Length: - - '288' + - '323' Content-Type: - application/json User-Agent: @@ -22,19 +22,19 @@ interactions: string: '' headers: apim-request-id: - - f88396b9-d7db-4873-8503-3f7d6b95557d + - 0446d1f6-1ab1-4946-bfa0-11042ede56f9 content-length: - '0' date: - - Mon, 14 Sep 2020 21:00:43 GMT + - Tue, 06 Oct 2020 01:32:53 GMT location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/aaa2228e-e8a5-44ed-90ae-1876b2d2e075 + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1e259f58-903a-4859-a712-465a93ac691e strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '138' + - '71' status: code: 201 message: Created @@ -50,19 +50,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/aaa2228e-e8a5-44ed-90ae-1876b2d2e075?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1e259f58-903a-4859-a712-465a93ac691e?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "aaa2228e-e8a5-44ed-90ae-1876b2d2e075", "status": - "creating", "createdDateTime": "2020-09-14T21:00:43Z", "lastUpdatedDateTime": - "2020-09-14T21:00:43Z"}}' + string: '{"modelInfo": {"modelId": "1e259f58-903a-4859-a712-465a93ac691e", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:32:53Z", + "lastUpdatedDateTime": "2020-10-06T01:32:53Z"}}' headers: apim-request-id: - - fe753ce4-13d8-4c01-af1f-1cd445245b26 + - f45739bb-d03f-4ccc-bf31-846b0e4405c6 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 21:00:48 GMT + - Tue, 06 Oct 2020 01:32:58 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -70,7 +70,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '43' + - '18' status: code: 200 message: OK @@ -86,19 +86,19 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/aaa2228e-e8a5-44ed-90ae-1876b2d2e075?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1e259f58-903a-4859-a712-465a93ac691e?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "aaa2228e-e8a5-44ed-90ae-1876b2d2e075", "status": - "creating", "createdDateTime": "2020-09-14T21:00:43Z", "lastUpdatedDateTime": - "2020-09-14T21:00:43Z"}}' + string: '{"modelInfo": {"modelId": "1e259f58-903a-4859-a712-465a93ac691e", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:32:53Z", + "lastUpdatedDateTime": "2020-10-06T01:32:53Z"}}' headers: apim-request-id: - - e8d9b9fc-f0e6-416f-a98a-6716814c32df + - 57de64f4-3ae4-423d-9d9c-79c06072e97e content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 21:00:54 GMT + - Tue, 06 Oct 2020 01:33:03 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -106,7 +106,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '44' + - '18' status: code: 200 message: OK @@ -122,12 +122,12 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/aaa2228e-e8a5-44ed-90ae-1876b2d2e075?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1e259f58-903a-4859-a712-465a93ac691e?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "aaa2228e-e8a5-44ed-90ae-1876b2d2e075", "status": - "ready", "createdDateTime": "2020-09-14T21:00:43Z", "lastUpdatedDateTime": - "2020-09-14T21:00:55Z"}, "keys": {"clusters": {"0": ["Additional Notes:", + string: '{"modelInfo": {"modelId": "1e259f58-903a-4859-a712-465a93ac691e", "status": + "ready", "createdDateTime": "2020-10-06T01:32:53Z", "lastUpdatedDateTime": + "2020-10-06T01:33:07Z"}, "keys": {"clusters": {"0": ["Additional Notes:", "Address:", "Company Name:", "Company Phone:", "Dated As:", "Details", "Email:", "Ft Lauderdale, FL Phone:", "Hero Limited", "Name:", "Phone:", "Purchase Order", "Purchase Order #:", "Quantity", "SUBTOTAL", "Seattle, WA 93849 Phone:", "Shipped @@ -140,11 +140,11 @@ interactions: "pages": 1, "errors": [], "status": "succeeded"}], "errors": []}}' headers: apim-request-id: - - a3145c0c-437d-44bd-918d-2a70b7b79609 + - 9713d70c-752e-4e4a-bb73-a690f08ee288 content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 21:00:58 GMT + - Tue, 06 Oct 2020 01:33:09 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -152,7 +152,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '63' + - '18' status: code: 200 message: OK diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training.test_training_with_labels.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training.test_training_with_labels.yaml index 119ccd282058..cb5dd354c35a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training.test_training_with_labels.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training.test_training_with_labels.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": true}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true, "modelName": "my labeled model"}''' headers: Accept: - application/json @@ -10,7 +10,7 @@ interactions: Connection: - keep-alive Content-Length: - - '287' + - '320' Content-Type: - application/json User-Agent: @@ -22,19 +22,19 @@ interactions: string: '' headers: apim-request-id: - - 5eea82c3-0cb9-47c4-a20b-281b88512730 + - 892962bc-10db-445a-9fb4-6734f294b32f content-length: - '0' date: - - Mon, 14 Sep 2020 21:01:35 GMT + - Tue, 06 Oct 2020 01:30:42 GMT location: - - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/b9e43625-c8a3-4d22-a847-b93f59030d10 + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e29693e2-4565-4270-842a-b5ddfb12dcd3 strict-transport-security: - max-age=31536000; includeSubDomains; preload x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '44' + - '132' status: code: 201 message: Created @@ -50,33 +50,33 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/b9e43625-c8a3-4d22-a847-b93f59030d10?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/e29693e2-4565-4270-842a-b5ddfb12dcd3?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "b9e43625-c8a3-4d22-a847-b93f59030d10", "attributes": - {"isComposed": false}, "status": "ready", "createdDateTime": "2020-09-14T21:01:36Z", - "lastUpdatedDateTime": "2020-09-14T21:01:37Z"}, "trainResult": {"averageModelAccuracy": - 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": - "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, - {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": - "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", - "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", - "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": - "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": - 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": - 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", - "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": - "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, - {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": - 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", - "accuracy": 1.0}], "errors": []}}' + string: '{"modelInfo": {"modelId": "e29693e2-4565-4270-842a-b5ddfb12dcd3", "modelName": + "my labeled model", "attributes": {"isComposed": false}, "status": "ready", + "createdDateTime": "2020-10-06T01:30:42Z", "lastUpdatedDateTime": "2020-10-06T01:30:45Z"}, + "trainResult": {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": + "Form_1.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], + "fields": [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": + "CompanyName", "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": + 1.0}, {"fieldName": "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": + 0.8}, {"fieldName": "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", + "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": + "Quantity", "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, + {"fieldName": "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": + 1.0}, {"fieldName": "Total", "accuracy": 1.0}, {"fieldName": "VendorName", + "accuracy": 1.0}, {"fieldName": "Website", "accuracy": 1.0}], "errors": []}}' headers: apim-request-id: - - 27d1d514-2d6a-4365-9fdc-f08166e8e306 + - 4a4305c2-3df6-411d-9407-beb07495592e content-type: - application/json; charset=utf-8 date: - - Mon, 14 Sep 2020 21:01:40 GMT + - Tue, 06 Oct 2020 01:30:47 GMT strict-transport-security: - max-age=31536000; includeSubDomains; preload transfer-encoding: @@ -84,7 +84,7 @@ interactions: x-content-type-options: - nosniff x-envoy-upstream-service-time: - - '14' + - '19' status: code: 200 message: OK diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training_async.test_training.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training_async.test_training.yaml index 843961281015..1bfdc5ade943 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training_async.test_training.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training_async.test_training.yaml @@ -1,12 +1,12 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": false}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": false, "modelName": "my unlabeled model"}''' headers: Accept: - application/json Content-Length: - - '288' + - '323' Content-Type: - application/json User-Agent: @@ -17,13 +17,13 @@ interactions: body: string: '' headers: - apim-request-id: 44cde0e2-3687-41e2-ba00-92064b66b65a + apim-request-id: 85f70794-2845-4b63-a52e-ed9c8bec0f1f content-length: '0' - date: Mon, 14 Sep 2020 22:20:37 GMT - location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/44d04738-f4c7-4b92-bd1f-442d80b10db4 + date: Tue, 06 Oct 2020 01:39:53 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931 strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '40' + x-envoy-upstream-service-time: '90' status: code: 201 message: Created @@ -34,16 +34,16 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/44d04738-f4c7-4b92-bd1f-442d80b10db4?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "44d04738-f4c7-4b92-bd1f-442d80b10db4", "status": - "creating", "createdDateTime": "2020-09-14T22:20:38Z", "lastUpdatedDateTime": - "2020-09-14T22:20:38Z"}}' + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' headers: - apim-request-id: 7fc94683-209a-4c86-9168-f2b0176ec49d + apim-request-id: 103f9bae-94c5-471b-87ac-dd44a9b9d1a6 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 22:20:42 GMT + date: Tue, 06 Oct 2020 01:39:57 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff @@ -51,23 +51,263 @@ interactions: status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/44d04738-f4c7-4b92-bd1f-442d80b10db4?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/44d04738-f4c7-4b92-bd1f-442d80b10db4?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "44d04738-f4c7-4b92-bd1f-442d80b10db4", "status": - "creating", "createdDateTime": "2020-09-14T22:20:38Z", "lastUpdatedDateTime": - "2020-09-14T22:20:38Z"}}' + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' headers: - apim-request-id: b2c7af20-b650-4528-b0e2-4c727437e2f9 + apim-request-id: 62b16eed-d459-471e-ac87-adc21b79e623 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 22:20:47 GMT + date: Tue, 06 Oct 2020 01:40:02 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '19' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 9febc854-43ce-461e-9c3c-b4ad2731e278 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:08 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 5105b5fe-5d83-4769-ba63-37c452ce845e + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:12 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '18' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: ca3485e2-afbd-4be9-a3dc-19ddf0ded008 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:18 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 65a29315-02ca-4fae-bff1-38d1478c3108 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:23 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: c93c51f0-dd5c-4bbd-ad11-29fc95574acf + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:28 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '33' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 98a304cd-4d05-439a-8f48-ce0e2f9e6584 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:33 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '16' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 5089234b-7971-4e0f-bc5b-9f8af4908212 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:39 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '18' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 6755f7a5-35f1-4437-9a3d-ad77d01d3cbf + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:43 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '12' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: c1735bc4-9060-4686-afc3-44dd54a2cd39 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:49 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '18' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 7abde1a0-878a-44dc-b67d-3aaf923c7e62 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:40:54 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff @@ -75,19 +315,451 @@ interactions: status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/44d04738-f4c7-4b92-bd1f-442d80b10db4?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 7afbd29d-bdc1-48d1-b215-72c5a7d80a52 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:00 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '16' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 1e026ac1-2c1a-4274-9314-6da30403eff7 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:05 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '18' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: b42bc8fd-eaf4-4ea3-a55b-6bd479069ba8 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:09 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 1cf25851-d360-4baf-b704-7989c5e4b0fc + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:15 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '16' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 0201a9e7-a10d-412a-ac34-001e71763ffa + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:20 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '16' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: dbb3e473-c412-481e-a6da-eea6eaa85efa + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:25 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '13' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 42c06863-585d-48d9-b1d0-2a3bbad7f11f + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:30 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '15' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 4968fb12-251e-4ad7-b608-3c0838066dae + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:36 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '13' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 9919ccab-c047-449b-a515-276ba3e5e2d0 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:40 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '14' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 949734b0-3f39-4013-98bb-be6777f664b6 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:46 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '12' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 7a279500-0db8-4c18-b7db-e169aa9276a2 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:51 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '13' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: fecd5a3b-7ffe-491d-8e19-6acdfeb6d316 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:41:56 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '15' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: b418a2b1-1255-46ae-bc8c-bc0893e47ffb + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:42:01 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '16' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true - request: body: null headers: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/44d04738-f4c7-4b92-bd1f-442d80b10db4?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "44d04738-f4c7-4b92-bd1f-442d80b10db4", "status": - "ready", "createdDateTime": "2020-09-14T22:20:38Z", "lastUpdatedDateTime": - "2020-09-14T22:20:50Z"}, "keys": {"clusters": {"0": ["Additional Notes:", + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 05ff188e-6fb4-4942-8323-4b492a30e30a + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:42:06 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '18' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 59282bf8-cd1a-49c5-be62-fa5da98679a5 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:42:11 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '16' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: 66bc6c25-4fb0-464b-8212-ea4693ab72d7 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:42:16 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '23' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: b554c15c-7bc2-40df-a393-3bbc83f75f27 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:42:21 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '19' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "modelName": + "my unlabeled model", "status": "creating", "createdDateTime": "2020-10-06T01:39:53Z", + "lastUpdatedDateTime": "2020-10-06T01:39:53Z"}}' + headers: + apim-request-id: b6732e5a-b937-41ae-b50c-145441535955 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 01:42:27 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '14' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f8efd27f-00ce-41ed-9a8e-985c25e0e931", "status": + "ready", "createdDateTime": "2020-10-06T01:39:53Z", "lastUpdatedDateTime": + "2020-10-06T01:42:30Z"}, "keys": {"clusters": {"0": ["Additional Notes:", "Address:", "Company Name:", "Company Phone:", "Dated As:", "Details", "Email:", "Ft Lauderdale, FL Phone:", "Hero Limited", "Name:", "Phone:", "Purchase Order", "Purchase Order #:", "Quantity", "SUBTOTAL", "Seattle, WA 93849 Phone:", "Shipped @@ -99,15 +771,15 @@ interactions: "pages": 1, "errors": [], "status": "succeeded"}, {"documentName": "Form_5.jpg", "pages": 1, "errors": [], "status": "succeeded"}], "errors": []}}' headers: - apim-request-id: d0523247-c921-40d0-ba2f-e311bc70b9d3 + apim-request-id: 15bff9ef-8f42-4c3c-87a5-8240878cdcee content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 22:20:53 GMT + date: Tue, 06 Oct 2020 01:42:31 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '16' + x-envoy-upstream-service-time: '17' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/44d04738-f4c7-4b92-bd1f-442d80b10db4?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f8efd27f-00ce-41ed-9a8e-985c25e0e931?includeKeys=true version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training_async.test_training_with_labels.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training_async.test_training_with_labels.yaml index b34a2b9f991b..df674335ed05 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training_async.test_training_with_labels.yaml +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_training_async.test_training_with_labels.yaml @@ -1,12 +1,12 @@ interactions: - request: - body: 'b''b\''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": - false}, "useLabelFile": true}\''''' + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true, "modelName": "my labeled model"}''' headers: Accept: - application/json Content-Length: - - '287' + - '320' Content-Type: - application/json User-Agent: @@ -17,13 +17,13 @@ interactions: body: string: '' headers: - apim-request-id: 0b8fd395-093e-4775-aa4d-9288a2b5e0b7 + apim-request-id: 997a7515-ea7c-4de4-a1d1-dc6db0a89ab6 content-length: '0' - date: Mon, 14 Sep 2020 22:21:59 GMT - location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ed77ab68-b223-40de-9a62-78c3b3489d54 + date: Tue, 06 Oct 2020 01:44:08 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/8fe658bb-bcd5-4fa1-a862-1215eb90f1c8 strict-transport-security: max-age=31536000; includeSubDomains; preload x-content-type-options: nosniff - x-envoy-upstream-service-time: '43' + x-envoy-upstream-service-time: '53' status: code: 201 message: Created @@ -34,36 +34,36 @@ interactions: User-Agent: - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ed77ab68-b223-40de-9a62-78c3b3489d54?includeKeys=true + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/8fe658bb-bcd5-4fa1-a862-1215eb90f1c8?includeKeys=true response: body: - string: '{"modelInfo": {"modelId": "ed77ab68-b223-40de-9a62-78c3b3489d54", "attributes": - {"isComposed": false}, "status": "ready", "createdDateTime": "2020-09-14T22:22:00Z", - "lastUpdatedDateTime": "2020-09-14T22:22:02Z"}, "trainResult": {"averageModelAccuracy": - 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": - "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, - {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": - "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", - "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", - "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": - "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": - 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": - 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", - "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": - "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, - {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": - 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", - "accuracy": 1.0}], "errors": []}}' + string: '{"modelInfo": {"modelId": "8fe658bb-bcd5-4fa1-a862-1215eb90f1c8", "modelName": + "my labeled model", "attributes": {"isComposed": false}, "status": "ready", + "createdDateTime": "2020-10-06T01:44:08Z", "lastUpdatedDateTime": "2020-10-06T01:44:10Z"}, + "trainResult": {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": + "Form_1.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], + "fields": [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": + "CompanyName", "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": + 1.0}, {"fieldName": "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": + 0.8}, {"fieldName": "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", + "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": + "Quantity", "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, + {"fieldName": "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": + 1.0}, {"fieldName": "Total", "accuracy": 1.0}, {"fieldName": "VendorName", + "accuracy": 1.0}, {"fieldName": "Website", "accuracy": 1.0}], "errors": []}}' headers: - apim-request-id: 81475cbf-9dbb-4e06-b1bd-8df780f024ab + apim-request-id: e0798b87-5214-4049-80aa-512f10a73ce3 content-type: application/json; charset=utf-8 - date: Mon, 14 Sep 2020 22:22:04 GMT + date: Tue, 06 Oct 2020 01:44:13 GMT strict-transport-security: max-age=31536000; includeSubDomains; preload transfer-encoding: chunked x-content-type-options: nosniff - x-envoy-upstream-service-time: '17' + x-envoy-upstream-service-time: '18' status: code: 200 message: OK - url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/ed77ab68-b223-40de-9a62-78c3b3489d54?includeKeys=true + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/8fe658bb-bcd5-4fa1-a862-1215eb90f1c8?includeKeys=true version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py index 2f69368afa77..51a4730cded6 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py @@ -138,6 +138,8 @@ def test_custom_form_unlabeled(self, client, container_sas_url): form = poller.result() self.assertEqual(form[0].form_type, "form-0") + self.assertIsNone(form[0].form_type_confidence) + self.assertIsNotNone(form[0].model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -166,6 +168,8 @@ def test_custom_form_multipage_unlabeled(self, client, container_sas_url): if form.form_type is None: continue # blank page self.assertEqual(form.form_type, "form-0") + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -181,7 +185,8 @@ def test_custom_form_labeled(self, client, container_sas_url): poller = client.begin_training( container_sas_url, - use_training_labels=True + use_training_labels=True, + display_name="labeled" ) model = poller.result() @@ -191,7 +196,9 @@ def test_custom_form_labeled(self, client, container_sas_url): poller = fr_client.begin_recognize_custom_forms(model.model_id, myfile, content_type=FormContentType.IMAGE_JPEG) form = poller.result() - self.assertEqual(form[0].form_type, "custom:"+model.model_id) + self.assertEqual(form[0].form_type, "custom:labeled") + self.assertEqual(form[0].form_type_confidence, 1.0) + self.assertIsNotNone(form[0].model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -222,6 +229,8 @@ def test_custom_form_multipage_labeled(self, client, container_sas_url): for form in forms: self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -264,6 +273,8 @@ def callback(raw_response, _, headers): self.assertFormPagesTransformCorrect(recognized_form[0].pages, read_results, page_results) self.assertEqual(recognized_form[0].page_range.first_page_number, page_results[0].page) self.assertEqual(recognized_form[0].page_range.last_page_number, page_results[0].page) + self.assertIsNone(recognized_form[0].form_type_confidence) + self.assertIsNotNone(recognized_form[0].model_id) self.assertUnlabeledFormFieldDictTransformCorrect(recognized_form[0].fields, actual_fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -302,6 +313,8 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, page_results): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @@ -339,6 +352,8 @@ def callback(raw_response, _, headers): self.assertFormPagesTransformCorrect(recognized_form[0].pages, read_results, page_results) self.assertEqual(recognized_form[0].page_range.first_page_number, page_results[0].page) self.assertEqual(recognized_form[0].page_range.last_page_number, page_results[0].page) + self.assertEqual(recognized_form[0].form_type_confidence, 1.0) + self.assertIsNotNone(recognized_form[0].model_id) self.assertLabeledFormFieldDictTransformCorrect(recognized_form[0].fields, actual_fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -378,6 +393,8 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -435,14 +452,14 @@ def callback(raw_response, _, headers): recognized_form = responses[1] read_results = actual.analyze_result.read_results page_results = actual.analyze_result.page_results - document_results = actual.analyze_result.document_results self.assertFormPagesTransformCorrect(recognized_form, read_results, page_results) - for form, actual in zip(recognized_form, document_results): - self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) - self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "custom:"+model.model_id) - self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) + for form, actual in zip(recognized_form, page_results): + self.assertEqual(form.page_range.first_page_number, actual.page) + self.assertEqual(form.page_range.last_page_number, actual.page) + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) + self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage2=True) @@ -481,4 +498,6 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py index 16b3abe977e1..dbf440ae5c0a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py @@ -156,6 +156,8 @@ async def test_custom_form_unlabeled(self, client, container_sas_url): poller = await fr_client.begin_recognize_custom_forms(model.model_id, myfile, content_type=FormContentType.IMAGE_JPEG) form = await poller.result() self.assertEqual(form[0].form_type, "form-0") + self.assertIsNone(form[0].form_type_confidence) + self.assertIsNotNone(form[0].model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -187,6 +189,8 @@ async def test_custom_form_multipage_unlabeled(self, client, container_sas_url): if form.form_type is None: continue # blank page self.assertEqual(form.form_type, "form-0") + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -204,14 +208,16 @@ async def test_custom_form_labeled(self, client, container_sas_url): myfile = fd.read() async with client: - training_poller = await client.begin_training(container_sas_url, use_training_labels=True) + training_poller = await client.begin_training(container_sas_url, use_training_labels=True, display_name="labeled") model = await training_poller.result() async with fr_client: poller = await fr_client.begin_recognize_custom_forms(model.model_id, myfile, content_type=FormContentType.IMAGE_JPEG) form = await poller.result() - self.assertEqual(form[0].form_type, "custom:"+model.model_id) + self.assertEqual(form[0].form_type, "custom:labeled") + self.assertEqual(form[0].form_type_confidence, 1.0) + self.assertIsNotNone(form[0].model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -243,6 +249,8 @@ async def test_custom_form_multipage_labeled(self, client, container_sas_url): for form in forms: self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -289,6 +297,8 @@ def callback(raw_response, _, headers): self.assertFormPagesTransformCorrect(recognized_form[0].pages, read_results, page_results) self.assertEqual(recognized_form[0].page_range.first_page_number, page_results[0].page) self.assertEqual(recognized_form[0].page_range.last_page_number, page_results[0].page) + self.assertIsNone(recognized_form[0].form_type_confidence) + self.assertIsNotNone(recognized_form[0].model_id) self.assertUnlabeledFormFieldDictTransformCorrect(recognized_form[0].fields, actual_fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -329,6 +339,8 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, page_results): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @@ -370,6 +382,8 @@ def callback(raw_response, _, headers): self.assertFormPagesTransformCorrect(recognized_form[0].pages, read_results, page_results) self.assertEqual(recognized_form[0].page_range.first_page_number, page_results[0].page) self.assertEqual(recognized_form[0].page_range.last_page_number, page_results[0].page) + self.assertEqual(recognized_form[0].form_type_confidence, 1.0) + self.assertIsNotNone(recognized_form[0].model_id) self.assertLabeledFormFieldDictTransformCorrect(recognized_form[0].fields, actual_fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -412,6 +426,8 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -474,14 +490,14 @@ def callback(raw_response, _, headers): recognized_form = responses[1] read_results = actual.analyze_result.read_results page_results = actual.analyze_result.page_results - document_results = actual.analyze_result.document_results self.assertFormPagesTransformCorrect(recognized_form, read_results, page_results) - for form, actual in zip(recognized_form, document_results): - self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) - self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "custom:"+model.model_id) - self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) + for form, actual in zip(recognized_form, page_results): + self.assertEqual(form.page_range.first_page_number, actual.page) + self.assertEqual(form.page_range.last_page_number, actual.page) + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) + self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage2=True) @@ -522,4 +538,6 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py index c089f8d165bc..be40cd40130b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py @@ -102,6 +102,8 @@ def test_custom_form_unlabeled(self, client, container_sas_url): form = poller.result() self.assertEqual(form[0].form_type, "form-0") + self.assertIsNone(form[0].form_type_confidence) + self.assertIsNotNone(form[0].model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -128,6 +130,8 @@ def test_form_multipage_unlabeled(self, client, container_sas_url, blob_sas_url) if form.form_type is None: continue # blank page self.assertEqual(form.form_type, "form-0") + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -141,13 +145,15 @@ def test_form_multipage_unlabeled(self, client, container_sas_url, blob_sas_url) def test_custom_form_labeled(self, client, container_sas_url): fr_client = client.get_form_recognizer_client() - poller = client.begin_training(container_sas_url, use_training_labels=True) + poller = client.begin_training(container_sas_url, use_training_labels=True, display_name="labeled") model = poller.result() poller = fr_client.begin_recognize_custom_forms_from_url(model.model_id, self.form_url_jpg) form = poller.result() - self.assertEqual(form[0].form_type, "custom:"+model.model_id) + self.assertEqual(form[0].form_type, "custom:labeled") + self.assertEqual(form[0].form_type_confidence, 1.0) + self.assertIsNotNone(form[0].model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -174,6 +180,8 @@ def test_form_multipage_labeled(self, client, container_sas_url, blob_sas_url): for form in forms: self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -214,6 +222,8 @@ def callback(raw_response, _, headers): self.assertFormPagesTransformCorrect(recognized_form[0].pages, read_results, page_results) self.assertEqual(recognized_form[0].page_range.first_page_number, page_results[0].page) self.assertEqual(recognized_form[0].page_range.last_page_number, page_results[0].page) + self.assertIsNone(recognized_form[0].form_type_confidence) + self.assertIsNotNone(recognized_form[0].model_id) self.assertUnlabeledFormFieldDictTransformCorrect(recognized_form[0].fields, actual_fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -249,6 +259,8 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, page_results): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @@ -284,6 +296,8 @@ def callback(raw_response, _, headers): self.assertFormPagesTransformCorrect(recognized_form[0].pages, read_results, page_results) self.assertEqual(recognized_form[0].page_range.first_page_number, page_results[0].page) self.assertEqual(recognized_form[0].page_range.last_page_number, page_results[0].page) + self.assertEqual(recognized_form[0].form_type_confidence, 1.0) + self.assertIsNotNone(recognized_form[0].model_id) self.assertLabeledFormFieldDictTransformCorrect(recognized_form[0].fields, actual_fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -320,6 +334,8 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -373,14 +389,15 @@ def callback(raw_response, _, headers): recognized_form = responses[1] read_results = actual.analyze_result.read_results page_results = actual.analyze_result.page_results - document_results = actual.analyze_result.document_results + page_results = actual.analyze_result.page_results self.assertFormPagesTransformCorrect(recognized_form, read_results, page_results) - for form, actual in zip(recognized_form, document_results): - self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) - self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "custom:"+model.model_id) - self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) + for form, actual in zip(recognized_form, page_results): + self.assertEqual(form.page_range.first_page_number, actual.page) + self.assertEqual(form.page_range.last_page_number, actual.page) + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) + self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage2=True, blob_sas_url=True) @@ -416,4 +433,6 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py index 31cbede03912..86bc51ee4f92 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py @@ -119,6 +119,8 @@ async def test_form_unlabeled(self, client, container_sas_url): form = await poller.result() self.assertEqual(form[0].form_type, "form-0") + self.assertIsNone(form[0].form_type_confidence) + self.assertIsNotNone(form[0].model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -147,6 +149,8 @@ async def test_custom_form_multipage_unlabeled(self, client, container_sas_url, if form.form_type is None: continue # blank page self.assertEqual(form.form_type, "form-0") + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -161,14 +165,16 @@ async def test_form_labeled(self, client, container_sas_url): fr_client = client.get_form_recognizer_client() async with client: - training_poller = await client.begin_training(container_sas_url, use_training_labels=True) + training_poller = await client.begin_training(container_sas_url, use_training_labels=True, display_name="labeled") model = await training_poller.result() async with fr_client: poller = await fr_client.begin_recognize_custom_forms_from_url(model.model_id, self.form_url_jpg) form = await poller.result() - self.assertEqual(form[0].form_type, "custom:"+model.model_id) + self.assertEqual(form[0].form_type, "custom:labeled") + self.assertEqual(form[0].form_type_confidence, 1.0) + self.assertIsNotNone(form[0].model_id) self.assertFormPagesHasValues(form[0].pages) for label, field in form[0].fields.items(): self.assertIsNotNone(field.confidence) @@ -197,6 +203,8 @@ async def test_form_multipage_labeled(self, client, container_sas_url, blob_sas_ for form in forms: self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertFormPagesHasValues(form.pages) for label, field in form.fields.items(): self.assertIsNotNone(field.confidence) @@ -238,6 +246,8 @@ def callback(raw_response, _, headers): self.assertFormPagesTransformCorrect(recognized_form[0].pages, read_results, page_results) self.assertEqual(recognized_form[0].page_range.first_page_number, page_results[0].page) self.assertEqual(recognized_form[0].page_range.last_page_number, page_results[0].page) + self.assertIsNone(recognized_form[0].form_type_confidence) + self.assertIsNotNone(recognized_form[0].model_id) self.assertUnlabeledFormFieldDictTransformCorrect(recognized_form[0].fields, actual_fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -276,6 +286,8 @@ def callback(raw_response, _, headers): for form, actual in zip(recognized_form, page_results): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @@ -313,6 +325,8 @@ def callback(raw_response, _, headers): self.assertFormPagesTransformCorrect(recognized_form[0].pages, read_results, page_results) self.assertEqual(recognized_form[0].page_range.first_page_number, page_results[0].page) self.assertEqual(recognized_form[0].page_range.last_page_number, page_results[0].page) + self.assertEqual(recognized_form[0].form_type_confidence, 1.0) + self.assertIsNotNone(recognized_form[0].model_id) self.assertLabeledFormFieldDictTransformCorrect(recognized_form[0].fields, actual_fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -352,6 +366,8 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -408,14 +424,14 @@ def callback(raw_response, _, headers): recognized_form = responses[1] read_results = actual.analyze_result.read_results page_results = actual.analyze_result.page_results - document_results = actual.analyze_result.document_results self.assertFormPagesTransformCorrect(recognized_form, read_results, page_results) - for form, actual in zip(recognized_form, document_results): - self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) - self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) - self.assertEqual(form.form_type, "custom:"+model.model_id) - self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) + for form, actual in zip(recognized_form, page_results): + self.assertEqual(form.page_range.first_page_number, actual.page) + self.assertEqual(form.page_range.last_page_number, actual.page) + self.assertIsNone(form.form_type_confidence) + self.assertIsNotNone(form.model_id) + self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage2=True, blob_sas_url=True) @@ -453,4 +469,6 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page_range[0]) self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) + self.assertEqual(form.form_type_confidence, 1.0) + self.assertIsNotNone(form.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py index 95f664ca030f..bb46dd6214b8 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py @@ -58,10 +58,11 @@ def test_training_auth_bad_key(self, resource_group, location, form_recognizer_a @GlobalClientPreparer(training=True) def test_training(self, client, container_sas_url): - poller = client.begin_training(training_files_url=container_sas_url, use_training_labels=False) + poller = client.begin_training(training_files_url=container_sas_url, use_training_labels=False, display_name="my unlabeled model") model = poller.result() self.assertIsNotNone(model.model_id) + # self.assertEqual(model.display_name, "my unlabeled model") # bug in service self.assertIsNotNone(model.training_started_on) self.assertIsNotNone(model.training_completed_on) self.assertEqual(model.errors, []) @@ -142,10 +143,11 @@ def callback(response, _, headers): @GlobalClientPreparer(training=True) def test_training_with_labels(self, client, container_sas_url): - poller = client.begin_training(training_files_url=container_sas_url, use_training_labels=True) + poller = client.begin_training(training_files_url=container_sas_url, use_training_labels=True, display_name="my labeled model") model = poller.result() self.assertIsNotNone(model.model_id) + self.assertEqual(model.display_name, "my labeled model") self.assertIsNotNone(model.training_started_on) self.assertIsNotNone(model.training_completed_on) self.assertEqual(model.errors, []) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py index 90cc9f7a0a98..d12a0fabdbf9 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py @@ -65,10 +65,12 @@ async def test_training(self, client, container_sas_url): async with client: poller = await client.begin_training( training_files_url=container_sas_url, - use_training_labels=False) + use_training_labels=False, + display_name="my unlabeled model") model = await poller.result() self.assertIsNotNone(model.model_id) + # self.assertEqual(model.display_name, "my unlabeled model") # bug in service self.assertIsNotNone(model.training_started_on) self.assertIsNotNone(model.training_completed_on) self.assertEqual(model.errors, []) @@ -154,10 +156,11 @@ def callback(response, _, headers): @GlobalClientPreparer(training=True) async def test_training_with_labels(self, client, container_sas_url): async with client: - poller = await client.begin_training(training_files_url=container_sas_url, use_training_labels=True) + poller = await client.begin_training(training_files_url=container_sas_url, use_training_labels=True, display_name="my labeled model") model = await poller.result() self.assertIsNotNone(model.model_id) + self.assertEqual(model.display_name, "my labeled model") self.assertIsNotNone(model.training_started_on) self.assertIsNotNone(model.training_completed_on) self.assertEqual(model.errors, []) From 7cc601f9453aa0f8177820707e8f594bc20537b7 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 5 Oct 2020 19:51:43 -0700 Subject: [PATCH 11/18] updating readmes/changelog --- .../azure-ai-formrecognizer/CHANGELOG.md | 11 ++++++++++ .../azure-ai-formrecognizer/README.md | 22 ++++++++++++++----- .../azure-ai-formrecognizer/samples/README.md | 8 ++++--- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md index 29a5b4150c77..845d38ff8615 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md @@ -2,6 +2,17 @@ ## 3.1.0b1 (Unreleased) +This version of the SDK defaults to the latest supported API version, which currently is v2.1-preview. + +**New features** + +- Added ability to create a composed model from the `FormTrainingClient` by calling method `begin_create_composed_model()` +- Added the properties `display_name` and `properties` to types `CustomFormModel` and `CustomFormModelInfo` +- Added keyword argument `display_name` to `begin_training()` and `begin_create_composed_model()` +- Added model type `CustomFormModelProperties` that includes information like if a model is a composed model +- Added property `model_id` to `CustomFormSubmodel` and `TrainingDocumentInfo` +- Added properties `model_id` and `form_type_confidence` to `RecognizedForm` + ## 3.0.0 (2020-08-20) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md index d150a52264c2..e18c8620b843 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md @@ -20,10 +20,10 @@ from form documents. It includes the following main functionalities: Install the Azure Form Recognizer client library for Python with [pip][pip]: ```bash -pip install azure-ai-formrecognizer +pip install azure-ai-formrecognizer --pre ``` -> Note: This version of the client library supports the v2.0 version of the Form Recognizer service +> Note: This version of the client library defaults to the v2.1-preview version of the service #### Create a Form Recognizer resource Form Recognizer supports both [multi-service and single-service access][multi_and_single_service]. @@ -135,6 +135,7 @@ Sample code snippets are provided to illustrate using a FormRecognizerClient [he - Training custom models with labels to recognize specific fields and values you specify by labeling your custom forms. A `CustomFormModel` is returned indicating the fields the model will extract, as well as the estimated accuracy for each field. See the [service documentation][fr-train-with-labels] for a more detailed explanation. - Managing models created in your account. - Copying a custom model from one Form Recognizer resource to another. +- Creating a composed model from a collection of existing trained models with labels. Please note that models can also be trained using a graphical user interface such as the [Form Recognizer Labeling Tool][fr-labeling-tool]. @@ -183,6 +184,8 @@ result = poller.result() for recognized_form in result: print("Form type: {}".format(recognized_form.form_type)) + print("Form type confidence: {}".format(recognized_form.form_type_confidence)) + print("Form was analyzed using model with ID: {}".format(recognized_form.model_id)) for name, field in recognized_form.fields.items(): print("Field '{}' has label '{}' with value '{}' and a confidence score of {}".format( name, @@ -275,12 +278,14 @@ form_training_client = FormTrainingClient(endpoint, credential) container_sas_url = "" # training documents uploaded to blob storage poller = form_training_client.begin_training( - container_sas_url, use_training_labels=False + container_sas_url, use_training_labels=False, display_name="my first model" ) model = poller.result() # Custom model information print("Model ID: {}".format(model.model_id)) +print("Display name: {}".format(model.display_name)) +print("Is composed model?: {}".format(model.properties.is_composed_model)) print("Status: {}".format(model.status)) print("Training started on: {}".format(model.training_started_on)) print("Training completed on: {}".format(model.training_completed_on)) @@ -288,8 +293,8 @@ print("Training completed on: {}".format(model.training_completed_on)) print("\nRecognized fields:") for submodel in model.submodels: print( - "The submodel with form type '{}' has recognized the following fields: {}".format( - submodel.form_type, + "The submodel with form type '{}' and model ID '{}' has recognized the following fields: {}".format( + submodel.form_type, submodel.model_id, ", ".join( [ field.label if field.label else name @@ -336,6 +341,8 @@ model_id = "" custom_model = form_training_client.get_custom_model(model_id=model_id) print("Model ID: {}".format(custom_model.model_id)) +print("Display name: {}".format(model.display_name)) +print("Is composed model?: {}".format(model.properties.is_composed_model)) print("Status: {}".format(custom_model.status)) print("Training started on: {}".format(custom_model.training_started_on)) print("Training completed on: {}".format(custom_model.training_completed_on)) @@ -388,6 +395,7 @@ These code samples show common scenario operations with the Azure Form Recognize * Train a model with labels: [sample_train_model_with_labels.py][sample_train_model_with_labels] * Manage custom models: [sample_manage_custom_models.py][sample_manage_custom_models] * Copy a model between Form Recognizer resources: [sample_copy_model.py][sample_copy_model] +* Create a composed model from a collection of models trained with labels: |[sample_create_composed_model.py][sample_create_composed_model] ### Async APIs This library also includes a complete async API supported on Python 3.5+. To use it, you must @@ -403,7 +411,7 @@ are found under the `azure.ai.formrecognizer.aio` namespace. * Train a model with labels: [sample_train_model_with_labels_async.py][sample_train_model_with_labels_async] * Manage custom models: [sample_manage_custom_models_async.py][sample_manage_custom_models_async] * Copy a model between Form Recognizer resources: [sample_copy_model_async.py][sample_copy_model_async] - +* Create a composed model from a collection of models trained with labels: [sample_create_composed_model_async.py][sample_create_composed_model_async] ### Additional documentation @@ -475,3 +483,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [sample_train_model_without_labels_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_without_labels_async.py [sample_copy_model]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_copy_model.py [sample_copy_model_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_copy_model_async.py +[sample_create_composed_model]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples +[sample_create_composed_model_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/ diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/samples/README.md index 19af853b73fc..7587eefe7e78 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/README.md @@ -29,7 +29,7 @@ All of these samples need the endpoint to your Form Recognizer resource ([instru |[sample_train_model_with_labels.py][sample_train_model_with_labels] and [sample_train_model_with_labels_async.py][sample_train_model_with_labels_async]|Train a custom model with labeled data| |[sample_manage_custom_models.py][sample_manage_custom_models] and [sample_manage_custom_models_async.py][sample_manage_custom_models_async]|Manage the custom models in your account| |[sample_copy_model.py][sample_copy_model] and [sample_copy_model_async.py][sample_copy_model_async]|Copy a custom model from one Form Recognizer resource to another| - +|[sample_create_composed_model.py][sample_create_composed_model] and [sample_create_composed_model_async.py][sample_create_composed_model_async]|Creates a composed model from a collection of existing trained models with labels| ## Prerequisites * Python 2.7, or 3.5 or later is required to use this package (3.5 or later if using asyncio) @@ -41,7 +41,7 @@ All of these samples need the endpoint to your Form Recognizer resource ([instru 1. Install the Azure Form Recognizer client library for Python with [pip][pip]: ```bash -pip install azure-ai-formrecognizer +pip install azure-ai-formrecognizer --pre ``` 2. Clone or download this sample repository @@ -97,4 +97,6 @@ what you can do with the Azure Form Recognizer client library. [sample_copy_model]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_copy_model.py [sample_copy_model_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_copy_model_async.py [sample_strongly_typing_recognized_form]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_strongly_typing_recognized_form.py -[sample_strongly_typing_recognized_form_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_strongly_typing_recognized_form_async.py \ No newline at end of file +[sample_strongly_typing_recognized_form_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_strongly_typing_recognized_form_async.py +[sample_create_composed_model]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples +[sample_create_composed_model_async]: https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/ From f80ab2b718f188bd98c58117ed996dda067b97b0 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Mon, 5 Oct 2020 19:57:15 -0700 Subject: [PATCH 12/18] small fix --- .../azure/ai/formrecognizer/_models.py | 4 ++++ .../async_samples/sample_create_composed_model_async.py | 4 ++-- .../async_samples/sample_manage_custom_models_async.py | 2 +- .../async_samples/sample_train_model_with_labels_async.py | 2 +- .../samples/sample_create_composed_model.py | 4 ++-- .../samples/sample_manage_custom_models.py | 2 +- .../samples/sample_train_model_with_labels.py | 2 +- 7 files changed, 12 insertions(+), 8 deletions(-) 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 45a1a53cf375..7155562749a5 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -676,6 +676,8 @@ class CustomFormSubmodel(object): is generated for each field. :vartype fields: dict[str, ~azure.ai.formrecognizer.CustomFormModelField] :ivar str form_type: Type of form this submodel recognizes. + .. versionadded:: v2.1-preview + The *model_id* property """ def __init__(self, **kwargs): self.model_id = kwargs.get("model_id", None) @@ -788,6 +790,8 @@ class TrainingDocumentInfo(object): List of any errors for document. :ivar str model_id: The model ID that used the document to train. + .. versionadded:: v2.1-preview + The *model_id* property """ def __init__(self, **kwargs): diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py index 3633174b607a..e466f6e89067 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py @@ -10,7 +10,7 @@ FILE: sample_create_composed_model_async.py DESCRIPTION: - This sample demonstrates how to create a composite model using existing custom models that + This sample demonstrates how to create a composed model using existing custom models that were trained with labels. USAGE: @@ -46,7 +46,7 @@ async def create_composed_model_async(self): # Custom model information print("Model ID: {}".format(model.model_id)) print("Model display name: {}".format(model.display_name)) - print("Is this a composite model?: {}".format(model.properties.is_composed_model)) + print("Is this a composed model?: {}".format(model.properties.is_composed_model)) print("Status: {}".format(model.status)) print("Composed model creation started on: {}".format(model.training_started_on)) print("Creation completed on: {}".format(model.training_completed_on)) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_manage_custom_models_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_manage_custom_models_async.py index 232b5dcf355b..8c98ea9ab06f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_manage_custom_models_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_manage_custom_models_async.py @@ -65,7 +65,7 @@ async def manage_custom_models(self): print("\nModel ID: {}".format(custom_model.model_id)) print("Status: {}".format(custom_model.status)) print("Model display name: {}".format(custom_model.display_name)) - print("Is this a composite model?: {}".format(custom_model.properties.is_composed_model)) + print("Is this a composed model?: {}".format(custom_model.properties.is_composed_model)) print("Training started on: {}".format(custom_model.training_started_on)) print("Training completed on: {}".format(custom_model.training_completed_on)) # [END get_custom_model_async] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py index d17aee0bf97d..ca0cd8d0ce6b 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_train_model_with_labels_async.py @@ -62,7 +62,7 @@ async def train_model_with_labels(self): print("Model ID: {}".format(model.model_id)) print("Status: {}".format(model.status)) print("Model display name: {}".format(model.display_name)) - print("Is this a composite model?: {}".format(model.properties.is_composed_model)) + print("Is this a composed model?: {}".format(model.properties.is_composed_model)) print("Training started on: {}".format(model.training_started_on)) print("Training completed on: {}".format(model.training_completed_on)) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py index 269b475a0c2d..f9aaaa77118e 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py @@ -10,7 +10,7 @@ FILE: sample_create_composed_model.py DESCRIPTION: - This sample demonstrates how to create a composite model using existing custom models that + This sample demonstrates how to create a composed model using existing custom models that were trained with labels. USAGE: @@ -44,7 +44,7 @@ def create_composed_model(self): # Custom model information print("Model ID: {}".format(model.model_id)) print("Model display name: {}".format(model.display_name)) - print("Is this a composite model?: {}".format(model.properties.is_composed_model)) + print("Is this a composed model?: {}".format(model.properties.is_composed_model)) print("Status: {}".format(model.status)) print("Composed model creation started on: {}".format(model.training_started_on)) print("Creation completed on: {}".format(model.training_completed_on)) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_manage_custom_models.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_manage_custom_models.py index 8a1755bfb0e4..f9a332035aa6 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_manage_custom_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_manage_custom_models.py @@ -62,7 +62,7 @@ def manage_custom_models(self): print("\nModel ID: {}".format(custom_model.model_id)) print("Status: {}".format(custom_model.status)) print("Model display name: {}".format(custom_model.display_name)) - print("Is this a composite model?: {}".format(custom_model.properties.is_composed_model)) + print("Is this a composed model?: {}".format(custom_model.properties.is_composed_model)) print("Training started on: {}".format(custom_model.training_started_on)) print("Training completed on: {}".format(custom_model.training_completed_on)) # [END get_custom_model] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py index 2b5b467c88a0..864f52f84f48 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_train_model_with_labels.py @@ -57,7 +57,7 @@ def train_model_with_labels(self): print("Model ID: {}".format(model.model_id)) print("Status: {}".format(model.status)) print("Model display name: {}".format(model.display_name)) - print("Is this a composite model?: {}".format(model.properties.is_composed_model)) + print("Is this a composed model?: {}".format(model.properties.is_composed_model)) print("Training started on: {}".format(model.training_started_on)) print("Training completed on: {}".format(model.training_completed_on)) From 3a9e729de47e7c79fbae8bb5b8eda77ecd601df8 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 6 Oct 2020 08:50:24 -0700 Subject: [PATCH 13/18] update sample to be more consistent with .NET --- .../formrecognizer/_form_training_client.py | 9 +++ .../aio/_form_training_client_async.py | 9 +++ .../sample_create_composed_model_async.py | 64 +++++++++++++++---- .../samples/sample_create_composed_model.py | 53 +++++++++++++-- 4 files changed, 119 insertions(+), 16 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py index 83537fdddcd0..13479db0fe4a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py @@ -395,6 +395,15 @@ def begin_create_composed_model( object to return a :class:`~azure.ai.formrecognizer.CustomFormModel`. :rtype: ~azure.core.polling.LROPoller[~azure.ai.formrecognizer.CustomFormModel] :raises ~azure.core.exceptions.HttpResponseError: + + .. admonition:: Example: + + .. literalinclude:: ../samples/sample_create_composed_model.py + :start-after: [START begin_create_composed_model] + :end-before: [END begin_create_composed_model] + :language: python + :dedent: 8 + :caption: Create a composed model """ def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argument diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py index d1589609dc6b..e7880011db9a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py @@ -406,6 +406,15 @@ async def begin_create_composed_model( object to return a :class:`~azure.ai.formrecognizer.CustomFormModel`. :rtype: ~azure.core.polling.AsyncLROPoller[~azure.ai.formrecognizer.CustomFormModel] :raises ~azure.core.exceptions.HttpResponseError: + + .. admonition:: Example: + + .. literalinclude:: ../samples/async_samples/sample_create_composed_model_async.py + :start-after: [START begin_create_composed_model_async] + :end-before: [END begin_create_composed_model_async] + :language: python + :dedent: 8 + :caption: Create a composed model """ def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argument diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py index e466f6e89067..43a4fb795419 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py @@ -10,8 +10,18 @@ FILE: sample_create_composed_model_async.py DESCRIPTION: - This sample demonstrates how to create a composed model using existing custom models that - were trained with labels. + Model compose allows multiple models to be composed and called with a single model ID. + This is useful when you have trained different models and want to aggregate a group of + them into a single model that you (or a user) could use to recognize a form. When doing + so, you can let the service decide which model more accurately represents the form to + recognize, instead of manually trying each trained model against the form and selecting + the most accurate one. + + In our case, we will be writing an application that collects the expenses a company is making. + There are 4 main areas where we get purchase orders from (office supplies, office equipment, + furniture, and cleaning supplies). Because each area has its own form with its own structure, + we need to train a model per form. Note that you can substitute your own models or container + SAS URLs for this sample. USAGE: python sample_create_composed_model_async.py @@ -19,6 +29,10 @@ Set the environment variables with your own values before running the sample: 1) AZURE_FORM_RECOGNIZER_ENDPOINT - the endpoint to your Cognitive Services resource. 2) AZURE_FORM_RECOGNIZER_KEY - your Form Recognizer API key + 3) PURCHASE_ORDER_OFFICE_SUPPLIES_SAS_URL - a container SAS URL to your Azure Storage blob container. + 4) PURCHASE_ORDER_OFFICE_EQUIPMENT_SAS_URL - a container SAS URL to your Azure Storage blob container. + 5) PURCHASE_ORDER_OFFICE_FURNITURE_SAS_URL - a container SAS URL to your Azure Storage blob container. + 6) PURCHASE_ORDER_OFFICE_CLEANING_SUPPLIES_SAS_URL - a container SAS URL to your Azure Storage blob container. """ import os @@ -28,22 +42,48 @@ class ComposedModelSampleAsync(object): async def create_composed_model_async(self): + # [START begin_create_composed_model_async] from azure.core.credentials import AzureKeyCredential from azure.ai.formrecognizer.aio import FormTrainingClient endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"] key = os.environ["AZURE_FORM_RECOGNIZER_KEY"] + po_supplies = os.environ['PURCHASE_ORDER_OFFICE_SUPPLIES_SAS_URL'] + po_equipment = os.environ['PURCHASE_ORDER_OFFICE_EQUIPMENT_SAS_URL'] + po_furniture = os.environ['PURCHASE_ORDER_OFFICE_FURNITURE_SAS_URL'] + po_cleaning_supplies = os.environ['PURCHASE_ORDER_OFFICE_CLEANING_SUPPLIES_SAS_URL'] form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key)) - - models_trained_with_labels = ["6f4f1583-8f73-4be8-9337-ccc105f1fdff", "4408815d-b870-4b15-86b0-fb1ea69f9853"] - async with form_training_client: - poller = await form_training_client.begin_create_composed_model( - models_trained_with_labels, display_name="my_composed_model" - ) - model = await poller.result() - - # Custom model information + supplies_poller = await form_training_client.begin_training( + po_supplies, use_training_labels=True, display_name="Purchase order - Office supplies" + ) + equipment_poller = await form_training_client.begin_training( + po_equipment, use_training_labels=True, display_name="Purchase order - Office Equipment" + ) + furniture_poller = await form_training_client.begin_training( + po_furniture, use_training_labels=True, display_name="Purchase order - Furniture" + ) + cleaning_supplies_poller = await form_training_client.begin_training( + po_cleaning_supplies, use_training_labels=True, display_name="Purchase order - Cleaning Supplies" + ) + supplies_model = await supplies_poller.result() + equipment_model = await equipment_poller.result() + furniture_model = await furniture_poller.result() + cleaning_supplies_model = await cleaning_supplies_poller.result() + + models_trained_with_labels = [ + supplies_model.model_id, + equipment_model.model_id, + furniture_model.model_id, + cleaning_supplies_model.model_id + ] + + poller = await form_training_client.begin_create_composed_model( + models_trained_with_labels, display_name="Office Supplies Composed Model" + ) + model = await poller.result() + + print("Purchase Order Model Info:") print("Model ID: {}".format(model.model_id)) print("Model display name: {}".format(model.display_name)) print("Is this a composed model?: {}".format(model.properties.is_composed_model)) @@ -51,6 +91,8 @@ async def create_composed_model_async(self): print("Composed model creation started on: {}".format(model.training_started_on)) print("Creation completed on: {}".format(model.training_completed_on)) + # [END begin_create_composed_model_async] + print("Recognized fields:") for submodel in model.submodels: print("The submodel has model ID: {}".format(submodel.model_id)) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py index f9aaaa77118e..ce28d9cdedc2 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py @@ -10,8 +10,18 @@ FILE: sample_create_composed_model.py DESCRIPTION: - This sample demonstrates how to create a composed model using existing custom models that - were trained with labels. + Model compose allows multiple models to be composed and called with a single model ID. + This is useful when you have trained different models and want to aggregate a group of + them into a single model that you (or a user) could use to recognize a form. When doing + so, you can let the service decide which model more accurately represents the form to + recognize, instead of manually trying each trained model against the form and selecting + the most accurate one. + + In our case, we will be writing an application that collects the expenses a company is making. + There are 4 main areas where we get purchase orders from (office supplies, office equipment, + furniture, and cleaning supplies). Because each area has its own form with its own structure, + we need to train a model per form. Note that you can substitute your own models or container + SAS URLs for this sample. USAGE: python sample_create_composed_model.py @@ -19,6 +29,10 @@ Set the environment variables with your own values before running the sample: 1) AZURE_FORM_RECOGNIZER_ENDPOINT - the endpoint to your Cognitive Services resource. 2) AZURE_FORM_RECOGNIZER_KEY - your Form Recognizer API key + 3) PURCHASE_ORDER_OFFICE_SUPPLIES_SAS_URL - a container SAS URL to your Azure Storage blob container. + 4) PURCHASE_ORDER_OFFICE_EQUIPMENT_SAS_URL - a container SAS URL to your Azure Storage blob container. + 5) PURCHASE_ORDER_OFFICE_FURNITURE_SAS_URL - a container SAS URL to your Azure Storage blob container. + 6) PURCHASE_ORDER_OFFICE_CLEANING_SUPPLIES_SAS_URL - a container SAS URL to your Azure Storage blob container. """ import os @@ -27,21 +41,48 @@ class ComposedModelSample(object): def create_composed_model(self): + # [START begin_create_composed_model] from azure.core.credentials import AzureKeyCredential from azure.ai.formrecognizer import FormTrainingClient endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"] key = os.environ["AZURE_FORM_RECOGNIZER_KEY"] + po_supplies = os.environ['PURCHASE_ORDER_OFFICE_SUPPLIES_SAS_URL'] + po_equipment = os.environ['PURCHASE_ORDER_OFFICE_EQUIPMENT_SAS_URL'] + po_furniture = os.environ['PURCHASE_ORDER_OFFICE_FURNITURE_SAS_URL'] + po_cleaning_supplies = os.environ['PURCHASE_ORDER_OFFICE_CLEANING_SUPPLIES_SAS_URL'] form_training_client = FormTrainingClient(endpoint=endpoint, credential=AzureKeyCredential(key)) + supplies_poller = form_training_client.begin_training( + po_supplies, use_training_labels=True, display_name="Purchase order - Office supplies" + ) + equipment_poller = form_training_client.begin_training( + po_equipment, use_training_labels=True, display_name="Purchase order - Office Equipment" + ) + furniture_poller = form_training_client.begin_training( + po_furniture, use_training_labels=True, display_name="Purchase order - Furniture" + ) + cleaning_supplies_poller = form_training_client.begin_training( + po_cleaning_supplies, use_training_labels=True, display_name="Purchase order - Cleaning Supplies" + ) + supplies_model = supplies_poller.result() + equipment_model = equipment_poller.result() + furniture_model = furniture_poller.result() + cleaning_supplies_model = cleaning_supplies_poller.result() + + models_trained_with_labels = [ + supplies_model.model_id, + equipment_model.model_id, + furniture_model.model_id, + cleaning_supplies_model.model_id + ] - models_trained_with_labels = ["6f4f1583-8f73-4be8-9337-ccc105f1fdff", "4408815d-b870-4b15-86b0-fb1ea69f9853"] poller = form_training_client.begin_create_composed_model( - models_trained_with_labels, display_name="my_composed_model" + models_trained_with_labels, display_name="Office Supplies Composed Model" ) model = poller.result() - # Custom model information + print("Purchase Order Model Info:") print("Model ID: {}".format(model.model_id)) print("Model display name: {}".format(model.display_name)) print("Is this a composed model?: {}".format(model.properties.is_composed_model)) @@ -49,6 +90,8 @@ def create_composed_model(self): print("Composed model creation started on: {}".format(model.training_started_on)) print("Creation completed on: {}".format(model.training_completed_on)) + # [END begin_create_composed_model] + print("Recognized fields:") for submodel in model.submodels: print("The submodel has model ID: {}".format(submodel.model_id)) From 02208d0f9c16c72eedd883e193a53a2a12b3b1bf Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 6 Oct 2020 13:09:25 -0700 Subject: [PATCH 14/18] add api version table to readme --- sdk/formrecognizer/azure-ai-formrecognizer/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md index e18c8620b843..b0cf70ae8eac 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md @@ -25,6 +25,14 @@ pip install azure-ai-formrecognizer --pre > Note: This version of the client library defaults to the v2.1-preview version of the service +This table shows the relationship between SDK versions and supported API versions of the service + +|SDK version|Supported API version of service +|-|- +|3.0.0 - Latest GA release (can be installed by removing the `--pre` flag)| 2.0 +|3.1.0b1 - Latest release (beta)| 2.0, 2.1-preview + + #### Create a Form Recognizer resource Form Recognizer supports both [multi-service and single-service access][multi_and_single_service]. Create a Cognitive Services resource if you plan to access multiple cognitive services under a single endpoint/key. For Form Recognizer access only, create a Form Recognizer resource. From 24b538072b94edd31d2f216477f49c7269e800e3 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Tue, 6 Oct 2020 14:57:52 -0700 Subject: [PATCH 15/18] add tests requested in feedback --- .../formrecognizer/_form_training_client.py | 2 + .../aio/_form_training_client_async.py | 2 + ...el.test_compose_model_no_display_name.yaml | 283 ++++++++++++++++++ ...test_compose_model_with_display_name.yaml} | 0 ...nc.test_compose_model_no_display_name.yaml | 217 ++++++++++++++ ...test_compose_model_with_display_name.yaml} | 0 .../tests/test_compose_model.py | 26 +- .../tests/test_compose_model_async.py | 27 +- .../tests/test_training.py | 8 + .../tests/test_training_async.py | 8 + .../azure-ai-formrecognizer/tests/testcase.py | 30 +- 11 files changed, 589 insertions(+), 14 deletions(-) create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_no_display_name.yaml rename sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/{test_compose_model.test_compose_model.yaml => test_compose_model.test_compose_model_with_display_name.yaml} (100%) create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_no_display_name.yaml rename sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/{test_compose_model_async.test_compose_model.yaml => test_compose_model_async.test_compose_model_with_display_name.yaml} (100%) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py index 13479db0fe4a..e8b1332be4cb 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py @@ -130,6 +130,8 @@ def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument cls = kwargs.pop("cls", None) display_name = kwargs.pop("display_name", None) + if display_name and self.api_version == "2.0": + raise ValueError("'display_name' is only available for API version v2.1-preview and up") continuation_token = kwargs.pop("continuation_token", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py index e7880011db9a..c5c1f2b7d757 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py @@ -131,6 +131,8 @@ def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument cls = kwargs.pop("cls", None) display_name = kwargs.pop("display_name", None) + if display_name and self.api_version == "2.0": + raise ValueError("'display_name' is only available for API version v2.1-preview and up") continuation_token = kwargs.pop("continuation_token", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_no_display_name.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_no_display_name.yaml new file mode 100644 index 000000000000..24321e8b84d1 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_no_display_name.yaml @@ -0,0 +1,283 @@ +interactions: +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '287' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: + - a8a0c4b5-c9f9-4074-9717-0313a3650303 + content-length: + - '0' + date: + - Tue, 06 Oct 2020 20:45:49 GMT + location: + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/d5cb35f5-5444-4372-92cd-aa74f28c00ad + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '39' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/d5cb35f5-5444-4372-92cd-aa74f28c00ad?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "d5cb35f5-5444-4372-92cd-aa74f28c00ad", "attributes": + {"isComposed": false}, "status": "ready", "createdDateTime": "2020-10-06T20:45:50Z", + "lastUpdatedDateTime": "2020-10-06T20:45:52Z"}, "trainResult": {"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "errors": []}}' + headers: + apim-request-id: + - 0b321762-e949-4c24-8f49-aa171abb2919 + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 20:45:55 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '14' + status: + code: 200 + message: OK +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '287' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: + - 52cef737-5bed-4329-8fa4-38ce97838319 + content-length: + - '0' + date: + - Tue, 06 Oct 2020 20:45:55 GMT + location: + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/daea8e9f-05d6-4690-aeeb-cdf6113aa988 + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '41' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/daea8e9f-05d6-4690-aeeb-cdf6113aa988?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "daea8e9f-05d6-4690-aeeb-cdf6113aa988", "attributes": + {"isComposed": false}, "status": "ready", "createdDateTime": "2020-10-06T20:45:55Z", + "lastUpdatedDateTime": "2020-10-06T20:45:58Z"}, "trainResult": {"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "errors": []}}' + headers: + apim-request-id: + - ebcdd1d1-5800-4d1b-a554-7850866a08f7 + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 20:46:00 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '48' + status: + code: 200 + message: OK +- request: + body: 'b''{"modelIds": ["d5cb35f5-5444-4372-92cd-aa74f28c00ad", "daea8e9f-05d6-4690-aeeb-cdf6113aa988"]}''' + headers: + Accept: + - application/json, text/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '94' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/compose + response: + body: + string: '' + headers: + apim-request-id: + - f89e37b6-8da5-44ff-81e8-a08d1f45e9c6 + content-length: + - '0' + date: + - Tue, 06 Oct 2020 20:46:01 GMT + location: + - https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/922fbbe0-cce4-4527-a324-4e7e109493d9 + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '84' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/922fbbe0-cce4-4527-a324-4e7e109493d9?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "922fbbe0-cce4-4527-a324-4e7e109493d9", "attributes": + {"isComposed": true}, "status": "ready", "createdDateTime": "2020-10-06T20:46:01Z", + "lastUpdatedDateTime": "2020-10-06T20:46:01Z"}, "composedTrainResults": [{"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "modelId": "daea8e9f-05d6-4690-aeeb-cdf6113aa988", "errors": + []}, {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": + "Form_1.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], + "fields": [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": + "CompanyName", "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": + 1.0}, {"fieldName": "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": + 0.8}, {"fieldName": "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", + "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": + "Quantity", "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, + {"fieldName": "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": + 1.0}, {"fieldName": "Total", "accuracy": 1.0}, {"fieldName": "VendorName", + "accuracy": 1.0}, {"fieldName": "Website", "accuracy": 1.0}], "modelId": "d5cb35f5-5444-4372-92cd-aa74f28c00ad", + "errors": []}]}' + headers: + apim-request-id: + - 18049688-50ef-40f6-a156-fb765fb974e0 + content-type: + - application/json; charset=utf-8 + date: + - Tue, 06 Oct 2020 20:46:05 GMT + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + transfer-encoding: + - chunked + x-content-type-options: + - nosniff + x-envoy-upstream-service-time: + - '90' + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_with_display_name.yaml similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model.yaml rename to sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model.test_compose_model_with_display_name.yaml diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_no_display_name.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_no_display_name.yaml new file mode 100644 index 000000000000..f87dd603a7fe --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_no_display_name.yaml @@ -0,0 +1,217 @@ +interactions: +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true}''' + headers: + Accept: + - application/json + Content-Length: + - '287' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: c5a5eddd-fe1c-4904-8d25-c294307807b1 + content-length: '0' + date: Tue, 06 Oct 2020 21:32:20 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1fb8a870-c57a-4398-aa55-e61b880f78d0 + strict-transport-security: max-age=31536000; includeSubDomains; preload + x-content-type-options: nosniff + x-envoy-upstream-service-time: '134' + status: + code: 201 + message: Created + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1fb8a870-c57a-4398-aa55-e61b880f78d0?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "1fb8a870-c57a-4398-aa55-e61b880f78d0", "attributes": + {"isComposed": false}, "status": "ready", "createdDateTime": "2020-10-06T21:32:20Z", + "lastUpdatedDateTime": "2020-10-06T21:32:23Z"}, "trainResult": {"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "errors": []}}' + headers: + apim-request-id: af6d9f73-29eb-406d-bc10-6944e818ce54 + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 21:32:26 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '101' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/1fb8a870-c57a-4398-aa55-e61b880f78d0?includeKeys=true +- request: + body: 'b''{"source": "containersasurl", "sourceFilter": {"prefix": "", "includeSubFolders": + false}, "useLabelFile": true}''' + headers: + Accept: + - application/json + Content-Length: + - '287' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models + response: + body: + string: '' + headers: + apim-request-id: 8c4a9942-500a-4261-8a97-989e87b1daf8 + content-length: '0' + date: Tue, 06 Oct 2020 21:32:26 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/eabaee12-a72d-47fc-8ab2-5c8bf91f9657 + strict-transport-security: max-age=31536000; includeSubDomains; preload + x-content-type-options: nosniff + x-envoy-upstream-service-time: '67' + status: + code: 201 + message: Created + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/eabaee12-a72d-47fc-8ab2-5c8bf91f9657?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "eabaee12-a72d-47fc-8ab2-5c8bf91f9657", "attributes": + {"isComposed": false}, "status": "ready", "createdDateTime": "2020-10-06T21:32:26Z", + "lastUpdatedDateTime": "2020-10-06T21:32:28Z"}, "trainResult": {"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "errors": []}}' + headers: + apim-request-id: 1f6cc9a5-e1ec-4171-9e8a-6ec85b19691d + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 21:32:31 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '17' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/eabaee12-a72d-47fc-8ab2-5c8bf91f9657?includeKeys=true +- request: + body: 'b''{"modelIds": ["1fb8a870-c57a-4398-aa55-e61b880f78d0", "eabaee12-a72d-47fc-8ab2-5c8bf91f9657"]}''' + headers: + Accept: + - application/json, text/json + Content-Length: + - '94' + Content-Type: + - application/json + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: POST + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/compose + response: + body: + string: '' + headers: + apim-request-id: 6c0455e9-de32-4013-a78d-7dcb4455f436 + content-length: '0' + date: Tue, 06 Oct 2020 21:32:31 GMT + location: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f53e500e-27fb-45a1-b137-c2cad3cb67b7 + strict-transport-security: max-age=31536000; includeSubDomains; preload + x-content-type-options: nosniff + x-envoy-upstream-service-time: '155' + status: + code: 201 + message: Created + url: https://centraluseuap.api.cognitive.microsoft.com//formrecognizer/v2.1-preview.1/custom/models/compose +- request: + body: null + headers: + User-Agent: + - azsdk-python-ai-formrecognizer/3.1.0b1 Python/3.7.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f53e500e-27fb-45a1-b137-c2cad3cb67b7?includeKeys=true + response: + body: + string: '{"modelInfo": {"modelId": "f53e500e-27fb-45a1-b137-c2cad3cb67b7", "attributes": + {"isComposed": true}, "status": "ready", "createdDateTime": "2020-10-06T21:32:31Z", + "lastUpdatedDateTime": "2020-10-06T21:32:31Z"}, "composedTrainResults": [{"averageModelAccuracy": + 0.96, "trainingDocuments": [{"documentName": "Form_1.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_2.jpg", "pages": 1, "status": "succeeded"}, + {"documentName": "Form_3.jpg", "pages": 1, "status": "succeeded"}, {"documentName": + "Form_4.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_5.jpg", + "pages": 1, "status": "succeeded"}], "fields": [{"fieldName": "CompanyAddress", + "accuracy": 0.8}, {"fieldName": "CompanyName", "accuracy": 1.0}, {"fieldName": + "CompanyPhoneNumber", "accuracy": 1.0}, {"fieldName": "DatedAs", "accuracy": + 1.0}, {"fieldName": "Email", "accuracy": 0.8}, {"fieldName": "Merchant", "accuracy": + 1.0}, {"fieldName": "PhoneNumber", "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", + "accuracy": 1.0}, {"fieldName": "Quantity", "accuracy": 1.0}, {"fieldName": + "Signature", "accuracy": 0.8}, {"fieldName": "Subtotal", "accuracy": 1.0}, + {"fieldName": "Tax", "accuracy": 1.0}, {"fieldName": "Total", "accuracy": + 1.0}, {"fieldName": "VendorName", "accuracy": 1.0}, {"fieldName": "Website", + "accuracy": 1.0}], "modelId": "1fb8a870-c57a-4398-aa55-e61b880f78d0", "errors": + []}, {"averageModelAccuracy": 0.96, "trainingDocuments": [{"documentName": + "Form_1.jpg", "pages": 1, "status": "succeeded"}, {"documentName": "Form_2.jpg", + "pages": 1, "status": "succeeded"}, {"documentName": "Form_3.jpg", "pages": + 1, "status": "succeeded"}, {"documentName": "Form_4.jpg", "pages": 1, "status": + "succeeded"}, {"documentName": "Form_5.jpg", "pages": 1, "status": "succeeded"}], + "fields": [{"fieldName": "CompanyAddress", "accuracy": 0.8}, {"fieldName": + "CompanyName", "accuracy": 1.0}, {"fieldName": "CompanyPhoneNumber", "accuracy": + 1.0}, {"fieldName": "DatedAs", "accuracy": 1.0}, {"fieldName": "Email", "accuracy": + 0.8}, {"fieldName": "Merchant", "accuracy": 1.0}, {"fieldName": "PhoneNumber", + "accuracy": 1.0}, {"fieldName": "PurchaseOrderNumber", "accuracy": 1.0}, {"fieldName": + "Quantity", "accuracy": 1.0}, {"fieldName": "Signature", "accuracy": 0.8}, + {"fieldName": "Subtotal", "accuracy": 1.0}, {"fieldName": "Tax", "accuracy": + 1.0}, {"fieldName": "Total", "accuracy": 1.0}, {"fieldName": "VendorName", + "accuracy": 1.0}, {"fieldName": "Website", "accuracy": 1.0}], "modelId": "eabaee12-a72d-47fc-8ab2-5c8bf91f9657", + "errors": []}]}' + headers: + apim-request-id: f35b4caf-c7c2-451b-9eea-fe4d095fd41e + content-type: application/json; charset=utf-8 + date: Tue, 06 Oct 2020 21:32:36 GMT + strict-transport-security: max-age=31536000; includeSubDomains; preload + transfer-encoding: chunked + x-content-type-options: nosniff + x-envoy-upstream-service-time: '15' + status: + code: 200 + message: OK + url: https://centraluseuap.api.cognitive.microsoft.com/formrecognizer/v2.1-preview.1/custom/models/f53e500e-27fb-45a1-b137-c2cad3cb67b7?includeKeys=true +version: 1 diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model.yaml b/sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_with_display_name.yaml similarity index 100% rename from sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model.yaml rename to sdk/formrecognizer/azure-ai-formrecognizer/tests/recordings/test_compose_model_async.test_compose_model_with_display_name.yaml diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py index 537843a33a1c..59be5cd509bc 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py @@ -18,7 +18,7 @@ class TestTraining(FormRecognizerTest): @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) - def test_compose_model(self, client, container_sas_url): + def test_compose_model_with_display_name(self, client, container_sas_url): poller = client.begin_training(container_sas_url, use_training_labels=True) model_1 = poller.result() @@ -32,6 +32,22 @@ def test_compose_model(self, client, container_sas_url): self.assertEqual(composed_model.display_name, "my composed model") self.assertComposedModelHasValues(composed_model, model_1, model_2) + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + def test_compose_model_no_display_name(self, client, container_sas_url): + + poller = client.begin_training(container_sas_url, use_training_labels=True) + model_1 = poller.result() + + poller = client.begin_training(container_sas_url, use_training_labels=True) + model_2 = poller.result() + + poller = client.begin_create_composed_model([model_1.model_id, model_2.model_id]) + + composed_model = poller.result() + self.assertIsNone(composed_model.display_name) + self.assertComposedModelHasValues(composed_model, model_1, model_2) + @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) def test_compose_model_invalid_unlabeled_models(self, client, container_sas_url): @@ -77,3 +93,11 @@ def test_compose_continuation_token(self, client, container_sas_url): self.assertIsNotNone(result) initial_poller.wait() # necessary so azure-devtools doesn't throw assertion error + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True, client_kwargs={"api_version": "2.0"}) + def test_compose_model_bad_api_version(self, client, container_sas_url): + with pytest.raises(ValueError) as excinfo: + poller = client.begin_create_composed_model(["00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000"]) + result = poller.result() + assert "API version 2.0 does not have operation 'begin_compose_custom_models_async'" in str(excinfo.value) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py index 821bee722d16..8a099fb680fa 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py @@ -20,7 +20,7 @@ class TestTrainingAsync(AsyncFormRecognizerTest): @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) - async def test_compose_model(self, client, container_sas_url): + async def test_compose_model_with_display_name(self, client, container_sas_url): async with client: poller = await client.begin_training(container_sas_url, use_training_labels=True) model_1 = await poller.result() @@ -34,6 +34,22 @@ async def test_compose_model(self, client, container_sas_url): self.assertEqual(composed_model.display_name, "my composed model") self.assertComposedModelHasValues(composed_model, model_1, model_2) + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True) + async def test_compose_model_no_display_name(self, client, container_sas_url): + async with client: + poller = await client.begin_training(container_sas_url, use_training_labels=True) + model_1 = await poller.result() + + poller = await client.begin_training(container_sas_url, use_training_labels=True) + model_2 = await poller.result() + + poller = await client.begin_create_composed_model([model_1.model_id, model_2.model_id]) + + composed_model = await poller.result() + self.assertIsNone(composed_model.display_name) + self.assertComposedModelHasValues(composed_model, model_1, model_2) + @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) async def test_compose_model_invalid_unlabeled_models(self, client, container_sas_url): @@ -79,3 +95,12 @@ async def test_compose_continuation_token(self, client, container_sas_url): self.assertIsNotNone(result) await initial_poller.wait() # necessary so azure-devtools doesn't throw assertion error + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True, client_kwargs={"api_version": "2.0"}) + async def test_compose_model_bad_api_version(self, client, container_sas_url): + async with client: + with pytest.raises(ValueError) as excinfo: + poller = await client.begin_create_composed_model(["00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000"]) + result = await poller.result() + assert "API version 2.0 does not have operation 'begin_compose_custom_models_async'" in str(excinfo.value) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py index bb46dd6214b8..418ac00893f1 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py @@ -257,3 +257,11 @@ def test_training_continuation_token(self, client, container_sas_url): result = poller.result() self.assertIsNotNone(result) initial_poller.wait() # necessary so azure-devtools doesn't throw assertion error + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True, client_kwargs={"api_version": "2.0"}) + def test_training_with_display_name_bad_api_version(self, client, container_sas_url): + with pytest.raises(ValueError) as excinfo: + poller = client.begin_training(training_files_url="url", use_training_labels=True, display_name="not supported in v2.0") + result = poller.result() + assert "'display_name' is only available for API version v2.1-preview and up" in str(excinfo.value) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py index d12a0fabdbf9..cd10f6d3ce19 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py @@ -271,3 +271,11 @@ async def test_training_continuation_token(self, client, container_sas_url): result = await poller.result() self.assertIsNotNone(result) await initial_poller.wait() # necessary so azure-devtools doesn't throw assertion error + + @GlobalFormRecognizerAccountPreparer() + @GlobalClientPreparer(training=True, client_kwargs={"api_version": "2.0"}) + async def test_training_with_display_name_bad_api_version(self, client, container_sas_url): + with pytest.raises(ValueError) as excinfo: + poller = await client.begin_training(training_files_url="url", use_training_labels=True, display_name="not supported in v2.0") + result = await poller.result() + assert "'display_name' is only available for API version v2.1-preview and up" in str(excinfo.value) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py index 627e80f5cd8f..bd885a7fb4b4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py @@ -419,22 +419,28 @@ def assertComposedModelHasValues(self, composed, model_1, model_2): self.assertEqual(doc.errors, composed_doc.errors) for model in model_1.submodels: - if not model_1.display_name: - self.assertEqual(model.form_type, composed.submodels[0].form_type) - self.assertEqual(model.accuracy, composed.submodels[0].accuracy) - self.assertEqual(model.model_id, composed.submodels[0].model_id) + composed_model = composed.submodels[0] + if model.model_id != composed_model.model_id: # order not guaranteed from service + composed_model = composed.submodels[1] + if model_1.display_name is None: + self.assertEqual(model.form_type, composed_model.form_type) + self.assertEqual(model.accuracy, composed_model.accuracy) + self.assertEqual(model.model_id, composed_model.model_id) for field, value in model.fields.items(): - self.assertEqual(value.name, composed.submodels[0].fields[field].name) - self.assertEqual(value.accuracy, composed.submodels[0].fields[field].accuracy) + self.assertEqual(value.name, composed_model.fields[field].name) + self.assertEqual(value.accuracy, composed_model.fields[field].accuracy) for model in model_2.submodels: - if not model_2.display_name: - self.assertEqual(model.form_type, composed.submodels[0].form_type) - self.assertEqual(model.accuracy, composed.submodels[1].accuracy) - self.assertEqual(model.model_id, composed.submodels[1].model_id) + composed_model = composed.submodels[1] + if model.model_id != composed_model.model_id: # order not guaranteed from service + composed_model = composed.submodels[0] + if model_2.display_name is None: + self.assertEqual(model.form_type, composed_model.form_type) + self.assertEqual(model.accuracy, composed_model.accuracy) + self.assertEqual(model.model_id, composed_model.model_id) for field, value in model.fields.items(): - self.assertEqual(value.name, composed.submodels[0].fields[field].name) - self.assertEqual(value.accuracy, composed.submodels[0].fields[field].accuracy) + self.assertEqual(value.name, composed_model.fields[field].name) + self.assertEqual(value.accuracy, composed_model.fields[field].accuracy) class GlobalResourceGroupPreparer(AzureMgmtPreparer): From 5a70733358c18ffe112458d8e47a1621ba6b3acf Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 7 Oct 2020 10:46:06 -0700 Subject: [PATCH 16/18] raise better error for multiapi --- .../formrecognizer/_form_training_client.py | 22 +++++++++++-------- .../aio/_form_training_client_async.py | 21 +++++++++++------- .../tests/test_compose_model.py | 2 +- .../tests/test_compose_model_async.py | 2 +- .../tests/test_training.py | 2 +- .../tests/test_training_async.py | 2 +- 6 files changed, 30 insertions(+), 21 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py index 73e3e8407aa9..a07bc30fce3d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py @@ -131,7 +131,7 @@ def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument cls = kwargs.pop("cls", None) display_name = kwargs.pop("display_name", None) if display_name and self.api_version == "2.0": - raise ValueError("'display_name' is only available for API version v2.1-preview and up") + raise ValueError("'display_name' is only available for API version V2_1_PREVIEW and up") continuation_token = kwargs.pop("continuation_token", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) @@ -417,14 +417,18 @@ def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argum display_name = kwargs.pop("display_name", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) continuation_token = kwargs.pop("continuation_token", None) - - return self._client.begin_compose_custom_models_async( - {"model_ids": model_ids, "model_name": display_name}, - cls=kwargs.pop("cls", _compose_callback), - polling=LROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), - continuation_token=continuation_token, - **kwargs - ) + try: + return self._client.begin_compose_custom_models_async( + {"model_ids": model_ids, "model_name": display_name}, + cls=kwargs.pop("cls", _compose_callback), + polling=LROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), + continuation_token=continuation_token, + **kwargs + ) + except ValueError: + raise ValueError( + "Method 'begin_create_composed_model' is only available for API version V2_1_PREVIEW and up" + ) def get_form_recognizer_client(self, **kwargs): # type: (Any) -> FormRecognizerClient diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py index bb9c0483e45d..851e316b4ca0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py @@ -132,7 +132,7 @@ def callback_v2_1(raw_response, _, headers): # pylint: disable=unused-argument cls = kwargs.pop("cls", None) display_name = kwargs.pop("display_name", None) if display_name and self.api_version == "2.0": - raise ValueError("'display_name' is only available for API version v2.1-preview and up") + raise ValueError("'display_name' is only available for API version V2_1_PREVIEW and up") continuation_token = kwargs.pop("continuation_token", None) polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) @@ -429,13 +429,18 @@ def _compose_callback(raw_response, _, headers): # pylint: disable=unused-argum polling_interval = kwargs.pop("polling_interval", self._client._config.polling_interval) continuation_token = kwargs.pop("continuation_token", None) - return await self._client.begin_compose_custom_models_async( # type: ignore - {"model_ids": model_ids, "model_name": display_name}, - cls=kwargs.pop("cls", _compose_callback), - polling=AsyncLROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), - continuation_token=continuation_token, - **kwargs - ) + try: + return await self._client.begin_compose_custom_models_async( # type: ignore + {"model_ids": model_ids, "model_name": display_name}, + cls=kwargs.pop("cls", _compose_callback), + polling=AsyncLROBasePolling(timeout=polling_interval, lro_algorithms=[TrainingPolling()], **kwargs), + continuation_token=continuation_token, + **kwargs + ) + except ValueError: + raise ValueError( + "Method 'begin_create_composed_model' is only available for API version V2_1_PREVIEW and up" + ) def get_form_recognizer_client(self, **kwargs: Any) -> FormRecognizerClient: """Get an instance of a FormRecognizerClient from FormTrainingClient. diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py index 59be5cd509bc..3121e9a7b97d 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model.py @@ -100,4 +100,4 @@ def test_compose_model_bad_api_version(self, client, container_sas_url): with pytest.raises(ValueError) as excinfo: poller = client.begin_create_composed_model(["00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000"]) result = poller.result() - assert "API version 2.0 does not have operation 'begin_compose_custom_models_async'" in str(excinfo.value) + assert "Method 'begin_create_composed_model' is only available for API version V2_1_PREVIEW and up" in str(excinfo.value) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py index 8a099fb680fa..f032123681a1 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_compose_model_async.py @@ -103,4 +103,4 @@ async def test_compose_model_bad_api_version(self, client, container_sas_url): with pytest.raises(ValueError) as excinfo: poller = await client.begin_create_composed_model(["00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000"]) result = await poller.result() - assert "API version 2.0 does not have operation 'begin_compose_custom_models_async'" in str(excinfo.value) + assert "Method 'begin_create_composed_model' is only available for API version V2_1_PREVIEW and up" in str(excinfo.value) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py index 418ac00893f1..445b3a6914e3 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training.py @@ -264,4 +264,4 @@ def test_training_with_display_name_bad_api_version(self, client, container_sas_ with pytest.raises(ValueError) as excinfo: poller = client.begin_training(training_files_url="url", use_training_labels=True, display_name="not supported in v2.0") result = poller.result() - assert "'display_name' is only available for API version v2.1-preview and up" in str(excinfo.value) + assert "'display_name' is only available for API version V2_1_PREVIEW and up" in str(excinfo.value) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py index cd10f6d3ce19..8ef9d0df9b0f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_training_async.py @@ -278,4 +278,4 @@ async def test_training_with_display_name_bad_api_version(self, client, containe with pytest.raises(ValueError) as excinfo: poller = await client.begin_training(training_files_url="url", use_training_labels=True, display_name="not supported in v2.0") result = await poller.result() - assert "'display_name' is only available for API version v2.1-preview and up" in str(excinfo.value) + assert "'display_name' is only available for API version V2_1_PREVIEW and up" in str(excinfo.value) From 6919fb9e214e4ef99be0e9770a620f9934d15f55 Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Wed, 7 Oct 2020 16:45:01 -0700 Subject: [PATCH 17/18] some docs feedback --- .../azure/ai/formrecognizer/_form_training_client.py | 2 +- .../azure/ai/formrecognizer/_models.py | 4 ++-- .../ai/formrecognizer/aio/_form_training_client_async.py | 2 +- .../async_samples/sample_create_composed_model_async.py | 2 +- .../samples/sample_create_composed_model.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py index a07bc30fce3d..beebceca0a4f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_training_client.py @@ -390,7 +390,7 @@ def begin_create_composed_model( # type: (List[str], Any) -> LROPoller[CustomFormModel] """Creates a composed model from a collection of existing trained models with labels. - :param list[str] model_ids: List of model IDs that were trained with labels. + :param list[str] model_ids: List of model IDs to use in the composed model. :keyword str display_name: Optional model display name. :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. 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 7155562749a5..5f78877e206a 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -598,7 +598,7 @@ class CustomFormModel(object): List of any training errors. :ivar list[~azure.ai.formrecognizer.TrainingDocumentInfo] training_documents: Metadata about each of the documents used to train the model. - :ivar str display_name: Optional user defined model name (max length: 1024). + :ivar str display_name: Optional user defined model name. :ivar properties: Optional model properties. :vartype properties: ~azure.ai.formrecognizer.CustomFormModelProperties .. versionadded:: v2.1-preview @@ -872,7 +872,7 @@ class CustomFormModelInfo(object): Date and time (UTC) when model training was started. :ivar ~datetime.datetime training_completed_on: Date and time (UTC) when model training completed. - :ivar display_name: Optional user defined model name (max length: 1024). + :ivar display_name: Optional user defined model name. :vartype display_name: str :ivar properties: Optional model properties. :vartype properties: ~azure.ai.formrecognizer.CustomFormModelProperties diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py index 851e316b4ca0..943f52f6b2d2 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_training_client_async.py @@ -401,7 +401,7 @@ async def begin_create_composed_model( ) -> AsyncLROPoller[CustomFormModel]: """Creates a composed model from a collection of existing trained models with labels. - :param list[str] model_ids: List of model IDs that were trained with labels. + :param list[str] model_ids: List of model IDs to use in the composed model. :keyword str display_name: Optional model display name. :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py index 43a4fb795419..f019899d4d28 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/async_samples/sample_create_composed_model_async.py @@ -83,7 +83,7 @@ async def create_composed_model_async(self): ) model = await poller.result() - print("Purchase Order Model Info:") + print("Office Supplies Composed Model Info:") print("Model ID: {}".format(model.model_id)) print("Model display name: {}".format(model.display_name)) print("Is this a composed model?: {}".format(model.properties.is_composed_model)) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py index ce28d9cdedc2..ab9b1c5cb8d2 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_create_composed_model.py @@ -82,7 +82,7 @@ def create_composed_model(self): ) model = poller.result() - print("Purchase Order Model Info:") + print("Office Supplies Composed Model Info:") print("Model ID: {}".format(model.model_id)) print("Model display name: {}".format(model.display_name)) print("Is this a composed model?: {}".format(model.properties.is_composed_model)) From f63c6d73697a2cbc13c19696ff752fe07e0dabfb Mon Sep 17 00:00:00 2001 From: Krista Pratico Date: Thu, 8 Oct 2020 11:43:35 -0700 Subject: [PATCH 18/18] testing feedback --- .../tests/test_custom_forms.py | 46 ++++-------------- .../tests/test_custom_forms_async.py | 47 ++++--------------- .../tests/test_custom_forms_from_url.py | 47 ++++--------------- .../tests/test_custom_forms_from_url_async.py | 46 ++++-------------- .../azure-ai-formrecognizer/tests/testcase.py | 21 +++++++++ 5 files changed, 53 insertions(+), 154 deletions(-) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py index 51a4730cded6..a36bc35dff12 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms.py @@ -138,15 +138,7 @@ def test_custom_form_unlabeled(self, client, container_sas_url): form = poller.result() self.assertEqual(form[0].form_type, "form-0") - self.assertIsNone(form[0].form_type_confidence) - self.assertIsNotNone(form[0].model_id) - self.assertFormPagesHasValues(form[0].pages) - for label, field in form[0].fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.label_data.text) + self.assertUnlabeledRecognizedFormHasValues(form[0], model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage=True) @@ -168,15 +160,7 @@ def test_custom_form_multipage_unlabeled(self, client, container_sas_url): if form.form_type is None: continue # blank page self.assertEqual(form.form_type, "form-0") - self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) - self.assertFormPagesHasValues(form.pages) - for label, field in form.fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.label_data.text) + self.assertUnlabeledRecognizedFormHasValues(form, model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) @@ -197,14 +181,7 @@ def test_custom_form_labeled(self, client, container_sas_url): form = poller.result() self.assertEqual(form[0].form_type, "custom:labeled") - self.assertEqual(form[0].form_type_confidence, 1.0) - self.assertIsNotNone(form[0].model_id) - self.assertFormPagesHasValues(form[0].pages) - for label, field in form[0].fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.value_data.bounding_box) + self.assertLabeledRecognizedFormHasValues(form[0], model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage=True) @@ -229,14 +206,7 @@ def test_custom_form_multipage_labeled(self, client, container_sas_url): for form in forms: self.assertEqual(form.form_type, "custom:"+model.model_id) - self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) - self.assertFormPagesHasValues(form.pages) - for label, field in form.fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.value_data.bounding_box) + self.assertLabeledRecognizedFormHasValues(form, model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) @@ -314,7 +284,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @@ -394,7 +364,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -458,7 +428,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @@ -499,5 +469,5 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py index dbf440ae5c0a..1ef06fbd6a70 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_async.py @@ -156,15 +156,7 @@ async def test_custom_form_unlabeled(self, client, container_sas_url): poller = await fr_client.begin_recognize_custom_forms(model.model_id, myfile, content_type=FormContentType.IMAGE_JPEG) form = await poller.result() self.assertEqual(form[0].form_type, "form-0") - self.assertIsNone(form[0].form_type_confidence) - self.assertIsNotNone(form[0].model_id) - self.assertFormPagesHasValues(form[0].pages) - for label, field in form[0].fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.label_data.text) + self.assertUnlabeledRecognizedFormHasValues(form[0], model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage=True) @@ -189,15 +181,7 @@ async def test_custom_form_multipage_unlabeled(self, client, container_sas_url): if form.form_type is None: continue # blank page self.assertEqual(form.form_type, "form-0") - self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) - self.assertFormPagesHasValues(form.pages) - for label, field in form.fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.label_data.text) + self.assertUnlabeledRecognizedFormHasValues(form, model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) @@ -216,14 +200,7 @@ async def test_custom_form_labeled(self, client, container_sas_url): form = await poller.result() self.assertEqual(form[0].form_type, "custom:labeled") - self.assertEqual(form[0].form_type_confidence, 1.0) - self.assertIsNotNone(form[0].model_id) - self.assertFormPagesHasValues(form[0].pages) - for label, field in form[0].fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.value_data.bounding_box) + self.assertLabeledRecognizedFormHasValues(form[0], model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage=True) @@ -249,15 +226,7 @@ async def test_custom_form_multipage_labeled(self, client, container_sas_url): for form in forms: self.assertEqual(form.form_type, "custom:"+model.model_id) - self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) - self.assertFormPagesHasValues(form.pages) - for label, field in form.fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.value_data.bounding_box) - + self.assertLabeledRecognizedFormHasValues(form, model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) @@ -340,7 +309,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @@ -427,7 +396,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -496,7 +465,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @@ -539,5 +508,5 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py index be40cd40130b..b310c6188bf5 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url.py @@ -102,15 +102,7 @@ def test_custom_form_unlabeled(self, client, container_sas_url): form = poller.result() self.assertEqual(form[0].form_type, "form-0") - self.assertIsNone(form[0].form_type_confidence) - self.assertIsNotNone(form[0].model_id) - self.assertFormPagesHasValues(form[0].pages) - for label, field in form[0].fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.label_data.text) + self.assertUnlabeledRecognizedFormHasValues(form[0], model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage=True, blob_sas_url=True) @@ -130,15 +122,7 @@ def test_form_multipage_unlabeled(self, client, container_sas_url, blob_sas_url) if form.form_type is None: continue # blank page self.assertEqual(form.form_type, "form-0") - self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) - self.assertFormPagesHasValues(form.pages) - for label, field in form.fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.label_data.text) + self.assertUnlabeledRecognizedFormHasValues(form, model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) @@ -152,14 +136,7 @@ def test_custom_form_labeled(self, client, container_sas_url): form = poller.result() self.assertEqual(form[0].form_type, "custom:labeled") - self.assertEqual(form[0].form_type_confidence, 1.0) - self.assertIsNotNone(form[0].model_id) - self.assertFormPagesHasValues(form[0].pages) - for label, field in form[0].fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.value_data.bounding_box) + self.assertLabeledRecognizedFormHasValues(form[0], model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage=True, blob_sas_url=True) @@ -180,15 +157,7 @@ def test_form_multipage_labeled(self, client, container_sas_url, blob_sas_url): for form in forms: self.assertEqual(form.form_type, "custom:"+model.model_id) - self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) - self.assertFormPagesHasValues(form.pages) - for label, field in form.fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.value_data.bounding_box) - + self.assertLabeledRecognizedFormHasValues(form, model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) @@ -260,7 +229,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @@ -335,7 +304,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -396,7 +365,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @@ -434,5 +403,5 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py index 86bc51ee4f92..d6f7a748612f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_custom_forms_from_url_async.py @@ -119,15 +119,7 @@ async def test_form_unlabeled(self, client, container_sas_url): form = await poller.result() self.assertEqual(form[0].form_type, "form-0") - self.assertIsNone(form[0].form_type_confidence) - self.assertIsNotNone(form[0].model_id) - self.assertFormPagesHasValues(form[0].pages) - for label, field in form[0].fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.label_data.text) + self.assertUnlabeledRecognizedFormHasValues(form[0], model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage=True, blob_sas_url=True) @@ -149,15 +141,7 @@ async def test_custom_form_multipage_unlabeled(self, client, container_sas_url, if form.form_type is None: continue # blank page self.assertEqual(form.form_type, "form-0") - self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) - self.assertFormPagesHasValues(form.pages) - for label, field in form.fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.label_data.text) + self.assertUnlabeledRecognizedFormHasValues(form, model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) @@ -173,14 +157,7 @@ async def test_form_labeled(self, client, container_sas_url): form = await poller.result() self.assertEqual(form[0].form_type, "custom:labeled") - self.assertEqual(form[0].form_type_confidence, 1.0) - self.assertIsNotNone(form[0].model_id) - self.assertFormPagesHasValues(form[0].pages) - for label, field in form[0].fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.value_data.bounding_box) + self.assertLabeledRecognizedFormHasValues(form[0], model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True, multipage=True, blob_sas_url=True) @@ -203,14 +180,7 @@ async def test_form_multipage_labeled(self, client, container_sas_url, blob_sas_ for form in forms: self.assertEqual(form.form_type, "custom:"+model.model_id) - self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) - self.assertFormPagesHasValues(form.pages) - for label, field in form.fields.items(): - self.assertIsNotNone(field.confidence) - self.assertIsNotNone(field.name) - self.assertIsNotNone(field.value_data.text) - self.assertIsNotNone(field.value_data.bounding_box) + self.assertLabeledRecognizedFormHasValues(form, model) @GlobalFormRecognizerAccountPreparer() @GlobalClientPreparer(training=True) @@ -287,7 +257,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @@ -367,7 +337,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) @GlobalFormRecognizerAccountPreparer() @@ -430,7 +400,7 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.first_page_number, actual.page) self.assertEqual(form.page_range.last_page_number, actual.page) self.assertIsNone(form.form_type_confidence) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertUnlabeledFormFieldDictTransformCorrect(form.fields, actual.key_value_pairs, read_results) @GlobalFormRecognizerAccountPreparer() @@ -470,5 +440,5 @@ def callback(raw_response, _, headers): self.assertEqual(form.page_range.last_page_number, actual.page_range[1]) self.assertEqual(form.form_type, "custom:"+model.model_id) self.assertEqual(form.form_type_confidence, 1.0) - self.assertIsNotNone(form.model_id) + self.assertEqual(form.model_id, model.model_id) self.assertLabeledFormFieldDictTransformCorrect(form.fields, actual.fields, read_results) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py index bd885a7fb4b4..b61420537778 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/testcase.py @@ -442,6 +442,27 @@ def assertComposedModelHasValues(self, composed, model_1, model_2): self.assertEqual(value.name, composed_model.fields[field].name) self.assertEqual(value.accuracy, composed_model.fields[field].accuracy) + def assertUnlabeledRecognizedFormHasValues(self, form, model): + self.assertIsNone(form.form_type_confidence) + self.assertEqual(form.model_id, model.model_id) + self.assertFormPagesHasValues(form.pages) + for label, field in form.fields.items(): + self.assertIsNotNone(field.confidence) + self.assertIsNotNone(field.name) + self.assertIsNotNone(field.value) + self.assertIsNotNone(field.value_data.text) + self.assertIsNotNone(field.label_data.text) + + def assertLabeledRecognizedFormHasValues(self, form, model): + self.assertEqual(form.form_type_confidence, 1.0) + self.assertEqual(form.model_id, model.model_id) + self.assertFormPagesHasValues(form.pages) + for label, field in form.fields.items(): + self.assertIsNotNone(field.confidence) + self.assertIsNotNone(field.name) + self.assertIsNotNone(field.value_data.text) + self.assertIsNotNone(field.value_data.bounding_box) + class GlobalResourceGroupPreparer(AzureMgmtPreparer): def __init__(self):