CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-azure-ai-documentintelligence

tessl install tessl/pypi-azure-ai-documentintelligence@1.0.0

Azure 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%

task.mdevals/scenario-7/

Single Document Analyzer

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.

Capabilities

Analyze local files

  • Submitting a PDF path with a model identifier returns the document's plain text content plus extracted fields for CustomerName and TotalAmount when the model provides them. @test

Respect page scope and locale

  • When given a page range (for example "1-1") and a locale code, analysis is limited to those pages and the locale hint is forwarded so language-aware extraction is used. @test

Target specific fields

  • When query_fields is provided, only the requested field keys are returned, with missing values represented as None. @test

Markdown or text output

  • When output_format is "markdown", the returned summary includes markdown content; when "text", it includes plain text; other values raise a ValueError. @test

Implementation

@generates

API

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
    """

Dependencies { .dependencies }

azure-ai-documentintelligence { .dependency }

Provides the document analysis client used to submit single-document requests.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-ai-documentintelligence@1.0.x
tile.json