- Updated the SDK to use the latest Generally Available (GA) version of the Form Recognizer REST API:
2023-07-31
. AnalyzeDocumentOptions.features
accepts three new features compared to the last beta version:barcodes
: enables the detection of barcodes in the document.keyValuePairs
: enable the detection of general key value pairs (form fields) in the document.languages
: enables the detection of the text content language.
beginBuildDocumentModel
has a new overload that accepts aDocumentModelSource
in place of a rawcontainerUrl
. This allows training document models using the new Blob File List source (that is already supported by document classifiers). Like with classifiers, the source inputs are specified as an object containing anazureFileListSource
property or anazureBlobSource
property containing the respective details of each source type.
From the last stable release (4.0.0):
- Support for passing alternative API versions has been removed from the client. In practice, the client only supported
using a single API version, but types and options for specifying an API version were provided. In version 5.0.0, these options and their associated types were removed:
- The
apiVersion
option that was previously accepted by theDocumentAnalysisClient
andDocumentModelAdministrationClient
constructors was removed. This option previously only had one valid value in version 4.0.0, and supporting multiple API versions in a single package weakens the type constraints, so we have chosen to only support the latest Generally Available version of the service in this SDK package. Support for multiple API versions may be reintroduced in a future version. - The
FormRecognizerApiVersion
type and enum were removed as they no longer serve any purpose. - The type of
apiVersion
properties of result objects was changed fromFormRecognizerApiVersion
tostring
. This type is more accurate, as these fields reflect the API version used to create the model or start the analysis operation, and not necessarily an API version that the client instance is aware of. - The
FormRecognizerCommonClientOptions
interface, which bothDocumentAnalysisClientOptions
andDocumentModelAdministrationClientOptions
inherited from was removed, as it only carried theapiVersion
option that no longer exists.
- The
- The
languages
andkeyValuePairs
properties ofAnalyzeResult
that were previously returned when using theprebuilt-document
model are no longer returned unless the correspondingfeatures
are specified when making the analysis request.
From the last beta release (4.1.0-beta.1):
AnalyzeDocumentOptions.features
changed the following feature names:ocr.highResolution
renamed toocrHighResolution
.ocr.formula
renamed toformulas
.ocr.font
renamed tostyleFont
.
- The following fields have been removed:
AnalyzeDocumentOptions.queryFields
DocumentPage.kind
andDocumentPage.images
(DocumentPageKind
andDocumentImage
types have been removed too.)DocumentKeyValuePair.commonName
- The type of the
docTypes
parameter ofbeginBuildDocumentClassifier
was refined slightly. The type will no longer accept bothazureBlobSource
andazureFileListSource
- Added support for Form Recognizer API version
2023-02-28-preview
. This is the default API version for SDK version4.1.0-beta.1
. For a detailed list of changes included in this API version, see the Form Recognizer release notes. - Added an
expiresOn
property toDocumentModelSummary
andDocumentModelDetails
. If this field is populated, it contains the date and time that the model will expire and will no longer be usable. - Added support for custom classification models. Classifiers combine layout and language features to accurately identify documents from among a set of document types.
- Added
beginBuildDocumentClassifier
toDocumentModelAdministrationClient
to build a custom classifier from training documents. See the service documentation on custom classifiers for more information on creating a training data set and creating a classifier. - Added
getDocumentClassifier
,listDocumentClassifiers
, anddeleteDocumentClassifier
methods toDocumentModelAdministrationClient
to manage custom classifiers. - Added
beginClassifyDocument
andbeginClassifyDocumentFromUrl
toDocumentAnalysisClient
to classify documents using a custom classification model. - The
getOperation
method can now returnDocumentClassifierBuildOperationDetails
for classifier build operations.
- Added
- Added
features
toAnalyzeDocumentOptions
. Features are add-on capabilities that must be explicitly activated in order to extract them. The use of features may incur additional costs, so please review the service documentation of add-on capabilities for more information. The Form Recognizer service has introduced four features in this API version:ocr.highResolution
: improves the quality of content extraction for A1/A2/A3 documents with small text.ocr.formula
: enables extraction of formulas, such as mathematical equations.ocr.font
: extends the existingstyles
property to include more font properties such assimilarFontFamily
for the font face of the text,fontStyle
for styles such as italics,fontWeight
for boldness,color
, andbackgroundColor
.queryFields.premium
: enables the use ofqueryFields
(see below).
- Added
queryFields
toAnalyzeDocumentOptions
. The service now supports extracting additional query fields using Azure OpenAI capabilities. This feature may only be used if the"queryFields.premium"
feature is enabled (see above). See the service documentation on query fields for more information. - Updated the
AddressValue
type to include several new fields:cityDistrict
,house
,level
,stateDistrict
,suburb
, andunit
. Please see the documentation of these fields for more information. - Added a
currencyCode
field toCurrencyValue
. This field contains the normalized ISO 4217 currency code for the currency value. - Added a
commonName
field toDocumentKeyValuePair
. This field contains a normalized "common" name for the field if the service was able to extract one. - Added a new field
annotations
and corresponding typeDocumentAnnotation
toDocumentPage
. This new page-level property contains information about extracted "annotations," which are visual marks like checkmarks or crosses. - Added a new field
barcodes
and corresponding typeDocumentBarcode
toDocumentPage
. This new page-level property contains information about extracted barcodes, including the type of the barcode (kind
) and the decoded data (value
). - Added a new field
formulas
and corresponding typeDocumentFormula
toDocumentPage
. This new page-level property contains information about extracted formulas, including thekind
of formula ("display" or "inline") and an equivalent LaTeX expression (value
). This field is only populated if the"ocr.formula"
feature is enabled. - Added a new field
images
and corresponding typeDocumentImage
toDocumentPage
. This page-level property contains information about images in the document. Images are represented by other pages, and theDocumentImage
type contains the page number of the image's data (pageNumber
, note that this is a 1-based index) and the bounding polygon of the image. - Added a new
kind
field toDocumentPage
. This field indicates what kind of content the page represents. The possible kinds are "document", "sheet", "slide", and "image". - Added a new
DocumentBooleanField
type for extracted fields that contain boolean values. This type is used in thefields
data of anAnalyzedDocument
. - Added new fields
backgroundColor
,color
,fontStyle
,fontWeight
, andsimilarFontFamily
toDocumentStyle
. These fields contain additional information about the font style of extracted text and will only be populated if the"ocr.font"
feature is enabled. - Added a new field
customNeuralDocumentModelBuilds
toResourceDetails
that contains information about the neural model build quota. This field has the typeQuotaDetails
and contains information about how many custom neural models may be built (quota
), how many have been built (used
), and when the quota will be reset (quotaResetOn
).
- Form Recognizer pollers (
AnalysisPoller
,DocumentModelPoller
, andDocumentClassifierPoller
) will now appropriately handle the HTTPRetry-After
header. If the Form Recognizer service sends aRetry-After
header in its response, the poller will wait at least that long before polling again. This prevents the poller from making too many requests if the service tells the client to wait. - Form Recognizer pollers will now appropriately handle
AbortSignal
cancellation. If the client passes anAbortSignal
to a long-running operation (such as any of the model/classifier creation operations or any analysis operation), theAbortSignal
may now be used to abort the operation. The poller will stop polling, any requests in progress will be aborted, and the poller will throw anAbortError
. - Fixed a bug in which fields of strongly-typed custom
DocumentModel
objects that contain spaces in their field names were not handled correctly. A field named"Account Number"
will now be represented asaccountNumber
in theDocumentModel
object, instead of"account Number"
. None of the supported prebuilt DocumentModel objects are affected by this change.
- Updated the SDK to use the latest Generally Available (GA) version of the Form Recognizer REST API:
2022-08-01
.
- Renamed
DocumentModelAdministrationClient
methods to have the wordDocument
in them, for examplegetModel
andlistModels
are updated togetDocumentModel
andlistDocumentModels
respectively. - Renamed all fields named
createdDateTime
andlastUpdateDateTime
tocreatedOn
andlastUpdatedOn
respectively.
- Refactored generic
DocumentModel
support to be more robust to different kinds of models. It now supports strongly-typed results forprebuilt-read
,prebuilt-layout
, andprebuilt-document
. See the "Breaking Changes" section for more information about how to replace existing usage ofPrebuiltModels
with new model code. DocumentModelAdministrationClient#getOperation
returns additionalresult
(operation result) anderror
(includes detailed error info) fields.
- Removed
PrebuiltModels
and all of its fields as well as related helper types. The strongly-typed functionality previously provided byPrebuiltModels
is now provided by sample code that you can copy into your own project. See theprebuilt
samples directory for models compatible with the current Form Recognizer API. - Separated URL-based and file-based analysis inputs into two separate methods:
beginAnalyzeDocument
(for file stream inputs) andbeginAnalyzeDocumentFromUrl
(for URL-based inputs). Previously, both were accepted as inputs to a singlebeginAnalyzeDocument
method, and a string value would be interpreted as if it were a URL, but this was confusing. The two inputs now have distinct signatures and documentation. - Removed the
beginExtractLayout
,beginExtractGeneralDocument
, andbeginReadDocument
methods. Strongly-typedDocumentModel
instances for the correspondingprebuilt-layout
,prebuilt-document
, andprebuilt-read
models are located in theprebuilt
samples directory. - Changed the suffix
-Info
for the methods and interfaces such asDocumentModelAdministrationClient#getResourceInfo
andDocumentModelInfo
to-Details
. - Array properties of
AnalyzeResult
, such asdocuments
,languages
, andpages
are now optional. If the value isundefined
, then the model does not support the given feature. Previously, we returned an empty array, even if the model didn't support the feature.
- Strongly-typed analysis functionality now checks that the
DocumentAnalysisClient
's API version now matches the assumed API version of theDocumentModel
exactly. This ensures that a strongly-typed model can only be used with the API version it was created for, so that future changes cannot violate the model's schema. - Renamed the following types:
TrainingPoller
->DocumentModelPoller
GetInfoResponse
->ResourceDetails
- In instances where we use
Model
as a prefix, updated it toDocumentModel
. For example,ModelInfo
->DocumentModelDetails
,ModelSummary
->DocumentModelSummary
. BuildModelOptions
->CreateModelOptions
, the options bag types forbeginComposeModel
andbeginCopyModelTo
, andbeginBuildModel
methods inherit fromCreateModelOptions
.
- Reworked a lookbehind regular expression that was preventing
@azure/ai-form-recognizer
from loading in Safari.
- Updated the SDK to use the latest preview version of the Form Recognizer service:
2022-06-30-preview
. - Added a
paragraphs
property to theAnalyzeResult
type and a newDocumentParagraph
type. This property represents the paragraph structure of the input document's text. - Documents may now contain a
DocumentAddressField
type, which has an object with several fields related to physical addresses, such asstreetAddress
,city
, andstate
as its value. This field is identified by the value"address"
in thekind
field. - Added a
kind
field toDocumentPage
. For now, the only supported value of this field is"document"
. In the future, other page kinds may be added, indicating different dispositions of the extracted page elements.
- [DEPRECATION] Deprecated
PrebuiltModels
. In a future version (prior to a stable release),PrebuiltModels
and its fields will be replaced with an out-of-tree solution for obtaining strongly-typed analysis results. - [DEPRECATION] Deprecated
beginExtractLayout
,beginExtractGeneralDocument
, andbeginReadDocument
. In a future version (prior to a stable release), these methods will be removed, andbeginAnalyzeDocument
will be enhanced to provide the same restricted types. - Renamed the
beginCopyModel
method ofDocumentModelAdministrationClient
tobeginCopyModelTo
. #20775 - Renamed
BoundingRegion#boundingBox
toBoundingRegion#polygon
, as the service may now provide arbitrary, polygonal bounding areas rather than just rectangles.- The polygon is represented as an array of
Point2D
, clockwise from the left, -180 degrees inclusive.
- The polygon is represented as an array of
- Removed the
entities
property from theAnalyzeResult
type. This field may be reintroduced in a future version, but service API version2022-06-30-preview
no longer returns this field. - Renamed the
languageCode
property in theDocumentLanguage
type tolocale
. - Made the
angle
,height
,lines
,unit
,width
, andwords
properties ofDocumentPage
optional, as not all page kinds are guaranteed to support these fields.
- Updated the SDK to use the latest preview version of the Form Recognizer service:
2022-01-30-preview
. - A new prebuilt model,
PrebuiltModels.TaxUsW2
, is available. It supports extracting data from United States W2 tax forms such as employee and employer information, IRS control number, tax withholding information, etc. - Added a new method,
beginReadDocument
toDocumentAnalysisClient
. This method uses the "prebuilt-read" model to extract textual information from the document such as page text contents and language spans. - Added a
languages
field to theAnalyzeResult
type. This field contains information about regions of text in the document that were identified as being of a particular written language. ADocumentLanguage
consists of the identifiedlanguageCode
(ISO 639-1 or BCP 47 language code), a list ofspans
of text that are of that language, and aconfidence
value (between zero and one) that the assessment is correct. - Added a
tags
field toBuildModelOptions
,GetCopyAuthorizationOptions
, andModelSummary
. Tags are user-specified key-value pairs that are immutably associated with the model. If tags are provided when a model is created, the Form Recognizer service will return the same tags as part of the model's summary. TheOperationInfo
andTrainingPollOperationState
of a model creation operation also produce thetags
if they were provided in theBuildModelOptions
. - Models now report the service API version used to create the model and that will be used for analysis in the
apiVersion
field. - Documents may now contain a new field type
DocumentCurrencyField
, which has an object withamount
andcurrencySymbol
fields as its value. This field is identified by the value"currency"
in thekind
field. Theamount
field contains the amount of the currency value, and thecurrencySymbol
field may contain a three-letter currency symbol if one was identified for the field. For example, the text$100.50
may have anamount
of100.5
and acurrencySymbol
of "USD". - Added support for setting the
buildMode
of a model building operation and introduced the "neural" build mode. Previous versions of the service and SDK only supported a single build mode that is now known as the "template" mode. Template models only accept documents that have the same basic page structure (i.e. a uniform visual appearance, or the same relative positioning of elements within the document), hence a fixed document "template." Neural models support document classes that have the same information, but different page structures. Examples of these documents include United States W2 tax forms, which all share the same information, but may vary in appearance by the company that created the document. Neural models currently only support English text, and are more costly and time-consuming to train and use for analysis, but should yield higher-quality results for English documents that do not follow a "template." - The
DocTypeInfo
type now has abuildMode
field that contains the build mode originally used to create the document type.
- Renamed the
beginAnalyzeDocuments
method ofDocumentAnalysisClient
tobeginAnalyzeDocument
for accuracy (only one input document is supported, though the document may contain multiple pages in certain file formats) and for consistency with other Azure SDK packages.- Renamed the options bag type
AnalyzeDocumentsOptions
toAnalyzeDocumentOptions
for consistency with the method name.
- Renamed the options bag type
- The
buildMode
parameter ofDocumentModelAdminsitrationClient#beginBuildModel
is a required parameter. To retain the same behavior as in previous versions, explicitly use the template build mode (pass the value"template"
to the method). - The
GeneratedDocument
type (as well as related types likeGeneratedDocumentField
) was removed from the public API and its uses replaced withunknown
, as it is only intended for internal use. These types represented raw REST API response types that are not exposed at runtime by the client methods. - Removed the
Preview
variant from theFormRecognizerApiVersion
object because it will never be different from theLatest
version in beta packages, and stable packages will not support it. - Renamed
beginExtractGenericDocument
andGenericDocumentResult
tobeginExtractGeneralDocument
andGeneralDocumentResult
for consistency with other Form Recognizer SDK packages. - Several of the prebuilt model schemas and result types have changed:
- The document type naming convention has changed. Instead of separation by colons (e.g. "prebuilt:receipt"), prebuilt model document type names are now separated by periods and are no longer prefixed with "prebuilt" ("prebuilt:idDocument:driverLicense" becomes "idDocument.driverLicense", "prebuilt:invoice" becomes just "invoice").
- In the
prebuilt-invoice
model, several numeric fields that represented amounts of money have been changed to a designated"currency"
type. These include thesubTotal
,totalTax
,invoiceTotal
,amountDue
, andpreviousUnpaidBalance
fields of invoices and theamount
,tax
, andunitPrice
fields of invoice items (a subfield of invoices).
- The
LayoutResult
andGeneralDocumentResult
types were missing theapiVersion
,modelId
, andcontent
fields that are common to all other analysis results. This version adds them through a new interface,AnalyzeResultCommon
, that includes these fields.LayoutResult
,GeneralDocumentResult
,ReadResult
, andAnalyzeResult
all now extend theAnalyzeResultCommon
interface. - The
DocumentSignatureField
interface was missing a type for itsvalue
property. The property existed at runtime, but no type information was available for this field. Thevalue
property has been added to the interface.
- Changed
FormRecognizerCommonClientOptions
to extendCommonClientOptions
from@azure/core-client
instead ofPipelineOptions
.CommonClientOptions
itself extendsPipelineOptions
, so no fields are removed, butCommonClientOptions
also includeshttpClient
andallowInsecureConnection
fields to allow overriding the default HTTP client and using insecure connections (without SSL/TLS) respectively.
- Added a
words
method toDocumentLine
. This method produces anIterableIterator
that will yield all of theDocumentWord
s that are contained by the line'sspans
. This allows accessing the words that are related to the line from the line itself. - Added
createdOn
andlastUpdatedOn
properties toDocumentAnalysisPollOperationState
andTrainingPollOperationState
that contain the date and time that the operation was created and last modified, respectively.
- Improved the handling of long-running operations (analysis and model creation operations). This fixes a bug (#18341) that caused the clients to reject model IDs that contained certain characters with an error: "unable to parse operationLocation". Our improvements to the long-running operation code make this error no longer possible.
- Replaced the
operationId
field ofDocumentAnalysisPollOperationState
with anoperationLocation
field containing the full operation URL, rather than the operation GUID only.
This new major version beta introduces a full redesign of the Azure Form Recognizer client library. To leverage features of the newest Form Recognizer service API (version "2021-09-30-preview" and newer), the new SDK is required, and application code must be changed to use the new clients. Please see the Migration Guide for detailed instructions on how to update application code from version 3.x of the Form Recognizer SDK to the new version (4.x). The following sections contain an outline of the changes.
- This package targets Azure Form Recognizer service API version
2021-09-30-preview
and newer. It is not compatible with the older Form Recognizer service API versions (2.0 and 2.1). To continue to use Form Recognizer API version 2.1, please use major version 3 of the client package (@azure/ai-form-recognizer@^3.2.0
). FormRecognizerClient
has been replaced byDocumentAnalysisClient
.- The new
beginExtractLayout
method replaces the previousbeginRecognizeContent
method and its-FromUrl
counterpart. Rather than aFormPageArray
, the new method produces an object that has properties forpages
,tables
, andstyles
. - The new
beginAnalyzeDocuments
method replaces the form recognition methods of the previous client. It provides a single method that can analyze documents using any model ID, including prebuilt models. It replacesbeginRecognizeCustomForms
,beginRecognizeReceipts
,beginRecognizeBusinessCards
,beginRecognizeInvoices
, andbeginRecognizeIdentityDocuments
, as well as all of their -FromUrl
counterparts. Rather than an array of forms, the new method produces anAnalyzeResult
(an object with several fields, described below). - Analysis using models trained without labeled training data is no longer supported by this package. This use-case is now provided by the prebuilt (generic) document model (see "New Features" below).
- The
language
option has been renamed tolocale
, and it accepts a wider variety of locale codes (such as "en-US" for United States English) as well as two-letter language codes (such as "fr" for French). - The
pages
option is now a singlestring
instead of an array of strings. Multiple page ranges may be specified by separating them with commas. - In many output types,
boundingBox
has been replaced by a list ofboundingRegions
, which may contain a bounding box and page number. This is useful for objects that may span multiple pages.
- The new
FormTrainingClient
has been replaced byDocumentModelAdministrationClient
.- The new
beginBuildModel
method replaces the previousbeginTraining
method. The new method and underlying service API do not support training a model using unlabeled training data. Labeled data are required to build a custom document model using the new SDK and service API. - The new
beginComposeModel
method replaces thebeginCreateComposedModel
method. - The
getCopyAuthorization
method no longer requires the target resource name and region, instead requiring only a model ID/name. - The
getModel
andlistModels
methods replace thegetCustomModel
andlistCustomModels
methods, as the new methods support prebuilt models as well as custom models. They no longer produce any information about models that did not succeed (if a model creation operation failed, it will not be included in the output oflistModels
and cannot be retrieved withgetModel
by model ID). - Custom models no longer have a name that is distinct from the model ID (more accurately, the model ID and name have been unified).
- You must now specify a model ID to create a model (whether composed, copied, or built). Previously, the Form Recognizer service would generate a GUID for the newly-created model. Now, the model ID may be any text (so long as it does not start with "prebuilt-"), and it must be provided when the model is created.
- The
ModelInfo
type (previouslyCustomFormModelInfo
) has been redesigned. It no longer containstrainingDocuments
, and it has a property calleddocTypes
that contains the information previously contained insubmodels
, but with a different shape. Please refer to the documentation for more information, as this type has changed significantly.
- The new
- The structure of many output types has changed. The full list of changes is extensive and discussed in depth in the migration guide. The following are some of the changes:
- When analyzing a document, the output is no longer an array of
RecognizedForm
s. All analysis methods—including custom/prebuilt model analysis, layout, and the generic document model—produce anAnalyzeResult
or a subset thereof. TheAnalyzeResult
has fields forpages
,tables
,styles
,entities
,keyValuePairs
, anddocuments
. ThebeginExtractLayout
andbeginExtractGenericDocument
methods produce subtypes (LayoutResult
andGenericDocumentResult
respectively) ofAnalyzeResult
that contain only those fields that are produced by that model. The list of changes within these types is extensive, as they have been redesigned. Please consult the documentation for more information. - The new type
AnalyzedDocument
replacesRecognizedForm
. It does not contain apages
property, aspages
are now a top-level property of theAnalyzeResult
. - The new type
DocumentPage
replacesFormPage
. It does not have atables
property, astables
are now a top-level property of theAnalyzeResult
. - The
DocumentLine
type (replacingFormLine
) no longer has awords
property, aswords
is now a property of theDocumentPage
. TheDocumentLine
instead containsspans
which can be used to correlateDocumentWord
s toDocumentLine
s, as words are no longer required to be part of a line.
- When analyzing a document, the output is no longer an array of
- Added support for a new generic document prebuilt model. The
beginExtractGenericDocument
method ofDocumentAnalysisClient
utilizes this new model, or it may be used withbeginAnalyzeDocuments
by its model ID: "prebuilt-document". This model produces all of the same basic layout information as the prebuilt layout model, but also extracts entities (along with their categories/subcategories) and key-value pairs (associations from one document element, such as a label, to another). - There are now strong result types for the four prebuilt models (receipts, business cards, invoices, and identity documents) built in to the SDK. To utilize these new result types, the
DocumentModel
data structure corresponding to the prebuilt model must be provided tobeginAnalyzeDocuments
(rather than providing a simple string model ID). TheseDocumentModel
data structures are part ofPrebuiltModels
(for example,PrebuiltModels.Receipt
), which can be imported from this package. - An extracted table may now span multiple pages. As a result, tables now have multiple bounding regions to describe their locations on multiple pages.
- Models may now have an optional
description
(part of the options bag when building a model, composing a model, or creating a model copy authorization). - Introduced
listOperations
andgetOperation
methods. These methods access model creation operations (including operations that failed to create a model). Operations are retained for 24 hours, after which point they are deleted.
- With the dropping of support for Node.js versions that are no longer in LTS, the dependency on
@types/node
has been updated to version 12. Read our support policy for more details. - Updated our internal core package dependencies to their latest versions in order to add support for Opentelemetry 1.0.0 which is compatible with the latest versions of our other client libraries.
- Changed TS compilation target to ES2017 in order to produce smaller bundles and use more native platform features
- Fixed an issue in which form recognition would sometimes fail due to encountering an element reference pointing to a selection mark, causing an exception to be thrown. These references are now handled correctly.
- This General Availability (GA) release marks the stability of the changes introduced in package versions 3.1.0-beta.1 through 3.1.0-beta.3.
- Changed all names including
IdDocument
to useIdentityDocument
instead, for example:BeginRecognizeIdentityDocumentOptions
,beginRecognizeIdentityDocuments
, andbeginRecognizeIdentityDocumentsFromUrl
for clarity. - Flattened the
TextStyle
type into theTextAppearance
type. Rather than having astyle
property with its ownname
andconfidence
,TextAppearance
now hasstyleName
andstyleConfidence
properties. - Removed the
FormGenderField
type. Any recognized value that was previously produced as aFormGenderField
is now returned as aFormStringField
instead (thevalue
will remain the same). - Renamed the
FormCountryField
type toFormCountryRegionField
, and changed thevalueType
discriminant property of that type to"countryRegion:
. - Renamed
ReadingOrder
andLanguage
toFormReadingOrder
andFormLanguage
to reduce the chance that these types would collide with other types having the same name from other packages. - Removed the
KnownStyleName
,KnownSelectionMarkState
, andKnownKeyValueType
enums, as they represent simple string enums. ThestyleName
,state
, andvalueType
properties (respectively) now have strong string-enum types. - Added the
KnownFormLocale
enum to access the well-known possible values of form locales (thelocale
property of the options parameters for prebuilt model recognition). - Migrated to the 2.1 Form Recognizer service endpoint for all REST API calls.
- Split
FormField
into several different interfaces. This should not cause any API compatibility issues except in certain edge cases (undefinedvalueType
), but should result in more accurate type refinement when dealing with FormField values and should significantly improve documentation and code hinting of these values through IntelliSense. - Added support for recognizing identity documents (such as driver licenses and passports) through the
beginRecognizeIdDocuments
method and its URL-based counterpartbeginRecognizeIdDocumentsFromUrl
. The identity document model is prebuilt and may be used without training a model. - Introduced two new form field value types:
"gender"
and"country"
. These value types appear in the identity document recognition responses.- The
"gender"
value type signifies the gender or sex of an individual and is represented by a string that is one of three values: "M", "F", or "X". - The
"country"
value type indicates a specific country and is represented by a three-letter country code string (ISO 3166-1 alpha-3).
- The
- Added support for the
pages
option to all form recognition methods (custom forms and all prebuilt models). This option works the same as in the content recognition methods, and allows for the specification of which pages within a multi-page document (PDF or TIFF formats) should be considered during analysis and included in the response. - Added support for a
readingOrder
option to the content recognition methods. This option enables you to control the algorithm that the service uses to determine how recognized lines of text should be ordered. - Custom model recognition now supports bitmap images through the "image/bmp" content-type (content recognition and all prebuilt models already support this content type).
- Migrated to the 2.1-preview.3 Form Recognizer service endpoint for all REST API calls.
- Renamed
Appearance
toTextAppearance
,Style
toTextStyle
(previously the name of the enum forStyle.name
, and theTextStyle
enum toStyleName
for the sake of clarity in the type names. - Added
KnownStyleName
,KnownLanguage
,KnownSelectionMarkState
, andKnownKeyValueType
enums to access the well-known possible values of theStyleName
,Language
,SelectionMarkState
, andKeyValueType
parameters/fields respectively.
- Added a
pages
option toBeginRecognizeContentOptions
. This option allows for the specification of which pages of a document to include in the content results. If a value is provided, pages that are not included in thepages
field will not be analyzed. - Added an
appearance
property toFormLine
that contains information about the appearance of the line, such as style (e.g. "handwritten"). - Added an optional
boundingBox
property toFormTable
that has a bounding box that contains the entire table. - Added support for the "image/bmp" content type. This content type is supported on all methods that accept a
FormRecognizerRequestBody
except for custom form recognition. - Added a
language
option toBeginRecognizeContentOptions
. By default, when performing layout/content analysis, the service will attempt to detect the language of the document and supports multi-language inputs. Thelanguage
parameter allows you to override this behavior and force the service to use a specific language. - Added support for Invoice recognition through the
beginRecognizeInvoices
andbeginRecognizeInvoicesFromUrl
methods. The Invoice model is prebuilt and may be used without training a model. - Added support for creating composed models through the
beginCreateComposedModel
method ofFormTrainingClient
. It accepts a list of model IDs that refer to labeled custom models that should be composed into a new model. - Added a
formTypeConfidence
property toRecognizedForm
indicating the model's confidence in determining the correct form type (and therefore the correct model to use) during recognition. - Added a
properties
field toCustomFormModelInfo
that may optionally contain extra properties. Currently, the only property isisComposedModel
which will indicate whether the model is a composed model or a single trained model. - Added a
modelId
field to theCustomFormSubmodel
,TrainingDocumentInfo
, andRecognizedForm
types containing the ID of the exact model that they are associated with (for example, in the context of a composed model, themodelId
field can determine which specific component model is associated with the submodel, training document, or recognized form). - Added support for selection marks in form fields. In addition to the previously-existing variants of
FormField
, custom models can now return fields withvalueType: "selectionMark"
and theirvalue
will be the state of the selection mark. - Added a new page element
FormSelectionMark
that represents marks on a page that can be selected (such as checkboxes and radio buttons). TheselectionMarks
field ofFormPage
contains the selection marks that were recognized in the page. A selection mark has a state value that is either "checked" or "unchecked." - Made optimizations to the long-running operation infrastructure that should result in faster and more memory-efficient polling for results of custom form recognition, receipt recognition, and business card recognition.
- Added an option for specifying the locale of a document to receipt and business card methods through the
locale
property of the options bag. - Added support for Business Card recognition through the
beginRecognizeBusinessCards
andbeginRecognizeBusinessCardsFromUrl
methods, which mirror their receipt counterparts. The Invoice model is prebuilt and may be used without training a model. - Added the
modelName
property toCustomFormModelInfo
, reflecting the same property that was added to the model training options. - Altered the type hierarchy so that
CustomFormModel
inherits the properties ofCustomFormModelInfo
. - Added the
modelName
field toBeginTrainingOptions
. The given model name will become an immutable property of the trained model. - Migrated to the 2.1-preview.1 Form Recognizer service endpoint for all REST API calls.
- This release marks the general availability of the
@azure/ai-form-recognizer
package.
- Changed the package version to 3.0.0-preview.1 to reduce confusion with older versions of the Azure Form Recognizer SDKs.
- Changed the name of the
options
bag parameter ofbeginRecognizeReceipts
andbeginRecognizeReceiptsFromUrl
toBeginRecognizeReceiptsOptions
. - Switched to using the generally-available 2.0 service endpoint rather than 2.0-preview.
- Added a
pageNumber
property to theFormTable
andFormTableCell
types indicating the number of the page where the table/cell appeared within the input document. - [Breaking] Renamed the
includeSubFolders
property of theTrainSourceFilter
type toincludeSubfolders
. - [Breaking] Renamed the
documentName
property of theTrainingDocumentInfo
type to justname
. - [Breaking] Removed the
containingLine
property of theFormWord
type. - Made the
rowSpan
,columnSpan
,isHeader
, andisFooter
properties of theFormTableCell
type non-optional to reflect that they have default values. - [Breaking] Renamed
CustomFormField
toCustomFormModelField
for similarity to other language SDKs. - [Breaking] Removed the redundant
expirationDateTimeTicks
property from theCopyAuthorization
type, as theexpiresOn
property exists. - [Breaking] Moved the optional
contentType
parameter of theFormRecognizerClient
recognition methods (recognizeContent
,recognizeCustomForms
,recognizeReceipts
, and their URL-based variants) to the associated options bag for these methods. - [Breaking] Removed exports of several internal types, including most internal poller operation states and some unused types. All client poller implementations now return a smaller subset of fields.
- [Breaking] Replace
RecognizedReceiptArray
with the more genericRecognizedFormArray
in the Poller response type returned bybeginRecognizeReceipts
andbeginRecognizeReceiptsFromUrl
. - Added an
expiresOn
property to theCopyAuthorization
type containing the time that the Copy Authorization will expire encoded as a JavaScriptDate
type. - [Breaking] Rename the
textContent
field of theFieldData
andFormTableCell
types tofieldElements
to mirror the change in its type. - [Breaking] Rename the
FormField
type'slabelText
andvalueText
fields tolabelData
andvalueData
respectively, to mirror the change of their type toFieldData
; - [Breaking] Rename the
includeTextContent
request option toincludeFieldElements
to mirror the change toFieldData
andFormElement
. - [Breaking] Rename
FieldText
toFieldData
andFormContent
toFormElement
to reflect that fields may contain more than textual information. - [Breaking] Rename
includeTextDetails
toincludeTextContent
in custom form and receipt recognition options to be consistent with other languages. - [Breaking] Rename properties
requestedOn
totrainingStartedOn
andcompletedOn
totrainingCompletedOn
inCustomFormModel
andCustomFormModelInfo
types.
- Blank pages in receipt recognition are now handled properly.
- Support Azure Active Directory credential.
- Support to copy a custom model from one Form Recognizer resource to another.
- Headers and query parameters which don't contain sensitive information are no longer redacted in logging output.
- Refactoring for cross-language consistency:
- [Breaking] Rename
beginRecognizeForms()
tobeginRecognizeCustomForms()
inFormRecognizerClient
. - [Breaking] Rename
listModels()
tolistCustomModels()
inFormTrainingClient
. - [Breaking] Rename
count
tocustomModelCount
andlimit
tocustomModelLimit
inAccountProperties
. - [Breaking] Rename type
ErrorInformation
toFormRecognizerError
. - [Breaking] Rename type
ModelStatus
toCustomFormModelStatus
. - [Breaking] Rename type
CustomFormSubModelField
toCustomFormField
. - [Breaking] Rename type
FormElement
toFormContent
andFormElementCommon
toFormContentCommon
. - [Breaking] Rename property
fieldLabel
tolabelText
inFormField
type. - [Breaking] Rename type
ModelInfo
toCustomFormModelInfo
. - [Breaking] Rename properties
createdOn
torequestedOn
andlastModified
tocompletedOn
inCustomModelInfo
type. - [Breaking] Rename type
TrainModelOptions
toTrainingFileFilter
. - [Breaking] Rename type
TrainStatus
toTrainingStatus
. - [Breaking] Rename type
ContentType
toFormContentType
. - [Breaking] Rename type
FormText
toFieldText
. - [Breaking] Rename type
CustomFormSubModel
toCustomFormSubmodel
. - [Breaking] Rename
models
tosubmodels
inCustomFormModel
. - [Breaking] Recognition methods and training methods now return the result directly, instead of wrapping them in a response object. Specifically,
beginTraining
now returnsCustomFormModel
instead ofFormModelResponse
from the poller.beginRecognizeContent
andbeginRecognizeContentFromUrl
now returnFormPageArray
instead ofRecognizeContentResultResponse
from the poller.beginRecognizeForms
andbeginRecognizeFormsFromUrl
now returnRecognizedFormArray
instead ofRecognizeFormResultResponse
from the poller.beginRecognizeReceipts
andbeginRecognizeReceiptsFromUrl
now returnRecognizedReceiptArray
instead ofRecognizeReceiptResultResponse
from the poller.
- [Breaking] Remove
getFormTrainingClient()
fromFormRecognizerClient
. A new methodgetFormRecognizerClient()
is added toFormTrainingClient
- [Breaking]
useTrainingLabels
parameter is now required forbeginTraining()
method. - [Breaking] Rename
intervalInMs
toupdateIntervalInMs
for all LRO poller options. - [Breaking] Remove
USReceipt
and associated types. - Rename the first parameter of
beginRecognizeContent()
fromdata
toform
. - Rename the second parameter of
beginRecognizeForms()
fromdata
toform
. - Rename the first parameter of
beginRecognizeReceipts()
fromdata
toreceipt
. - Rename the first parameter of
beginRecognizeContentFromUrl()
fromdocumentUrl
toformUrl
. - Rename the second parameter of
beginRecognizeFormsFromUrl()
fromdocumentUrl
toformUrl
. - Rename the first parameter of
beginRecognizeReceiptsFromUrl()
fromdocumentUrl
toreceiptUrl
. - Rename the first parameter of
beginTraining
fromblobContainerUrl
totrainingFilesUrl
.
- [Breaking] Rename
FormTrainingClient.listModels()
now works correctly on NodeJs v8.- Custom Form recognition now handles missing fields properly.
- This release is a preview of our efforts to create a client library that is user friendly and idiomatic to the JavaScript ecosystem. The reasons for most of the changes in this update can be found in the Azure SDK Design Guidelines for TypeScript.
- Differences from previous public package
@azure/cognitiveservices-formrecognizer
- Package name changed from
@azure/cognitiveservices-formrecognizer
to@azure/ai-form-recognizer
. - Package targets version
2.0
of the service API.
- Package name changed from