The following code is throwing an Invalid argument error on KeyValuePairs while keyValuePairs feature exists and is valid. Can you help explain?
AnalyzeDocumentOperation operation = await client.AnalyzeDocumentFromUriAsync(WaitUntil.Completed, "prebuilt-layout", fileUri, new AnalyzeDocumentOptions() { Features = { DocumentAnalysisFeature.KeyValuePairs } });
Error message: Azure.RequestFailedException: 'Invalid argument. Status: 400 (Bad Request) ErrorCode: InvalidArgument Content: {"error":{"code":"InvalidArgument","message":"Invalid argument.","innererror":{"code":"InvalidParameter","message":"The parameter keyValuePairs is invalid: The feature is invalid or not supported."}}}
I tried all below feature and they work, but keyvaluepairs feature don't work.
AnalyzeDocumentOptions options = new AnalyzeDocumentOptions();
options.Features.Add(DocumentAnalysisFeature.Barcodes);
options.Features.Add(DocumentAnalysisFeature.Formulas);
options.Features.Add(DocumentAnalysisFeature.Languages);
options.Features.Add(DocumentAnalysisFeature.FontStyling);
options.Features.Add(DocumentAnalysisFeature.OcrHighResolution);
Prerequisites:
Create an Azure AI services or Document Intelligence single-service or multi-service.
To connect your application to the Azure Document Intelligence service:
Use Document Intelligence client library SDKs or REST API - Azure AI services.
Code taken from DOC.
Output: