or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

async-clients.mdclassifier-management.mddocument-analysis.mdindex.mdmodel-management.mdmodels-and-types.md

models-and-types.mddocs/

0

# Models and Type Definitions

1

2

Comprehensive data models, enums, and type definitions covering analysis results, document structures, configuration options, and service responses. The SDK provides 57 model classes and 19 enums offering complete type safety for all Document Intelligence operations.

3

4

## Core Imports

5

6

```python

7

from azure.ai.documentintelligence.models import (

8

# Analysis results

9

AnalyzeResult, AnalyzedDocument, DocumentField,

10

# Document structure

11

DocumentPage, DocumentTable, DocumentParagraph,

12

# Request types

13

AnalyzeDocumentRequest, BuildDocumentModelRequest,

14

# Enums

15

DocumentFieldType, DocumentAnalysisFeature, StringIndexType,

16

# All other model classes...

17

)

18

```

19

20

## Analysis Result Types

21

22

### Primary Analysis Results

23

24

```python { .api }

25

class AnalyzeResult:

26

"""Main container for document analysis results."""

27

api_version: Optional[str]

28

model_id: str

29

string_index_type: Optional[StringIndexType]

30

content: Optional[str]

31

pages: Optional[List[DocumentPage]]

32

paragraphs: Optional[List[DocumentParagraph]]

33

tables: Optional[List[DocumentTable]]

34

figures: Optional[List[DocumentFigure]]

35

sections: Optional[List[DocumentSection]]

36

key_value_pairs: Optional[List[DocumentKeyValuePair]]

37

styles: Optional[List[DocumentStyle]]

38

languages: Optional[List[DocumentLanguage]]

39

documents: Optional[List[AnalyzedDocument]]

40

warnings: Optional[List[DocumentIntelligenceWarning]]

41

42

class AnalyzedDocument:

43

"""Individual document analysis result with extracted fields."""

44

doc_type: str

45

bounding_regions: Optional[List[BoundingRegion]]

46

spans: List[DocumentSpan]

47

fields: Optional[Dict[str, DocumentField]]

48

confidence: Optional[float]

49

50

class DocumentField:

51

"""Field value with comprehensive type support."""

52

type: Optional[DocumentFieldType]

53

# String values

54

value_string: Optional[str]

55

content: Optional[str]

56

# Date and time values

57

value_date: Optional[date]

58

value_time: Optional[time]

59

# Numeric values

60

value_number: Optional[float]

61

value_integer: Optional[int]

62

value_currency: Optional[CurrencyValue]

63

# Contact information

64

value_phone_number: Optional[str]

65

value_address: Optional[AddressValue]

66

# Geographic and selection values

67

value_country_region: Optional[str]

68

value_selection_mark: Optional[DocumentSelectionMarkState]

69

value_signature: Optional[DocumentSignatureType]

70

value_boolean: Optional[bool]

71

value_selection_group: Optional[List[str]]

72

# Complex types

73

value_array: Optional[List[DocumentField]]

74

value_object: Optional[Dict[str, DocumentField]]

75

# Positioning information

76

bounding_regions: Optional[List[BoundingRegion]]

77

spans: Optional[List[DocumentSpan]]

78

confidence: Optional[float]

79

```

80

81

### Document Structure Types

82

83

