You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/openai/how-to/create-resource.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ manager: nitinme
7
7
ms.service: cognitive-services
8
8
ms.subservice: openai
9
9
ms.topic: how-to
10
-
ms.date: 06/30/2022
10
+
ms.date: 02/02/2023
11
11
zone_pivot_groups: openai-create-resource
12
12
author: ChrisHMSFT
13
13
ms.author: chrhoder
@@ -16,17 +16,17 @@ recommendations: false
16
16
17
17
# Create a resource and deploy a model using Azure OpenAI
18
18
19
-
Use this article to get started with Azure OpenAI with step-by-step instructions to create a resource and deploy a model. While the steps for resource creation and model deployment can be completed in a few minutes, the actual deployment process itself can take more than hour. It is recommended to create your resource, start your deployment, and then check back in on your deployment later rather than actively waiting for the deployment to complete.
19
+
Use this article to get started with Azure OpenAI with step-by-step instructions to create a resource and deploy a model. While the steps for resource creation and model deployment can be completed in a few minutes, the actual deployment process itself can take more than hour. You can create your resource, start your deployment, and then check back in on your deployment later rather than actively waiting for the deployment to complete.
Copy file name to clipboardExpand all lines: articles/cognitive-services/openai/includes/create-resource-portal.md
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ manager: nitinme
7
7
ms.service: cognitive-services
8
8
ms.subservice: openai
9
9
ms.topic: include
10
-
ms.date: 06/30/2022
10
+
ms.date: 02/02/2023
11
11
keywords:
12
12
---
13
13
@@ -22,7 +22,7 @@ keywords:
22
22
23
23
Resources in Azure can be created several different ways:
24
24
25
-
- Within the Azure portal
25
+
- Within the [Azure portal](https://portal.azure.com/?microsoft_azure_marketplace_ItemHideKey=microsoft_openai_tip#create/Microsoft.CognitiveServicesOpenAI)
26
26
- Using the REST APIs, Azure CLI, PowerShell or client libraries
27
27
- Via ARM templates
28
28
@@ -43,14 +43,21 @@ This guide walks you through the Azure portal creation experience.
43
43
44
44
## Deploy a model
45
45
46
-
Before you can generate text or inference, you need to deploy a model. This is done by selecting **create new deployment** on the **deployments** page. From here, you can select from one of our many available models. For getting started, we recommend `text-davinci-002` for users in South Central and `text-davinci-001` for users in West Europe (text-davinci-002 is not available in this region). You can do this in the Azure OpenAI Studio.
46
+
Before you can generate text or inference, you need to deploy a model. You can select from one of several available models in the Azure OpenAI Studio.
47
47
48
-
1. Go to the [Azure OpenAI Studio](https://oai.azure.com)
48
+
Davinci is the most capable model family and can perform any task the other models can perform and often with less instruction. For applications requiring a lot of understanding of the content, like summarization for a specific audience and creative content generation, Davinci is going to produce the best results.
49
49
50
-
1. Login with the resource you want to use
50
+
To deploy a model, follow these steps:
51
51
52
-
1. Select the **Go to Deployments** button under **Manage deployments in your resource** to navigate to the **Deployments** page
52
+
1. Sign in to the [Azure OpenAI Studio](https://oai.azure.com).
53
+
1. Select the subscription and OpenAI resource to work with.
54
+
1. Select **Manage deployments in your resource** > **Go to Deployments** under **Manage your deployments and models**. You might first need to scroll down on the landing page.
53
55
54
56
:::image type="content" source="../media/create-resource/deployment.png" alt-text="Screenshot of the Azure OpenAI Studio page with the 'Go to Deployments' button highlighted." lightbox="../media/create-resource/deployment.png":::
55
57
56
-
1. Create a new deployment called `text-davinci-002` and choose the `text-davinci-002` model from the drop-down.
58
+
1. Select **Create new deployment** from the **Management** > **Deployments** page.
59
+
1. Select a model from the drop-down. For getting started in the East US region, we recommend the `text-davinci-003` model. In other regions you should start with the `text-davinci-002` model. Some models are not available in all regions. For a list of available models per region, see [Model Summary table and region availability](../concepts/models.md#model-summary-table-and-region-availability).
60
+
1. Enter a model name to help you identify the model. Choose a name carefully. The model name will be used as the deployment name via OpenAI client libraries and API.
61
+
1. Select **Create** to deploy the model.
62
+
63
+
The deployments table displays a new entry that corresponds to this newly created model. Your deployment status will move to succeeded when the deployment is complete and ready for use.
Copy file name to clipboardExpand all lines: articles/cognitive-services/openai/includes/python.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ manager: nitinme
7
7
ms.service: cognitive-services
8
8
ms.subservice: openai
9
9
ms.topic: include
10
-
ms.date: 12/14/2022
10
+
ms.date: 02/02/2023
11
11
keywords:
12
12
---
13
13
@@ -21,18 +21,18 @@ keywords:
21
21
Currently, access to this service is granted only by application. You can apply for access to the Azure OpenAI service by completing the form at <ahref="https://aka.ms/oai/access"target="_blank">https://aka.ms/oai/access</a>. Open an issue on this repo to contact us if you have an issue.
22
22
- <ahref="https://www.python.org/"target="_blank">Python 3.7.1 or later version</a>
23
23
- The following Python libraries: os, requests, json
24
-
- An Azure OpenAI Service resource with a model deployed. If you don't have a resource/model the process is documented in our [resource deployment guide](../how-to/create-resource.md)
24
+
- An Azure OpenAI Service resource with a model deployed. For more information about model deployment, see the [resource deployment guide](../how-to/create-resource.md).
25
25
26
26
## Set up
27
27
28
-
1.Install the client library. You can install the client library with:
28
+
Install the OpenAI Python client library with:
29
29
30
30
```console
31
31
pip install openai
32
32
```
33
33
34
34
> [!NOTE]
35
-
> This library is maintained by OpenAI and is currently a previewrelease. Use the [version.py commit history](https://github.com/openai/openai-python/commits/main/openai/version.py) to track the latest updates to the library.
35
+
> This library is maintained by OpenAI and is currently in preview. Refer to the [release history](https://github.com/openai/openai-python/releases) or the [version.py commit history](https://github.com/openai/openai-python/commits/main/openai/version.py) to track the latest updates to the library.
36
36
37
37
## Retrieve key and endpoint
38
38
@@ -42,7 +42,7 @@ To successfully make a call against the Azure OpenAI service, you'll need the fo
42
42
|--------------------------|-------------|
43
43
|`ENDPOINT`| This value can be found in the **Keys & Endpoint** section when examining your resource from the Azure portal. Alternatively, you can find the value in the **Azure OpenAI Studio** > **Playground** > **Code View**. An example endpoint is: `https://docs-test-001.openai.azure.com/`.|
44
44
|`API-KEY`| This value can be found in the **Keys & Endpoint** section when examining your resource from the Azure portal. You can use either `KEY1` or `KEY2`.|
45
-
|`DEPLOYMENT-NAME`| This will correspond to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal or alternatively under **Management** > **Deployments** in Azure OpenAI Studio.|
45
+
|`DEPLOYMENT-NAME`| This value will correspond to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal or alternatively under **Management** > **Deployments** in Azure OpenAI Studio.|
46
46
47
47
Go to your resource in the Azure portal. The **Endpoint and Keys** can be found in the **Resource Management** section. Copy your endpoint and access key as you'll need both for authenticating your API calls. You can use either `KEY1` or `KEY2`. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption.
48
48
@@ -52,7 +52,7 @@ Go to your resource in the Azure portal. The **Endpoint and Keys** can be found
52
52
53
53
1. Create a new Python file called quickstart.py. Then open it up in your preferred editor or IDE.
54
54
55
-
2. Replace the contents of quickstart.py with the following code. Modify the code to add your key, endpoint, and deployment name:
55
+
2. Replace the contents of quickstart.py with the following code. Modify the code to add your key, endpoint, and deployment name:
56
56
57
57
```python
58
58
import os
@@ -65,27 +65,29 @@ Go to your resource in the Azure portal. The **Endpoint and Keys** can be found
65
65
openai.api_type ='azure'
66
66
openai.api_version ='2022-12-01'# this may change in the future
67
67
68
-
deployment_id='REPLACE_WITH_YOUR_DEPLOYMENT_NAME'#This will correspond to the custom name you chose for your deployment when you deployed a model.
68
+
deployment_name='REPLACE_WITH_YOUR_DEPLOYMENT_NAME'#This will correspond to the custom name you chose for your deployment when you deployed a model.
69
69
70
70
# Send a completion call to generate an answer
71
71
print('Sending a test completion job')
72
72
start_phrase ='Write a tagline for an ice cream shop. '
text = response['choices'][0]['text'].replace('\n', '').replace(' .', '.').strip()
75
75
print(start_phrase+text)
76
76
```
77
77
78
-
> [!IMPORTANT]
79
-
> Remember to remove the key from your code when you're done, and never post it publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../../key-vault/general/overview.md). See the Cognitive Services [security](../../cognitive-services-security.md) article for more information.
78
+
> [!IMPORTANT]
79
+
> Remember to remove the key from your code when you're done, and never post it publicly. For production, use a secure way of storing and accessing your credentials like [Azure Key Vault](../../../key-vault/general/overview.md). See the Cognitive Services [security](../../cognitive-services-security.md) article for more information.
80
80
81
-
1. Run the application with the `python` command on your quickstart file
81
+
1. Run the application with the `python` command on your quickstart file:
82
82
83
83
```console
84
84
python quickstart.py
85
85
```
86
86
87
87
## Output
88
88
89
+
The output will include response text following the `Write a tagline for an ice cream shop.` prompt. The Azure OpenAI Service returned `The coldest ice cream in town!`in this example.
90
+
89
91
```console
90
92
Sending a test completion job
91
93
Write a tagline for an ice cream shop. The coldest ice cream in town!
@@ -95,7 +97,7 @@ Run the code a few more times to see what other types of responses you get as th
95
97
96
98
### Understanding your results
97
99
98
-
Since our example of `Write a tagline for an ice cream shop.` provides very little context, it's normal for the model to not always return expected results. You can adjust the maximum number of tokens if the response seems unexpected or truncated.
100
+
Since our example of `Write a tagline for an ice cream shop.` provides little context, it's normal for the model to not always return expected results. You can adjust the maximum number of tokens if the response seems unexpected or truncated.
99
101
100
102
The Azure OpenAI Service also performs content moderation on the prompt inputs and generated outputs. The prompts or responses may be filtered if harmful content is detected. For more information, see the [content filter](../concepts/content-filter.md) article.
Copy file name to clipboardExpand all lines: articles/cognitive-services/openai/includes/rest.md
+24-19Lines changed: 24 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ manager: nitinme
7
7
ms.service: cognitive-services
8
8
ms.subservice: openai
9
9
ms.topic: include
10
-
ms.date: 12/14/2022
10
+
ms.date: 02/02/2023
11
11
keywords:
12
12
---
13
13
@@ -19,7 +19,7 @@ keywords:
19
19
Currently, access to this service is granted only by application. You can apply for access to the Azure OpenAI service by completing the form at <ahref="https://aka.ms/oai/access"target="_blank">https://aka.ms/oai/access</a>. Open an issue on this repo to contact us if you have an issue.
20
20
- <ahref="https://www.python.org/"target="_blank">Python 3.7.1 or later version</a>
21
21
- The following Python libraries: os, requests, json
22
-
- An Azure OpenAI Service resource with a model deployed. If you don't have a resource/model the process is documented in our [resource deployment guide](../how-to/create-resource.md)
22
+
- An Azure OpenAI Service resource with a model deployed. For more information about model deployment, see the [resource deployment guide](../how-to/create-resource.md).
23
23
24
24
## Retrieve key and endpoint
25
25
@@ -29,7 +29,7 @@ To successfully make a call against the Azure OpenAI service, you'll need the fo
29
29
|--------------------------|-------------|
30
30
|`ENDPOINT`| This value can be found in the **Keys & Endpoint** section when examining your resource from the Azure portal. Alternatively, you can find the value in the **Azure OpenAI Studio** > **Playground** > **Code View**. An example endpoint is: `https://docs-test-001.openai.azure.com/`.|
31
31
|`API-KEY`| This value can be found in the **Keys & Endpoint** section when examining your resource from the Azure portal. You can use either `KEY1` or `KEY2`.|
32
-
|`DEPLOYMENT-NAME`| This will correspond to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal or alternatively under **Management** > **Deployments** in Azure OpenAI Studio.|
32
+
|`DEPLOYMENT-NAME`| This value will correspond to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal or alternatively under **Management** > **Deployments** in Azure OpenAI Studio.|
33
33
34
34
Go to your resource in the Azure portal. The **Endpoint and Keys** can be found in the **Resource Management** section. Copy your endpoint and access key as you'll need both for authenticating your API calls. You can use either `KEY1` or `KEY2`. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption.
35
35
@@ -46,19 +46,19 @@ Create a new Python file called quickstart.py. Then open it up in your preferred
@@ -70,10 +70,10 @@ Create a new Python file called quickstart.py. Then open it up in your preferred
70
70
print(formatted_response)
71
71
```
72
72
73
-
> [!IMPORTANT]
74
-
> Remember to remove the key from your code when you're done, and never post it publicly. For production, use a secure way of storing and accessing your credentials. For example, [Azure Key Vault](../../../key-vault/general/overview.md).
73
+
> [!IMPORTANT]
74
+
> Remember to remove the key from your code when you're done, and never post it publicly. For production, use a secure way of storing and accessing your credentials. For example, [Azure Key Vault](../../../key-vault/general/overview.md).
75
75
76
-
1. Run the application with the `python` command on your quickstart file
76
+
1. Run the application with the `python` command on your quickstart file:
77
77
78
78
```console
79
79
python quickstart.py
@@ -84,20 +84,25 @@ Create a new Python file called quickstart.py. Then open it up in your preferred
84
84
The output from the completions API will look as follows.
85
85
86
86
```json
87
-
{
88
-
"id": "id of your call",
87
+
{
88
+
"id": "ID of your call",
89
89
"object": "text_completion",
90
-
"created": 1589478378,
91
-
"model": "model used",
90
+
"created": 1675444965,
91
+
"model": "text-davinci-002",
92
92
"choices": [
93
93
{
94
-
"text": " there was a girl who",
95
-
"index": 0,
96
-
"logprobs": null,
97
-
"finish_reason": "length"
94
+
"text": " there lived in a little village a woman who was known as the meanest",
95
+
"index": 0,
96
+
"finish_reason": "length",
97
+
"logprobs": null
98
98
}
99
-
]
99
+
],
100
+
"usage": {
101
+
"completion_tokens": 16,
102
+
"prompt_tokens": 3,
103
+
"total_tokens": 19
100
104
}
105
+
}
101
106
```
102
107
103
108
The Azure OpenAI Service also performs content moderation on the prompt inputs and generated outputs. The prompts or responses may be filtered if harmful content is detected. For more information, see the [content filter](../concepts/content-filter.md) article.
0 commit comments