I am using AzureOpenAI Service, and I just encountered an issue openai.NotFoundError: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}}.
A quick Python example is attached here (need to first pip install openai and export the Azure-related environment variables).
import os
from openai import AzureOpenAI
AZURE_OPENAI_API_KEY = os.getenv("AZURE_OPENAI_API_KEY")
AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT")
client = AzureOpenAI(
api_version="2024-02-01",
api_key=AZURE_OPENAI_API_KEY,
azure_endpoint=AZURE_OPENAI_ENDPOINT,
)
_tmp_messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "How many 'r's in strawberry?"}
]
_tmp_completion = client.chat.completions.create(
model="gpt-4o-full",
max_tokens=8192,
messages=_tmp_messages,
)
print(_tmp_completion.choices[0].message.content)
Previously, this code worked well under my account. And I checked the billing there is no issue. I also tried out the AI Foundry (https://ms.portal.azure.com/#home), and it didn't work either, returning a similar error:
DeploymentNotFound: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again. | Apim-request-id: xxxxxxxx
Is there anyone who knows how to fix it? Thanks for your help!