Can't consume the Azure OpenAI API

I seem unable to consume my Azure OpenAI API.
I’m getting the following error message:

“openai.error.InvalidRequestError: Must provide an ‘engine’ or ‘deployment_id’ parameter to create a <class ‘openai.api_resources.chat_completion.ChatCompletion’>”

The code snippet:

import openai
import os
import load_dotenv

'''
AZURE_OPENAI_RESOURCE = 'AI_Sandbox'
AZURE_OPENAI_MODEL = 'gpt-3.5-turbo'
AZURE_OPENAI_KEY = ''
AZURE_OPENAI_ENDPOINT = 'https://{resource}.openai.azure.com/'
AZURE_OPENAI_MODEL_NAME = 'gpt-35-turbo'
AZURE_DEPLOYMENT_NAME = 'GPT-35-TURBO'
'''

# AOAI Integration Settings
AZURE_OPENAI_RESOURCE = os.environ.get("AZURE_OPENAI_RESOURCE")
AZURE_OPENAI_MODEL = os.environ.get("AZURE_OPENAI_MODEL")
AZURE_OPENAI_MODEL_NAME = os.environ.get("AZURE_OPENAI_MODEL_NAME")
AZURE_OPENAI_ENDPOINT = os.environ.get("AZURE_OPENAI_ENDPOINT")
AZURE_OPENAI_KEY = os.environ.get("AZURE_OPENAI_KEY")
AZURE_DEPLOYMENT_NAME = os.environ.get("AZURE_DEPLOYMENT_NAME")

base_url = AZURE_OPENAI_ENDPOINT if AZURE_OPENAI_ENDPOINT else f"https://{AZURE_OPENAI_RESOURCE}.openai.azure.com/"
        
class OpenAIService:
    def __init__(self):
        openai.api_key = AZURE_OPENAI_KEY
        openai.api_type = "azure"
        openai.api_base = base_url
        openai.api_version = "2023-03-15-preview"

    def list_models(self):
        return openai.Model.list()

    def prompt(self, prompt):
        return openai.ChatCompletion.create(
            engine=AZURE_OPENAI_MODEL_NAME,
            deployment_id=AZURE_DEPLOYMENT_NAME,
            messages=[{"role": "user", "content": prompt}],
            temperature=0,
            timeout=60,
        )

Are you trying to use that as-is? You need to get your deployment model name from Azure.

Also the sign that this is some AI-produced nonsense is the engine= line. After reading the above link, you can look at the other linked examples of the parameters the ChatCompletion endpoint accepts.
Other documents are closely linked of

Thanks for replying!

I deployed the model (viz. the ‘AZURE_DEPLOYMENT_NAME’).