Can't configure a regional API endpoint for AzureOpenAIEmbeddingSkill

114 Views Asked by At

I run into an issue while configuring the AzureOpenAIEmbeddingSkill in my indexers' skillset. Particularly, I can't seem to set the correct value for the "resourceUri" field.

All my search resources are deployed to France Central (azure ai search, cognitive accounts, azure openAI, and the deployed models). The deployed model I tried to use is called "ada-embedding".When I use https://.openai.azure.com as the value for resource URI, I can successfully POST the configuration via the Rest API. However, when the skill is executed, I get this error:

Access denied due to an invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource

I get the same error when I manually try to embed some text with this curl:

curl 'https://<my-openai-deployment-name>.openai.azure.com/openai/deployments/ada-embedding/embeddings?api-version=2023-05-15'\
  -H "Content-Type: application/json" \
  -H "api-key: 1c.....e" \
  -d '{"input": "Sample Document goes here"}'

I then tried to configure the regional API endpoint and tried to put "https://francecentral.api.cognitive.microsoft.com" as the resourceUri. Note: in this case, there's no subdomain. I cannot save this configuration, I immediately get the error message "Invalid resourceUri. Provide a valid resourceUri for the Azure Open AI service". I can, however, successfully create an embedding by manually calling this API endpoint:

curl 'https://francecentral.api.cognitive.microsoft.com/openai/deployments/ada-embedding/embeddings?api-version=2023-05-15'\
  -H "Content-Type: application/json" \
  -H "api-key: 1c....e" \
  -d '{"input": "Sample Document goes here"}'

This curl succeeds and returns an embedding. To me, this looks like an issue in the validation of the configuration API. If I try to configure the skillset via the Azure portal, I also get this error, even when picking the resources (openAI deployment, model) from the dropdowns in the wizard.

It seems that there's a simple check that the URI is a subdomain of 'openai.azure.com', as it will accept a value like "https://dasdasdasdfasdfasd.openai.azure.com".Is this a bug in the API validation or should I use ".openai.azure.com" here?

2

There are 2 best solutions below

6
JayashankarGS On

Although you can obtain embeddings from both endpoints (AzureOpenAi resource and regional) using curl, when configuring the skillset, you need to provide a valid resourceUri for the Azure Open AI service.

Check this for more information on Skill parameters.

Try regenerating your keys and running the skillset.

Enter image description here

Skillset definition.

    {
      "@odata.type": "#Microsoft.Skills.Text.AzureOpenAIEmbeddingSkill",
      "name": "embeding skill",
      "description": "",
      "context": "/document/content",
      "resourceUri": "https://jsopenai.openai.azure.com",
      "apiKey": "bbxxxxxxxxxxxxxxxxxxxxxxxxx",
      "deploymentId": "embeding1",
      "inputs": [
        {
          "name": "text",
          "source": "/document/content"
        }
      ],
      "outputs": [
        {
          "name": "embedding",
          "targetName": "embedding"
        }
      ],
      "authIdentity": null
    }
0
WiktorM On

Just use: https://francecentral.openai.azure.com.

It resolves to the same IP as https://francecentral.api.cognitive.microsoft.com and satisfies the resourceUri field validation.