Azure 雲端轉換

Document Intelligence 與 Content Understanding 兩條雲端路徑

內建 converter 全部在本機離線運作。需要更高品質(掃描 PDF、複雜表格、影片、結構化欄位)時, MarkItDown 提供兩條 Azure 雲端路徑。

兩者對照

能力內建 converterDocument IntelligenceContent Understanding
文件轉換離線、格式特定抽取雲端版面分析雲端多模態抽取
結構化欄位不支援此整合未暴露YAML front matter(analyzer 欄位)
自訂 analyzer不支援此整合不可設定cu_analyzer_id 支援
音訊 / 影片僅基本音訊、無影片不支援音訊 + 影片 analyzer
成本純本機Azure API 計費Azure API 計費

何時用 Content Understanding

Content Understanding 用法

pip install 'markitdown[az-content-understanding]'

# CLI
markitdown report.pdf --use-cu --cu-endpoint "<endpoint>"

# Python(零設定,自動依檔案類型選 analyzer)
from markitdown import MarkItDown
md = MarkItDown(cu_endpoint="<endpoint>")
print(md.convert("report.pdf").markdown)    # 文件 → prebuilt-documentSearch
print(md.convert("meeting.mp4").markdown)   # 影片 → prebuilt-videoSearch

# 自訂 analyzer(領域欄位抽取)
md = MarkItDown(cu_endpoint="<endpoint>", cu_analyzer_id="my-invoice-analyzer")
print(md.convert("invoice.pdf").markdown)
# 輸出含 YAML front matter:
# ---
# contentType: document
# fields:
#   VendorName: CONTOSO LTD.
#   InvoiceDate: '2019-11-15'
# ---
# <!-- page 1 -->

計費與範圍控制

計費注意:每個 convert() 呼叫,只要是 CU 路由的格式, 就是一筆可計費的 Azure API 呼叫。用 cu_file_types 限制哪些格式才走 CU:
from markitdown.converters import ContentUnderstandingFileType

md = MarkItDown(
    cu_endpoint="<endpoint>",
    cu_file_types=[ContentUnderstandingFileType.PDF],   # 只有 PDF 走 CU
)

Document Intelligence 用法

pip install 'markitdown[az-doc-intel]'

# CLI
markitdown file.pdf -o document.md -d -e "<document_intelligence_endpoint>"

# Python
md = MarkItDown(docintel_endpoint="<document_intelligence_endpoint>")
result = md.convert("test.pdf")
print(result.text_content)

本站說明

Azure 兩條路徑都需要雲端資源與計費,本站不實跑;以上內容為官方 README 的忠實翻譯與對照整理。 建立資源的指引見 Document IntelligenceContent Understanding 官方文件。