Abhishek Rawat created IMPALA-13131:
---------------------------------------

             Summary: Azure OpenAI API expects 'api-key' instead of 
'Authorization' in the request header
                 Key: IMPALA-13131
                 URL: https://issues.apache.org/jira/browse/IMPALA-13131
             Project: IMPALA
          Issue Type: Bug
            Reporter: Abhishek Rawat


As per the [API 
reference|https://learn.microsoft.com/en-us/azure/ai-services/openai/reference],
 the header expects API key as follows:

 
{code:java}
curl 
https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/completions?api-version=2024-02-01\
  -H "Content-Type: application/json" \
  -H "api-key: YOUR_API_KEY" \             <<<<<<< API Key
  -d "{
  \"prompt\": \"Once upon a time\",
  \"max_tokens\": 5
}" {code}
Impala supports API Key as follows:

 

 
{code:java}
curl 
https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/completions?api-version=2024-02-01\
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \   <<<<<<<< API Key
  -d "{
  \"prompt\": \"Once upon a time\",
  \"max_tokens\": 5
}"{code}
This causes ai functions calling Azure OpenAI endpoint to fail with 401 error:
{code:java}
{ "statusCode": 401, "message": "Unauthorized. Access token is missing, 
invalid, audience is incorrect (https://cognitiveservices.azure.com), or have 
expired." } {code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to