Skip to content

release: 1.88.1 #2417

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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.88.0"
".": "1.88.1"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 1.88.1 (2025-06-18)

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

### Bug Fixes

* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([35bcc4b](https://github.com/openai/openai-python/commit/35bcc4b80bdbaa31108650f2a515902e83794e5a))


### Chores

* **readme:** update badges ([68044ee](https://github.com/openai/openai-python/commit/68044ee85d1bf324b17d3f60c914df4725d47fc8))

## 1.88.0 (2025-06-17)

Full Changelog: [v1.87.0...v1.88.0](https://github.com/openai/openai-python/compare/v1.87.0...v1.88.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenAI Python API library

[![PyPI version](https://img.shields.io/pypi/v/openai.svg)](https://pypi.org/project/openai/)
[![PyPI version](<https://img.shields.io/pypi/v/openai.svg?label=pypi%20(stable)>)](https://pypi.org/project/openai/)

The OpenAI Python library provides convenient access to the OpenAI REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
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.88.0"
version = "1.88.1"
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.88.0" # x-release-please-version
__version__ = "1.88.1" # x-release-please-version
129 changes: 40 additions & 89 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@

from openai import OpenAI, AsyncOpenAI, APIResponseValidationError
from openai._types import Omit
from openai._utils import maybe_transform
from openai._models import BaseModel, FinalRequestOptions
from openai._constants import RAW_RESPONSE_HEADER
from openai._streaming import Stream, AsyncStream
from openai._exceptions import OpenAIError, APIStatusError, APITimeoutError, APIResponseValidationError
from openai._base_client import (
Expand All @@ -36,7 +34,6 @@
DefaultAsyncHttpxClient,
make_request_options,
)
from openai.types.chat.completion_create_params import CompletionCreateParamsNonStreaming

from .utils import update_env

Expand Down Expand Up @@ -725,60 +722,37 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str

@mock.patch("openai._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: OpenAI) -> None:
respx_mock.post("/chat/completions").mock(side_effect=httpx.TimeoutException("Test timeout error"))

with pytest.raises(APITimeoutError):
self.client.post(
"/chat/completions",
body=cast(
object,
maybe_transform(
dict(
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="gpt-4o",
),
CompletionCreateParamsNonStreaming,
),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
client.chat.completions.with_streaming_response.create(
messages=[
{
"content": "string",
"role": "developer",
}
],
model="gpt-4o",
).__enter__()

assert _get_open_connections(self.client) == 0

@mock.patch("openai._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: OpenAI) -> None:
respx_mock.post("/chat/completions").mock(return_value=httpx.Response(500))

with pytest.raises(APIStatusError):
self.client.post(
"/chat/completions",
body=cast(
object,
maybe_transform(
dict(
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="gpt-4o",
),
CompletionCreateParamsNonStreaming,
),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)

client.chat.completions.with_streaming_response.create(
messages=[
{
"content": "string",
"role": "developer",
}
],
model="gpt-4o",
).__enter__()
assert _get_open_connections(self.client) == 0

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
Expand Down Expand Up @@ -1647,60 +1621,37 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte

@mock.patch("openai._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncOpenAI) -> None:
respx_mock.post("/chat/completions").mock(side_effect=httpx.TimeoutException("Test timeout error"))

with pytest.raises(APITimeoutError):
await self.client.post(
"/chat/completions",
body=cast(
object,
maybe_transform(
dict(
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="gpt-4o",
),
CompletionCreateParamsNonStreaming,
),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)
await async_client.chat.completions.with_streaming_response.create(
messages=[
{
"content": "string",
"role": "developer",
}
],
model="gpt-4o",
).__aenter__()

assert _get_open_connections(self.client) == 0

@mock.patch("openai._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None:
async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, async_client: AsyncOpenAI) -> None:
respx_mock.post("/chat/completions").mock(return_value=httpx.Response(500))

with pytest.raises(APIStatusError):
await self.client.post(
"/chat/completions",
body=cast(
object,
maybe_transform(
dict(
messages=[
{
"role": "user",
"content": "Say this is a test",
}
],
model="gpt-4o",
),
CompletionCreateParamsNonStreaming,
),
),
cast_to=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
)

await async_client.chat.completions.with_streaming_response.create(
messages=[
{
"content": "string",
"role": "developer",
}
],
model="gpt-4o",
).__aenter__()
assert _get_open_connections(self.client) == 0

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
Expand Down