Skip to content

Commit 6edf73d

Browse files
HarshaNalluruwitemple-msftwillmtemple
authored
[Form Recognizer] 2023-07-31 swagger (Azure#26560)
### Packages impacted by this PR `@azure/ai-form-recognizer` ### Describe the problem that is addressed by this PR Moving in the `azure-sdk-for-js-pr` code(https://github.com/Azure/azure-sdk-for-js-pr/tree/ai-form-recognizer/2023-07-31) to the `azure-sdk-for-js` repo --------- Co-authored-by: Will Temple <witemple@microsoft.com> Co-authored-by: Will Temple <will@wtemple.net>
1 parent d9bfd12 commit 6edf73d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+616
-8201
lines changed

sdk/formrecognizer/ai-form-recognizer/CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Release History
22

3+
## 4.1.0 (Unreleased)
4+
5+
### Features Added
6+
7+
- `AnalyzeDocumentOptions.features` allows three new features compared to the last beta version:
8+
- `barcodes`: enables the detection of barcodes in the document.
9+
- `keyValuePairs`: enable the detection of general key value pairs (form fields) in the document.
10+
- `languages`: enables the detection of the text content language.
11+
- `beginBuildDocumentModel` has a new overload that accepts a `DocumentModelContentSource` in place of a raw `containerUrl`. This allows training document models using the new Azure Blob file list source (that is already supported by document classifiers). The `DocumentModelContentSource` is an object that contains a `containerUrl` property, and if a `fileList` property is also provided it is interpreted as an Azure Blob file list source. Otherwise it is interpreted as an Azure Blob content source with an optional `prefix` property.
12+
13+
### Breaking Changes
14+
15+
- `DocumentAnalysisClient` and `DocumentModelAdministrationClient` now target service API version `2023-07-31` by default. Version `2023-02-28-preview` is not supported.
16+
- `AnalyzeDocumentOptions.features` changed the following feature names:
17+
- `ocr.highResolution` renamed to `ocrHighResolution`.
18+
- `ocr.formula` renamed to `formulas`.
19+
- `ocr.font` renamed to `styleFont`.
20+
- The following fields have been removed
21+
- `AnalyzeDocumentOptions.queryFields`
22+
- `DocumentPage.kind` and `DocumentPage.images` (`DocumentPageKind` and `DocumentImage` types have been removed too.)
23+
- `DocumentKeyValuePair.commonName`
24+
- Changed how content sources are provided when creating document classifiers. The type of content source (`azureBlobContentSource` or `azureBlobFileListSource`) is no longer required in the content source input, and the type is now inferred automatically. If a `fileList` property is provided, it is interpreted as a file list source, and otherwise it is interpreted as a blob content source with optional `prefix`.
25+
326
## 4.1.0-beta.1 (2023-04-11)
427

528
### Features Added

sdk/formrecognizer/ai-form-recognizer/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "js",
44
"TagPrefix": "js/formrecognizer/ai-form-recognizer",
5-
"Tag": "js/formrecognizer/ai-form-recognizer_9bcc4e2404"
5+
"Tag": "js/formrecognizer/ai-form-recognizer_8a62bba2a4"
66
}

sdk/formrecognizer/ai-form-recognizer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"sdk-type": "client",
44
"author": "Microsoft Corporation",
55
"description": "An isomorphic client library for the Azure Form Recognizer service.",
6-
"version": "4.1.0-beta.1",
6+
"version": "4.1.0",
77
"keywords": [
88
"node",
99
"azure",

sdk/formrecognizer/ai-form-recognizer/review/ai-form-recognizer.api.md

Lines changed: 18 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export interface AnalyzeDocumentOptions<Result = AnalyzeResult<AnalyzedDocument>
5252
features?: string[];
5353
locale?: string;
5454
pages?: string;
55-
queryFields?: string[];
5655
}
5756

5857
// @public
@@ -83,7 +82,7 @@ export interface AzureBlobContentSource {
8382
}
8483

