Azure AI Search는 Azure Blob Storage에 저장된 PDF 문서에서 텍스트와 이미지를 추출하고 인덱싱할 수 있습니다. 이 자습서에서는 문서 구조에 따라 데이터를 청크 하고 다중 모달 포함을 사용하여 동일한 문서의 텍스트 및 이미지를 벡터화하는 다중 모달 인덱싱 파이프라인을 빌드하는 방법을 보여 줍니다. 잘린 이미지는 지식 저장소에 저장되며 텍스트와 시각적 콘텐츠는 모두 검색 가능한 인덱스로 벡터화되고 수집됩니다. 청크는 문서 구조를 인식하는 Foundry Tools에서의 Azure 문서 인텔리전스 레이아웃 모델을 기반으로 합니다.
이 자습서에서는 다음을 사용합니다.
차트, 인포그래픽 및 스캔한 페이지와 같은 풍부한 시각적 콘텐츠를 기존 텍스트와 결합하는 36페이지 분량의 PDF 문서입니다.
기술을 통한 AI 보강을 포함하는 인덱싱 파이프라인을 만드는 인덱서 및 기술 세트입니다.
문서 레이아웃 기술은 페이지 번호나 경계 영역과 같은 다양한 문서에서
locationMetadata와 함께 텍스트 및 정규화된 이미지를 추출하는 기능을 제공합니다.Azure Vision 멀티모달 포함 기술은 텍스트와 이미지를 벡터화합니다.
추출된 텍스트 및 이미지 콘텐츠를 저장하도록 구성된 검색 인덱스입니다. 일부 콘텐츠는 벡터 기반 유사성 검색을 위해 벡터화됩니다.
Prerequisites
Microsoft Foundry 리소스. 이 리소스는 Azure Vision 멀티모달 포함 모델과 이 자습서의 기술에서 사용하는 Azure Document Intelligence 레이아웃 모델에 모두 액세스할 수 있도록 합니다. 이러한 리소스에 대한 기술 세트 액세스를 위해 Foundry 리소스를 사용해야 합니다.
Azure AI 검색. 역할 기반 액세스 제어 및 관리 ID에 대한 검색 서비스를 구성합니다. 서비스는 기본 계층 이상에 있어야 합니다. 이 자습서는 무료 계층에서 지원되지 않습니다.
샘플 데이터를 저장하고 지식 저장소를 만드는 데 사용되는 Azure Storage입니다.
Limitations
문서 레이아웃 기술에는 지역 가용성이 제한됩니다. Foundry 리소스를 만들 때 멀티모달 임베딩을 제공하는 리전을 선택합니다. 지원되는 지역 목록은 문서 레이아웃 기술 지원 지역을 참조하세요.
Azure Vision 멀티모달 포함 기술도 지역 가용성이 제한됩니다. 다중 모드 포함을 제공하는 업데이트된 지역 목록은 Azure Vision 설명서를 참조하세요.
데이터 준비
다음 지침은 샘플 데이터를 제공하고 지식 저장소를 호스트하는 Azure Storage에 적용됩니다. 검색 서비스 ID는 샘플 데이터를 검색하기 위해 Azure Storage에 대한 읽기 액세스 권한이 필요하며 지식 저장소를 만들려면 쓰기 액세스 권한이 필요합니다. 검색 서비스는 환경 변수에 제공한 이름을 사용하여 기술 세트 처리 중에 잘린 이미지에 대한 컨테이너를 만듭니다.
다음 샘플 PDF 다운로드: sustainable-ai-pdf
Azure Storage에서 sustainable-ai-pdf라는 새 컨테이너를 만듭니다.
샘플 데이터 파일을 업로드합니다.
역할 할당을 만들고 연결 문자열에서 관리 ID를 지정합니다.
데이터 검색을 위해 인덱서에 Storage Blob 데이터 리더 역할을 할당합니다. Storage Blob 데이터 기여자 및 스토리지 테이블 데이터 기여자를 할당하여 지식 저장소를 만들고 로드합니다. 검색 서비스 역할 할당에 시스템 할당 관리 ID 또는 사용자 할당 관리 ID를 사용할 수 있습니다.
시스템 할당 관리 ID를 사용하여 만든 연결의 경우 계정 키 또는 암호 없이 ResourceId가 포함된 연결 문자열을 가져옵니다. ResourceId에는 스토리지 계정의 구독 ID, 스토리지 계정의 리소스 그룹 및 스토리지 계정 이름이 포함되어야 합니다. 연결 문자열은 다음 예제와 유사합니다.
"credentials" : { "connectionString" : "ResourceId=/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MY-DEMO-RESOURCE-GROUP/providers/Microsoft.Storage/storageAccounts/MY-DEMO-STORAGE-ACCOUNT/;" }사용자 할당 관리 ID를 사용하여 만든 연결의 경우 계정 키 또는 암호 없이 ResourceId가 포함된 연결 문자열을 가져옵니다. ResourceId에는 스토리지 계정의 구독 ID, 스토리지 계정의 리소스 그룹 및 스토리지 계정 이름이 포함되어야 합니다. 다음 예제에 표시된 구문을 사용하여 ID를 제공합니다. userAssignedIdentity를 사용자가 할당한 관리 ID로 설정합니다. 연결 문자열은 다음 예제와 유사합니다.
"credentials" : { "connectionString" : "ResourceId=/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MY-DEMO-RESOURCE-GROUP/providers/Microsoft.Storage/storageAccounts/MY-DEMO-STORAGE-ACCOUNT/;" }, "identity" : { "@odata.type": "#Microsoft.Azure.Search.DataUserAssignedIdentity", "userAssignedIdentity" : "/subscriptions/00000000-0000-0000-0000-00000000/resourcegroups/MY-DEMO-RESOURCE-GROUP/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MY-DEMO-USER-MANAGED-IDENTITY" }
모델 준비
이 자습서에서는 스킬이 Azure Vision 4.0 멀티모달 포함 모델을 호출할 수 있는 이미 있는 Foundry 리소스를 가지고 있다고 가정합니다. 검색 서비스는 해당 관리 ID를 사용하여 기술 세트를 처리하는 동안 모델에 연결합니다. 이 섹션에서는 권한 있는 액세스에 대한 역할을 할당하기 위한 지침과 링크를 제공합니다.
Foundry 리소스를 통해 Azure Document Intelligence 레이아웃 모델에 액세스하는 데도 동일한 역할 할당이 사용됩니다.
Foundry 포털이 아닌 Azure Portal에 로그인하고 Foundry 리소스를 찾습니다. multimodal 4.0 API 및 Azure Document Intelligence 레이아웃 모델을 제공하는 지역에 있는지 확인합니다.
액세스 제어(IAM) 를 선택합니다.
추가를 선택한 다음 역할 할당 추가를 선택합니다.
Cognitive Services 사용자를 검색한 후 선택합니다.
관리 ID를 선택한 다음 검색 서비스 관리 ID를 할당합니다.
REST 파일 설정
이 자습서에서는 Azure AI Search에 대한 로컬 REST 클라이언트 연결에 엔드포인트 및 API 키가 필요합니다. Azure Portal에서 이러한 값을 가져올 수 있습니다. 대체 연결 방법은 검색 서비스에 연결을 참조하세요.
인덱서 및 기술 세트 처리 중에 발생하는 인증된 연결의 경우 검색 서비스는 이전에 정의한 역할 할당을 사용합니다.
Visual Studio Code를 시작하고 새 파일을 만듭니다.
요청에 사용되는 변수에 대한 값을 제공합니다. 연결
@storageConnection문자열에 후행 세미콜론 또는 따옴표가 없는지 확인합니다. 의 경우@imageProjectionContainerBlob Storage에서 고유한 컨테이너 이름을 제공합니다. Azure AI 검색은 기술 처리 중에 이 컨테이너를 만듭니다.@searchUrl = PUT-YOUR-SEARCH-SERVICE-ENDPOINT-HERE @searchApiKey = PUT-YOUR-ADMIN-API-KEY-HERE @storageConnection = PUT-YOUR-STORAGE-CONNECTION-STRING-HERE @cognitiveServicesUrl = PUT-YOUR-AZURE-AI-FOUNDARY-ENDPOINT-HERE @modelVersion = 2023-04-15 @imageProjectionContainer=sustainable-ai-pdf-images.rest또는.http파일 확장자를 사용하여 파일을 저장합니다. REST 클라이언트에 대한 도움말은 빠른 시작: REST를 사용한 전체 텍스트 검색을 참조하세요.
Azure AI Search 엔드포인트 및 API 키를 얻으려면 다음을 수행합니다.
Azure Portal에 로그인하고 검색 서비스 개요 페이지로 이동한 다음, URL을 복사합니다. 엔드포인트의 예는 다음과 같습니다.
https://mydemo.search.windows.net설정>키에서 관리자 키를 복사합니다. 관리자 키는 개체를 추가, 수정, 삭제하는 데 사용됩니다. 교환 가능한 관리자 키는 2개입니다. 둘 중 하나를 복사합니다.
데이터 원본 만들기
REST(데이터 원본 만들기)에 인덱싱할 데이터를 지정하는 데이터 원본 연결을 만듭니다.
### Create a data source using system-assigned managed identities
POST {{searchUrl}}/datasources?api-version=2025-11-01-preview HTTP/1.1
Content-Type: application/json
api-key: {{searchApiKey}}
{
"name": "doc-intelligence-multimodal-embedding-ds",
"description": "A data source to store multimodal documents",
"type": "azureblob",
"subtype": null,
"credentials":{
"connectionString":"{{storageConnection}}"
},
"container": {
"name": "sustainable-ai-pdf",
"query": null
},
"dataChangeDetectionPolicy": null,
"dataDeletionDetectionPolicy": null,
"encryptionKey": null,
"identity": null
}
요청을 보냅니다. 응답은 다음과 같아야 합니다.
HTTP/1.1 201 Created
Transfer-Encoding: chunked
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
Location: https://<YOUR-SEARCH-SERVICE-NAME>.search.windows-int.net:443/datasources('doc-extraction-multimodal-embedding-ds')?api-version=2025-11-01-preview -Preview
Server: Microsoft-IIS/10.0
Strict-Transport-Security: max-age=2592000, max-age=15724800; includeSubDomains
Preference-Applied: odata.include-annotations="*"
OData-Version: 4.0
request-id: 4eb8bcc3-27b5-44af-834e-295ed078e8ed
elapsed-time: 346
Date: Sat, 26 Apr 2025 21:25:24 GMT
Connection: close
{
"name": "doc-extraction-multimodal-embedding-ds",
"description": null,
"type": "azureblob",
"subtype": null,
"indexerPermissionOptions": [],
"credentials": {
"connectionString": null
},
"container": {
"name": "sustainable-ai-pdf",
"query": null
},
"dataChangeDetectionPolicy": null,
"dataDeletionDetectionPolicy": null,
"encryptionKey": null,
"identity": null
}
인덱스 만들기
인덱스 만들기(REST) 검색 서비스에 검색 인덱스가 만들어집니다. 인덱스는 모든 매개 변수 및 해당 특성을 지정합니다.
중첩된 JSON의 경우 인덱스 필드는 원본 필드와 동일해야 합니다. 현재 Azure AI Search는 중첩된 JSON에 대한 필드 매핑을 지원하지 않으므로 필드 이름과 데이터 형식이 완전히 일치해야 합니다. 다음 인덱스는 원시 콘텐츠의 JSON 요소에 맞춥니다.
### Create an index
POST {{searchUrl}}/indexes?api-version=2025-11-01-preview HTTP/1.1
Content-Type: application/json
api-key: {{searchApiKey}}
{
"name": "doc-intelligence-multimodal-embedding-index",
"fields": [
{
"name": "content_id",
"type": "Edm.String",
"retrievable": true,
"key": true,
"analyzer": "keyword"
},
{
"name": "text_document_id",
"type": "Edm.String",
"searchable": false,
"filterable": true,
"retrievable": true,
"stored": true,
"sortable": false,
"facetable": false
},
{
"name": "document_title",
"type": "Edm.String",
"searchable": true
},
{
"name": "image_document_id",
"type": "Edm.String",
"filterable": true,
"retrievable": true
},
{
"name": "content_text",
"type": "Edm.String",
"searchable": true,
"retrievable": true
},
{
"name": "content_embedding",
"type": "Collection(Edm.Single)",
"dimensions": 1024,
"searchable": true,
"retrievable": true,
"vectorSearchProfile": "hnsw"
},
{
"name": "content_path",
"type": "Edm.String",
"searchable": false,
"retrievable": true
},
{
"name": "offset",
"type": "Edm.String",
"searchable": false,
"retrievable": true
},
{
"name": "location_metadata",
"type": "Edm.ComplexType",
"fields": [
{
"name": "page_number",
"type": "Edm.Int32",
"searchable": false,
"retrievable": true
},
{
"name": "bounding_polygons",
"type": "Edm.String",
"searchable": false,
"retrievable": true,
"filterable": false,
"sortable": false,
"facetable": false
}
]
}
],
"vectorSearch": {
"profiles": [
{
"name": "hnsw",
"algorithm": "defaulthnsw",
"vectorizer": "demo-vectorizer"
}
],
"algorithms": [
{
"name": "defaulthnsw",
"kind": "hnsw",
"hnswParameters": {
"m": 4,
"efConstruction": 400,
"metric": "cosine"
}
}
],
"vectorizers": [
{
"name": "demo-vectorizer",
"kind": "aiServicesVision",
"aiServicesVisionParameters": {
"resourceUri": "{{cognitiveServicesUrl}}",
"authIdentity": null,
"modelVersion": "{{modelVersion}}"
}
}
]
},
"semantic": {
"defaultConfiguration": "semanticconfig",
"configurations": [
{
"name": "semanticconfig",
"prioritizedFields": {
"titleField": {
"fieldName": "document_title"
},
"prioritizedContentFields": [
],
"prioritizedKeywordsFields": []
}
}
]
}
}
주요 정보:
텍스트 및 이미지 포함은
content_embedding필드에 저장되며 1024와 같은 적절한 차원, 예를 들어 벡터 검색 프로필로 구성해야 합니다.location_metadata는 각 텍스트 청크 및 정규화된 이미지에 대한 경계 다각형 및 페이지 번호 메타데이터를 캡처하여 정확한 공간 검색 또는 UI 오버레이를 가능하게 합니다.벡터 검색에 대한 자세한 내용은 Azure AI Search의 벡터를 참조하세요.
의미 체계 순위에 대한 자세한 내용은 Azure AI Search의 의미 체계 순위를 참조하세요.
기술 역량을 개발하기
기술 세트 만들기(REST) 는 검색 서비스에 기술 세트를 만듭니다. 기술 세트는 인덱싱 전에 콘텐츠를 청크하고 포함하는 작업을 정의합니다. 이 기술 세트는 문서 레이아웃 기술을 사용하여 텍스트 및 이미지를 추출하고 RAG 애플리케이션의 인용에 유용한 위치 메타데이터를 유지합니다. Azure Vision 멀티모달 포함 기술을 사용하여 이미지 및 텍스트 콘텐츠를 벡터화합니다.
### Create a skillset
POST {{searchUrl}}/skillsets?api-version=2025-11-01-preview HTTP/1.1
Content-Type: application/json
api-key: {{searchApiKey}}
{
"name": "doc-intelligence-multimodal-embedding-skillset",
"description": "A sample skillset for multimodal using multimodal embedding",
"skills": [
{
"@odata.type": "#Microsoft.Skills.Util.DocumentIntelligenceLayoutSkill",
"name": "document-layout-skill",
"description": "Azure Document Intelligence skill for document cracking",
"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"
}
]
},
{
"@odata.type": "#Microsoft.Skills.Vision.VectorizeSkill",
"name": "text-embedding-skill",
"description": "Vision Vectorization skill for text",
"context": "/document/text_sections/*",
"modelVersion": "2023-04-15",
"inputs": [
{
"name": "text",
"source": "/document/text_sections/*/content"
}
],
"outputs": [
{
"name": "vector",
"targetName": "text_vector"
}
]
},
{
"@odata.type": "#Microsoft.Skills.Vision.VectorizeSkill",
"name": "image-embedding-skill",
"description": "Vision Vectorization skill for images",
"context": "/document/normalized_images/*",
"modelVersion": "2023-04-15",
"inputs": [
{
"name": "image",
"source": "/document/normalized_images/*"
}
],
"outputs": [
{
"name": "vector",
"targetName": "image_vector"
}
]
},
{
"@odata.type": "#Microsoft.Skills.Util.ShaperSkill",
"name": "shaper-skill",
"context": "/document/normalized_images/*",
"inputs": [
{
"name": "normalized_images",
"source": "/document/normalized_images/*",
"inputs": []
},
{
"name": "imagePath",
"source": "='my_container_name/'+$(/document/normalized_images/*/imagePath)",
"inputs": []
}
],
"outputs": [
{
"name": "output",
"targetName": "new_normalized_images"
}
]
}
],
"indexProjections": {
"selectors": [
{
"targetIndexName": "doc-intelligence-multimodal-embedding-index",
"parentKeyFieldName": "text_document_id",
"sourceContext": "/document/text_sections/*",
"mappings": [
{
"name": "content_embedding",
"source": "/document/text_sections/*/text_vector"
},
{
"name": "content_text",
"source": "/document/text_sections/*/content"
},
{
"name": "location_metadata",
"source": "/document/text_sections/*/locationMetadata"
},
{
"name": "document_title",
"source": "/document/document_title"
}
]
},
{
"targetIndexName": "{{index}}",
"parentKeyFieldName": "image_document_id",
"sourceContext": "/document/normalized_images/*",
"mappings": [
{
"name": "content_embedding",
"source": "/document/normalized_images/*/image_vector"
},
{
"name": "content_path",
"source": "/document/normalized_images/*/new_normalized_images/imagePath"
},
{
"name": "document_title",
"source": "/document/document_title"
},
{
"name": "location_metadata",
"source": "/document/normalized_images/*/locationMetadata"
}
]
}
],
"parameters": {
"projectionMode": "skipIndexingParentDocuments"
}
},
"cognitiveServices": {
"@odata.type": "#Microsoft.Azure.Search.AIServicesByIdentity",
"subdomainUrl": "{{cognitiveServicesUrl}}",
"identity": null
},
"knowledgeStore": {
"storageConnectionString": "",
"identity": null,
"projections": [
{
"files": [
{
"storageContainer": "{{imageProjectionContainer}}",
"source": "/document/normalized_images/*"
}
]
}
]
}
}
이 기술 세트는 텍스트와 이미지를 추출하고, 둘 다 벡터화하고, 인덱스에 프로젝션하기 위한 이미지 메타데이터를 셰이프합니다.
주요 정보:
필드
content_text가 문서 레이아웃 기술을 사용하여 추출되고 청크된 텍스트로 채워집니다.content_path에는 지정된 이미지 프로젝션 컨테이너 내의 이미지 파일에 대한 상대 경로가 포함됩니다. 이 필드는extractOption가["images", "locationMetadata"]또는["images"]로 설정될 때 문서에서 추출된 이미지에 대해서만 생성되며, 원본 필드/document/normalized_images/*/imagePath에서 보강된 문서로 매핑할 수 있습니다.Azure Vision 멀티모달 포함 기술을 사용하면 입력(텍스트 및 이미지)으로 구분된 동일한 기술 유형을 사용하여 텍스트 및 시각적 데이터를 모두 포함할 수 있습니다. 자세한 내용은 Azure Vision 다중 모달 포함 기술을 참조하세요.
인덱서 만들기 및 실행
인덱서 만들기 검색 서비스에 인덱서가 만들어집니다. 인덱서는 데이터 원본에 연결하고, 데이터를 로드하고, 기술 세트를 실행하고, 보강된 데이터를 인덱싱합니다.
### Create and run an indexer
POST {{searchUrl}}/indexers?api-version=2025-11-01-preview HTTP/1.1
Content-Type: application/json
api-key: {{searchApiKey}}
{
"dataSourceName": "doc-intelligence-multimodal-embedding-ds",
"targetIndexName": "doc-intelligence-multimodal-embedding-index",
"skillsetName": "doc-intelligence-multimodal-embedding-skillset",
"parameters": {
"maxFailedItems": -1,
"maxFailedItemsPerBatch": 0,
"batchSize": 1,
"configuration": {
"allowSkillsetToReadFileData": true
}
},
"fieldMappings": [
{
"sourceFieldName": "metadata_storage_name",
"targetFieldName": "document_title"
}
],
"outputFieldMappings": []
}
쿼리 실행
첫 번째 문서를 로드하는 즉시 검색을 시작할 수 있습니다.
### Query the index
POST {{searchUrl}}/indexes/doc-intelligence-multimodal-embedding-index/docs/search?api-version=2025-11-01-preview HTTP/1.1
Content-Type: application/json
api-key: {{searchApiKey}}
{
"search": "*",
"count": true
}
요청을 보냅니다. 인덱스에 검색 가능한 것으로 표시된 모든 필드와 문서 수를 반환하는 지정되지 않은 전체 텍스트 검색 쿼리입니다. 응답은 다음과 같아야 합니다.
{
"@odata.count": 100,
"@search.nextPageParameters": {
"search": "*",
"count": true,
"skip": 50
},
"value": [
],
"@odata.nextLink": "https://<YOUR-SEARCH-SERVICE-NAME>.search.windows.net/indexes/doc-intelligence-multimodal-embedding-index/docs/search?api-version=2025-11-01-preview "
}
100 문서가 응답에 반환됩니다.
필터의 경우 논리 연산자(및, 그렇지 않음) 및 비교 연산자(eq, ne, gt, lt, ge, le)를 사용할 수도 있습니다. 문자열 비교는 대/소문자를 구분합니다. 자세한 내용 및 예제는 간단한 검색 쿼리의 예를 참조하세요.
Note
매개 변수는 $filter 인덱스 생성 중에 필터링 가능한 것으로 표시된 필드에서만 작동합니다.
### Query for only images
POST {{searchUrl}}/indexes/doc-intelligence-multimodal-embedding-index/docs/search?api-version=2025-11-01-preview HTTP/1.1
Content-Type: application/json
api-key: {{searchApiKey}}
{
"search": "*",
"count": true,
"filter": "image_document_id ne null"
}
### Query for text or images with content related to energy, returning the id, parent document, and text (only populated for text chunks), and the content path where the image is saved in the knowledge store (only populated for images)
POST {{searchUrl}}/indexes/doc-intelligence-multimodal-embedding-index/docs/search?api-version=2025-11-01-preview HTTP/1.1
Content-Type: application/json
api-key: {{searchApiKey}}
{
"search": "energy",
"count": true,
"select": "content_id, document_title, content_text, content_path"
}
다시 설정하고 다시 실행
인덱서를 다시 설정하여 실행 기록을 지울 수 있으므로 전체 다시 실행할 수 있습니다. 다음 POST 요청은 다시 설정하고 다시 실행합니다.
### Reset the indexer
POST {{searchUrl}}/indexers/doc-intelligence-multimodal-embedding-indexer/reset?api-version=2025-11-01-preview HTTP/1.1
api-key: {{searchApiKey}}
### Run the indexer
POST {{searchUrl}}/indexers/doc-intelligence-multimodal-embedding-indexer/run?api-version=2025-11-01-preview HTTP/1.1
api-key: {{searchApiKey}}
### Check indexer status
GET {{searchUrl}}/indexers/doc-intelligence-multimodal-embedding-indexer/status?api-version=2025-11-01-preview HTTP/1.1
api-key: {{searchApiKey}}
자원을 정리하세요
사용자 고유의 구독에서 작업하는 경우 프로젝트의 끝에서 더 이상 필요하지 않은 리소스를 제거하는 것이 좋습니다. 리소스를 실행 상태로 남겨두면 비용이 발생할 수 있습니다. 리소스를 개별적으로 삭제하거나 리소스 그룹을 삭제하여 전체 리소스 세트를 삭제할 수 있습니다.
Azure Portal을 사용하여 인덱스, 인덱서 및 데이터 원본을 삭제할 수 있습니다.
참고하십시오
이제 다중 모드 인덱싱 시나리오의 샘플 구현에 익숙해졌으므로 다음을 확인하세요.