Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build with Azure AI Search, Speech, OpenAI, and Document Intelligence services.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/sdk/azure-ai-document-intelligence-ts.md
1# Azure Document Intelligence — TypeScript SDK Quick Reference23> Condensed from **azure-ai-document-intelligence-ts**. Full patterns (custom models, classifiers, batch polling)4> in the **azure-ai-document-intelligence-ts** plugin skill if installed.56## Install7```bash8npm install @azure-rest/ai-document-intelligence @azure/identity9```1011## Quick Start1213> **Auth:** `DefaultAzureCredential` is for local development. See [auth-best-practices.md](../auth-best-practices.md) for production patterns.1415```typescript16import DocumentIntelligence, { isUnexpected, getLongRunningPoller, AnalyzeOperationOutput } from "@azure-rest/ai-document-intelligence";17const client = DocumentIntelligence(endpoint, new DefaultAzureCredential());18```1920## Non-Obvious Patterns21- REST client — `DocumentIntelligence` is a function, not a class22- Analyze path: `client.path("/documentModels/{modelId}:analyze", "prebuilt-layout").post({...})`23- Must use `getLongRunningPoller(client, initialResponse)` then `poller.pollUntilDone()`24- Local file: send as `base64Source` in body, not as binary stream25- Pagination: `import { paginate } from "@azure-rest/ai-document-intelligence"`2627## Best Practices281. Use `getLongRunningPoller()` — document analysis is async, always poll292. Check `isUnexpected()` — type guard for proper error handling303. Choose the right model — prebuilt when possible, custom for specialized docs314. Handle confidence scores — set thresholds for your use case325. Use `paginate()` helper for listing models336. Prefer neural mode for custom models over template34