8584
// @public
86-
export interface AzureBlobFileListSource {
85+
export interface AzureBlobFileListContentSource {
8786
containerUrl: string;
8887
fileList: string;
8988
}
@@ -114,7 +113,7 @@ export interface BoundingRegion extends HasBoundingPolygon {
114113

115114
// @public
116115
export interface ClassifierDocumentTypeDetails {
117-
azureBlobFileListSource?: AzureBlobFileListSource;
116+
azureBlobFileListSource?: AzureBlobFileListContentSource;
118117
azureBlobSource?: AzureBlobContentSource;
119118
}
120119

@@ -198,12 +197,8 @@ export interface DocumentAnalysisPollOperationState<Result = AnalyzeResult<Analy
198197
// @public
199198
export interface DocumentAnnotation extends HasBoundingPolygon {
200199
confidence: number;
201-
kind: DocumentAnnotationKind;
202200
}
203201

204-
// @public
205-
export type DocumentAnnotationKind = string;
206-
207202
// @public
208203
export interface DocumentArrayField<T = DocumentField> extends DocumentFieldCommon {
209204
kind: "array";
@@ -242,6 +237,9 @@ export interface DocumentClassifierBuildOperationDetails extends OperationDetail
242237
result?: DocumentClassifierDetails;
243238
}
244239

240+
// @public
241+
export type DocumentClassifierContentSource = AzureBlobContentSource | AzureBlobFileListContentSource;
242+
245243
// @public
246244
export interface DocumentClassifierDetails {
247245
apiVersion: string;
@@ -321,13 +319,6 @@ export interface DocumentFormula extends HasBoundingPolygon {
321319
// @public
322320
export type DocumentFormulaKind = string;
323321

324-
// @public
325-
export interface DocumentImage extends HasBoundingPolygon {
326-
confidence: number;
327-
pageNumber: number;
328-
span: DocumentSpan;
329-
}
330-
331322
// @public
332323
export interface DocumentIntegerField extends DocumentValueField<number> {
333324
kind: "integer";
@@ -342,7 +333,6 @@ export interface DocumentKeyValueElement {
342333

343334
// @public
344335
export interface DocumentKeyValuePair {
345-
commonName?: string;
346336
confidence: number;
347337
key: DocumentKeyValueElement;
348338
value?: DocumentKeyValueElement;
@@ -375,9 +365,10 @@ export class DocumentModelAdministrationClient {
375365
constructor(endpoint: string, credential: KeyCredential, options?: DocumentModelAdministrationClientOptions);
376366
constructor(endpoint: string, credential: KeyCredential | TokenCredential, options?: DocumentModelAdministrationClientOptions);
377367
beginBuildDocumentClassifier(classifierId: string, docTypes: {
378-
[docType: string]: ClassifierDocumentTypeDetails;
368+
[docType: string]: DocumentClassifierContentSource;
379369
}, options?: BeginBuildDocumentClassifierOptions): Promise<DocumentClassifierPoller>;
380370
beginBuildDocumentModel(modelId: string, containerUrl: string, buildMode: DocumentModelBuildMode, options?: BeginBuildDocumentModelOptions): Promise<DocumentModelPoller>;
371+
beginBuildDocumentModel(modelId: string, contentSource: DocumentModelContentSource, buildMode: DocumentModelBuildMode, options?: BeginBuildDocumentModelOptions): Promise<DocumentModelPoller>;
381372
beginComposeDocumentModel(modelId: string, componentModelIds: Iterable<string>, options?: BeginComposeDocumentModelOptions): Promise<DocumentModelPoller>;
382373
beginCopyModelTo(sourceModelId: string, authorization: CopyAuthorization, options?: BeginCopyModelOptions): Promise<DocumentModelPoller>;
383374
deleteDocumentClassifier(classifierId: string, options?: OperationOptions): Promise<void>;
@@ -417,6 +408,9 @@ export interface DocumentModelComposeOperationDetails extends OperationDetails {
417408
result?: DocumentModelDetails;
418409
}
419410

411+
// @public
412+
export type DocumentModelContentSource = AzureBlobContentSource | AzureBlobFileListContentSource;
413+
420414
// @public
421415
export interface DocumentModelCopyToOperationDetails extends OperationDetails {
422416
kind: "documentModelCopyTo";
@@ -473,12 +467,9 @@ export interface DocumentObjectField<Properties = {
473467
// @public
474468
export interface DocumentPage {
475469
angle?: number;
476-
annotations?: DocumentAnnotation[];
477470
barcodes?: DocumentBarcode[];
478471
formulas?: DocumentFormula[];
479472
height?: number;
480-
images?: DocumentImage[];
481-
kind: DocumentPageKind;
482473
lines?: DocumentLine[];
483474
pageNumber: number;
484475
selectionMarks?: DocumentSelectionMark[];
@@ -488,9 +479,6 @@ export interface DocumentPage {
488479
words?: DocumentWord[];
489480
}
490481

491-
// @public
492-
export type DocumentPageKind = string;
493-
494482
// @public
495483
export interface DocumentParagraph {
496484
boundingRegions?: BoundingRegion[];
@@ -624,10 +612,9 @@ export type FormRecognizerApiVersion = (typeof FormRecognizerApiVersion)[keyof t
624612

625613
// @public
626614
export const FormRecognizerApiVersion: {
627-
readonly Latest: "2023-02-28-preview";
628-
readonly Stable: "2022-08-31";
615+
readonly Latest: "2023-07-31";
616+
readonly Stable: "2023-07-31";
629617
readonly "2022-08-31": "2022-08-31";
630-
readonly "2023-02-28-preview": "2023-02-28-preview";
631618
};
632619

633620
// @public
@@ -640,10 +627,12 @@ export type FormRecognizerFeature = (typeof FormRecognizerFeature)[keyof typeof
640627

641628
// @public (undocumented)
642629
export const FormRecognizerFeature: {
643-
readonly QueryFieldsPremium: "queryFields.premium";
644-
readonly OcrFont: "ocr.font";
645-
readonly OcrHighResolution: "ocr.highResolution";
646-
readonly OcrFormula: "ocr.formula";
630+
readonly Fonts: "styleFont";
631+
readonly OcrHighResolution: "ocrHighResolution";
632+
readonly Formulas: "formulas";
633+
readonly Languages: "languages";
634+
readonly Barcodes: "barcodes";
635+
readonly KeyValuePairs: "keyValuePairs";
647636
};
648637

649638
// @public
@@ -677,12 +666,6 @@ export interface InnerError {
677666
message?: string;
678667
}
679668

680-
// @public
681-
export enum KnownDocumentAnnotationKind {
682-
Check = "check",
683-
Cross = "cross"
684-
}
685-
686669
// @public
687670
export enum KnownDocumentBarcodeKind {
688671
Aztec = "Aztec",
@@ -734,14 +717,6 @@ export enum KnownDocumentFormulaKind {
734717
Inline = "inline"
735718
}
736719

737-
// @public
738-
export enum KnownDocumentPageKind {
739-
Document = "document",
740-
Image = "image",
741-
Sheet = "sheet",
742-
Slide = "slide"
743-
}
744-
745720
// @public
746721
export enum KnownDocumentSignatureType {
747722
Signed = "signed",

sdk/formrecognizer/ai-form-recognizer/samples-dev/buildClassifier.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,10 @@ async function main() {
4242
type1: {
4343
// `azureBlobSource` isn't the only way to provide training data to the service. For more information, see
4444
// the documentation of the `ClassifierDocumentTypeDetails` type.
45-
azureBlobSource: {
46-
containerUrl: trainingDataSasUrl1,
47-
},
45+
containerUrl: trainingDataSasUrl1,
4846
},
4947
type2: {
50-
azureBlobSource: {
51-
containerUrl: trainingDataSasUrl2,
52-
},
48+
containerUrl: trainingDataSasUrl2,
5349
},
5450
},
5551
{

sdk/formrecognizer/ai-form-recognizer/samples-dev/prebuilt/prebuilt-businessCard.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
// Model: prebuilt-businessCard
1010
// Description: Extract key information from business cards.
11-
// API Version: 2023-02-28-preview
12-
// Created: Thu Apr 06 2023
11+
// API Version: 2023-07-31
12+
// Created: Wed Aug 02 2023
1313

1414
import * as fr from "@azure/ai-form-recognizer";
1515

@@ -139,8 +139,8 @@ function modelInfo() {
139139
return {
140140
modelId: "prebuilt-businessCard",
141141
description: "Extract key information from business cards.",
142-
createdOn: "2023-02-28T00:00:00.000Z",
143-
apiVersion: "2023-02-28-preview",
142+
createdOn: "2023-07-31T00:00:00.000Z",
143+
apiVersion: "2023-07-31",
144144
docTypes: {
145145
businessCard: {
146146
buildMode: "template",

sdk/formrecognizer/ai-form-recognizer/samples-dev/prebuilt/prebuilt-document.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// Model: prebuilt-document
1010
// Description: Extract text, layout, entities, and general key-value pairs from documents.
11-
// API Version: 2023-02-28-preview
11+
// API Version: 2023-07-31
1212
// Created: Thu Apr 06 2023
1313

1414
import * as fr from "@azure/ai-form-recognizer";
@@ -55,6 +55,6 @@ function modelInfo() {
5555
modelId: "prebuilt-document",
5656
description: "Extract text, layout, entities, and general key-value pairs from documents.",
5757
createdOn: "2023-02-28T00:00:00.000Z",
58-
apiVersion: "2023-02-28-preview",
58+
apiVersion: "2023-07-31",
5959
} as const;
6060
}

0 commit comments

Comments
 (0)