@azure/ai-form-recognizer type definitions do not match actual response data
See original GitHub issue- Package Name: @azure/ai-form-recognizer
- Package Version: 4.0.0-beta.4
- Operating system: Linux
- nodejs
- version: 16
- browser
- name/version:
- typescript
- version: 4.7
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://docs.microsoft.com
Describe the bug
The returned analysed document data from calling beginAnalyzeDocument
with the prebuilt-document
model has data that doesn’t match the declared type declarations. The pages[].lines[]
array element objects have an incorrect type definition. Expected type defined in type definitions:
{
polygon?: Point2D[]
}
Actual type of returned value:
{
polygon?: number[]
}
Reproduce
import { DocumentAnalysisClient } from "@azure/ai-form-recognizer";
const client = new DocumentAnalysisClient(...);
const res = await client.beginAnalyzeDocument("prebuilt-document", documentFile);
// TS type: { polygon?: Point2D[] }
// Actual data: { polygon?: number[] }
console.log(res.pages[0].lines[0]);
Note that the other objects that have the polygon
property (words
, paragraphs
, keyValuePairs
, etc.) are correctly returned as Point2D
objects; only line polygons are returned as an array of numbers.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
[ai-form-recognizer] TypeError (investigation needed) #8508
I just ran into this, in my case it is because the library does not handle null values for fields (which is the...
Read more >Form Recognizer service Quotas and Limits - Azure
Quick reference, detailed description, and best practices on Azure Form Recognizer service Quotas and Limits.
Read more >Form Recognizer – Automated Data Processing Systems
Microsoft Azure Form Recognizer is an automated data processing system that uses AI and OCR to quickly extract text and structure from documents....
Read more >Form Recognizer API (v2.1-preview.2) - Cognitive Services
Form Recognizer learns the structure of your forms to intelligently extract text and data. It ingests text from forms, applies machine learning technology ......
Read more >What's new in Form Recognizer? - Azure Applied AI Services
Label subtypes and second-level subtypes The Studio now supports subtypes for table columns, table rows, and second-level subtypes for types ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@wilsonzlin Thanks for reporting this. We transform the
number[]
intoPoint2D[]
for convenience in the API, but due to some loose type constraints in one of our internal functions, we missed it specifically onDocumentLine
objects.We’re scheduled to release a new beta:
4.0.0-beta.6
today that should resolve this issue.It’s got the right labels on it to qualify for getting picked-up the next time we run training.