tessl install tessl/pypi-azure-ai-documentintelligence@1.0.0Azure AI Document Intelligence client library for Python - a cloud service that uses machine learning to analyze text and structured data from documents
Agent Success
Agent success rate when using this tile
76%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.19x
Baseline
Agent success rate without this tile
64%
Build a helper that submits a single document to a document analysis service using a specified model and returns a concise summary of the extracted content and fields.
CustomerName and TotalAmount when the model provides them. @test"1-1") and a locale code, analysis is limited to those pages and the locale hint is forwarded so language-aware extraction is used. @testquery_fields is provided, only the requested field keys are returned, with missing values represented as None. @testoutput_format is "markdown", the returned summary includes markdown content; when "text", it includes plain text; other values raise a ValueError. @test@generates
from typing import Iterable, Optional, Dict, Any
def analyze_document(
file_path: str,
*,
model_id: str,
pages: Optional[str] = None,
locale: Optional[str] = None,
query_fields: Optional[Iterable[str]] = None,
output_format: str = "text"
) -> Dict[str, Any]:
"""
Analyze a single document and return extracted content and fields.
Returns a dictionary with:
- "content": the document text in the requested format
- "fields": a mapping from requested field names to extracted strings or None
"""Provides the document analysis client used to submit single-document requests.