Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.47k stars 4.8k forks source link

[QUERY] How to get barcodes with prebuit-invoice model #38081

Closed rvilvert closed 1 year ago

rvilvert commented 1 year ago

Library name and version

Azure.AI.FormRecognizer 4.1.0-beta.1

Query/Question

I'm following the javascript example to get invoice data using the prebuilt-invoice model. When I tried on Form Recognizer Studio there is an option to enable the detection of barcodes.

With the given example I could not find a way to enable this. My code:

const client = new DocumentAnalysisClient(endpoint, new AzureKeyCredential(key));
const poller = await client.beginAnalyzeDocumentFromUrl("prebuilt-invoice", document);
const {
        documents: [result]
    } = await poller.pollUntilDone();

//poller.getResult().pages[0].barcodes = undefined

I believe I need to pass a parameter to enable the barcode read, any thoughts?

Environment

.NET SDK: Version: 7.0.202 Commit: 6c74320bc3

OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.202\

Host: Version: 7.0.4 Architecture: x64 Commit: 0a396acafe

.NET SDKs installed: 6.0.401 [C:\Program Files\dotnet\sdk] 7.0.202 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

jsquire commented 1 year ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

kinelski commented 1 year ago

Hello @rvilvert,

The option to enable barcode detection you saw in Form Recognizer Studio is only available in service version 2023-07-31. The SDK version you're using (4.1.0-beta.1) targets service version 2023-02-28-preview, which only supports barcode detection in models prebuilt-read and prebuilt-layout.

SDK version 4.1.0 targeting the latest service version will be released this week. Once it's released, you'll be able to enable barcode detection by doing the following (in the .NET SDK):

var options = new AnalyzeDocumentOptions()
{
    Features = { DocumentAnalysisFeature.Barcodes }
};
var operation = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-invoice", document, options);

Please note that this repository focuses on the .NET SDK. If you have questions about the JavaScript SDK, feel free to open an issue at https://github.com/Azure/azure-sdk-for-js.

github-actions[bot] commented 1 year ago

Hi @rvilvert. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

rvilvert commented 1 year ago

Thank you @kinelski