```python { .api }

84

class DocumentPage:

85

"""Represents a single document page with all detected elements."""

86

page_number: int

87

angle: Optional[float]

88

width: Optional[float]

89

height: Optional[float]

90

unit: Optional[LengthUnit]

91

spans: List[DocumentSpan]

92

words: Optional[List[DocumentWord]]

93

selection_marks: Optional[List[DocumentSelectionMark]]

94

lines: Optional[List[DocumentLine]]

95

barcodes: Optional[List[DocumentBarcode]]

96

formulas: Optional[List[DocumentFormula]]

97

98

class DocumentTable:

99

"""Table structure with cells and metadata."""

100

row_count: int

101

column_count: int

102

cells: List[DocumentTableCell]

103

bounding_regions: Optional[List[BoundingRegion]]

104

spans: List[DocumentSpan]

105

caption: Optional[DocumentCaption]

106

footnotes: Optional[List[DocumentFootnote]]

107

108

class DocumentTableCell:

109

"""Individual table cell with positioning and content."""

110

kind: Optional[DocumentTableCellKind]

111

row_index: int

112

column_index: int

113

row_span: Optional[int]

114

column_span: Optional[int]

115

content: str

116

bounding_regions: Optional[List[BoundingRegion]]

117

spans: List[DocumentSpan]

118

elements: Optional[List[str]]

119

120

class DocumentParagraph:

121

"""Paragraph-level content with role classification."""

122

spans: List[DocumentSpan]

123

bounding_regions: Optional[List[BoundingRegion]]

124

role: Optional[ParagraphRole]

125

content: str

126

127

class DocumentLine:

128

"""Text line with content and positioning."""

129

content: str

130

polygon: Optional[List[float]]

131

spans: List[DocumentSpan]

132

133

class DocumentWord:

134

"""Individual word with confidence and positioning."""

135

content: str

136

polygon: Optional[List[float]]

137

confidence: Optional[float]

138

span: DocumentSpan

139

```

140

141

### Content Elements

142

143

```python { .api }

144

class DocumentKeyValuePair:

145

"""Key-value pair extraction result."""

146

key: DocumentKeyValueElement

147

value: Optional[DocumentKeyValueElement]

148

confidence: Optional[float]

149

150

class DocumentKeyValueElement:

151

"""Key or value element in a key-value pair."""

152

content: str

153

bounding_regions: Optional[List[BoundingRegion]]

154

spans: List[DocumentSpan]

155

156

class DocumentSelectionMark:

157

"""Selection mark (checkbox, radio button) detection."""

158

state: DocumentSelectionMarkState

159

polygon: Optional[List[float]]

160

confidence: Optional[float]

161

span: DocumentSpan

162

163

class DocumentBarcode:

164

"""Barcode detection result."""

165

kind: DocumentBarcodeKind

166

value: str

167

polygon: Optional[List[float]]

168

confidence: Optional[float]

169

span: DocumentSpan

170

171

class DocumentFormula:

172

"""Mathematical formula detection."""

173

kind: DocumentFormulaKind

174

value: str

175

polygon: Optional[List[float]]

176

confidence: Optional[float]

177

span: DocumentSpan

178

179

class DocumentFigure:

180

"""Figure or image detection within document."""

181

id: str

182

bounding_regions: List[BoundingRegion]

183

spans: List[DocumentSpan]

184

elements: Optional[List[str]]

185

caption: Optional[DocumentCaption]

186

footnotes: Optional[List[DocumentFootnote]]

187

188

class DocumentSection:

189

"""Document section with hierarchical structure."""

190

spans: List[DocumentSpan]

191

elements: Optional[List[str]]

192

193

class DocumentCaption:

194

"""Caption text associated with tables and figures."""

195

content: str

196

bounding_regions: Optional[List[BoundingRegion]]

197

spans: List[DocumentSpan]

198

elements: Optional[List[str]]

199

200

class DocumentFootnote:

201

"""Footnote content associated with tables and figures."""

202

content: str

203

bounding_regions: Optional[List[BoundingRegion]]

204

spans: List[DocumentSpan]

205

elements: Optional[List[str]]

206

207

```

208

209

### Positioning and Layout Types

210

211

```python { .api }

212

class BoundingRegion:

213

"""Geometric bounding region on a page."""

214

page_number: int

215

polygon: List[float]

216

217

class DocumentSpan:

218

"""Text span with offset and length."""

219

offset: int

220

length: int

221

222

class DocumentStyle:

223

"""Text styling information."""

224

is_handwritten: Optional[bool]

225

similar_font_family: Optional[str]

226

font_style: Optional[DocumentFontStyle]

227

font_weight: Optional[DocumentFontWeight]

228

color: Optional[str]

229

background_color: Optional[str]

230

spans: List[DocumentSpan]

231

confidence: Optional[float]

232

233

class DocumentLanguage:

234

"""Language detection result."""

235

locale: str

236

spans: List[DocumentSpan]

237

confidence: Optional[float]

238

```

