Skip to content

Commit 9d540b9

Browse files
author
Jill Grant
authored
Merge pull request #379 from mrbullwinkle/mrb_09_19_2024_Studio_UX_updates
[Azure OpenAI] Chat Completions Studio UI updates
2 parents 77ffd27 + 5da9642 commit 9d540b9

File tree

4 files changed

+15
-60
lines changed

4 files changed

+15
-60
lines changed

articles/ai-services/openai/includes/chatgpt-studio.md

Lines changed: 15 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@ description: Walkthrough on how to get started with Azure OpenAI and make your f
66
manager: nitinme
77
ms.service: azure-ai-openai
88
ms.topic: include
9-
ms.date: 03/01/2023
9+
ms.date: 09/19/2024
1010
---
1111

1212
## Prerequisites
1313

1414
- An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services?azure-portal=true).
15-
- An Azure OpenAI Service resource with either the `gpt-35-turbo` or the `gpt-4` models deployed. For more information about model deployment, see the [resource deployment guide](../how-to/create-resource.md).
16-
17-
> [!div class="nextstepaction"]
18-
> [I ran into an issue with the prerequisites.](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=STUDIO&Pillar=AOAI&Product=Chatgpt&Page=quickstart&Section=Prerequisites)
19-
20-
> [!TIP]
21-
> Try out the new unified [Azure AI Studio (preview)](../../../ai-studio/what-is-ai-studio.md) which brings together capabilities from across multiple Azure AI services.
15+
- An Azure OpenAI Service resource with either `gpt-4o` or the `gpt-4o-mini` models deployed. We recommend using standard or global standard model [deployment tpyes](../how-to/deployment-types.md) for initial exploration. For more information about model deployment, see the [resource deployment guide](../how-to/create-resource.md).
2216

2317
## Go to Azure OpenAI Studio
2418

@@ -34,82 +28,43 @@ Start exploring OpenAI capabilities with a no-code approach through the Azure Op
3428

3529
:::image type="content" source="../media/quickstarts/chatgpt-playground-load.png" alt-text="Screenshot of the Chat playground page." lightbox="../media/quickstarts/chatgpt-playground-load.png":::
3630

37-
### Assistant setup
31+
### Setup
3832

39-
You can use the **Assistant setup** dropdown to select a few pre-loaded **System message** examples to get started.
33+
You can use the **Prompt samples* dropdown to select a few pre-loaded **System message** examples to get started.
4034

4135
**System messages** give the model instructions about how it should behave and any context it should reference when generating a response. You can describe the assistant's personality, tell it what it should and shouldn't answer, and tell it how to format responses.
4236

