question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@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

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:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
witemple-msftcommented, Aug 9, 2022

@wilsonzlin Thanks for reporting this. We transform the number[] into Point2D[] for convenience in the API, but due to some loose type constraints in one of our internal functions, we missed it specifically on DocumentLine objects.

We’re scheduled to release a new beta: 4.0.0-beta.6 today that should resolve this issue.

1reaction
jsquirecommented, Aug 8, 2022

It’s got the right labels on it to qualify for getting picked-up the next time we run training.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found