239

240

### Value Types

241

242

```python { .api }

243

class AddressValue:

244

"""Structured address information."""

245

house_number: Optional[str]

246

po_box: Optional[str]

247

road: Optional[str]

248

city: Optional[str]

249

state: Optional[str]

250

postal_code: Optional[str]

251

country_region: Optional[str]

252

street_address: Optional[str]

253

unit: Optional[str]

254

city_district: Optional[str]

255

state_district: Optional[str]

256

suburb: Optional[str]

257

house: Optional[str]

258

level: Optional[str]

259

260

class CurrencyValue:

261

"""Currency amount with symbol and code."""

262

amount: float

263

currency_symbol: Optional[str]

264

currency_code: Optional[str]

265

```

266

267

## Model Management Types

268

269

### Model Details and Configuration

270

271

```python { .api }

272

class DocumentModelDetails:

273

"""Comprehensive model information."""

274

model_id: str

275

description: Optional[str]

276

created_date_time: datetime

277

expiration_date_time: Optional[datetime]

278

api_version: str

279

tags: Optional[Dict[str, str]]

280

build_mode: Optional[DocumentBuildMode]

281

azure_blob_source: Optional[AzureBlobContentSource]

282

azure_blob_file_list_source: Optional[AzureBlobFileListContentSource]

283

doc_types: Optional[Dict[str, DocumentTypeDetails]]

284

warnings: Optional[List[DocumentIntelligenceWarning]]

285

training_hours: Optional[int]

286

base_model_id: Optional[str]

287

288

class DocumentTypeDetails:

289

"""Document type configuration within a model."""

290

description: Optional[str]

291

build_mode: Optional[DocumentBuildMode]

292

field_schema: Optional[Dict[str, DocumentFieldSchema]]

293

field_confidence: Optional[Dict[str, float]]

294

295

class DocumentFieldSchema:

296

"""Schema definition for document fields."""

297

type: DocumentFieldType

298

description: Optional[str]

299

example: Optional[str]

300

items: Optional["DocumentFieldSchema"]

301

properties: Optional[Dict[str, "DocumentFieldSchema"]]

302

303

class ComponentDocumentModelDetails:

304

"""Component model reference for composition."""

305

model_id: str

306

```

307

308

### Classifier Types

309

310

```python { .api }

311

class DocumentClassifierDetails:

312

"""Document classifier information and configuration."""

313

classifier_id: str

314

description: Optional[str]

315

created_date_time: datetime

316

expiration_date_time: Optional[datetime]

317

api_version: str

318

base_classifier_id: Optional[str]

319

doc_types: Dict[str, ClassifierDocumentTypeDetails]

320

warnings: Optional[List[DocumentIntelligenceWarning]]

321

322

class ClassifierDocumentTypeDetails:

323

"""Document type configuration for classifier."""

324

azure_blob_source: Optional[AzureBlobContentSource]

325

azure_blob_file_list_source: Optional[AzureBlobFileListContentSource]

326

```

327

328

## Request Types

329

330

### Analysis Requests

331

332

```python { .api }

333

class AnalyzeDocumentRequest:

334

"""Request for single document analysis."""

335

url_source: Optional[str]

336

base64_source: Optional[str]

337

pages: Optional[str]

338

locale: Optional[str]

339

string_index_type: Optional[StringIndexType]

340

features: Optional[List[DocumentAnalysisFeature]]

341

query_fields: Optional[List[str]]

342

output_content_format: Optional[DocumentContentFormat]

343

output: Optional[List[AnalyzeOutputOption]]

344

345

class AnalyzeBatchDocumentsRequest:

346

"""Request for batch document processing."""

347

azure_blob_source: Optional[AzureBlobContentSource]

348

azure_blob_file_list_source: Optional[AzureBlobFileListContentSource]

349

result_container_url: str

350

result_prefix: Optional[str]

351

overwrite_existing: Optional[bool]

352

pages: Optional[str]

353

locale: Optional[str]

354

string_index_type: Optional[StringIndexType]

355

features: Optional[List[DocumentAnalysisFeature]]

356

query_fields: Optional[List[str]]

357

output_content_format: Optional[DocumentContentFormat]

358

output: Optional[List[AnalyzeOutputOption]]

359

360

class ClassifyDocumentRequest:

361

"""Request for document classification."""

362

url_source: Optional[str]

363

base64_source: Optional[str]

364

pages: Optional[str]

365

string_index_type: Optional[StringIndexType]

366

split_mode: Optional[SplitMode]

367

```

