diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/README.md b/sdk/formrecognizer/azure-ai-formrecognizer/README.md index bbb28f760a58..9c0ddc24d9df 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/README.md +++ b/sdk/formrecognizer/azure-ai-formrecognizer/README.md @@ -34,7 +34,7 @@ This table shows the relationship between SDK versions and supported API version |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.0b4 - Latest release (beta)| 2.0, 2.1-preview.3 +|3.1.0b5 - Latest release (beta)| 2.0, 2.1-preview.3, 2.1 #### Create a Form Recognizer resource diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_api_versions.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_api_versions.py index 1c4cb7225907..29380a0f0cf2 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_api_versions.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_api_versions.py @@ -11,6 +11,7 @@ class FormRecognizerApiVersion(str, Enum): #: This is the default version V2_1_PREVIEW = "2.1-preview.3" + V2_1 = "2.1" V2_0 = "2.0" diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_recognizer_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_recognizer_client.py index 149b4e4deb70..a8b90ea04038 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_recognizer_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_recognizer_client.py @@ -127,7 +127,7 @@ def begin_recognize_receipts(self, receipt, **kwargs): # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if locale: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"locale": locale}) else: raise ValueError( @@ -136,7 +136,7 @@ def begin_recognize_receipts(self, receipt, **kwargs): # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -198,7 +198,7 @@ def begin_recognize_receipts_from_url(self, receipt_url, **kwargs): # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if locale: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"locale": locale}) else: raise ValueError( @@ -207,7 +207,7 @@ def begin_recognize_receipts_from_url(self, receipt_url, **kwargs): # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -644,7 +644,7 @@ def begin_recognize_content(self, form, **kwargs): # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -652,7 +652,7 @@ def begin_recognize_content(self, form, **kwargs): ) if reading_order: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"reading_order": reading_order}) else: raise ValueError( @@ -660,7 +660,7 @@ def begin_recognize_content(self, form, **kwargs): ) if language: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"language": language}) else: raise ValueError( @@ -714,7 +714,7 @@ def begin_recognize_content_from_url(self, form_url, **kwargs): # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -722,7 +722,7 @@ def begin_recognize_content_from_url(self, form_url, **kwargs): ) if reading_order: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"reading_order": reading_order}) else: raise ValueError( @@ -730,7 +730,7 @@ def begin_recognize_content_from_url(self, form_url, **kwargs): ) if language: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"language": language}) else: raise ValueError( @@ -817,7 +817,7 @@ def analyze_callback( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -886,7 +886,7 @@ def analyze_callback( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/_form_recognizer_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/_form_recognizer_client.py index c0d28163f74b..fafcbdb9436f 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/_form_recognizer_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/_form_recognizer_client.py @@ -74,6 +74,8 @@ def __init__( ): if api_version == '2.0': base_url = '{endpoint}/formrecognizer/v2.0' + elif api_version == '2.1': + base_url = '{endpoint}/formrecognizer/v2.1' elif api_version == '2.1-preview.3': base_url = '{endpoint}/formrecognizer/v2.1-preview.3' else: @@ -94,11 +96,15 @@ def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: * 2.0: :mod:`v2_0.models` + * 2.1: :mod:`v2_1.models` * 2.1-preview.3: :mod:`v2_1_preview_3.models` """ if api_version == '2.0': from .v2_0 import models return models + elif api_version == '2.1': + from .v2_1 import models + return models elif api_version == '2.1-preview.3': from .v2_1_preview_3 import models return models diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/_operations_mixin.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/_operations_mixin.py index 4424212191c3..3f5104d48717 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/_operations_mixin.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/_operations_mixin.py @@ -56,8 +56,8 @@ def begin_analyze_business_card_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -65,7 +65,9 @@ def begin_analyze_business_card_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_analyze_business_card_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_analyze_business_card_async'".format(api_version)) @@ -103,8 +105,8 @@ def begin_analyze_id_document_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -112,7 +114,9 @@ def begin_analyze_id_document_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_analyze_id_document_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_analyze_id_document_async'".format(api_version)) @@ -154,8 +158,8 @@ def begin_analyze_invoice_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -163,7 +167,9 @@ def begin_analyze_invoice_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_analyze_invoice_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_analyze_invoice_async'".format(api_version)) @@ -222,8 +228,8 @@ def begin_analyze_layout_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -233,6 +239,8 @@ def begin_analyze_layout_async( api_version = self._get_api_version('begin_analyze_layout_async') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -246,6 +254,8 @@ def begin_analyze_layout_async( # FIXME: this is handwritten if api_version == '2.0': return mixin_instance.begin_analyze_layout_async(file_stream, **kwargs) + elif api_version == '2.1': + return mixin_instance.begin_analyze_layout_async(pages, language, reading_order, file_stream, **kwargs) elif api_version == '2.1-preview.3': return mixin_instance.begin_analyze_layout_async(pages, language, reading_order, file_stream, **kwargs) @@ -279,8 +289,8 @@ def begin_analyze_receipt_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -290,6 +300,8 @@ def begin_analyze_receipt_async( api_version = self._get_api_version('begin_analyze_receipt_async') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -303,6 +315,8 @@ def begin_analyze_receipt_async( # FIXME: this is handwritten if api_version == '2.0': return mixin_instance.begin_analyze_receipt_async(include_text_details, file_stream, **kwargs) + elif api_version == '2.1': + return mixin_instance.begin_analyze_receipt_async(include_text_details, locale, pages, file_stream, **kwargs) elif api_version == '2.1-preview.3': return mixin_instance.begin_analyze_receipt_async(include_text_details, locale, pages, file_stream, **kwargs) @@ -335,8 +349,8 @@ def begin_analyze_with_custom_model( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -346,6 +360,8 @@ def begin_analyze_with_custom_model( api_version = self._get_api_version('begin_analyze_with_custom_model') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -359,6 +375,8 @@ def begin_analyze_with_custom_model( # FIXME: this is handwritten if api_version == '2.0': return mixin_instance.begin_analyze_with_custom_model(model_id, include_text_details, file_stream, **kwargs) + elif api_version == '2.1': + return mixin_instance.begin_analyze_with_custom_model(model_id, include_text_details, pages, file_stream, **kwargs) elif api_version == '2.1-preview.3': return mixin_instance.begin_analyze_with_custom_model(model_id, include_text_details, pages, file_stream, **kwargs) @@ -377,8 +395,8 @@ def begin_compose_custom_models_async( :type compose_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.ComposeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -386,7 +404,9 @@ def begin_compose_custom_models_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_compose_custom_models_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_compose_custom_models_async'".format(api_version)) @@ -415,8 +435,8 @@ def begin_copy_custom_model( :type copy_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.CopyRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -426,6 +446,8 @@ def begin_copy_custom_model( api_version = self._get_api_version('begin_copy_custom_model') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -459,8 +481,8 @@ def begin_train_custom_model_async( :type train_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.TrainRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -468,7 +490,9 @@ def begin_train_custom_model_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_train_custom_model_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_train_custom_model_async'".format(api_version)) @@ -500,6 +524,8 @@ def delete_custom_model( api_version = self._get_api_version('delete_custom_model') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -528,6 +554,8 @@ def generate_model_copy_authorization( api_version = self._get_api_version('generate_model_copy_authorization') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -557,7 +585,9 @@ def get_analyze_business_card_result( :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('get_analyze_business_card_result') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'get_analyze_business_card_result'".format(api_version)) @@ -591,6 +621,8 @@ def get_analyze_form_result( api_version = self._get_api_version('get_analyze_form_result') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -620,7 +652,9 @@ def get_analyze_id_document_result( :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('get_analyze_id_document_result') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'get_analyze_id_document_result'".format(api_version)) @@ -649,7 +683,9 @@ def get_analyze_invoice_result( :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('get_analyze_invoice_result') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'get_analyze_invoice_result'".format(api_version)) @@ -680,6 +716,8 @@ def get_analyze_layout_result( api_version = self._get_api_version('get_analyze_layout_result') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -711,6 +749,8 @@ def get_analyze_receipt_result( api_version = self._get_api_version('get_analyze_receipt_result') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -745,6 +785,8 @@ def get_custom_model( api_version = self._get_api_version('get_custom_model') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -779,6 +821,8 @@ def get_custom_model_copy_result( api_version = self._get_api_version('get_custom_model_copy_result') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -807,6 +851,8 @@ def get_custom_models( api_version = self._get_api_version('get_custom_models') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -835,6 +881,8 @@ def list_custom_models( api_version = self._get_api_version('list_custom_models') if api_version == '2.0': from .v2_0.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from .v2_1.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from .v2_1_preview_3.operations import FormRecognizerClientOperationsMixin as OperationClass else: diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/aio/_form_recognizer_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/aio/_form_recognizer_client.py index cf8e61eb0f41..e393731f69a0 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/aio/_form_recognizer_client.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/aio/_form_recognizer_client.py @@ -72,6 +72,8 @@ def __init__( ) -> None: if api_version == '2.0': base_url = '{endpoint}/formrecognizer/v2.0' + elif api_version == '2.1': + base_url = '{endpoint}/formrecognizer/v2.1' elif api_version == '2.1-preview.3': base_url = '{endpoint}/formrecognizer/v2.1-preview.3' else: @@ -92,11 +94,15 @@ def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: * 2.0: :mod:`v2_0.models` + * 2.1: :mod:`v2_1.models` * 2.1-preview.3: :mod:`v2_1_preview_3.models` """ if api_version == '2.0': from ..v2_0 import models return models + elif api_version == '2.1': + from ..v2_1 import models + return models elif api_version == '2.1-preview.3': from ..v2_1_preview_3 import models return models diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/aio/_operations_mixin.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/aio/_operations_mixin.py index 0742416eb59d..cee54d95b116 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/aio/_operations_mixin.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/aio/_operations_mixin.py @@ -52,8 +52,8 @@ async def begin_analyze_business_card_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -61,7 +61,9 @@ async def begin_analyze_business_card_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_analyze_business_card_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_analyze_business_card_async'".format(api_version)) @@ -99,8 +101,8 @@ async def begin_analyze_id_document_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -108,7 +110,9 @@ async def begin_analyze_id_document_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_analyze_id_document_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_analyze_id_document_async'".format(api_version)) @@ -150,8 +154,8 @@ async def begin_analyze_invoice_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -159,7 +163,9 @@ async def begin_analyze_invoice_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_analyze_invoice_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_analyze_invoice_async'".format(api_version)) @@ -218,8 +224,8 @@ async def begin_analyze_layout_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -229,6 +235,8 @@ async def begin_analyze_layout_async( api_version = self._get_api_version('begin_analyze_layout_async') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -242,6 +250,8 @@ async def begin_analyze_layout_async( # FIXME: this is handwritten if api_version == '2.0': return await mixin_instance.begin_analyze_layout_async(file_stream, **kwargs) + elif api_version == '2.1': + return await mixin_instance.begin_analyze_layout_async(pages, language, reading_order, file_stream, **kwargs) elif api_version == '2.1-preview.3': return await mixin_instance.begin_analyze_layout_async(pages, language, reading_order, file_stream, **kwargs) @@ -275,8 +285,8 @@ async def begin_analyze_receipt_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -286,6 +296,8 @@ async def begin_analyze_receipt_async( api_version = self._get_api_version('begin_analyze_receipt_async') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -299,7 +311,9 @@ async def begin_analyze_receipt_async( # FIXME: this is handwritten if api_version == '2.0': return await mixin_instance.begin_analyze_receipt_async(include_text_details, file_stream, **kwargs) - elif api_version == '2.1-preview.3': + elif api_version == '2.1': + return await mixin_instance.begin_analyze_receipt_async(include_text_details, locale, pages, file_stream, **kwargs) + elif api_version == "2.1-preview.3": return await mixin_instance.begin_analyze_receipt_async(include_text_details, locale, pages, file_stream, **kwargs) async def begin_analyze_with_custom_model( @@ -331,8 +345,8 @@ async def begin_analyze_with_custom_model( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -342,6 +356,8 @@ async def begin_analyze_with_custom_model( api_version = self._get_api_version('begin_analyze_with_custom_model') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -355,6 +371,8 @@ async def begin_analyze_with_custom_model( # FIXME: this is handwritten if api_version == '2.0': return await mixin_instance.begin_analyze_with_custom_model(model_id, include_text_details, file_stream, **kwargs) + elif api_version == '2.1': + return await mixin_instance.begin_analyze_with_custom_model(model_id, include_text_details, pages, file_stream, **kwargs) elif api_version == '2.1-preview.3': return await mixin_instance.begin_analyze_with_custom_model(model_id, include_text_details, pages, file_stream, **kwargs) @@ -373,8 +391,8 @@ async def begin_compose_custom_models_async( :type compose_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.ComposeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -382,7 +400,9 @@ async def begin_compose_custom_models_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_compose_custom_models_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_compose_custom_models_async'".format(api_version)) @@ -411,8 +431,8 @@ async def begin_copy_custom_model( :type copy_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.CopyRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -422,6 +442,8 @@ async def begin_copy_custom_model( api_version = self._get_api_version('begin_copy_custom_model') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -455,8 +477,8 @@ async def begin_train_custom_model_async( :type train_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.TrainRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -464,7 +486,9 @@ async def begin_train_custom_model_async( :raises ~azure.core.exceptions.HttpResponseError: """ api_version = self._get_api_version('begin_train_custom_model_async') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'begin_train_custom_model_async'".format(api_version)) @@ -496,6 +520,8 @@ async def delete_custom_model( api_version = self._get_api_version('delete_custom_model') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -524,6 +550,8 @@ async def generate_model_copy_authorization( api_version = self._get_api_version('generate_model_copy_authorization') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -553,7 +581,9 @@ async def get_analyze_business_card_result( :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('get_analyze_business_card_result') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'get_analyze_business_card_result'".format(api_version)) @@ -587,6 +617,8 @@ async def get_analyze_form_result( api_version = self._get_api_version('get_analyze_form_result') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -616,7 +648,9 @@ async def get_analyze_id_document_result( :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('get_analyze_id_document_result') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'get_analyze_id_document_result'".format(api_version)) @@ -645,7 +679,9 @@ async def get_analyze_invoice_result( :raises: ~azure.core.exceptions.HttpResponseError """ api_version = self._get_api_version('get_analyze_invoice_result') - if api_version == '2.1-preview.3': + if api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: raise ValueError("API version {} does not have operation 'get_analyze_invoice_result'".format(api_version)) @@ -676,6 +712,8 @@ async def get_analyze_layout_result( api_version = self._get_api_version('get_analyze_layout_result') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -707,6 +745,8 @@ async def get_analyze_receipt_result( api_version = self._get_api_version('get_analyze_receipt_result') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -741,6 +781,8 @@ async def get_custom_model( api_version = self._get_api_version('get_custom_model') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -775,6 +817,8 @@ async def get_custom_model_copy_result( api_version = self._get_api_version('get_custom_model_copy_result') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -803,6 +847,8 @@ async def get_custom_models( api_version = self._get_api_version('get_custom_models') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: @@ -831,6 +877,8 @@ def list_custom_models( api_version = self._get_api_version('list_custom_models') if api_version == '2.0': from ..v2_0.aio.operations import FormRecognizerClientOperationsMixin as OperationClass + elif api_version == '2.1': + from ..v2_1.aio.operations import FormRecognizerClientOperationsMixin as OperationClass elif api_version == '2.1-preview.3': from ..v2_1_preview_3.aio.operations import FormRecognizerClientOperationsMixin as OperationClass else: diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/_metadata.json b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/_metadata.json index 9eaedd177725..cbdb78002793 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/_metadata.json +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/_metadata.json @@ -142,12 +142,12 @@ "begin_analyze_with_custom_model" : { "sync": { "signature": "def begin_analyze_with_custom_model(\n self,\n model_id, # type: str\n include_text_details=False, # type: Optional[bool]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or\n\u0027image/tiff\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or\n\u0027image/tiff\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_analyze_with_custom_model(\n self,\n model_id: str,\n include_text_details: Optional[bool] = False,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or\n\u0027image/tiff\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or\n\u0027image/tiff\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "model_id, include_text_details, file_stream" }, @@ -178,12 +178,12 @@ "begin_copy_custom_model" : { "sync": { "signature": "def begin_copy_custom_model(\n self,\n model_id, # type: str\n copy_request, # type: \"_models.CopyRequest\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_0.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_0.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_copy_custom_model(\n self,\n model_id: str,\n copy_request: \"_models.CopyRequest\",\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_0.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_0.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "model_id, copy_request" }, @@ -226,12 +226,12 @@ "begin_analyze_receipt_async" : { "sync": { "signature": "def begin_analyze_receipt_async(\n self,\n include_text_details=False, # type: Optional[bool]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or\n\u0027image/tiff\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or\n\u0027image/tiff\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_analyze_receipt_async(\n self,\n include_text_details: Optional[bool] = False,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or\n\u0027image/tiff\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or\n\u0027image/tiff\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "include_text_details, file_stream" }, @@ -262,12 +262,12 @@ "begin_analyze_layout_async" : { "sync": { "signature": "def begin_analyze_layout_async(\n self,\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or \u0027image/tiff\u0027.\nAlternatively, use \u0027application/json\u0027 type to specify the location (Uri or local path) of the\ndocument to be analyzed.\n\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or \u0027image/tiff\u0027.\nAlternatively, use \u0027application/json\u0027 type to specify the location (Uri or local path) of the\ndocument to be analyzed.\n\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_analyze_layout_async(\n self,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or \u0027image/tiff\u0027.\nAlternatively, use \u0027application/json\u0027 type to specify the location (Uri or local path) of the\ndocument to be analyzed.\n\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027 or \u0027image/tiff\u0027.\nAlternatively, use \u0027application/json\u0027 type to specify the location (Uri or local path) of the\ndocument to be analyzed.\n\n:param file_stream: .json, .pdf, .jpg, .png or .tiff type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_0.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "file_stream" }, diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/aio/operations/_form_recognizer_client_operations.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/aio/operations/_form_recognizer_client_operations.py index 5dfc78af8182..c8a35c4cc3a5 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/aio/operations/_form_recognizer_client_operations.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/aio/operations/_form_recognizer_client_operations.py @@ -290,15 +290,15 @@ async def begin_analyze_with_custom_model( Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -466,15 +466,15 @@ async def begin_copy_custom_model( :type copy_request: ~azure.ai.formrecognizer.v2_0.models.CopyRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -710,15 +710,15 @@ async def begin_analyze_receipt_async( Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -890,15 +890,15 @@ async def begin_analyze_layout_async( Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/operations/_form_recognizer_client_operations.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/operations/_form_recognizer_client_operations.py index 4270e2f1eaee..cd0461e24153 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/operations/_form_recognizer_client_operations.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_0/operations/_form_recognizer_client_operations.py @@ -299,15 +299,15 @@ def begin_analyze_with_custom_model( Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -478,15 +478,15 @@ def begin_copy_custom_model( :type copy_request: ~azure.ai.formrecognizer.v2_0.models.CopyRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -726,15 +726,15 @@ def begin_analyze_receipt_async( Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -909,15 +909,15 @@ def begin_analyze_layout_async( Allowed values are: "application/pdf", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/__init__.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/__init__.py new file mode 100644 index 000000000000..d4be1e681b60 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/__init__.py @@ -0,0 +1,16 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._form_recognizer_client import FormRecognizerClient +__all__ = ['FormRecognizerClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/_configuration.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/_configuration.py new file mode 100644 index 000000000000..e835a903b4f3 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/_configuration.py @@ -0,0 +1,68 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class FormRecognizerClientConfiguration(Configuration): + """Configuration for FormRecognizerClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). + :type endpoint: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + endpoint, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + super(FormRecognizerClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.endpoint = endpoint + self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'ai-formrecognizer/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/_form_recognizer_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/_form_recognizer_client.py new file mode 100644 index 000000000000..8c5339c74528 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/_form_recognizer_client.py @@ -0,0 +1,82 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import FormRecognizerClientConfiguration +from .operations import FormRecognizerClientOperationsMixin +from . import models + + +class FormRecognizerClient(FormRecognizerClientOperationsMixin): + """Extracts information from forms and images into structured data. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). + :type endpoint: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + endpoint, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + base_url = '{endpoint}/formrecognizer/v2.1' + self._config = FormRecognizerClientConfiguration(credential, endpoint, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> FormRecognizerClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/_metadata.json b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/_metadata.json new file mode 100644 index 000000000000..3b8f7a4caf5d --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/_metadata.json @@ -0,0 +1,456 @@ +{ + "chosen_version": "2.1", + "total_api_version_list": ["2.1"], + "client": { + "name": "FormRecognizerClient", + "filename": "_form_recognizer_client", + "description": "Extracts information from forms and images into structured data.", + "base_url": null, + "custom_base_url": "\u0027{endpoint}/formrecognizer/v2.1\u0027", + "azure_arm": false, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"FormRecognizerClientConfiguration\"], \"._operations_mixin\": [\"FormRecognizerClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"FormRecognizerClientConfiguration\"], \"._operations_mixin\": [\"FormRecognizerClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "endpoint": { + "signature": "endpoint, # type: str", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "endpoint": { + "signature": "endpoint: str,", + "description": "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, endpoint", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://cognitiveservices.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + }, + "operation_mixins": { + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.polling\": [\"LROPoller\", \"NoPolling\", \"PollingMethod\"], \"azure.core.polling.base_polling\": [\"LROBasePolling\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"IO\", \"Iterable\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.polling\": [\"AsyncLROPoller\", \"AsyncNoPolling\", \"AsyncPollingMethod\"], \"azure.core.polling.async_base_polling\": [\"AsyncLROBasePolling\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"IO\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "operations": { + "_train_custom_model_async_initial" : { + "sync": { + "signature": "def _train_custom_model_async_initial(\n self,\n train_request, # type: \"_models.TrainRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param train_request: Training request parameters.\n:type train_request: ~azure.ai.formrecognizer.v2_1.models.TrainRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _train_custom_model_async_initial(\n self,\n train_request: \"_models.TrainRequest\",\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param train_request: Training request parameters.\n:type train_request: ~azure.ai.formrecognizer.v2_1.models.TrainRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "train_request" + }, + "begin_train_custom_model_async" : { + "sync": { + "signature": "def begin_train_custom_model_async(\n self,\n train_request, # type: \"_models.TrainRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Train Custom Model.\n\nCreate and train a custom model. The request must include a source parameter that is either an\nexternally accessible Azure storage blob container Uri (preferably a Shared Access Signature\nUri) or valid path to a data folder in a locally mounted drive. When local paths are specified,\nthey must follow the Linux/Unix path format and be an absolute path rooted to the input mount\nconfiguration setting value e.g., if \u0027{Mounts:Input}\u0027 configuration setting value is \u0027/input\u0027\nthen a valid source path would be \u0027/input/contosodataset\u0027. All data to be trained is expected\nto be under the source folder or sub folders under it. Models are trained using documents that\nare of the following content type - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Other type of content is ignored.\n\n:param train_request: Training request parameters.\n:type train_request: ~azure.ai.formrecognizer.v2_1.models.TrainRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_train_custom_model_async(\n self,\n train_request: \"_models.TrainRequest\",\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Train Custom Model.\n\nCreate and train a custom model. The request must include a source parameter that is either an\nexternally accessible Azure storage blob container Uri (preferably a Shared Access Signature\nUri) or valid path to a data folder in a locally mounted drive. When local paths are specified,\nthey must follow the Linux/Unix path format and be an absolute path rooted to the input mount\nconfiguration setting value e.g., if \u0027{Mounts:Input}\u0027 configuration setting value is \u0027/input\u0027\nthen a valid source path would be \u0027/input/contosodataset\u0027. All data to be trained is expected\nto be under the source folder or sub folders under it. Models are trained using documents that\nare of the following content type - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Other type of content is ignored.\n\n:param train_request: Training request parameters.\n:type train_request: ~azure.ai.formrecognizer.v2_1.models.TrainRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "train_request" + }, + "get_custom_model" : { + "sync": { + "signature": "def get_custom_model(\n self,\n model_id, # type: str\n include_keys=False, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get Custom Model.\n\nGet detailed information about a custom model.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_keys: Include list of extracted keys in model information.\n:type include_keys: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Model, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.Model\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_custom_model(\n self,\n model_id: str,\n include_keys: Optional[bool] = False,\n **kwargs\n) -\u003e \"_models.Model\":\n", + "doc": "\"\"\"Get Custom Model.\n\nGet detailed information about a custom model.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_keys: Include list of extracted keys in model information.\n:type include_keys: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Model, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.Model\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "model_id, include_keys" + }, + "delete_custom_model" : { + "sync": { + "signature": "def delete_custom_model(\n self,\n model_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Delete Custom Model.\n\nMark model for deletion. Model artifacts will be permanently removed within a predetermined\nperiod.\n\n:param model_id: Model identifier.\n:type model_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_custom_model(\n self,\n model_id: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Delete Custom Model.\n\nMark model for deletion. Model artifacts will be permanently removed within a predetermined\nperiod.\n\n:param model_id: Model identifier.\n:type model_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "model_id" + }, + "_analyze_with_custom_model_initial" : { + "sync": { + "signature": "def _analyze_with_custom_model_initial(\n self,\n model_id, # type: str\n include_text_details=False, # type: Optional[bool]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _analyze_with_custom_model_initial(\n self,\n model_id: str,\n include_text_details: Optional[bool] = False,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "model_id, include_text_details, pages, file_stream" + }, + "begin_analyze_with_custom_model" : { + "sync": { + "signature": "def begin_analyze_with_custom_model(\n self,\n model_id, # type: str\n include_text_details=False, # type: Optional[bool]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri or local path) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_analyze_with_custom_model(\n self,\n model_id: str,\n include_text_details: Optional[bool] = False,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri or local path) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "model_id, include_text_details, pages, file_stream" + }, + "get_analyze_form_result" : { + "sync": { + "signature": "def get_analyze_form_result(\n self,\n model_id, # type: str\n result_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get Analyze Form Result.\n\nObtain current status and the result of the analyze form operation.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_analyze_form_result(\n self,\n model_id: str,\n result_id: str,\n **kwargs\n) -\u003e \"_models.AnalyzeOperationResult\":\n", + "doc": "\"\"\"Get Analyze Form Result.\n\nObtain current status and the result of the analyze form operation.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "model_id, result_id" + }, + "_copy_custom_model_initial" : { + "sync": { + "signature": "def _copy_custom_model_initial(\n self,\n model_id, # type: str\n copy_request, # type: \"_models.CopyRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_1.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _copy_custom_model_initial(\n self,\n model_id: str,\n copy_request: \"_models.CopyRequest\",\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_1.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "model_id, copy_request" + }, + "begin_copy_custom_model" : { + "sync": { + "signature": "def begin_copy_custom_model(\n self,\n model_id, # type: str\n copy_request, # type: \"_models.CopyRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_1.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_copy_custom_model(\n self,\n model_id: str,\n copy_request: \"_models.CopyRequest\",\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_1.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "model_id, copy_request" + }, + "get_custom_model_copy_result" : { + "sync": { + "signature": "def get_custom_model_copy_result(\n self,\n model_id, # type: str\n result_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get Custom Model Copy Result.\n\nObtain current status and the result of a custom model copy operation.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param result_id: Copy operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CopyOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.CopyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_custom_model_copy_result(\n self,\n model_id: str,\n result_id: str,\n **kwargs\n) -\u003e \"_models.CopyOperationResult\":\n", + "doc": "\"\"\"Get Custom Model Copy Result.\n\nObtain current status and the result of a custom model copy operation.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param result_id: Copy operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CopyOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.CopyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "model_id, result_id" + }, + "generate_model_copy_authorization" : { + "sync": { + "signature": "def generate_model_copy_authorization(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Generate Copy Authorization.\n\nGenerate authorization to copy a model into the target Form Recognizer resource.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CopyAuthorizationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.CopyAuthorizationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def generate_model_copy_authorization(\n self,\n **kwargs\n) -\u003e \"_models.CopyAuthorizationResult\":\n", + "doc": "\"\"\"Generate Copy Authorization.\n\nGenerate authorization to copy a model into the target Form Recognizer resource.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CopyAuthorizationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.CopyAuthorizationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "_compose_custom_models_async_initial" : { + "sync": { + "signature": "def _compose_custom_models_async_initial(\n self,\n compose_request, # type: \"_models.ComposeRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param compose_request: Compose models.\n:type compose_request: ~azure.ai.formrecognizer.v2_1.models.ComposeRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _compose_custom_models_async_initial(\n self,\n compose_request: \"_models.ComposeRequest\",\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param compose_request: Compose models.\n:type compose_request: ~azure.ai.formrecognizer.v2_1.models.ComposeRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "compose_request" + }, + "begin_compose_custom_models_async" : { + "sync": { + "signature": "def begin_compose_custom_models_async(\n self,\n compose_request, # type: \"_models.ComposeRequest\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Compose trained with labels models into one composed model.\n\nCompose request would include list of models ids.\nIt would validate what all models either trained with labels model or composed model.\nIt would validate limit of models put together.\n\n:param compose_request: Compose models.\n:type compose_request: ~azure.ai.formrecognizer.v2_1.models.ComposeRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_compose_custom_models_async(\n self,\n compose_request: \"_models.ComposeRequest\",\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Compose trained with labels models into one composed model.\n\nCompose request would include list of models ids.\nIt would validate what all models either trained with labels model or composed model.\nIt would validate limit of models put together.\n\n:param compose_request: Compose models.\n:type compose_request: ~azure.ai.formrecognizer.v2_1.models.ComposeRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "compose_request" + }, + "_analyze_business_card_async_initial" : { + "sync": { + "signature": "def _analyze_business_card_async_initial(\n self,\n include_text_details=False, # type: Optional[bool]\n locale=None, # type: Optional[Union[str, \"_models.Locale\"]]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _analyze_business_card_async_initial(\n self,\n include_text_details: Optional[bool] = False,\n locale: Optional[Union[str, \"_models.Locale\"]] = None,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "include_text_details, locale, pages, file_stream" + }, + "begin_analyze_business_card_async" : { + "sync": { + "signature": "def begin_analyze_business_card_async(\n self,\n include_text_details=False, # type: Optional[bool]\n locale=None, # type: Optional[Union[str, \"_models.Locale\"]]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Analyze Business Card.\n\nExtract field text and semantic values from a given business card document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_analyze_business_card_async(\n self,\n include_text_details: Optional[bool] = False,\n locale: Optional[Union[str, \"_models.Locale\"]] = None,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Analyze Business Card.\n\nExtract field text and semantic values from a given business card document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "include_text_details, locale, pages, file_stream" + }, + "get_analyze_business_card_result" : { + "sync": { + "signature": "def get_analyze_business_card_result(\n self,\n result_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get Analyze Business Card Result.\n\nTrack the progress and obtain the result of the analyze business card operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_analyze_business_card_result(\n self,\n result_id: str,\n **kwargs\n) -\u003e \"_models.AnalyzeOperationResult\":\n", + "doc": "\"\"\"Get Analyze Business Card Result.\n\nTrack the progress and obtain the result of the analyze business card operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "result_id" + }, + "_analyze_invoice_async_initial" : { + "sync": { + "signature": "def _analyze_invoice_async_initial(\n self,\n include_text_details=False, # type: Optional[bool]\n locale=None, # type: Optional[Union[str, \"_models.Locale\"]]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _analyze_invoice_async_initial(\n self,\n include_text_details: Optional[bool] = False,\n locale: Optional[Union[str, \"_models.Locale\"]] = None,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "include_text_details, locale, pages, file_stream" + }, + "begin_analyze_invoice_async" : { + "sync": { + "signature": "def begin_analyze_invoice_async(\n self,\n include_text_details=False, # type: Optional[bool]\n locale=None, # type: Optional[Union[str, \"_models.Locale\"]]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Analyze Invoice Document.\n\nExtract field text and semantic values from a given invoice document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_analyze_invoice_async(\n self,\n include_text_details: Optional[bool] = False,\n locale: Optional[Union[str, \"_models.Locale\"]] = None,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Analyze Invoice Document.\n\nExtract field text and semantic values from a given invoice document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "include_text_details, locale, pages, file_stream" + }, + "get_analyze_invoice_result" : { + "sync": { + "signature": "def get_analyze_invoice_result(\n self,\n result_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get Analyze Invoice Result.\n\nTrack the progress and obtain the result of the analyze invoice operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_analyze_invoice_result(\n self,\n result_id: str,\n **kwargs\n) -\u003e \"_models.AnalyzeOperationResult\":\n", + "doc": "\"\"\"Get Analyze Invoice Result.\n\nTrack the progress and obtain the result of the analyze invoice operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "result_id" + }, + "_analyze_id_document_async_initial" : { + "sync": { + "signature": "def _analyze_id_document_async_initial(\n self,\n include_text_details=False, # type: Optional[bool]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _analyze_id_document_async_initial(\n self,\n include_text_details: Optional[bool] = False,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "include_text_details, pages, file_stream" + }, + "begin_analyze_id_document_async" : { + "sync": { + "signature": "def begin_analyze_id_document_async(\n self,\n include_text_details=False, # type: Optional[bool]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Analyze ID Document.\n\nExtract field text and semantic values from a given ID document. The input document must be of\none of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri) of the\ndocument to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_analyze_id_document_async(\n self,\n include_text_details: Optional[bool] = False,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Analyze ID Document.\n\nExtract field text and semantic values from a given ID document. The input document must be of\none of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri) of the\ndocument to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "include_text_details, pages, file_stream" + }, + "get_analyze_id_document_result" : { + "sync": { + "signature": "def get_analyze_id_document_result(\n self,\n result_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get Analyze ID Document Result.\n\nTrack the progress and obtain the result of the analyze ID operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_analyze_id_document_result(\n self,\n result_id: str,\n **kwargs\n) -\u003e \"_models.AnalyzeOperationResult\":\n", + "doc": "\"\"\"Get Analyze ID Document Result.\n\nTrack the progress and obtain the result of the analyze ID operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "result_id" + }, + "_analyze_receipt_async_initial" : { + "sync": { + "signature": "def _analyze_receipt_async_initial(\n self,\n include_text_details=False, # type: Optional[bool]\n locale=None, # type: Optional[Union[str, \"_models.Locale\"]]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _analyze_receipt_async_initial(\n self,\n include_text_details: Optional[bool] = False,\n locale: Optional[Union[str, \"_models.Locale\"]] = None,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "include_text_details, locale, pages, file_stream" + }, + "begin_analyze_receipt_async" : { + "sync": { + "signature": "def begin_analyze_receipt_async(\n self,\n include_text_details=False, # type: Optional[bool]\n locale=None, # type: Optional[Union[str, \"_models.Locale\"]]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_analyze_receipt_async(\n self,\n include_text_details: Optional[bool] = False,\n locale: Optional[Union[str, \"_models.Locale\"]] = None,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "include_text_details, locale, pages, file_stream" + }, + "get_analyze_receipt_result" : { + "sync": { + "signature": "def get_analyze_receipt_result(\n self,\n result_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get Analyze Receipt Result.\n\nTrack the progress and obtain the result of the analyze receipt operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_analyze_receipt_result(\n self,\n result_id: str,\n **kwargs\n) -\u003e \"_models.AnalyzeOperationResult\":\n", + "doc": "\"\"\"Get Analyze Receipt Result.\n\nTrack the progress and obtain the result of the analyze receipt operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "result_id" + }, + "_analyze_layout_async_initial" : { + "sync": { + "signature": "def _analyze_layout_async_initial(\n self,\n pages=None, # type: Optional[List[str]]\n language=None, # type: Optional[Union[str, \"_models.Language\"]]\n reading_order=\"basic\", # type: Optional[Union[str, \"_models.ReadingOrder\"]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"\n\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param language: Currently, only Afrikaans (\u2018af\u2019), Albanian (\u2018sq\u2019), Asturian (\u2018ast\u2019), Basque\n (\u2018eu\u2019), Bislama (\u2018bi\u2019), Breton (\u2018br\u2019), Catalan (\u2018ca\u2019), Cebuano (\u2018ceb\u2019), Chamorro (\u2018ch\u2019),\n Cornish (\u2018kw\u2019), Corsican (\u2018co\u2019), Crimean Tatar - Latin script(\u2018crh\u2019), Czech (\u2018cs\u2019), Danish\n (\u2018da\u2019), Dutch (\u2018nl\u2019), English (\u0027en\u0027), Estonian (\u2018et\u2019), Fijian (\u2018fj\u2019), Filipino (\u2018fil\u2019), Finnish\n (\u2018fi\u2019), French (\u2018fr\u2019), Friulian (\u2018fur\u2019), Galician (\u2018gl\u2019), German (\u2018de\u2019), Gilbertese (\u2018gil\u2019),\n Greenlandic (\u2018kl\u2019), Haitian Creole (\u2018ht\u2019), Hani (\u2018hni\u2019), Hmong Daw (\u2018mww\u2019), Hungarian (\u2018hu\u2019),\n Indonesian (\u2018id\u2019), Interlingua (\u2018ia\u2019), Inuktitut (\u2018iu\u2019), Irish (\u2018ga\u2019), Italian (\u2018it\u2019), Japanese\n (\u2018ja\u2019), Javanese (\u2018jv\u2019), Kabuverdianu (\u2018kea\u2019), Kachin (\u2018kac\u2019), Kara-Kalpak (\u2018kaa\u2019), Kashubian\n (\u2018csb\u2019), Khasi (\u2018kha\u2019), Korean (\u2018ko\u2019), Kurdish - Latin script (\u2018ku\u2019), K\u2019iche\u2019 (\u2018quc\u2019),\n Luxembourgish (\u2018lb\u2019), Malay (\u2018ms\u2019), Manx (\u2018gv\u2019), Neapolitan (\u2018nap\u2019), Norwegian (\u2018no\u2019), Occitan\n (\u2018oc\u2019), Polish (\u2018pl\u2019), Portuguese (\u2018pt\u2019), Romansh (\u2018rm\u2019), Scots (\u2018sco\u2019), Scottish Gaelic\n (\u2018gd\u2019), simplified Chinese (\u2018zh-Hans\u2019), Slovenian (\u2018sl\u2019), Spanish (\u2018es\u2019), Swahili (\u2018sw\u2019),\n Swedish (\u2018sv\u2019), Tatar - Latin script (\u2018tt\u2019), Tetum (\u2018tet\u2019), traditional Chinese (\u2018zh-Hant\u2019),\n Turkish (\u2018tr\u2019), Upper Sorbian (\u2018hsb\u2019), Uzbek (\u2018uz\u2019), Volap\u00fck (\u2018vo\u2019), Walser (\u2018wae\u2019), Western\n Frisian (\u2018fy\u2019), Yucatec Maya (\u2018yua\u2019), Zhuang (\u2018za\u2019) and Zulu (\u2018zu\u2019) are supported (print \u2013\n seventy-three languages and handwritten \u2013 English only). Layout supports auto language\n identification and multi language documents, so only provide a language code if you would like\n to force the documented to be processed as that specific language.\n:type language: str or ~azure.ai.formrecognizer.v2_1.models.Language\n:param reading_order: Reading order algorithm to sort the text lines returned. Supported\n reading orders include: basic(default), natural.\n:type reading_order: str or ~azure.ai.formrecognizer.v2_1.models.ReadingOrder\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def _analyze_layout_async_initial(\n self,\n pages: Optional[List[str]] = None,\n language: Optional[Union[str, \"_models.Language\"]] = None,\n reading_order: Optional[Union[str, \"_models.ReadingOrder\"]] = \"basic\",\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"\n\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param language: Currently, only Afrikaans (\u2018af\u2019), Albanian (\u2018sq\u2019), Asturian (\u2018ast\u2019), Basque\n (\u2018eu\u2019), Bislama (\u2018bi\u2019), Breton (\u2018br\u2019), Catalan (\u2018ca\u2019), Cebuano (\u2018ceb\u2019), Chamorro (\u2018ch\u2019),\n Cornish (\u2018kw\u2019), Corsican (\u2018co\u2019), Crimean Tatar - Latin script(\u2018crh\u2019), Czech (\u2018cs\u2019), Danish\n (\u2018da\u2019), Dutch (\u2018nl\u2019), English (\u0027en\u0027), Estonian (\u2018et\u2019), Fijian (\u2018fj\u2019), Filipino (\u2018fil\u2019), Finnish\n (\u2018fi\u2019), French (\u2018fr\u2019), Friulian (\u2018fur\u2019), Galician (\u2018gl\u2019), German (\u2018de\u2019), Gilbertese (\u2018gil\u2019),\n Greenlandic (\u2018kl\u2019), Haitian Creole (\u2018ht\u2019), Hani (\u2018hni\u2019), Hmong Daw (\u2018mww\u2019), Hungarian (\u2018hu\u2019),\n Indonesian (\u2018id\u2019), Interlingua (\u2018ia\u2019), Inuktitut (\u2018iu\u2019), Irish (\u2018ga\u2019), Italian (\u2018it\u2019), Japanese\n (\u2018ja\u2019), Javanese (\u2018jv\u2019), Kabuverdianu (\u2018kea\u2019), Kachin (\u2018kac\u2019), Kara-Kalpak (\u2018kaa\u2019), Kashubian\n (\u2018csb\u2019), Khasi (\u2018kha\u2019), Korean (\u2018ko\u2019), Kurdish - Latin script (\u2018ku\u2019), K\u2019iche\u2019 (\u2018quc\u2019),\n Luxembourgish (\u2018lb\u2019), Malay (\u2018ms\u2019), Manx (\u2018gv\u2019), Neapolitan (\u2018nap\u2019), Norwegian (\u2018no\u2019), Occitan\n (\u2018oc\u2019), Polish (\u2018pl\u2019), Portuguese (\u2018pt\u2019), Romansh (\u2018rm\u2019), Scots (\u2018sco\u2019), Scottish Gaelic\n (\u2018gd\u2019), simplified Chinese (\u2018zh-Hans\u2019), Slovenian (\u2018sl\u2019), Spanish (\u2018es\u2019), Swahili (\u2018sw\u2019),\n Swedish (\u2018sv\u2019), Tatar - Latin script (\u2018tt\u2019), Tetum (\u2018tet\u2019), traditional Chinese (\u2018zh-Hant\u2019),\n Turkish (\u2018tr\u2019), Upper Sorbian (\u2018hsb\u2019), Uzbek (\u2018uz\u2019), Volap\u00fck (\u2018vo\u2019), Walser (\u2018wae\u2019), Western\n Frisian (\u2018fy\u2019), Yucatec Maya (\u2018yua\u2019), Zhuang (\u2018za\u2019) and Zulu (\u2018zu\u2019) are supported (print \u2013\n seventy-three languages and handwritten \u2013 English only). Layout supports auto language\n identification and multi language documents, so only provide a language code if you would like\n to force the documented to be processed as that specific language.\n:type language: str or ~azure.ai.formrecognizer.v2_1.models.Language\n:param reading_order: Reading order algorithm to sort the text lines returned. Supported\n reading orders include: basic(default), natural.\n:type reading_order: str or ~azure.ai.formrecognizer.v2_1.models.ReadingOrder\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "pages, language, reading_order, file_stream" + }, + "begin_analyze_layout_async" : { + "sync": { + "signature": "def begin_analyze_layout_async(\n self,\n pages=None, # type: Optional[List[str]]\n language=None, # type: Optional[Union[str, \"_models.Language\"]]\n reading_order=\"basic\", # type: Optional[Union[str, \"_models.ReadingOrder\"]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027 or\n\u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param language: Currently, only Afrikaans (\u2018af\u2019), Albanian (\u2018sq\u2019), Asturian (\u2018ast\u2019), Basque\n (\u2018eu\u2019), Bislama (\u2018bi\u2019), Breton (\u2018br\u2019), Catalan (\u2018ca\u2019), Cebuano (\u2018ceb\u2019), Chamorro (\u2018ch\u2019),\n Cornish (\u2018kw\u2019), Corsican (\u2018co\u2019), Crimean Tatar - Latin script(\u2018crh\u2019), Czech (\u2018cs\u2019), Danish\n (\u2018da\u2019), Dutch (\u2018nl\u2019), English (\u0027en\u0027), Estonian (\u2018et\u2019), Fijian (\u2018fj\u2019), Filipino (\u2018fil\u2019), Finnish\n (\u2018fi\u2019), French (\u2018fr\u2019), Friulian (\u2018fur\u2019), Galician (\u2018gl\u2019), German (\u2018de\u2019), Gilbertese (\u2018gil\u2019),\n Greenlandic (\u2018kl\u2019), Haitian Creole (\u2018ht\u2019), Hani (\u2018hni\u2019), Hmong Daw (\u2018mww\u2019), Hungarian (\u2018hu\u2019),\n Indonesian (\u2018id\u2019), Interlingua (\u2018ia\u2019), Inuktitut (\u2018iu\u2019), Irish (\u2018ga\u2019), Italian (\u2018it\u2019), Japanese\n (\u2018ja\u2019), Javanese (\u2018jv\u2019), Kabuverdianu (\u2018kea\u2019), Kachin (\u2018kac\u2019), Kara-Kalpak (\u2018kaa\u2019), Kashubian\n (\u2018csb\u2019), Khasi (\u2018kha\u2019), Korean (\u2018ko\u2019), Kurdish - Latin script (\u2018ku\u2019), K\u2019iche\u2019 (\u2018quc\u2019),\n Luxembourgish (\u2018lb\u2019), Malay (\u2018ms\u2019), Manx (\u2018gv\u2019), Neapolitan (\u2018nap\u2019), Norwegian (\u2018no\u2019), Occitan\n (\u2018oc\u2019), Polish (\u2018pl\u2019), Portuguese (\u2018pt\u2019), Romansh (\u2018rm\u2019), Scots (\u2018sco\u2019), Scottish Gaelic\n (\u2018gd\u2019), simplified Chinese (\u2018zh-Hans\u2019), Slovenian (\u2018sl\u2019), Spanish (\u2018es\u2019), Swahili (\u2018sw\u2019),\n Swedish (\u2018sv\u2019), Tatar - Latin script (\u2018tt\u2019), Tetum (\u2018tet\u2019), traditional Chinese (\u2018zh-Hant\u2019),\n Turkish (\u2018tr\u2019), Upper Sorbian (\u2018hsb\u2019), Uzbek (\u2018uz\u2019), Volap\u00fck (\u2018vo\u2019), Walser (\u2018wae\u2019), Western\n Frisian (\u2018fy\u2019), Yucatec Maya (\u2018yua\u2019), Zhuang (\u2018za\u2019) and Zulu (\u2018zu\u2019) are supported (print \u2013\n seventy-three languages and handwritten \u2013 English only). Layout supports auto language\n identification and multi language documents, so only provide a language code if you would like\n to force the documented to be processed as that specific language.\n:type language: str or ~azure.ai.formrecognizer.v2_1.models.Language\n:param reading_order: Reading order algorithm to sort the text lines returned. Supported\n reading orders include: basic(default), natural.\n:type reading_order: str or ~azure.ai.formrecognizer.v2_1.models.ReadingOrder\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def begin_analyze_layout_async(\n self,\n pages: Optional[List[str]] = None,\n language: Optional[Union[str, \"_models.Language\"]] = None,\n reading_order: Optional[Union[str, \"_models.ReadingOrder\"]] = \"basic\",\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", + "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027 or\n\u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param language: Currently, only Afrikaans (\u2018af\u2019), Albanian (\u2018sq\u2019), Asturian (\u2018ast\u2019), Basque\n (\u2018eu\u2019), Bislama (\u2018bi\u2019), Breton (\u2018br\u2019), Catalan (\u2018ca\u2019), Cebuano (\u2018ceb\u2019), Chamorro (\u2018ch\u2019),\n Cornish (\u2018kw\u2019), Corsican (\u2018co\u2019), Crimean Tatar - Latin script(\u2018crh\u2019), Czech (\u2018cs\u2019), Danish\n (\u2018da\u2019), Dutch (\u2018nl\u2019), English (\u0027en\u0027), Estonian (\u2018et\u2019), Fijian (\u2018fj\u2019), Filipino (\u2018fil\u2019), Finnish\n (\u2018fi\u2019), French (\u2018fr\u2019), Friulian (\u2018fur\u2019), Galician (\u2018gl\u2019), German (\u2018de\u2019), Gilbertese (\u2018gil\u2019),\n Greenlandic (\u2018kl\u2019), Haitian Creole (\u2018ht\u2019), Hani (\u2018hni\u2019), Hmong Daw (\u2018mww\u2019), Hungarian (\u2018hu\u2019),\n Indonesian (\u2018id\u2019), Interlingua (\u2018ia\u2019), Inuktitut (\u2018iu\u2019), Irish (\u2018ga\u2019), Italian (\u2018it\u2019), Japanese\n (\u2018ja\u2019), Javanese (\u2018jv\u2019), Kabuverdianu (\u2018kea\u2019), Kachin (\u2018kac\u2019), Kara-Kalpak (\u2018kaa\u2019), Kashubian\n (\u2018csb\u2019), Khasi (\u2018kha\u2019), Korean (\u2018ko\u2019), Kurdish - Latin script (\u2018ku\u2019), K\u2019iche\u2019 (\u2018quc\u2019),\n Luxembourgish (\u2018lb\u2019), Malay (\u2018ms\u2019), Manx (\u2018gv\u2019), Neapolitan (\u2018nap\u2019), Norwegian (\u2018no\u2019), Occitan\n (\u2018oc\u2019), Polish (\u2018pl\u2019), Portuguese (\u2018pt\u2019), Romansh (\u2018rm\u2019), Scots (\u2018sco\u2019), Scottish Gaelic\n (\u2018gd\u2019), simplified Chinese (\u2018zh-Hans\u2019), Slovenian (\u2018sl\u2019), Spanish (\u2018es\u2019), Swahili (\u2018sw\u2019),\n Swedish (\u2018sv\u2019), Tatar - Latin script (\u2018tt\u2019), Tetum (\u2018tet\u2019), traditional Chinese (\u2018zh-Hant\u2019),\n Turkish (\u2018tr\u2019), Upper Sorbian (\u2018hsb\u2019), Uzbek (\u2018uz\u2019), Volap\u00fck (\u2018vo\u2019), Walser (\u2018wae\u2019), Western\n Frisian (\u2018fy\u2019), Yucatec Maya (\u2018yua\u2019), Zhuang (\u2018za\u2019) and Zulu (\u2018zu\u2019) are supported (print \u2013\n seventy-three languages and handwritten \u2013 English only). Layout supports auto language\n identification and multi language documents, so only provide a language code if you would like\n to force the documented to be processed as that specific language.\n:type language: str or ~azure.ai.formrecognizer.v2_1.models.Language\n:param reading_order: Reading order algorithm to sort the text lines returned. Supported\n reading orders include: basic(default), natural.\n:type reading_order: str or ~azure.ai.formrecognizer.v2_1.models.ReadingOrder\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + }, + "call": "pages, language, reading_order, file_stream" + }, + "get_analyze_layout_result" : { + "sync": { + "signature": "def get_analyze_layout_result(\n self,\n result_id, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get Analyze Layout Result.\n\nTrack the progress and obtain the result of the analyze layout operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_analyze_layout_result(\n self,\n result_id: str,\n **kwargs\n) -\u003e \"_models.AnalyzeOperationResult\":\n", + "doc": "\"\"\"Get Analyze Layout Result.\n\nTrack the progress and obtain the result of the analyze layout operation.\n\n:param result_id: Analyze operation result identifier.\n:type result_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: AnalyzeOperationResult, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "result_id" + }, + "list_custom_models" : { + "sync": { + "signature": "def list_custom_models(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List Custom Models.\n\nGet information about all custom models.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either Models or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.ai.formrecognizer.v2_1.models.Models]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def list_custom_models(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"_models.Models\"]:\n", + "doc": "\"\"\"List Custom Models.\n\nGet information about all custom models.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either Models or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.formrecognizer.v2_1.models.Models]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + }, + "get_custom_models" : { + "sync": { + "signature": "def get_custom_models(\n self,\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get Custom Models.\n\nGet information about all custom models.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Models, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.Models\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_custom_models(\n self,\n **kwargs\n) -\u003e \"_models.Models\":\n", + "doc": "\"\"\"Get Custom Models.\n\nGet information about all custom models.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Models, or the result of cls(response)\n:rtype: ~azure.ai.formrecognizer.v2_1.models.Models\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "" + } + } + } +} \ No newline at end of file diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/__init__.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/__init__.py new file mode 100644 index 000000000000..69eccfa9e16e --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/__init__.py @@ -0,0 +1,10 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._form_recognizer_client import FormRecognizerClient +__all__ = ['FormRecognizerClient'] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/_configuration.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/_configuration.py new file mode 100644 index 000000000000..7a4589348bec --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/_configuration.py @@ -0,0 +1,64 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +class FormRecognizerClientConfiguration(Configuration): + """Configuration for FormRecognizerClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). + :type endpoint: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + endpoint: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + super(FormRecognizerClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.endpoint = endpoint + self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'ai-formrecognizer/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/_form_recognizer_client.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/_form_recognizer_client.py new file mode 100644 index 000000000000..8bc39cd2bace --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/_form_recognizer_client.py @@ -0,0 +1,75 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core import AsyncPipelineClient +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import FormRecognizerClientConfiguration +from .operations import FormRecognizerClientOperationsMixin +from .. import models + + +class FormRecognizerClient(FormRecognizerClientOperationsMixin): + """Extracts information from forms and images into structured data. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). + :type endpoint: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + endpoint: str, + **kwargs: Any + ) -> None: + base_url = '{endpoint}/formrecognizer/v2.1' + self._config = FormRecognizerClientConfiguration(credential, endpoint, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "FormRecognizerClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/operations/__init__.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/operations/__init__.py new file mode 100644 index 000000000000..f2f858714054 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._form_recognizer_client_operations import FormRecognizerClientOperationsMixin + +__all__ = [ + 'FormRecognizerClientOperationsMixin', +] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/operations/_form_recognizer_client_operations.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/operations/_form_recognizer_client_operations.py new file mode 100644 index 000000000000..e690c8f1d142 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/aio/operations/_form_recognizer_client_operations.py @@ -0,0 +1,1946 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, IO, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FormRecognizerClientOperationsMixin: + + async def _train_custom_model_async_initial( + self, + train_request: "_models.TrainRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._train_custom_model_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(train_request, 'TrainRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _train_custom_model_async_initial.metadata = {'url': '/custom/models'} # type: ignore + + async def begin_train_custom_model_async( + self, + train_request: "_models.TrainRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Train Custom Model. + + Create and train a custom model. The request must include a source parameter that is either an + externally accessible Azure storage blob container Uri (preferably a Shared Access Signature + Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, + they must follow the Linux/Unix path format and be an absolute path rooted to the input mount + configuration setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' + then a valid source path would be '/input/contosodataset'. All data to be trained is expected + to be under the source folder or sub folders under it. Models are trained using documents that + are of the following content type - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff' + or 'image/bmp'. Other type of content is ignored. + + :param train_request: Training request parameters. + :type train_request: ~azure.ai.formrecognizer.v2_1.models.TrainRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._train_custom_model_async_initial( + train_request=train_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_train_custom_model_async.metadata = {'url': '/custom/models'} # type: ignore + + async def get_custom_model( + self, + model_id: str, + include_keys: Optional[bool] = False, + **kwargs + ) -> "_models.Model": + """Get Custom Model. + + Get detailed information about a custom model. + + :param model_id: Model identifier. + :type model_id: str + :param include_keys: Include list of extracted keys in model information. + :type include_keys: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Model, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.Model + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Model"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_custom_model.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_keys is not None: + query_parameters['includeKeys'] = self._serialize.query("include_keys", include_keys, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Model', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_custom_model.metadata = {'url': '/custom/models/{modelId}'} # type: ignore + + async def delete_custom_model( + self, + model_id: str, + **kwargs + ) -> None: + """Delete Custom Model. + + Mark model for deletion. Model artifacts will be permanently removed within a predetermined + period. + + :param model_id: Model identifier. + :type model_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.delete_custom_model.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_custom_model.metadata = {'url': '/custom/models/{modelId}'} # type: ignore + + async def _analyze_with_custom_model_initial( + self, + model_id: str, + include_text_details: Optional[bool] = False, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_with_custom_model_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_with_custom_model_initial.metadata = {'url': '/custom/models/{modelId}/analyze'} # type: ignore + + async def begin_analyze_with_custom_model( + self, + model_id: str, + include_text_details: Optional[bool] = False, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Analyze Form. + + Extract key-value pairs, tables, and semantic values from a given document. The input document + must be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', + 'image/tiff' or 'image/bmp'. Alternatively, use 'application/json' type to specify the location + (Uri or local path) of the document to be analyzed. + + :param model_id: Model identifier. + :type model_id: str + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._analyze_with_custom_model_initial( + model_id=model_id, + include_text_details=include_text_details, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_with_custom_model.metadata = {'url': '/custom/models/{modelId}/analyze'} # type: ignore + + async def get_analyze_form_result( + self, + model_id: str, + result_id: str, + **kwargs + ) -> "_models.AnalyzeOperationResult": + """Get Analyze Form Result. + + Obtain current status and the result of the analyze form operation. + + :param model_id: Model identifier. + :type model_id: str + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_form_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_form_result.metadata = {'url': '/custom/models/{modelId}/analyzeResults/{resultId}'} # type: ignore + + async def _copy_custom_model_initial( + self, + model_id: str, + copy_request: "_models.CopyRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._copy_custom_model_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(copy_request, 'CopyRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _copy_custom_model_initial.metadata = {'url': '/custom/models/{modelId}/copy'} # type: ignore + + async def begin_copy_custom_model( + self, + model_id: str, + copy_request: "_models.CopyRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Copy Custom Model. + + Copy custom model stored in this resource (the source) to user specified target Form Recognizer + resource. + + :param model_id: Model identifier. + :type model_id: str + :param copy_request: Copy request parameters. + :type copy_request: ~azure.ai.formrecognizer.v2_1.models.CopyRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._copy_custom_model_initial( + model_id=model_id, + copy_request=copy_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_copy_custom_model.metadata = {'url': '/custom/models/{modelId}/copy'} # type: ignore + + async def get_custom_model_copy_result( + self, + model_id: str, + result_id: str, + **kwargs + ) -> "_models.CopyOperationResult": + """Get Custom Model Copy Result. + + Obtain current status and the result of a custom model copy operation. + + :param model_id: Model identifier. + :type model_id: str + :param result_id: Copy operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CopyOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.CopyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CopyOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_custom_model_copy_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CopyOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_custom_model_copy_result.metadata = {'url': '/custom/models/{modelId}/copyResults/{resultId}'} # type: ignore + + async def generate_model_copy_authorization( + self, + **kwargs + ) -> "_models.CopyAuthorizationResult": + """Generate Copy Authorization. + + Generate authorization to copy a model into the target Form Recognizer resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CopyAuthorizationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.CopyAuthorizationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CopyAuthorizationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.generate_model_copy_authorization.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + deserialized = self._deserialize('CopyAuthorizationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + generate_model_copy_authorization.metadata = {'url': '/custom/models/copyAuthorization'} # type: ignore + + async def _compose_custom_models_async_initial( + self, + compose_request: "_models.ComposeRequest", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._compose_custom_models_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(compose_request, 'ComposeRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _compose_custom_models_async_initial.metadata = {'url': '/custom/models/compose'} # type: ignore + + async def begin_compose_custom_models_async( + self, + compose_request: "_models.ComposeRequest", + **kwargs + ) -> AsyncLROPoller[None]: + """Compose trained with labels models into one composed model. + + Compose request would include list of models ids. + It would validate what all models either trained with labels model or composed model. + It would validate limit of models put together. + + :param compose_request: Compose models. + :type compose_request: ~azure.ai.formrecognizer.v2_1.models.ComposeRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._compose_custom_models_async_initial( + compose_request=compose_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_compose_custom_models_async.metadata = {'url': '/custom/models/compose'} # type: ignore + + async def _analyze_business_card_async_initial( + self, + include_text_details: Optional[bool] = False, + locale: Optional[Union[str, "_models.Locale"]] = None, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_business_card_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if locale is not None: + query_parameters['locale'] = self._serialize.query("locale", locale, 'str') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_business_card_async_initial.metadata = {'url': '/prebuilt/businessCard/analyze'} # type: ignore + + async def begin_analyze_business_card_async( + self, + include_text_details: Optional[bool] = False, + locale: Optional[Union[str, "_models.Locale"]] = None, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Analyze Business Card. + + Extract field text and semantic values from a given business card document. The input document + must be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', + 'image/tiff' or 'image/bmp'. Alternatively, use 'application/json' type to specify the location + (Uri) of the document to be analyzed. + + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB, + en-IN, en-US(default). + :type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._analyze_business_card_async_initial( + include_text_details=include_text_details, + locale=locale, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_business_card_async.metadata = {'url': '/prebuilt/businessCard/analyze'} # type: ignore + + async def get_analyze_business_card_result( + self, + result_id: str, + **kwargs + ) -> "_models.AnalyzeOperationResult": + """Get Analyze Business Card Result. + + Track the progress and obtain the result of the analyze business card operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_business_card_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_business_card_result.metadata = {'url': '/prebuilt/businessCard/analyzeResults/{resultId}'} # type: ignore + + async def _analyze_invoice_async_initial( + self, + include_text_details: Optional[bool] = False, + locale: Optional[Union[str, "_models.Locale"]] = None, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_invoice_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if locale is not None: + query_parameters['locale'] = self._serialize.query("locale", locale, 'str') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_invoice_async_initial.metadata = {'url': '/prebuilt/invoice/analyze'} # type: ignore + + async def begin_analyze_invoice_async( + self, + include_text_details: Optional[bool] = False, + locale: Optional[Union[str, "_models.Locale"]] = None, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Analyze Invoice Document. + + Extract field text and semantic values from a given invoice document. The input document must + be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', + 'image/tiff' or 'image/bmp'. Alternatively, use 'application/json' type to specify the location + (Uri) of the document to be analyzed. + + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB, + en-IN, en-US(default). + :type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._analyze_invoice_async_initial( + include_text_details=include_text_details, + locale=locale, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_invoice_async.metadata = {'url': '/prebuilt/invoice/analyze'} # type: ignore + + async def get_analyze_invoice_result( + self, + result_id: str, + **kwargs + ) -> "_models.AnalyzeOperationResult": + """Get Analyze Invoice Result. + + Track the progress and obtain the result of the analyze invoice operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_invoice_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_invoice_result.metadata = {'url': '/prebuilt/invoice/analyzeResults/{resultId}'} # type: ignore + + async def _analyze_id_document_async_initial( + self, + include_text_details: Optional[bool] = False, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_id_document_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_id_document_async_initial.metadata = {'url': '/prebuilt/idDocument/analyze'} # type: ignore + + async def begin_analyze_id_document_async( + self, + include_text_details: Optional[bool] = False, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Analyze ID Document. + + Extract field text and semantic values from a given ID document. The input document must be of + one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff' + or 'image/bmp'. Alternatively, use 'application/json' type to specify the location (Uri) of the + document to be analyzed. + + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._analyze_id_document_async_initial( + include_text_details=include_text_details, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_id_document_async.metadata = {'url': '/prebuilt/idDocument/analyze'} # type: ignore + + async def get_analyze_id_document_result( + self, + result_id: str, + **kwargs + ) -> "_models.AnalyzeOperationResult": + """Get Analyze ID Document Result. + + Track the progress and obtain the result of the analyze ID operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_id_document_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_id_document_result.metadata = {'url': '/prebuilt/idDocument/analyzeResults/{resultId}'} # type: ignore + + async def _analyze_receipt_async_initial( + self, + include_text_details: Optional[bool] = False, + locale: Optional[Union[str, "_models.Locale"]] = None, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_receipt_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if locale is not None: + query_parameters['locale'] = self._serialize.query("locale", locale, 'str') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_receipt_async_initial.metadata = {'url': '/prebuilt/receipt/analyze'} # type: ignore + + async def begin_analyze_receipt_async( + self, + include_text_details: Optional[bool] = False, + locale: Optional[Union[str, "_models.Locale"]] = None, + pages: Optional[List[str]] = None, + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Analyze Receipt. + + Extract field text and semantic values from a given receipt document. The input document must + be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', + 'image/tiff' or 'image/bmp'. Alternatively, use 'application/json' type to specify the location + (Uri) of the document to be analyzed. + + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB, + en-IN, en-US(default). + :type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._analyze_receipt_async_initial( + include_text_details=include_text_details, + locale=locale, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_receipt_async.metadata = {'url': '/prebuilt/receipt/analyze'} # type: ignore + + async def get_analyze_receipt_result( + self, + result_id: str, + **kwargs + ) -> "_models.AnalyzeOperationResult": + """Get Analyze Receipt Result. + + Track the progress and obtain the result of the analyze receipt operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_receipt_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_receipt_result.metadata = {'url': '/prebuilt/receipt/analyzeResults/{resultId}'} # type: ignore + + async def _analyze_layout_async_initial( + self, + pages: Optional[List[str]] = None, + language: Optional[Union[str, "_models.Language"]] = None, + reading_order: Optional[Union[str, "_models.ReadingOrder"]] = "basic", + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_layout_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if reading_order is not None: + query_parameters['readingOrder'] = self._serialize.query("reading_order", reading_order, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_layout_async_initial.metadata = {'url': '/layout/analyze'} # type: ignore + + async def begin_analyze_layout_async( + self, + pages: Optional[List[str]] = None, + language: Optional[Union[str, "_models.Language"]] = None, + reading_order: Optional[Union[str, "_models.ReadingOrder"]] = "basic", + file_stream: Optional[Union[IO, "_models.SourcePath"]] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Analyze Layout. + + Extract text and layout information from a given document. The input document must be of one of + the supported content types - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff' or + 'image/bmp'. Alternatively, use 'application/json' type to specify the location (Uri or local + path) of the document to be analyzed. + + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param language: Currently, only Afrikaans (‘af’), Albanian (‘sq’), Asturian (‘ast’), Basque + (‘eu’), Bislama (‘bi’), Breton (‘br’), Catalan (‘ca’), Cebuano (‘ceb’), Chamorro (‘ch’), + Cornish (‘kw’), Corsican (‘co’), Crimean Tatar - Latin script(‘crh’), Czech (‘cs’), Danish + (‘da’), Dutch (‘nl’), English ('en'), Estonian (‘et’), Fijian (‘fj’), Filipino (‘fil’), Finnish + (‘fi’), French (‘fr’), Friulian (‘fur’), Galician (‘gl’), German (‘de’), Gilbertese (‘gil’), + Greenlandic (‘kl’), Haitian Creole (‘ht’), Hani (‘hni’), Hmong Daw (‘mww’), Hungarian (‘hu’), + Indonesian (‘id’), Interlingua (‘ia’), Inuktitut (‘iu’), Irish (‘ga’), Italian (‘it’), Japanese + (‘ja’), Javanese (‘jv’), Kabuverdianu (‘kea’), Kachin (‘kac’), Kara-Kalpak (‘kaa’), Kashubian + (‘csb’), Khasi (‘kha’), Korean (‘ko’), Kurdish - Latin script (‘ku’), K’iche’ (‘quc’), + Luxembourgish (‘lb’), Malay (‘ms’), Manx (‘gv’), Neapolitan (‘nap’), Norwegian (‘no’), Occitan + (‘oc’), Polish (‘pl’), Portuguese (‘pt’), Romansh (‘rm’), Scots (‘sco’), Scottish Gaelic + (‘gd’), simplified Chinese (‘zh-Hans’), Slovenian (‘sl’), Spanish (‘es’), Swahili (‘sw’), + Swedish (‘sv’), Tatar - Latin script (‘tt’), Tetum (‘tet’), traditional Chinese (‘zh-Hant’), + Turkish (‘tr’), Upper Sorbian (‘hsb’), Uzbek (‘uz’), Volapük (‘vo’), Walser (‘wae’), Western + Frisian (‘fy’), Yucatec Maya (‘yua’), Zhuang (‘za’) and Zulu (‘zu’) are supported (print – + seventy-three languages and handwritten – English only). Layout supports auto language + identification and multi language documents, so only provide a language code if you would like + to force the documented to be processed as that specific language. + :type language: str or ~azure.ai.formrecognizer.v2_1.models.Language + :param reading_order: Reading order algorithm to sort the text lines returned. Supported + reading orders include: basic(default), natural. + :type reading_order: str or ~azure.ai.formrecognizer.v2_1.models.ReadingOrder + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._analyze_layout_async_initial( + pages=pages, + language=language, + reading_order=reading_order, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_layout_async.metadata = {'url': '/layout/analyze'} # type: ignore + + async def get_analyze_layout_result( + self, + result_id: str, + **kwargs + ) -> "_models.AnalyzeOperationResult": + """Get Analyze Layout Result. + + Track the progress and obtain the result of the analyze layout operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_layout_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_layout_result.metadata = {'url': '/layout/analyzeResults/{resultId}'} # type: ignore + + def list_custom_models( + self, + **kwargs + ) -> AsyncIterable["_models.Models"]: + """List Custom Models. + + Get information about all custom models. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Models or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.formrecognizer.v2_1.models.Models] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Models"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + op = "full" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_custom_models.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['op'] = self._serialize.query("op", op, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('Models', pipeline_response) + list_of_elem = deserialized.model_list + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_custom_models.metadata = {'url': '/custom/models'} # type: ignore + + async def get_custom_models( + self, + **kwargs + ) -> "_models.Models": + """Get Custom Models. + + Get information about all custom models. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Models, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.Models + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Models"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + op = "summary" + accept = "application/json" + + # Construct URL + url = self.get_custom_models.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['op'] = self._serialize.query("op", op, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Models', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_custom_models.metadata = {'url': '/custom/models'} # type: ignore diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/__init__.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/__init__.py new file mode 100644 index 000000000000..36591d89593a --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/__init__.py @@ -0,0 +1,146 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AnalyzeOperationResult + from ._models_py3 import AnalyzeResult + from ._models_py3 import Appearance + from ._models_py3 import Attributes + from ._models_py3 import ComposeRequest + from ._models_py3 import CopyAuthorizationResult + from ._models_py3 import CopyOperationResult + from ._models_py3 import CopyRequest + from ._models_py3 import CopyResult + from ._models_py3 import DataTable + from ._models_py3 import DataTableCell + from ._models_py3 import DocumentResult + from ._models_py3 import ErrorInformation + from ._models_py3 import ErrorResponse + from ._models_py3 import FieldValue + from ._models_py3 import FormFieldsReport + from ._models_py3 import KeyValueElement + from ._models_py3 import KeyValuePair + from ._models_py3 import KeysResult + from ._models_py3 import Model + from ._models_py3 import ModelInfo + from ._models_py3 import Models + from ._models_py3 import ModelsSummary + from ._models_py3 import PageResult + from ._models_py3 import ReadResult + from ._models_py3 import SelectionMark + from ._models_py3 import SourcePath + from ._models_py3 import Style + from ._models_py3 import TextLine + from ._models_py3 import TextWord + from ._models_py3 import TrainRequest + from ._models_py3 import TrainResult + from ._models_py3 import TrainSourceFilter + from ._models_py3 import TrainingDocumentInfo +except (SyntaxError, ImportError): + from ._models import AnalyzeOperationResult # type: ignore + from ._models import AnalyzeResult # type: ignore + from ._models import Appearance # type: ignore + from ._models import Attributes # type: ignore + from ._models import ComposeRequest # type: ignore + from ._models import CopyAuthorizationResult # type: ignore + from ._models import CopyOperationResult # type: ignore + from ._models import CopyRequest # type: ignore + from ._models import CopyResult # type: ignore + from ._models import DataTable # type: ignore + from ._models import DataTableCell # type: ignore + from ._models import DocumentResult # type: ignore + from ._models import ErrorInformation # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import FieldValue # type: ignore + from ._models import FormFieldsReport # type: ignore + from ._models import KeyValueElement # type: ignore + from ._models import KeyValuePair # type: ignore + from ._models import KeysResult # type: ignore + from ._models import Model # type: ignore + from ._models import ModelInfo # type: ignore + from ._models import Models # type: ignore + from ._models import ModelsSummary # type: ignore + from ._models import PageResult # type: ignore + from ._models import ReadResult # type: ignore + from ._models import SelectionMark # type: ignore + from ._models import SourcePath # type: ignore + from ._models import Style # type: ignore + from ._models import TextLine # type: ignore + from ._models import TextWord # type: ignore + from ._models import TrainRequest # type: ignore + from ._models import TrainResult # type: ignore + from ._models import TrainSourceFilter # type: ignore + from ._models import TrainingDocumentInfo # type: ignore + +from ._form_recognizer_client_enums import ( + ContentType, + FieldValueGender, + FieldValueSelectionMark, + FieldValueType, + KeyValueType, + Language, + LengthUnit, + Locale, + ModelStatus, + OperationStatus, + ReadingOrder, + SelectionMarkState, + TextStyle, + TrainStatus, +) + +__all__ = [ + 'AnalyzeOperationResult', + 'AnalyzeResult', + 'Appearance', + 'Attributes', + 'ComposeRequest', + 'CopyAuthorizationResult', + 'CopyOperationResult', + 'CopyRequest', + 'CopyResult', + 'DataTable', + 'DataTableCell', + 'DocumentResult', + 'ErrorInformation', + 'ErrorResponse', + 'FieldValue', + 'FormFieldsReport', + 'KeyValueElement', + 'KeyValuePair', + 'KeysResult', + 'Model', + 'ModelInfo', + 'Models', + 'ModelsSummary', + 'PageResult', + 'ReadResult', + 'SelectionMark', + 'SourcePath', + 'Style', + 'TextLine', + 'TextWord', + 'TrainRequest', + 'TrainResult', + 'TrainSourceFilter', + 'TrainingDocumentInfo', + 'ContentType', + 'FieldValueGender', + 'FieldValueSelectionMark', + 'FieldValueType', + 'KeyValueType', + 'Language', + 'LengthUnit', + 'Locale', + 'ModelStatus', + 'OperationStatus', + 'ReadingOrder', + 'SelectionMarkState', + 'TextStyle', + 'TrainStatus', +] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/_form_recognizer_client_enums.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/_form_recognizer_client_enums.py new file mode 100644 index 000000000000..9a7bfe1bfed5 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/_form_recognizer_client_enums.py @@ -0,0 +1,216 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ContentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Content type for upload + """ + + #: Content Type 'application/pdf'. + APPLICATION_PDF = "application/pdf" + #: Content Type 'image/bmp'. + IMAGE_BMP = "image/bmp" + #: Content Type 'image/jpeg'. + IMAGE_JPEG = "image/jpeg" + #: Content Type 'image/png'. + IMAGE_PNG = "image/png" + #: Content Type 'image/tiff'. + IMAGE_TIFF = "image/tiff" + +class FieldValueGender(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Gender value: M, F, or X. + """ + + M = "M" + F = "F" + X = "X" + +class FieldValueSelectionMark(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Selection mark value. + """ + + SELECTED = "selected" + UNSELECTED = "unselected" + +class FieldValueType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Semantic data type of the field value. + """ + + STRING = "string" + DATE = "date" + TIME = "time" + PHONE_NUMBER = "phoneNumber" + NUMBER = "number" + INTEGER = "integer" + ARRAY = "array" + OBJECT = "object" + SELECTION_MARK = "selectionMark" + GENDER = "gender" + COUNTRY = "country" + +class KeyValueType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Semantic data type of the key value element. + """ + + STRING = "string" + SELECTION_MARK = "selectionMark" + +class Language(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + AF = "af" + AST = "ast" + BI = "bi" + BR = "br" + CA = "ca" + CEB = "ceb" + CH = "ch" + CO = "co" + CRH = "crh" + CS = "cs" + CSB = "csb" + DA = "da" + DE = "de" + EN = "en" + ES = "es" + ET = "et" + EU = "eu" + FI = "fi" + FIL = "fil" + FJ = "fj" + FR = "fr" + FUR = "fur" + FY = "fy" + GA = "ga" + GD = "gd" + GIL = "gil" + GL = "gl" + GV = "gv" + HNI = "hni" + HSB = "hsb" + HT = "ht" + HU = "hu" + IA = "ia" + ID = "id" + IT = "it" + IU = "iu" + JA = "ja" + JV = "jv" + KAA = "kaa" + KAC = "kac" + KEA = "kea" + KHA = "kha" + KL = "kl" + KO = "ko" + KU = "ku" + KW = "kw" + LB = "lb" + MS = "ms" + MWW = "mww" + NAP = "nap" + NL = "nl" + NO = "no" + OC = "oc" + PL = "pl" + PT = "pt" + QUC = "quc" + RM = "rm" + SCO = "sco" + SL = "sl" + SQ = "sq" + SV = "sv" + SW = "sw" + TET = "tet" + TR = "tr" + TT = "tt" + UZ = "uz" + VO = "vo" + WAE = "wae" + YUA = "yua" + ZA = "za" + ZH_HANS = "zh-Hans" + ZH_HANT = "zh-Hant" + ZU = "zu" + +class LengthUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The unit used by the width, height and boundingBox properties. For images, the unit is "pixel". + For PDF, the unit is "inch". + """ + + PIXEL = "pixel" + INCH = "inch" + +class Locale(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + EN_AU = "en-AU" + EN_CA = "en-CA" + EN_GB = "en-GB" + EN_IN = "en-IN" + EN_US = "en-US" + +class ModelStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the model. + """ + + CREATING = "creating" + READY = "ready" + INVALID = "invalid" + +class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the queued operation. + """ + + NOT_STARTED = "notStarted" + RUNNING = "running" + SUCCEEDED = "succeeded" + FAILED = "failed" + +class ReadingOrder(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + BASIC = "basic" + NATURAL = "natural" + +class SelectionMarkState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of the selection mark. + """ + + SELECTED = "selected" + UNSELECTED = "unselected" + +class TextStyle(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The text line style name, including handwriting and other. + """ + + OTHER = "other" + HANDWRITING = "handwriting" + +class TrainStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the training operation. + """ + + SUCCEEDED = "succeeded" + PARTIALLY_SUCCEEDED = "partiallySucceeded" + FAILED = "failed" diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/_models.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/_models.py new file mode 100644 index 000000000000..d170074aefc5 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/_models.py @@ -0,0 +1,1305 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AnalyzeOperationResult(msrest.serialization.Model): + """Status and result of the queued analyze operation. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. Operation status. Possible values include: "notStarted", "running", + "succeeded", "failed". + :type status: str or ~azure.ai.formrecognizer.v2_1.models.OperationStatus + :param created_date_time: Required. Date and time (UTC) when the analyze operation was + submitted. + :type created_date_time: ~datetime.datetime + :param last_updated_date_time: Required. Date and time (UTC) when the status was last updated. + :type last_updated_date_time: ~datetime.datetime + :param analyze_result: Results of the analyze operation. + :type analyze_result: ~azure.ai.formrecognizer.v2_1.models.AnalyzeResult + """ + + _validation = { + 'status': {'required': True}, + 'created_date_time': {'required': True}, + 'last_updated_date_time': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'iso-8601'}, + 'analyze_result': {'key': 'analyzeResult', 'type': 'AnalyzeResult'}, + } + + def __init__( + self, + **kwargs + ): + super(AnalyzeOperationResult, self).__init__(**kwargs) + self.status = kwargs['status'] + self.created_date_time = kwargs['created_date_time'] + self.last_updated_date_time = kwargs['last_updated_date_time'] + self.analyze_result = kwargs.get('analyze_result', None) + + +class AnalyzeResult(msrest.serialization.Model): + """Analyze operation result. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. Version of schema used for this result. + :type version: str + :param read_results: Required. Text extracted from the input. + :type read_results: list[~azure.ai.formrecognizer.v2_1.models.ReadResult] + :param page_results: Page-level information extracted from the input. + :type page_results: list[~azure.ai.formrecognizer.v2_1.models.PageResult] + :param document_results: Document-level information extracted from the input. + :type document_results: list[~azure.ai.formrecognizer.v2_1.models.DocumentResult] + :param errors: List of errors reported during the analyze operation. + :type errors: list[~azure.ai.formrecognizer.v2_1.models.ErrorInformation] + """ + + _validation = { + 'version': {'required': True}, + 'read_results': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'read_results': {'key': 'readResults', 'type': '[ReadResult]'}, + 'page_results': {'key': 'pageResults', 'type': '[PageResult]'}, + 'document_results': {'key': 'documentResults', 'type': '[DocumentResult]'}, + 'errors': {'key': 'errors', 'type': '[ErrorInformation]'}, + } + + def __init__( + self, + **kwargs + ): + super(AnalyzeResult, self).__init__(**kwargs) + self.version = kwargs['version'] + self.read_results = kwargs['read_results'] + self.page_results = kwargs.get('page_results', None) + self.document_results = kwargs.get('document_results', None) + self.errors = kwargs.get('errors', None) + + +class Appearance(msrest.serialization.Model): + """An object representing the appearance of the text line. + + All required parameters must be populated in order to send to Azure. + + :param style: Required. An object representing the style of the text line. + :type style: ~azure.ai.formrecognizer.v2_1.models.Style + """ + + _validation = { + 'style': {'required': True}, + } + + _attribute_map = { + 'style': {'key': 'style', 'type': 'Style'}, + } + + def __init__( + self, + **kwargs + ): + super(Appearance, self).__init__(**kwargs) + self.style = kwargs['style'] + + +class Attributes(msrest.serialization.Model): + """Optional model attributes. + + :param is_composed: Is this model composed? (default: false). + :type is_composed: bool + """ + + _attribute_map = { + 'is_composed': {'key': 'isComposed', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Attributes, self).__init__(**kwargs) + self.is_composed = kwargs.get('is_composed', False) + + +class ComposeRequest(msrest.serialization.Model): + """Request contract for compose operation. + + All required parameters must be populated in order to send to Azure. + + :param model_ids: Required. List of model ids to compose. + :type model_ids: list[str] + :param model_name: Optional user defined model name (max length: 1024). + :type model_name: str + """ + + _validation = { + 'model_ids': {'required': True}, + } + + _attribute_map = { + 'model_ids': {'key': 'modelIds', 'type': '[str]'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ComposeRequest, self).__init__(**kwargs) + self.model_ids = kwargs['model_ids'] + self.model_name = kwargs.get('model_name', None) + + +class CopyAuthorizationResult(msrest.serialization.Model): + """Request parameter that contains authorization claims for copy operation. + + All required parameters must be populated in order to send to Azure. + + :param model_id: Required. Model identifier. + :type model_id: str + :param access_token: Required. Token claim used to authorize the request. + :type access_token: str + :param expiration_date_time_ticks: Required. The time when the access token expires. The date + is represented as the number of seconds from 1970-01-01T0:0:0Z UTC until the expiration time. + :type expiration_date_time_ticks: long + """ + + _validation = { + 'model_id': {'required': True}, + 'access_token': {'required': True}, + 'expiration_date_time_ticks': {'required': True}, + } + + _attribute_map = { + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'access_token': {'key': 'accessToken', 'type': 'str'}, + 'expiration_date_time_ticks': {'key': 'expirationDateTimeTicks', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(CopyAuthorizationResult, self).__init__(**kwargs) + self.model_id = kwargs['model_id'] + self.access_token = kwargs['access_token'] + self.expiration_date_time_ticks = kwargs['expiration_date_time_ticks'] + + +class CopyOperationResult(msrest.serialization.Model): + """Status and result of the queued copy operation. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. Operation status. Possible values include: "notStarted", "running", + "succeeded", "failed". + :type status: str or ~azure.ai.formrecognizer.v2_1.models.OperationStatus + :param created_date_time: Required. Date and time (UTC) when the copy operation was submitted. + :type created_date_time: ~datetime.datetime + :param last_updated_date_time: Required. Date and time (UTC) when the status was last updated. + :type last_updated_date_time: ~datetime.datetime + :param copy_result: Results of the copy operation. + :type copy_result: ~azure.ai.formrecognizer.v2_1.models.CopyResult + """ + + _validation = { + 'status': {'required': True}, + 'created_date_time': {'required': True}, + 'last_updated_date_time': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'iso-8601'}, + 'copy_result': {'key': 'copyResult', 'type': 'CopyResult'}, + } + + def __init__( + self, + **kwargs + ): + super(CopyOperationResult, self).__init__(**kwargs) + self.status = kwargs['status'] + self.created_date_time = kwargs['created_date_time'] + self.last_updated_date_time = kwargs['last_updated_date_time'] + self.copy_result = kwargs.get('copy_result', None) + + +class CopyRequest(msrest.serialization.Model): + """Request parameter to copy an existing custom model from the source resource to a target resource referenced by the resource ID. + + All required parameters must be populated in order to send to Azure. + + :param target_resource_id: Required. Azure Resource Id of the target Form Recognizer resource + where the model is copied to. + :type target_resource_id: str + :param target_resource_region: Required. Location of the target Azure resource. A valid Azure + region name supported by Cognitive Services. + :type target_resource_region: str + :param copy_authorization: Required. Entity that encodes claims to authorize the copy request. + :type copy_authorization: ~azure.ai.formrecognizer.v2_1.models.CopyAuthorizationResult + """ + + _validation = { + 'target_resource_id': {'required': True, 'max_length': 1024, 'min_length': 0, 'pattern': r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.CognitiveServices/accounts/[^/]*$'}, + 'target_resource_region': {'required': True, 'max_length': 24, 'min_length': 1, 'pattern': r'^[a-z0-9]+$'}, + 'copy_authorization': {'required': True}, + } + + _attribute_map = { + 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + 'target_resource_region': {'key': 'targetResourceRegion', 'type': 'str'}, + 'copy_authorization': {'key': 'copyAuthorization', 'type': 'CopyAuthorizationResult'}, + } + + def __init__( + self, + **kwargs + ): + super(CopyRequest, self).__init__(**kwargs) + self.target_resource_id = kwargs['target_resource_id'] + self.target_resource_region = kwargs['target_resource_region'] + self.copy_authorization = kwargs['copy_authorization'] + + +class CopyResult(msrest.serialization.Model): + """Custom model copy result. + + All required parameters must be populated in order to send to Azure. + + :param model_id: Required. Identifier of the target model. + :type model_id: str + :param errors: Errors returned during the copy operation. + :type errors: list[~azure.ai.formrecognizer.v2_1.models.ErrorInformation] + """ + + _validation = { + 'model_id': {'required': True}, + } + + _attribute_map = { + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[ErrorInformation]'}, + } + + def __init__( + self, + **kwargs + ): + super(CopyResult, self).__init__(**kwargs) + self.model_id = kwargs['model_id'] + self.errors = kwargs.get('errors', None) + + +class DataTable(msrest.serialization.Model): + """Information about the extracted table contained in a page. + + All required parameters must be populated in order to send to Azure. + + :param rows: Required. Number of rows. + :type rows: int + :param columns: Required. Number of columns. + :type columns: int + :param cells: Required. List of cells contained in the table. + :type cells: list[~azure.ai.formrecognizer.v2_1.models.DataTableCell] + :param bounding_box: Required. Bounding box of the table. + :type bounding_box: list[float] + """ + + _validation = { + 'rows': {'required': True, 'minimum': 1}, + 'columns': {'required': True, 'minimum': 1}, + 'cells': {'required': True}, + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + } + + _attribute_map = { + 'rows': {'key': 'rows', 'type': 'int'}, + 'columns': {'key': 'columns', 'type': 'int'}, + 'cells': {'key': 'cells', 'type': '[DataTableCell]'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataTable, self).__init__(**kwargs) + self.rows = kwargs['rows'] + self.columns = kwargs['columns'] + self.cells = kwargs['cells'] + self.bounding_box = kwargs['bounding_box'] + + +class DataTableCell(msrest.serialization.Model): + """Information about the extracted cell in a table. + + All required parameters must be populated in order to send to Azure. + + :param row_index: Required. Row index of the cell. + :type row_index: int + :param column_index: Required. Column index of the cell. + :type column_index: int + :param row_span: Number of rows spanned by this cell. + :type row_span: int + :param column_span: Number of columns spanned by this cell. + :type column_span: int + :param text: Required. Text content of the cell. + :type text: str + :param bounding_box: Required. Bounding box of the cell. + :type bounding_box: list[float] + :param confidence: Required. Confidence value. + :type confidence: float + :param elements: When includeTextDetails is set to true, a list of references to the text + elements constituting this table cell. + :type elements: list[str] + :param is_header: Is the current cell a header cell?. + :type is_header: bool + :param is_footer: Is the current cell a footer cell?. + :type is_footer: bool + """ + + _validation = { + 'row_index': {'required': True, 'minimum': 0}, + 'column_index': {'required': True, 'minimum': 0}, + 'row_span': {'minimum': 1}, + 'column_span': {'minimum': 1}, + 'text': {'required': True}, + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + 'confidence': {'required': True, 'maximum': 1, 'minimum': 0}, + } + + _attribute_map = { + 'row_index': {'key': 'rowIndex', 'type': 'int'}, + 'column_index': {'key': 'columnIndex', 'type': 'int'}, + 'row_span': {'key': 'rowSpan', 'type': 'int'}, + 'column_span': {'key': 'columnSpan', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'elements': {'key': 'elements', 'type': '[str]'}, + 'is_header': {'key': 'isHeader', 'type': 'bool'}, + 'is_footer': {'key': 'isFooter', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DataTableCell, self).__init__(**kwargs) + self.row_index = kwargs['row_index'] + self.column_index = kwargs['column_index'] + self.row_span = kwargs.get('row_span', 1) + self.column_span = kwargs.get('column_span', 1) + self.text = kwargs['text'] + self.bounding_box = kwargs['bounding_box'] + self.confidence = kwargs['confidence'] + self.elements = kwargs.get('elements', None) + self.is_header = kwargs.get('is_header', False) + self.is_footer = kwargs.get('is_footer', False) + + +class DocumentResult(msrest.serialization.Model): + """A set of extracted fields corresponding to the input document. + + All required parameters must be populated in order to send to Azure. + + :param doc_type: Required. Document type. + :type doc_type: str + :param model_id: Model identifier. + :type model_id: str + :param page_range: Required. First and last page number where the document is found. + :type page_range: list[int] + :param doc_type_confidence: Predicted document type confidence. + :type doc_type_confidence: float + :param fields: Required. Dictionary of named field values. + :type fields: dict[str, ~azure.ai.formrecognizer.v2_1.models.FieldValue] + """ + + _validation = { + 'doc_type': {'required': True}, + 'page_range': {'required': True, 'max_items': 2, 'min_items': 2}, + 'doc_type_confidence': {'maximum': 1, 'minimum': 0}, + 'fields': {'required': True}, + } + + _attribute_map = { + 'doc_type': {'key': 'docType', 'type': 'str'}, + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'page_range': {'key': 'pageRange', 'type': '[int]'}, + 'doc_type_confidence': {'key': 'docTypeConfidence', 'type': 'float'}, + 'fields': {'key': 'fields', 'type': '{FieldValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(DocumentResult, self).__init__(**kwargs) + self.doc_type = kwargs['doc_type'] + self.model_id = kwargs.get('model_id', None) + self.page_range = kwargs['page_range'] + self.doc_type_confidence = kwargs.get('doc_type_confidence', None) + self.fields = kwargs['fields'] + + +class ErrorInformation(msrest.serialization.Model): + """ErrorInformation. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. + :type code: str + :param message: Required. + :type message: str + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorInformation, self).__init__(**kwargs) + self.code = kwargs['code'] + self.message = kwargs['message'] + + +class ErrorResponse(msrest.serialization.Model): + """ErrorResponse. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. + :type error: ~azure.ai.formrecognizer.v2_1.models.ErrorInformation + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorInformation'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs['error'] + + +class FieldValue(msrest.serialization.Model): + """Recognized field value. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Type of field value. Possible values include: "string", "date", "time", + "phoneNumber", "number", "integer", "array", "object", "selectionMark", "gender", "country". + :type type: str or ~azure.ai.formrecognizer.v2_1.models.FieldValueType + :param value_string: String value. + :type value_string: str + :param value_date: Date value. + :type value_date: ~datetime.date + :param value_time: Time value. + :type value_time: ~datetime.time + :param value_phone_number: Phone number value. + :type value_phone_number: str + :param value_number: Floating point value. + :type value_number: float + :param value_integer: Integer value. + :type value_integer: int + :param value_array: Array of field values. + :type value_array: list[~azure.ai.formrecognizer.v2_1.models.FieldValue] + :param value_object: Dictionary of named field values. + :type value_object: dict[str, ~azure.ai.formrecognizer.v2_1.models.FieldValue] + :param value_selection_mark: Selection mark value. Possible values include: "selected", + "unselected". + :type value_selection_mark: str or ~azure.ai.formrecognizer.v2_1.models.FieldValueSelectionMark + :param value_gender: Gender value: M, F, or X. Possible values include: "M", "F", "X". + :type value_gender: str or ~azure.ai.formrecognizer.v2_1.models.FieldValueGender + :param value_country: 3-letter country code (ISO 3166-1 alpha-3). + :type value_country: str + :param text: Text content of the extracted field. + :type text: str + :param bounding_box: Bounding box of the field value, if appropriate. + :type bounding_box: list[float] + :param confidence: Confidence score. + :type confidence: float + :param elements: When includeTextDetails is set to true, a list of references to the text + elements constituting this field. + :type elements: list[str] + :param page: The 1-based page number in the input document. + :type page: int + """ + + _validation = { + 'type': {'required': True}, + 'bounding_box': {'max_items': 8, 'min_items': 8}, + 'confidence': {'maximum': 1, 'minimum': 0}, + 'page': {'minimum': 1}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value_string': {'key': 'valueString', 'type': 'str'}, + 'value_date': {'key': 'valueDate', 'type': 'date'}, + 'value_time': {'key': 'valueTime', 'type': 'time'}, + 'value_phone_number': {'key': 'valuePhoneNumber', 'type': 'str'}, + 'value_number': {'key': 'valueNumber', 'type': 'float'}, + 'value_integer': {'key': 'valueInteger', 'type': 'int'}, + 'value_array': {'key': 'valueArray', 'type': '[FieldValue]'}, + 'value_object': {'key': 'valueObject', 'type': '{FieldValue}'}, + 'value_selection_mark': {'key': 'valueSelectionMark', 'type': 'str'}, + 'value_gender': {'key': 'valueGender', 'type': 'str'}, + 'value_country': {'key': 'valueCountry', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'elements': {'key': 'elements', 'type': '[str]'}, + 'page': {'key': 'page', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(FieldValue, self).__init__(**kwargs) + self.type = kwargs['type'] + self.value_string = kwargs.get('value_string', None) + self.value_date = kwargs.get('value_date', None) + self.value_time = kwargs.get('value_time', None) + self.value_phone_number = kwargs.get('value_phone_number', None) + self.value_number = kwargs.get('value_number', None) + self.value_integer = kwargs.get('value_integer', None) + self.value_array = kwargs.get('value_array', None) + self.value_object = kwargs.get('value_object', None) + self.value_selection_mark = kwargs.get('value_selection_mark', None) + self.value_gender = kwargs.get('value_gender', None) + self.value_country = kwargs.get('value_country', None) + self.text = kwargs.get('text', None) + self.bounding_box = kwargs.get('bounding_box', None) + self.confidence = kwargs.get('confidence', None) + self.elements = kwargs.get('elements', None) + self.page = kwargs.get('page', None) + + +class FormFieldsReport(msrest.serialization.Model): + """Report for a custom model training field. + + All required parameters must be populated in order to send to Azure. + + :param field_name: Required. Training field name. + :type field_name: str + :param accuracy: Required. Estimated extraction accuracy for this field. + :type accuracy: float + """ + + _validation = { + 'field_name': {'required': True}, + 'accuracy': {'required': True}, + } + + _attribute_map = { + 'field_name': {'key': 'fieldName', 'type': 'str'}, + 'accuracy': {'key': 'accuracy', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(FormFieldsReport, self).__init__(**kwargs) + self.field_name = kwargs['field_name'] + self.accuracy = kwargs['accuracy'] + + +class KeysResult(msrest.serialization.Model): + """Keys extracted by the custom model. + + All required parameters must be populated in order to send to Azure. + + :param clusters: Required. Object mapping clusterIds to a list of keys. + :type clusters: dict[str, list[str]] + """ + + _validation = { + 'clusters': {'required': True}, + } + + _attribute_map = { + 'clusters': {'key': 'clusters', 'type': '{[str]}'}, + } + + def __init__( + self, + **kwargs + ): + super(KeysResult, self).__init__(**kwargs) + self.clusters = kwargs['clusters'] + + +class KeyValueElement(msrest.serialization.Model): + """Information about the extracted key or value in a key-value pair. + + All required parameters must be populated in order to send to Azure. + + :param type: Semantic data type of the key value element. Possible values include: "string", + "selectionMark". + :type type: str or ~azure.ai.formrecognizer.v2_1.models.KeyValueType + :param text: Required. The text content of the key or value. + :type text: str + :param bounding_box: Bounding box of the key or value. + :type bounding_box: list[float] + :param elements: When includeTextDetails is set to true, a list of references to the text + elements constituting this key or value. + :type elements: list[str] + """ + + _validation = { + 'text': {'required': True}, + 'bounding_box': {'max_items': 8, 'min_items': 8}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'elements': {'key': 'elements', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyValueElement, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.text = kwargs['text'] + self.bounding_box = kwargs.get('bounding_box', None) + self.elements = kwargs.get('elements', None) + + +class KeyValuePair(msrest.serialization.Model): + """Information about the extracted key-value pair. + + All required parameters must be populated in order to send to Azure. + + :param label: A user defined label for the key/value pair entry. + :type label: str + :param key: Required. Information about the extracted key in a key-value pair. + :type key: ~azure.ai.formrecognizer.v2_1.models.KeyValueElement + :param value: Required. Information about the extracted value in a key-value pair. + :type value: ~azure.ai.formrecognizer.v2_1.models.KeyValueElement + :param confidence: Required. Confidence value. + :type confidence: float + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'confidence': {'required': True, 'maximum': 1, 'minimum': 0}, + } + + _attribute_map = { + 'label': {'key': 'label', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'KeyValueElement'}, + 'value': {'key': 'value', 'type': 'KeyValueElement'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyValuePair, self).__init__(**kwargs) + self.label = kwargs.get('label', None) + self.key = kwargs['key'] + self.value = kwargs['value'] + self.confidence = kwargs['confidence'] + + +class Model(msrest.serialization.Model): + """Response to the get custom model operation. + + All required parameters must be populated in order to send to Azure. + + :param model_info: Required. Basic custom model information. + :type model_info: ~azure.ai.formrecognizer.v2_1.models.ModelInfo + :param keys: Keys extracted by the custom model. + :type keys: ~azure.ai.formrecognizer.v2_1.models.KeysResult + :param train_result: Training result for custom model. + :type train_result: ~azure.ai.formrecognizer.v2_1.models.TrainResult + :param composed_train_results: Training result for composed model. + :type composed_train_results: list[~azure.ai.formrecognizer.v2_1.models.TrainResult] + """ + + _validation = { + 'model_info': {'required': True}, + } + + _attribute_map = { + 'model_info': {'key': 'modelInfo', 'type': 'ModelInfo'}, + 'keys': {'key': 'keys', 'type': 'KeysResult'}, + 'train_result': {'key': 'trainResult', 'type': 'TrainResult'}, + 'composed_train_results': {'key': 'composedTrainResults', 'type': '[TrainResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(Model, self).__init__(**kwargs) + self.model_info = kwargs['model_info'] + self.keys = kwargs.get('keys', None) + self.train_result = kwargs.get('train_result', None) + self.composed_train_results = kwargs.get('composed_train_results', None) + + +class ModelInfo(msrest.serialization.Model): + """Basic custom model information. + + All required parameters must be populated in order to send to Azure. + + :param model_id: Required. Model identifier. + :type model_id: str + :param status: Required. Status of the model. Possible values include: "creating", "ready", + "invalid". + :type status: str or ~azure.ai.formrecognizer.v2_1.models.ModelStatus + :param created_date_time: Required. Date and time (UTC) when the model was created. + :type created_date_time: ~datetime.datetime + :param last_updated_date_time: Required. Date and time (UTC) when the status was last updated. + :type last_updated_date_time: ~datetime.datetime + :param model_name: Optional user defined model name (max length: 1024). + :type model_name: str + :param attributes: Optional model attributes. + :type attributes: ~azure.ai.formrecognizer.v2_1.models.Attributes + """ + + _validation = { + 'model_id': {'required': True}, + 'status': {'required': True}, + 'created_date_time': {'required': True}, + 'last_updated_date_time': {'required': True}, + } + + _attribute_map = { + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'iso-8601'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'Attributes'}, + } + + def __init__( + self, + **kwargs + ): + super(ModelInfo, self).__init__(**kwargs) + self.model_id = kwargs['model_id'] + self.status = kwargs['status'] + self.created_date_time = kwargs['created_date_time'] + self.last_updated_date_time = kwargs['last_updated_date_time'] + self.model_name = kwargs.get('model_name', None) + self.attributes = kwargs.get('attributes', None) + + +class Models(msrest.serialization.Model): + """Response to the list custom models operation. + + :param summary: Summary of all trained custom models. + :type summary: ~azure.ai.formrecognizer.v2_1.models.ModelsSummary + :param model_list: Collection of trained custom models. + :type model_list: list[~azure.ai.formrecognizer.v2_1.models.ModelInfo] + :param next_link: Link to the next page of custom models. + :type next_link: str + """ + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'ModelsSummary'}, + 'model_list': {'key': 'modelList', 'type': '[ModelInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Models, self).__init__(**kwargs) + self.summary = kwargs.get('summary', None) + self.model_list = kwargs.get('model_list', None) + self.next_link = kwargs.get('next_link', None) + + +class ModelsSummary(msrest.serialization.Model): + """Summary of all trained custom models. + + All required parameters must be populated in order to send to Azure. + + :param count: Required. Current count of trained custom models. + :type count: int + :param limit: Required. Max number of models that can be trained for this account. + :type limit: int + :param last_updated_date_time: Required. Date and time (UTC) when the summary was last updated. + :type last_updated_date_time: ~datetime.datetime + """ + + _validation = { + 'count': {'required': True}, + 'limit': {'required': True}, + 'last_updated_date_time': {'required': True}, + } + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(ModelsSummary, self).__init__(**kwargs) + self.count = kwargs['count'] + self.limit = kwargs['limit'] + self.last_updated_date_time = kwargs['last_updated_date_time'] + + +class PageResult(msrest.serialization.Model): + """Extracted information from a single page. + + All required parameters must be populated in order to send to Azure. + + :param page: Required. Page number. + :type page: int + :param cluster_id: Cluster identifier. + :type cluster_id: int + :param key_value_pairs: List of key-value pairs extracted from the page. + :type key_value_pairs: list[~azure.ai.formrecognizer.v2_1.models.KeyValuePair] + :param tables: List of data tables extracted from the page. + :type tables: list[~azure.ai.formrecognizer.v2_1.models.DataTable] + """ + + _validation = { + 'page': {'required': True, 'minimum': 1}, + 'cluster_id': {'minimum': 0}, + } + + _attribute_map = { + 'page': {'key': 'page', 'type': 'int'}, + 'cluster_id': {'key': 'clusterId', 'type': 'int'}, + 'key_value_pairs': {'key': 'keyValuePairs', 'type': '[KeyValuePair]'}, + 'tables': {'key': 'tables', 'type': '[DataTable]'}, + } + + def __init__( + self, + **kwargs + ): + super(PageResult, self).__init__(**kwargs) + self.page = kwargs['page'] + self.cluster_id = kwargs.get('cluster_id', None) + self.key_value_pairs = kwargs.get('key_value_pairs', None) + self.tables = kwargs.get('tables', None) + + +class ReadResult(msrest.serialization.Model): + """Text extracted from a page in the input document. + + All required parameters must be populated in order to send to Azure. + + :param page: Required. The 1-based page number in the input document. + :type page: int + :param angle: Required. The general orientation of the text in clockwise direction, measured in + degrees between (-180, 180]. + :type angle: float + :param width: Required. The width of the image/PDF in pixels/inches, respectively. + :type width: float + :param height: Required. The height of the image/PDF in pixels/inches, respectively. + :type height: float + :param unit: Required. The unit used by the width, height and boundingBox properties. For + images, the unit is "pixel". For PDF, the unit is "inch". Possible values include: "pixel", + "inch". + :type unit: str or ~azure.ai.formrecognizer.v2_1.models.LengthUnit + :param lines: When includeTextDetails is set to true, a list of recognized text lines. The + maximum number of lines returned is 300 per page. The lines are sorted top to bottom, left to + right, although in certain cases proximity is treated with higher priority. As the sorting + order depends on the detected text, it may change across images and OCR version updates. Thus, + business logic should be built upon the actual line location instead of order. + :type lines: list[~azure.ai.formrecognizer.v2_1.models.TextLine] + :param selection_marks: List of selection marks extracted from the page. + :type selection_marks: list[~azure.ai.formrecognizer.v2_1.models.SelectionMark] + """ + + _validation = { + 'page': {'required': True, 'minimum': 1}, + 'angle': {'required': True, 'maximum': 180, 'minimum_ex': -180}, + 'width': {'required': True, 'minimum': 0}, + 'height': {'required': True, 'minimum': 0}, + 'unit': {'required': True}, + } + + _attribute_map = { + 'page': {'key': 'page', 'type': 'int'}, + 'angle': {'key': 'angle', 'type': 'float'}, + 'width': {'key': 'width', 'type': 'float'}, + 'height': {'key': 'height', 'type': 'float'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'lines': {'key': 'lines', 'type': '[TextLine]'}, + 'selection_marks': {'key': 'selectionMarks', 'type': '[SelectionMark]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReadResult, self).__init__(**kwargs) + self.page = kwargs['page'] + self.angle = kwargs['angle'] + self.width = kwargs['width'] + self.height = kwargs['height'] + self.unit = kwargs['unit'] + self.lines = kwargs.get('lines', None) + self.selection_marks = kwargs.get('selection_marks', None) + + +class SelectionMark(msrest.serialization.Model): + """Information about the extracted selection mark. + + All required parameters must be populated in order to send to Azure. + + :param bounding_box: Required. Bounding box of the selection mark. + :type bounding_box: list[float] + :param confidence: Required. Confidence value. + :type confidence: float + :param state: Required. State of the selection mark. Possible values include: "selected", + "unselected". + :type state: str or ~azure.ai.formrecognizer.v2_1.models.SelectionMarkState + """ + + _validation = { + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + 'confidence': {'required': True, 'maximum': 1, 'minimum': 0}, + 'state': {'required': True}, + } + + _attribute_map = { + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SelectionMark, self).__init__(**kwargs) + self.bounding_box = kwargs['bounding_box'] + self.confidence = kwargs['confidence'] + self.state = kwargs['state'] + + +class SourcePath(msrest.serialization.Model): + """Uri or local path to source data. + + :param source: File source path. + :type source: str + """ + + _validation = { + 'source': {'max_length': 2048, 'min_length': 0}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SourcePath, self).__init__(**kwargs) + self.source = kwargs.get('source', None) + + +class Style(msrest.serialization.Model): + """An object representing the style of the text line. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The text line style name, including handwriting and other. Possible + values include: "other", "handwriting". + :type name: str or ~azure.ai.formrecognizer.v2_1.models.TextStyle + :param confidence: Required. The confidence of text line style. + :type confidence: float + """ + + _validation = { + 'name': {'required': True}, + 'confidence': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(Style, self).__init__(**kwargs) + self.name = kwargs['name'] + self.confidence = kwargs['confidence'] + + +class TextLine(msrest.serialization.Model): + """An object representing an extracted text line. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. The text content of the line. + :type text: str + :param bounding_box: Required. Bounding box of an extracted line. + :type bounding_box: list[float] + :param words: Required. List of words in the text line. + :type words: list[~azure.ai.formrecognizer.v2_1.models.TextWord] + :param appearance: Text appearance properties. + :type appearance: ~azure.ai.formrecognizer.v2_1.models.Appearance + """ + + _validation = { + 'text': {'required': True}, + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + 'words': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'words': {'key': 'words', 'type': '[TextWord]'}, + 'appearance': {'key': 'appearance', 'type': 'Appearance'}, + } + + def __init__( + self, + **kwargs + ): + super(TextLine, self).__init__(**kwargs) + self.text = kwargs['text'] + self.bounding_box = kwargs['bounding_box'] + self.words = kwargs['words'] + self.appearance = kwargs.get('appearance', None) + + +class TextWord(msrest.serialization.Model): + """An object representing a word. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. The text content of the word. + :type text: str + :param bounding_box: Required. Bounding box of an extracted word. + :type bounding_box: list[float] + :param confidence: Confidence value. + :type confidence: float + """ + + _validation = { + 'text': {'required': True}, + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + 'confidence': {'maximum': 1, 'minimum': 0}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(TextWord, self).__init__(**kwargs) + self.text = kwargs['text'] + self.bounding_box = kwargs['bounding_box'] + self.confidence = kwargs.get('confidence', None) + + +class TrainingDocumentInfo(msrest.serialization.Model): + """Report for a custom model training document. + + All required parameters must be populated in order to send to Azure. + + :param document_name: Required. Training document name. + :type document_name: str + :param pages: Required. Total number of pages trained. + :type pages: int + :param errors: Required. List of errors. + :type errors: list[~azure.ai.formrecognizer.v2_1.models.ErrorInformation] + :param status: Required. Status of the training operation. Possible values include: + "succeeded", "partiallySucceeded", "failed". + :type status: str or ~azure.ai.formrecognizer.v2_1.models.TrainStatus + """ + + _validation = { + 'document_name': {'required': True}, + 'pages': {'required': True}, + 'errors': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'document_name': {'key': 'documentName', 'type': 'str'}, + 'pages': {'key': 'pages', 'type': 'int'}, + 'errors': {'key': 'errors', 'type': '[ErrorInformation]'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrainingDocumentInfo, self).__init__(**kwargs) + self.document_name = kwargs['document_name'] + self.pages = kwargs['pages'] + self.errors = kwargs['errors'] + self.status = kwargs['status'] + + +class TrainRequest(msrest.serialization.Model): + """Request parameter to train a new custom model. + + All required parameters must be populated in order to send to Azure. + + :param source: Required. Source path containing the training documents. + :type source: str + :param source_filter: Filter to apply to the documents in the source path for training. + :type source_filter: ~azure.ai.formrecognizer.v2_1.models.TrainSourceFilter + :param use_label_file: Use label file for training a model. + :type use_label_file: bool + :param model_name: Optional user defined model name (max length: 1024). + :type model_name: str + """ + + _validation = { + 'source': {'required': True, 'max_length': 2048, 'min_length': 0}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'str'}, + 'source_filter': {'key': 'sourceFilter', 'type': 'TrainSourceFilter'}, + 'use_label_file': {'key': 'useLabelFile', 'type': 'bool'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrainRequest, self).__init__(**kwargs) + self.source = kwargs['source'] + self.source_filter = kwargs.get('source_filter', None) + self.use_label_file = kwargs.get('use_label_file', False) + self.model_name = kwargs.get('model_name', None) + + +class TrainResult(msrest.serialization.Model): + """Custom model training result. + + All required parameters must be populated in order to send to Azure. + + :param training_documents: Required. List of the documents used to train the model and any + errors reported in each document. + :type training_documents: list[~azure.ai.formrecognizer.v2_1.models.TrainingDocumentInfo] + :param fields: List of fields used to train the model and the train operation error reported by + each. + :type fields: list[~azure.ai.formrecognizer.v2_1.models.FormFieldsReport] + :param average_model_accuracy: Average accuracy. + :type average_model_accuracy: float + :param model_id: Model identifier. + :type model_id: str + :param errors: Errors returned during the training operation. + :type errors: list[~azure.ai.formrecognizer.v2_1.models.ErrorInformation] + """ + + _validation = { + 'training_documents': {'required': True}, + } + + _attribute_map = { + 'training_documents': {'key': 'trainingDocuments', 'type': '[TrainingDocumentInfo]'}, + 'fields': {'key': 'fields', 'type': '[FormFieldsReport]'}, + 'average_model_accuracy': {'key': 'averageModelAccuracy', 'type': 'float'}, + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[ErrorInformation]'}, + } + + def __init__( + self, + **kwargs + ): + super(TrainResult, self).__init__(**kwargs) + self.training_documents = kwargs['training_documents'] + self.fields = kwargs.get('fields', None) + self.average_model_accuracy = kwargs.get('average_model_accuracy', None) + self.model_id = kwargs.get('model_id', None) + self.errors = kwargs.get('errors', None) + + +class TrainSourceFilter(msrest.serialization.Model): + """Filter to apply to the documents in the source path for training. + + :param prefix: A case-sensitive prefix string to filter documents in the source path for + training. For example, when using a Azure storage blob Uri, use the prefix to restrict sub + folders for training. + :type prefix: str + :param include_sub_folders: A flag to indicate if sub folders within the set of prefix folders + will also need to be included when searching for content to be preprocessed. + :type include_sub_folders: bool + """ + + _validation = { + 'prefix': {'max_length': 1024, 'min_length': 0}, + } + + _attribute_map = { + 'prefix': {'key': 'prefix', 'type': 'str'}, + 'include_sub_folders': {'key': 'includeSubFolders', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(TrainSourceFilter, self).__init__(**kwargs) + self.prefix = kwargs.get('prefix', None) + self.include_sub_folders = kwargs.get('include_sub_folders', False) diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/_models_py3.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/_models_py3.py new file mode 100644 index 000000000000..50277ec26f67 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/models/_models_py3.py @@ -0,0 +1,1474 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._form_recognizer_client_enums import * + + +class AnalyzeOperationResult(msrest.serialization.Model): + """Status and result of the queued analyze operation. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. Operation status. Possible values include: "notStarted", "running", + "succeeded", "failed". + :type status: str or ~azure.ai.formrecognizer.v2_1.models.OperationStatus + :param created_date_time: Required. Date and time (UTC) when the analyze operation was + submitted. + :type created_date_time: ~datetime.datetime + :param last_updated_date_time: Required. Date and time (UTC) when the status was last updated. + :type last_updated_date_time: ~datetime.datetime + :param analyze_result: Results of the analyze operation. + :type analyze_result: ~azure.ai.formrecognizer.v2_1.models.AnalyzeResult + """ + + _validation = { + 'status': {'required': True}, + 'created_date_time': {'required': True}, + 'last_updated_date_time': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'iso-8601'}, + 'analyze_result': {'key': 'analyzeResult', 'type': 'AnalyzeResult'}, + } + + def __init__( + self, + *, + status: Union[str, "OperationStatus"], + created_date_time: datetime.datetime, + last_updated_date_time: datetime.datetime, + analyze_result: Optional["AnalyzeResult"] = None, + **kwargs + ): + super(AnalyzeOperationResult, self).__init__(**kwargs) + self.status = status + self.created_date_time = created_date_time + self.last_updated_date_time = last_updated_date_time + self.analyze_result = analyze_result + + +class AnalyzeResult(msrest.serialization.Model): + """Analyze operation result. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. Version of schema used for this result. + :type version: str + :param read_results: Required. Text extracted from the input. + :type read_results: list[~azure.ai.formrecognizer.v2_1.models.ReadResult] + :param page_results: Page-level information extracted from the input. + :type page_results: list[~azure.ai.formrecognizer.v2_1.models.PageResult] + :param document_results: Document-level information extracted from the input. + :type document_results: list[~azure.ai.formrecognizer.v2_1.models.DocumentResult] + :param errors: List of errors reported during the analyze operation. + :type errors: list[~azure.ai.formrecognizer.v2_1.models.ErrorInformation] + """ + + _validation = { + 'version': {'required': True}, + 'read_results': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'read_results': {'key': 'readResults', 'type': '[ReadResult]'}, + 'page_results': {'key': 'pageResults', 'type': '[PageResult]'}, + 'document_results': {'key': 'documentResults', 'type': '[DocumentResult]'}, + 'errors': {'key': 'errors', 'type': '[ErrorInformation]'}, + } + + def __init__( + self, + *, + version: str, + read_results: List["ReadResult"], + page_results: Optional[List["PageResult"]] = None, + document_results: Optional[List["DocumentResult"]] = None, + errors: Optional[List["ErrorInformation"]] = None, + **kwargs + ): + super(AnalyzeResult, self).__init__(**kwargs) + self.version = version + self.read_results = read_results + self.page_results = page_results + self.document_results = document_results + self.errors = errors + + +class Appearance(msrest.serialization.Model): + """An object representing the appearance of the text line. + + All required parameters must be populated in order to send to Azure. + + :param style: Required. An object representing the style of the text line. + :type style: ~azure.ai.formrecognizer.v2_1.models.Style + """ + + _validation = { + 'style': {'required': True}, + } + + _attribute_map = { + 'style': {'key': 'style', 'type': 'Style'}, + } + + def __init__( + self, + *, + style: "Style", + **kwargs + ): + super(Appearance, self).__init__(**kwargs) + self.style = style + + +class Attributes(msrest.serialization.Model): + """Optional model attributes. + + :param is_composed: Is this model composed? (default: false). + :type is_composed: bool + """ + + _attribute_map = { + 'is_composed': {'key': 'isComposed', 'type': 'bool'}, + } + + def __init__( + self, + *, + is_composed: Optional[bool] = False, + **kwargs + ): + super(Attributes, self).__init__(**kwargs) + self.is_composed = is_composed + + +class ComposeRequest(msrest.serialization.Model): + """Request contract for compose operation. + + All required parameters must be populated in order to send to Azure. + + :param model_ids: Required. List of model ids to compose. + :type model_ids: list[str] + :param model_name: Optional user defined model name (max length: 1024). + :type model_name: str + """ + + _validation = { + 'model_ids': {'required': True}, + } + + _attribute_map = { + 'model_ids': {'key': 'modelIds', 'type': '[str]'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + } + + def __init__( + self, + *, + model_ids: List[str], + model_name: Optional[str] = None, + **kwargs + ): + super(ComposeRequest, self).__init__(**kwargs) + self.model_ids = model_ids + self.model_name = model_name + + +class CopyAuthorizationResult(msrest.serialization.Model): + """Request parameter that contains authorization claims for copy operation. + + All required parameters must be populated in order to send to Azure. + + :param model_id: Required. Model identifier. + :type model_id: str + :param access_token: Required. Token claim used to authorize the request. + :type access_token: str + :param expiration_date_time_ticks: Required. The time when the access token expires. The date + is represented as the number of seconds from 1970-01-01T0:0:0Z UTC until the expiration time. + :type expiration_date_time_ticks: long + """ + + _validation = { + 'model_id': {'required': True}, + 'access_token': {'required': True}, + 'expiration_date_time_ticks': {'required': True}, + } + + _attribute_map = { + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'access_token': {'key': 'accessToken', 'type': 'str'}, + 'expiration_date_time_ticks': {'key': 'expirationDateTimeTicks', 'type': 'long'}, + } + + def __init__( + self, + *, + model_id: str, + access_token: str, + expiration_date_time_ticks: int, + **kwargs + ): + super(CopyAuthorizationResult, self).__init__(**kwargs) + self.model_id = model_id + self.access_token = access_token + self.expiration_date_time_ticks = expiration_date_time_ticks + + +class CopyOperationResult(msrest.serialization.Model): + """Status and result of the queued copy operation. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. Operation status. Possible values include: "notStarted", "running", + "succeeded", "failed". + :type status: str or ~azure.ai.formrecognizer.v2_1.models.OperationStatus + :param created_date_time: Required. Date and time (UTC) when the copy operation was submitted. + :type created_date_time: ~datetime.datetime + :param last_updated_date_time: Required. Date and time (UTC) when the status was last updated. + :type last_updated_date_time: ~datetime.datetime + :param copy_result: Results of the copy operation. + :type copy_result: ~azure.ai.formrecognizer.v2_1.models.CopyResult + """ + + _validation = { + 'status': {'required': True}, + 'created_date_time': {'required': True}, + 'last_updated_date_time': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'iso-8601'}, + 'copy_result': {'key': 'copyResult', 'type': 'CopyResult'}, + } + + def __init__( + self, + *, + status: Union[str, "OperationStatus"], + created_date_time: datetime.datetime, + last_updated_date_time: datetime.datetime, + copy_result: Optional["CopyResult"] = None, + **kwargs + ): + super(CopyOperationResult, self).__init__(**kwargs) + self.status = status + self.created_date_time = created_date_time + self.last_updated_date_time = last_updated_date_time + self.copy_result = copy_result + + +class CopyRequest(msrest.serialization.Model): + """Request parameter to copy an existing custom model from the source resource to a target resource referenced by the resource ID. + + All required parameters must be populated in order to send to Azure. + + :param target_resource_id: Required. Azure Resource Id of the target Form Recognizer resource + where the model is copied to. + :type target_resource_id: str + :param target_resource_region: Required. Location of the target Azure resource. A valid Azure + region name supported by Cognitive Services. + :type target_resource_region: str + :param copy_authorization: Required. Entity that encodes claims to authorize the copy request. + :type copy_authorization: ~azure.ai.formrecognizer.v2_1.models.CopyAuthorizationResult + """ + + _validation = { + 'target_resource_id': {'required': True, 'max_length': 1024, 'min_length': 0, 'pattern': r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.CognitiveServices/accounts/[^/]*$'}, + 'target_resource_region': {'required': True, 'max_length': 24, 'min_length': 1, 'pattern': r'^[a-z0-9]+$'}, + 'copy_authorization': {'required': True}, + } + + _attribute_map = { + 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + 'target_resource_region': {'key': 'targetResourceRegion', 'type': 'str'}, + 'copy_authorization': {'key': 'copyAuthorization', 'type': 'CopyAuthorizationResult'}, + } + + def __init__( + self, + *, + target_resource_id: str, + target_resource_region: str, + copy_authorization: "CopyAuthorizationResult", + **kwargs + ): + super(CopyRequest, self).__init__(**kwargs) + self.target_resource_id = target_resource_id + self.target_resource_region = target_resource_region + self.copy_authorization = copy_authorization + + +class CopyResult(msrest.serialization.Model): + """Custom model copy result. + + All required parameters must be populated in order to send to Azure. + + :param model_id: Required. Identifier of the target model. + :type model_id: str + :param errors: Errors returned during the copy operation. + :type errors: list[~azure.ai.formrecognizer.v2_1.models.ErrorInformation] + """ + + _validation = { + 'model_id': {'required': True}, + } + + _attribute_map = { + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[ErrorInformation]'}, + } + + def __init__( + self, + *, + model_id: str, + errors: Optional[List["ErrorInformation"]] = None, + **kwargs + ): + super(CopyResult, self).__init__(**kwargs) + self.model_id = model_id + self.errors = errors + + +class DataTable(msrest.serialization.Model): + """Information about the extracted table contained in a page. + + All required parameters must be populated in order to send to Azure. + + :param rows: Required. Number of rows. + :type rows: int + :param columns: Required. Number of columns. + :type columns: int + :param cells: Required. List of cells contained in the table. + :type cells: list[~azure.ai.formrecognizer.v2_1.models.DataTableCell] + :param bounding_box: Required. Bounding box of the table. + :type bounding_box: list[float] + """ + + _validation = { + 'rows': {'required': True, 'minimum': 1}, + 'columns': {'required': True, 'minimum': 1}, + 'cells': {'required': True}, + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + } + + _attribute_map = { + 'rows': {'key': 'rows', 'type': 'int'}, + 'columns': {'key': 'columns', 'type': 'int'}, + 'cells': {'key': 'cells', 'type': '[DataTableCell]'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + } + + def __init__( + self, + *, + rows: int, + columns: int, + cells: List["DataTableCell"], + bounding_box: List[float], + **kwargs + ): + super(DataTable, self).__init__(**kwargs) + self.rows = rows + self.columns = columns + self.cells = cells + self.bounding_box = bounding_box + + +class DataTableCell(msrest.serialization.Model): + """Information about the extracted cell in a table. + + All required parameters must be populated in order to send to Azure. + + :param row_index: Required. Row index of the cell. + :type row_index: int + :param column_index: Required. Column index of the cell. + :type column_index: int + :param row_span: Number of rows spanned by this cell. + :type row_span: int + :param column_span: Number of columns spanned by this cell. + :type column_span: int + :param text: Required. Text content of the cell. + :type text: str + :param bounding_box: Required. Bounding box of the cell. + :type bounding_box: list[float] + :param confidence: Required. Confidence value. + :type confidence: float + :param elements: When includeTextDetails is set to true, a list of references to the text + elements constituting this table cell. + :type elements: list[str] + :param is_header: Is the current cell a header cell?. + :type is_header: bool + :param is_footer: Is the current cell a footer cell?. + :type is_footer: bool + """ + + _validation = { + 'row_index': {'required': True, 'minimum': 0}, + 'column_index': {'required': True, 'minimum': 0}, + 'row_span': {'minimum': 1}, + 'column_span': {'minimum': 1}, + 'text': {'required': True}, + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + 'confidence': {'required': True, 'maximum': 1, 'minimum': 0}, + } + + _attribute_map = { + 'row_index': {'key': 'rowIndex', 'type': 'int'}, + 'column_index': {'key': 'columnIndex', 'type': 'int'}, + 'row_span': {'key': 'rowSpan', 'type': 'int'}, + 'column_span': {'key': 'columnSpan', 'type': 'int'}, + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'elements': {'key': 'elements', 'type': '[str]'}, + 'is_header': {'key': 'isHeader', 'type': 'bool'}, + 'is_footer': {'key': 'isFooter', 'type': 'bool'}, + } + + def __init__( + self, + *, + row_index: int, + column_index: int, + text: str, + bounding_box: List[float], + confidence: float, + row_span: Optional[int] = 1, + column_span: Optional[int] = 1, + elements: Optional[List[str]] = None, + is_header: Optional[bool] = False, + is_footer: Optional[bool] = False, + **kwargs + ): + super(DataTableCell, self).__init__(**kwargs) + self.row_index = row_index + self.column_index = column_index + self.row_span = row_span + self.column_span = column_span + self.text = text + self.bounding_box = bounding_box + self.confidence = confidence + self.elements = elements + self.is_header = is_header + self.is_footer = is_footer + + +class DocumentResult(msrest.serialization.Model): + """A set of extracted fields corresponding to the input document. + + All required parameters must be populated in order to send to Azure. + + :param doc_type: Required. Document type. + :type doc_type: str + :param model_id: Model identifier. + :type model_id: str + :param page_range: Required. First and last page number where the document is found. + :type page_range: list[int] + :param doc_type_confidence: Predicted document type confidence. + :type doc_type_confidence: float + :param fields: Required. Dictionary of named field values. + :type fields: dict[str, ~azure.ai.formrecognizer.v2_1.models.FieldValue] + """ + + _validation = { + 'doc_type': {'required': True}, + 'page_range': {'required': True, 'max_items': 2, 'min_items': 2}, + 'doc_type_confidence': {'maximum': 1, 'minimum': 0}, + 'fields': {'required': True}, + } + + _attribute_map = { + 'doc_type': {'key': 'docType', 'type': 'str'}, + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'page_range': {'key': 'pageRange', 'type': '[int]'}, + 'doc_type_confidence': {'key': 'docTypeConfidence', 'type': 'float'}, + 'fields': {'key': 'fields', 'type': '{FieldValue}'}, + } + + def __init__( + self, + *, + doc_type: str, + page_range: List[int], + fields: Dict[str, "FieldValue"], + model_id: Optional[str] = None, + doc_type_confidence: Optional[float] = None, + **kwargs + ): + super(DocumentResult, self).__init__(**kwargs) + self.doc_type = doc_type + self.model_id = model_id + self.page_range = page_range + self.doc_type_confidence = doc_type_confidence + self.fields = fields + + +class ErrorInformation(msrest.serialization.Model): + """ErrorInformation. + + All required parameters must be populated in order to send to Azure. + + :param code: Required. + :type code: str + :param message: Required. + :type message: str + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: str, + message: str, + **kwargs + ): + super(ErrorInformation, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ErrorResponse(msrest.serialization.Model): + """ErrorResponse. + + All required parameters must be populated in order to send to Azure. + + :param error: Required. + :type error: ~azure.ai.formrecognizer.v2_1.models.ErrorInformation + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorInformation'}, + } + + def __init__( + self, + *, + error: "ErrorInformation", + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class FieldValue(msrest.serialization.Model): + """Recognized field value. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Type of field value. Possible values include: "string", "date", "time", + "phoneNumber", "number", "integer", "array", "object", "selectionMark", "gender", "country". + :type type: str or ~azure.ai.formrecognizer.v2_1.models.FieldValueType + :param value_string: String value. + :type value_string: str + :param value_date: Date value. + :type value_date: ~datetime.date + :param value_time: Time value. + :type value_time: ~datetime.time + :param value_phone_number: Phone number value. + :type value_phone_number: str + :param value_number: Floating point value. + :type value_number: float + :param value_integer: Integer value. + :type value_integer: int + :param value_array: Array of field values. + :type value_array: list[~azure.ai.formrecognizer.v2_1.models.FieldValue] + :param value_object: Dictionary of named field values. + :type value_object: dict[str, ~azure.ai.formrecognizer.v2_1.models.FieldValue] + :param value_selection_mark: Selection mark value. Possible values include: "selected", + "unselected". + :type value_selection_mark: str or ~azure.ai.formrecognizer.v2_1.models.FieldValueSelectionMark + :param value_gender: Gender value: M, F, or X. Possible values include: "M", "F", "X". + :type value_gender: str or ~azure.ai.formrecognizer.v2_1.models.FieldValueGender + :param value_country: 3-letter country code (ISO 3166-1 alpha-3). + :type value_country: str + :param text: Text content of the extracted field. + :type text: str + :param bounding_box: Bounding box of the field value, if appropriate. + :type bounding_box: list[float] + :param confidence: Confidence score. + :type confidence: float + :param elements: When includeTextDetails is set to true, a list of references to the text + elements constituting this field. + :type elements: list[str] + :param page: The 1-based page number in the input document. + :type page: int + """ + + _validation = { + 'type': {'required': True}, + 'bounding_box': {'max_items': 8, 'min_items': 8}, + 'confidence': {'maximum': 1, 'minimum': 0}, + 'page': {'minimum': 1}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'value_string': {'key': 'valueString', 'type': 'str'}, + 'value_date': {'key': 'valueDate', 'type': 'date'}, + 'value_time': {'key': 'valueTime', 'type': 'time'}, + 'value_phone_number': {'key': 'valuePhoneNumber', 'type': 'str'}, + 'value_number': {'key': 'valueNumber', 'type': 'float'}, + 'value_integer': {'key': 'valueInteger', 'type': 'int'}, + 'value_array': {'key': 'valueArray', 'type': '[FieldValue]'}, + 'value_object': {'key': 'valueObject', 'type': '{FieldValue}'}, + 'value_selection_mark': {'key': 'valueSelectionMark', 'type': 'str'}, + 'value_gender': {'key': 'valueGender', 'type': 'str'}, + 'value_country': {'key': 'valueCountry', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'elements': {'key': 'elements', 'type': '[str]'}, + 'page': {'key': 'page', 'type': 'int'}, + } + + def __init__( + self, + *, + type: Union[str, "FieldValueType"], + value_string: Optional[str] = None, + value_date: Optional[datetime.date] = None, + value_time: Optional[datetime.time] = None, + value_phone_number: Optional[str] = None, + value_number: Optional[float] = None, + value_integer: Optional[int] = None, + value_array: Optional[List["FieldValue"]] = None, + value_object: Optional[Dict[str, "FieldValue"]] = None, + value_selection_mark: Optional[Union[str, "FieldValueSelectionMark"]] = None, + value_gender: Optional[Union[str, "FieldValueGender"]] = None, + value_country: Optional[str] = None, + text: Optional[str] = None, + bounding_box: Optional[List[float]] = None, + confidence: Optional[float] = None, + elements: Optional[List[str]] = None, + page: Optional[int] = None, + **kwargs + ): + super(FieldValue, self).__init__(**kwargs) + self.type = type + self.value_string = value_string + self.value_date = value_date + self.value_time = value_time + self.value_phone_number = value_phone_number + self.value_number = value_number + self.value_integer = value_integer + self.value_array = value_array + self.value_object = value_object + self.value_selection_mark = value_selection_mark + self.value_gender = value_gender + self.value_country = value_country + self.text = text + self.bounding_box = bounding_box + self.confidence = confidence + self.elements = elements + self.page = page + + +class FormFieldsReport(msrest.serialization.Model): + """Report for a custom model training field. + + All required parameters must be populated in order to send to Azure. + + :param field_name: Required. Training field name. + :type field_name: str + :param accuracy: Required. Estimated extraction accuracy for this field. + :type accuracy: float + """ + + _validation = { + 'field_name': {'required': True}, + 'accuracy': {'required': True}, + } + + _attribute_map = { + 'field_name': {'key': 'fieldName', 'type': 'str'}, + 'accuracy': {'key': 'accuracy', 'type': 'float'}, + } + + def __init__( + self, + *, + field_name: str, + accuracy: float, + **kwargs + ): + super(FormFieldsReport, self).__init__(**kwargs) + self.field_name = field_name + self.accuracy = accuracy + + +class KeysResult(msrest.serialization.Model): + """Keys extracted by the custom model. + + All required parameters must be populated in order to send to Azure. + + :param clusters: Required. Object mapping clusterIds to a list of keys. + :type clusters: dict[str, list[str]] + """ + + _validation = { + 'clusters': {'required': True}, + } + + _attribute_map = { + 'clusters': {'key': 'clusters', 'type': '{[str]}'}, + } + + def __init__( + self, + *, + clusters: Dict[str, List[str]], + **kwargs + ): + super(KeysResult, self).__init__(**kwargs) + self.clusters = clusters + + +class KeyValueElement(msrest.serialization.Model): + """Information about the extracted key or value in a key-value pair. + + All required parameters must be populated in order to send to Azure. + + :param type: Semantic data type of the key value element. Possible values include: "string", + "selectionMark". + :type type: str or ~azure.ai.formrecognizer.v2_1.models.KeyValueType + :param text: Required. The text content of the key or value. + :type text: str + :param bounding_box: Bounding box of the key or value. + :type bounding_box: list[float] + :param elements: When includeTextDetails is set to true, a list of references to the text + elements constituting this key or value. + :type elements: list[str] + """ + + _validation = { + 'text': {'required': True}, + 'bounding_box': {'max_items': 8, 'min_items': 8}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'elements': {'key': 'elements', 'type': '[str]'}, + } + + def __init__( + self, + *, + text: str, + type: Optional[Union[str, "KeyValueType"]] = None, + bounding_box: Optional[List[float]] = None, + elements: Optional[List[str]] = None, + **kwargs + ): + super(KeyValueElement, self).__init__(**kwargs) + self.type = type + self.text = text + self.bounding_box = bounding_box + self.elements = elements + + +class KeyValuePair(msrest.serialization.Model): + """Information about the extracted key-value pair. + + All required parameters must be populated in order to send to Azure. + + :param label: A user defined label for the key/value pair entry. + :type label: str + :param key: Required. Information about the extracted key in a key-value pair. + :type key: ~azure.ai.formrecognizer.v2_1.models.KeyValueElement + :param value: Required. Information about the extracted value in a key-value pair. + :type value: ~azure.ai.formrecognizer.v2_1.models.KeyValueElement + :param confidence: Required. Confidence value. + :type confidence: float + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'confidence': {'required': True, 'maximum': 1, 'minimum': 0}, + } + + _attribute_map = { + 'label': {'key': 'label', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'KeyValueElement'}, + 'value': {'key': 'value', 'type': 'KeyValueElement'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + } + + def __init__( + self, + *, + key: "KeyValueElement", + value: "KeyValueElement", + confidence: float, + label: Optional[str] = None, + **kwargs + ): + super(KeyValuePair, self).__init__(**kwargs) + self.label = label + self.key = key + self.value = value + self.confidence = confidence + + +class Model(msrest.serialization.Model): + """Response to the get custom model operation. + + All required parameters must be populated in order to send to Azure. + + :param model_info: Required. Basic custom model information. + :type model_info: ~azure.ai.formrecognizer.v2_1.models.ModelInfo + :param keys: Keys extracted by the custom model. + :type keys: ~azure.ai.formrecognizer.v2_1.models.KeysResult + :param train_result: Training result for custom model. + :type train_result: ~azure.ai.formrecognizer.v2_1.models.TrainResult + :param composed_train_results: Training result for composed model. + :type composed_train_results: list[~azure.ai.formrecognizer.v2_1.models.TrainResult] + """ + + _validation = { + 'model_info': {'required': True}, + } + + _attribute_map = { + 'model_info': {'key': 'modelInfo', 'type': 'ModelInfo'}, + 'keys': {'key': 'keys', 'type': 'KeysResult'}, + 'train_result': {'key': 'trainResult', 'type': 'TrainResult'}, + 'composed_train_results': {'key': 'composedTrainResults', 'type': '[TrainResult]'}, + } + + def __init__( + self, + *, + model_info: "ModelInfo", + keys: Optional["KeysResult"] = None, + train_result: Optional["TrainResult"] = None, + composed_train_results: Optional[List["TrainResult"]] = None, + **kwargs + ): + super(Model, self).__init__(**kwargs) + self.model_info = model_info + self.keys = keys + self.train_result = train_result + self.composed_train_results = composed_train_results + + +class ModelInfo(msrest.serialization.Model): + """Basic custom model information. + + All required parameters must be populated in order to send to Azure. + + :param model_id: Required. Model identifier. + :type model_id: str + :param status: Required. Status of the model. Possible values include: "creating", "ready", + "invalid". + :type status: str or ~azure.ai.formrecognizer.v2_1.models.ModelStatus + :param created_date_time: Required. Date and time (UTC) when the model was created. + :type created_date_time: ~datetime.datetime + :param last_updated_date_time: Required. Date and time (UTC) when the status was last updated. + :type last_updated_date_time: ~datetime.datetime + :param model_name: Optional user defined model name (max length: 1024). + :type model_name: str + :param attributes: Optional model attributes. + :type attributes: ~azure.ai.formrecognizer.v2_1.models.Attributes + """ + + _validation = { + 'model_id': {'required': True}, + 'status': {'required': True}, + 'created_date_time': {'required': True}, + 'last_updated_date_time': {'required': True}, + } + + _attribute_map = { + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'created_date_time': {'key': 'createdDateTime', 'type': 'iso-8601'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'iso-8601'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'Attributes'}, + } + + def __init__( + self, + *, + model_id: str, + status: Union[str, "ModelStatus"], + created_date_time: datetime.datetime, + last_updated_date_time: datetime.datetime, + model_name: Optional[str] = None, + attributes: Optional["Attributes"] = None, + **kwargs + ): + super(ModelInfo, self).__init__(**kwargs) + self.model_id = model_id + self.status = status + self.created_date_time = created_date_time + self.last_updated_date_time = last_updated_date_time + self.model_name = model_name + self.attributes = attributes + + +class Models(msrest.serialization.Model): + """Response to the list custom models operation. + + :param summary: Summary of all trained custom models. + :type summary: ~azure.ai.formrecognizer.v2_1.models.ModelsSummary + :param model_list: Collection of trained custom models. + :type model_list: list[~azure.ai.formrecognizer.v2_1.models.ModelInfo] + :param next_link: Link to the next page of custom models. + :type next_link: str + """ + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'ModelsSummary'}, + 'model_list': {'key': 'modelList', 'type': '[ModelInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + summary: Optional["ModelsSummary"] = None, + model_list: Optional[List["ModelInfo"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(Models, self).__init__(**kwargs) + self.summary = summary + self.model_list = model_list + self.next_link = next_link + + +class ModelsSummary(msrest.serialization.Model): + """Summary of all trained custom models. + + All required parameters must be populated in order to send to Azure. + + :param count: Required. Current count of trained custom models. + :type count: int + :param limit: Required. Max number of models that can be trained for this account. + :type limit: int + :param last_updated_date_time: Required. Date and time (UTC) when the summary was last updated. + :type last_updated_date_time: ~datetime.datetime + """ + + _validation = { + 'count': {'required': True}, + 'limit': {'required': True}, + 'last_updated_date_time': {'required': True}, + } + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'last_updated_date_time': {'key': 'lastUpdatedDateTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + count: int, + limit: int, + last_updated_date_time: datetime.datetime, + **kwargs + ): + super(ModelsSummary, self).__init__(**kwargs) + self.count = count + self.limit = limit + self.last_updated_date_time = last_updated_date_time + + +class PageResult(msrest.serialization.Model): + """Extracted information from a single page. + + All required parameters must be populated in order to send to Azure. + + :param page: Required. Page number. + :type page: int + :param cluster_id: Cluster identifier. + :type cluster_id: int + :param key_value_pairs: List of key-value pairs extracted from the page. + :type key_value_pairs: list[~azure.ai.formrecognizer.v2_1.models.KeyValuePair] + :param tables: List of data tables extracted from the page. + :type tables: list[~azure.ai.formrecognizer.v2_1.models.DataTable] + """ + + _validation = { + 'page': {'required': True, 'minimum': 1}, + 'cluster_id': {'minimum': 0}, + } + + _attribute_map = { + 'page': {'key': 'page', 'type': 'int'}, + 'cluster_id': {'key': 'clusterId', 'type': 'int'}, + 'key_value_pairs': {'key': 'keyValuePairs', 'type': '[KeyValuePair]'}, + 'tables': {'key': 'tables', 'type': '[DataTable]'}, + } + + def __init__( + self, + *, + page: int, + cluster_id: Optional[int] = None, + key_value_pairs: Optional[List["KeyValuePair"]] = None, + tables: Optional[List["DataTable"]] = None, + **kwargs + ): + super(PageResult, self).__init__(**kwargs) + self.page = page + self.cluster_id = cluster_id + self.key_value_pairs = key_value_pairs + self.tables = tables + + +class ReadResult(msrest.serialization.Model): + """Text extracted from a page in the input document. + + All required parameters must be populated in order to send to Azure. + + :param page: Required. The 1-based page number in the input document. + :type page: int + :param angle: Required. The general orientation of the text in clockwise direction, measured in + degrees between (-180, 180]. + :type angle: float + :param width: Required. The width of the image/PDF in pixels/inches, respectively. + :type width: float + :param height: Required. The height of the image/PDF in pixels/inches, respectively. + :type height: float + :param unit: Required. The unit used by the width, height and boundingBox properties. For + images, the unit is "pixel". For PDF, the unit is "inch". Possible values include: "pixel", + "inch". + :type unit: str or ~azure.ai.formrecognizer.v2_1.models.LengthUnit + :param lines: When includeTextDetails is set to true, a list of recognized text lines. The + maximum number of lines returned is 300 per page. The lines are sorted top to bottom, left to + right, although in certain cases proximity is treated with higher priority. As the sorting + order depends on the detected text, it may change across images and OCR version updates. Thus, + business logic should be built upon the actual line location instead of order. + :type lines: list[~azure.ai.formrecognizer.v2_1.models.TextLine] + :param selection_marks: List of selection marks extracted from the page. + :type selection_marks: list[~azure.ai.formrecognizer.v2_1.models.SelectionMark] + """ + + _validation = { + 'page': {'required': True, 'minimum': 1}, + 'angle': {'required': True, 'maximum': 180, 'minimum_ex': -180}, + 'width': {'required': True, 'minimum': 0}, + 'height': {'required': True, 'minimum': 0}, + 'unit': {'required': True}, + } + + _attribute_map = { + 'page': {'key': 'page', 'type': 'int'}, + 'angle': {'key': 'angle', 'type': 'float'}, + 'width': {'key': 'width', 'type': 'float'}, + 'height': {'key': 'height', 'type': 'float'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'lines': {'key': 'lines', 'type': '[TextLine]'}, + 'selection_marks': {'key': 'selectionMarks', 'type': '[SelectionMark]'}, + } + + def __init__( + self, + *, + page: int, + angle: float, + width: float, + height: float, + unit: Union[str, "LengthUnit"], + lines: Optional[List["TextLine"]] = None, + selection_marks: Optional[List["SelectionMark"]] = None, + **kwargs + ): + super(ReadResult, self).__init__(**kwargs) + self.page = page + self.angle = angle + self.width = width + self.height = height + self.unit = unit + self.lines = lines + self.selection_marks = selection_marks + + +class SelectionMark(msrest.serialization.Model): + """Information about the extracted selection mark. + + All required parameters must be populated in order to send to Azure. + + :param bounding_box: Required. Bounding box of the selection mark. + :type bounding_box: list[float] + :param confidence: Required. Confidence value. + :type confidence: float + :param state: Required. State of the selection mark. Possible values include: "selected", + "unselected". + :type state: str or ~azure.ai.formrecognizer.v2_1.models.SelectionMarkState + """ + + _validation = { + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + 'confidence': {'required': True, 'maximum': 1, 'minimum': 0}, + 'state': {'required': True}, + } + + _attribute_map = { + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + bounding_box: List[float], + confidence: float, + state: Union[str, "SelectionMarkState"], + **kwargs + ): + super(SelectionMark, self).__init__(**kwargs) + self.bounding_box = bounding_box + self.confidence = confidence + self.state = state + + +class SourcePath(msrest.serialization.Model): + """Uri or local path to source data. + + :param source: File source path. + :type source: str + """ + + _validation = { + 'source': {'max_length': 2048, 'min_length': 0}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'str'}, + } + + def __init__( + self, + *, + source: Optional[str] = None, + **kwargs + ): + super(SourcePath, self).__init__(**kwargs) + self.source = source + + +class Style(msrest.serialization.Model): + """An object representing the style of the text line. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The text line style name, including handwriting and other. Possible + values include: "other", "handwriting". + :type name: str or ~azure.ai.formrecognizer.v2_1.models.TextStyle + :param confidence: Required. The confidence of text line style. + :type confidence: float + """ + + _validation = { + 'name': {'required': True}, + 'confidence': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + } + + def __init__( + self, + *, + name: Union[str, "TextStyle"], + confidence: float, + **kwargs + ): + super(Style, self).__init__(**kwargs) + self.name = name + self.confidence = confidence + + +class TextLine(msrest.serialization.Model): + """An object representing an extracted text line. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. The text content of the line. + :type text: str + :param bounding_box: Required. Bounding box of an extracted line. + :type bounding_box: list[float] + :param words: Required. List of words in the text line. + :type words: list[~azure.ai.formrecognizer.v2_1.models.TextWord] + :param appearance: Text appearance properties. + :type appearance: ~azure.ai.formrecognizer.v2_1.models.Appearance + """ + + _validation = { + 'text': {'required': True}, + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + 'words': {'required': True}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'words': {'key': 'words', 'type': '[TextWord]'}, + 'appearance': {'key': 'appearance', 'type': 'Appearance'}, + } + + def __init__( + self, + *, + text: str, + bounding_box: List[float], + words: List["TextWord"], + appearance: Optional["Appearance"] = None, + **kwargs + ): + super(TextLine, self).__init__(**kwargs) + self.text = text + self.bounding_box = bounding_box + self.words = words + self.appearance = appearance + + +class TextWord(msrest.serialization.Model): + """An object representing a word. + + All required parameters must be populated in order to send to Azure. + + :param text: Required. The text content of the word. + :type text: str + :param bounding_box: Required. Bounding box of an extracted word. + :type bounding_box: list[float] + :param confidence: Confidence value. + :type confidence: float + """ + + _validation = { + 'text': {'required': True}, + 'bounding_box': {'required': True, 'max_items': 8, 'min_items': 8}, + 'confidence': {'maximum': 1, 'minimum': 0}, + } + + _attribute_map = { + 'text': {'key': 'text', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': '[float]'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + } + + def __init__( + self, + *, + text: str, + bounding_box: List[float], + confidence: Optional[float] = None, + **kwargs + ): + super(TextWord, self).__init__(**kwargs) + self.text = text + self.bounding_box = bounding_box + self.confidence = confidence + + +class TrainingDocumentInfo(msrest.serialization.Model): + """Report for a custom model training document. + + All required parameters must be populated in order to send to Azure. + + :param document_name: Required. Training document name. + :type document_name: str + :param pages: Required. Total number of pages trained. + :type pages: int + :param errors: Required. List of errors. + :type errors: list[~azure.ai.formrecognizer.v2_1.models.ErrorInformation] + :param status: Required. Status of the training operation. Possible values include: + "succeeded", "partiallySucceeded", "failed". + :type status: str or ~azure.ai.formrecognizer.v2_1.models.TrainStatus + """ + + _validation = { + 'document_name': {'required': True}, + 'pages': {'required': True}, + 'errors': {'required': True}, + 'status': {'required': True}, + } + + _attribute_map = { + 'document_name': {'key': 'documentName', 'type': 'str'}, + 'pages': {'key': 'pages', 'type': 'int'}, + 'errors': {'key': 'errors', 'type': '[ErrorInformation]'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + *, + document_name: str, + pages: int, + errors: List["ErrorInformation"], + status: Union[str, "TrainStatus"], + **kwargs + ): + super(TrainingDocumentInfo, self).__init__(**kwargs) + self.document_name = document_name + self.pages = pages + self.errors = errors + self.status = status + + +class TrainRequest(msrest.serialization.Model): + """Request parameter to train a new custom model. + + All required parameters must be populated in order to send to Azure. + + :param source: Required. Source path containing the training documents. + :type source: str + :param source_filter: Filter to apply to the documents in the source path for training. + :type source_filter: ~azure.ai.formrecognizer.v2_1.models.TrainSourceFilter + :param use_label_file: Use label file for training a model. + :type use_label_file: bool + :param model_name: Optional user defined model name (max length: 1024). + :type model_name: str + """ + + _validation = { + 'source': {'required': True, 'max_length': 2048, 'min_length': 0}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'str'}, + 'source_filter': {'key': 'sourceFilter', 'type': 'TrainSourceFilter'}, + 'use_label_file': {'key': 'useLabelFile', 'type': 'bool'}, + 'model_name': {'key': 'modelName', 'type': 'str'}, + } + + def __init__( + self, + *, + source: str, + source_filter: Optional["TrainSourceFilter"] = None, + use_label_file: Optional[bool] = False, + model_name: Optional[str] = None, + **kwargs + ): + super(TrainRequest, self).__init__(**kwargs) + self.source = source + self.source_filter = source_filter + self.use_label_file = use_label_file + self.model_name = model_name + + +class TrainResult(msrest.serialization.Model): + """Custom model training result. + + All required parameters must be populated in order to send to Azure. + + :param training_documents: Required. List of the documents used to train the model and any + errors reported in each document. + :type training_documents: list[~azure.ai.formrecognizer.v2_1.models.TrainingDocumentInfo] + :param fields: List of fields used to train the model and the train operation error reported by + each. + :type fields: list[~azure.ai.formrecognizer.v2_1.models.FormFieldsReport] + :param average_model_accuracy: Average accuracy. + :type average_model_accuracy: float + :param model_id: Model identifier. + :type model_id: str + :param errors: Errors returned during the training operation. + :type errors: list[~azure.ai.formrecognizer.v2_1.models.ErrorInformation] + """ + + _validation = { + 'training_documents': {'required': True}, + } + + _attribute_map = { + 'training_documents': {'key': 'trainingDocuments', 'type': '[TrainingDocumentInfo]'}, + 'fields': {'key': 'fields', 'type': '[FormFieldsReport]'}, + 'average_model_accuracy': {'key': 'averageModelAccuracy', 'type': 'float'}, + 'model_id': {'key': 'modelId', 'type': 'str'}, + 'errors': {'key': 'errors', 'type': '[ErrorInformation]'}, + } + + def __init__( + self, + *, + training_documents: List["TrainingDocumentInfo"], + fields: Optional[List["FormFieldsReport"]] = None, + average_model_accuracy: Optional[float] = None, + model_id: Optional[str] = None, + errors: Optional[List["ErrorInformation"]] = None, + **kwargs + ): + super(TrainResult, self).__init__(**kwargs) + self.training_documents = training_documents + self.fields = fields + self.average_model_accuracy = average_model_accuracy + self.model_id = model_id + self.errors = errors + + +class TrainSourceFilter(msrest.serialization.Model): + """Filter to apply to the documents in the source path for training. + + :param prefix: A case-sensitive prefix string to filter documents in the source path for + training. For example, when using a Azure storage blob Uri, use the prefix to restrict sub + folders for training. + :type prefix: str + :param include_sub_folders: A flag to indicate if sub folders within the set of prefix folders + will also need to be included when searching for content to be preprocessed. + :type include_sub_folders: bool + """ + + _validation = { + 'prefix': {'max_length': 1024, 'min_length': 0}, + } + + _attribute_map = { + 'prefix': {'key': 'prefix', 'type': 'str'}, + 'include_sub_folders': {'key': 'includeSubFolders', 'type': 'bool'}, + } + + def __init__( + self, + *, + prefix: Optional[str] = None, + include_sub_folders: Optional[bool] = False, + **kwargs + ): + super(TrainSourceFilter, self).__init__(**kwargs) + self.prefix = prefix + self.include_sub_folders = include_sub_folders diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/operations/__init__.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/operations/__init__.py new file mode 100644 index 000000000000..f2f858714054 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/operations/__init__.py @@ -0,0 +1,13 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._form_recognizer_client_operations import FormRecognizerClientOperationsMixin + +__all__ = [ + 'FormRecognizerClientOperationsMixin', +] diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/operations/_form_recognizer_client_operations.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/operations/_form_recognizer_client_operations.py new file mode 100644 index 000000000000..de68683c1328 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/operations/_form_recognizer_client_operations.py @@ -0,0 +1,1980 @@ +# 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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, IO, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class FormRecognizerClientOperationsMixin(object): + + def _train_custom_model_async_initial( + self, + train_request, # type: "_models.TrainRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._train_custom_model_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(train_request, 'TrainRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _train_custom_model_async_initial.metadata = {'url': '/custom/models'} # type: ignore + + def begin_train_custom_model_async( + self, + train_request, # type: "_models.TrainRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Train Custom Model. + + Create and train a custom model. The request must include a source parameter that is either an + externally accessible Azure storage blob container Uri (preferably a Shared Access Signature + Uri) or valid path to a data folder in a locally mounted drive. When local paths are specified, + they must follow the Linux/Unix path format and be an absolute path rooted to the input mount + configuration setting value e.g., if '{Mounts:Input}' configuration setting value is '/input' + then a valid source path would be '/input/contosodataset'. All data to be trained is expected + to be under the source folder or sub folders under it. Models are trained using documents that + are of the following content type - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff' + or 'image/bmp'. Other type of content is ignored. + + :param train_request: Training request parameters. + :type train_request: ~azure.ai.formrecognizer.v2_1.models.TrainRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._train_custom_model_async_initial( + train_request=train_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_train_custom_model_async.metadata = {'url': '/custom/models'} # type: ignore + + def get_custom_model( + self, + model_id, # type: str + include_keys=False, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.Model" + """Get Custom Model. + + Get detailed information about a custom model. + + :param model_id: Model identifier. + :type model_id: str + :param include_keys: Include list of extracted keys in model information. + :type include_keys: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Model, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.Model + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Model"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_custom_model.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_keys is not None: + query_parameters['includeKeys'] = self._serialize.query("include_keys", include_keys, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Model', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_custom_model.metadata = {'url': '/custom/models/{modelId}'} # type: ignore + + def delete_custom_model( + self, + model_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete Custom Model. + + Mark model for deletion. Model artifacts will be permanently removed within a predetermined + period. + + :param model_id: Model identifier. + :type model_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.delete_custom_model.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_custom_model.metadata = {'url': '/custom/models/{modelId}'} # type: ignore + + def _analyze_with_custom_model_initial( + self, + model_id, # type: str + include_text_details=False, # type: Optional[bool] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_with_custom_model_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_with_custom_model_initial.metadata = {'url': '/custom/models/{modelId}/analyze'} # type: ignore + + def begin_analyze_with_custom_model( + self, + model_id, # type: str + include_text_details=False, # type: Optional[bool] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Analyze Form. + + Extract key-value pairs, tables, and semantic values from a given document. The input document + must be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', + 'image/tiff' or 'image/bmp'. Alternatively, use 'application/json' type to specify the location + (Uri or local path) of the document to be analyzed. + + :param model_id: Model identifier. + :type model_id: str + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._analyze_with_custom_model_initial( + model_id=model_id, + include_text_details=include_text_details, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_with_custom_model.metadata = {'url': '/custom/models/{modelId}/analyze'} # type: ignore + + def get_analyze_form_result( + self, + model_id, # type: str + result_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AnalyzeOperationResult" + """Get Analyze Form Result. + + Obtain current status and the result of the analyze form operation. + + :param model_id: Model identifier. + :type model_id: str + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_form_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_form_result.metadata = {'url': '/custom/models/{modelId}/analyzeResults/{resultId}'} # type: ignore + + def _copy_custom_model_initial( + self, + model_id, # type: str + copy_request, # type: "_models.CopyRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._copy_custom_model_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(copy_request, 'CopyRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _copy_custom_model_initial.metadata = {'url': '/custom/models/{modelId}/copy'} # type: ignore + + def begin_copy_custom_model( + self, + model_id, # type: str + copy_request, # type: "_models.CopyRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Copy Custom Model. + + Copy custom model stored in this resource (the source) to user specified target Form Recognizer + resource. + + :param model_id: Model identifier. + :type model_id: str + :param copy_request: Copy request parameters. + :type copy_request: ~azure.ai.formrecognizer.v2_1.models.CopyRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._copy_custom_model_initial( + model_id=model_id, + copy_request=copy_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_copy_custom_model.metadata = {'url': '/custom/models/{modelId}/copy'} # type: ignore + + def get_custom_model_copy_result( + self, + model_id, # type: str + result_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CopyOperationResult" + """Get Custom Model Copy Result. + + Obtain current status and the result of a custom model copy operation. + + :param model_id: Model identifier. + :type model_id: str + :param result_id: Copy operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CopyOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.CopyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CopyOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_custom_model_copy_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'modelId': self._serialize.url("model_id", model_id, 'str'), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CopyOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_custom_model_copy_result.metadata = {'url': '/custom/models/{modelId}/copyResults/{resultId}'} # type: ignore + + def generate_model_copy_authorization( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.CopyAuthorizationResult" + """Generate Copy Authorization. + + Generate authorization to copy a model into the target Form Recognizer resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CopyAuthorizationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.CopyAuthorizationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CopyAuthorizationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.generate_model_copy_authorization.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + deserialized = self._deserialize('CopyAuthorizationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + generate_model_copy_authorization.metadata = {'url': '/custom/models/copyAuthorization'} # type: ignore + + def _compose_custom_models_async_initial( + self, + compose_request, # type: "_models.ComposeRequest" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._compose_custom_models_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(compose_request, 'ComposeRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _compose_custom_models_async_initial.metadata = {'url': '/custom/models/compose'} # type: ignore + + def begin_compose_custom_models_async( + self, + compose_request, # type: "_models.ComposeRequest" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Compose trained with labels models into one composed model. + + Compose request would include list of models ids. + It would validate what all models either trained with labels model or composed model. + It would validate limit of models put together. + + :param compose_request: Compose models. + :type compose_request: ~azure.ai.formrecognizer.v2_1.models.ComposeRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._compose_custom_models_async_initial( + compose_request=compose_request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_compose_custom_models_async.metadata = {'url': '/custom/models/compose'} # type: ignore + + def _analyze_business_card_async_initial( + self, + include_text_details=False, # type: Optional[bool] + locale=None, # type: Optional[Union[str, "_models.Locale"]] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_business_card_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if locale is not None: + query_parameters['locale'] = self._serialize.query("locale", locale, 'str') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_business_card_async_initial.metadata = {'url': '/prebuilt/businessCard/analyze'} # type: ignore + + def begin_analyze_business_card_async( + self, + include_text_details=False, # type: Optional[bool] + locale=None, # type: Optional[Union[str, "_models.Locale"]] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Analyze Business Card. + + Extract field text and semantic values from a given business card document. The input document + must be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', + 'image/tiff' or 'image/bmp'. Alternatively, use 'application/json' type to specify the location + (Uri) of the document to be analyzed. + + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB, + en-IN, en-US(default). + :type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._analyze_business_card_async_initial( + include_text_details=include_text_details, + locale=locale, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_business_card_async.metadata = {'url': '/prebuilt/businessCard/analyze'} # type: ignore + + def get_analyze_business_card_result( + self, + result_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AnalyzeOperationResult" + """Get Analyze Business Card Result. + + Track the progress and obtain the result of the analyze business card operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_business_card_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_business_card_result.metadata = {'url': '/prebuilt/businessCard/analyzeResults/{resultId}'} # type: ignore + + def _analyze_invoice_async_initial( + self, + include_text_details=False, # type: Optional[bool] + locale=None, # type: Optional[Union[str, "_models.Locale"]] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_invoice_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if locale is not None: + query_parameters['locale'] = self._serialize.query("locale", locale, 'str') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_invoice_async_initial.metadata = {'url': '/prebuilt/invoice/analyze'} # type: ignore + + def begin_analyze_invoice_async( + self, + include_text_details=False, # type: Optional[bool] + locale=None, # type: Optional[Union[str, "_models.Locale"]] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Analyze Invoice Document. + + Extract field text and semantic values from a given invoice document. The input document must + be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', + 'image/tiff' or 'image/bmp'. Alternatively, use 'application/json' type to specify the location + (Uri) of the document to be analyzed. + + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB, + en-IN, en-US(default). + :type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._analyze_invoice_async_initial( + include_text_details=include_text_details, + locale=locale, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_invoice_async.metadata = {'url': '/prebuilt/invoice/analyze'} # type: ignore + + def get_analyze_invoice_result( + self, + result_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AnalyzeOperationResult" + """Get Analyze Invoice Result. + + Track the progress and obtain the result of the analyze invoice operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_invoice_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_invoice_result.metadata = {'url': '/prebuilt/invoice/analyzeResults/{resultId}'} # type: ignore + + def _analyze_id_document_async_initial( + self, + include_text_details=False, # type: Optional[bool] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_id_document_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_id_document_async_initial.metadata = {'url': '/prebuilt/idDocument/analyze'} # type: ignore + + def begin_analyze_id_document_async( + self, + include_text_details=False, # type: Optional[bool] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Analyze ID Document. + + Extract field text and semantic values from a given ID document. The input document must be of + one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff' + or 'image/bmp'. Alternatively, use 'application/json' type to specify the location (Uri) of the + document to be analyzed. + + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._analyze_id_document_async_initial( + include_text_details=include_text_details, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_id_document_async.metadata = {'url': '/prebuilt/idDocument/analyze'} # type: ignore + + def get_analyze_id_document_result( + self, + result_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AnalyzeOperationResult" + """Get Analyze ID Document Result. + + Track the progress and obtain the result of the analyze ID operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_id_document_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_id_document_result.metadata = {'url': '/prebuilt/idDocument/analyzeResults/{resultId}'} # type: ignore + + def _analyze_receipt_async_initial( + self, + include_text_details=False, # type: Optional[bool] + locale=None, # type: Optional[Union[str, "_models.Locale"]] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_receipt_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_text_details is not None: + query_parameters['includeTextDetails'] = self._serialize.query("include_text_details", include_text_details, 'bool') + if locale is not None: + query_parameters['locale'] = self._serialize.query("locale", locale, 'str') + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_receipt_async_initial.metadata = {'url': '/prebuilt/receipt/analyze'} # type: ignore + + def begin_analyze_receipt_async( + self, + include_text_details=False, # type: Optional[bool] + locale=None, # type: Optional[Union[str, "_models.Locale"]] + pages=None, # type: Optional[List[str]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Analyze Receipt. + + Extract field text and semantic values from a given receipt document. The input document must + be of one of the supported content types - 'application/pdf', 'image/jpeg', 'image/png', + 'image/tiff' or 'image/bmp'. Alternatively, use 'application/json' type to specify the location + (Uri) of the document to be analyzed. + + :param include_text_details: Include text lines and element references in the result. + :type include_text_details: bool + :param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB, + en-IN, en-US(default). + :type locale: str or ~azure.ai.formrecognizer.v2_1.models.Locale + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._analyze_receipt_async_initial( + include_text_details=include_text_details, + locale=locale, + pages=pages, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_receipt_async.metadata = {'url': '/prebuilt/receipt/analyze'} # type: ignore + + def get_analyze_receipt_result( + self, + result_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AnalyzeOperationResult" + """Get Analyze Receipt Result. + + Track the progress and obtain the result of the analyze receipt operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_receipt_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_receipt_result.metadata = {'url': '/prebuilt/receipt/analyzeResults/{resultId}'} # type: ignore + + def _analyze_layout_async_initial( + self, + pages=None, # type: Optional[List[str]] + language=None, # type: Optional[Union[str, "_models.Language"]] + reading_order="basic", # type: Optional[Union[str, "_models.ReadingOrder"]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._analyze_layout_async_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if pages is not None: + query_parameters['pages'] = self._serialize.query("pages", pages, '[str]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if reading_order is not None: + query_parameters['readingOrder'] = self._serialize.query("reading_order", reading_order, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff']: + body_content_kwargs['stream_content'] = file_stream + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + if file_stream is not None: + body_content = self._serialize.body(file_stream, 'SourcePath') + else: + body_content = None + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/pdf', 'image/bmp', 'image/jpeg', 'image/png', 'image/tiff', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, None, response_headers) + + _analyze_layout_async_initial.metadata = {'url': '/layout/analyze'} # type: ignore + + def begin_analyze_layout_async( + self, + pages=None, # type: Optional[List[str]] + language=None, # type: Optional[Union[str, "_models.Language"]] + reading_order="basic", # type: Optional[Union[str, "_models.ReadingOrder"]] + file_stream=None, # type: Optional[Union[IO, "_models.SourcePath"]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Analyze Layout. + + Extract text and layout information from a given document. The input document must be of one of + the supported content types - 'application/pdf', 'image/jpeg', 'image/png', 'image/tiff' or + 'image/bmp'. Alternatively, use 'application/json' type to specify the location (Uri or local + path) of the document to be analyzed. + + :param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the + pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or + range with a comma. + :type pages: list[str] + :param language: Currently, only Afrikaans (‘af’), Albanian (‘sq’), Asturian (‘ast’), Basque + (‘eu’), Bislama (‘bi’), Breton (‘br’), Catalan (‘ca’), Cebuano (‘ceb’), Chamorro (‘ch’), + Cornish (‘kw’), Corsican (‘co’), Crimean Tatar - Latin script(‘crh’), Czech (‘cs’), Danish + (‘da’), Dutch (‘nl’), English ('en'), Estonian (‘et’), Fijian (‘fj’), Filipino (‘fil’), Finnish + (‘fi’), French (‘fr’), Friulian (‘fur’), Galician (‘gl’), German (‘de’), Gilbertese (‘gil’), + Greenlandic (‘kl’), Haitian Creole (‘ht’), Hani (‘hni’), Hmong Daw (‘mww’), Hungarian (‘hu’), + Indonesian (‘id’), Interlingua (‘ia’), Inuktitut (‘iu’), Irish (‘ga’), Italian (‘it’), Japanese + (‘ja’), Javanese (‘jv’), Kabuverdianu (‘kea’), Kachin (‘kac’), Kara-Kalpak (‘kaa’), Kashubian + (‘csb’), Khasi (‘kha’), Korean (‘ko’), Kurdish - Latin script (‘ku’), K’iche’ (‘quc’), + Luxembourgish (‘lb’), Malay (‘ms’), Manx (‘gv’), Neapolitan (‘nap’), Norwegian (‘no’), Occitan + (‘oc’), Polish (‘pl’), Portuguese (‘pt’), Romansh (‘rm’), Scots (‘sco’), Scottish Gaelic + (‘gd’), simplified Chinese (‘zh-Hans’), Slovenian (‘sl’), Spanish (‘es’), Swahili (‘sw’), + Swedish (‘sv’), Tatar - Latin script (‘tt’), Tetum (‘tet’), traditional Chinese (‘zh-Hant’), + Turkish (‘tr’), Upper Sorbian (‘hsb’), Uzbek (‘uz’), Volapük (‘vo’), Walser (‘wae’), Western + Frisian (‘fy’), Yucatec Maya (‘yua’), Zhuang (‘za’) and Zulu (‘zu’) are supported (print – + seventy-three languages and handwritten – English only). Layout supports auto language + identification and multi language documents, so only provide a language code if you would like + to force the documented to be processed as that specific language. + :type language: str or ~azure.ai.formrecognizer.v2_1.models.Language + :param reading_order: Reading order algorithm to sort the text lines returned. Supported + reading orders include: basic(default), natural. + :type reading_order: str or ~azure.ai.formrecognizer.v2_1.models.ReadingOrder + :param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream. + :type file_stream: IO or ~azure.ai.formrecognizer.v2_1.models.SourcePath + :keyword str content_type: Media type of the body sent to the API. Default value is "application/json". + Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._analyze_layout_async_initial( + pages=pages, + language=language, + reading_order=reading_order, + file_stream=file_stream, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_analyze_layout_async.metadata = {'url': '/layout/analyze'} # type: ignore + + def get_analyze_layout_result( + self, + result_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AnalyzeOperationResult" + """Get Analyze Layout Result. + + Track the progress and obtain the result of the analyze layout operation. + + :param result_id: Analyze operation result identifier. + :type result_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AnalyzeOperationResult, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.AnalyzeOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AnalyzeOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + + # Construct URL + url = self.get_analyze_layout_result.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + 'resultId': self._serialize.url("result_id", result_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AnalyzeOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_analyze_layout_result.metadata = {'url': '/layout/analyzeResults/{resultId}'} # type: ignore + + def list_custom_models( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.Models"] + """List Custom Models. + + Get information about all custom models. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Models or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.ai.formrecognizer.v2_1.models.Models] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Models"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + op = "full" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_custom_models.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['op'] = self._serialize.query("op", op, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('Models', pipeline_response) + list_of_elem = deserialized.model_list + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_custom_models.metadata = {'url': '/custom/models'} # type: ignore + + def get_custom_models( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.Models" + """Get Custom Models. + + Get information about all custom models. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Models, or the result of cls(response) + :rtype: ~azure.ai.formrecognizer.v2_1.models.Models + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Models"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + op = "summary" + accept = "application/json" + + # Construct URL + url = self.get_custom_models.metadata['url'] # type: ignore + path_format_arguments = { + 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['op'] = self._serialize.query("op", op, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Models', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_custom_models.metadata = {'url': '/custom/models'} # type: ignore diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/py.typed b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/_metadata.json b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/_metadata.json index f748aa5d61c0..d99f04b0bb0e 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/_metadata.json +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/_metadata.json @@ -106,12 +106,12 @@ "begin_train_custom_model_async" : { "sync": { "signature": "def begin_train_custom_model_async(\n self,\n train_request, # type: \"_models.TrainRequest\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Train Custom Model.\n\nCreate and train a custom model. The request must include a source parameter that is either an\nexternally accessible Azure storage blob container Uri (preferably a Shared Access Signature\nUri) or valid path to a data folder in a locally mounted drive. When local paths are specified,\nthey must follow the Linux/Unix path format and be an absolute path rooted to the input mount\nconfiguration setting value e.g., if \u0027{Mounts:Input}\u0027 configuration setting value is \u0027/input\u0027\nthen a valid source path would be \u0027/input/contosodataset\u0027. All data to be trained is expected\nto be under the source folder or sub folders under it. Models are trained using documents that\nare of the following content type - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Other type of content is ignored.\n\n:param train_request: Training request parameters.\n:type train_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.TrainRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Train Custom Model.\n\nCreate and train a custom model. The request must include a source parameter that is either an\nexternally accessible Azure storage blob container Uri (preferably a Shared Access Signature\nUri) or valid path to a data folder in a locally mounted drive. When local paths are specified,\nthey must follow the Linux/Unix path format and be an absolute path rooted to the input mount\nconfiguration setting value e.g., if \u0027{Mounts:Input}\u0027 configuration setting value is \u0027/input\u0027\nthen a valid source path would be \u0027/input/contosodataset\u0027. All data to be trained is expected\nto be under the source folder or sub folders under it. Models are trained using documents that\nare of the following content type - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Other type of content is ignored.\n\n:param train_request: Training request parameters.\n:type train_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.TrainRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_train_custom_model_async(\n self,\n train_request: \"_models.TrainRequest\",\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Train Custom Model.\n\nCreate and train a custom model. The request must include a source parameter that is either an\nexternally accessible Azure storage blob container Uri (preferably a Shared Access Signature\nUri) or valid path to a data folder in a locally mounted drive. When local paths are specified,\nthey must follow the Linux/Unix path format and be an absolute path rooted to the input mount\nconfiguration setting value e.g., if \u0027{Mounts:Input}\u0027 configuration setting value is \u0027/input\u0027\nthen a valid source path would be \u0027/input/contosodataset\u0027. All data to be trained is expected\nto be under the source folder or sub folders under it. Models are trained using documents that\nare of the following content type - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Other type of content is ignored.\n\n:param train_request: Training request parameters.\n:type train_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.TrainRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Train Custom Model.\n\nCreate and train a custom model. The request must include a source parameter that is either an\nexternally accessible Azure storage blob container Uri (preferably a Shared Access Signature\nUri) or valid path to a data folder in a locally mounted drive. When local paths are specified,\nthey must follow the Linux/Unix path format and be an absolute path rooted to the input mount\nconfiguration setting value e.g., if \u0027{Mounts:Input}\u0027 configuration setting value is \u0027/input\u0027\nthen a valid source path would be \u0027/input/contosodataset\u0027. All data to be trained is expected\nto be under the source folder or sub folders under it. Models are trained using documents that\nare of the following content type - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Other type of content is ignored.\n\n:param train_request: Training request parameters.\n:type train_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.TrainRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "train_request" }, @@ -154,12 +154,12 @@ "begin_analyze_with_custom_model" : { "sync": { "signature": "def begin_analyze_with_custom_model(\n self,\n model_id, # type: str\n include_text_details=False, # type: Optional[bool]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri or local path) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri or local path) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_analyze_with_custom_model(\n self,\n model_id: str,\n include_text_details: Optional[bool] = False,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri or local path) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Form.\n\nExtract key-value pairs, tables, and semantic values from a given document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri or local path) of the document to be analyzed.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "model_id, include_text_details, pages, file_stream" }, @@ -190,12 +190,12 @@ "begin_copy_custom_model" : { "sync": { "signature": "def begin_copy_custom_model(\n self,\n model_id, # type: str\n copy_request, # type: \"_models.CopyRequest\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_copy_custom_model(\n self,\n model_id: str,\n copy_request: \"_models.CopyRequest\",\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Copy Custom Model.\n\nCopy custom model stored in this resource (the source) to user specified target Form Recognizer\nresource.\n\n:param model_id: Model identifier.\n:type model_id: str\n:param copy_request: Copy request parameters.\n:type copy_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.CopyRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "model_id, copy_request" }, @@ -238,12 +238,12 @@ "begin_compose_custom_models_async" : { "sync": { "signature": "def begin_compose_custom_models_async(\n self,\n compose_request, # type: \"_models.ComposeRequest\"\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Compose trained with labels models into one composed model.\n\nCompose request would include list of models ids.\nIt would validate what all models either trained with labels model or composed model.\nIt would validate limit of models put together.\n\n:param compose_request: Compose models.\n:type compose_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.ComposeRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Compose trained with labels models into one composed model.\n\nCompose request would include list of models ids.\nIt would validate what all models either trained with labels model or composed model.\nIt would validate limit of models put together.\n\n:param compose_request: Compose models.\n:type compose_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.ComposeRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_compose_custom_models_async(\n self,\n compose_request: \"_models.ComposeRequest\",\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Compose trained with labels models into one composed model.\n\nCompose request would include list of models ids.\nIt would validate what all models either trained with labels model or composed model.\nIt would validate limit of models put together.\n\n:param compose_request: Compose models.\n:type compose_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.ComposeRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Compose trained with labels models into one composed model.\n\nCompose request would include list of models ids.\nIt would validate what all models either trained with labels model or composed model.\nIt would validate limit of models put together.\n\n:param compose_request: Compose models.\n:type compose_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.ComposeRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "compose_request" }, @@ -262,12 +262,12 @@ "begin_analyze_business_card_async" : { "sync": { "signature": "def begin_analyze_business_card_async(\n self,\n include_text_details=False, # type: Optional[bool]\n locale=None, # type: Optional[Union[str, \"_models.Locale\"]]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Analyze Business Card.\n\nExtract field text and semantic values from a given business card document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Business Card.\n\nExtract field text and semantic values from a given business card document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_analyze_business_card_async(\n self,\n include_text_details: Optional[bool] = False,\n locale: Optional[Union[str, \"_models.Locale\"]] = None,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Analyze Business Card.\n\nExtract field text and semantic values from a given business card document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Business Card.\n\nExtract field text and semantic values from a given business card document. The input document\nmust be of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "include_text_details, locale, pages, file_stream" }, @@ -298,12 +298,12 @@ "begin_analyze_invoice_async" : { "sync": { "signature": "def begin_analyze_invoice_async(\n self,\n include_text_details=False, # type: Optional[bool]\n locale=None, # type: Optional[Union[str, \"_models.Locale\"]]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Analyze Invoice Document.\n\nExtract field text and semantic values from a given invoice document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Invoice Document.\n\nExtract field text and semantic values from a given invoice document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_analyze_invoice_async(\n self,\n include_text_details: Optional[bool] = False,\n locale: Optional[Union[str, \"_models.Locale\"]] = None,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Analyze Invoice Document.\n\nExtract field text and semantic values from a given invoice document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Invoice Document.\n\nExtract field text and semantic values from a given invoice document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "include_text_details, locale, pages, file_stream" }, @@ -334,12 +334,12 @@ "begin_analyze_id_document_async" : { "sync": { "signature": "def begin_analyze_id_document_async(\n self,\n include_text_details=False, # type: Optional[bool]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Analyze ID Document.\n\nExtract field text and semantic values from a given ID document. The input document must be of\none of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri) of the\ndocument to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze ID Document.\n\nExtract field text and semantic values from a given ID document. The input document must be of\none of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri) of the\ndocument to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_analyze_id_document_async(\n self,\n include_text_details: Optional[bool] = False,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Analyze ID Document.\n\nExtract field text and semantic values from a given ID document. The input document must be of\none of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri) of the\ndocument to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze ID Document.\n\nExtract field text and semantic values from a given ID document. The input document must be of\none of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027\nor \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri) of the\ndocument to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "include_text_details, pages, file_stream" }, @@ -370,12 +370,12 @@ "begin_analyze_receipt_async" : { "sync": { "signature": "def begin_analyze_receipt_async(\n self,\n include_text_details=False, # type: Optional[bool]\n locale=None, # type: Optional[Union[str, \"_models.Locale\"]]\n pages=None, # type: Optional[List[str]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_analyze_receipt_async(\n self,\n include_text_details: Optional[bool] = False,\n locale: Optional[Union[str, \"_models.Locale\"]] = None,\n pages: Optional[List[str]] = None,\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Receipt.\n\nExtract field text and semantic values from a given receipt document. The input document must\nbe of one of the supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027,\n\u0027image/tiff\u0027 or \u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location\n(Uri) of the document to be analyzed.\n\n:param include_text_details: Include text lines and element references in the result.\n:type include_text_details: bool\n:param locale: Locale of the input document. Supported locales include: en-AU, en-CA, en-GB,\n en-IN, en-US(default).\n:type locale: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Locale\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "include_text_details, locale, pages, file_stream" }, @@ -406,12 +406,12 @@ "begin_analyze_layout_async" : { "sync": { "signature": "def begin_analyze_layout_async(\n self,\n pages=None, # type: Optional[List[str]]\n language=None, # type: Optional[Union[str, \"_models.Language\"]]\n reading_order=\"basic\", # type: Optional[Union[str, \"_models.ReadingOrder\"]]\n file_stream=None, # type: Optional[Union[IO, \"_models.SourcePath\"]]\n **kwargs # type: Any\n):\n", - "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027 or\n\u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param language: Currently, only Afrikaans (\u2018af\u2019), Albanian (\u2018sq\u2019), Asturian (\u2018ast\u2019), Basque\n (\u2018eu\u2019), Bislama (\u2018bi\u2019), Breton (\u2018br\u2019), Catalan (\u2018ca\u2019), Cebuano (\u2018ceb\u2019), Chamorro (\u2018ch\u2019),\n Cornish (\u2018kw\u2019), Corsican (\u2018co\u2019), Crimean Tatar - Latin script(\u2018crh\u2019), Czech (\u2018cs\u2019), Danish\n (\u2018da\u2019), Dutch (\u2018nl\u2019), English (\u0027en\u0027), Estonian (\u2018et\u2019), Fijian (\u2018fj\u2019), Filipino (\u2018fil\u2019), Finnish\n (\u2018fi\u2019), French (\u2018fr\u2019), Friulian (\u2018fur\u2019), Galician (\u2018gl\u2019), German (\u2018de\u2019), Gilbertese (\u2018gil\u2019),\n Greenlandic (\u2018kl\u2019), Haitian Creole (\u2018ht\u2019), Hani (\u2018hni\u2019), Hmong Daw (\u2018mww\u2019), Hungarian (\u2018hu\u2019),\n Indonesian (\u2018id\u2019), Interlingua (\u2018ia\u2019), Inuktitut (\u2018iu\u2019), Irish (\u2018ga\u2019), Italian (\u2018it\u2019), Japanese\n (\u2018ja\u2019), Javanese (\u2018jv\u2019), Kabuverdianu (\u2018kea\u2019), Kachin (\u2018kac\u2019), Kara-Kalpak (\u2018kaa\u2019), Kashubian\n (\u2018csb\u2019), Khasi (\u2018kha\u2019), Korean (\u2018ko\u2019), Kurdish - Latin script (\u2018ku\u2019), K\u2019iche\u2019 (\u2018quc\u2019),\n Luxembourgish (\u2018lb\u2019), Malay (\u2018ms\u2019), Manx (\u2018gv\u2019), Neapolitan (\u2018nap\u2019), Norwegian (\u2018no\u2019), Occitan\n (\u2018oc\u2019), Polish (\u2018pl\u2019), Portuguese (\u2018pt\u2019), Romansh (\u2018rm\u2019), Scots (\u2018sco\u2019), Scottish Gaelic\n (\u2018gd\u2019), simplified Chinese (\u2018zh-Hans\u2019), Slovenian (\u2018sl\u2019), Spanish (\u2018es\u2019), Swahili (\u2018sw\u2019),\n Swedish (\u2018sv\u2019), Tatar - Latin script (\u2018tt\u2019), Tetum (\u2018tet\u2019), traditional Chinese (\u2018zh-Hant\u2019),\n Turkish (\u2018tr\u2019), Upper Sorbian (\u2018hsb\u2019), Uzbek (\u2018uz\u2019), Volap\u00fck (\u2018vo\u2019), Walser (\u2018wae\u2019), Western\n Frisian (\u2018fy\u2019), Yucatec Maya (\u2018yua\u2019), Zhuang (\u2018za\u2019) and Zulu (\u2018zu\u2019) are supported (print \u2013\n seventy-three languages and handwritten \u2013 English only). Layout supports auto language\n identification and multi language documents, so only provide a language code if you would like\n to force the documented to be processed as that specific language.\n:type language: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Language\n:param reading_order: Reading order algorithm to sort the text lines returned. Supported\n reading orders include: basic(default), natural.\n:type reading_order: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.ReadingOrder\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the LROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027 or\n\u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param language: Currently, only Afrikaans (\u2018af\u2019), Albanian (\u2018sq\u2019), Asturian (\u2018ast\u2019), Basque\n (\u2018eu\u2019), Bislama (\u2018bi\u2019), Breton (\u2018br\u2019), Catalan (\u2018ca\u2019), Cebuano (\u2018ceb\u2019), Chamorro (\u2018ch\u2019),\n Cornish (\u2018kw\u2019), Corsican (\u2018co\u2019), Crimean Tatar - Latin script(\u2018crh\u2019), Czech (\u2018cs\u2019), Danish\n (\u2018da\u2019), Dutch (\u2018nl\u2019), English (\u0027en\u0027), Estonian (\u2018et\u2019), Fijian (\u2018fj\u2019), Filipino (\u2018fil\u2019), Finnish\n (\u2018fi\u2019), French (\u2018fr\u2019), Friulian (\u2018fur\u2019), Galician (\u2018gl\u2019), German (\u2018de\u2019), Gilbertese (\u2018gil\u2019),\n Greenlandic (\u2018kl\u2019), Haitian Creole (\u2018ht\u2019), Hani (\u2018hni\u2019), Hmong Daw (\u2018mww\u2019), Hungarian (\u2018hu\u2019),\n Indonesian (\u2018id\u2019), Interlingua (\u2018ia\u2019), Inuktitut (\u2018iu\u2019), Irish (\u2018ga\u2019), Italian (\u2018it\u2019), Japanese\n (\u2018ja\u2019), Javanese (\u2018jv\u2019), Kabuverdianu (\u2018kea\u2019), Kachin (\u2018kac\u2019), Kara-Kalpak (\u2018kaa\u2019), Kashubian\n (\u2018csb\u2019), Khasi (\u2018kha\u2019), Korean (\u2018ko\u2019), Kurdish - Latin script (\u2018ku\u2019), K\u2019iche\u2019 (\u2018quc\u2019),\n Luxembourgish (\u2018lb\u2019), Malay (\u2018ms\u2019), Manx (\u2018gv\u2019), Neapolitan (\u2018nap\u2019), Norwegian (\u2018no\u2019), Occitan\n (\u2018oc\u2019), Polish (\u2018pl\u2019), Portuguese (\u2018pt\u2019), Romansh (\u2018rm\u2019), Scots (\u2018sco\u2019), Scottish Gaelic\n (\u2018gd\u2019), simplified Chinese (\u2018zh-Hans\u2019), Slovenian (\u2018sl\u2019), Spanish (\u2018es\u2019), Swahili (\u2018sw\u2019),\n Swedish (\u2018sv\u2019), Tatar - Latin script (\u2018tt\u2019), Tetum (\u2018tet\u2019), traditional Chinese (\u2018zh-Hant\u2019),\n Turkish (\u2018tr\u2019), Upper Sorbian (\u2018hsb\u2019), Uzbek (\u2018uz\u2019), Volap\u00fck (\u2018vo\u2019), Walser (\u2018wae\u2019), Western\n Frisian (\u2018fy\u2019), Yucatec Maya (\u2018yua\u2019), Zhuang (\u2018za\u2019) and Zulu (\u2018zu\u2019) are supported (print \u2013\n seventy-three languages and handwritten \u2013 English only). Layout supports auto language\n identification and multi language documents, so only provide a language code if you would like\n to force the documented to be processed as that specific language.\n:type language: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Language\n:param reading_order: Reading order algorithm to sort the text lines returned. Supported\n reading orders include: basic(default), natural.\n:type reading_order: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.ReadingOrder\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be LROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "async": { "coroutine": true, "signature": "async def begin_analyze_layout_async(\n self,\n pages: Optional[List[str]] = None,\n language: Optional[Union[str, \"_models.Language\"]] = None,\n reading_order: Optional[Union[str, \"_models.ReadingOrder\"]] = \"basic\",\n file_stream: Optional[Union[IO, \"_models.SourcePath\"]] = None,\n **kwargs\n) -\u003e AsyncLROPoller[None]:\n", - "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027 or\n\u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param language: Currently, only Afrikaans (\u2018af\u2019), Albanian (\u2018sq\u2019), Asturian (\u2018ast\u2019), Basque\n (\u2018eu\u2019), Bislama (\u2018bi\u2019), Breton (\u2018br\u2019), Catalan (\u2018ca\u2019), Cebuano (\u2018ceb\u2019), Chamorro (\u2018ch\u2019),\n Cornish (\u2018kw\u2019), Corsican (\u2018co\u2019), Crimean Tatar - Latin script(\u2018crh\u2019), Czech (\u2018cs\u2019), Danish\n (\u2018da\u2019), Dutch (\u2018nl\u2019), English (\u0027en\u0027), Estonian (\u2018et\u2019), Fijian (\u2018fj\u2019), Filipino (\u2018fil\u2019), Finnish\n (\u2018fi\u2019), French (\u2018fr\u2019), Friulian (\u2018fur\u2019), Galician (\u2018gl\u2019), German (\u2018de\u2019), Gilbertese (\u2018gil\u2019),\n Greenlandic (\u2018kl\u2019), Haitian Creole (\u2018ht\u2019), Hani (\u2018hni\u2019), Hmong Daw (\u2018mww\u2019), Hungarian (\u2018hu\u2019),\n Indonesian (\u2018id\u2019), Interlingua (\u2018ia\u2019), Inuktitut (\u2018iu\u2019), Irish (\u2018ga\u2019), Italian (\u2018it\u2019), Japanese\n (\u2018ja\u2019), Javanese (\u2018jv\u2019), Kabuverdianu (\u2018kea\u2019), Kachin (\u2018kac\u2019), Kara-Kalpak (\u2018kaa\u2019), Kashubian\n (\u2018csb\u2019), Khasi (\u2018kha\u2019), Korean (\u2018ko\u2019), Kurdish - Latin script (\u2018ku\u2019), K\u2019iche\u2019 (\u2018quc\u2019),\n Luxembourgish (\u2018lb\u2019), Malay (\u2018ms\u2019), Manx (\u2018gv\u2019), Neapolitan (\u2018nap\u2019), Norwegian (\u2018no\u2019), Occitan\n (\u2018oc\u2019), Polish (\u2018pl\u2019), Portuguese (\u2018pt\u2019), Romansh (\u2018rm\u2019), Scots (\u2018sco\u2019), Scottish Gaelic\n (\u2018gd\u2019), simplified Chinese (\u2018zh-Hans\u2019), Slovenian (\u2018sl\u2019), Spanish (\u2018es\u2019), Swahili (\u2018sw\u2019),\n Swedish (\u2018sv\u2019), Tatar - Latin script (\u2018tt\u2019), Tetum (\u2018tet\u2019), traditional Chinese (\u2018zh-Hant\u2019),\n Turkish (\u2018tr\u2019), Upper Sorbian (\u2018hsb\u2019), Uzbek (\u2018uz\u2019), Volap\u00fck (\u2018vo\u2019), Walser (\u2018wae\u2019), Western\n Frisian (\u2018fy\u2019), Yucatec Maya (\u2018yua\u2019), Zhuang (\u2018za\u2019) and Zulu (\u2018zu\u2019) are supported (print \u2013\n seventy-three languages and handwritten \u2013 English only). Layout supports auto language\n identification and multi language documents, so only provide a language code if you would like\n to force the documented to be processed as that specific language.\n:type language: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Language\n:param reading_order: Reading order algorithm to sort the text lines returned. Supported\n reading orders include: basic(default), natural.\n:type reading_order: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.ReadingOrder\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: Pass in True if you\u0027d like the AsyncLROBasePolling polling method,\n False for no polling, or your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" + "doc": "\"\"\"Analyze Layout.\n\nExtract text and layout information from a given document. The input document must be of one of\nthe supported content types - \u0027application/pdf\u0027, \u0027image/jpeg\u0027, \u0027image/png\u0027, \u0027image/tiff\u0027 or\n\u0027image/bmp\u0027. Alternatively, use \u0027application/json\u0027 type to specify the location (Uri or local\npath) of the document to be analyzed.\n\n:param pages: Custom page numbers for multi-page documents(PDF/TIFF), input the number of the\n pages you want to get OCR result. For a range of pages, use a hyphen. Separate each page or\n range with a comma.\n:type pages: list[str]\n:param language: Currently, only Afrikaans (\u2018af\u2019), Albanian (\u2018sq\u2019), Asturian (\u2018ast\u2019), Basque\n (\u2018eu\u2019), Bislama (\u2018bi\u2019), Breton (\u2018br\u2019), Catalan (\u2018ca\u2019), Cebuano (\u2018ceb\u2019), Chamorro (\u2018ch\u2019),\n Cornish (\u2018kw\u2019), Corsican (\u2018co\u2019), Crimean Tatar - Latin script(\u2018crh\u2019), Czech (\u2018cs\u2019), Danish\n (\u2018da\u2019), Dutch (\u2018nl\u2019), English (\u0027en\u0027), Estonian (\u2018et\u2019), Fijian (\u2018fj\u2019), Filipino (\u2018fil\u2019), Finnish\n (\u2018fi\u2019), French (\u2018fr\u2019), Friulian (\u2018fur\u2019), Galician (\u2018gl\u2019), German (\u2018de\u2019), Gilbertese (\u2018gil\u2019),\n Greenlandic (\u2018kl\u2019), Haitian Creole (\u2018ht\u2019), Hani (\u2018hni\u2019), Hmong Daw (\u2018mww\u2019), Hungarian (\u2018hu\u2019),\n Indonesian (\u2018id\u2019), Interlingua (\u2018ia\u2019), Inuktitut (\u2018iu\u2019), Irish (\u2018ga\u2019), Italian (\u2018it\u2019), Japanese\n (\u2018ja\u2019), Javanese (\u2018jv\u2019), Kabuverdianu (\u2018kea\u2019), Kachin (\u2018kac\u2019), Kara-Kalpak (\u2018kaa\u2019), Kashubian\n (\u2018csb\u2019), Khasi (\u2018kha\u2019), Korean (\u2018ko\u2019), Kurdish - Latin script (\u2018ku\u2019), K\u2019iche\u2019 (\u2018quc\u2019),\n Luxembourgish (\u2018lb\u2019), Malay (\u2018ms\u2019), Manx (\u2018gv\u2019), Neapolitan (\u2018nap\u2019), Norwegian (\u2018no\u2019), Occitan\n (\u2018oc\u2019), Polish (\u2018pl\u2019), Portuguese (\u2018pt\u2019), Romansh (\u2018rm\u2019), Scots (\u2018sco\u2019), Scottish Gaelic\n (\u2018gd\u2019), simplified Chinese (\u2018zh-Hans\u2019), Slovenian (\u2018sl\u2019), Spanish (\u2018es\u2019), Swahili (\u2018sw\u2019),\n Swedish (\u2018sv\u2019), Tatar - Latin script (\u2018tt\u2019), Tetum (\u2018tet\u2019), traditional Chinese (\u2018zh-Hant\u2019),\n Turkish (\u2018tr\u2019), Upper Sorbian (\u2018hsb\u2019), Uzbek (\u2018uz\u2019), Volap\u00fck (\u2018vo\u2019), Walser (\u2018wae\u2019), Western\n Frisian (\u2018fy\u2019), Yucatec Maya (\u2018yua\u2019), Zhuang (\u2018za\u2019) and Zulu (\u2018zu\u2019) are supported (print \u2013\n seventy-three languages and handwritten \u2013 English only). Layout supports auto language\n identification and multi language documents, so only provide a language code if you would like\n to force the documented to be processed as that specific language.\n:type language: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.Language\n:param reading_order: Reading order algorithm to sort the text lines returned. Supported\n reading orders include: basic(default), natural.\n:type reading_order: str or ~azure.ai.formrecognizer.v2_1_preview_3.models.ReadingOrder\n:param file_stream: .json, .pdf, .jpg, .png, .tiff or .bmp type file stream.\n:type file_stream: IO or ~azure.ai.formrecognizer.v2_1_preview_3.models.SourcePath\n:keyword str content_type: Media type of the body sent to the API. Default value is \"application/json\".\n Allowed values are: \"application/pdf\", \"image/bmp\", \"image/jpeg\", \"image/png\", \"image/tiff\", \"application/json\".\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncLROBasePolling.\n Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises ~azure.core.exceptions.HttpResponseError:\n\"\"\"" }, "call": "pages, language, reading_order, file_stream" }, diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/aio/operations/_form_recognizer_client_operations.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/aio/operations/_form_recognizer_client_operations.py index c7144db47041..d4cf0e46a432 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/aio/operations/_form_recognizer_client_operations.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/aio/operations/_form_recognizer_client_operations.py @@ -91,15 +91,15 @@ async def begin_train_custom_model_async( :type train_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.TrainRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -347,15 +347,15 @@ async def begin_analyze_with_custom_model( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -524,15 +524,15 @@ async def begin_copy_custom_model( :type copy_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.CopyRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -748,15 +748,15 @@ async def begin_compose_custom_models_async( :type compose_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.ComposeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -893,15 +893,15 @@ async def begin_analyze_business_card_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1096,15 +1096,15 @@ async def begin_analyze_invoice_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1292,15 +1292,15 @@ async def begin_analyze_id_document_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1494,15 +1494,15 @@ async def begin_analyze_receipt_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1714,15 +1714,15 @@ async def begin_analyze_layout_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the AsyncLROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/operations/_form_recognizer_client_operations.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/operations/_form_recognizer_client_operations.py index 55d5a31df492..44a62816c2e8 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/operations/_form_recognizer_client_operations.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/v2_1_preview_3/operations/_form_recognizer_client_operations.py @@ -97,15 +97,15 @@ def begin_train_custom_model_async( :type train_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.TrainRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,15 +357,15 @@ def begin_analyze_with_custom_model( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -537,15 +537,15 @@ def begin_copy_custom_model( :type copy_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.CopyRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -765,15 +765,15 @@ def begin_compose_custom_models_async( :type compose_request: ~azure.ai.formrecognizer.v2_1_preview_3.models.ComposeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -912,15 +912,15 @@ def begin_analyze_business_card_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1118,15 +1118,15 @@ def begin_analyze_invoice_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1317,15 +1317,15 @@ def begin_analyze_id_document_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1522,15 +1522,15 @@ def begin_analyze_receipt_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1745,15 +1745,15 @@ def begin_analyze_layout_async( Allowed values are: "application/pdf", "image/bmp", "image/jpeg", "image/png", "image/tiff", "application/json". :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: Pass in True if you'd like the LROBasePolling polling method, - False for no polling, or your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - polling = kwargs.pop('polling', False) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_helpers.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_helpers.py index 0976fcb5dccb..10ac89a614a3 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_helpers.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_helpers.py @@ -17,7 +17,9 @@ def _get_deserialize(api_version): if api_version == "2.0": from ._generated.v2_0 import FormRecognizerClient - else: + elif api_version == "2.1": + from ._generated.v2_1 import FormRecognizerClient + elif api_version == "2.1-preview.3": from ._generated.v2_1_preview_3 import FormRecognizerClient return FormRecognizerClient( # pylint: disable=protected-access "dummy", "dummy" 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 850c1c6c8638..b4e8e2864c47 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_models.py @@ -63,9 +63,7 @@ def get_field_value( for key, value in value.value_object.items() } if value.type == "selectionMark": - return ( - value.text - ) # FIXME https://github.com/Azure/azure-sdk-for-python/issues/15276 + return value.value_selection_mark or value.text # TODO: preview.3 still returns in text if value.type == "gender": return value.value_gender if value.type == "country": diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_base_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_base_client_async.py index 412994355772..6186a7815255 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_base_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_base_client_async.py @@ -43,14 +43,17 @@ def __init__( http_logging_policy.allowed_header_names.update( { "Operation-Location", + "Location", "x-envoy-upstream-service-time", "apim-request-id", "Strict-Transport-Security", "x-content-type-options", + "ms-azure-ai-errorcode", + "x-ms-cs-error-code", } ) http_logging_policy.allowed_query_params.update( - {"includeTextDetails", "locale", "language", "includeKeys", "op"} + {"includeTextDetails", "locale", "language", "includeKeys", "op", "pages", "readingOrder"} ) self._client = FormRecognizer( endpoint=endpoint, diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_recognizer_client_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_recognizer_client_async.py index 53ff2493fda6..cc54926d7504 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_recognizer_client_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_recognizer_client_async.py @@ -124,7 +124,7 @@ async def begin_recognize_receipts( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if locale: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"locale": locale}) else: raise ValueError( @@ -136,7 +136,7 @@ async def begin_recognize_receipts( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -199,7 +199,7 @@ async def begin_recognize_receipts_from_url( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if locale: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"locale": locale}) else: raise ValueError( @@ -211,7 +211,7 @@ async def begin_recognize_receipts_from_url( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -656,7 +656,7 @@ async def begin_recognize_content( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -664,7 +664,7 @@ async def begin_recognize_content( ) if reading_order: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"reading_order": reading_order}) else: raise ValueError( @@ -672,7 +672,7 @@ async def begin_recognize_content( ) if language: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"language": language}) else: raise ValueError( @@ -727,7 +727,7 @@ async def begin_recognize_content_from_url( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -735,7 +735,7 @@ async def begin_recognize_content_from_url( ) if reading_order: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"reading_order": reading_order}) else: raise ValueError( @@ -743,7 +743,7 @@ async def begin_recognize_content_from_url( ) if language: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"language": language}) else: raise ValueError( @@ -831,7 +831,7 @@ def analyze_callback( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( @@ -901,7 +901,7 @@ def analyze_callback( # FIXME: part of this code will be removed once autorest can handle diff mixin # signatures across API versions if pages: - if self._api_version == FormRecognizerApiVersion.V2_1_PREVIEW: + if self._api_version in [FormRecognizerApiVersion.V2_1, FormRecognizerApiVersion.V2_1_PREVIEW]: kwargs.update({"pages": pages}) else: raise ValueError( diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_multiapi.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_multiapi.py index 917e9c2e7767..b19fb72da168 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_multiapi.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_multiapi.py @@ -45,6 +45,16 @@ def test_v2_1_preview_3_form_recognizer_client(self, client): def test_v2_1_preview_3_form_training_client(self, client): assert "v2.1-preview.3" in client._client._client._base_url + @FormRecognizerPreparer() + @FormRecognizerClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_1}) + def test_v2_1_form_recognizer_client(self, client): + assert "v2.1" in client._client._client._base_url + + @FormRecognizerPreparer() + @FormTrainingClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_1}) + def test_v2_1_form_training_client(self, client): + assert "v2.1" in client._client._client._base_url + @FormRecognizerPreparer() @FormTrainingClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_0}) def test_v2_0_compatibility(self, client, formrecognizer_storage_container_sas_url): diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_multiapi_async.py b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_multiapi_async.py index a5fdee72becb..0c0958e35ef4 100644 --- a/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_multiapi_async.py +++ b/sdk/formrecognizer/azure-ai-formrecognizer/tests/test_multiapi_async.py @@ -38,14 +38,24 @@ def test_v2_0_form_training_client(self, client): @FormRecognizerPreparer() @FormRecognizerClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_1_PREVIEW}) - def test_v2_1_preview_1_form_recognizer_client(self, client): + def test_v2_1_preview_3_form_recognizer_client(self, client): assert "v2.1-preview.3" in client._client._client._base_url @FormRecognizerPreparer() @FormTrainingClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_1_PREVIEW}) - def test_v2_1_preview_1_form_training_client(self, client): + def test_v2_1_preview_3_form_training_client(self, client): assert "v2.1-preview.3" in client._client._client._base_url + @FormRecognizerPreparer() + @FormRecognizerClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_1}) + def test_V2_1_form_recognizer_client(self, client): + assert "v2.1" in client._client._client._base_url + + @FormRecognizerPreparer() + @FormTrainingClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_1}) + def test_V2_1_form_training_client(self, client): + assert "v2.1" in client._client._client._base_url + @FormRecognizerPreparer() @FormTrainingClientPreparer(client_kwargs={"api_version": FormRecognizerApiVersion.V2_0}) async def test_v2_0_compatibility(self, client, formrecognizer_storage_container_sas_url):