注意
此功能目前處於公開預覽。 此預覽版在沒有服務等級協議的情況下提供,不建議用於生產工作負載。 可能不支援特定功能,或可能已經限制功能。 如需詳細資訊,請參閱 Microsoft Azure 預覽版增補使用條款。
檔版面配置技能會分析檔以偵測結構和特性,並以 Markdown 或 Text 格式產生檔的語法表示法。 您可以使用它來擷取文字和影像,其中影像擷取包含保留檔內影像位置的位置元數據。 相關內容的影像鄰近性會增加擷取擴增世代 (RAG) 工作負載和 多模式搜尋的價值。
本文是檔版面配置技能的參考檔。 如需使用方式資訊,請參閱 如何依檔版面配置進行區塊和向量化。
在具有結構和影像的 PDF 等內容上使用此技能很常見。 下列教學課程示範數個案例:
注意
此技能使用 Azure AI 檔智慧中所提供的文件智慧版面配置模型。
此技能會系結至每天超過每個索引器 20 份檔的 可計費 Azure AI 多服務資源 。 內建技能的執行會以現有的 Azure AI 服務標準價格收費。
限制
在公開預覽期間,此技能有下列限制:
- 技能不適用於 AI 檔智慧版面配置模型中需要超過 5 分鐘處理的大型檔。 技能逾時,但如果 AI 服務多服務資源附加至技能集以供計費之用,則費用仍會套用至 AI 服務多服務資源。 請確定檔已優化,以保持在處理限制內,以避免不必要的成本。
支援的區域
檔版面配置技能會呼叫 Document Intelligence 公開預覽版本 2024-07-31-preview。
支援的區域會因形式而異,以及技能如何連線到文件智慧版面配置模型。
方法 | 地區 | 要求 |
---|---|---|
匯入並向量化資料精靈 | 美國東部、 西歐、 美國中北部 | 在下列其中一個區域中建立 Azure AI 多服務資源,以取得入口網站體驗。 |
以程序設計方式,使用 無密鑰連線 (預覽) 計費 | 依資源而異 | 在下列其中一個區域中建立 Azure AI 搜尋: 美國東部、 西歐、 美國中北部、 美國西部 2。 透過依 區域數據表列出的 任何區域中的 Azure AI 多服務資源存取檔智慧。 |
以程序設計方式,使用 多服務資源 API 金鑰 進行計費 | 美國東部、 西歐、 美國中北部、 美國西部 2 | 在相同區域中建立 Azure AI 搜尋服務和 AI 多服務資源。 |
支援的檔案格式
此技能可辨識下列檔格式。
- 。PDF格式
- .JPEG
- .JPG
- .PNG
- .BMP
- .TIFF
- .DOCX
- .XLSX
- .PPTX
- HTML。
支援的語言
如需印刷文字,請參閱 Azure AI 檔智慧版面配置模型支援的語言。
支援的參數
有數個參數是版本特定的。 skills 參數數據表會指出引進參數的 API 版本,讓您知道如何設定技能。 若要在 2025-05-01-preview REST API 中使用映射和位置元數據擷取等版本特定功能,您可以使用 Azure 入口網站或目標 2025-05-01-preview,或檢查 Azure SDK 變更記錄檔,以查看其是否支援新的參數。
Azure 入口網站 支援大部分的預覽功能,可用來建立或更新技能集。 如需檔配置技能的更新,請編輯技能集 JSON 定義以新增預覽參數。
@odata.type
Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill
資料限制
- 若使用 PDF 和 TIFF,最多可處理 2,000 頁 (若使用免費層訂閱,則只會處理前兩頁)。
- 即使分析文件的檔案大小是 500 MB 的 Azure AI 檔智慧付費層 (S0) 層,而 Azure AI 檔智慧免費層為 4 MB,索引編製仍受限於搜尋服務層級的索引器限制。
- 影像尺寸必須介於 50 像素 x 50 像素或 10,000 像素 x 10,000 像素之間。
- 如果您的 PDF 已鎖定密碼,請在執行索引器之前先移除鎖定。
技能參數
這些參數會區分大小寫。
參數名稱 | 版本 | 允許的值 | 描述 |
---|---|---|---|
outputMode |
2024-11-01-預覽版 | oneToMany |
控制技能所產生的輸出基數。 |
markdownHeaderDepth |
2024-11-01-預覽版 |
h1 、、h2 h3 、h4 、、h5 、h6(default) |
只有在 設定為 outputFormat 時才markdown 適用。 此參數描述應該考慮的最深層巢狀層級。 例如,如果 markdownHeaderDepth 為 h3 ,則任何更深的 h4 區段都會擲入 h3 。 |
outputFormat |
2025-05-01-預覽版 |
markdown(default) 、text |
New。 控制技能所產生的輸出格式。 |
extractionOptions |
2025-05-01-預覽版 |
["images"] 、["images", "locationMetadata"] 、["locationMetadata"] |
New。 識別從檔擷取的任何額外內容。 定義列舉陣列,其對應至要包含在輸出中的內容。 例如,如果 extractionOptions 是 ["images", "locationMetadata"] ,則輸出會包含影像和位置元數據,以提供與擷取內容位置相關的頁面位置資訊,例如頁碼或區段。 此參數適用於這兩種輸出格式。 |
chunkingProperties |
2025-05-01-預覽版 | 請參閱下方。 |
New。 只有在 設定為 outputFormat 時才text 適用。 封裝如何在重新計算其他元數據時將文字內容區塊化的選項。 |
ChunkingProperties 參數 | 版本 | 允許的值 | 描述 |
---|---|---|---|
unit |
2025-05-01-預覽版 |
Characters 。 目前唯一允許的值。 區塊長度是以字元來測量,而不是單字或標記 |
New。 控制 chunk unit 的基數。 |
maximumLength |
2025-05-01-預覽版 | 介於 300-50000 之間的任何整數 | New。 以 String.Length 測量的字元最大區塊長度。 |
overlapLength |
2025-05-01-預覽版 | 整數。 值必須小於的一半 maximumLength |
New。 在兩個文本塊之間提供的重疊長度。 |
技能輸入
輸入名稱 | 描述 |
---|---|
file_data |
應該從中擷取內容的檔案。 |
“file_data” 輸入必須是定義為:
{
"$type": "file",
"data": "BASE64 encoded string of the file"
}
或者,它可以定義為:
{
"$type": "file",
"url": "URL to download file",
"sasToken": "OPTIONAL: SAS token for authentication if the URL provided is for a file in blob storage"
}
檔案參考物件可以透過下列其中一種方式產生:
將
allowSkillsetToReadFileData
索引器定義上的 參數設定為 true。 此設定會建立代表從 Blob 數據源下載之源文件資料的物件路徑/document/file_data
。 此參數僅適用於 Azure Blob 記憶體中的檔案。擁有傳回 JSON 物件定義的自訂技能,以提供
$type
、data
或url
和sastoken
。$type
參數必須設定為file
,而且data
必須是檔案內容的基底 64 編碼位元組陣列。 參數url
必須是具有存取權的有效 URL,才能在該位置下載檔案。
技能輸出
輸出名稱 | 描述 |
---|---|
markdown_document |
只有在 設定為 outputFormat 時才markdown 適用。 “sections” 物件的集合,代表 Markdown 檔中的每個個別區段。 |
text_sections |
只有在 設定為 outputFormat 時才text 適用。 文字區塊物件的集合,代表頁面界限內的文字(納入任何已設定的區塊化), 並包含 任何區段標頭本身。 如果適用,則文字區塊物件會包含 locationMetadata 。 |
normalized_images |
只有在 設定為 outputFormat 且text 包含 extractionOptions 時才images 適用。 從檔擷取的影像集合,包括 locationMetadata 如果適用的話。 |
Markdown 輸出模式的範例定義
{
"skills": [
{
"description": "Analyze a document",
"@odata.type": "#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill",
"context": "/document",
"outputMode": "oneToMany",
"markdownHeaderDepth": "h3",
"inputs": [
{
"name": "file_data",
"source": "/document/file_data"
}
],
"outputs": [
{
"name": "markdown_document",
"targetName": "markdown_document"
}
]
}
]
}
Markdown 輸出模式的範例輸出
{
"markdown_document": [
{
"content": "Hi this is Jim \r\nHi this is Joe",
"sections": {
"h1": "Foo",
"h2": "Bar",
"h3": ""
},
"ordinal_position": 0
},
{
"content": "Hi this is Lance",
"sections": {
"h1": "Foo",
"h2": "Bar",
"h3": "Boo"
},
"ordinal_position": 1,
}
]
}
的值 markdownHeaderDepth
會控制「區段」字典中的索引鍵數目。 在範例技能定義中,由於 markdownHeaderDepth
是 「h3」,因此 「sections」 字典中有三個索引鍵:h1、h2、h3。
文字輸出模式和影像和元數據擷取的範例
此範例示範如何使用 2025-05-01-preview 中引進的新參數,在固定大小的區塊中輸出文字內容,以及從檔擷取位置元數據。
文字輸出模式和影像和元數據擷取的範例定義
{
"skills": [
{
"description": "Analyze a document",
"@odata.type": "#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill",
"context": "/document",
"outputMode": "oneToMany",
"outputFormat": "text",
"extractionOptions": ["images", "locationMetadata"],
"chunkingProperties": {
"unit": "characters",
"maximumLength": 2000,
"overlapLength": 200
},
"inputs": [
{
"name": "file_data",
"source": "/document/file_data"
}
],
"outputs": [
{
"name": "text_sections",
"targetName": "text_sections"
},
{
"name": "normalized_images",
"targetName": "normalized_images"
}
]
}
]
}
文字輸出模式和影像和元數據擷取的範例輸出
{
"text_sections": [
{
"id": "1_7e6ef1f0-d2c0-479c-b11c-5d3c0fc88f56",
"content": "the effects of analyzers using Analyze Text (REST). For more information about analyzers, see Analyzers for text processing.During indexing, an indexer only checks field names and types. There's no validation step that ensures incoming content is correct for the corresponding search field in the index.Create an indexerWhen you're ready to create an indexer on a remote search service, you need a search client. A search client can be the Azure portal, a REST client, or code that instantiates an indexer client. We recommend the Azure portal or REST APIs for early development and proof-of-concept testing.Azure portal1. Sign in to the Azure portal 2, then find your search service.2. On the search service Overview page, choose from two options:· Import data wizard: The wizard is unique in that it creates all of the required elements. Other approaches require a predefined data source and index.All services > Azure Al services | Al Search >demo-search-svc Search serviceSearchAdd indexImport dataImport and vectorize dataOverviewActivity logEssentialsAccess control (IAM)Get startedPropertiesUsageMonitoring· Add indexer: A visual editor for specifying an indexer definition.",
"locationMetadata": {
"pageNumber": 1,
"ordinalPosition": 0,
"boundingPolygons": "[[{\"x\":1.5548,\"y\":0.4036},{\"x\":6.9691,\"y\":0.4033},{\"x\":6.9691,\"y\":0.8577},{\"x\":1.5548,\"y\":0.8581}],[{\"x\":1.181,\"y\":1.0627},{\"x\":7.1393,\"y\":1.0626},{\"x\":7.1393,\"y\":1.7363},{\"x\":1.181,\"y\":1.7365}],[{\"x\":1.1923,\"y\":2.1466},{\"x\":3.4585,\"y\":2.1496},{\"x\":3.4582,\"y\":2.4251},{\"x\":1.1919,\"y\":2.4221}],[{\"x\":1.1813,\"y\":2.6518},{\"x\":7.2464,\"y\":2.6375},{\"x\":7.2486,\"y\":3.5913},{\"x\":1.1835,\"y\":3.6056}],[{\"x\":1.3349,\"y\":3.9489},{\"x\":2.1237,\"y\":3.9508},{\"x\":2.1233,\"y\":4.1128},{\"x\":1.3346,\"y\":4.111}],[{\"x\":1.5705,\"y\":4.5322},{\"x\":5.801,\"y\":4.5326},{\"x\":5.801,\"y\":4.7311},{\"x\":1.5704,\"y\":4.7307}]]"
},
"sections": ["sectionHeading"]
},
{
"id": "2_25134f52-04c3-415a-ab3d-80729bd58e67",
"content": "All services > Azure Al services | Al Search >demo-search-svc | Indexers Search serviceSearch0«Add indexerRefreshDelete:selected: TagsFilter by name ...:selected: Diagnose and solve problemsSearch managementStatusNameIndexesIndexers*Data sourcesRun the indexerBy default, an indexer runs immediately when you create it on the search service. You can override this behavior by setting disabled to true in the indexer definition. Indexer execution is the moment of truth where you find out if there are problems with connections, field mappings, or skillset construction.There are several ways to run an indexer:· Run on indexer creation or update (default).. Run on demand when there are no changes to the definition, or precede with reset for full indexing. For more information, see Run or reset indexers.· Schedule indexer processing to invoke execution at regular intervals.Scheduled execution is usually implemented when you have a need for incremental indexing so that you can pick up the latest changes. As such, scheduling has a dependency on change detection.Indexers are one of the few subsystems that make overt outbound calls to other Azure resources. In terms of Azure roles, indexers don't have separate identities; a connection from the search engine to another Azure resource is made using the system or user- assigned managed identity of a search service. If the indexer connects to an Azure resource on a virtual network, you should create a shared private link for that connection. For more information about secure connections, see Security in Azure Al Search.Check results",
"locationMetadata": {
"pageNumber": 2,
"ordinalPosition": 1,
"boundingPolygons": "[[{\"x\":2.2041,\"y\":0.4109},{\"x\":4.3967,\"y\":0.4131},{\"x\":4.3966,\"y\":0.5505},{\"x\":2.204,\"y\":0.5482}],[{\"x\":2.5042,\"y\":0.6422},{\"x\":4.8539,\"y\":0.6506},{\"x\":4.8527,\"y\":0.993},{\"x\":2.5029,\"y\":0.9845}],[{\"x\":2.3705,\"y\":1.1496},{\"x\":2.6859,\"y\":1.15},{\"x\":2.6858,\"y\":1.2612},{\"x\":2.3704,\"y\":1.2608}],[{\"x\":3.7418,\"y\":1.1709},{\"x\":3.8082,\"y\":1.171},{\"x\":3.8081,\"y\":1.2508},{\"x\":3.7417,\"y\":1.2507}],[{\"x\":3.9692,\"y\":1.1445},{\"x\":4.0541,\"y\":1.1445},{\"x\":4.0542,\"y\":1.2621},{\"x\":3.9692,\"y\":1.2622}],[{\"x\":4.5326,\"y\":1.2263},{\"x\":5.1065,\"y\":1.229},{\"x\":5.106,\"y\":1.346},{\"x\":4.5321,\"y\":1.3433}],[{\"x\":5.5508,\"y\":1.2267},{\"x\":5.8992,\"y\":1.2268},{\"x\":5.8991,\"y\":1.3408},{\"x\":5.5508,\"y\":1.3408}]]"
},
"sections": ["sectionHeading", "title"]
}
],
"normalized_images": [
{
"id": "1_550e8400-e29b-41d4-a716-446655440000",
"data": "SGVsbG8sIFdvcmxkIQ==",
"imagePath": "aHR0cHM6Ly9henNyb2xsaW5nLmJsb2IuY29yZS53aW5kb3dzLm5ldC9tdWx0aW1vZGFsaXR5L0NyZWF0ZUluZGV4ZXJwNnA3LnBkZg2/normalized_images_0.jpg",
"locationMetadata": {
"pageNumber": 1,
"ordinalPosition": 0,
"boundingPolygons": "[[{\"x\":2.0834,\"y\":6.2245},{\"x\":7.1818,\"y\":6.2244},{\"x\":7.1816,\"y\":7.9375},{\"x\":2.0831,\"y\":7.9377}]]"
}
},
{
"id": "2_123e4567-e89b-12d3-a456-426614174000",
"data": "U29tZSBtb3JlIGV4YW1wbGUgdGV4dA==",
"imagePath": "aHR0cHM6Ly9henNyb2xsaW5nLmJsb2IuY29yZS53aW5kb3dzLm5ldC9tdWx0aW1vZGFsaXR5L0NyZWF0ZUluZGV4ZXJwNnA3LnBkZg2/normalized_images_1.jpg",
"locationMetadata": {
"pageNumber": 2,
"ordinalPosition": 1,
"boundingPolygons": "[[{\"x\":2.0784,\"y\":0.3734},{\"x\":7.1837,\"y\":0.3729},{\"x\":7.183,\"y\":2.8611},{\"x\":2.0775,\"y\":2.8615}]]"
}
}
]
}
技能會使用 Azure AI 檔智慧 來計算 locationMetadata。 如需如何定義頁面和周框多邊形座標的詳細資訊,請參閱 檔智慧版 面配置模型。
imagePath
表示預存影像的相對路徑。 如果在技能集中設定知識存放區檔案投影,此路徑會比對儲存在知識存放區中之影像的相對路徑。