368

369

### Model Building Requests

370

371

```python { .api }

372

class BuildDocumentModelRequest:

373

"""Request to build custom document model."""

374

model_id: str

375

description: Optional[str]

376

build_mode: DocumentBuildMode

377

training_data_source: Union[AzureBlobContentSource, AzureBlobFileListContentSource]

378

test_data_source: Optional[Union[AzureBlobContentSource, AzureBlobFileListContentSource]]

379

tags: Optional[Dict[str, str]]

380

381

class ComposeDocumentModelRequest:

382

"""Request to compose multiple models."""

383

model_id: str

384

description: Optional[str]

385

component_models: List[ComponentDocumentModelDetails]

386

tags: Optional[Dict[str, str]]

387

388

class BuildDocumentClassifierRequest:

389

"""Request to build document classifier."""

390

classifier_id: str

391

description: Optional[str]

392

doc_types: Dict[str, ClassifierDocumentTypeDetails]

393

base_classifier_id: Optional[str]

394

```

395

396

### Copy Authorization Requests

397

398

```python { .api }

399

class AuthorizeCopyRequest:

400

"""Request to authorize model copying."""

401

model_id: str

402

description: Optional[str]

403

tags: Optional[Dict[str, str]]

404

405

class AuthorizeClassifierCopyRequest:

406

"""Request to authorize classifier copying."""

407

classifier_id: str

408

description: Optional[str]

409

tags: Optional[Dict[str, str]]

410

411

class ModelCopyAuthorization:

412

"""Model copy authorization token."""

413

target_resource_id: str

414

target_resource_region: str

415

target_model_id: str

416

target_model_location: str

417

access_token: str

418

expiration_date_time: datetime

419

420

class ClassifierCopyAuthorization:

421

"""Classifier copy authorization token."""

422

target_resource_id: str

423

target_resource_region: str

424

target_classifier_id: str

425

target_classifier_location: str

426

access_token: str

427

expiration_date_time: datetime

428

```

429

430

## Content Sources

431

432

```python { .api }

433

class AzureBlobContentSource:

434

"""Azure Blob Storage content source."""

435

container_url: str

436

prefix: Optional[str]

437

438

class AzureBlobFileListContentSource:

439

"""Azure Blob Storage file list source."""

440

container_url: str

441

file_list: str

442

```

443

444

## Operation and Service Types

445

446

### Operation Details

447

448

```python { .api }

449

class DocumentIntelligenceOperationDetails:

450

"""Base operation details with polymorphic support."""

451

operation_id: str

452

status: DocumentIntelligenceOperationStatus

453

percent_completed: Optional[int]

454

created_date_time: datetime

455

last_updated_date_time: datetime

456

kind: OperationKind

457

resource_location: str

458

api_version: Optional[str]

459

tags: Optional[Dict[str, str]]

460

error: Optional[DocumentIntelligenceError]

461

462

class DocumentModelBuildOperationDetails(DocumentIntelligenceOperationDetails):

463

"""Model build operation details."""

464

result: Optional[DocumentModelDetails]

465

466

class DocumentModelComposeOperationDetails(DocumentIntelligenceOperationDetails):

467

"""Model compose operation details."""

468

result: Optional[DocumentModelDetails]

469

470

class DocumentModelCopyToOperationDetails(DocumentIntelligenceOperationDetails):

471

"""Model copy operation details."""

472

result: Optional[DocumentModelDetails]

473

474

class DocumentClassifierBuildOperationDetails(DocumentIntelligenceOperationDetails):

475

"""Classifier build operation details."""

476

result: Optional[DocumentClassifierDetails]

477

478

class DocumentClassifierCopyToOperationDetails(DocumentIntelligenceOperationDetails):

479

"""Classifier copy operation details."""

480

result: Optional[DocumentClassifierDetails]

481

```

