自定义Web API Skill输入参数名称

问题描述 投票:0回答:1

我正在尝试使用自定义 Web API 技能集从 Azure openAI 调用新的嵌入模型。我的 Json 是这样定义的:

{
  "name": "skillset-name",
  "description": "",
  "skills": [
    {
      "@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
      "name": "Text Embedding",
      "description": "",
      "context": "/document",
      "uri": "https://my_endpoint/openai/deployments/text-embedding-3-small/embeddings?api-version=2024-02-01&model=text-embedding-3-small&dimensions=512",
      "httpMethod": "POST",
      "timeout": "PT30S",
      "batchSize": 1000,
      "degreeOfParallelism": null,
      "inputs": [
        {
          "name": "input",
          "source": "/document/representacao_vetorial"
        }
      ],
      "outputs": [
        {
          "name": "embedding",
          "targetName": "vetor"
        }
      ],
      "httpHeaders": {
        "api-key": "api-key"
      },
      "authIdentity": null
    }
  ],
  "cognitiveServices": {
    "@odata.type": "#Microsoft.Azure.Search.DefaultCognitiveServices",
    "description": null
  },
  "knowledgeStore": null,
  "indexProjections": null,
  "encryptionKey": null
}

但是当索引器运行时,我收到此错误:

Web Api response status: 'BadRequest', Web Api response details: '{
  "error": {
    "message": "'input' is a required property",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}
'

我错过了什么?如何将“输入”参数传递给 API 调用?

azure-cognitive-search
1个回答
0
投票

确保发送到 Web API 的 JSON 负载包含 API 预期的

input
参数。错误消息
"'input' is a required property"
表示 Web API 需要负载中包含名为
input
的属性,但未正确提供。

  • 使用了 Azure AI 技能集中的自定义 Web API 技能搜索

 "inputs": [
        {
          "name": "text",
          "source": "/document/content"
        }
      ],

(或)

"inputs": [
        {
          "name": "text",
          "source": "/document/content"
        },
        {
          "name": "language",
          "source": "/document/languageCode"
        },
        {
          "name": "phraseList",
          "source": "/document/keyphrases"
        }
      ],

enter image description here

如果使用字段

/document/representacao_vetorial
存在于您的文档中,并且包含您打算作为
input
传递的正确数据。

{
  "values": [
    {
      "recordId": "0",
      "data": {
        "input": "This is the text to be embedded."
      }
    },
    {
      "recordId": "1",
      "data": {
        "input": "Another text to be processed."
      }
    }
    // Add more records as needed
  ]
}




文档在处理之前应该有一个索引

{
  "representacao_vetorial": "This is the text to be embedded."
}

索引器将提取

representacao_vetorial
的值并将其包含在发送到您的 Web API 的 JSON 负载的
input
字段中。

© www.soinside.com 2019 - 2024. All rights reserved.