"Resource not found" with using Azure OpenAI in Python

Demo Beinf 0 Reputation points
2024-06-21T10:45:34.14+00:00

I have the problem with Azure OpenAI for using in Python.

This is my code:

def azure_ai_responder(self, prompt_template):

openai.api_key = "50***********************6"

openai.api_base = "https://b***f.openai.azure.com/"

openai.api_type = 'azure'

openai.api_version = '2024-05-13'

deployment_name = 'beinf-gpt-4o'

print('Sending a test completion job')

start_phrase = 'Write a tagline for an ice cream shop. '

response = openai.Completion.create(

    engine=deployment_name,

    prompt=start_phrase,

    max_tokens=5

)

return response['choices'][0]['message']['content']  

And I have the error:

openai.error.InvalidRequestError: Resource not found

I used openai version - 0.28.0

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,215 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Trymore Ncube 0 Reputation points
    2024-08-06T12:51:04.25+00:00

    User's image

    I am facing the same issue as well.I verified the Key and end point ,model name and version several times but it didnt help.May be i need to apply for access as i am using company subscription.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.