[
https://issues.apache.org/jira/browse/IMPALA-13131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Abhishek Rawat resolved IMPALA-13131.
-------------------------------------
Target Version: Impala 4.4.2
Resolution: Fixed
> 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
> Assignee: Abhishek Rawat
> Priority: Major
>
> 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)