Skip to content

Commit b383c6c

Browse files
authored
Merge pull request #259874 from MicrosoftDocs/main
11/30 11:00 AM IST Publish
2 parents 304d283 + 6eccf28 commit b383c6c

File tree

96 files changed

+1252
-362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+1252
-362
lines changed

articles/ai-services/document-intelligence/changelog-release-history.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This reference article provides a version-based description of Document Intellig
4141
* Document Intelligence **1.0.0-beta.1**
4242
* **Targets REST API 2023-10-31-preview by default**
4343

44-
[**Package (MVN)**](https://repo1.maven.org/maven2/com/azure/azure-ai-documentintelligence/1.0.0-beta.1/)
44+
[**Package (MVN)**](https://mvnrepository.com/artifact/com.azure/azure-ai-documentintelligence/1.0.0-beta.1)
4545

4646
[**ReadMe**](https://github.com/Azure/azure-sdk-for-java/blob/azure-ai-documentintelligence_1.0.0-beta.1/sdk/documentintelligence/azure-ai-documentintelligence/README.md#azure-documentintelligence-client-library-for-java)
4747

articles/ai-services/document-intelligence/quickstarts/get-started-sdks-rest-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ zone_pivot_groups: programming-languages-set-formre
2626
> * Some platforms are still awaiting the renaming update.
2727
> * All mention of Form Recognizer or Document Intelligence in our documentation refers to the same Azure service.
2828
29-
**This content applies to:** ![checkmark](../media/yes-icon.png) **v3.1 (GA)** **Earlier versions:** ![blue-checkmark](../media/blue-yes-icon.png) [v3.0](?view=doc-intel-3.0.0&preserve-view=true) ![blue-checkmark](../media/blue-yes-icon.png) [v2.1](?view=doc-intel-2.1.0&preserve-view=true)
3029

3130
::: moniker range="doc-intel-3.1.0"
3231

32+
**This content applies to:** ![checkmark](../media/yes-icon.png) **v3.1 (GA)** **Earlier versions:** ![blue-checkmark](../media/blue-yes-icon.png) [v3.0](?view=doc-intel-3.0.0&preserve-view=true) ![blue-checkmark](../media/blue-yes-icon.png) [v2.1](?view=doc-intel-2.1.0&preserve-view=true)
3333

3434
* Get started with Azure AI Document Intelligence latest GA version (v3.1).
3535

Lines changed: 325 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,325 @@
1+
---
2+
title: Document Intelligence (formerly Form Recognizer) SDK target REST API v2.1 (GA)
3+
titleSuffix: Azure AI services
4+
description: Document Intelligence v2.1 (GA) software development kits (SDKs) expose Document Intelligence models, features and capabilities, using C#, Java, JavaScript, and Python programming language.
5+
author: laujan
6+
manager: nitinme
7+
ms.service: azure-ai-document-intelligence
8+
ms.custom:
9+
- devx-track-python
10+
- ignite-2023
11+
ms.topic: conceptual
12+
ms.date: 11/29/2023
13+
ms.author: lajanuar
14+
monikerRange: 'doc-intel-2.1.0'
15+
---
16+
17+
18+
<!-- markdownlint-disable MD024 -->
19+
<!-- markdownlint-disable MD036 -->
20+
<!-- markdownlint-disable MD001 -->
21+
<!-- markdownlint-disable MD051 -->
22+
23+
# SDK target: REST API v2.1 (GA)
24+
25+
![Document Intelligence checkmark](media/yes-icon.png) **REST API version v2.1 (GA) 21-06-08**
26+
27+
Azure AI Document Intelligence is a cloud service that uses machine learning to analyze text and structured data from documents. The Document Intelligence software development kit (SDK) is a set of libraries and tools that enable you to easily integrate Document Intelligence models and capabilities into your applications. Document Intelligence SDK is available across platforms in C#/.NET, Java, JavaScript, and Python programming languages.
28+
29+
## Supported programming languages
30+
31+
Document Intelligence SDK supports the following languages and platforms:
32+
33+
| Language → Document Intelligence SDK version | Package| Supported API version| Platform support |
34+
|:----------------------:|:----------|:----------| :----------------|
35+
| [.NET/C# → 3.1.x (GA)](/dotnet/api/azure.ai.formrecognizer?view=azure-dotnet&preserve-view=true)|[NuGet](https://www.nuget.org/packages/Azure.AI.FormRecognizer)|[v2.1](https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-1/operations/AnalyzeBusinessCardAsync)</br>[v2.0](https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2/operations/AnalyzeLayoutAsync) |[Windows, macOS, Linux, Docker](https://dotnet.microsoft.com/download)|
36+
|[Java → 3.1.x (GA)](https://azuresdkdocs.blob.core.windows.net/$web/java/azure-ai-formrecognizer/3.1.1/index.html) |[MVN repository](https://mvnrepository.com/artifact/com.azure/azure-ai-formrecognizer/3.1.1) |[v2.1](https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-1/operations/AnalyzeBusinessCardAsync)</br>[v2.0](https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2/operations/AnalyzeLayoutAsync) |[Windows, macOS, Linux](/java/openjdk/install)|
37+
|[JavaScript → 3.1.0 (GA)](https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-ai-form-recognizer/3.1.0/index.html)| [npm](https://www.npmjs.com/package/@azure/ai-form-recognizer/v/3.1.0)|[v2.1](https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-1/operations/AnalyzeBusinessCardAsync)</br>[v2.0](https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2/operations/AnalyzeLayoutAsync) | [Browser, Windows, macOS, Linux](https://nodejs.org/en/download/) |
38+
|[Python → 3.1.0 (GA)](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-formrecognizer/3.1.0/index.html) | [PyPI](https://pypi.org/project/azure-ai-formrecognizer/3.1.0/)|[v2.1](https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-1/operations/AnalyzeBusinessCardAsync)</br>[v2.0](https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2/operations/AnalyzeLayoutAsync) |[Windows, macOS, Linux](/azure/developer/python/configure-local-development-environment?tabs=windows%2Capt%2Ccmd#use-the-azure-cli)|
39+
40+
## Supported Clients
41+
42+
| Language| SDK version | API version | Supported clients|
43+
| :------ | :-----------|:---------- | :-----------------|
44+
|.NET/C#</br> Java</br> JavaScript</br>| 3.1.x | v2.1 (default)</br>v2.0 | **FormRecognizerClient**</br>**FormTrainingClient** |
45+
|.NET/C#</br> Java</br> JavaScript</br>| 3.0.x| v2.0 | **FormRecognizerClient**</br>**FormTrainingClient** |
46+
| Python | 3.1.x | v2.1 (default)</br>v2.0 |**FormRecognizerClient**</br>**FormTrainingClient** |
47+
| Python | 3.0.0 | v2.0 |**FormRecognizerClient**</br>**FormTrainingClient** |
48+
49+
## Use Document Intelligence SDK in your applications
50+
51+
The Document Intelligence SDK enables the use and management of the Document Intelligence service in your application. The SDK builds on the underlying Document Intelligence REST API allowing you to easily use those APIs within your programming language paradigm. Here's how you use the Document Intelligence SDK for your preferred language:
52+
53+
### 1. Install the SDK client library
54+
55+
### [C#/.NET](#tab/csharp)
56+
57+
```dotnetcli
58+
dotnet add package Azure.AI.FormRecognizer --version 3.1.0
59+
```
60+
61+
```powershell
62+
Install-Package Azure.AI.FormRecognizer -Version 3.1.0
63+
```
64+
65+
### [Java](#tab/java)
66+
67+
```xml
68+
<dependency>
69+
<groupId>com.azure</groupId>
70+
<artifactId>azure-ai-formrecognizer</artifactId>
71+
<version>3.1.0</version>
72+
</dependency>
73+
```
74+
75+
```kotlin
76+
implementation("com.azure:azure-ai-formrecognizer:3.1.0")
77+
```
78+
79+
### [JavaScript](#tab/javascript)
80+
81+
```javascript
82+
npm i @azure/ai-form-recognizer@3.1.0
83+
```
84+
85+
### [Python](#tab/python)
86+
87+
```python
88+
pip install azure-ai-formrecognizer==3.1.0
89+
```
90+
91+
---
92+
93+
### 2. Import the SDK client library into your application
94+
95+
### [C#/.NET](#tab/csharp)
96+
97+
```csharp
98+
using Azure;
99+
using Azure.AI.FormRecognizer.Models;
100+
```
101+
102+
### [Java](#tab/java)
103+
104+
```java
105+
import com.azure.ai.formrecognizer.*;
106+
import com.azure.ai.formrecognizer.models.*;
107+
108+
import com.azure.core.credential.AzureKeyCredential;
109+
```
110+
111+
### [JavaScript](#tab/javascript)
112+
113+
```javascript
114+
const { FormRecognizerClient, AzureKeyCredential } = require("@azure/ai-form-recognizer");
115+
```
116+
117+
### [Python](#tab/python)
118+
119+
```python
120+
from azure.ai.formrecognizer import FormRecognizerClient
121+
from azure.core.credentials import AzureKeyCredential
122+
```
123+
124+
---
125+
126+
### 3. Set up authentication
127+
128+
There are two supported methods for authentication
129+
130+
* Use a [Document Intelligence API key](#use-your-api-key) with AzureKeyCredential from azure.core.credentials.
131+
132+
* Use a [token credential from azure-identity](#use-an-azure-active-directory-azure-ad-token-credential) to authenticate with [Microsoft Entra ID](../../active-directory/fundamentals/active-directory-whatis.md).
133+
134+
#### Use your API key
135+
136+
Here's where to find your Document Intelligence API key in the Azure portal:
137+
138+
:::image type="content" source="media/containers/keys-and-endpoint.png" alt-text="Screenshot of the keys and endpoint location in the Azure portal.":::
139+
140+
### [C#/.NET](#tab/csharp)
141+
142+
```csharp
143+
144+
//set `<your-endpoint>` and `<your-key>` variables with the values from the Azure portal to create your `AzureKeyCredential` and `FormRecognizerClient` instance
145+
string key = "<your-key>";
146+
string endpoint = "<your-endpoint>";
147+
FormRecognizerClient client = new FormRecognizerClient(new Uri(endpoint), new AzureKeyCredential(key));
148+
```
149+
150+
### [Java](#tab/java)
151+
152+
```java
153+
154+
// create your `FormRecognizerClient` instance and `AzureKeyCredential` variable
155+
FormRecognizerClient formRecognizerClient = new FormRecognizerClientBuilder()
156+
.credential(new AzureKeyCredential("<your-key>"))
157+
.endpoint("<your-endpoint>")
158+
.buildClient();
159+
```
160+
161+
### [JavaScript](#tab/javascript)
162+
163+
```javascript
164+
165+
// create your `FormRecognizerClient` instance and `AzureKeyCredential` variable
166+
async function main() {
167+
const client = new FormRecognizerClient("<your-endpoint>", new AzureKeyCredential("<your-key>"));
168+
```
169+
170+
### [Python](#tab/python)
171+
172+
```python
173+
174+
# create your `FormRecognizerClient` instance and `AzureKeyCredential` variable
175+
form_recognizer_client = FormRecognizerClient(endpoint="<your-endpoint>", credential=AzureKeyCredential("<your-key>"))
176+
```
177+
178+
---
179+
180+
<a name='use-an-azure-active-directory-azure-ad-token-credential'></a>
181+
182+
#### Use a Microsoft Entra token credential
183+
184+
> [!NOTE]
185+
> Regional endpoints do not support Microsoft Entra authentication. Create a [custom subdomain](../../ai-services/authentication.md?tabs=powershell#create-a-resource-with-a-custom-subdomain) for your resource in order to use this type of authentication.
186+
187+
Authorization is easiest using the `DefaultAzureCredential`. It provides a default token credential, based upon the running environment, capable of handling most Azure authentication scenarios.
188+
189+
### [C#/.NET](#tab/csharp)
190+
191+
Here's how to acquire and use the [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet&preserve-view=true) for .NET applications:
192+
193+
1. Install the [Azure Identity library for .NET](/dotnet/api/overview/azure/identity-readme):
194+
195+
```console
196+
dotnet add package Azure.Identity
197+
```
198+
199+
```powershell
200+
Install-Package Azure.Identity
201+
```
202+
203+
1. [Register a Microsoft Entra application and create a new service principal](../../ai-services/authentication.md?tabs=powershell#assign-a-role-to-a-service-principal).
204+
205+
1. Grant access to Document Intelligence by assigning the **`Cognitive Services User`** role to your service principal.
206+
207+
1. Set the values of the client ID, tenant ID, and client secret in the Microsoft Entra application as environment variables: **`AZURE_CLIENT_ID`**, **`AZURE_TENANT_ID`**, and **`AZURE_CLIENT_SECRET`**, respectively.
208+
209+
1. Create your **`FormRecognizerClient`** instance including the **`DefaultAzureCredential`**:
210+
211+
```csharp
212+
string endpoint = "<your-endpoint>";
213+
var client = new FormRecognizerClient(new Uri(endpoint), new DefaultAzureCredential());
214+
```
215+
216+
For more information, *see* [Authenticate the client](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.FormRecognizer_4.0.0-beta.4/sdk/formrecognizer/Azure.AI.FormRecognizer#authenticate-the-client)
217+
218+
### [Java](#tab/java)
219+
220+
Here's how to acquire and use the [DefaultAzureCredential](/java/api/com.azure.identity.defaultazurecredential?view=azure-java-stable&preserve-view=true) for Java applications:
221+
222+
1. Install the [Azure Identity library for Java](/java/api/overview/azure/identity-readme?view=azure-java-stable&preserve-view=true):
223+
224+
```xml
225+
<dependency>
226+
<groupId>com.azure</groupId>
227+
<artifactId>azure-identity</artifactId>
228+
<version>1.5.3</version>
229+
</dependency>
230+
```
231+
232+
1. [Register a Microsoft Entra application and create a new service principal](../../ai-services/authentication.md?tabs=powershell#assign-a-role-to-a-service-principal).
233+
234+
1. Grant access to Document Intelligence by assigning the **`Cognitive Services User`** role to your service principal.
235+
236+
1. Set the values of the client ID, tenant ID, and client secret of the Microsoft Entra application as environment variables: **`AZURE_CLIENT_ID`**, **`AZURE_TENANT_ID`**, and **`AZURE_CLIENT_SECRET`**, respectively.
237+
238+
1. Create your **`FormRecognizerClient`** instance and **`TokenCredential`** variable:
239+
240+
```java
241+
TokenCredential credential = new DefaultAzureCredentialBuilder().build();
242+
FormRecognizerClient formRecognizerClient = new FormRecognizerClientBuilder()
243+
.endpoint("{your-endpoint}")
244+
.credential(credential)
245+
.buildClient();
246+
```
247+
248+
For more information, *see* [Authenticate the client](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/formrecognizer/azure-ai-formrecognizer#authenticate-the-client)
249+
250+
### [JavaScript](#tab/javascript)
251+
252+
Here's how to acquire and use the [DefaultAzureCredential](/javascript/api/@azure/identity/defaultazurecredential?view=azure-node-latest&preserve-view=true) for JavaScript applications:
253+
254+
1. Install the [Azure Identity library for JavaScript](/javascript/api/overview/azure/identity-readme?view=azure-node-latest&preserve-view=true):
255+
256+
```javascript
257+
npm install @azure/identity
258+
```
259+
260+
1. [Register a Microsoft Entra application and create a new service principal](../../ai-services/authentication.md?tabs=powershell#assign-a-role-to-a-service-principal).
261+
262+
1. Grant access to Document Intelligence by assigning the **`Cognitive Services User`** role to your service principal.
263+
264+
1. Set the values of the client ID, tenant ID, and client secret of the Microsoft Entra application as environment variables: **`AZURE_CLIENT_ID`**, **`AZURE_TENANT_ID`**, and **`AZURE_CLIENT_SECRET`**, respectively.
265+
266+
1. Create your **`FormRecognizerClient`** instance including the **`DefaultAzureCredential`**:
267+
268+
```javascript
269+
const { FormRecognizerClient } = require("@azure/ai-form-recognizer");
270+
const { DefaultAzureCredential } = require("@azure/identity");
271+
272+
const client = new FormRecognizerClient("<your-endpoint>", new DefaultAzureCredential());
273+
```
274+
275+
For more information, *see* [Create and authenticate a client](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/formrecognizer/ai-form-recognizer#create-and-authenticate-a-client).
276+
277+
### [Python](#tab/python)
278+
279+
Here's how to acquire and use the [DefaultAzureCredential](/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python&preserve-view=true) for Python applications.
280+
281+
1. Install the [Azure Identity library for Python](/python/api/overview/azure/identity-readme?view=azure-python&preserve-view=true):
282+
283+
```python
284+
pip install azure-identity
285+
```
286+
287+
1. [Register a Microsoft Entra application and create a new service principal](../../ai-services/authentication.md?tabs=powershell#assign-a-role-to-a-service-principal).
288+
289+
1. Grant access to Document Intelligence by assigning the **`Cognitive Services User`** role to your service principal.
290+
291+
1. Set the values of the client ID, tenant ID, and client secret of the Microsoft Entra application as environment variables: **`AZURE_CLIENT_ID`**, **`AZURE_TENANT_ID`**, and **`AZURE_CLIENT_SECRET`**, respectively.
292+
293+
1. Create your **`FormRecognizerClient`** instance including the **`DefaultAzureCredential`**:
294+
295+
```python
296+
from azure.identity import DefaultAzureCredential
297+
from azure.ai.formrecognizer import FormRecognizerClient
298+
299+
credential = DefaultAzureCredential()
300+
form_recognizer_client = FormRecognizerClient(
301+
endpoint="https://<my-custom-subdomain>.cognitiveservices.azure.com/",
302+
credential=credential
303+
)
304+
```
305+
306+
For more information, *see* [Authenticate the client](https://github.com/Azure/azure-sdk-for-python/tree/azure-ai-formrecognizer_3.2.0b5/sdk/formrecognizer/azure-ai-formrecognizer#authenticate-the-client)
307+
308+
---
309+
310+
311+
### 4. Build your application
312+
313+
Create a client object to interact with the Document Intelligence SDK, and then call methods on that client object to interact with the service. The SDKs provide both synchronous and asynchronous methods. For more insight, try a [quickstart](quickstarts/get-started-sdks-rest-api.md?view=doc-intel-3.0.0&preserve-view=true) in a language of your choice.
314+
315+
## Help options
316+
317+
The [Microsoft Q&A](/answers/topics/azure-form-recognizer.html) and [Stack Overflow](https://stackoverflow.com/questions/tagged/azure-form-recognizer) forums are available for the developer community to ask and answer questions about Azure AI Document Intelligence and other services. Microsoft monitors the forums and replies to questions that the community has yet to answer. To make sure that we see your question, tag it with **`azure-form-recognizer`**.
318+
319+
## Next steps
320+
321+
>[!div class="nextstepaction"]
322+
> [**Explore Document Intelligence REST API v2.1**](https://westus.dev.cognitive.microsoft.com/docs/services/form-recognizer-api-v2-1/operations/AnalyzeBusinessCardAsync)
323+
324+
> [!div class="nextstepaction"]
325+
> [**Try a Document Intelligence quickstart**](quickstarts/get-started-sdks-rest-api.md?view=doc-intel-2.1.0&preserve-view=true)

0 commit comments

Comments
 (0)