我正在使用 Azure AI 搜索,并希望在使用 AzureOpenAI 技能后将自定义技能的列表输出映射到索引元素。
例如我的自定义技能有一个输出,其中我将文本分块,如下所示
{
"values":
[
{ "recordId": "0",
"data": {
"identifier": [ [1,2], [1,2] ],
"text": ["Hello", "world"],
"pagenumber": [1,2]}
}
}
]
}
如何将数据中的值映射到索引的标量? 上面示例的输出应如下所示
{
{
"id: "0",
"identifier": [1,2],
"text": "Hello",
"embedding": [0.2, 0.3],
"pagenumber": 1
},
{
"id: "1",
"identifier": [1,2],
"text": "World",
"embedding": [0.3, 0.3],
"pagenumber": 2
}
}
我尝试了技能集中的indexProjections,但无法将列表映射到标量。
我尝试了技能集中的indexProjections,但无法将列表映射到标量。
在技能组定义中使用“outputFieldMappings”属性。这允许您将一项技能的输出转换为另一项技能期望的输入或直接转换为索引。
技能:
{
"name": "Test_set",
"description": "skillset_description",
"skills": [
{
"@odata.type": "#Microsoft.Skills.Text.AzureOpenTypeSkill",
"name": "your-azure-open-ai-skill",
"description": "Your AzureOpenAI Skill description",
"context": "/document",
"inputs": [
{
"name": "text",
"source": "/document/content"
}
],
"outputs": [
{
"name": "identifier",
"targetName": "identifier"
},
{
"name": "text",
"targetName": "text"
},
{
"name": "pagenumber",
"targetName": "pagenumber"
}
]
},
{
"@odata.type": "#Microsoft.Skills.Text.SentimentSkill",
"name": "your-sentiment-skill",
"description": "Your Sentiment Skill description",
"inputs": [
{
"name": "text",
"source": "/document/text"
}
],
"outputs": [
{
"name": "score",
"targetName": "sentimentScore"
}
]
}
],
"cognitiveServices": {
"@odata.type": "#Microsoft.Azure.Search.CognitiveServicesByKey",
"description": "Your cognitive services key",
"key": "your-cognitive-services-key"
},
"knowledgeStore": {
"storageConnectionString": "Your storage connection string",
"projections": [],
"tables": []
},
"skills": [],
"outputFieldMappings": [
{
"sourceFieldName": "/document/identifier",
"targetFieldName": "identifier"
},
{
"sourceFieldName": "/document/text",
"targetFieldName": "text"
},
{
"sourceFieldName": "/document/pagenumber",
"targetFieldName": "pagenumber"
}
]
}
在这里,我同时使用 AzureOpenAI 技能和情感分析技能。 outputFieldMappings 部分指定如何将技能的输出映射到索引中的字段。
通过我的示例技能集处理并索引到 Azure AI 搜索后的输出。
[
{
"id": "0",
"identifier": [1, 2],
"text": "Hello",
"pagenumber": 1,
"embedding": [0.2, 0.3]
},
{
"id": "1",
"identifier": [1, 2],
"text": "world",
"pagenumber": 2,
"embedding": [0.2, 0.3]
}
]
技能组定义: