"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.
2,635 questions
{count} votes