CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-ai-documentintelligence

Azure AI Document Intelligence client library for Python - a cloud service that uses machine learning to analyze text and structured data from documents

76

1.18x
Overview
Eval results
Files

task.mdevals/scenario-3/

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.

Install with Tessl CLI

npx tessl i tessl/pypi-azure-ai-documentintelligence

tile.json