-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AI Model Inference Readme and Samples Issue #37045
Comments
Thank you @zimuli157 for opening this issue! I'm the owner of this SDK. Issue #2: I removed the white space in my current PR. Thanks! Issue #1: Please make sure your key is valid. Is this a Serverless API endpoint (aka MaaS)? Is this a chat completion model? Can you share your endpoint URL? If so, please try this simple cURL command to make sure your key is valid, before running the samples (replace the two environment variables with the endpoint and key you see in Azure AI Studio). Note that this is example is for API key authentication, not Entra ID authentication. Please follow up with me over IM to continue discussing this. Thanks!
|
@dargilco For Issue #1: We think there is a mistake in this command. When we replaced Authorization: Bearer %AZURE_AI_CHAT_KEY% with api-key: %AZURE_AI_CHAT_KEY%, the authentication was successful. The results are as follows. The complete command at this point is
|
@jerryshia Yes, if your model is an OpenAI model hosted on Azure OpenAI, you need the "api-key: " header. Please see new package docs here, showing how to create a ChatCompletionsClient for Azure OpenAI endpoint: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference#create-and-authenticate-a-client-directly-using-api-key-or-github-token There are also a few samples (with file names containing azure_openai) in the samples folder: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples |
@dargilco When I use the same endpoint as the endpoint URL to run the sample file, the above issue occurs. I believe the aforementioned issue also exists in the SDK, which can lead to similar errors. Please check the way requests are sent in the SDK's code. |
@v-xuto please provide full details about your issue, including source code and SDK logs from your failed run. To enable SDK logging, add this at the top of your code: import sys And add this additional input parameter to the constructor for ChatCompletionsClient: logging_enable=True Please make sure to remove any secrets when sharing here (api-key). |
@dargilco Here is the log when the run failed:
and the file run was sample_chat_completions.py. We found that when we added the parameter
|
Section link1, link2, link3, link4, link5, link6, link7, link8, link9, link10, link11, link12, link13, link14, link15, link16, link17, link18:
Reason:
Unauthorized. Access token is missing, invalid, audience is incorrect, or have expired.
Section link1
Reason:
Indent error.
Suggestion:
Remove whitespace.
@rohit-ganguly , @lmazuel , @achandmsft , @mayurid , @dargilco for notification.
The text was updated successfully, but these errors were encountered: