Azure认知搜索技能集:Azure函数技能配置报错求助
问题分析与解决步骤
错误诱因排查
出现The request is invalid. Details: Incompatible type kinds were found. The type 'Microsoft.Skills.Custom.WebApiSkill' was found to be of kind 'Complex' instead of the expected kind 'Entity'.错误,主要有几个明确的问题点:
- 配置JSON存在重复键:你的配置里重复定义了
batchSize和context字段,JSON解析时的结构异常会触发类型校验错误。 - 上下文(context)设置不当:当前
context设为/document/content,指向的是文档的单个字符串字段,但自定义WebApiSkill通常需要作用于整个文档(/document),作用对象类型不匹配会引发类型校验问题。 - 输出字段的索引类型不匹配:如果搜索索引中
chunks字段被定义为Entity类型,但WebApiSkill返回的是复杂对象集合(Complex Type),就会出现类型不兼容错误。
修正后的配置示例
先清理重复字段,调整上下文,修正后的配置如下:
{ "@odata.type": "#Microsoft.Skills.Custom.WebApiSkill", "description": "生成向量嵌入的自定义技能", "uri": "https://**my_func_url_with_default_key_here**", "batchSize": 1, "context": "/document", "inputs": [ { "name": "document_id", "source": "/document/document_id" }, { "name": "text", "source": "/document/content" }, { "name": "filepath", "source": "/document/file_path" }, { "name": "fieldname", "source": "='content'" } ], "outputs": [ { "name": "chunks", "targetName": "chunks" } ] }
后续验证步骤
- 检查搜索索引中
chunks字段的定义,确保它是Collection(Edm.ComplexType)类型(适配技能返回的分块对象集合),而非Entity类型。 - 保存修正后的技能集配置,重新测试索引管道。
内容的提问来源于stack exchange,提问作者ExoV1
相关产品推荐
相关产品推荐

