Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.
Learn how to maximize the potential of GPT-4 and ChatGPT on Azure OpenAI Service with our comprehensive guide. Discover tips, tricks, and best practices to harness the power of this AI language model.
ChatGPT and GPT-4 are huge language models from OpenAI that may be used to generate text, translate languages, write various types of creative material, and provide useful answers to your questions. They are both available on Azure OpenAI Service, making them simple to integrate into your applications. In this article, I’ll show you How to Use ChatGPT on Azure OpenAI Service step by step procedures.
Table of Contents
An Azure subscription can be created for free.
Azure OpenAI has been granted access in the desired Azure subscription.
Currently, access to this service is only available through application. You can apply for Azure OpenAI access by filling out the form at https://aka.ms/oai/access. If you have a problem, please open an issue on this repo.
An Azure OpenAI Service resource running the gpt-35-turbo or gpt-41 models. See the resource deployment guide for additional information on model deployment.
What is Azure OpenAI Service?
Azure OpenAI Service provides a REST API through which you may use OpenAI’s advanced language models, including as GPT-3, Codex, Embeddings, GPT-4, and ChatGPT. These models can be applied to a wide range of tasks, including content generation, summarization, semantic search, and natural language to code translation. The service can be accessed via REST APIs, the Python SDK, or the web-based interface in Azure OpenAI Studio.
How to Access Azure OpenAI Studio?
Follow these steps to access Azure OpenAI Studio and use Chat playground.
By default, the Azure OpenAI Studio Chat playground has three panels: assistant setup, chat session, and settings.
You can use Show panels to add, remove, or rearrange these panels. If you close a panel and need to get it back, use Show panels to restore the lost panel.
Assistant Setup Feature
Locate the “Assistant setup” dropdown menu in the Chat playground interface. It enables you to choose from a library of pre-loaded System message samples to deliver instructions and context to the model.
Select one of the pre-loaded System message samples from the “Assistant setup” dropdown menu. These examples can assist you in defining the assistant’s personality, specifying what it should and should not answer, and instructing it on how to style responses.
You can also use the “Add few-shot examples” function to provide conversational examples for the model to learn from in-context. These examples assist the model in understanding the required behavior and improving its responses based on the examples presented.
When interacting with the Chat playground, pick “View code” to see code samples in Python, curl, and JSON. These code samples are produced automatically based on your current chat session and preferences. You can refer to these code samples when creating your own applications to accomplish the same functionality outside of the playground environment.
Using the Assistant setting choices, you may define the assistant’s behavior and personality, improve its replies, and fine-tune its output to meet your individual needs. The Chat playground allows you to experiment, test, and get insights for integrating OpenAI language models into your own apps.
Sending Text: Type your preferred text into the input text box and press the “Send” button. This passes the text to the completions API, and the model responds based on the input. The model’s reaction is then displayed in the text field, allowing for a conversational back-and-forth.
Clearing Chat History: Click the “Clear chat” button to wipe the current conversation history and begin over. This action deletes all previous chat messages from the text box, leaving a blank slate for fresh conversations.
The name of the deployment that contains the ChatGPT or GPT-4 model.
Controls the randomness of the model’s output. Higher temperatures will produce more creative and unexpected responses, while lower temperatures will produce more factual and predictable responses.
Controls the probability of the model selecting the top-p most likely tokens. Higher values will produce more creative and unexpected responses, while lower values will produce more factual and predictable responses.
The maximum number of tokens that the model can generate.
How to use Azure ChatGPT playground?
Step by step instructions to use GPT-4 and ChatGPT on Azure OpenAI Service.
Step1: Select Xbox customer care agent from the assistant setup drop-down list.
Step2: When asked if you wish to update the system message, choose Continue.
Step3: In the chat session pane, type “I’m interested in buying a new Xbox” and press Send.
Step4: You’ll get something like this:
Step5: Add a follow-up question, such as “which models support 4K?”
Step6: Now that you have a basic conversation, pick View code from Assistant setup to see a replay of the code behind the entire conversation thus far:
#Note: The openai-python library support for Azure OpenAI is in preview.
openai.api_type = "azure"
openai.api_base = "https://docs-test-001.openai.azure.com/"
openai.api_version = "2023-05-15"
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.ChatCompletion.create(
engine="gpt-35-turbo", # replace this value with the deployment name you chose when you deployed the associated model.
"content": "You are an Xbox customer support agent whose primary goal is to help users with issues they are experiencing with their Xbox devices. You are friendly and concise. You only provide factual answers to queries, and do not provide answers that are not related to Xbox."
"content": "How much is a PS5?"
"content": "I apologize, but I do not have information about the prices of other gaming devices such as the PS5. My primary focus is to assist with issues regarding Xbox devices. Is there a specific issue you are having with your Xbox device that I may be able to help with?"
Special tokens used in ChatGPT on Azure
|im_start|>: This token denotes the start of the input message.
<|im_end|>: This token indicates the end of the input message.
|as_start|>: This token denotes the start of the assistant’s response.
<|as_end|>: This token indicates the end of the assistant’s response.
The tokens |im_start|> and |im_end|> indicate the start and end of the system message, respectively. The tokens |as_start|> and |as_end|> indicate the start and end of the assistant’s response, respectively.
ChatGPT can comprehend that the system message is a welcome message, and that the user wants to learn more about ChatGPT by using these tokens. This enables ChatGPT to provide a more natural-sounding response that is tailored to the user’s individual needs.
You may also display these tokens in the chat session window by using the Show raw syntax toggle button. This can be useful for troubleshooting or understanding how ChatGPT handles prompts.
Finally, ChatGPT on Azure OpenAI Service are excellent tools for natural language processing and conversational AI. Developers can simply integrate these models into their applications because to their user-friendly interfaces and extensive documentation. As language understanding and generating capabilities improve, these services become valuable tools for creating intelligent and engaging conversational interactions. Please feel free to share your thoughts and feedback in the comment section below.
Greetings, I am a technical writer who specializes in conveying complex topics in simple and engaging ways. I have a degree in computer science and journalism, and I have experience writing about software, data, and design. My content includes blog posts, tutorials, and documentation pages, which I always strive to make clear, concise, and useful for the reader. I am constantly learning new things and sharing my insights with others.
Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.