Skip to content

Commit a483e99

Browse files
authored
Merge branch 'main' into chore/client-comment-fix
2 parents 69ad3e0 + 67997a4 commit a483e99

31 files changed

+205
-89
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.76.2"
2+
".": "1.77.0"
33
}

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 97
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml
3-
openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03
4-
config_hash: b597cd9a31e9e5ec709e2eefb4c54122
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml
3+
openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6
4+
config_hash: d9b6b6e6bc85744663e300eebc482067

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## 1.77.0 (2025-05-02)
4+
5+
Full Changelog: [v1.76.2...v1.77.0](https://github.com/openai/openai-python/compare/v1.76.2...v1.77.0)
6+
7+
### Features
8+
9+
* **api:** add image sizes, reasoning encryption ([473469a](https://github.com/openai/openai-python/commit/473469afa1a5f0a03f727bdcdadb9fd57872f9c5))
10+
11+
12+
### Bug Fixes
13+
14+
* **parsing:** handle whitespace only strings ([#2007](https://github.com/openai/openai-python/issues/2007)) ([246bc5b](https://github.com/openai/openai-python/commit/246bc5b7559887840717667a0dad465caef66c3b))
15+
16+
17+
### Chores
18+
19+
* only strip leading whitespace ([8467d66](https://github.com/openai/openai-python/commit/8467d666e0ddf1a9f81b8769a5c8a2fef1de20c1))
20+
321
## 1.76.2 (2025-04-29)
422

523
Full Changelog: [v1.76.1...v1.76.2](https://github.com/openai/openai-python/compare/v1.76.1...v1.76.2)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "openai"
3-
version = "1.76.2"
3+
version = "1.77.0"
44
description = "The official Python library for the openai API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/openai/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "openai"
4-
__version__ = "1.76.2" # x-release-please-version
4+
__version__ = "1.77.0" # x-release-please-version

src/openai/lib/streaming/chat/_completions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ def _accumulate_chunk(self, chunk: ChatCompletionChunk) -> ParsedChatCompletionS
438438
choice_snapshot.message.content
439439
and not choice_snapshot.message.refusal
440440
and is_given(self._rich_response_format)
441+
# partial parsing fails on white-space
442+
and choice_snapshot.message.content.lstrip()
441443
):
442444
choice_snapshot.message.parsed = from_json(
443445
bytes(choice_snapshot.message.content, "utf-8"),

src/openai/resources/audio/speech.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def create(
8585
`wav`, and `pcm`.
8686
8787
speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
88-
the default.
88+
the default. Does not work with `gpt-4o-mini-tts`.
8989
9090
extra_headers: Send extra headers
9191
@@ -176,7 +176,7 @@ async def create(
176176
`wav`, and `pcm`.
177177
178178
speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
179-
the default.
179+
the default. Does not work with `gpt-4o-mini-tts`.
180180
181181
extra_headers: Send extra headers
182182

src/openai/resources/images.py

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,14 @@ def edit(
119119
*,
120120
image: Union[FileTypes, List[FileTypes]],
121121
prompt: str,
122+
background: Optional[Literal["transparent", "opaque", "auto"]] | NotGiven = NOT_GIVEN,
122123
mask: FileTypes | NotGiven = NOT_GIVEN,
123124
model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
124125
n: Optional[int] | NotGiven = NOT_GIVEN,
125126
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | NotGiven = NOT_GIVEN,
126127
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
127-
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
128+
size: Optional[Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"]]
129+
| NotGiven = NOT_GIVEN,
128130
user: str | NotGiven = NOT_GIVEN,
129131
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
130132
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -139,14 +141,25 @@ def edit(
139141
This endpoint only supports `gpt-image-1` and `dall-e-2`.
140142
141143
Args:
142-
image: The image(s) to edit. Must be a supported image file or an array of images. For
143-
`gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
144-
25MB. For `dall-e-2`, you can only provide one image, and it should be a square
145-
`png` file less than 4MB.
144+
image: The image(s) to edit. Must be a supported image file or an array of images.
145+
146+
For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
147+
25MB. You can provide up to 16 images.
148+
149+
For `dall-e-2`, you can only provide one image, and it should be a square `png`
150+
file less than 4MB.
146151
147152
prompt: A text description of the desired image(s). The maximum length is 1000
148153
characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.
149154
155+
background: Allows to set transparency for the background of the generated image(s). This
156+
parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
157+
`opaque` or `auto` (default value). When `auto` is used, the model will
158+
automatically determine the best background for the image.
159+
160+
If `transparent`, the output format needs to support transparency, so it should
161+
be set to either `png` (default value) or `webp`.
162+
150163
mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
151164
indicate where `image` should be edited. If there are multiple images provided,
152165
the mask will be applied on the first image. Must be a valid PNG file, less than
@@ -187,6 +200,7 @@ def edit(
187200
{
188201
"image": image,
189202
"prompt": prompt,
203+
"background": background,
190204
"mask": mask,
191205
"model": model,
192206
"n": n,
@@ -429,12 +443,14 @@ async def edit(
429443
*,
430444
image: Union[FileTypes, List[FileTypes]],
431445
prompt: str,
446+
background: Optional[Literal["transparent", "opaque", "auto"]] | NotGiven = NOT_GIVEN,
432447
mask: FileTypes | NotGiven = NOT_GIVEN,
433448
model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
434449
n: Optional[int] | NotGiven = NOT_GIVEN,
435450
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | NotGiven = NOT_GIVEN,
436451
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
437-
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
452+
size: Optional[Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"]]
453+
| NotGiven = NOT_GIVEN,
438454
user: str | NotGiven = NOT_GIVEN,
439455
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
440456
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -449,14 +465,25 @@ async def edit(
449465
This endpoint only supports `gpt-image-1` and `dall-e-2`.
450466
451467
Args:
452-
image: The image(s) to edit. Must be a supported image file or an array of images. For
453-
`gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
454-
25MB. For `dall-e-2`, you can only provide one image, and it should be a square
455-
`png` file less than 4MB.
468+
image: The image(s) to edit. Must be a supported image file or an array of images.
469+
470+
For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
471+
25MB. You can provide up to 16 images.
472+
473+
For `dall-e-2`, you can only provide one image, and it should be a square `png`
474+
file less than 4MB.
456475
457476
prompt: A text description of the desired image(s). The maximum length is 1000
458477
characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.
459478
479+
background: Allows to set transparency for the background of the generated image(s). This
480+
parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
481+
`opaque` or `auto` (default value). When `auto` is used, the model will
482+
automatically determine the best background for the image.
483+
484+
If `transparent`, the output format needs to support transparency, so it should
485+
be set to either `png` (default value) or `webp`.
486+
460487
mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
461488
indicate where `image` should be edited. If there are multiple images provided,
462489
the mask will be applied on the first image. Must be a valid PNG file, less than
@@ -497,6 +524,7 @@ async def edit(
497524
{
498525
"image": image,
499526
"prompt": prompt,
527+
"background": background,
500528
"mask": mask,
501529
"model": model,
502530
"n": n,

src/openai/resources/responses/responses.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ def create(
140140
- `message.input_image.image_url`: Include image urls from the input message.
141141
- `computer_call_output.output.image_url`: Include image urls from the computer
142142
call output.
143+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
144+
tokens in reasoning item outputs. This enables reasoning items to be used in
145+
multi-turn conversations when using the Responses API statelessly (like when
146+
the `store` parameter is set to `false`, or when an organization is enrolled
147+
in the zero data retention program).
143148
144149
instructions: Inserts a system (or developer) message as the first item in the model's
145150
context.
@@ -331,6 +336,11 @@ def create(
331336
- `message.input_image.image_url`: Include image urls from the input message.
332337
- `computer_call_output.output.image_url`: Include image urls from the computer
333338
call output.
339+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
340+
tokens in reasoning item outputs. This enables reasoning items to be used in
341+
multi-turn conversations when using the Responses API statelessly (like when
342+
the `store` parameter is set to `false`, or when an organization is enrolled
343+
in the zero data retention program).
334344
335345
instructions: Inserts a system (or developer) message as the first item in the model's
336346
context.
@@ -515,6 +525,11 @@ def create(
515525
- `message.input_image.image_url`: Include image urls from the input message.
516526
- `computer_call_output.output.image_url`: Include image urls from the computer
517527
call output.
528+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
529+
tokens in reasoning item outputs. This enables reasoning items to be used in
530+
multi-turn conversations when using the Responses API statelessly (like when
531+
the `store` parameter is set to `false`, or when an organization is enrolled
532+
in the zero data retention program).
518533
519534
instructions: Inserts a system (or developer) message as the first item in the model's
520535
context.
@@ -1013,6 +1028,11 @@ async def create(
10131028
- `message.input_image.image_url`: Include image urls from the input message.
10141029
- `computer_call_output.output.image_url`: Include image urls from the computer
10151030
call output.
1031+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
1032+
tokens in reasoning item outputs. This enables reasoning items to be used in
1033+
multi-turn conversations when using the Responses API statelessly (like when
1034+
the `store` parameter is set to `false`, or when an organization is enrolled
1035+
in the zero data retention program).
10161036
10171037
instructions: Inserts a system (or developer) message as the first item in the model's
10181038
context.
@@ -1204,6 +1224,11 @@ async def create(
12041224
- `message.input_image.image_url`: Include image urls from the input message.
12051225
- `computer_call_output.output.image_url`: Include image urls from the computer
12061226
call output.
1227+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
1228+
tokens in reasoning item outputs. This enables reasoning items to be used in
1229+
multi-turn conversations when using the Responses API statelessly (like when
1230+
the `store` parameter is set to `false`, or when an organization is enrolled
1231+
in the zero data retention program).
12071232
12081233
instructions: Inserts a system (or developer) message as the first item in the model's
12091234
context.
@@ -1388,6 +1413,11 @@ async def create(
13881413
- `message.input_image.image_url`: Include image urls from the input message.
13891414
- `computer_call_output.output.image_url`: Include image urls from the computer
13901415
call output.
1416+
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
1417+
tokens in reasoning item outputs. This enables reasoning items to be used in
1418+
multi-turn conversations when using the Responses API statelessly (like when
1419+
the `store` parameter is set to `false`, or when an organization is enrolled
1420+
in the zero data retention program).
13911421
13921422
instructions: Inserts a system (or developer) message as the first item in the model's
13931423
context.

src/openai/types/audio/speech_create_params.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ class SpeechCreateParams(TypedDict, total=False):
4848
speed: float
4949
"""The speed of the generated audio.
5050
51-
Select a value from `0.25` to `4.0`. `1.0` is the default.
51+
Select a value from `0.25` to `4.0`. `1.0` is the default. Does not work with
52+
`gpt-4o-mini-tts`.
5253
"""

0 commit comments

Comments
 (0)