Skip to content

Commit 8444b9e

Browse files
Merge pull request #661 from mrbullwinkle/mrb_10_04_2024_temp_models_fix
[Azure OpenAI] Small updates
2 parents 2588abc + f21d107 commit 8444b9e

File tree

4 files changed

+79
-5
lines changed

4 files changed

+79
-5
lines changed

articles/ai-services/openai/concepts/models.md

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,79 @@ Once access has been granted, you will need to create a deployment for each mode
4949

5050
Support for the **o1 series** models was added in API version `2024-09-01-preview`.
5151

52-
The `max_tokens` parameter has been deprecated and replaced with the new `max_completion_tokens` parameter. **o1 series** models will only work with the `max_completions_tokens` parameter.
52+
The `max_tokens` parameter has been deprecated and replaced with the new `max_completion_tokens` parameter. **o1 series** models will only work with the `max_completion_tokens` parameter.
53+
54+
### Usage
55+
56+
These models do not currently support the same set of parameters as other models that use the chat completions API. Only a very limited subset is currently supported, so common parameters like `temperature`, `top_p`, are not available and including them will cause your request to fail. `o1-preview` and `o1-mini` models will also not accept the system message role as part of the messages array.
57+
58+
# [Python (Microsoft Entra ID)](#tab/python-secure)
59+
60+
You may need to upgrade your version of the OpenAI Python library to take advantage of the new `max_completion_tokens` parameter.
61+
62+
```cmd
63+
pip install openai --upgrade
64+
```
65+
66+
If you are new to using Microsoft Entra ID for authentication see [How to configure Azure OpenAI Service with Microsoft Entra ID authentication](../how-to/managed-identity.md).
67+
68+
```python
69+
from openai import AzureOpenAI
70+
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
71+
72+
token_provider = get_bearer_token_provider(
73+
DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"
74+
)
75+
76+
client = AzureOpenAI(
77+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),
78+
azure_ad_token_provider=token_provider,
79+
api_version="2024-09-01-preview"
80+
)
81+
82+
response = client.chat.completions.create(
83+
model="o1-preview-new", # replace with the model deployment name of your o1-preview, or o1-mini model
84+
messages=[
85+
{"role": "user", "content": "What steps should I think about when writing my first Python API?"},
86+
],
87+
max_completion_tokens = 5000
88+
89+
)
90+
91+
print(response.model_dump_json(indent=2))
92+
```
93+
94+
# [Python (key-based auth)](#tab/python)
95+
96+
You may need to upgrade your version of the OpenAI Python library to take advantage of the new `max_completion_tokens` parameter.
97+
98+
```cmd
99+
pip install openai --upgrade
100+
```
101+
102+
```python
103+
104+
from openai import AzureOpenAI
105+
106+
client = AzureOpenAI(
107+
azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"),
108+
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
109+
api_version="2024-09-01-preview"
110+
)
111+
112+
response = client.chat.completions.create(
113+
model="o1-preview-new", # replace with the model deployment name of your o1-preview, or o1-mini model
114+
messages=[
115+
{"role": "user", "content": "What steps should I think about when writing my first Python API?"},
116+
],
117+
max_completion_tokens = 5000
118+
119+
)
120+
121+
print(response.model_dump_json(indent=2))
122+
```
123+
124+
---
53125

54126
### Region availability
55127

@@ -196,7 +268,7 @@ You can also use the OpenAI text to speech voices via Azure AI Speech. To learn
196268

197269
[!INCLUDE [Standard Models](../includes/model-matrix/standard-models.md)]
198270

199-
This table doesn't include fine-tuning regional availability information. Consult the the [fine-tuning section](#fine-tuning-models) for this information.
271+
This table doesn't include fine-tuning regional availability information. Consult the [fine-tuning section](#fine-tuning-models) for this information.
200272

201273
For information on default quota, refer to the [quota and limits article](../quotas-limits.md).
202274

articles/ai-services/openai/how-to/batch.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ In the Studio UI the deployment type will appear as `Global-Batch`.
8383
:::image type="content" source="../media/how-to/global-batch/global-batch.png" alt-text="Screenshot that shows the model deployment dialog in Azure OpenAI Studio with Global-Batch deployment type highlighted." lightbox="../media/how-to/global-batch/global-batch.png":::
8484

8585
> [!TIP]
86-
> Each line of your input file for batch processing has a `model` attribute that requires a global batch **deployment name**. For a given input file, all names must be the same deployment name. This is different from OpenAI where the concept of model deployments does not exist.
86+
> Each line of your input file for batch processing has a `model` attribute that requires a global batch **deployment name**. For a given input file, all names must be the same deployment name. This is different from OpenAI where the concept of model deployments does not exist.
87+
>
88+
> For the best performance we recommend submitting large files for patch processing, rather than a large number of small files with only a few lines in each file.
8789
8890
::: zone pivot="programming-language-ai-studio"
8991

articles/ai-services/openai/how-to/structured-outputs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ You can use [`Pydantic`](https://docs.pydantic.dev/latest/) to define object sch
3737
pip install openai pydantic --upgrade
3838
```
3939

40-
If you new to using Microsoft Entra ID for authentication see [How to configure Azure OpenAI Service with Microsoft Entra ID authentication](./managed-identity.md).
40+
If you are new to using Microsoft Entra ID for authentication see [How to configure Azure OpenAI Service with Microsoft Entra ID authentication](./managed-identity.md).
4141

4242
```python
4343
from pydantic import BaseModel

articles/ai-services/openai/whats-new.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Customers who were already approved and have access to the model through the ear
3232

3333
Support for the **o1 series** models was added in API version `2024-09-01-preview`.
3434

35-
The `max_tokens` parameter has been deprecated and replaced with the new `max_completion_tokens` parameter. **o1 series** models will only work with the `max_completions_tokens` parameter.
35+
The `max_tokens` parameter has been deprecated and replaced with the new `max_completion_tokens` parameter. **o1 series** models will only work with the `max_completion_tokens` parameter.
3636

3737
**Region availability**:
3838

0 commit comments

Comments
 (0)