Skip to content

release: 1.77.0 #2335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.76.2"
".": "1.77.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 97
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml
openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03
config_hash: b597cd9a31e9e5ec709e2eefb4c54122
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml
openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6
config_hash: d9b6b6e6bc85744663e300eebc482067
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 1.77.0 (2025-05-02)

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

### Features

* **api:** add image sizes, reasoning encryption ([473469a](https://github.com/openai/openai-python/commit/473469afa1a5f0a03f727bdcdadb9fd57872f9c5))


### Bug Fixes

* **parsing:** handle whitespace only strings ([#2007](https://github.com/openai/openai-python/issues/2007)) ([246bc5b](https://github.com/openai/openai-python/commit/246bc5b7559887840717667a0dad465caef66c3b))


### Chores

* only strip leading whitespace ([8467d66](https://github.com/openai/openai-python/commit/8467d666e0ddf1a9f81b8769a5c8a2fef1de20c1))

## 1.76.2 (2025-04-29)

Full Changelog: [v1.76.1...v1.76.2](https://github.com/openai/openai-python/compare/v1.76.1...v1.76.2)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openai"
version = "1.76.2"
version = "1.77.0"
description = "The official Python library for the openai API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/openai/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "openai"
__version__ = "1.76.2" # x-release-please-version
__version__ = "1.77.0" # x-release-please-version
2 changes: 2 additions & 0 deletions src/openai/lib/streaming/chat/_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ def _accumulate_chunk(self, chunk: ChatCompletionChunk) -> ParsedChatCompletionS
choice_snapshot.message.content
and not choice_snapshot.message.refusal
and is_given(self._rich_response_format)
# partial parsing fails on white-space
and choice_snapshot.message.content.lstrip()
):
choice_snapshot.message.parsed = from_json(
bytes(choice_snapshot.message.content, "utf-8"),
Expand Down
4 changes: 2 additions & 2 deletions src/openai/resources/audio/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def create(
`wav`, and `pcm`.

speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
the default.
the default. Does not work with `gpt-4o-mini-tts`.

extra_headers: Send extra headers

Expand Down Expand Up @@ -176,7 +176,7 @@ async def create(
`wav`, and `pcm`.

speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
the default.
the default. Does not work with `gpt-4o-mini-tts`.

extra_headers: Send extra headers

Expand Down
48 changes: 38 additions & 10 deletions src/openai/resources/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ def edit(
*,
image: Union[FileTypes, List[FileTypes]],
prompt: str,
background: Optional[Literal["transparent", "opaque", "auto"]] | NotGiven = NOT_GIVEN,
mask: FileTypes | NotGiven = NOT_GIVEN,
model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
n: Optional[int] | NotGiven = NOT_GIVEN,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | NotGiven = NOT_GIVEN,
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
size: Optional[Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"]]
| NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -139,14 +141,25 @@ def edit(
This endpoint only supports `gpt-image-1` and `dall-e-2`.

Args:
image: The image(s) to edit. Must be a supported image file or an array of images. For
`gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
25MB. For `dall-e-2`, you can only provide one image, and it should be a square
`png` file less than 4MB.
image: The image(s) to edit. Must be a supported image file or an array of images.

For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
25MB. You can provide up to 16 images.

For `dall-e-2`, you can only provide one image, and it should be a square `png`
file less than 4MB.

prompt: A text description of the desired image(s). The maximum length is 1000
characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.

background: Allows to set transparency for the background of the generated image(s). This
parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
`opaque` or `auto` (default value). When `auto` is used, the model will
automatically determine the best background for the image.

If `transparent`, the output format needs to support transparency, so it should
be set to either `png` (default value) or `webp`.

mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
indicate where `image` should be edited. If there are multiple images provided,
the mask will be applied on the first image. Must be a valid PNG file, less than
Expand Down Expand Up @@ -187,6 +200,7 @@ def edit(
{
"image": image,
"prompt": prompt,
"background": background,
"mask": mask,
"model": model,
"n": n,
Expand Down Expand Up @@ -429,12 +443,14 @@ async def edit(
*,
image: Union[FileTypes, List[FileTypes]],
prompt: str,
background: Optional[Literal["transparent", "opaque", "auto"]] | NotGiven = NOT_GIVEN,
mask: FileTypes | NotGiven = NOT_GIVEN,
model: Union[str, ImageModel, None] | NotGiven = NOT_GIVEN,
n: Optional[int] | NotGiven = NOT_GIVEN,
quality: Optional[Literal["standard", "low", "medium", "high", "auto"]] | NotGiven = NOT_GIVEN,
response_format: Optional[Literal["url", "b64_json"]] | NotGiven = NOT_GIVEN,
size: Optional[Literal["256x256", "512x512", "1024x1024"]] | NotGiven = NOT_GIVEN,
size: Optional[Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"]]
| NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -449,14 +465,25 @@ async def edit(
This endpoint only supports `gpt-image-1` and `dall-e-2`.

Args:
image: The image(s) to edit. Must be a supported image file or an array of images. For
`gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
25MB. For `dall-e-2`, you can only provide one image, and it should be a square
`png` file less than 4MB.
image: The image(s) to edit. Must be a supported image file or an array of images.

For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
25MB. You can provide up to 16 images.

For `dall-e-2`, you can only provide one image, and it should be a square `png`
file less than 4MB.

prompt: A text description of the desired image(s). The maximum length is 1000
characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.

background: Allows to set transparency for the background of the generated image(s). This
parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
`opaque` or `auto` (default value). When `auto` is used, the model will
automatically determine the best background for the image.

If `transparent`, the output format needs to support transparency, so it should
be set to either `png` (default value) or `webp`.

mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
indicate where `image` should be edited. If there are multiple images provided,
the mask will be applied on the first image. Must be a valid PNG file, less than
Expand Down Expand Up @@ -497,6 +524,7 @@ async def edit(
{
"image": image,
"prompt": prompt,
"background": background,
"mask": mask,
"model": model,
"n": n,
Expand Down
30 changes: 30 additions & 0 deletions src/openai/resources/responses/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ def create(
- `message.input_image.image_url`: Include image urls from the input message.
- `computer_call_output.output.image_url`: Include image urls from the computer
call output.
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
tokens in reasoning item outputs. This enables reasoning items to be used in
multi-turn conversations when using the Responses API statelessly (like when
the `store` parameter is set to `false`, or when an organization is enrolled
in the zero data retention program).

instructions: Inserts a system (or developer) message as the first item in the model's
context.
Expand Down Expand Up @@ -331,6 +336,11 @@ def create(
- `message.input_image.image_url`: Include image urls from the input message.
- `computer_call_output.output.image_url`: Include image urls from the computer
call output.
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
tokens in reasoning item outputs. This enables reasoning items to be used in
multi-turn conversations when using the Responses API statelessly (like when
the `store` parameter is set to `false`, or when an organization is enrolled
in the zero data retention program).

instructions: Inserts a system (or developer) message as the first item in the model's
context.
Expand Down Expand Up @@ -515,6 +525,11 @@ def create(
- `message.input_image.image_url`: Include image urls from the input message.
- `computer_call_output.output.image_url`: Include image urls from the computer
call output.
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
tokens in reasoning item outputs. This enables reasoning items to be used in
multi-turn conversations when using the Responses API statelessly (like when
the `store` parameter is set to `false`, or when an organization is enrolled
in the zero data retention program).

instructions: Inserts a system (or developer) message as the first item in the model's
context.
Expand Down Expand Up @@ -1013,6 +1028,11 @@ async def create(
- `message.input_image.image_url`: Include image urls from the input message.
- `computer_call_output.output.image_url`: Include image urls from the computer
call output.
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
tokens in reasoning item outputs. This enables reasoning items to be used in
multi-turn conversations when using the Responses API statelessly (like when
the `store` parameter is set to `false`, or when an organization is enrolled
in the zero data retention program).

instructions: Inserts a system (or developer) message as the first item in the model's
context.
Expand Down Expand Up @@ -1204,6 +1224,11 @@ async def create(
- `message.input_image.image_url`: Include image urls from the input message.
- `computer_call_output.output.image_url`: Include image urls from the computer
call output.
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
tokens in reasoning item outputs. This enables reasoning items to be used in
multi-turn conversations when using the Responses API statelessly (like when
the `store` parameter is set to `false`, or when an organization is enrolled
in the zero data retention program).

instructions: Inserts a system (or developer) message as the first item in the model's
context.
Expand Down Expand Up @@ -1388,6 +1413,11 @@ async def create(
- `message.input_image.image_url`: Include image urls from the input message.
- `computer_call_output.output.image_url`: Include image urls from the computer
call output.
- `reasoning.encrypted_content`: Includes an encrypted version of reasoning
tokens in reasoning item outputs. This enables reasoning items to be used in
multi-turn conversations when using the Responses API statelessly (like when
the `store` parameter is set to `false`, or when an organization is enrolled
in the zero data retention program).

instructions: Inserts a system (or developer) message as the first item in the model's
context.
Expand Down
3 changes: 2 additions & 1 deletion src/openai/types/audio/speech_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ class SpeechCreateParams(TypedDict, total=False):
speed: float
"""The speed of the generated audio.
Select a value from `0.25` to `4.0`. `1.0` is the default.
Select a value from `0.25` to `4.0`. `1.0` is the default. Does not work with
`gpt-4o-mini-tts`.
"""
24 changes: 18 additions & 6 deletions src/openai/types/image_edit_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@

class ImageEditParams(TypedDict, total=False):
image: Required[Union[FileTypes, List[FileTypes]]]
"""The image(s) to edit.
"""The image(s) to edit. Must be a supported image file or an array of images.

Must be a supported image file or an array of images. For `gpt-image-1`, each
image should be a `png`, `webp`, or `jpg` file less than 25MB. For `dall-e-2`,
you can only provide one image, and it should be a square `png` file less than
4MB.
For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
25MB. You can provide up to 16 images.

For `dall-e-2`, you can only provide one image, and it should be a square `png`
file less than 4MB.
"""

prompt: Required[str]
Expand All @@ -28,6 +29,17 @@ class ImageEditParams(TypedDict, total=False):
`gpt-image-1`.
"""

background: Optional[Literal["transparent", "opaque", "auto"]]
"""Allows to set transparency for the background of the generated image(s).

This parameter is only supported for `gpt-image-1`. Must be one of
`transparent`, `opaque` or `auto` (default value). When `auto` is used, the
model will automatically determine the best background for the image.

If `transparent`, the output format needs to support transparency, so it should
be set to either `png` (default value) or `webp`.
"""

mask: FileTypes
"""An additional image whose fully transparent areas (e.g.

Expand Down Expand Up @@ -61,7 +73,7 @@ class ImageEditParams(TypedDict, total=False):
`gpt-image-1` will always return base64-encoded images.
"""

size: Optional[Literal["256x256", "512x512", "1024x1024"]]
size: Optional[Literal["256x256", "512x512", "1024x1024", "1536x1024", "1024x1536", "auto"]]
"""The size of the generated images.

Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or
Expand Down
6 changes: 3 additions & 3 deletions src/openai/types/responses/computer_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@


class ComputerTool(BaseModel):
display_height: float
display_height: int
"""The height of the computer display."""

display_width: float
display_width: int
"""The width of the computer display."""

environment: Literal["mac", "windows", "ubuntu", "browser"]
environment: Literal["windows", "mac", "linux", "ubuntu", "browser"]
"""The type of computer environment to control."""

type: Literal["computer_use_preview"]
Expand Down
6 changes: 3 additions & 3 deletions src/openai/types/responses/computer_tool_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@


class ComputerToolParam(TypedDict, total=False):
display_height: Required[float]
display_height: Required[int]
"""The height of the computer display."""

display_width: Required[float]
display_width: Required[int]
"""The width of the computer display."""

environment: Required[Literal["mac", "windows", "ubuntu", "browser"]]
environment: Required[Literal["windows", "mac", "linux", "ubuntu", "browser"]]
"""The type of computer environment to control."""

type: Required[Literal["computer_use_preview"]]
Expand Down
12 changes: 6 additions & 6 deletions src/openai/types/responses/file_search_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@

__all__ = ["FileSearchTool", "Filters", "RankingOptions"]

Filters: TypeAlias = Union[ComparisonFilter, CompoundFilter]
Filters: TypeAlias = Union[ComparisonFilter, CompoundFilter, None]


class RankingOptions(BaseModel):
ranker: Optional[Literal["auto", "default-2024-11-15"]] = None
"""The ranker to use for the file search."""

score_threshold: Optional[float] = None
"""
The score threshold for the file search, a number between 0 and 1. Numbers
closer to 1 will attempt to return only the most relevant results, but may
return fewer results.
"""The score threshold for the file search, a number between 0 and 1.
Numbers closer to 1 will attempt to return only the most relevant results, but
may return fewer results.
"""


Expand All @@ -32,7 +32,7 @@ class FileSearchTool(BaseModel):
"""The IDs of the vector stores to search."""

filters: Optional[Filters] = None
"""A filter to apply based on file attributes."""
"""A filter to apply."""

max_num_results: Optional[int] = None
"""The maximum number of results to return.
Expand Down
Loading