Search code examples
azure-functionsazure-cognitive-servicesazure-cognitive-search

Azure Cognitive Search Skillsets - Error w/ Azure FN Skill


Followed this repo https://github.com/Azure-Samples/azure-search-power-skills/tree/main/Vector/EmbeddingGenerator.

  1. Successfully deployed the Azure Fn. Can successfully use the TEST+CODE Fn Azure portal and use the FN. It's working.

  2. Per README. on the repo; I've added the following JSON to define this Vector Embedding API Fn as a SkillSet Skill for Azure Cognitive Services which I have running.

  3. When it hit SAVE on the UI in Cog Services w/ the JSON below; I get this error: 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'.

Can't find any reference to what I've done wrong. Custom APIs should be this type. Thoughts?

__

{ "@odata.type": "#Microsoft.Skills.Custom.WebApiSkill", "description": "Acronym linker", "uri": "https://**my_func_url_with_default_key_here**", "batchSize": 1, "context": "/document/content", "batchSize": 1, "context": "/document/content", "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" } ] }


Solution

  • You need to add the skill in context of a skillset resource, so within the skills array of the JSON object. So basically it should be like this:

    {
      "name": "**skillset name here**",
      "description": "",
      "skills": [
            {
        "@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
        "description": "Acronym linker",
        "uri": "https://**my_func_url_with_default_key_here**",
        "batchSize": 1,
        "context": "/document/content",
        "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"
            }
        ]
    }
        ],
      "cognitiveServices": {
        "@odata.type": "#Microsoft.Azure.Search.DefaultCognitiveServices"
      }
    }