From ab60d7a52c310bb0490ff36b8bdc33b8d4ea725f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:41:18 +0000 Subject: [PATCH 1/2] feat(api): workload identity in audit logs, additional_tools item in responses, fix ActionSearch.query to be optional. --- .stats.yml | 4 +- src/openai/lib/_parsing/_responses.py | 1 + .../admin/organization/audit_logs.py | 12 ++ .../resources/chat/completions/completions.py | 48 ++++++++ .../resources/responses/input_tokens.py | 12 ++ src/openai/resources/responses/responses.py | 48 ++++++++ .../organization/audit_log_list_params.py | 6 + .../organization/audit_log_list_response.py | 114 ++++++++++++++++++ .../types/chat/completion_create_params.py | 8 ++ .../types/conversations/conversation_item.py | 17 +++ .../responses/input_token_count_params.py | 7 ++ src/openai/types/responses/parsed_response.py | 2 + src/openai/types/responses/response.py | 8 ++ .../types/responses/response_create_params.py | 8 ++ .../responses/response_function_web_search.py | 6 +- .../response_function_web_search_param.py | 6 +- .../types/responses/response_input_item.py | 17 +++ .../responses/response_input_item_param.py | 17 +++ .../types/responses/response_input_param.py | 17 +++ src/openai/types/responses/response_item.py | 17 +++ .../types/responses/response_output_item.py | 17 +++ .../types/responses/responses_client_event.py | 8 ++ .../responses/responses_client_event_param.py | 8 ++ .../responses/test_input_tokens.py | 2 + 24 files changed, 402 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index b9d21daa06..1accdac38a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 262 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-afacc4343d0efc074c8c5667eb83570642c8b9acaa7792ca8e075c6d18ef9f3a.yml -openapi_spec_hash: a62a557c61532681963fd21e748b0eb4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-2a971ccbb946726988e96654eaecceb6d9b5ad27f5793c0064b864f5686d4fc1.yml +openapi_spec_hash: a712e4ee68f829570b3f5b267afa5a05 config_hash: bb69d8d0771dbac4a84fc6dca11e3ceb diff --git a/src/openai/lib/_parsing/_responses.py b/src/openai/lib/_parsing/_responses.py index 8853a0749f..232718cef6 100644 --- a/src/openai/lib/_parsing/_responses.py +++ b/src/openai/lib/_parsing/_responses.py @@ -103,6 +103,7 @@ def parse_response( or output.type == "web_search_call" or output.type == "tool_search_call" or output.type == "tool_search_output" + or output.type == "additional_tools" or output.type == "reasoning" or output.type == "compaction" or output.type == "mcp_call" diff --git a/src/openai/resources/admin/organization/audit_logs.py b/src/openai/resources/admin/organization/audit_logs.py index 3cf3127631..760fb4b034 100644 --- a/src/openai/resources/admin/organization/audit_logs.py +++ b/src/openai/resources/admin/organization/audit_logs.py @@ -91,6 +91,12 @@ def list( "tunnel.created", "tunnel.updated", "tunnel.deleted", + "workload_identity_provider.created", + "workload_identity_provider.updated", + "workload_identity_provider.deleted", + "workload_identity_provider_mapping.created", + "workload_identity_provider_mapping.updated", + "workload_identity_provider_mapping.deleted", "role.created", "role.updated", "role.deleted", @@ -256,6 +262,12 @@ def list( "tunnel.created", "tunnel.updated", "tunnel.deleted", + "workload_identity_provider.created", + "workload_identity_provider.updated", + "workload_identity_provider.deleted", + "workload_identity_provider_mapping.created", + "workload_identity_provider_mapping.updated", + "workload_identity_provider_mapping.deleted", "role.created", "role.updated", "role.deleted", diff --git a/src/openai/resources/chat/completions/completions.py b/src/openai/resources/chat/completions/completions.py index c85ac45cdb..9a2973c2a9 100644 --- a/src/openai/resources/chat/completions/completions.py +++ b/src/openai/resources/chat/completions/completions.py @@ -419,6 +419,14 @@ def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning_effort: Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently @@ -735,6 +743,14 @@ def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning_effort: Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently @@ -1042,6 +1058,14 @@ def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning_effort: Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently @@ -1943,6 +1967,14 @@ async def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning_effort: Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently @@ -2259,6 +2291,14 @@ async def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning_effort: Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently @@ -2566,6 +2606,14 @@ async def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning_effort: Constrains effort on reasoning for [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently diff --git a/src/openai/resources/responses/input_tokens.py b/src/openai/resources/responses/input_tokens.py index fae71fd59c..3306dfcd65 100644 --- a/src/openai/resources/responses/input_tokens.py +++ b/src/openai/resources/responses/input_tokens.py @@ -51,6 +51,7 @@ def count( instructions: Optional[str] | Omit = omit, model: Optional[str] | Omit = omit, parallel_tool_calls: Optional[bool] | Omit = omit, + personality: Union[str, Literal["friendly", "pragmatic"]] | Omit = omit, previous_response_id: Optional[str] | Omit = omit, reasoning: Optional[Reasoning] | Omit = omit, text: Optional[input_token_count_params.Text] | Omit = omit, @@ -91,6 +92,10 @@ def count( parallel_tool_calls: Whether to allow the model to run tool calls in parallel. + personality: A model-owned style preset to apply to this request. Omit this parameter to use + the model's default style. Supported values may expand over time. Values must be + at most 64 characters. + previous_response_id: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://platform.openai.com/docs/guides/conversation-state). @@ -133,6 +138,7 @@ def count( "instructions": instructions, "model": model, "parallel_tool_calls": parallel_tool_calls, + "personality": personality, "previous_response_id": previous_response_id, "reasoning": reasoning, "text": text, @@ -181,6 +187,7 @@ async def count( instructions: Optional[str] | Omit = omit, model: Optional[str] | Omit = omit, parallel_tool_calls: Optional[bool] | Omit = omit, + personality: Union[str, Literal["friendly", "pragmatic"]] | Omit = omit, previous_response_id: Optional[str] | Omit = omit, reasoning: Optional[Reasoning] | Omit = omit, text: Optional[input_token_count_params.Text] | Omit = omit, @@ -221,6 +228,10 @@ async def count( parallel_tool_calls: Whether to allow the model to run tool calls in parallel. + personality: A model-owned style preset to apply to this request. Omit this parameter to use + the model's default style. Supported values may expand over time. Values must be + at most 64 characters. + previous_response_id: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://platform.openai.com/docs/guides/conversation-state). @@ -263,6 +274,7 @@ async def count( "instructions": instructions, "model": model, "parallel_tool_calls": parallel_tool_calls, + "personality": personality, "previous_response_id": previous_response_id, "reasoning": reasoning, "text": text, diff --git a/src/openai/resources/responses/responses.py b/src/openai/resources/responses/responses.py index e83f9824be..9caadacd66 100644 --- a/src/openai/resources/responses/responses.py +++ b/src/openai/resources/responses/responses.py @@ -268,6 +268,14 @@ def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning: **gpt-5 and o-series models only** @@ -525,6 +533,14 @@ def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning: **gpt-5 and o-series models only** @@ -775,6 +791,14 @@ def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning: **gpt-5 and o-series models only** @@ -1974,6 +1998,14 @@ async def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning: **gpt-5 and o-series models only** @@ -2231,6 +2263,14 @@ async def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning: **gpt-5 and o-series models only** @@ -2481,6 +2521,14 @@ async def create( prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. reasoning: **gpt-5 and o-series models only** diff --git a/src/openai/types/admin/organization/audit_log_list_params.py b/src/openai/types/admin/organization/audit_log_list_params.py index bd3bc6d629..25224d47dc 100644 --- a/src/openai/types/admin/organization/audit_log_list_params.py +++ b/src/openai/types/admin/organization/audit_log_list_params.py @@ -81,6 +81,12 @@ class AuditLogListParams(TypedDict, total=False): "tunnel.created", "tunnel.updated", "tunnel.deleted", + "workload_identity_provider.created", + "workload_identity_provider.updated", + "workload_identity_provider.deleted", + "workload_identity_provider_mapping.created", + "workload_identity_provider_mapping.updated", + "workload_identity_provider_mapping.deleted", "role.created", "role.updated", "role.deleted", diff --git a/src/openai/types/admin/organization/audit_log_list_response.py b/src/openai/types/admin/organization/audit_log_list_response.py index ec899758a2..9fa99bd677 100644 --- a/src/openai/types/admin/organization/audit_log_list_response.py +++ b/src/openai/types/admin/organization/audit_log_list_response.py @@ -80,6 +80,12 @@ "UserDeleted", "UserUpdated", "UserUpdatedChangesRequested", + "WorkloadIdentityProviderMappingCreated", + "WorkloadIdentityProviderMappingDeleted", + "WorkloadIdentityProviderMappingUpdated", + "WorkloadIdentityProviderCreated", + "WorkloadIdentityProviderDeleted", + "WorkloadIdentityProviderUpdated", ] @@ -804,6 +810,78 @@ class UserUpdated(BaseModel): """The payload used to update the user.""" +class WorkloadIdentityProviderMappingCreated(BaseModel): + """The details for events with this `type`.""" + + id: Optional[str] = None + """The workload identity provider mapping ID.""" + + data: Optional[object] = None + """The payload used to create the workload identity provider mapping.""" + + identity_provider_id: Optional[str] = None + """The workload identity provider ID.""" + + +class WorkloadIdentityProviderMappingDeleted(BaseModel): + """The details for events with this `type`.""" + + id: Optional[str] = None + """The workload identity provider mapping ID.""" + + identity_provider_id: Optional[str] = None + """The workload identity provider ID.""" + + project_id: Optional[str] = None + """The project ID.""" + + service_account_id: Optional[str] = None + """The mapped service account ID.""" + + +class WorkloadIdentityProviderMappingUpdated(BaseModel): + """The details for events with this `type`.""" + + id: Optional[str] = None + """The workload identity provider mapping ID.""" + + changes_requested: Optional[object] = None + """The payload used to update the workload identity provider mapping.""" + + identity_provider_id: Optional[str] = None + """The workload identity provider ID.""" + + +class WorkloadIdentityProviderCreated(BaseModel): + """The details for events with this `type`.""" + + id: Optional[str] = None + """The workload identity provider ID.""" + + data: Optional[object] = None + """The payload used to create the workload identity provider.""" + + +class WorkloadIdentityProviderDeleted(BaseModel): + """The details for events with this `type`.""" + + id: Optional[str] = None + """The workload identity provider ID.""" + + name: Optional[str] = None + """The workload identity provider name.""" + + +class WorkloadIdentityProviderUpdated(BaseModel): + """The details for events with this `type`.""" + + id: Optional[str] = None + """The workload identity provider ID.""" + + changes_requested: Optional[object] = None + """The payload used to update the workload identity provider.""" + + class AuditLogListResponse(BaseModel): """A log of a user action or configuration change within this organization.""" @@ -852,6 +930,12 @@ class AuditLogListResponse(BaseModel): "tunnel.created", "tunnel.updated", "tunnel.deleted", + "workload_identity_provider.created", + "workload_identity_provider.updated", + "workload_identity_provider.deleted", + "workload_identity_provider_mapping.created", + "workload_identity_provider_mapping.updated", + "workload_identity_provider_mapping.deleted", "role.created", "role.updated", "role.deleted", @@ -1031,3 +1115,33 @@ class AuditLogListResponse(BaseModel): user_updated: Optional[UserUpdated] = FieldInfo(alias="user.updated", default=None) """The details for events with this `type`.""" + + workload_identity_provider_mapping_created: Optional[WorkloadIdentityProviderMappingCreated] = FieldInfo( + alias="workload_identity_provider_mapping.created", default=None + ) + """The details for events with this `type`.""" + + workload_identity_provider_mapping_deleted: Optional[WorkloadIdentityProviderMappingDeleted] = FieldInfo( + alias="workload_identity_provider_mapping.deleted", default=None + ) + """The details for events with this `type`.""" + + workload_identity_provider_mapping_updated: Optional[WorkloadIdentityProviderMappingUpdated] = FieldInfo( + alias="workload_identity_provider_mapping.updated", default=None + ) + """The details for events with this `type`.""" + + workload_identity_provider_created: Optional[WorkloadIdentityProviderCreated] = FieldInfo( + alias="workload_identity_provider.created", default=None + ) + """The details for events with this `type`.""" + + workload_identity_provider_deleted: Optional[WorkloadIdentityProviderDeleted] = FieldInfo( + alias="workload_identity_provider.deleted", default=None + ) + """The details for events with this `type`.""" + + workload_identity_provider_updated: Optional[WorkloadIdentityProviderUpdated] = FieldInfo( + alias="workload_identity_provider.updated", default=None + ) + """The details for events with this `type`.""" diff --git a/src/openai/types/chat/completion_create_params.py b/src/openai/types/chat/completion_create_params.py index 3c541b96b4..5ec1a1ae91 100644 --- a/src/openai/types/chat/completion_create_params.py +++ b/src/openai/types/chat/completion_create_params.py @@ -191,6 +191,14 @@ class CompletionCreateParamsBase(TypedDict, total=False): Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. """ reasoning_effort: Optional[ReasoningEffort] diff --git a/src/openai/types/conversations/conversation_item.py b/src/openai/types/conversations/conversation_item.py index 52e87ccb0b..9bc0495a34 100644 --- a/src/openai/types/conversations/conversation_item.py +++ b/src/openai/types/conversations/conversation_item.py @@ -6,6 +6,7 @@ from .message import Message from ..._utils import PropertyInfo from ..._models import BaseModel +from ..responses.tool import Tool from ..responses.response_reasoning_item import ResponseReasoningItem from ..responses.response_compaction_item import ResponseCompactionItem from ..responses.response_custom_tool_call import ResponseCustomToolCall @@ -27,6 +28,7 @@ __all__ = [ "ConversationItem", "ImageGenerationCall", + "AdditionalTools", "LocalShellCall", "LocalShellCallAction", "LocalShellCallOutput", @@ -54,6 +56,20 @@ class ImageGenerationCall(BaseModel): """The type of the image generation call. Always `image_generation_call`.""" +class AdditionalTools(BaseModel): + id: str + """The unique ID of the additional tools item.""" + + role: Literal["unknown", "user", "assistant", "system", "critic", "discriminator", "developer", "tool"] + """The role that provided the additional tools.""" + + tools: List[Tool] + """The additional tool definitions made available at this item.""" + + type: Literal["additional_tools"] + """The type of the item. Always `additional_tools`.""" + + class LocalShellCallAction(BaseModel): """Execute a shell command on the server.""" @@ -234,6 +250,7 @@ class McpCall(BaseModel): ResponseComputerToolCallOutputItem, ResponseToolSearchCall, ResponseToolSearchOutputItem, + AdditionalTools, ResponseReasoningItem, ResponseCompactionItem, ResponseCodeInterpreterToolCall, diff --git a/src/openai/types/responses/input_token_count_params.py b/src/openai/types/responses/input_token_count_params.py index f8a2026537..d94eea689c 100644 --- a/src/openai/types/responses/input_token_count_params.py +++ b/src/openai/types/responses/input_token_count_params.py @@ -54,6 +54,13 @@ class InputTokenCountParams(TypedDict, total=False): parallel_tool_calls: Optional[bool] """Whether to allow the model to run tool calls in parallel.""" + personality: Union[str, Literal["friendly", "pragmatic"]] + """A model-owned style preset to apply to this request. + + Omit this parameter to use the model's default style. Supported values may + expand over time. Values must be at most 64 characters. + """ + previous_response_id: Optional[str] """The unique ID of the previous response to the model. diff --git a/src/openai/types/responses/parsed_response.py b/src/openai/types/responses/parsed_response.py index 4100a8d9d0..0d1f18b472 100644 --- a/src/openai/types/responses/parsed_response.py +++ b/src/openai/types/responses/parsed_response.py @@ -10,6 +10,7 @@ McpCall, McpListTools, LocalShellCall, + AdditionalTools, McpApprovalRequest, ImageGenerationCall, McpApprovalResponse, @@ -80,6 +81,7 @@ class ParsedResponseFunctionToolCall(ResponseFunctionToolCall): ResponseComputerToolCallOutputItem, ResponseToolSearchCall, ResponseToolSearchOutputItem, + AdditionalTools, ResponseReasoningItem, McpCall, McpApprovalRequest, diff --git a/src/openai/types/responses/response.py b/src/openai/types/responses/response.py index dac3e09a89..bb4a4b3952 100644 --- a/src/openai/types/responses/response.py +++ b/src/openai/types/responses/response.py @@ -220,6 +220,14 @@ class Response(BaseModel): Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. """ reasoning: Optional[Reasoning] = None diff --git a/src/openai/types/responses/response_create_params.py b/src/openai/types/responses/response_create_params.py index 5f9b948ae9..b85ee87741 100644 --- a/src/openai/types/responses/response_create_params.py +++ b/src/openai/types/responses/response_create_params.py @@ -158,6 +158,14 @@ class ResponseCreateParamsBase(TypedDict, total=False): Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. """ reasoning: Optional[Reasoning] diff --git a/src/openai/types/responses/response_function_web_search.py b/src/openai/types/responses/response_function_web_search.py index de6001e146..3584992b7d 100644 --- a/src/openai/types/responses/response_function_web_search.py +++ b/src/openai/types/responses/response_function_web_search.py @@ -29,15 +29,15 @@ class ActionSearchSource(BaseModel): class ActionSearch(BaseModel): """Action type "search" - Performs a web search query.""" - query: str - """[DEPRECATED] The search query.""" - type: Literal["search"] """The action type.""" queries: Optional[List[str]] = None """The search queries.""" + query: Optional[str] = None + """The search query.""" + sources: Optional[List[ActionSearchSource]] = None """The sources used in the search.""" diff --git a/src/openai/types/responses/response_function_web_search_param.py b/src/openai/types/responses/response_function_web_search_param.py index 15e313b0d3..9e31a46be1 100644 --- a/src/openai/types/responses/response_function_web_search_param.py +++ b/src/openai/types/responses/response_function_web_search_param.py @@ -30,15 +30,15 @@ class ActionSearchSource(TypedDict, total=False): class ActionSearch(TypedDict, total=False): """Action type "search" - Performs a web search query.""" - query: Required[str] - """[DEPRECATED] The search query.""" - type: Required[Literal["search"]] """The action type.""" queries: SequenceNotStr[str] """The search queries.""" + query: str + """The search query.""" + sources: Iterable[ActionSearchSource] """The sources used in the search.""" diff --git a/src/openai/types/responses/response_input_item.py b/src/openai/types/responses/response_input_item.py index 9f12b429bd..f7f67c3414 100644 --- a/src/openai/types/responses/response_input_item.py +++ b/src/openai/types/responses/response_input_item.py @@ -3,6 +3,7 @@ from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias +from .tool import Tool from ..._utils import PropertyInfo from ..._models import BaseModel from .local_environment import LocalEnvironment @@ -31,6 +32,7 @@ "ComputerCallOutputAcknowledgedSafetyCheck", "FunctionCallOutput", "ToolSearchCall", + "AdditionalTools", "ImageGenerationCall", "LocalShellCall", "LocalShellCallAction", @@ -170,6 +172,20 @@ class ToolSearchCall(BaseModel): """The status of the tool search call.""" +class AdditionalTools(BaseModel): + role: Literal["developer"] + """The role that provided the additional tools. Only `developer` is supported.""" + + tools: List[Tool] + """A list of additional tools made available at this item.""" + + type: Literal["additional_tools"] + """The item type. Always `additional_tools`.""" + + id: Optional[str] = None + """The unique ID of this additional tools item.""" + + class ImageGenerationCall(BaseModel): """An image generation request made by the model.""" @@ -558,6 +574,7 @@ class ItemReference(BaseModel): FunctionCallOutput, ToolSearchCall, ResponseToolSearchOutputItemParam, + AdditionalTools, ResponseReasoningItem, ResponseCompactionItemParam, ImageGenerationCall, diff --git a/src/openai/types/responses/response_input_item_param.py b/src/openai/types/responses/response_input_item_param.py index 156ac92d39..0b0d68cdbd 100644 --- a/src/openai/types/responses/response_input_item_param.py +++ b/src/openai/types/responses/response_input_item_param.py @@ -6,6 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr +from .tool_param import ToolParam from .local_environment_param import LocalEnvironmentParam from .easy_input_message_param import EasyInputMessageParam from .container_reference_param import ContainerReferenceParam @@ -32,6 +33,7 @@ "ComputerCallOutputAcknowledgedSafetyCheck", "FunctionCallOutput", "ToolSearchCall", + "AdditionalTools", "ImageGenerationCall", "LocalShellCall", "LocalShellCallAction", @@ -171,6 +173,20 @@ class ToolSearchCall(TypedDict, total=False): """The status of the tool search call.""" +class AdditionalTools(TypedDict, total=False): + role: Required[Literal["developer"]] + """The role that provided the additional tools. Only `developer` is supported.""" + + tools: Required[Iterable[ToolParam]] + """A list of additional tools made available at this item.""" + + type: Required[Literal["additional_tools"]] + """The item type. Always `additional_tools`.""" + + id: Optional[str] + """The unique ID of this additional tools item.""" + + class ImageGenerationCall(TypedDict, total=False): """An image generation request made by the model.""" @@ -555,6 +571,7 @@ class ItemReference(TypedDict, total=False): FunctionCallOutput, ToolSearchCall, ResponseToolSearchOutputItemParamParam, + AdditionalTools, ResponseReasoningItemParam, ResponseCompactionItemParamParam, ImageGenerationCall, diff --git a/src/openai/types/responses/response_input_param.py b/src/openai/types/responses/response_input_param.py index 656c70359b..f45aa276c8 100644 --- a/src/openai/types/responses/response_input_param.py +++ b/src/openai/types/responses/response_input_param.py @@ -6,6 +6,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr +from .tool_param import ToolParam from .local_environment_param import LocalEnvironmentParam from .easy_input_message_param import EasyInputMessageParam from .container_reference_param import ContainerReferenceParam @@ -33,6 +34,7 @@ "ComputerCallOutputAcknowledgedSafetyCheck", "FunctionCallOutput", "ToolSearchCall", + "AdditionalTools", "ImageGenerationCall", "LocalShellCall", "LocalShellCallAction", @@ -172,6 +174,20 @@ class ToolSearchCall(TypedDict, total=False): """The status of the tool search call.""" +class AdditionalTools(TypedDict, total=False): + role: Required[Literal["developer"]] + """The role that provided the additional tools. Only `developer` is supported.""" + + tools: Required[Iterable[ToolParam]] + """A list of additional tools made available at this item.""" + + type: Required[Literal["additional_tools"]] + """The item type. Always `additional_tools`.""" + + id: Optional[str] + """The unique ID of this additional tools item.""" + + class ImageGenerationCall(TypedDict, total=False): """An image generation request made by the model.""" @@ -556,6 +572,7 @@ class ItemReference(TypedDict, total=False): FunctionCallOutput, ToolSearchCall, ResponseToolSearchOutputItemParamParam, + AdditionalTools, ResponseReasoningItemParam, ResponseCompactionItemParamParam, ImageGenerationCall, diff --git a/src/openai/types/responses/response_item.py b/src/openai/types/responses/response_item.py index 721bf02ecb..eb2cd44192 100644 --- a/src/openai/types/responses/response_item.py +++ b/src/openai/types/responses/response_item.py @@ -3,6 +3,7 @@ from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias +from .tool import Tool from ..._utils import PropertyInfo from ..._models import BaseModel from .response_output_message import ResponseOutputMessage @@ -27,6 +28,7 @@ __all__ = [ "ResponseItem", + "AdditionalTools", "ImageGenerationCall", "LocalShellCall", "LocalShellCallAction", @@ -39,6 +41,20 @@ ] +class AdditionalTools(BaseModel): + id: str + """The unique ID of the additional tools item.""" + + role: Literal["unknown", "user", "assistant", "system", "critic", "discriminator", "developer", "tool"] + """The role that provided the additional tools.""" + + tools: List[Tool] + """The additional tool definitions made available at this item.""" + + type: Literal["additional_tools"] + """The type of the item. Always `additional_tools`.""" + + class ImageGenerationCall(BaseModel): """An image generation request made by the model.""" @@ -235,6 +251,7 @@ class McpCall(BaseModel): ResponseFunctionToolCallOutputItem, ResponseToolSearchCall, ResponseToolSearchOutputItem, + AdditionalTools, ResponseReasoningItem, ResponseCompactionItem, ImageGenerationCall, diff --git a/src/openai/types/responses/response_output_item.py b/src/openai/types/responses/response_output_item.py index a4b23f26fd..ee7057348b 100644 --- a/src/openai/types/responses/response_output_item.py +++ b/src/openai/types/responses/response_output_item.py @@ -3,6 +3,7 @@ from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias +from .tool import Tool from ..._utils import PropertyInfo from ..._models import BaseModel from .response_output_message import ResponseOutputMessage @@ -26,6 +27,7 @@ __all__ = [ "ResponseOutputItem", + "AdditionalTools", "ImageGenerationCall", "LocalShellCall", "LocalShellCallAction", @@ -38,6 +40,20 @@ ] +class AdditionalTools(BaseModel): + id: str + """The unique ID of the additional tools item.""" + + role: Literal["unknown", "user", "assistant", "system", "critic", "discriminator", "developer", "tool"] + """The role that provided the additional tools.""" + + tools: List[Tool] + """The additional tool definitions made available at this item.""" + + type: Literal["additional_tools"] + """The type of the item. Always `additional_tools`.""" + + class ImageGenerationCall(BaseModel): """An image generation request made by the model.""" @@ -234,6 +250,7 @@ class McpApprovalResponse(BaseModel): ResponseReasoningItem, ResponseToolSearchCall, ResponseToolSearchOutputItem, + AdditionalTools, ResponseCompactionItem, ImageGenerationCall, ResponseCodeInterpreterToolCall, diff --git a/src/openai/types/responses/responses_client_event.py b/src/openai/types/responses/responses_client_event.py index 0a5dcb4ddd..8f50848d9d 100644 --- a/src/openai/types/responses/responses_client_event.py +++ b/src/openai/types/responses/responses_client_event.py @@ -190,6 +190,14 @@ class ResponsesClientEvent(BaseModel): Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. """ reasoning: Optional[Reasoning] = None diff --git a/src/openai/types/responses/responses_client_event_param.py b/src/openai/types/responses/responses_client_event_param.py index 59d8f205ae..632807aedf 100644 --- a/src/openai/types/responses/responses_client_event_param.py +++ b/src/openai/types/responses/responses_client_event_param.py @@ -191,6 +191,14 @@ class ResponsesClientEventParam(TypedDict, total=False): Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention). + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on + your organization's data retention policy: + + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when + `prompt_cache_retention` is not specified. """ reasoning: Optional[Reasoning] diff --git a/tests/api_resources/responses/test_input_tokens.py b/tests/api_resources/responses/test_input_tokens.py index b4bc627837..04c0bb698e 100644 --- a/tests/api_resources/responses/test_input_tokens.py +++ b/tests/api_resources/responses/test_input_tokens.py @@ -30,6 +30,7 @@ def test_method_count_with_all_params(self, client: OpenAI) -> None: instructions="instructions", model="model", parallel_tool_calls=True, + personality="friendly", previous_response_id="resp_123", reasoning={ "effort": "none", @@ -94,6 +95,7 @@ async def test_method_count_with_all_params(self, async_client: AsyncOpenAI) -> instructions="instructions", model="model", parallel_tool_calls=True, + personality="friendly", previous_response_id="resp_123", reasoning={ "effort": "none", From 465fe52067a5307bf3bb6893a46a7694f129bfd2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:43:01 +0000 Subject: [PATCH 2/2] release: 2.39.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/openai/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0e1c697558..9f6026f1c7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.38.0" + ".": "2.39.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b4f9d758d8..13992c0e52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 2.39.0 (2026-06-01) + +Full Changelog: [v2.38.0...v2.39.0](https://github.com/openai/openai-python/compare/v2.38.0...v2.39.0) + +### Features + +* **api:** workload identity in audit logs, additional_tools item in responses, fix ActionSearch.query to be optional. ([ab60d7a](https://github.com/openai/openai-python/commit/ab60d7a52c310bb0490ff36b8bdc33b8d4ea725f)) + ## 2.38.0 (2026-05-21) Full Changelog: [v2.37.0...v2.38.0](https://github.com/openai/openai-python/compare/v2.37.0...v2.38.0) diff --git a/pyproject.toml b/pyproject.toml index aedb6d8f51..39c6b5174d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openai" -version = "2.38.0" +version = "2.39.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 ba9c5f3a3c..8f492efa5d 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.38.0" # x-release-please-version +__version__ = "2.39.0" # x-release-please-version