Home > Common Problem > Quickstart: Get started using ChatGPT and GPT-4 with Azure OpenAI Service

Quickstart: Get started using ChatGPT and GPT-4 with Azure OpenAI Service

WBOY
Release: 2023-06-03 10:04:55
forward
1802 people have browsed it
  • Azure Subscription - Create one for free.
  • Grant access to Azure OpenAI in the required Azure subscription. Currently, access to this service can only be granted through the app. You can request access to Azure OpenAI by filling out the form at https://aka.ms/oai/access . Open an issue on this repository to contact us if you encounter problems.
  • Have or gpt-35-turbogpt-41deployed model. For more information about model deployment, see the Resource Deployment Guide.

1 GPT-4 models are currently available by request only. To access these models, existing Azure OpenAI customers can request access by filling out this form.

I'm having a prerequisite problem.

Go to Azure OpenAI Studio

Navigate to Azure OpenAI Studio https://oai.azure.com/ and log in with credentials that have access to OpenAI resources. During the sign-in workflow or later, select the relevant catalog, Azure subscription, and Azure OpenAI resources.

In the Azure OpenAI Studio landing page, select "Chat Playground".

快速入门:开始使用 ChatGPT 和 GPT-4 与 Azure OpenAI Service

Playground

Use a no-code approach to start exploring OpenAI capabilities with Azure OpenAI Studio’s chat playground. From this page, you can quickly iterate and experiment with these features.

快速入门:开始使用 ChatGPT 和 GPT-4 与 Azure OpenAI Service

Assistant Settings

You can use the "Assistant Settings" drop-down list to select some preloaded system messagesExample to get started.

System Messages Provides the model with instructions on how it should behave and any context it should reference when generating responses. You can describe the assistant's personality, tell it what it should and shouldn't answer, and tell it how to format answers.

Add Few ShotsExamples allows you to provide examples of conversations that the model uses for contextual learning.

When using the Chat Playground, you can select "View Code" at any time to view pre-populated Python, curl, and json code examples based on your current chat session and settings selection. You can then take this code and write an application that accomplishes the same task you currently perform on the playground.

Chat Session

Selecting the "Send" button will send the entered text to the completion API and the results will be returned to the text box.

Select the "Clear Chat" button to delete the current conversation history.

Settings

Name Description
Deployment The deployment name associated with a specific model. For ChatGPT, you need to use this model. gpt-35-turbo
Temperature Control randomness. Lowering the temperature means the model produces a more repeatable and deterministic response. Raising the temperature can lead to more unexpected or creative reactions. Try adjusting either the temperature or the top P, but not both.
Maximum length (tokens) Set a limit on the number of tokens per model response. The API supports sharing up to 4096 tokens between prompts (including system messages, samples, message history, and user queries) and model responses. For typical English text, a token is approximately four characters.
Highest Probability Similar to Temperature, this controls randomness, but uses a different method. Lowering the top P narrows the model's token selection to more likely tokens. Increasing the top P allows the model to choose from tokens with high and low likelihoods. Try adjusting either the temperature or the top P, but not both.
Multiple Conversations Select the number of past messages to include in each new API request. This helps provide model context for new user queries. Setting this number to 10 results in <> user queries and <> system responses.
Stop sequence The stop sequence causes the model to end its response at the desired point. The model response ends before the specified sequence, so it does not contain stop sequence text. For ChatGPT, use ensures that model responses do not generate subsequent user queries. Up to four stop sequences can be included. <|im_end|>

Show Panels

By default, there are three panels: Assistant Settings, Chat Sessions, and Settings. Show Panels allows you to add, delete and rearrange panels. If you ever closed a panel and need to restore it, use "Show Panel" to restore the lost panel.

Start a chat session

  1. From the Assistant settings drop-down list, select "Xbox Customer Support Agent"
  2. You will be prompted if you want To update the system message, select "Continue".
  3. In the chat session pane, enter the following question: "I'm interested in buying a new Xbox" and then select "Send".
  4. You will receive a response similar to the following: 快速入门:开始使用 ChatGPT 和 GPT-4 与 Azure OpenAI Service
  5. Enter a follow-up question, such as: "Which models support 4K?快速入门:开始使用 ChatGPT 和 GPT-4 与 Azure OpenAI Service
  6. Now that you have a basic conversation select View code from under Assistant setup and you'll have a replay of the code behind the entire conversation so far:

Python