43-
**Add few-shot examples** allows you to provide conversational examples that are used by the model for [in-context learning](../concepts/prompt-engineering.md#basics).
44-
4537
At any time while using the Chat playground you can select **View code** to see Python, curl, and json code samples pre-populated based on your current chat session and settings selections. You can then take this code and write an application to complete the same task you're currently performing with the playground.
4638

4739
### Chat session
4840

49-
Selecting the **Send** button sends the entered text to the completions API and the results are returned back to the text box.
41+
Selecting the **Enter** button or selecting the right arrow icon sends the entered text to the chat completions API and the results are returned back to the text box.
5042

5143
Select the **Clear chat** button to delete the current conversation history.
5244

53-
### Settings
45+
### Key settings
5446

5547
| **Name** | **Description** |
5648
|:--------------------|:-------------------------------------------------------------------------------|
5749
| Deployments | Your deployment name that is associated with a specific model. |
50+
| Add your data |
51+
| Parameters | Custom parameters that alter the model responses. When you are starting out we recommend to use the defaults for most parameters |
5852
| Temperature | Controls randomness. Lowering the temperature means that the model produces more repetitive and deterministic responses. Increasing the temperature results in more unexpected or creative responses. Try adjusting temperature or Top P but not both. |
59-
| Max length (tokens) | Set a limit on the number of tokens per model response. The API supports a maximum of 4096 tokens shared between the prompt (including system message, examples, message history, and user query) and the model's response. One token is roughly four characters for typical English text.|
60-
| Top probabilities | Similar to temperature, this controls randomness but uses a different method. Lowering Top P narrows the model’s token selection to likelier tokens. Increasing Top P lets the model choose from tokens with both high and low likelihood. Try adjusting temperature or Top P but not both.|
61-
| Multi-turn conversations | Select the number of past messages to include in each new API request. This helps give the model context for new user queries. Setting this number to 10 results in five user queries and five system responses.|
53+
| Max response (tokens) | Set a limit on the number of tokens per model response. The API on the latest models supports a maximum of 128,000 tokens shared between the prompt (including system message, examples, message history, and user query) and the model's response. One token is roughly four characters for typical English text.|
54+
| Top p | Similar to temperature, this controls randomness but uses a different method. Lowering Top P narrows the model’s token selection to likelier tokens. Increasing Top P lets the model choose from tokens with both high and low likelihood. Try adjusting temperature or Top P but not both.|
6255
| Stop sequences | Stop sequence make the model end its response at a desired point. The model response ends before the specified sequence, so it won't contain the stop sequence text. For GPT-35-Turbo, using `<|im_end|>` ensures that the model response doesn't generate a follow-up user query. You can include as many as four stop sequences.|
6356

64-
### Show panels
65-
66-
By default there are three panels: assistant setup, chat session, and settings. **Show panels** allows you to add, remove, and rearrange the panels. If you ever close a panel and need to get it back, use **Show panels** to restore the lost panel.
67-
68-
## Start a chat session
69-
70-
1. From the assistant setup drop-down, select **Xbox customer support agent**
71-
2. You'll be prompted asking if you want to update the system message, select **Continue**.
72-
3. In the chat session pane, enter the following question: "I'm interested in buying a new Xbox", and select **Send**.
73-
4. You'll receive a response similar to:
57+
## View code
7458

75-
:::image type="content" source="../media/quickstarts/xbox.png" alt-text="Screenshot of a first question and answer in playground." lightbox="../media/quickstarts/xbox.png":::
59+
Once you have experimented with chatting with the model select the **</> View Code** button. This will give you a replay of the code behind your entire conversation so far:
7660

77-
5. Enter a follow-up question like: "which models support 4K?"
78-
79-
:::image type="content" source="../media/quickstarts/models.png" alt-text="Screenshot of follow-up question and answer in playground." lightbox="../media/quickstarts/models.png":::
80-
81-
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:
82-
83-
```python
84-
#Note: The openai-python library support for Azure OpenAI is in preview.
85-
import os
86-
import openai
87-
openai.api_type = "azure"
88-
openai.api_base = "https://docs-test-001.openai.azure.com/"
89-
openai.api_version = "2024-02-01"
90-
openai.api_key = os.getenv("OPENAI_API_KEY")
91-
92-
response = openai.ChatCompletion.create(
93-
engine="gpt-35-turbo", # replace this value with the deployment name you chose when you deployed the associated model.
94-
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."}],
95-
temperature=0,
96-
max_tokens=350,
97-
top_p=0.95,
98-
frequency_penalty=0,
99-
presence_penalty=0,
100-
stop=None)
101-
```
102-
103-
> [!div class="nextstepaction"]
104-
> [I ran into an issue with the playground.](https://microsoft.qualtrics.com/jfe/form/SV_0Cl5zkG3CnDjq6O?PLanguage=STUDIO&Pillar=AOAI&Product=Chatgpt&Page=quickstart&Section=Set-up)
61+
:::image type="content" source="../media/quickstarts/chat-view-code.png" alt-text="Screenshot of view code experience." lightbox="../media/quickstarts/chat-view-code.png":::
10562

10663
### Understanding the prompt structure
10764

108-
If you examine the sample from **View code** you'll notice some unique tokens that weren't part of a typical GPT completion call. GPT-35-Turbo was trained to use special tokens to delineate different parts of the prompt. Content is provided to the model in between `<|im_start|>` and `<|im_end|>` tokens. The prompt begins with a system message that can be used to prime the model by including context or instructions for the model. After that, the prompt contains a series of messages between the user and the assistant.
109-
110-
The assistant's response to the prompt will then be returned below the `<|im_start|>assistant` token and will end with `<|im_end|>` denoting that the assistant has finished its response. You can also use the **Show raw syntax** toggle button to display these tokens within the chat session panel.
65+
If you examine the sample from **View code** you'll notice that the conversation is broken into three distinct roles `system`, `user`, `assistant`. Each time you message the model the entire conversation history up to that point is resent. When using the chat completions API the model has no true memory of what you have sent to it in the past so you provide the conversation history for context to allow the model to respond properly.
11166

112-
The [GPT-35-Turbo & GPT-4 how-to guide](../how-to/chatgpt.md) provides an in-depth introduction into the new prompt structure and how to use the `gpt-35-turbo` model effectively.
67+
The [Chat completions how-to guide](../how-to/chatgpt.md) provides an in-depth introduction into the new prompt structure and how to use chat completions models effectively.
11368

11469
[!INCLUDE [deploy-web-app](deploy-web-app.md)]
11570

107 KB
Loading
-35.4 KB
Loading
33.7 KB
Loading

0 commit comments

Comments
 (0)