Skip to content
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 @@
{
".": "2.17.0"
".": "2.18.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: 137
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-64c3a646eb5dcad2b7ff7bd976c0e312b886676a542f6ffcd9a6c8503ae24c58.yml
openapi_spec_hash: 91b1b7bf3c1a6b6c9c7507d4cac8fe2a
config_hash: f8e6baff429cf000b8e4ba1da08dff47
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-bff810f46da56eff8d5e189b0d1f56ac07a8289723666138549d4239cad7c2ea.yml
openapi_spec_hash: 7532ce5a6f490c8f5d1e079c76c70535
config_hash: a1454ffd9612dee11f9d5a98e55eac9e
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2.18.0 (2026-02-09)

Full Changelog: [v2.17.0...v2.18.0](https://github.com/openai/openai-python/compare/v2.17.0...v2.18.0)

### Features

* **api:** add context_management to responses ([137e992](https://github.com/openai/openai-python/commit/137e992b80956401d1867274fa7a0969edfdba54))
* **api:** responses context_management ([c3bd017](https://github.com/openai/openai-python/commit/c3bd017318347af0a0105a7e975c8d91e22f7941))

## 2.17.0 (2026-02-05)

Full Changelog: [v2.16.0...v2.17.0](https://github.com/openai/openai-python/compare/v2.16.0...v2.17.0)
Expand Down
5 changes: 1 addition & 4 deletions examples/realtime/azure_realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ async def main() -> None:
# The APIs are compatible with the OpenAI client library.
# You can use the OpenAI client library to access the Azure OpenAI APIs.
# Make sure to set the baseURL and apiKey to use the Azure OpenAI endpoint and token.
client = AsyncOpenAI(
websocket_base_url=base_url,
api_key=token
)
client = AsyncOpenAI(websocket_base_url=base_url, api_key=token)
async with client.realtime.connect(
model=deployment_name,
) as connection:
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 = "2.17.0"
version = "2.18.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__ = "2.17.0" # x-release-please-version
__version__ = "2.18.0" # x-release-please-version
24 changes: 12 additions & 12 deletions src/openai/resources/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def edit(
input_fidelity: Control how much effort the model will exert to match the style and features,
especially facial features, of input images. This parameter is only supported
for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
`low`. Defaults to `low`.
for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
`gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
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,
Expand Down Expand Up @@ -291,8 +291,8 @@ def edit(
input_fidelity: Control how much effort the model will exert to match the style and features,
especially facial features, of input images. This parameter is only supported
for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
`low`. Defaults to `low`.
for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
`gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
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,
Expand Down Expand Up @@ -406,8 +406,8 @@ def edit(
input_fidelity: Control how much effort the model will exert to match the style and features,
especially facial features, of input images. This parameter is only supported
for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
`low`. Defaults to `low`.
for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
`gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
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,
Expand Down Expand Up @@ -1068,8 +1068,8 @@ async def edit(
input_fidelity: Control how much effort the model will exert to match the style and features,
especially facial features, of input images. This parameter is only supported
for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
`low`. Defaults to `low`.
for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
`gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
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,
Expand Down Expand Up @@ -1187,8 +1187,8 @@ async def edit(
input_fidelity: Control how much effort the model will exert to match the style and features,
especially facial features, of input images. This parameter is only supported
for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
`low`. Defaults to `low`.
for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
`gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
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,
Expand Down Expand Up @@ -1302,8 +1302,8 @@ async def edit(
input_fidelity: Control how much effort the model will exert to match the style and features,
especially facial features, of input images. This parameter is only supported
for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and
`low`. Defaults to `low`.
for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for
`gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
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,
Expand Down
34 changes: 34 additions & 0 deletions src/openai/resources/responses/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def create(
self,
*,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -147,6 +148,8 @@ def create(
background: Whether to run the model response in the background.
[Learn more](https://platform.openai.com/docs/guides/background).
context_management: Context management configuration for this request.
conversation: The conversation that this response belongs to. Items from this conversation are
prepended to `input_items` for this response request. Input items and output
items from this response are automatically added to this conversation after this
Expand Down Expand Up @@ -341,6 +344,7 @@ def create(
*,
stream: Literal[True],
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -399,6 +403,8 @@ def create(
background: Whether to run the model response in the background.
[Learn more](https://platform.openai.com/docs/guides/background).
context_management: Context management configuration for this request.
conversation: The conversation that this response belongs to. Items from this conversation are
prepended to `input_items` for this response request. Input items and output
items from this response are automatically added to this conversation after this
Expand Down Expand Up @@ -586,6 +592,7 @@ def create(
*,
stream: bool,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -644,6 +651,8 @@ def create(
background: Whether to run the model response in the background.
[Learn more](https://platform.openai.com/docs/guides/background).
context_management: Context management configuration for this request.
conversation: The conversation that this response belongs to. Items from this conversation are
prepended to `input_items` for this response request. Input items and output
items from this response are automatically added to this conversation after this
Expand Down Expand Up @@ -829,6 +838,7 @@ def create(
self,
*,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -868,6 +878,7 @@ def create(
body=maybe_transform(
{
"background": background,
"context_management": context_management,
"conversation": conversation,
"include": include,
"input": input,
Expand Down Expand Up @@ -930,6 +941,7 @@ def stream(
input: Union[str, ResponseInputParam],
model: ResponsesModel,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
text_format: type[TextFormatT] | Omit = omit,
tools: Iterable[ParseableToolParam] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
Expand Down Expand Up @@ -970,6 +982,7 @@ def stream(
input: Union[str, ResponseInputParam] | Omit = omit,
model: ResponsesModel | Omit = omit,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
text_format: type[TextFormatT] | Omit = omit,
tools: Iterable[ParseableToolParam] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
Expand Down Expand Up @@ -1006,6 +1019,7 @@ def stream(
new_response_args = {
"input": input,
"model": model,
"context_management": context_management,
"conversation": conversation,
"include": include,
"instructions": instructions,
Expand Down Expand Up @@ -1061,6 +1075,7 @@ def stream(
input=input,
model=model,
tools=tools,
context_management=context_management,
conversation=conversation,
include=include,
instructions=instructions,
Expand Down Expand Up @@ -1118,6 +1133,7 @@ def parse(
*,
text_format: type[TextFormatT] | Omit = omit,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -1176,6 +1192,7 @@ def parser(raw_response: Response) -> ParsedResponse[TextFormatT]:
body=maybe_transform(
{
"background": background,
"context_management": context_management,
"conversation": conversation,
"include": include,
"input": input,
Expand Down Expand Up @@ -1709,6 +1726,7 @@ async def create(
self,
*,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -1761,6 +1779,8 @@ async def create(
background: Whether to run the model response in the background.
[Learn more](https://platform.openai.com/docs/guides/background).
context_management: Context management configuration for this request.
conversation: The conversation that this response belongs to. Items from this conversation are
prepended to `input_items` for this response request. Input items and output
items from this response are automatically added to this conversation after this
Expand Down Expand Up @@ -1955,6 +1975,7 @@ async def create(
*,
stream: Literal[True],
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -2013,6 +2034,8 @@ async def create(
background: Whether to run the model response in the background.
[Learn more](https://platform.openai.com/docs/guides/background).
context_management: Context management configuration for this request.
conversation: The conversation that this response belongs to. Items from this conversation are
prepended to `input_items` for this response request. Input items and output
items from this response are automatically added to this conversation after this
Expand Down Expand Up @@ -2200,6 +2223,7 @@ async def create(
*,
stream: bool,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -2258,6 +2282,8 @@ async def create(
background: Whether to run the model response in the background.
[Learn more](https://platform.openai.com/docs/guides/background).
context_management: Context management configuration for this request.
conversation: The conversation that this response belongs to. Items from this conversation are
prepended to `input_items` for this response request. Input items and output
items from this response are automatically added to this conversation after this
Expand Down Expand Up @@ -2443,6 +2469,7 @@ async def create(
self,
*,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -2482,6 +2509,7 @@ async def create(
body=await async_maybe_transform(
{
"background": background,
"context_management": context_management,
"conversation": conversation,
"include": include,
"input": input,
Expand Down Expand Up @@ -2544,6 +2572,7 @@ def stream(
input: Union[str, ResponseInputParam],
model: ResponsesModel,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
text_format: type[TextFormatT] | Omit = omit,
tools: Iterable[ParseableToolParam] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
Expand Down Expand Up @@ -2584,6 +2613,7 @@ def stream(
input: Union[str, ResponseInputParam] | Omit = omit,
model: ResponsesModel | Omit = omit,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
text_format: type[TextFormatT] | Omit = omit,
tools: Iterable[ParseableToolParam] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
Expand Down Expand Up @@ -2620,6 +2650,7 @@ def stream(
new_response_args = {
"input": input,
"model": model,
"context_management": context_management,
"conversation": conversation,
"include": include,
"instructions": instructions,
Expand Down Expand Up @@ -2675,6 +2706,7 @@ def stream(
model=model,
stream=True,
tools=tools,
context_management=context_management,
conversation=conversation,
include=include,
instructions=instructions,
Expand Down Expand Up @@ -2736,6 +2768,7 @@ async def parse(
*,
text_format: type[TextFormatT] | Omit = omit,
background: Optional[bool] | Omit = omit,
context_management: Optional[Iterable[response_create_params.ContextManagement]] | Omit = omit,
conversation: Optional[response_create_params.Conversation] | Omit = omit,
include: Optional[List[ResponseIncludable]] | Omit = omit,
input: Union[str, ResponseInputParam] | Omit = omit,
Expand Down Expand Up @@ -2794,6 +2827,7 @@ def parser(raw_response: Response) -> ParsedResponse[TextFormatT]:
body=maybe_transform(
{
"background": background,
"context_management": context_management,
"conversation": conversation,
"include": include,
"input": input,
Expand Down
Loading