OpenAI: error inference result
i'm trying to make an inference request with my prox. I.ex i deployed a model on azure openAI services and now want to test and communicate with it.
But i get the following error while trying to do a inference request:
Can someone maybe help me on what i'm doing wrong ? Its my first project using Azure OpenAI Service...
Inference result: {'error': 'Error communicating with OpenAI: HTTPSConnectionPool(host=\'agiopenai.openai.azure.com\', port=443): Max retries exceeded with url: //openai/deployments/%3Cai-for-proxy%3E/chat/completions?api-version=2023-05-15 (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f7010033ca0>: Failed to resolve \'agiopenai.openai.azure.com\' ([Errno -3] Temporary failure in name resolution)"))'}
{'_content': b'{"error":"Error communicating with OpenAI: HTTPSConnectionPool(h'
b"ost='agiopenai.openai.azure.com', port=443): Max retries exceede"
b'd with url: //openai/deployments/%3Cai-for-proxy%3E/chat/complet'
b'ions?api-version=2023-05-15 (Caused by NameResolutionError(\\'
b'"<urllib3.connection.HTTPSConnection object at 0x7f7010033ca0>: '
b"Failed to resolve 'agiopenai.openai.azure.com' ([Errno -3] Tempo"
b'rary failure in name resolution)\\"))"}\n',
I'm doing the following tutorial from gitHub and have allocated all the resources but however whenever I want to make a request to my proxy I get this error from OpenAi.
(Here's the link to the git tutorial: https://github.com/SAP-samples/azure-openai-aicore-cap-api/blob/main/01-ai-core-azure-openai-proxy/proxy.ipynb
and I'm currently executing the steps from the proxy.ipynb i.ex step 8 in the file.)
I double checked and I'm pretty sure I'm using the right endpoint as showed in the picture.
Here's the code (my goal is to do an inference request with my ai proxy)
endpoint = f"{deployment.deployment_url}/v2/envs"
headers = {"Authorization": ai_core_client.rest_client.get_token(),
"ai-resource-group": resource_group_id,
"Content-Type": "application/json"}
response = requests.get(endpoint, headers=headers)
legacy_davinci = False # set True if you have a davinci model deployment on Azure OpenAI Services
if legacy_davinci:
body = {
"engine": "<ai-for-proxy>", # The deployment name you chose when you deployed the ChatGPT or GPT-4 model.
# For information of deployment creation and name Refer article https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal
"prompt": "Classify the following news article into 1 of the following categories: categories: [Business, Tech, Politics, Sport, Entertainment]\n\nnews article: Donna Steffensen Is Cooking Up a New Kind of Perfection. The Internet’s most beloved cooking guru has a buzzy new book and a fresh new perspective:\n\nClassified category:",
"max_tokens": 60,
"temperature": 0,
"frequency_penalty": 0,
"presence_penalty": 0,
"top_p": 1,
"best_of": 1,
"stop": "null"
}
endpoint = f"{deployment.deployment_url}/v2/completion"
else:
body = {
"engine": "<ai-for-proxy>", # include your engine from a deployment of an Azure OpenAI services model
"prompt": "Classify the following news article into 1 of the following categories: categories: [Business, Tech, Politics, Sport, Entertainment]\n\nnews article: Donna Steffensen Is Cooking Up a New Kind of Perfection. The Internet’s most beloved cooking guru has a buzzy new book and a fresh new perspective:\n\nClassified category:",
"max_tokens": 60,
"temperature": 0,
"frequency_penalty": 0,
"presence_penalty": 0,
"stop": "null"
}
endpoint = f"{deployment.deployment_url}/v2/chat-completion"
headers = {"Authorization": ai_core_client.rest_client.get_token(),
"ai-resource-group": resource_group_id,
"Content-Type": "application/json"}
response = requests.post(endpoint, headers=headers, json=body)
print("Inference result:", response.json())
pprint(vars(response))
here's the error I still get: