Skip to content

Commit 84dd057

Browse files
committed
update code
1 parent 412e57e commit 84dd057

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

articles/ai-services/document-intelligence/quickstarts/includes/csharp-sdk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ Uri invoiceUri = new Uri ("https://raw.githubusercontent.com/Azure-Samples/cogni
648648

649649
AnalyzeDocumentContent content = new AnalyzeDocumentContent()
650650
{
651-
UrlSource= invoiceUri
651+
UrlSource = invoiceUri
652652
};
653653

654654
Operation<AnalyzeResult> operation = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-invoice", content);

articles/ai-services/document-intelligence/quickstarts/includes/java-sdk.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public class DocIntelligence {
284284

285285
public static void main(String[] args) {
286286

287-
// create your `DocumentAnalysisClient` instance and `AzureKeyCredential` variable
287+
// create your `DocumentIntelligenceClient` instance and `AzureKeyCredential` variable
288288
DocumentIntelligenceClient client = new DocumentIntelligenceClientBuilder()
289289
.credential(new AzureKeyCredential(key))
290290
.endpoint(endpoint)
@@ -665,24 +665,19 @@ public class DocIntelligence {
665665

666666
public static void main(String[] args) {
667667

668-
// create your `DocumentAnalysisClient` instance and `AzureKeyCredential` variable
669-
DocumentIntelligenceClient client = new DocumentIntelligenceClientBuilder()
670-
.credential(new AzureKeyCredential(key))
671-
.endpoint(endpoint)
672-
.buildClient();
673-
674668
// sample document
675669
String modelId = "prebuilt-invoice";
676670
String invoiceUrl = "https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-invoice.pdf";
677671

678672
public static void main(final String[] args) throws IOException {
673+
679674
// Instantiate a client that will be used to call the service.
680675
DocumentIntelligenceClient client = new DocumentIntelligenceClientBuilder()
681-
.credential(new AzureKeyCredential("{key}"))
682-
.endpoint("https://{endpoint}.cognitiveservices.azure.com/")
676+
.credential(new AzureKeyCredential(key))
677+
.endpoint(endpoint)
683678
.buildClient();
684679

685-
SyncPoller < AnalyzeResultOperation, AnalyzeResultOperation > analyzeLayoutPoller =
680+
SyncPoller<AnalyzeResultOperation, AnalyzeResultOperation > analyzeInvoicesPoller =
686681
client.beginAnalyzeDocument(modelId,
687682
null,
688683
null,

articles/ai-services/document-intelligence/quickstarts/includes/javascript-sdk.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ Extract text, selection marks, text styles, table structures, and bounding regio
146146
:::moniker range="doc-intel-4.0.0"
147147

148148
```javascript
149-
const { DocumentIntelligenceClient } = require("@azure-rest/ai-document-intelligence");
150-
const { AzureKeyCredential } = require("@azure/core-auth");
149+
const DocumentIntelligenceClient = require("@azure-rest/ai-document-intelligence");
151150

152151
// set `<your-key>` and `<your-endpoint>` variables with the values from the Azure portal.
153152
const key = "<your-key";
@@ -157,12 +156,12 @@ Extract text, selection marks, text styles, table structures, and bounding regio
157156
const formUrl = "https://raw.githubusercontent.com/Azure-Samples/cognitive-services-REST-api-samples/master/curl/form-recognizer/sample-layout.pdf"
158157

159158
async function main() {
160-
const client = DocumentIntelligenceClient(endpoint, new AzureKeyCredential(key));
159+
const client = DocumentIntelligenceClient(endpoint, {key:key},);
161160

162161

163162
const initialResponse = await client
164163
.path("/documentModels/{modelId}:analyze", "prebuilt-layout")
165-
.post: ({
164+
.post({
166165
contentType: "application/json",
167166
body: {
168167
urlSource: formUrl
@@ -310,8 +309,7 @@ In this example, we analyze an invoice using the **prebuilt-invoice** model.
310309

311310
```javascript
312311

313-
const { DocumentIntelligenceClient } = require("@azure-rest/ai-document-intelligence");
314-
const { AzureKeyCredential } = require("@azure/core-auth");
312+
const DocumentIntelligenceClient = require("@azure-rest/ai-document-intelligence");
315313

316314
// set `<your-key>` and `<your-endpoint>` variables with the values from the Azure portal.
317315
const key = "<your-key>";
@@ -322,7 +320,8 @@ const { AzureKeyCredential } = require("@azure/core-auth");
322320

323321
async function main() {
324322

325-
const client = DocumentIntelligenceClient(endpoint, new AzureKeyCredential(key));
323+
const client = DocumentIntelligenceClient(endpoint, {key: key},
324+
);
326325

327326
const initialResponse = await client
328327
.path("/documentModels/{modelId}:analyze", "prebuilt-invoice")

0 commit comments

Comments
 (0)