#Note: The openai-python library support for Azure OpenAI is in preview.import osimport openaiopenai.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.messages = [{"role":"system","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."},{"role":"user","content":"How much is a PS5?"},{"role":"assistant","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?"},{"role":"user","content":"I am interested in buying an Xbox?"},{"role":"assistant","content":"Great! There are several Xbox models available in the market, including the Xbox Series X, Xbox Series S, and Xbox One. The Xbox Series X is the latest and most powerful console, while the Xbox Series S is a more affordable option that still offers great performance. The Xbox One is the previous generation console, but it still has a large library of games available to play.\n\nBefore purchasing an Xbox, you may want to consider factors such as your budget, the types of games you want to play, and whether you want to play games in 4K resolution. Once you have decided on a console, you can purchase it from a retailer or directly from the Xbox website. Let me know if you have any other questions or concerns!"},{"role":"user","content":"Which models are 4K?"},{"role":"assistant","content":"Both the Xbox Series X and Xbox One X support 4K resolution gaming. The Xbox Series S, on the other hand, supports up to 1440p resolution gaming, but it can upscale games to 4K. It's worth noting that in order to take advantage of 4K gaming, you'll need a 4K TV or monitor that supports HDR (High Dynamic Range) and HDMI 2.0 or higher."}],temperature=0,max_tokens=350,top_p=0.95,frequency_penalty=0,presence_penalty=0,stop=None)
Copy after login

I ran into an issue with the playground.

Understanding the prompt structure

If you check View the example in Code and you'll notice some unique tokens that are not part of the typical GPT completion call. ChatGPT is trained to use special tags to describe different parts of the prompt. Content is provided to the model between tokens. Prompts Begins with a system message that can be used to start a model by including a context or description for the model. Afterwards, the prompt contains a series of messages between the user and the assistant.<|im_start|> <|im_end|>

The assistant's response to the prompt will then be returned below the token, ending with a response indicating that the assistant has completed. You can also use Show original syntaxToggle button to display these tokens in the chat session panel. <|im_start|>assistant<|im_end|>

ChatGPT Operation Guide An in-depth introduction to the new prompt structure and how to use the model effectively. gpt-35-turbo

Cleaning up resources

After completing the test of the chat playground, if you want to clean up and delete OpenAI resources, you can delete the resource or resource group. Deleting a resource group also deletes any other resources associated with it.

  • Portal
  • Azure CLI

Next Steps

  • Learn more about how to use ChatGPT and the new model with the ChatGPT How-To Guide.gpt-35-turbo
  • For more For examples, check out the Azure OpenAI Samples GitHub repository

Related Articles

  • What is Azure OpenAI Service?

    Azure OpenAI Service provides REST API access to OpenAI’s powerful language models, including the GPT-3, Codex, and Embeddings model families. The new GPT-4 and ChatGPT (gpt-35-turbo) model series have been officially launched. These models can be easily adapted to your specific...

  • Learn how to use ChatGPT and GPT-4 models

    ChatGPT and GPT-4 models are optimized for conversational interfaces Language model. These models behave differently than older GPT-3 models. Previous models took a text input and text output approach, receiving a prompt string and returning the content added to the prompt string. However, ChatGPT and GPT-4 models...

  • 快速入门:开始使用 ChatGPT 和 GPT-4 与 Azure OpenAI Service

    #Microsoft launches Bing AI Chat widget for Android and Apple devices

    Launched on Bing 100 days of Microsoft AI Search are being celebrated with a series of exciting system updates. Among these updates, a chatbot widget designed specifically for mobile screens on iOS and Android platforms was introduced. See Microsoft's blog post here. This new feature...

  • 快速入门:开始使用 ChatGPT 和 GPT-4 与 Azure OpenAI Service

    Microsoft launches new tabular model definition language for Power BI

    The end of support date for Power BI Desktop on Windows 8.1 has been announced by Microsoft. The tech giant recently updated its leading data analytics platform to add support for TypeScript among other new features. Power BI today released a new Tabular Model Definition Language (TMDL)

  • 快速入门:开始使用 ChatGPT 和 GPT-4 与 Azure OpenAI Service

    ChromeOS Flex USB can now be set up on Linux systems

    ChromeOS Flex has Published, available on PC and Mac. One very annoying decision Google made at the time was that the installer USB had to be set up using a Chromebook recovery utility that was incompatible with Linux distributions like Ubuntu and Linux Mint. Unless you have another one...

The above is the detailed content of Quickstart: Get started using ChatGPT and GPT-4 with Azure OpenAI Service. For more information, please follow other related articles on the PHP Chinese website!

source:yundongfang.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template