482

483

### Batch Operations

484

485

```python { .api }

486

class AnalyzeBatchResult:

487

"""Batch analysis summary results."""

488

succeeded_count: int

489

failed_count: int

490

skipped_count: int

491

details: List[AnalyzeBatchOperationDetail]

492

493

class AnalyzeBatchOperation:

494

"""Batch operation metadata and results."""

495

operation_id: str

496

status: DocumentIntelligenceOperationStatus

497

created_date_time: datetime

498

last_updated_date_time: datetime

499

percent_completed: Optional[int]

500

result: Optional[AnalyzeBatchResult]

501

error: Optional[DocumentIntelligenceError]

502

503

class AnalyzeBatchOperationDetail:

504

"""Individual document result within batch operation."""

505

status: DocumentIntelligenceOperationStatus

506

source_url: Optional[str]

507

result_url: Optional[str]

508

error: Optional[DocumentIntelligenceError]

509

```

510

511

### Service Information

512

513

```python { .api }

514

class DocumentIntelligenceResourceDetails:

515

"""Service resource information and limits."""

516

custom_document_models: CustomDocumentModelsDetails

517

custom_neural_document_model_builds: CustomDocumentModelsDetails

518

519

class CustomDocumentModelsDetails:

520

"""Model quota and usage information."""

521

count: int

522

limit: int

523

```

524

525

## Error Types

526

527

```python { .api }

528

class DocumentIntelligenceError:

529

"""Service error information."""

530

code: str

531

message: str

532

target: Optional[str]

533

details: Optional[List["DocumentIntelligenceError"]]

534

innererror: Optional[DocumentIntelligenceInnerError]

535

536

class DocumentIntelligenceErrorResponse:

537

"""Error response wrapper."""

538

error: DocumentIntelligenceError

539

540

class DocumentIntelligenceInnerError:

541

"""Detailed inner error information."""

542

code: Optional[str]

543

message: Optional[str]

544

innererror: Optional["DocumentIntelligenceInnerError"]

545

546

class DocumentIntelligenceWarning:

547

"""Service warning information."""

548

code: str

549

message: str

550

target: Optional[str]

551

```

552

553

## Comprehensive Enum Definitions

554

555

### Analysis Configuration Enums

556

557

```python { .api }

558

class DocumentAnalysisFeature(str, Enum):

559

"""Document analysis feature options."""

560

OCR_HIGH_RESOLUTION = "ocrHighResolution"

561

LANGUAGES = "languages"

562

BARCODES = "barcodes"

563

FORMULAS = "formulas"

564

KEY_VALUE_PAIRS = "keyValuePairs"

565

STYLE_FONT = "styleFont"

566

QUERY_FIELDS = "queryFields"

567

568

class AnalyzeOutputOption(str, Enum):

569

"""Additional output format options."""

570

PDF = "pdf"

571

FIGURES = "figures"

572

573

class DocumentContentFormat(str, Enum):

574

"""Content format options."""

575

TEXT = "text"

576

MARKDOWN = "markdown"

577

578

class StringIndexType(str, Enum):

579

"""Character indexing schemes."""

580

TEXT_ELEMENTS = "textElements"

581

UNICODE_CODE_POINT = "unicodeCodePoint"

582

UTF16_CODE_UNIT = "utf16CodeUnit"

583

```

584

585

### Content Type Enums

586

587

