Reputation: 1
File "/usr/local/lib/python3.11/site-packages/openai/_base_client.py", line 1510, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/openai/_base_client.py", line 1611, in _request raise self._make_status_error_from_response(err.response) from None openai.AuthenticationError: Error code: 401 - {'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}
followed the exact steps in documentation provided by the git repo for the upload feature.
commands which i followed :-
azd env set AZURE_USE_AUTHENTICATION true
python ./scripts/manageacl.py --acl-action enable_acls
azd env set AZURE_ENFORCE_ACCESS_CONTROL true
azd env set AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS true
azd env set AZURE_ENABLE_UNAUTHENTICATED_ACCESS true
azd env set AZURE_ENABLE_GLOBAL_DOCUMENT_ACCESS true
azd env set USE_USER_UPLOAD true
Upvotes: 0
Views: 97
Reputation: 14619
This part of the error is quite clear:
openai.AuthenticationError: Error code: 401 - {'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}
You are trying to call your Azure OpenAI request without authentication details. If you check the demo code (here) you will see that the behavior is the following:
AZURE_OPENAI_API_KEY_OVERRIDE
setting), it is using it for authenticationUpvotes: 1