From 5544a4837f28159d5133677cc398681a8cd4fe0f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Feb 2026 14:48:19 +0000 Subject: [PATCH 1/5] codegen metadata --- .stats.yml | 2 +- .../resources/vector_stores/file_batches.py | 40 ++++++++++++++++--- src/openai/resources/vector_stores/files.py | 30 +++++++++++++- .../vector_stores/test_file_batches.py | 11 +++++ .../api_resources/vector_stores/test_files.py | 1 - 5 files changed, 74 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index d9e272c17f..b1253c1855 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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 +config_hash: e7976c555732f55dc92f3aa09558ef9d diff --git a/src/openai/resources/vector_stores/file_batches.py b/src/openai/resources/vector_stores/file_batches.py index d31fb59bec..fca1ef89fa 100644 --- a/src/openai/resources/vector_stores/file_batches.py +++ b/src/openai/resources/vector_stores/file_batches.py @@ -194,15 +194,29 @@ def create_and_poll( self, vector_store_id: str, *, - file_ids: SequenceNotStr[str], - poll_interval_ms: int | Omit = omit, + attributes: Optional[Dict[str, Union[str, float, bool]]] | Omit = omit, chunking_strategy: FileChunkingStrategyParam | Omit = omit, + file_ids: SequenceNotStr[str] | Omit = omit, + files: Iterable[file_batch_create_params.File] | Omit = omit, + poll_interval_ms: int | Omit = omit, + # 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStoreFileBatch: """Create a vector store batch and poll until all files have been processed.""" batch = self.create( vector_store_id=vector_store_id, - file_ids=file_ids, + attributes=attributes, chunking_strategy=chunking_strategy, + file_ids=file_ids, + files=files, + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, ) # TODO: don't poll unless necessary?? return self.poll( @@ -539,15 +553,29 @@ async def create_and_poll( self, vector_store_id: str, *, - file_ids: SequenceNotStr[str], - poll_interval_ms: int | Omit = omit, + attributes: Optional[Dict[str, Union[str, float, bool]]] | Omit = omit, chunking_strategy: FileChunkingStrategyParam | Omit = omit, + file_ids: SequenceNotStr[str] | Omit = omit, + files: Iterable[file_batch_create_params.File] | Omit = omit, + poll_interval_ms: int | Omit = omit, + # 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStoreFileBatch: """Create a vector store batch and poll until all files have been processed.""" batch = await self.create( vector_store_id=vector_store_id, - file_ids=file_ids, + attributes=attributes, chunking_strategy=chunking_strategy, + file_ids=file_ids, + files=files, + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, ) # TODO: don't poll unless necessary?? return await self.poll( diff --git a/src/openai/resources/vector_stores/files.py b/src/openai/resources/vector_stores/files.py index d2eb4e16ed..29f6e879f1 100644 --- a/src/openai/resources/vector_stores/files.py +++ b/src/openai/resources/vector_stores/files.py @@ -307,10 +307,23 @@ def create_and_poll( attributes: Optional[Dict[str, Union[str, float, bool]]] | Omit = omit, poll_interval_ms: int | Omit = omit, chunking_strategy: FileChunkingStrategyParam | Omit = omit, + # 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStoreFile: """Attach a file to the given vector store and wait for it to be processed.""" self.create( - vector_store_id=vector_store_id, file_id=file_id, chunking_strategy=chunking_strategy, attributes=attributes + vector_store_id=vector_store_id, + file_id=file_id, + chunking_strategy=chunking_strategy, + attributes=attributes, + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, ) return self.poll( @@ -715,10 +728,23 @@ async def create_and_poll( attributes: Optional[Dict[str, Union[str, float, bool]]] | Omit = omit, poll_interval_ms: int | Omit = omit, chunking_strategy: FileChunkingStrategyParam | Omit = omit, + # 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStoreFile: """Attach a file to the given vector store and wait for it to be processed.""" await self.create( - vector_store_id=vector_store_id, file_id=file_id, chunking_strategy=chunking_strategy, attributes=attributes + vector_store_id=vector_store_id, + file_id=file_id, + chunking_strategy=chunking_strategy, + attributes=attributes, + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, ) return await self.poll( diff --git a/tests/api_resources/vector_stores/test_file_batches.py b/tests/api_resources/vector_stores/test_file_batches.py index abbefc20e9..f647782822 100644 --- a/tests/api_resources/vector_stores/test_file_batches.py +++ b/tests/api_resources/vector_stores/test_file_batches.py @@ -9,6 +9,7 @@ from openai import OpenAI, AsyncOpenAI from tests.utils import assert_matches_type +from openai._utils import assert_signatures_in_sync from openai.pagination import SyncCursorPage, AsyncCursorPage from openai.types.vector_stores import ( VectorStoreFile, @@ -450,3 +451,13 @@ async def test_path_params_list_files(self, async_client: AsyncOpenAI) -> None: batch_id="", vector_store_id="vector_store_id", ) + + +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +def test_create_and_poll_method_in_sync(sync: bool, client: OpenAI, async_client: AsyncOpenAI) -> None: + checking_client: OpenAI | AsyncOpenAI = client if sync else async_client + + assert_signatures_in_sync( + checking_client.vector_stores.file_batches.create, + checking_client.vector_stores.file_batches.create_and_poll, + ) diff --git a/tests/api_resources/vector_stores/test_files.py b/tests/api_resources/vector_stores/test_files.py index 7394b50d95..53aa5ee041 100644 --- a/tests/api_resources/vector_stores/test_files.py +++ b/tests/api_resources/vector_stores/test_files.py @@ -635,7 +635,6 @@ def test_create_and_poll_method_in_sync(sync: bool, client: OpenAI, async_client assert_signatures_in_sync( checking_client.vector_stores.files.create, checking_client.vector_stores.files.create_and_poll, - exclude_params={"extra_headers", "extra_query", "extra_body", "timeout"}, ) From 17e7c65785bc777f99b9791bbb6cdbf1b4bec55d Mon Sep 17 00:00:00 2001 From: Alex Chang Date: Fri, 6 Feb 2026 09:56:33 -0500 Subject: [PATCH 2/5] test note --- examples/realtime/azure_realtime.py | 5 +---- tests/api_resources/vector_stores/test_file_batches.py | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/examples/realtime/azure_realtime.py b/examples/realtime/azure_realtime.py index 177c24fdfa..a8bcf4c536 100644 --- a/examples/realtime/azure_realtime.py +++ b/examples/realtime/azure_realtime.py @@ -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: diff --git a/tests/api_resources/vector_stores/test_file_batches.py b/tests/api_resources/vector_stores/test_file_batches.py index f647782822..c1fba534a6 100644 --- a/tests/api_resources/vector_stores/test_file_batches.py +++ b/tests/api_resources/vector_stores/test_file_batches.py @@ -457,6 +457,7 @@ async def test_path_params_list_files(self, async_client: AsyncOpenAI) -> None: def test_create_and_poll_method_in_sync(sync: bool, client: OpenAI, async_client: AsyncOpenAI) -> None: checking_client: OpenAI | AsyncOpenAI = client if sync else async_client + # ensure helpers do not drift from generated spec assert_signatures_in_sync( checking_client.vector_stores.file_batches.create, checking_client.vector_stores.file_batches.create_and_poll, From 137e992b80956401d1867274fa7a0969edfdba54 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Feb 2026 18:33:34 +0000 Subject: [PATCH 3/5] feat(api): add context_management to responses --- src/openai/resources/responses/responses.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/openai/resources/responses/responses.py b/src/openai/resources/responses/responses.py index 8e80f6793b..1c877d8808 100644 --- a/src/openai/resources/responses/responses.py +++ b/src/openai/resources/responses/responses.py @@ -930,6 +930,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, @@ -970,6 +971,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, @@ -1006,6 +1008,7 @@ def stream( new_response_args = { "input": input, "model": model, + "context_management": context_management, "conversation": conversation, "include": include, "instructions": instructions, @@ -1061,6 +1064,7 @@ def stream( input=input, model=model, tools=tools, + context_management=context_management, conversation=conversation, include=include, instructions=instructions, @@ -1118,6 +1122,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, @@ -1176,6 +1181,7 @@ def parser(raw_response: Response) -> ParsedResponse[TextFormatT]: body=maybe_transform( { "background": background, + "context_management": context_management, "conversation": conversation, "include": include, "input": input, @@ -2544,6 +2550,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, @@ -2584,6 +2591,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, @@ -2620,6 +2628,7 @@ def stream( new_response_args = { "input": input, "model": model, + "context_management": context_management, "conversation": conversation, "include": include, "instructions": instructions, @@ -2675,6 +2684,7 @@ def stream( model=model, stream=True, tools=tools, + context_management=context_management, conversation=conversation, include=include, instructions=instructions, @@ -2736,6 +2746,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, @@ -2794,6 +2805,7 @@ def parser(raw_response: Response) -> ParsedResponse[TextFormatT]: body=maybe_transform( { "background": background, + "context_management": context_management, "conversation": conversation, "include": include, "input": input, From c3bd017318347af0a0105a7e975c8d91e22f7941 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Feb 2026 20:49:07 +0000 Subject: [PATCH 4/5] feat(api): responses context_management --- .stats.yml | 6 ++--- src/openai/resources/images.py | 24 +++++++++---------- src/openai/resources/responses/responses.py | 22 +++++++++++++++++ src/openai/types/image_edit_params.py | 4 ++-- .../types/responses/response_create_params.py | 12 ++++++++++ src/openai/types/responses/tool.py | 4 ++-- src/openai/types/responses/tool_param.py | 4 ++-- tests/api_resources/test_responses.py | 24 +++++++++++++++++++ 8 files changed, 79 insertions(+), 21 deletions(-) diff --git a/.stats.yml b/.stats.yml index b1253c1855..fce116bc4f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -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: e7976c555732f55dc92f3aa09558ef9d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-bff810f46da56eff8d5e189b0d1f56ac07a8289723666138549d4239cad7c2ea.yml +openapi_spec_hash: 7532ce5a6f490c8f5d1e079c76c70535 +config_hash: a1454ffd9612dee11f9d5a98e55eac9e diff --git a/src/openai/resources/images.py b/src/openai/resources/images.py index 805828488f..3de5185a87 100644 --- a/src/openai/resources/images.py +++ b/src/openai/resources/images.py @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/src/openai/resources/responses/responses.py b/src/openai/resources/responses/responses.py index 1c877d8808..79034b7e18 100644 --- a/src/openai/resources/responses/responses.py +++ b/src/openai/resources/responses/responses.py @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -868,6 +878,7 @@ def create( body=maybe_transform( { "background": background, + "context_management": context_management, "conversation": conversation, "include": include, "input": input, @@ -1715,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, @@ -1767,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 @@ -1961,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, @@ -2019,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 @@ -2206,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, @@ -2264,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 @@ -2449,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, @@ -2488,6 +2509,7 @@ async def create( body=await async_maybe_transform( { "background": background, + "context_management": context_management, "conversation": conversation, "include": include, "input": input, diff --git a/src/openai/types/image_edit_params.py b/src/openai/types/image_edit_params.py index 0bd5f39fac..916fbc1411 100644 --- a/src/openai/types/image_edit_params.py +++ b/src/openai/types/image_edit_params.py @@ -45,8 +45,8 @@ class ImageEditParamsBase(TypedDict, total=False): """ 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: FileTypes diff --git a/src/openai/types/responses/response_create_params.py b/src/openai/types/responses/response_create_params.py index 15844c6597..97aaf9dc3a 100644 --- a/src/openai/types/responses/response_create_params.py +++ b/src/openai/types/responses/response_create_params.py @@ -25,6 +25,7 @@ __all__ = [ "ResponseCreateParamsBase", + "ContextManagement", "Conversation", "StreamOptions", "ToolChoice", @@ -40,6 +41,9 @@ class ResponseCreateParamsBase(TypedDict, total=False): [Learn more](https://platform.openai.com/docs/guides/background). """ + context_management: Optional[Iterable[ContextManagement]] + """Context management configuration for this request.""" + conversation: Optional[Conversation] """The conversation that this response belongs to. @@ -279,6 +283,14 @@ class ResponseCreateParamsBase(TypedDict, total=False): """ +class ContextManagement(TypedDict, total=False): + type: Required[str] + """The context management entry type. Currently only 'compaction' is supported.""" + + compact_threshold: Optional[int] + """Token threshold at which compaction should be triggered for this entry.""" + + Conversation: TypeAlias = Union[str, ResponseConversationParam] diff --git a/src/openai/types/responses/tool.py b/src/openai/types/responses/tool.py index 435f046768..bd266ea753 100644 --- a/src/openai/types/responses/tool.py +++ b/src/openai/types/responses/tool.py @@ -240,8 +240,8 @@ class ImageGeneration(BaseModel): """ 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`. """ input_image_mask: Optional[ImageGenerationInputImageMask] = None diff --git a/src/openai/types/responses/tool_param.py b/src/openai/types/responses/tool_param.py index 3afff87892..a81c69d3ab 100644 --- a/src/openai/types/responses/tool_param.py +++ b/src/openai/types/responses/tool_param.py @@ -240,8 +240,8 @@ class ImageGeneration(TypedDict, total=False): """ 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`. """ input_image_mask: ImageGenerationInputImageMask diff --git a/tests/api_resources/test_responses.py b/tests/api_resources/test_responses.py index 3cdbdba8a6..a644b2c6b9 100644 --- a/tests/api_resources/test_responses.py +++ b/tests/api_resources/test_responses.py @@ -30,6 +30,12 @@ def test_method_create_overload_1(self, client: OpenAI) -> None: def test_method_create_with_all_params_overload_1(self, client: OpenAI) -> None: response = client.responses.create( background=True, + context_management=[ + { + "type": "type", + "compact_threshold": 1000, + } + ], conversation="string", include=["file_search_call.results"], input="string", @@ -111,6 +117,12 @@ def test_method_create_with_all_params_overload_2(self, client: OpenAI) -> None: response_stream = client.responses.create( stream=True, background=True, + context_management=[ + { + "type": "type", + "compact_threshold": 1000, + } + ], conversation="string", include=["file_search_call.results"], input="string", @@ -426,6 +438,12 @@ async def test_method_create_overload_1(self, async_client: AsyncOpenAI) -> None async def test_method_create_with_all_params_overload_1(self, async_client: AsyncOpenAI) -> None: response = await async_client.responses.create( background=True, + context_management=[ + { + "type": "type", + "compact_threshold": 1000, + } + ], conversation="string", include=["file_search_call.results"], input="string", @@ -507,6 +525,12 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn response_stream = await async_client.responses.create( stream=True, background=True, + context_management=[ + { + "type": "type", + "compact_threshold": 1000, + } + ], conversation="string", include=["file_search_call.results"], input="string", From aa6659d2ece4b033c53bb8b2ee8027df07fbea5c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 05:31:52 +0000 Subject: [PATCH 5/5] release: 2.18.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ pyproject.toml | 2 +- src/openai/_version.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c1a7e63f69..ca3496a3e6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.17.0" + ".": "2.18.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ea480c424e..ad2758cf6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/pyproject.toml b/pyproject.toml index e3843e1f56..4dc3418464 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/src/openai/_version.py b/src/openai/_version.py index 5f7901120a..aede964362 100644 --- a/src/openai/_version.py +++ b/src/openai/_version.py @@ -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