You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Abhishek Rawat (Jira)" <ji...@apache.org> on 2024/06/04 13:58:00 UTC

[jira] [Assigned] (IMPALA-13131) Azure OpenAI API expects 'api-key' instead of 'Authorization' in the request header

     [ https://issues.apache.org/jira/browse/IMPALA-13131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Abhishek Rawat reassigned IMPALA-13131:
---------------------------------------

    Assignee: Abhishek Rawat

> 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)

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