```python { .api }

588

class DocumentFieldType(str, Enum):

589

"""Document field value types."""

590

STRING = "string"

591

DATE = "date"

592

TIME = "time"

593

PHONE_NUMBER = "phoneNumber"

594

NUMBER = "number"

595

INTEGER = "integer"

596

SELECTION_MARK = "selectionMark"

597

COUNTRY_REGION = "countryRegion"

598

SIGNATURE = "signature"

599

ARRAY = "array"

600

OBJECT = "object"

601

CURRENCY = "currency"

602

ADDRESS = "address"

603

BOOLEAN = "boolean"

604

SELECTION_GROUP = "selectionGroup"

605

606

class DocumentBarcodeKind(str, Enum):

607

"""Barcode type classifications."""

608

QR_CODE = "QRCode"

609

PDF417 = "PDF417"

610

UPCA = "UPCA"

611

UPCE = "UPCE"

612

CODE39 = "Code39"

613

CODE128 = "Code128"

614

EAN8 = "EAN8"

615

EAN13 = "EAN13"

616

DATA_BAR = "DataBar"

617

CODE93 = "Code93"

618

CODABAR = "Codabar"

619

DATA_BAR_EXPANDED = "DataBarExpanded"

620

ITF = "ITF"

621

MICRO_QR_CODE = "MicroQRCode"

622

AZTEC = "Aztec"

623

DATA_MATRIX = "DataMatrix"

624

MAXI_CODE = "MaxiCode"

625

```

626

627

### Style and State Enums

628

629

```python { .api }

630

class DocumentFontStyle(str, Enum):

631

"""Font style classifications."""

632

NORMAL = "normal"

633

ITALIC = "italic"

634

635

class DocumentFontWeight(str, Enum):

636

"""Font weight classifications."""

637

NORMAL = "normal"

638

BOLD = "bold"

639

640

class DocumentSelectionMarkState(str, Enum):

641

"""Selection mark states."""

642

SELECTED = "selected"

643

UNSELECTED = "unselected"

644

645

class DocumentSignatureType(str, Enum):

646

"""Signature detection results."""

647

SIGNED = "signed"

648

UNSIGNED = "unsigned"

649

650

class DocumentTableCellKind(str, Enum):

651

"""Table cell type classifications."""

652

CONTENT = "content"

653

ROW_HEADER = "rowHeader"

654

COLUMN_HEADER = "columnHeader"

655

STUB_HEAD = "stubHead"

656

DESCRIPTION = "description"

657

```

658

659

### Operation and Processing Enums

660

661

```python { .api }

662

class DocumentIntelligenceOperationStatus(str, Enum):

663

"""Operation status values."""

664

NOT_STARTED = "notStarted"

665

RUNNING = "running"

666

FAILED = "failed"

667

SUCCEEDED = "succeeded"

668

CANCELED = "canceled"

669

SKIPPED = "skipped"

670

671

class DocumentBuildMode(str, Enum):

672

"""Model building approaches."""

673

TEMPLATE = "template"

674

NEURAL = "neural"

675

676

class OperationKind(str, Enum):

677

"""Operation type classifications."""

678

DOCUMENT_MODEL_BUILD = "documentModelBuild"

679

DOCUMENT_MODEL_COMPOSE = "documentModelCompose"

680

DOCUMENT_MODEL_COPY_TO = "documentModelCopyTo"

681

DOCUMENT_CLASSIFIER_COPY_TO = "documentClassifierCopyTo"

682

DOCUMENT_CLASSIFIER_BUILD = "documentClassifierBuild"

683

684

class ContentSourceKind(str, Enum):

685

"""Content source type classifications."""

686

URL = "url"

687

BASE64 = "base64"

688

AZURE_BLOB = "azureBlob"

689

AZURE_BLOB_FILE_LIST = "azureBlobFileList"

690

691

class SplitMode(str, Enum):

692

"""Document splitting behavior."""

693

AUTO = "auto"

694

NONE = "none"

695

PER_PAGE = "perPage"

696

```

697

698

### Layout and Content Enums

699

700

```python { .api }

701

class LengthUnit(str, Enum):

702

"""Measurement units for dimensions."""

703

PIXEL = "pixel"

704

INCH = "inch"

705

706

class ParagraphRole(str, Enum):

707

"""Paragraph role classifications."""

708

PAGE_HEADER = "pageHeader"

709

PAGE_FOOTER = "pageFooter"

710

PAGE_NUMBER = "pageNumber"

711

TITLE = "title"

712

SECTION_HEADING = "sectionHeading"

713

FOOTNOTE = "footnote"

714

FORMULA_BLOCK = "formulaBlock"

715

716

class DocumentFormulaKind(str, Enum):

717

"""Mathematical formula types."""

718

INLINE = "inline"

719

DISPLAY = "display"

720

```