Azure OpenAI ChatGPT: The Ultimate AI-Powered Conversational Chatbot Solution. A Beginner Guide.

Alexandre t'Kint
4 min readMar 15, 2023

--

Are you looking for an AI-powered conversational chatbot to enhance your customer support or provide automated assistance to your users? Look no further than Azure OpenAI ChatGPT.

Azure OpenAI ChatGPT is a language model developed by OpenAI, which uses cutting-edge natural language processing (NLP) techniques to generate human-like responses to user inputs. Azure OpenAI has very strict Data Usage Policies which makes it safe to use and avoid red cheeks with your Legal and Security departments.

In this blog, I’ll go over what is needed to get you started on the gpt-35-turbo model. Note that this model is only available in East US and South Central US. Let’s get started! 🤗

Here are the steps to get started with Azure OpenAI ChatGPT. We’ll go over two major steps (I) set up the environment and (II) use the Azure ChatGPT API in Python.

I. Set up the Azure Environment

  1. Create an Azure account: If you don’t already have one, you’ll need to create an Azure account to use Azure OpenAI ChatGPT.
  2. The OpenAI service on Azure is still limited to certain companies. In order to ask for access, fill in this request form. I got my reply within a business day.
  3. Create a new resource: In the Azure portal, navigate to the “Create a resource” page and search for “Azure OpenAI”. Select the “Azure OpenAI” resource and fill in the required information. I’ll call my new resource group, “rs-chatgpt-test” and have it located in the “US East” region. Finally give the instance a name, “chatgpt-testing-alex” and select the available pricing tier.
  4. Once deployed (wait a couple of minutes — then you’ll see success), go to your newly created resource and click on “manage keys”. Here can you grab one of the two keys and the end point which we’ll need in Step II.
  5. Next click on “Go to Azure OpenAI Studio”. Here go to “Create new deployment” in order to get your specific model started. I’ll choose the “gpt-35-turbo (version 0301)” model and give it the name “chatgpt-turbo”.

II. Use the Azure ChatGPT API in Python.

Once Step I is complete, wait 5 minutes so that everything propagates and the API is ready for use.

  1. Install the OpenAI package. If you already used the openai package in the past, make sure you update it to the latest version with: pip install — upgrade openai
pip install openai

2. Let’s fill in the necessary parameters that we got in Step II and import the os and openai python library.

# Import packages 
import os
import openai

# Set parameters for the API
openai.api_type = "azure"
openai.api_version = "2022-12-01"
openai.api_type = "azure"
openai.api_base = "YOUR_ENDPOINT"
openai.api_key = "YOUR_KEY"

3. Finally, let’s send a prompt to ChatGPT, and ask it to write a blog about itself. Here you see that the engine is filled in with the chatgpt-turbo model which we deployed in our resource. We give it a prompt and a few more parameters that we can use to tune the response.

# Push question to the API
response = openai.Completion.create(
engine="chatgpt-turbo",
prompt="Write a blog on what the model chatgpt is",
temperature=0.5,
max_tokens=800,
top_p=0.5,
frequency_penalty=0,
presence_penalty=0,
stop=None)

# Print the result
print(response['choices'][0]['text'])

Voila! Our response! Enjoy! 😃

In conclusion, Azure OpenAI ChatGPT is a powerful tool for developing conversational chatbots that can provide automated assistance to users. By following these steps, you can quickly and easily set up an Azure OpenAI ChatGPT resource and start building your own chatbot. Whether you’re looking to improve customer support, automate tasks, or enhance user engagement, Azure OpenAI ChatGPT is an excellent and secure solution to explore.

❤️If you found this article helpful, I’d be grateful if you could follow me on Medium and give it a clap or two. Your support means a lot to me. Thank you!

Check out how you can build out a LinkedIn Post Generator in my next blog

Alexandre t’Kint

--

--