Skip to content

Commit

Permalink
Feature/form 2.1 preview.3 (#17485)
Browse files Browse the repository at this point in the history
* [formrecognizer] Update generated code for preview.3 (#16833)

* Adding generated code

* update api-version dependent code

* update test_receipt.py recordings

* update generated code

* update msrest dependency, add pages to custom form calls

* skipping tests for undeployed endpoints

* update pages doc comment

* fix async operations and testcase handling

* clean up response urls

* adding content recordings

* adding invoice test recordings

* adding receipt recordings

* update multiapi tests

* update testcase and recordings

* updating mgmt tests

* update msrest requirement

* update async client

* [formrecognizer] Adding comment about image/bmp being accepted (#17130)

* adding comment about image/bmp being accepted

* add comments on async clients

* update changelog

* [formrecognizer] Add Identity Documents APIs (#17128)

* Adding ID docs APIs and tests

* comment test assertions, add recordings

* pylint

* fix type declaration

* update changelog and descriptions

* [formrecognizer] Adding sync and async samples for ID documents (#17186)

* adding sync and async samples

* rename sample function

* get poller result instead of wait (#17299)

* [formrecognizer] Add missing pages comments and tests (#17197)

* add missing pages comments

* update polling declaration in fr clients in custom forms

* adding tests and recordings

* updating changelog

* remove extra pages tests in content tests

* regenerate with latest preview 3 changes (#17400)

* Adding more custom forms kwargs fixes (#17397)

* pending id docs fixes (#17436)

* [formrecognizer] rerecord tests for preview.3 (#17460)

* enable business card and compose tests

* enable training tests

* rerecord training tests with correct multipage documents

* rerecord copy tests with preview.3

* rerecord custom forms with preview.3

* rerecord invoices with preview.3

* rerecord receipts for preview.3

* rerecord mgmt tests for preview.3

Co-authored-by: Catalina Peralta <catalinaperaltah@hotmail.com>

* add missing recording and unskip aad test

* access correct env var for aad tests

Co-authored-by: catalinaperalta <catalinaperaltah@hotmail.com>
  • Loading branch information
kristapratico and catalinaperalta authored Mar 22, 2021
1 parent 254c677 commit fc26007
Show file tree
Hide file tree
Showing 498 changed files with 55,782 additions and 43,151 deletions.
10 changes: 10 additions & 0 deletions sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## 3.1.0b4 (Unreleased)

**New features**

- New methods `begin_recognize_id_documents` and `begin_recognize_id_documents_from_url` introduced to the SDK. Use these methods to recognize data from identity documents.
- Content-type `image/bmp` now supported by custom forms and training methods.
- Added keyword argument `pages` for business cards, receipts, custom forms, and invoices
to specify which page to process of the document.

**Dependency Updates**

- Bumped `msrest` requirement from `0.6.12` to `0.6.21`.

## 3.1.0b3 (2021-02-09)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FormRecognizerApiVersion(str, Enum):
"""Form Recognizer API versions supported by this package"""

#: This is the default version
V2_1_PREVIEW = "2.1-preview.2"
V2_1_PREVIEW = "2.1-preview.3"
V2_0 = "2.0"


Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def begin_training(self, training_files_url, use_training_labels, **kwargs):
externally accessible Azure storage blob container URI (preferably a Shared Access Signature URI). Note that
a container URI (without SAS) is accepted only when the container is public.
Models are trained using documents that are of the following content type - 'application/pdf',
'image/jpeg', 'image/png', 'image/tiff'. Other types of content in the container is ignored.
'image/jpeg', 'image/png', 'image/tiff', or 'image/bmp'. Other types of content in the container is ignored.
:param str training_files_url: An Azure Storage blob container's SAS URI. A container URI (without SAS)
can be used if the container is public. For more information on setting up a training data set, see:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from typing import Any
from typing import TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential

class FormRecognizerClientConfiguration(Configuration):
"""Configuration for FormRecognizerClient.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@
# regenerated.
# --------------------------------------------------------------------------

from azure.core import PipelineClient
from msrest import Serializer, Deserializer
from typing import TYPE_CHECKING

from azure.core import PipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from msrest import Deserializer, Serializer

from ._configuration import FormRecognizerClientConfiguration
from ._operations_mixin import FormRecognizerClientOperationsMixin

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Expand All @@ -38,14 +48,14 @@ class FormRecognizerClient(FormRecognizerClientOperationsMixin, MultiApiClientMi
: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
:param str api_version: API version to use if no profile is provided, or if
missing in profile.
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = '2.1-preview.2'
DEFAULT_API_VERSION = '2.1-preview.3'
_PROFILE_TAG = "azure.ai.formrecognizer.FormRecognizerClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
Expand All @@ -58,14 +68,14 @@ def __init__(
self,
credential, # type: "TokenCredential"
endpoint, # type: str
api_version=None,
profile=KnownProfiles.default,
api_version=None, # type: Optional[str]
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
):
if api_version == '2.0':
base_url = '{endpoint}/formrecognizer/v2.0'
elif api_version == '2.1-preview.2':
base_url = '{endpoint}/formrecognizer/v2.1-preview.2'
elif api_version == '2.1-preview.3':
base_url = '{endpoint}/formrecognizer/v2.1-preview.3'
else:
raise ValueError("API version {} is not available".format(api_version))
self._config = FormRecognizerClientConfiguration(credential, endpoint, **kwargs)
Expand All @@ -84,13 +94,13 @@ def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2.0: :mod:`v2_0.models<azure.ai.formrecognizer.v2_0.models>`
* 2.1-preview.2: :mod:`v2_1_preview_2.models<azure.ai.formrecognizer.v2_1_preview_2.models>`
* 2.1-preview.3: :mod:`v2_1_preview_3.models<azure.ai.formrecognizer.v2_1_preview_3.models>`
"""
if api_version == '2.0':
from .v2_0 import models
return models
elif api_version == '2.1-preview.2':
from .v2_1_preview_2 import models
elif api_version == '2.1-preview.3':
from .v2_1_preview_3 import models
return models
raise ValueError("API version {} is not available".format(api_version))

Expand Down
Loading

0 comments on commit fc26007

Please sign in to comment.