スキル一覧に戻る
samelhousseini

content-understanding

by samelhousseini

0🍴 0📅 2026年1月21日
GitHubで見るManusで実行

SKILL.md


name: content-understanding description: Process multimodal content (documents, images, audio, video) using Azure AI Content Understanding. Use when extracting structured data from invoices, receipts, IDs, analyzing media files, or building multimodal content pipelines.

Content Understanding Skill

Folder Contents

FileTypeDescription
SKILL.mdDocumentationMain skill documentation with API reference, quick start, and patterns
PRD.mdDocumentationProduct Requirements Document for the skill
.env.sampleConfigurationSample environment variables template
requirements.txtDependenciesPython package dependencies
scripts/
scripts/__init__.pyModulePackage initializer with exports
scripts/content_understanding_client.pyClientCore API client for Content Understanding service with analyze, poll, and create methods
scripts/invoice_analyzer.pyAnalyzerInvoice/receipt field extraction with structured output (vendor, totals, line items)
scripts/media_analyzer.pyAnalyzerAudio/video analysis with transcription and speaker identification
scripts/custom_analyzer.pyAnalyzerCreate and manage custom analyzers with extracted and AI-generated fields

Transform unstructured documents, images, audio, and video into structured, searchable data using Azure AI Content Understanding (GA November 2025, API version 2025-11-01).

Overview

Azure AI Content Understanding is a core component of Microsoft Foundry Tools that provides:

  • Multimodal Processing: Documents, images, audio, and video
  • 14 Prebuilt Analyzers: OCR, layout, invoices, receipts, IDs, audio/video search
  • Custom Analyzers: Domain-specific field extraction with AI-generated fields
  • RAG Integration: Optimized for search and retrieval scenarios

Supported Content Types

ModalityFormatsMax SizeMax Duration/Pages
DocumentsPDF, TIFF, DOCX, XLSX, PPTX, TXT, HTML, MD, EML200 MB300 pages
ImagesJPG, PNG, BMP, HEIF, HEIC200 MB10,000 x 10,000 px
AudioWAV, MP3, MP4, OPUS, OGG, FLAC, AAC1 GB4 hours
VideoMP4, M4V, FLV, WMV, AVI, MKV, MOV4 GB (URL)2 hours

Prebuilt Analyzers

Content Extraction

  • prebuilt-read - Basic OCR, words, paragraphs, barcodes
  • prebuilt-layout - Enhanced structure with tables, figures, annotations

RAG/Search Analyzers

  • prebuilt-documentSearch - Document ingestion with markdown output
  • prebuilt-imageSearch - Image description and visual content
  • prebuilt-audioSearch - Transcription with speaker labeling
  • prebuilt-videoSearch - Keyframes, chapters, transcripts

Domain-Specific Analyzers

  • prebuilt-invoice - Invoices, utility bills, purchase orders
  • prebuilt-receipt - Receipts with itemization
  • prebuilt-idDocument - Driver's licenses, passports, IDs
  • prebuilt-contract - Legal contracts
  • US tax forms (1040, 1099, W-2, etc.)
  • US mortgage documents

Quick Start

Environment Variables

AZURE_AI_ENDPOINT=https://your-foundry-name.services.ai.azure.com/
AZURE_AI_API_KEY=your-api-key-here
API_VERSION=2025-11-01

Basic Usage

from content_understanding_client import ContentUnderstandingClient

client = ContentUnderstandingClient()

# Analyze an invoice
result = client.analyze("prebuilt-invoice", "https://example.com/invoice.pdf")

# Extract fields
for content in result.get("result", {}).get("contents", []):
    fields = content.get("fields", {})
    print(f"Vendor: {fields.get('VendorName', {}).get('valueString', 'N/A')}")
    print(f"Total: {fields.get('InvoiceTotal', {}).get('valueNumber', 'N/A')}")

Building Block Scripts

ScriptDescription
content_understanding_client.pyCore client for Content Understanding API
invoice_analyzer.pyInvoice/receipt extraction with structured output
media_analyzer.pyAudio/video analysis with transcription
custom_analyzer.pyCreate and manage custom analyzers

Custom Analyzer Creation

Create domain-specific analyzers with extracted and AI-generated fields:

custom_definition = {
    "description": "Purchase order analyzer",
    "baseAnalyzerId": "prebuilt-document",
    "models": {
        "completion": "gpt-4.1",
        "embedding": "text-embedding-3-large"
    },
    "fieldSchema": {
        "fields": {
            "PONumber": {
                "type": "string",
                "method": "extract",
                "description": "Purchase order number"
            },
            "UrgencyLevel": {
                "type": "string",
                "method": "generate",  # AI-inferred field
                "description": "Inferred urgency: Low, Medium, High"
            }
        }
    }
}

client.create_analyzer("my-po-analyzer", custom_definition)

API Patterns

Analyze Content (Async)

# Start analysis
response = requests.post(
    f"{endpoint}/contentunderstanding/analyzers/{analyzer_id}:analyze",
    params={"api-version": "2025-11-01"},
    headers=headers,
    json={"inputs": [{"url": file_url}]}
)

# Poll for results
operation_location = response.headers.get("Operation-Location")
while True:
    result = requests.get(operation_location, headers=headers).json()
    if result["status"] in ["Succeeded", "Failed"]:
        break
    time.sleep(2)

Set Default Model Deployments

curl -X PATCH "${AZURE_AI_ENDPOINT}/contentunderstanding/defaults?api-version=2025-11-01" \
  -H "Ocp-Apim-Subscription-Key: ${AZURE_AI_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
        "modelDeployments": {
          "gpt-4.1": "gpt-4.1",
          "gpt-4.1-mini": "gpt-4.1-mini",
          "text-embedding-3-large": "text-embedding-3-large"
        }
      }'

Azure Resource Setup

Deploy via Azure CLI

# Create AI Foundry resource (required for Content Understanding)
az cognitiveservices account create \
  --name $FOUNDRY_NAME \
  --resource-group $RESOURCE_GROUP \
  --kind AIServices \
  --sku S0 \
  --location eastus \
  --yes

# Get endpoint and key
az cognitiveservices account show \
  --name $FOUNDRY_NAME \
  --resource-group $RESOURCE_GROUP \
  --query "properties.endpoint" -o tsv

az cognitiveservices account keys list \
  --name $FOUNDRY_NAME \
  --resource-group $RESOURCE_GROUP \
  --query "key1" -o tsv

Required Model Deployments

Deploy these models in Azure AI Foundry Portal:

  • gpt-4.1 - For invoice, receipt, document analyzers
  • gpt-4.1-mini - For search analyzers
  • text-embedding-3-large - For all analyzers

Pricing

ComponentPricing Model
Content ExtractionPer page (documents), per image, per minute (audio/video)
Field ExtractionToken-based (GPT-4o pricing)
ContextualizationPer content unit

Lessons Learned

API Response Structure

Results are returned in a nested structure:

result["result"]["contents"][0]["fields"]["FieldName"]["valueString"]

Polling Pattern

Always implement proper polling with status checks:

  • Succeeded - Results ready
  • Failed - Check error message
  • Other statuses - Keep polling

File Input Options

  • URL: Direct public URL or SAS-signed blob URL
  • Base64: For inline content (documents only)
  • Blob storage integration requires SAS token generation

スコア

総合スコア

45/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です