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
> This library is maintained by OpenAI. Refer to the [release history](https://github.com/openai/openai-python/releases) to track the latest updates to the library.
43
31
@@ -64,16 +52,21 @@ Go to your resource in the Azure portal. The **Keys and Endpoint** can be found
64
52
65
53
2. Replace the contents of quickstart.py with the following code. Modify the code to add your key, endpoint, and deployment name:
66
54
67
-
# [OpenAI Python 1.x](#tab/python-new)
55
+
# [Microsoft Entra ID](#tab/entra)
68
56
69
57
```python
70
58
import os
71
59
from openai import AzureOpenAI
60
+
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
deployment_name='REPLACE_WITH_YOUR_DEPLOYMENT_NAME'#This will correspond to the custom name you chose for your deployment when you deployed a model. Use a gpt-35-turbo-instruct deployment.
deployment_name='REPLACE_WITH_YOUR_DEPLOYMENT_NAME'#This will correspond to the custom name you chose for your deployment when you deployed a model. Use a gpt-35-turbo-instruct deployment.
96
+
101
97
# Send a completion call to generate an answer
102
98
print('Sending a test completion job')
103
99
start_phrase ='Write a tagline for an ice cream shop. '
@@ -128,7 +123,6 @@ Write a tagline for an ice cream shop. The coldest ice cream in town!
128
123
129
124
Run the code a few more times to see what other types of responses you get as the response won't always be the same.
130
125
131
-
132
126
### Understanding your results
133
127
134
128
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.
Copy file name to clipboardExpand all lines: articles/ai-services/openai/includes/rest.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: Walkthrough on how to get started with Azure OpenAI and make your f
5
5
manager: nitinme
6
6
ms.service: azure-ai-openai
7
7
ms.topic: include
8
-
ms.date: 02/02/2023
8
+
ms.date: 03/26/2025
9
9
---
10
10
11
11
## Prerequisites
@@ -38,14 +38,27 @@ Go to your resource in the Azure portal. The **Endpoint and Keys** can be found
38
38
39
39
In a bash shell, run the following command. You will need to replace `gpt-35-turbo-instruct` with the deployment name you chose when you deployed the `gpt-35-turbo-instruct` model. Entering the model name will result in an error unless you chose a deployment name that is identical to the underlying model name.
The format of your first line of the command with an example endpoint would appear as follows `curl https://docs-test-001.openai.azure.com/openai/deployments/{YOUR-DEPLOYMENT_NAME_HERE}/completions?api-version=2024-02-01 \`. If you encounter an error double check to make sure that you don't have a doubling of the `/` at the separation between your endpoint and `/openai/deployments`.
59
+
---
60
+
61
+
The format of your first line of the command with an example endpoint would appear as follows `curl https://docs-test-001.openai.azure.com/openai/deployments/{YOUR-DEPLOYMENT_NAME_HERE}/completions?api-version=2024-10-21 \`. If you encounter an error double check to make sure that you don't have a doubling of the `/` at the separation between your endpoint and `/openai/deployments`.
49
62
50
63
If you want to run this command in a normal Windows command prompt you would need to alter the text to remove the `\` and line breaks.
0 commit comments