Microsoft에서 관리하는 전 세계 데이터 센터 네트워크를 통해 애플리케이션과 서비스를 빌드, 배포, 관리하기 위한 클라우드 컴퓨팅 플랫폼 및 인프라입니다.
Azure AI Search의 SkillSet 을 통해 embedding 변환한 vector data를 index data 필드에 연계시 맵핑 오류 (데이타 타입 불일치)
AI Search 에서 data source 등록(blob storage) > skillset 설정(DocumentExtractionSkill > SplitSkill > WebApiSkill) > Azure function 구성 > AOAI(Ada model 구성) > indexes 설정 > indexer 설정을 통하여
blob storage 에 위치한 pdf 파일의 내용을 vector embedding 값으로 vector search test 하고자 합니다.
모든 설정을 완료하고 indexer reset, run 시 skillset 의 webapi 를 통해 Azure Function을 호출하고 Function에서 AOAI 호출하여 얻은 embedding 값을 Skillset 에서 받아 index의 data 필드와 Mapping 하는 시점에 하기와 같은 데이타 타입 불일치 오류가 발생하고 있습니다.
아시겠지만 index의 vector 데이타 필드는 Collection(Edm.Single) 로 설정해야만 합니다.
또한 AzureOpenAIVectorizerSkill Skill을 사용하여도 마찮가지 오류가 발생합니다.
이 에러를 해결할 수 있는 방법에 대해 가이드 받을 수 있을지요?
[오류 메시지]
The data field 'vectorContent/0' in the document with key 'aHR0cHM....' has an invalid value of type 'Collection(Edm.Double)' ('JSON arrays with element type 'Float' map to Collection(Edm.Double)'). The expected type was 'Collection(Edm.Single)'.
즉. Skillset 이 수신한 Vector Embedding 값의 데이타 타입은 Collection(Edm.Double) 이나 맵핑되어질 index Field의 데이타 타입은 Collection(Edm.Single) 이기 때문에 서로 데이타 타입이 맞지 않아 indexer runs 단계에서 오류가 발생한 상황입니다.
해당 문제 해결을 위해
Azure Function 단에서 AOAI의 ada model 로 부터 수신한 embedding 값을 float32 형식으로 하기와 같이 변환하여 해당 변환된 데이타를 json.dumps 로 skillset에 응답 전송하여도 동일한 오류가 지속 발생하고 있습니다.
# 상단 로직에서는 skillset 호출로 부터 받은 text를 aoai(ada 모델) 전달하여 embedding data(embeded_data)을 수신(to skillset)
emb = np.array(embeded_data, dtype=np.float32)
response_payload = {
"values": [
{
"recordId": body["values"][0]["recordId"],
"data": {
#"embedding": emb # tolist 처리를 하지 않으면 json.dumps 호출시 오류발생
"embedding": emb.tolist()
}
}
]
}
return func.HttpResponse(json.dumps(response_payload),
mimetype="application/json", status_code=200)
하기는 Skillset, index, indexer 설정 내역입니다.
[skillset]
{
"@odata.etag": "\"0x8DDBF890845B0FC\"",
"name": "pdf-skillset",
"skills": [
{
"@odata.type": "#Microsoft.Skills.Util.DocumentExtractionSkill",
"name": "docExtractor",
"description": "Extract text from PDF",
"context": "/document",
"parsingMode": "default",
"dataToExtract": "contentAndMetadata",
"inputs": [
{
"name": "file_data",
"source": "/document/file_data",
"inputs": []
}
],
"outputs": [
{
"name": "content",
"targetName": "extContent"
}
],
"configuration": {}
},
{
"@odata.type": "#Microsoft.Skills.Text.SplitSkill",
"name": "splitPages",
"context": "/document/extContent",
"defaultLanguageCode": "ko",
"textSplitMode": "pages",
"maximumPageLength": 4000,
"pageOverlapLength": 0,
"maximumPagesToTake": 0,
"unit": "characters",
"inputs": [
{
"name": "text",
"source": "/document/extContent",
"inputs": []
}
],
"outputs": [
{
"name": "textItems",
"targetName": "pages"
}
]
},
{
"@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
"name": "embedByFunction",
"description": "Generate float32 embeddings via Azure Function",
"context": "/document/extContent/pages/*",
"uri": "<my auzre function uri>",
"httpMethod": "POST",
"timeout": "PT30S",
"batchSize": 1,
"inputs": [
{
"name": "recordId",
"source": "/document/metadata_storage_path",
"inputs": []
},
{
"name": "text",
"source": "/document/extContent/pages/*",
"inputs": []
}
],
"outputs": [
{
"name": "embedding",
"targetName": "vectorContent"
}
],
"httpHeaders": {}
}
]
}
[indexes]
{
"@odata.etag": "\"0x8DDB9EE431EF320\"",
"name": "lsiindex01",
"fields": [
{
"name": "id",
"type": "Edm.String",
"searchable": false,
"filterable": false,
"retrievable": true,
"stored": true,
"sortable": false,
"facetable": false,
"key": true,
"synonymMaps": []
},
{
"name": "pageContent",
"type": "Edm.String",
"searchable": true,
"filterable": false,
"retrievable": true,
"stored": true,
"sortable": false,
"facetable": false,
"key": false,
"analyzer": "ko.lucene",
"synonymMaps": []
},
{
"name": "vectorContent",
"type": "Collection(Edm.Single)",
"searchable": true,
"filterable": false,
"retrievable": true,
"stored": true,
"sortable": false,
"facetable": false,
"key": false,
"dimensions": 1536,
"vectorSearchProfile": "vector-profile-1751518682587",
"synonymMaps": []
}
],
"scoringProfiles": [],
"suggesters": [],
"analyzers": [],
"normalizers": [],
"tokenizers": [],
"tokenFilters": [],
"charFilters": [],
"similarity": {
"@odata.type": "#Microsoft.Azure.Search.BM25Similarity"
},
"vectorSearch": {
"algorithms": [
{
"name": "vector-config-1751518686135",
"kind": "hnsw",
"hnswParameters": {
"metric": "cosine",
"m": 4,
"efConstruction": 400,
"efSearch": 500
}
}
],
"profiles": [
{
"name": "vector-profile-1751518682587",
"algorithm": "vector-config-1751518686135"
}
],
"vectorizers": [],
"compressions": []
}
}
[indexer]
{
"@odata.context": "https://lsi-aisearch-01.search.windows.net/$metadata#indexers/$entity",
"@odata.etag": "\"0x8DDBEB9EE335227\"",
"name": "indexer-1751518729265",
"description": null,
"dataSourceName": "azureblob-1751502489056-datasource",
"skillsetName": "pdf-skillset",
"targetIndexName": "lsiindex01",
"disabled": null,
"schedule": null,
"parameters": {
"batchSize": 100,
"maxFailedItems": -1,
"maxFailedItemsPerBatch": -1,
"configuration": {
"parsingMode": "default",
"allowSkillsetToReadFileData": true,
"dataToExtract": "contentAndMetadata"
}
},
"fieldMappings": [
{
"sourceFieldName": "metadata_storage_path",
"targetFieldName": "id",
"mappingFunction": {
"name": "base64Encode",
"parameters": null
}
}
],
"outputFieldMappings": [
{
"sourceFieldName": "/document/extContent/pages/*",
"targetFieldName": "pageContent",
"mappingFunction": null
},
{
"sourceFieldName": "/document/extContent/pages/*/vectorContent",
"targetFieldName": "vectorContent",
"mappingFunction": null
}
],
"cache": null,
"encryptionKey": null
}