[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-835f3c01-a34d-4b8d-b03d-ba998fc5c7c1":3,"$f-cQ_qLYt0lRdd0bSROnL6WVB5Pvl4s8bv2YbX80wL1s":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"835f3c01-a34d-4b8d-b03d-ba998fc5c7c1","azure-ai-contentunderstanding-py","Azure AI内容理解Python SDK。用于从文档、图像、音频和视频中提取多模态内容。","cat_coding_devops","mod_coding","sickn33,coding","---\nname: azure-ai-contentunderstanding-py\ndescription: Azure AI Content Understanding SDK for Python. Use for multimodal content extraction from documents, images, audio, and video.\nrisk: unknown\nsource: community\ndate_added: '2026-02-27'\n---\n\n# Azure AI Content Understanding SDK for Python\n\nMultimodal AI service that extracts semantic content from documents, video, audio, and image files for RAG and automated workflows.\n\n## Installation\n\n```bash\npip install azure-ai-contentunderstanding\n```\n\n## Environment Variables\n\n```bash\nCONTENTUNDERSTANDING_ENDPOINT=https:\u002F\u002F\u003Cresource>.cognitiveservices.azure.com\u002F\n```\n\n## Authentication\n\n```python\nimport os\nfrom azure.ai.contentunderstanding import ContentUnderstandingClient\nfrom azure.identity import DefaultAzureCredential\n\nendpoint = os.environ[\"CONTENTUNDERSTANDING_ENDPOINT\"]\ncredential = DefaultAzureCredential()\nclient = ContentUnderstandingClient(endpoint=endpoint, credential=credential)\n```\n\n## Core Workflow\n\nContent Understanding operations are asynchronous long-running operations:\n\n1. **Begin Analysis** — Start the analysis operation with `begin_analyze()` (returns a poller)\n2. **Poll for Results** — Poll until analysis completes (SDK handles this with `.result()`)\n3. **Process Results** — Extract structured results from `AnalyzeResult.contents`\n\n## Prebuilt Analyzers\n\n| Analyzer | Content Type | Purpose |\n|----------|--------------|---------|\n| `prebuilt-documentSearch` | Documents | Extract markdown for RAG applications |\n| `prebuilt-imageSearch` | Images | Extract content from images |\n| `prebuilt-audioSearch` | Audio | Transcribe audio with timing |\n| `prebuilt-videoSearch` | Video | Extract frames, transcripts, summaries |\n| `prebuilt-invoice` | Documents | Extract invoice fields |\n\n## Analyze Document\n\n```python\nimport os\nfrom azure.ai.contentunderstanding import ContentUnderstandingClient\nfrom azure.ai.contentunderstanding.models import AnalyzeInput\nfrom azure.identity import DefaultAzureCredential\n\nendpoint = os.environ[\"CONTENTUNDERSTANDING_ENDPOINT\"]\nclient = ContentUnderstandingClient(\n    endpoint=endpoint,\n    credential=DefaultAzureCredential()\n)\n\n# Analyze document from URL\npoller = client.begin_analyze(\n    analyzer_id=\"prebuilt-documentSearch\",\n    inputs=[AnalyzeInput(url=\"https:\u002F\u002Fexample.com\u002Fdocument.pdf\")]\n)\n\nresult = poller.result()\n\n# Access markdown content (contents is a list)\ncontent = result.contents[0]\nprint(content.markdown)\n```\n\n## Access Document Content Details\n\n```python\nfrom azure.ai.contentunderstanding.models import MediaContentKind, DocumentContent\n\ncontent = result.contents[0]\nif content.kind == MediaContentKind.DOCUMENT:\n    document_content: DocumentContent = content  # type: ignore\n    print(document_content.start_page_number)\n```\n\n## Analyze Image\n\n```python\nfrom azure.ai.contentunderstanding.models import AnalyzeInput\n\npoller = client.begin_analyze(\n    analyzer_id=\"prebuilt-imageSearch\",\n    inputs=[AnalyzeInput(url=\"https:\u002F\u002Fexample.com\u002Fimage.jpg\")]\n)\nresult = poller.result()\ncontent = result.contents[0]\nprint(content.markdown)\n```\n\n## Analyze Video\n\n```python\nfrom azure.ai.contentunderstanding.models import AnalyzeInput\n\npoller = client.begin_analyze(\n    analyzer_id=\"prebuilt-videoSearch\",\n    inputs=[AnalyzeInput(url=\"https:\u002F\u002Fexample.com\u002Fvideo.mp4\")]\n)\n\nresult = poller.result()\n\n# Access video content (AudioVisualContent)\ncontent = result.contents[0]\n\n# Get transcript phrases with timing\nfor phrase in content.transcript_phrases:\n    print(f\"[{phrase.start_time} - {phrase.end_time}]: {phrase.text}\")\n\n# Get key frames (for video)\nfor frame in content.key_frames:\n    print(f\"Frame at {frame.time}: {frame.description}\")\n```\n\n## Analyze Audio\n\n```python\nfrom azure.ai.contentunderstanding.models import AnalyzeInput\n\npoller = client.begin_analyze(\n    analyzer_id=\"prebuilt-audioSearch\",\n    inputs=[AnalyzeInput(url=\"https:\u002F\u002Fexample.com\u002Faudio.mp3\")]\n)\n\nresult = poller.result()\n\n# Access audio transcript\ncontent = result.contents[0]\nfor phrase in content.transcript_phrases:\n    print(f\"[{phrase.start_time}] {phrase.text}\")\n```\n\n## Custom Analyzers\n\nCreate custom analyzers with field schemas for specialized extraction:\n\n```python\n# Create custom analyzer\nanalyzer = client.create_analyzer(\n    analyzer_id=\"my-invoice-analyzer\",\n    analyzer={\n        \"description\": \"Custom invoice analyzer\",\n        \"base_analyzer_id\": \"prebuilt-documentSearch\",\n        \"field_schema\": {\n            \"fields\": {\n                \"vendor_name\": {\"type\": \"string\"},\n                \"invoice_total\": {\"type\": \"number\"},\n                \"line_items\": {\n                    \"type\": \"array\",\n                    \"items\": {\n                        \"type\": \"object\",\n                        \"properties\": {\n                            \"description\": {\"type\": \"string\"},\n                            \"amount\": {\"type\": \"number\"}\n                        }\n                    }\n                }\n            }\n        }\n    }\n)\n\n# Use custom analyzer\nfrom azure.ai.contentunderstanding.models import AnalyzeInput\n\npoller = client.begin_analyze(\n    analyzer_id=\"my-invoice-analyzer\",\n    inputs=[AnalyzeInput(url=\"https:\u002F\u002Fexample.com\u002Finvoice.pdf\")]\n)\n\nresult = poller.result()\n\n# Access extracted fields\nprint(result.fields[\"vendor_name\"])\nprint(result.fields[\"invoice_total\"])\n```\n\n## Analyzer Management\n\n```python\n# List all analyzers\nanalyzers = client.list_analyzers()\nfor analyzer in analyzers:\n    print(f\"{analyzer.analyzer_id}: {analyzer.description}\")\n\n# Get specific analyzer\nanalyzer = client.get_analyzer(\"prebuilt-documentSearch\")\n\n# Delete custom analyzer\nclient.delete_analyzer(\"my-custom-analyzer\")\n```\n\n## Async Client\n\n```python\nimport asyncio\nimport os\nfrom azure.ai.contentunderstanding.aio import ContentUnderstandingClient\nfrom azure.ai.contentunderstanding.models import AnalyzeInput\nfrom azure.identity.aio import DefaultAzureCredential\n\nasync def analyze_document():\n    endpoint = os.environ[\"CONTENTUNDERSTANDING_ENDPOINT\"]\n    credential = DefaultAzureCredential()\n    \n    async with ContentUnderstandingClient(\n        endpoint=endpoint,\n        credential=credential\n    ) as client:\n        poller = await client.begin_analyze(\n            analyzer_id=\"prebuilt-documentSearch\",\n            inputs=[AnalyzeInput(url=\"https:\u002F\u002Fexample.com\u002Fdoc.pdf\")]\n        )\n        result = await poller.result()\n        content = result.contents[0]\n        return content.markdown\n\nasyncio.run(analyze_document())\n```\n\n## Content Types\n\n| Class | For | Provides |\n|-------|-----|----------|\n| `DocumentContent` | PDF, images, Office docs | Pages, tables, figures, paragraphs |\n| `AudioVisualContent` | Audio, video files | Transcript phrases, timing, key frames |\n\nBoth derive from `MediaContent` which provides basic info and markdown representation.\n\n## Model Imports\n\n```python\nfrom azure.ai.contentunderstanding.models import (\n    AnalyzeInput,\n    AnalyzeResult,\n    MediaContentKind,\n    DocumentContent,\n    AudioVisualContent,\n)\n```\n\n## Client Types\n\n| Client | Purpose |\n|--------|---------|\n| `ContentUnderstandingClient` | Sync client for all operations |\n| `ContentUnderstandingClient` (aio) | Async client for all operations |\n\n## Best Practices\n\n1. **Use `begin_analyze` with `AnalyzeInput`** — this is the correct method signature\n2. **Access results via `result.contents[0]`** — results are returned as a list\n3. **Use prebuilt analyzers** for common scenarios (document\u002Fimage\u002Faudio\u002Fvideo search)\n4. **Create custom analyzers** only for domain-specific field extraction\n5. **Use async client** for high-throughput scenarios with `azure.identity.aio` credentials\n6. **Handle long-running operations** — video\u002Faudio analysis can take minutes\n7. **Use URL sources** when possible to avoid upload overhead\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,197,2045,"2026-05-16 13:05:10",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"DevOps","devops","mdi-cog-outline","CI\u002FCD、容器化、部署运维",3,162,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"c0e5df9b-96dc-4d2e-940d-2e827c24557c","1.0.0","azure-ai-contentunderstanding-py.zip",2568,"uploads\u002Fskills\u002F835f3c01-a34d-4b8d-b03d-ba998fc5c7c1\u002Fazure-ai-contentunderstanding-py.zip","e1fe184ec2364d567e710a6ea4b478fb75b685cae6b8d6212b7e5caedcb8c1da","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":8206}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]