From 2f29170f770b5cb1d2a247c4664d112c5a9f148c Mon Sep 17 00:00:00 2001 From: "Sameeksha Vaity (from Dev Box)" Date: Mon, 16 Dec 2024 15:45:33 -0800 Subject: [PATCH] update for minor testfix --- .../MIGRATION_GUIDE.md | 2 ++ .../azure-ai-documentintelligence/README.md | 19 +++++++++++++++++++ .../DocumentIntelligenceClientTestBase.java | 1 - 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md b/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md index 54ffa722bafed..b1d74b94d14fd 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md +++ b/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md @@ -35,6 +35,8 @@ New features provided by the `azure-ai-documentintelligence` library include: - `AUTO`: let the service determine where to split. - `NONE`: the entire file is treated as a single document. No splitting is performed. - `PER_PAGE`: each page is treated as a separate document. Each empty page is kept as its own document. +- **Batch analysis:** allows you to bulk process multiple documents using a single request. +Rather than having to submit documents individually, you can analyze a collection of documents like invoices, a series of a loan documents, or a group of custom documents simultaneously. ## Breaking Changes diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/README.md b/sdk/documentintelligence/azure-ai-documentintelligence/README.md index 05568865f3a4e..f988c5972b266 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/README.md +++ b/sdk/documentintelligence/azure-ai-documentintelligence/README.md @@ -9,6 +9,7 @@ It includes the following main features: * Custom - Build custom models to extract text, field values, selection marks, and table data from documents. Custom models are built with your own data, so they're tailored to your documents. * Read - Read information about textual elements, such as page words and lines in addition to text language information. * Classifiers - Build custom classifiers to categorize documents into predefined classes. +- Batch analysis - Analyze multiple documents using a single request. [Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_reference_doc] | [Product Documentation][product_documentation] | [Samples][sample_readme] @@ -113,7 +114,23 @@ DocumentIntelligenceAsyncClient documentIntelligenceAsyncClient = new DocumentIn .endpoint("{endpoint}") .buildAsyncClient(); ``` +You will also need to [register a new Microsoft Entra application][register_aad_app] and grant access to Document Intelligence by assigning the `"Cognitive Services Data Reader"` role to your service principal. +It is strongly recommended to use Microsoft Entra ID as your default authentication approach. On the other hand, using an `AzureKeyCredential` can be helpful on getting-started scenarios since it can be set up fastly. +##### Get the API Key + +The API key can be found in the [Azure Portal][azure_portal_get_endpoint] or by running the following Azure CLI command: + +```PowerShell +az cognitiveservices account keys list --name "" --resource-group "" +``` + +```java com.azure.ai.documentanalysis.readme.DocumentIntelligenceAdministrationClient +DocumentIntelligenceAdministrationClient documentIntelligenceAsyncClient = new DocumentIntelligenceAdministrationClientBuilder() + .credential(new AzureKeyCredential("{key}")) + .endpoint("{endpoint}") + .buildClient(); +``` ## Key concepts ### DocumentAnalysisClient The [DocumentAnalysisClient][document_analysis_sync_client] and [DocumentAnalysisAsyncClient][document_analysis_async_client] @@ -477,6 +494,8 @@ For details on contributing to this repository, see the [contributing guide](htt [analyze_identity_documents_from_url_async]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeIdentityDocumentsFromUrlAsync.java [analyze_invoices_from_url]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeInvoicesFromUrl.java [analyze_receipts_from_url]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/documentintelligence/azure-ai-documentintelligence/src/samples/java/com/azure/ai/documentintelligence/AnalyzeReceiptsFromUrl.java +[register_aad_app]: https://learn.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal +[azure_portal_get_endpoint]: https://learn.microsoft.com/azure/ai-services/document-intelligence/how-to-guides/create-document-intelligence-resource#get-endpoint-url-and-keys [fr_models]: https://aka.ms/azsdk/formrecognizer/models [service_access]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows diff --git a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTestBase.java b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTestBase.java index e517cc40bf807..2b0c8f8b0581c 100644 --- a/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTestBase.java +++ b/sdk/documentintelligence/azure-ai-documentintelligence/src/test/java/com/azure/ai/documentintelligence/DocumentIntelligenceClientTestBase.java @@ -229,7 +229,6 @@ void validateIdentityData(AnalyzeResult analyzeResult) { assertEquals("Main Street", licensePageFields.get("Address").getValueAddress().getStreetAddress()); assertNotNull(licensePageFields.get("Address").getConfidence()); assertEquals("USA", licensePageFields.get("CountryRegion").getValueCountryRegion()); - assertNotNull(licensePageFields.get("CountryRegion").getConfidence()); assertEquals(LocalDate.of(1988, 3, 23), licensePageFields.get("DateOfBirth").getValueDate()); assertNotNull(licensePageFields.get("DateOfBirth").getConfidence()); assertEquals(LocalDate.of(2026, 3, 23), licensePageFields.get("DateOfExpiration").getValueDate());