Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/form 2.1 preview.3 #17485

Merged
merged 13 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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"
Copy link
Contributor

Choose a reason for hiding this comment

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

You should update the version in the readme.md

Copy link
Member Author

Choose a reason for hiding this comment

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

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