From b231482636d2ac9aed48aa4ca1b9d776b8200a5b Mon Sep 17 00:00:00 2001 From: dpiet-oai <326640584+dpiet-oai@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:48:26 +0000 Subject: [PATCH] feat(api): expand Live Responses delegation tools Castiron-Internal-PR: https://github.com/openai/openai-python-internal/pull/385 Castiron-Source-SHA: 2dfcfa8d469453d8aac40be908b9253548bd60a4 Castiron-Public-Base-SHA: 16bdad17364b62254e14f52f834d15cf1036a024 --- .castiron.stats.yml | 10 +- api_reference/openapi.transformed.yml | 60 ++- scripts/castiron/generated-files.json | 8 +- .../types/live/responses_delegation_config.py | 408 +++++++++++++++++- .../live/responses_delegation_config_param.py | 396 ++++++++++++++++- .../responses_delegation_update_config.py | 408 +++++++++++++++++- ...esponses_delegation_update_config_param.py | 396 ++++++++++++++++- tests/lib/live/test_delegation_transport.py | 113 +++++ 8 files changed, 1778 insertions(+), 21 deletions(-) create mode 100644 tests/lib/live/test_delegation_transport.py diff --git a/.castiron.stats.yml b/.castiron.stats.yml index 3e08e91b71..0b0f4dbc0d 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,7 +1,7 @@ schema_version: 1 -generation_id: 518e3d93-186c-4c88-86e8-55cf698e7f68 +generation_id: d65b0177-3510-4159-81c8-ce15fc6574bb openapi_spec_hash: c3c2cc244c107fdd6e624a7b961015a9 -openapi_transformed_spec_hash: 5b121d4b6cca6573c41db323a7399527 -config_hash: b707b209c892562880c415693d111ad6 -codegen_sha: fa973427eb9189f3d853d3facf90d0e9378564d1 -codegen_hash: 808925bbb2d1383e24adc2561d78688239e15f45bc83c0f1994fe04f05611980 +openapi_transformed_spec_hash: f4cb51137173a3ae515bb8a81b697146 +config_hash: 0a8dfbd4fa6f09fd4f99fe129fd95cf8 +codegen_sha: 52e48cd3c03cd885f7c67e9a4f237baf49a501d4 +codegen_hash: df2d7e7d31711d2fd8c3433ec9a498185a6a0b807deb3796c76a39dbcb80130b diff --git a/api_reference/openapi.transformed.yml b/api_reference/openapi.transformed.yml index 157bf377f5..1979495e14 100644 --- a/api_reference/openapi.transformed.yml +++ b/api_reference/openapi.transformed.yml @@ -59589,6 +59589,7 @@ components: - type - server_label - name + x-stainless-variantName: LiveMCPToolChoiceParam LiveFunctionToolChoiceParam: type: object properties: @@ -59606,6 +59607,7 @@ components: required: - type - name + x-stainless-variantName: LiveFunctionToolChoiceParam SubmitToolOutputsRunRequestWithoutStream: type: object additionalProperties: false @@ -80092,12 +80094,37 @@ components: anyOf: - $ref: '#/components/schemas/LiveFunctionToolInputParam' - $ref: '#/components/schemas/LiveWebSearchToolInputParam' + - $ref: '#/components/schemas/LiveFileSearchToolInputParam' + - $ref: '#/components/schemas/LiveCodeInterpreterToolInputParam' + - $ref: '#/components/schemas/LiveHostedShellToolInputParam' + - $ref: '#/components/schemas/LiveImageGenerationToolInputParam' + - $ref: '#/components/schemas/LiveMCPToolInputParam' + - $ref: '#/components/schemas/LiveCustomToolInputParam' + - $ref: '#/components/schemas/LiveNamespaceToolInputParam' + - $ref: '#/components/schemas/LiveToolSearchToolInputParam' + - $ref: '#/components/schemas/LiveProgrammaticToolInputParam' + - $ref: '#/components/schemas/LiveComputerToolInputParam' + - $ref: '#/components/schemas/LiveApplyPatchToolInputParam' tool_choice: description: Controls which tool the Responses backend uses when handling a task delegated by the Live model. anyOf: - $ref: '#/components/schemas/LiveToolChoiceEnum' - - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' - - $ref: '#/components/schemas/LiveMCPToolChoiceParam' + - discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' + - $ref: '#/components/schemas/LiveMCPToolChoiceParam' + - $ref: '#/components/schemas/LiveSpecificFileSearchParam' + - $ref: '#/components/schemas/LiveSpecificWebSearchParam' + - $ref: '#/components/schemas/LiveSpecificWebSearchPreviewParam' + - $ref: '#/components/schemas/LiveSpecificImageGenParam' + - $ref: '#/components/schemas/LiveSpecificComputerParam' + - $ref: '#/components/schemas/LiveSpecificCodeInterpreterParam' + - $ref: '#/components/schemas/LiveSpecificProgrammaticToolCallingParam' + - $ref: '#/components/schemas/LiveSpecificFunctionShellParam' + - $ref: '#/components/schemas/LiveSpecificCustomToolParam' + - $ref: '#/components/schemas/LiveSpecificApplyPatchParam' + - $ref: '#/components/schemas/LiveAllowedToolsChoiceParam' parallel_tool_calls: anyOf: - description: Whether the delegated Responses model may request multiple tool calls in a single response. @@ -80725,12 +80752,37 @@ components: anyOf: - $ref: '#/components/schemas/LiveFunctionToolInputParam' - $ref: '#/components/schemas/LiveWebSearchToolInputParam' + - $ref: '#/components/schemas/LiveFileSearchToolInputParam' + - $ref: '#/components/schemas/LiveCodeInterpreterToolInputParam' + - $ref: '#/components/schemas/LiveHostedShellToolInputParam' + - $ref: '#/components/schemas/LiveImageGenerationToolInputParam' + - $ref: '#/components/schemas/LiveMCPToolInputParam' + - $ref: '#/components/schemas/LiveCustomToolInputParam' + - $ref: '#/components/schemas/LiveNamespaceToolInputParam' + - $ref: '#/components/schemas/LiveToolSearchToolInputParam' + - $ref: '#/components/schemas/LiveProgrammaticToolInputParam' + - $ref: '#/components/schemas/LiveComputerToolInputParam' + - $ref: '#/components/schemas/LiveApplyPatchToolInputParam' tool_choice: description: Controls which tool the Responses backend uses when handling a task delegated by the Live model. anyOf: - $ref: '#/components/schemas/LiveToolChoiceEnum' - - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' - - $ref: '#/components/schemas/LiveMCPToolChoiceParam' + - discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' + - $ref: '#/components/schemas/LiveMCPToolChoiceParam' + - $ref: '#/components/schemas/LiveSpecificFileSearchParam' + - $ref: '#/components/schemas/LiveSpecificWebSearchParam' + - $ref: '#/components/schemas/LiveSpecificWebSearchPreviewParam' + - $ref: '#/components/schemas/LiveSpecificImageGenParam' + - $ref: '#/components/schemas/LiveSpecificComputerParam' + - $ref: '#/components/schemas/LiveSpecificCodeInterpreterParam' + - $ref: '#/components/schemas/LiveSpecificProgrammaticToolCallingParam' + - $ref: '#/components/schemas/LiveSpecificFunctionShellParam' + - $ref: '#/components/schemas/LiveSpecificCustomToolParam' + - $ref: '#/components/schemas/LiveSpecificApplyPatchParam' + - $ref: '#/components/schemas/LiveAllowedToolsChoiceParam' parallel_tool_calls: anyOf: - description: Whether the delegated Responses model may request multiple tool calls in a single response. diff --git a/scripts/castiron/generated-files.json b/scripts/castiron/generated-files.json index 71cbeccd2f..1d75a5f05e 100644 --- a/scripts/castiron/generated-files.json +++ b/scripts/castiron/generated-files.json @@ -4971,19 +4971,19 @@ }, "src/openai/types/live/responses_delegation_config.py": { "mode": "100644", - "sha256": "7a7667d93dc56d47835f9597817015f18bc519afb5df0b5e0d28535a41127e48" + "sha256": "9acf81a3c59c90ea84fa44ae0623bda33c7c8b55b814713ec45242c5027a7c0f" }, "src/openai/types/live/responses_delegation_config_param.py": { "mode": "100644", - "sha256": "c531bc1a27b6dacbf9f391601787e4cc79d3707bbf71d5563e2b3ace151d4c87" + "sha256": "033eb7569fa9975bd2adb584f645581067b068f8ff70bf93f5848278c3b02d75" }, "src/openai/types/live/responses_delegation_update_config.py": { "mode": "100644", - "sha256": "39f16a0d55ba11e002f3ac10c5b53df5c48ad8f2d81c8ac481c00b76c3da2fc2" + "sha256": "c0e958d70b97fe6fe67c5ae0c8bfb8b89d0a56cfccb36d0e1573faafa9334112" }, "src/openai/types/live/responses_delegation_update_config_param.py": { "mode": "100644", - "sha256": "bf5e7f05e80ed46fc65a4757b3c6934cd8d57bcc3fb0e8092cd9155e51c0aa37" + "sha256": "5a13bebcc51dff57350011a07333209ce359c9e47e7f219f8c8d0ec6ecf1dfbc" }, "src/openai/types/live/server_event.py": { "mode": "100644", diff --git a/src/openai/types/live/responses_delegation_config.py b/src/openai/types/live/responses_delegation_config.py index 1d8c548a23..dafa065af5 100644 --- a/src/openai/types/live/responses_delegation_config.py +++ b/src/openai/types/live/responses_delegation_config.py @@ -14,8 +14,55 @@ "ToolChoice", "ToolChoiceLiveFunctionToolChoiceParam", "ToolChoiceLiveMCPToolChoiceParam", + "ToolChoiceFileSearch", + "ToolChoiceWebSearch", + "ToolChoiceWebSearchPreview", + "ToolChoiceImageGeneration", + "ToolChoiceComputer", + "ToolChoiceCodeInterpreter", + "ToolChoiceProgrammaticToolCalling", + "ToolChoiceShell", + "ToolChoiceCustom", + "ToolChoiceApplyPatch", + "ToolChoiceLiveAllowedToolsChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamTool", + "ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch", + "ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch", + "ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview", + "ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration", + "ToolChoiceLiveAllowedToolsChoiceParamToolComputer", + "ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter", + "ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling", + "ToolChoiceLiveAllowedToolsChoiceParamToolShell", + "ToolChoiceLiveAllowedToolsChoiceParamToolCustom", + "ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch", "Tool", "ToolWebSearch", + "ToolFileSearch", + "ToolCodeInterpreter", + "ToolShell", + "ToolShellEnvironment", + "ToolShellEnvironmentContainerAuto", + "ToolShellEnvironmentContainerAutoNetworkPolicy", + "ToolShellEnvironmentContainerAutoNetworkPolicyDisabled", + "ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist", + "ToolShellEnvironmentContainerAutoSkill", + "ToolShellEnvironmentContainerAutoSkillSkillReference", + "ToolShellEnvironmentContainerAutoSkillInline", + "ToolShellEnvironmentContainerAutoSkillInlineSource", + "ToolShellEnvironmentContainerReference", + "ToolShellEnvironmentLocal", + "ToolShellEnvironmentLocalSkill", + "ToolImageGeneration", + "ToolMcp", + "ToolCustom", + "ToolNamespace", + "ToolSearch", + "ToolProgrammaticToolCalling", + "ToolComputer", + "ToolApplyPatch", ] @@ -57,10 +104,182 @@ class ToolChoiceLiveMCPToolChoiceParam(BaseModel): server_label: str type: Literal["mcp"] + """The tool choice type. Always `allowed_tools`.""" + + +class ToolChoiceFileSearch(BaseModel): + type: Literal["file_search"] + """The tool to call. Always `file_search`.""" + + +class ToolChoiceWebSearch(BaseModel): + type: Literal["web_search"] + """The tool to call. Always `web_search`.""" + + +class ToolChoiceWebSearchPreview(BaseModel): + type: Literal["web_search_preview"] + """The tool to call. Always `web_search_preview`.""" + + +class ToolChoiceImageGeneration(BaseModel): + type: Literal["image_generation"] + """The tool to call. Always `image_generation`.""" + + +class ToolChoiceComputer(BaseModel): + type: Literal["computer"] + """The tool to call. Always `computer`.""" + + +class ToolChoiceCodeInterpreter(BaseModel): + type: Literal["code_interpreter"] + """The tool to call. Always `code_interpreter`.""" + + +class ToolChoiceProgrammaticToolCalling(BaseModel): + type: Literal["programmatic_tool_calling"] + """The tool to call. Always `programmatic_tool_calling`.""" + + +class ToolChoiceShell(BaseModel): + """Forces the model to call the shell tool when a tool call is required.""" + + type: Literal["shell"] + """The tool to call. Always `shell`.""" + + +class ToolChoiceCustom(BaseModel): + name: str + """The name of the custom tool to call.""" + + type: Literal["custom"] + """The tool to call. Always `custom`.""" + + +class ToolChoiceApplyPatch(BaseModel): + """Forces the model to call the apply_patch tool when executing a tool call.""" + + type: Literal["apply_patch"] + """The tool to call. Always `apply_patch`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam(BaseModel): + name: str + + type: Literal["function"] + + +class ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam(BaseModel): + name: str + + server_label: str + + type: Literal["mcp"] + + +class ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch(BaseModel): + type: Literal["file_search"] + """The tool to call. Always `file_search`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch(BaseModel): + type: Literal["web_search"] + """The tool to call. Always `web_search`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview(BaseModel): + type: Literal["web_search_preview"] + """The tool to call. Always `web_search_preview`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration(BaseModel): + type: Literal["image_generation"] + """The tool to call. Always `image_generation`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolComputer(BaseModel): + type: Literal["computer"] + """The tool to call. Always `computer`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter(BaseModel): + type: Literal["code_interpreter"] + """The tool to call. Always `code_interpreter`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling(BaseModel): + type: Literal["programmatic_tool_calling"] + """The tool to call. Always `programmatic_tool_calling`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolShell(BaseModel): + """Forces the model to call the shell tool when a tool call is required.""" + + type: Literal["shell"] + """The tool to call. Always `shell`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolCustom(BaseModel): + name: str + """The name of the custom tool to call.""" + + type: Literal["custom"] + """The tool to call. Always `custom`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch(BaseModel): + """Forces the model to call the apply_patch tool when executing a tool call.""" + + type: Literal["apply_patch"] + """The tool to call. Always `apply_patch`.""" + + +ToolChoiceLiveAllowedToolsChoiceParamTool: TypeAlias = Annotated[ + Union[ + ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam, + ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam, + ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch, + ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch, + ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview, + ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration, + ToolChoiceLiveAllowedToolsChoiceParamToolComputer, + ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter, + ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling, + ToolChoiceLiveAllowedToolsChoiceParamToolShell, + ToolChoiceLiveAllowedToolsChoiceParamToolCustom, + ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch, + ], + PropertyInfo(discriminator="type"), +] + + +class ToolChoiceLiveAllowedToolsChoiceParam(BaseModel): + tools: List[ToolChoiceLiveAllowedToolsChoiceParamTool] + """The tools that the delegated Responses model may call.""" + + type: Literal["allowed_tools"] + """The tool choice type. Always `allowed_tools`.""" + + mode: Optional[Literal["none", "auto", "required"]] = None + """How to select a tool from the allowed set.""" ToolChoice: TypeAlias = Union[ - Literal["auto", "none", "required"], ToolChoiceLiveFunctionToolChoiceParam, ToolChoiceLiveMCPToolChoiceParam + Literal["auto", "none", "required"], + ToolChoiceLiveFunctionToolChoiceParam, + ToolChoiceLiveMCPToolChoiceParam, + ToolChoiceFileSearch, + ToolChoiceWebSearch, + ToolChoiceWebSearchPreview, + ToolChoiceImageGeneration, + ToolChoiceComputer, + ToolChoiceCodeInterpreter, + ToolChoiceProgrammaticToolCalling, + ToolChoiceShell, + ToolChoiceCustom, + ToolChoiceApplyPatch, + ToolChoiceLiveAllowedToolsChoiceParam, ] @@ -71,7 +290,192 @@ class ToolWebSearch(BaseModel): """The tool type. Always `web_search`.""" -Tool: TypeAlias = Annotated[Union[FunctionTool, ToolWebSearch], PropertyInfo(discriminator="type")] +class ToolFileSearch(BaseModel): + type: Literal["file_search"] + + +class ToolCodeInterpreter(BaseModel): + type: Literal["code_interpreter"] + + +class ToolShellEnvironmentContainerAutoNetworkPolicyDisabled(BaseModel): + type: Literal["disabled"] + """Disable outbound network access. Always `disabled`.""" + + +class ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist(BaseModel): + allowed_domains: List[str] + """A list of allowed domains when type is `allowlist`.""" + + type: Literal["allowlist"] + """Allow outbound network access only to specified domains. Always `allowlist`.""" + + +ToolShellEnvironmentContainerAutoNetworkPolicy: TypeAlias = Annotated[ + Union[ + ToolShellEnvironmentContainerAutoNetworkPolicyDisabled, + ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist, + None, + ], + PropertyInfo(discriminator="type"), +] + + +class ToolShellEnvironmentContainerAutoSkillSkillReference(BaseModel): + skill_id: str + """The ID of the referenced skill.""" + + type: Literal["skill_reference"] + """References a skill created with the /v1/skills endpoint.""" + + version: Optional[str] = None + """Optional skill version. Use a positive integer or 'latest'. Omit for default.""" + + +class ToolShellEnvironmentContainerAutoSkillInlineSource(BaseModel): + """Inline skill payload""" + + data: str + """Base64-encoded skill zip bundle.""" + + media_type: Literal["application/zip"] + """The media type of the inline skill payload. Must be `application/zip`.""" + + type: Literal["base64"] + """The type of the inline skill source. Must be `base64`.""" + + +class ToolShellEnvironmentContainerAutoSkillInline(BaseModel): + description: str + """The description of the skill.""" + + name: str + """The name of the skill.""" + + source: ToolShellEnvironmentContainerAutoSkillInlineSource + """Inline skill payload""" + + type: Literal["inline"] + """Defines an inline skill for this request.""" + + +ToolShellEnvironmentContainerAutoSkill: TypeAlias = Annotated[ + Union[ToolShellEnvironmentContainerAutoSkillSkillReference, ToolShellEnvironmentContainerAutoSkillInline], + PropertyInfo(discriminator="type"), +] + + +class ToolShellEnvironmentContainerAuto(BaseModel): + type: Literal["container_auto"] + """Automatically creates a container for this request""" + + file_ids: Optional[List[str]] = None + """An optional list of uploaded files to make available to your code.""" + + memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]] = None + """The memory limit for the container.""" + + network_policy: Optional[ToolShellEnvironmentContainerAutoNetworkPolicy] = None + """Network access policy for the container.""" + + skills: Optional[List[ToolShellEnvironmentContainerAutoSkill]] = None + """An optional list of skills referenced by id or inline data.""" + + +class ToolShellEnvironmentContainerReference(BaseModel): + container_id: str + """The ID of the referenced container.""" + + type: Literal["container_reference"] + """References a container created with the /v1/containers endpoint""" + + +class ToolShellEnvironmentLocalSkill(BaseModel): + description: str + """The description of the skill.""" + + name: str + """The name of the skill.""" + + path: str + """The path to the directory containing the skill.""" + + +class ToolShellEnvironmentLocal(BaseModel): + type: Literal["local"] + """Use a local computer environment.""" + + skills: Optional[List[ToolShellEnvironmentLocalSkill]] = None + """An optional list of skills.""" + + +ToolShellEnvironment: TypeAlias = Annotated[ + Union[ToolShellEnvironmentContainerAuto, ToolShellEnvironmentContainerReference, ToolShellEnvironmentLocal, None], + PropertyInfo(discriminator="type"), +] + + +class ToolShell(BaseModel): + """A Responses shell tool. + + Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported. + """ + + type: Literal["shell"] + + environment: Optional[ToolShellEnvironment] = None + + +class ToolImageGeneration(BaseModel): + type: Literal["image_generation"] + + +class ToolMcp(BaseModel): + type: Literal["mcp"] + + +class ToolCustom(BaseModel): + type: Literal["custom"] + + +class ToolNamespace(BaseModel): + type: Literal["namespace"] + + +class ToolSearch(BaseModel): + type: Literal["tool_search"] + + +class ToolProgrammaticToolCalling(BaseModel): + type: Literal["programmatic_tool_calling"] + + +class ToolComputer(BaseModel): + type: Literal["computer"] + + +class ToolApplyPatch(BaseModel): + type: Literal["apply_patch"] + + +Tool: TypeAlias = Annotated[ + Union[ + FunctionTool, + ToolWebSearch, + ToolFileSearch, + ToolCodeInterpreter, + ToolShell, + ToolImageGeneration, + ToolMcp, + ToolCustom, + ToolNamespace, + ToolSearch, + ToolProgrammaticToolCalling, + ToolComputer, + ToolApplyPatch, + ], + PropertyInfo(discriminator="type"), +] class ResponsesDelegationConfig(BaseModel): diff --git a/src/openai/types/live/responses_delegation_config_param.py b/src/openai/types/live/responses_delegation_config_param.py index 1e7e58b6ec..40a37f51bc 100644 --- a/src/openai/types/live/responses_delegation_config_param.py +++ b/src/openai/types/live/responses_delegation_config_param.py @@ -5,6 +5,7 @@ from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict +from ..._types import SequenceNotStr from .function_tool_param import FunctionToolParam __all__ = [ @@ -14,8 +15,55 @@ "ToolChoice", "ToolChoiceLiveFunctionToolChoiceParam", "ToolChoiceLiveMCPToolChoiceParam", + "ToolChoiceFileSearch", + "ToolChoiceWebSearch", + "ToolChoiceWebSearchPreview", + "ToolChoiceImageGeneration", + "ToolChoiceComputer", + "ToolChoiceCodeInterpreter", + "ToolChoiceProgrammaticToolCalling", + "ToolChoiceShell", + "ToolChoiceCustom", + "ToolChoiceApplyPatch", + "ToolChoiceLiveAllowedToolsChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamTool", + "ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch", + "ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch", + "ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview", + "ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration", + "ToolChoiceLiveAllowedToolsChoiceParamToolComputer", + "ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter", + "ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling", + "ToolChoiceLiveAllowedToolsChoiceParamToolShell", + "ToolChoiceLiveAllowedToolsChoiceParamToolCustom", + "ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch", "Tool", "ToolWebSearch", + "ToolFileSearch", + "ToolCodeInterpreter", + "ToolShell", + "ToolShellEnvironment", + "ToolShellEnvironmentContainerAuto", + "ToolShellEnvironmentContainerAutoNetworkPolicy", + "ToolShellEnvironmentContainerAutoNetworkPolicyDisabled", + "ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist", + "ToolShellEnvironmentContainerAutoSkill", + "ToolShellEnvironmentContainerAutoSkillSkillReference", + "ToolShellEnvironmentContainerAutoSkillInline", + "ToolShellEnvironmentContainerAutoSkillInlineSource", + "ToolShellEnvironmentContainerReference", + "ToolShellEnvironmentLocal", + "ToolShellEnvironmentLocalSkill", + "ToolImageGeneration", + "ToolMcp", + "ToolCustom", + "ToolNamespace", + "ToolSearch", + "ToolProgrammaticToolCalling", + "ToolComputer", + "ToolApplyPatch", ] @@ -57,10 +105,179 @@ class ToolChoiceLiveMCPToolChoiceParam(TypedDict, total=False): server_label: Required[str] type: Required[Literal["mcp"]] + """The tool choice type. Always `allowed_tools`.""" + + +class ToolChoiceFileSearch(TypedDict, total=False): + type: Required[Literal["file_search"]] + """The tool to call. Always `file_search`.""" + + +class ToolChoiceWebSearch(TypedDict, total=False): + type: Required[Literal["web_search"]] + """The tool to call. Always `web_search`.""" + + +class ToolChoiceWebSearchPreview(TypedDict, total=False): + type: Required[Literal["web_search_preview"]] + """The tool to call. Always `web_search_preview`.""" + + +class ToolChoiceImageGeneration(TypedDict, total=False): + type: Required[Literal["image_generation"]] + """The tool to call. Always `image_generation`.""" + + +class ToolChoiceComputer(TypedDict, total=False): + type: Required[Literal["computer"]] + """The tool to call. Always `computer`.""" + + +class ToolChoiceCodeInterpreter(TypedDict, total=False): + type: Required[Literal["code_interpreter"]] + """The tool to call. Always `code_interpreter`.""" + + +class ToolChoiceProgrammaticToolCalling(TypedDict, total=False): + type: Required[Literal["programmatic_tool_calling"]] + """The tool to call. Always `programmatic_tool_calling`.""" + + +class ToolChoiceShell(TypedDict, total=False): + """Forces the model to call the shell tool when a tool call is required.""" + + type: Required[Literal["shell"]] + """The tool to call. Always `shell`.""" + + +class ToolChoiceCustom(TypedDict, total=False): + name: Required[str] + """The name of the custom tool to call.""" + + type: Required[Literal["custom"]] + """The tool to call. Always `custom`.""" + + +class ToolChoiceApplyPatch(TypedDict, total=False): + """Forces the model to call the apply_patch tool when executing a tool call.""" + + type: Required[Literal["apply_patch"]] + """The tool to call. Always `apply_patch`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam(TypedDict, total=False): + name: Required[str] + + type: Required[Literal["function"]] + + +class ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam(TypedDict, total=False): + name: Required[str] + + server_label: Required[str] + + type: Required[Literal["mcp"]] + + +class ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch(TypedDict, total=False): + type: Required[Literal["file_search"]] + """The tool to call. Always `file_search`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch(TypedDict, total=False): + type: Required[Literal["web_search"]] + """The tool to call. Always `web_search`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview(TypedDict, total=False): + type: Required[Literal["web_search_preview"]] + """The tool to call. Always `web_search_preview`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration(TypedDict, total=False): + type: Required[Literal["image_generation"]] + """The tool to call. Always `image_generation`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolComputer(TypedDict, total=False): + type: Required[Literal["computer"]] + """The tool to call. Always `computer`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter(TypedDict, total=False): + type: Required[Literal["code_interpreter"]] + """The tool to call. Always `code_interpreter`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling(TypedDict, total=False): + type: Required[Literal["programmatic_tool_calling"]] + """The tool to call. Always `programmatic_tool_calling`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolShell(TypedDict, total=False): + """Forces the model to call the shell tool when a tool call is required.""" + + type: Required[Literal["shell"]] + """The tool to call. Always `shell`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolCustom(TypedDict, total=False): + name: Required[str] + """The name of the custom tool to call.""" + + type: Required[Literal["custom"]] + """The tool to call. Always `custom`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch(TypedDict, total=False): + """Forces the model to call the apply_patch tool when executing a tool call.""" + + type: Required[Literal["apply_patch"]] + """The tool to call. Always `apply_patch`.""" + + +ToolChoiceLiveAllowedToolsChoiceParamTool: TypeAlias = Union[ + ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam, + ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam, + ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch, + ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch, + ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview, + ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration, + ToolChoiceLiveAllowedToolsChoiceParamToolComputer, + ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter, + ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling, + ToolChoiceLiveAllowedToolsChoiceParamToolShell, + ToolChoiceLiveAllowedToolsChoiceParamToolCustom, + ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch, +] + + +class ToolChoiceLiveAllowedToolsChoiceParam(TypedDict, total=False): + tools: Required[Iterable[ToolChoiceLiveAllowedToolsChoiceParamTool]] + """The tools that the delegated Responses model may call.""" + + type: Required[Literal["allowed_tools"]] + """The tool choice type. Always `allowed_tools`.""" + + mode: Optional[Literal["none", "auto", "required"]] + """How to select a tool from the allowed set.""" ToolChoice: TypeAlias = Union[ - Literal["auto", "none", "required"], ToolChoiceLiveFunctionToolChoiceParam, ToolChoiceLiveMCPToolChoiceParam + Literal["auto", "none", "required"], + ToolChoiceLiveFunctionToolChoiceParam, + ToolChoiceLiveMCPToolChoiceParam, + ToolChoiceFileSearch, + ToolChoiceWebSearch, + ToolChoiceWebSearchPreview, + ToolChoiceImageGeneration, + ToolChoiceComputer, + ToolChoiceCodeInterpreter, + ToolChoiceProgrammaticToolCalling, + ToolChoiceShell, + ToolChoiceCustom, + ToolChoiceApplyPatch, + ToolChoiceLiveAllowedToolsChoiceParam, ] @@ -71,7 +288,182 @@ class ToolWebSearch(TypedDict, total=False): """The tool type. Always `web_search`.""" -Tool: TypeAlias = Union[FunctionToolParam, ToolWebSearch] +class ToolFileSearch(TypedDict, total=False): + type: Required[Literal["file_search"]] + + +class ToolCodeInterpreter(TypedDict, total=False): + type: Required[Literal["code_interpreter"]] + + +class ToolShellEnvironmentContainerAutoNetworkPolicyDisabled(TypedDict, total=False): + type: Required[Literal["disabled"]] + """Disable outbound network access. Always `disabled`.""" + + +class ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist(TypedDict, total=False): + allowed_domains: Required[SequenceNotStr[str]] + """A list of allowed domains when type is `allowlist`.""" + + type: Required[Literal["allowlist"]] + """Allow outbound network access only to specified domains. Always `allowlist`.""" + + +ToolShellEnvironmentContainerAutoNetworkPolicy: TypeAlias = Union[ + ToolShellEnvironmentContainerAutoNetworkPolicyDisabled, ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist +] + + +class ToolShellEnvironmentContainerAutoSkillSkillReference(TypedDict, total=False): + skill_id: Required[str] + """The ID of the referenced skill.""" + + type: Required[Literal["skill_reference"]] + """References a skill created with the /v1/skills endpoint.""" + + version: Optional[str] + """Optional skill version. Use a positive integer or 'latest'. Omit for default.""" + + +class ToolShellEnvironmentContainerAutoSkillInlineSource(TypedDict, total=False): + """Inline skill payload""" + + data: Required[str] + """Base64-encoded skill zip bundle.""" + + media_type: Required[Literal["application/zip"]] + """The media type of the inline skill payload. Must be `application/zip`.""" + + type: Required[Literal["base64"]] + """The type of the inline skill source. Must be `base64`.""" + + +class ToolShellEnvironmentContainerAutoSkillInline(TypedDict, total=False): + description: Required[str] + """The description of the skill.""" + + name: Required[str] + """The name of the skill.""" + + source: Required[ToolShellEnvironmentContainerAutoSkillInlineSource] + """Inline skill payload""" + + type: Required[Literal["inline"]] + """Defines an inline skill for this request.""" + + +ToolShellEnvironmentContainerAutoSkill: TypeAlias = Union[ + ToolShellEnvironmentContainerAutoSkillSkillReference, ToolShellEnvironmentContainerAutoSkillInline +] + + +class ToolShellEnvironmentContainerAuto(TypedDict, total=False): + type: Required[Literal["container_auto"]] + """Automatically creates a container for this request""" + + file_ids: Optional[SequenceNotStr[str]] + """An optional list of uploaded files to make available to your code.""" + + memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]] + """The memory limit for the container.""" + + network_policy: Optional[ToolShellEnvironmentContainerAutoNetworkPolicy] + """Network access policy for the container.""" + + skills: Optional[Iterable[ToolShellEnvironmentContainerAutoSkill]] + """An optional list of skills referenced by id or inline data.""" + + +class ToolShellEnvironmentContainerReference(TypedDict, total=False): + container_id: Required[str] + """The ID of the referenced container.""" + + type: Required[Literal["container_reference"]] + """References a container created with the /v1/containers endpoint""" + + +class ToolShellEnvironmentLocalSkill(TypedDict, total=False): + description: Required[str] + """The description of the skill.""" + + name: Required[str] + """The name of the skill.""" + + path: Required[str] + """The path to the directory containing the skill.""" + + +class ToolShellEnvironmentLocal(TypedDict, total=False): + type: Required[Literal["local"]] + """Use a local computer environment.""" + + skills: Optional[Iterable[ToolShellEnvironmentLocalSkill]] + """An optional list of skills.""" + + +ToolShellEnvironment: TypeAlias = Union[ + ToolShellEnvironmentContainerAuto, ToolShellEnvironmentContainerReference, ToolShellEnvironmentLocal +] + + +class ToolShell(TypedDict, total=False): + """A Responses shell tool. + + Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported. + """ + + type: Required[Literal["shell"]] + + environment: Optional[ToolShellEnvironment] + + +class ToolImageGeneration(TypedDict, total=False): + type: Required[Literal["image_generation"]] + + +class ToolMcp(TypedDict, total=False): + type: Required[Literal["mcp"]] + + +class ToolCustom(TypedDict, total=False): + type: Required[Literal["custom"]] + + +class ToolNamespace(TypedDict, total=False): + type: Required[Literal["namespace"]] + + +class ToolSearch(TypedDict, total=False): + type: Required[Literal["tool_search"]] + + +class ToolProgrammaticToolCalling(TypedDict, total=False): + type: Required[Literal["programmatic_tool_calling"]] + + +class ToolComputer(TypedDict, total=False): + type: Required[Literal["computer"]] + + +class ToolApplyPatch(TypedDict, total=False): + type: Required[Literal["apply_patch"]] + + +Tool: TypeAlias = Union[ + FunctionToolParam, + ToolWebSearch, + ToolFileSearch, + ToolCodeInterpreter, + ToolShell, + ToolImageGeneration, + ToolMcp, + ToolCustom, + ToolNamespace, + ToolSearch, + ToolProgrammaticToolCalling, + ToolComputer, + ToolApplyPatch, +] class ResponsesDelegationConfigParam(TypedDict, total=False): diff --git a/src/openai/types/live/responses_delegation_update_config.py b/src/openai/types/live/responses_delegation_update_config.py index 03a01dacaf..89313284d2 100644 --- a/src/openai/types/live/responses_delegation_update_config.py +++ b/src/openai/types/live/responses_delegation_update_config.py @@ -14,8 +14,55 @@ "ToolChoice", "ToolChoiceLiveFunctionToolChoiceParam", "ToolChoiceLiveMCPToolChoiceParam", + "ToolChoiceFileSearch", + "ToolChoiceWebSearch", + "ToolChoiceWebSearchPreview", + "ToolChoiceImageGeneration", + "ToolChoiceComputer", + "ToolChoiceCodeInterpreter", + "ToolChoiceProgrammaticToolCalling", + "ToolChoiceShell", + "ToolChoiceCustom", + "ToolChoiceApplyPatch", + "ToolChoiceLiveAllowedToolsChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamTool", + "ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch", + "ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch", + "ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview", + "ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration", + "ToolChoiceLiveAllowedToolsChoiceParamToolComputer", + "ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter", + "ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling", + "ToolChoiceLiveAllowedToolsChoiceParamToolShell", + "ToolChoiceLiveAllowedToolsChoiceParamToolCustom", + "ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch", "Tool", "ToolWebSearch", + "ToolFileSearch", + "ToolCodeInterpreter", + "ToolShell", + "ToolShellEnvironment", + "ToolShellEnvironmentContainerAuto", + "ToolShellEnvironmentContainerAutoNetworkPolicy", + "ToolShellEnvironmentContainerAutoNetworkPolicyDisabled", + "ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist", + "ToolShellEnvironmentContainerAutoSkill", + "ToolShellEnvironmentContainerAutoSkillSkillReference", + "ToolShellEnvironmentContainerAutoSkillInline", + "ToolShellEnvironmentContainerAutoSkillInlineSource", + "ToolShellEnvironmentContainerReference", + "ToolShellEnvironmentLocal", + "ToolShellEnvironmentLocalSkill", + "ToolImageGeneration", + "ToolMcp", + "ToolCustom", + "ToolNamespace", + "ToolSearch", + "ToolProgrammaticToolCalling", + "ToolComputer", + "ToolApplyPatch", ] @@ -57,10 +104,182 @@ class ToolChoiceLiveMCPToolChoiceParam(BaseModel): server_label: str type: Literal["mcp"] + """The tool choice type. Always `allowed_tools`.""" + + +class ToolChoiceFileSearch(BaseModel): + type: Literal["file_search"] + """The tool to call. Always `file_search`.""" + + +class ToolChoiceWebSearch(BaseModel): + type: Literal["web_search"] + """The tool to call. Always `web_search`.""" + + +class ToolChoiceWebSearchPreview(BaseModel): + type: Literal["web_search_preview"] + """The tool to call. Always `web_search_preview`.""" + + +class ToolChoiceImageGeneration(BaseModel): + type: Literal["image_generation"] + """The tool to call. Always `image_generation`.""" + + +class ToolChoiceComputer(BaseModel): + type: Literal["computer"] + """The tool to call. Always `computer`.""" + + +class ToolChoiceCodeInterpreter(BaseModel): + type: Literal["code_interpreter"] + """The tool to call. Always `code_interpreter`.""" + + +class ToolChoiceProgrammaticToolCalling(BaseModel): + type: Literal["programmatic_tool_calling"] + """The tool to call. Always `programmatic_tool_calling`.""" + + +class ToolChoiceShell(BaseModel): + """Forces the model to call the shell tool when a tool call is required.""" + + type: Literal["shell"] + """The tool to call. Always `shell`.""" + + +class ToolChoiceCustom(BaseModel): + name: str + """The name of the custom tool to call.""" + + type: Literal["custom"] + """The tool to call. Always `custom`.""" + + +class ToolChoiceApplyPatch(BaseModel): + """Forces the model to call the apply_patch tool when executing a tool call.""" + + type: Literal["apply_patch"] + """The tool to call. Always `apply_patch`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam(BaseModel): + name: str + + type: Literal["function"] + + +class ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam(BaseModel): + name: str + + server_label: str + + type: Literal["mcp"] + + +class ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch(BaseModel): + type: Literal["file_search"] + """The tool to call. Always `file_search`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch(BaseModel): + type: Literal["web_search"] + """The tool to call. Always `web_search`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview(BaseModel): + type: Literal["web_search_preview"] + """The tool to call. Always `web_search_preview`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration(BaseModel): + type: Literal["image_generation"] + """The tool to call. Always `image_generation`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolComputer(BaseModel): + type: Literal["computer"] + """The tool to call. Always `computer`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter(BaseModel): + type: Literal["code_interpreter"] + """The tool to call. Always `code_interpreter`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling(BaseModel): + type: Literal["programmatic_tool_calling"] + """The tool to call. Always `programmatic_tool_calling`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolShell(BaseModel): + """Forces the model to call the shell tool when a tool call is required.""" + + type: Literal["shell"] + """The tool to call. Always `shell`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolCustom(BaseModel): + name: str + """The name of the custom tool to call.""" + + type: Literal["custom"] + """The tool to call. Always `custom`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch(BaseModel): + """Forces the model to call the apply_patch tool when executing a tool call.""" + + type: Literal["apply_patch"] + """The tool to call. Always `apply_patch`.""" + + +ToolChoiceLiveAllowedToolsChoiceParamTool: TypeAlias = Annotated[ + Union[ + ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam, + ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam, + ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch, + ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch, + ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview, + ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration, + ToolChoiceLiveAllowedToolsChoiceParamToolComputer, + ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter, + ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling, + ToolChoiceLiveAllowedToolsChoiceParamToolShell, + ToolChoiceLiveAllowedToolsChoiceParamToolCustom, + ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch, + ], + PropertyInfo(discriminator="type"), +] + + +class ToolChoiceLiveAllowedToolsChoiceParam(BaseModel): + tools: List[ToolChoiceLiveAllowedToolsChoiceParamTool] + """The tools that the delegated Responses model may call.""" + + type: Literal["allowed_tools"] + """The tool choice type. Always `allowed_tools`.""" + + mode: Optional[Literal["none", "auto", "required"]] = None + """How to select a tool from the allowed set.""" ToolChoice: TypeAlias = Union[ - Literal["auto", "none", "required"], ToolChoiceLiveFunctionToolChoiceParam, ToolChoiceLiveMCPToolChoiceParam + Literal["auto", "none", "required"], + ToolChoiceLiveFunctionToolChoiceParam, + ToolChoiceLiveMCPToolChoiceParam, + ToolChoiceFileSearch, + ToolChoiceWebSearch, + ToolChoiceWebSearchPreview, + ToolChoiceImageGeneration, + ToolChoiceComputer, + ToolChoiceCodeInterpreter, + ToolChoiceProgrammaticToolCalling, + ToolChoiceShell, + ToolChoiceCustom, + ToolChoiceApplyPatch, + ToolChoiceLiveAllowedToolsChoiceParam, ] @@ -71,7 +290,192 @@ class ToolWebSearch(BaseModel): """The tool type. Always `web_search`.""" -Tool: TypeAlias = Annotated[Union[FunctionTool, ToolWebSearch], PropertyInfo(discriminator="type")] +class ToolFileSearch(BaseModel): + type: Literal["file_search"] + + +class ToolCodeInterpreter(BaseModel): + type: Literal["code_interpreter"] + + +class ToolShellEnvironmentContainerAutoNetworkPolicyDisabled(BaseModel): + type: Literal["disabled"] + """Disable outbound network access. Always `disabled`.""" + + +class ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist(BaseModel): + allowed_domains: List[str] + """A list of allowed domains when type is `allowlist`.""" + + type: Literal["allowlist"] + """Allow outbound network access only to specified domains. Always `allowlist`.""" + + +ToolShellEnvironmentContainerAutoNetworkPolicy: TypeAlias = Annotated[ + Union[ + ToolShellEnvironmentContainerAutoNetworkPolicyDisabled, + ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist, + None, + ], + PropertyInfo(discriminator="type"), +] + + +class ToolShellEnvironmentContainerAutoSkillSkillReference(BaseModel): + skill_id: str + """The ID of the referenced skill.""" + + type: Literal["skill_reference"] + """References a skill created with the /v1/skills endpoint.""" + + version: Optional[str] = None + """Optional skill version. Use a positive integer or 'latest'. Omit for default.""" + + +class ToolShellEnvironmentContainerAutoSkillInlineSource(BaseModel): + """Inline skill payload""" + + data: str + """Base64-encoded skill zip bundle.""" + + media_type: Literal["application/zip"] + """The media type of the inline skill payload. Must be `application/zip`.""" + + type: Literal["base64"] + """The type of the inline skill source. Must be `base64`.""" + + +class ToolShellEnvironmentContainerAutoSkillInline(BaseModel): + description: str + """The description of the skill.""" + + name: str + """The name of the skill.""" + + source: ToolShellEnvironmentContainerAutoSkillInlineSource + """Inline skill payload""" + + type: Literal["inline"] + """Defines an inline skill for this request.""" + + +ToolShellEnvironmentContainerAutoSkill: TypeAlias = Annotated[ + Union[ToolShellEnvironmentContainerAutoSkillSkillReference, ToolShellEnvironmentContainerAutoSkillInline], + PropertyInfo(discriminator="type"), +] + + +class ToolShellEnvironmentContainerAuto(BaseModel): + type: Literal["container_auto"] + """Automatically creates a container for this request""" + + file_ids: Optional[List[str]] = None + """An optional list of uploaded files to make available to your code.""" + + memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]] = None + """The memory limit for the container.""" + + network_policy: Optional[ToolShellEnvironmentContainerAutoNetworkPolicy] = None + """Network access policy for the container.""" + + skills: Optional[List[ToolShellEnvironmentContainerAutoSkill]] = None + """An optional list of skills referenced by id or inline data.""" + + +class ToolShellEnvironmentContainerReference(BaseModel): + container_id: str + """The ID of the referenced container.""" + + type: Literal["container_reference"] + """References a container created with the /v1/containers endpoint""" + + +class ToolShellEnvironmentLocalSkill(BaseModel): + description: str + """The description of the skill.""" + + name: str + """The name of the skill.""" + + path: str + """The path to the directory containing the skill.""" + + +class ToolShellEnvironmentLocal(BaseModel): + type: Literal["local"] + """Use a local computer environment.""" + + skills: Optional[List[ToolShellEnvironmentLocalSkill]] = None + """An optional list of skills.""" + + +ToolShellEnvironment: TypeAlias = Annotated[ + Union[ToolShellEnvironmentContainerAuto, ToolShellEnvironmentContainerReference, ToolShellEnvironmentLocal, None], + PropertyInfo(discriminator="type"), +] + + +class ToolShell(BaseModel): + """A Responses shell tool. + + Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported. + """ + + type: Literal["shell"] + + environment: Optional[ToolShellEnvironment] = None + + +class ToolImageGeneration(BaseModel): + type: Literal["image_generation"] + + +class ToolMcp(BaseModel): + type: Literal["mcp"] + + +class ToolCustom(BaseModel): + type: Literal["custom"] + + +class ToolNamespace(BaseModel): + type: Literal["namespace"] + + +class ToolSearch(BaseModel): + type: Literal["tool_search"] + + +class ToolProgrammaticToolCalling(BaseModel): + type: Literal["programmatic_tool_calling"] + + +class ToolComputer(BaseModel): + type: Literal["computer"] + + +class ToolApplyPatch(BaseModel): + type: Literal["apply_patch"] + + +Tool: TypeAlias = Annotated[ + Union[ + FunctionTool, + ToolWebSearch, + ToolFileSearch, + ToolCodeInterpreter, + ToolShell, + ToolImageGeneration, + ToolMcp, + ToolCustom, + ToolNamespace, + ToolSearch, + ToolProgrammaticToolCalling, + ToolComputer, + ToolApplyPatch, + ], + PropertyInfo(discriminator="type"), +] class ResponsesDelegationUpdateConfig(BaseModel): diff --git a/src/openai/types/live/responses_delegation_update_config_param.py b/src/openai/types/live/responses_delegation_update_config_param.py index 740691d546..1143e62499 100644 --- a/src/openai/types/live/responses_delegation_update_config_param.py +++ b/src/openai/types/live/responses_delegation_update_config_param.py @@ -5,6 +5,7 @@ from typing import Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict +from ..._types import SequenceNotStr from .function_tool_param import FunctionToolParam __all__ = [ @@ -14,8 +15,55 @@ "ToolChoice", "ToolChoiceLiveFunctionToolChoiceParam", "ToolChoiceLiveMCPToolChoiceParam", + "ToolChoiceFileSearch", + "ToolChoiceWebSearch", + "ToolChoiceWebSearchPreview", + "ToolChoiceImageGeneration", + "ToolChoiceComputer", + "ToolChoiceCodeInterpreter", + "ToolChoiceProgrammaticToolCalling", + "ToolChoiceShell", + "ToolChoiceCustom", + "ToolChoiceApplyPatch", + "ToolChoiceLiveAllowedToolsChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamTool", + "ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam", + "ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch", + "ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch", + "ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview", + "ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration", + "ToolChoiceLiveAllowedToolsChoiceParamToolComputer", + "ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter", + "ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling", + "ToolChoiceLiveAllowedToolsChoiceParamToolShell", + "ToolChoiceLiveAllowedToolsChoiceParamToolCustom", + "ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch", "Tool", "ToolWebSearch", + "ToolFileSearch", + "ToolCodeInterpreter", + "ToolShell", + "ToolShellEnvironment", + "ToolShellEnvironmentContainerAuto", + "ToolShellEnvironmentContainerAutoNetworkPolicy", + "ToolShellEnvironmentContainerAutoNetworkPolicyDisabled", + "ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist", + "ToolShellEnvironmentContainerAutoSkill", + "ToolShellEnvironmentContainerAutoSkillSkillReference", + "ToolShellEnvironmentContainerAutoSkillInline", + "ToolShellEnvironmentContainerAutoSkillInlineSource", + "ToolShellEnvironmentContainerReference", + "ToolShellEnvironmentLocal", + "ToolShellEnvironmentLocalSkill", + "ToolImageGeneration", + "ToolMcp", + "ToolCustom", + "ToolNamespace", + "ToolSearch", + "ToolProgrammaticToolCalling", + "ToolComputer", + "ToolApplyPatch", ] @@ -57,10 +105,179 @@ class ToolChoiceLiveMCPToolChoiceParam(TypedDict, total=False): server_label: Required[str] type: Required[Literal["mcp"]] + """The tool choice type. Always `allowed_tools`.""" + + +class ToolChoiceFileSearch(TypedDict, total=False): + type: Required[Literal["file_search"]] + """The tool to call. Always `file_search`.""" + + +class ToolChoiceWebSearch(TypedDict, total=False): + type: Required[Literal["web_search"]] + """The tool to call. Always `web_search`.""" + + +class ToolChoiceWebSearchPreview(TypedDict, total=False): + type: Required[Literal["web_search_preview"]] + """The tool to call. Always `web_search_preview`.""" + + +class ToolChoiceImageGeneration(TypedDict, total=False): + type: Required[Literal["image_generation"]] + """The tool to call. Always `image_generation`.""" + + +class ToolChoiceComputer(TypedDict, total=False): + type: Required[Literal["computer"]] + """The tool to call. Always `computer`.""" + + +class ToolChoiceCodeInterpreter(TypedDict, total=False): + type: Required[Literal["code_interpreter"]] + """The tool to call. Always `code_interpreter`.""" + + +class ToolChoiceProgrammaticToolCalling(TypedDict, total=False): + type: Required[Literal["programmatic_tool_calling"]] + """The tool to call. Always `programmatic_tool_calling`.""" + + +class ToolChoiceShell(TypedDict, total=False): + """Forces the model to call the shell tool when a tool call is required.""" + + type: Required[Literal["shell"]] + """The tool to call. Always `shell`.""" + + +class ToolChoiceCustom(TypedDict, total=False): + name: Required[str] + """The name of the custom tool to call.""" + + type: Required[Literal["custom"]] + """The tool to call. Always `custom`.""" + + +class ToolChoiceApplyPatch(TypedDict, total=False): + """Forces the model to call the apply_patch tool when executing a tool call.""" + + type: Required[Literal["apply_patch"]] + """The tool to call. Always `apply_patch`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam(TypedDict, total=False): + name: Required[str] + + type: Required[Literal["function"]] + + +class ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam(TypedDict, total=False): + name: Required[str] + + server_label: Required[str] + + type: Required[Literal["mcp"]] + + +class ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch(TypedDict, total=False): + type: Required[Literal["file_search"]] + """The tool to call. Always `file_search`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch(TypedDict, total=False): + type: Required[Literal["web_search"]] + """The tool to call. Always `web_search`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview(TypedDict, total=False): + type: Required[Literal["web_search_preview"]] + """The tool to call. Always `web_search_preview`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration(TypedDict, total=False): + type: Required[Literal["image_generation"]] + """The tool to call. Always `image_generation`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolComputer(TypedDict, total=False): + type: Required[Literal["computer"]] + """The tool to call. Always `computer`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter(TypedDict, total=False): + type: Required[Literal["code_interpreter"]] + """The tool to call. Always `code_interpreter`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling(TypedDict, total=False): + type: Required[Literal["programmatic_tool_calling"]] + """The tool to call. Always `programmatic_tool_calling`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolShell(TypedDict, total=False): + """Forces the model to call the shell tool when a tool call is required.""" + + type: Required[Literal["shell"]] + """The tool to call. Always `shell`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolCustom(TypedDict, total=False): + name: Required[str] + """The name of the custom tool to call.""" + + type: Required[Literal["custom"]] + """The tool to call. Always `custom`.""" + + +class ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch(TypedDict, total=False): + """Forces the model to call the apply_patch tool when executing a tool call.""" + + type: Required[Literal["apply_patch"]] + """The tool to call. Always `apply_patch`.""" + + +ToolChoiceLiveAllowedToolsChoiceParamTool: TypeAlias = Union[ + ToolChoiceLiveAllowedToolsChoiceParamToolLiveFunctionToolChoiceParam, + ToolChoiceLiveAllowedToolsChoiceParamToolLiveMCPToolChoiceParam, + ToolChoiceLiveAllowedToolsChoiceParamToolFileSearch, + ToolChoiceLiveAllowedToolsChoiceParamToolWebSearch, + ToolChoiceLiveAllowedToolsChoiceParamToolWebSearchPreview, + ToolChoiceLiveAllowedToolsChoiceParamToolImageGeneration, + ToolChoiceLiveAllowedToolsChoiceParamToolComputer, + ToolChoiceLiveAllowedToolsChoiceParamToolCodeInterpreter, + ToolChoiceLiveAllowedToolsChoiceParamToolProgrammaticToolCalling, + ToolChoiceLiveAllowedToolsChoiceParamToolShell, + ToolChoiceLiveAllowedToolsChoiceParamToolCustom, + ToolChoiceLiveAllowedToolsChoiceParamToolApplyPatch, +] + + +class ToolChoiceLiveAllowedToolsChoiceParam(TypedDict, total=False): + tools: Required[Iterable[ToolChoiceLiveAllowedToolsChoiceParamTool]] + """The tools that the delegated Responses model may call.""" + + type: Required[Literal["allowed_tools"]] + """The tool choice type. Always `allowed_tools`.""" + + mode: Optional[Literal["none", "auto", "required"]] + """How to select a tool from the allowed set.""" ToolChoice: TypeAlias = Union[ - Literal["auto", "none", "required"], ToolChoiceLiveFunctionToolChoiceParam, ToolChoiceLiveMCPToolChoiceParam + Literal["auto", "none", "required"], + ToolChoiceLiveFunctionToolChoiceParam, + ToolChoiceLiveMCPToolChoiceParam, + ToolChoiceFileSearch, + ToolChoiceWebSearch, + ToolChoiceWebSearchPreview, + ToolChoiceImageGeneration, + ToolChoiceComputer, + ToolChoiceCodeInterpreter, + ToolChoiceProgrammaticToolCalling, + ToolChoiceShell, + ToolChoiceCustom, + ToolChoiceApplyPatch, + ToolChoiceLiveAllowedToolsChoiceParam, ] @@ -71,7 +288,182 @@ class ToolWebSearch(TypedDict, total=False): """The tool type. Always `web_search`.""" -Tool: TypeAlias = Union[FunctionToolParam, ToolWebSearch] +class ToolFileSearch(TypedDict, total=False): + type: Required[Literal["file_search"]] + + +class ToolCodeInterpreter(TypedDict, total=False): + type: Required[Literal["code_interpreter"]] + + +class ToolShellEnvironmentContainerAutoNetworkPolicyDisabled(TypedDict, total=False): + type: Required[Literal["disabled"]] + """Disable outbound network access. Always `disabled`.""" + + +class ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist(TypedDict, total=False): + allowed_domains: Required[SequenceNotStr[str]] + """A list of allowed domains when type is `allowlist`.""" + + type: Required[Literal["allowlist"]] + """Allow outbound network access only to specified domains. Always `allowlist`.""" + + +ToolShellEnvironmentContainerAutoNetworkPolicy: TypeAlias = Union[ + ToolShellEnvironmentContainerAutoNetworkPolicyDisabled, ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist +] + + +class ToolShellEnvironmentContainerAutoSkillSkillReference(TypedDict, total=False): + skill_id: Required[str] + """The ID of the referenced skill.""" + + type: Required[Literal["skill_reference"]] + """References a skill created with the /v1/skills endpoint.""" + + version: Optional[str] + """Optional skill version. Use a positive integer or 'latest'. Omit for default.""" + + +class ToolShellEnvironmentContainerAutoSkillInlineSource(TypedDict, total=False): + """Inline skill payload""" + + data: Required[str] + """Base64-encoded skill zip bundle.""" + + media_type: Required[Literal["application/zip"]] + """The media type of the inline skill payload. Must be `application/zip`.""" + + type: Required[Literal["base64"]] + """The type of the inline skill source. Must be `base64`.""" + + +class ToolShellEnvironmentContainerAutoSkillInline(TypedDict, total=False): + description: Required[str] + """The description of the skill.""" + + name: Required[str] + """The name of the skill.""" + + source: Required[ToolShellEnvironmentContainerAutoSkillInlineSource] + """Inline skill payload""" + + type: Required[Literal["inline"]] + """Defines an inline skill for this request.""" + + +ToolShellEnvironmentContainerAutoSkill: TypeAlias = Union[ + ToolShellEnvironmentContainerAutoSkillSkillReference, ToolShellEnvironmentContainerAutoSkillInline +] + + +class ToolShellEnvironmentContainerAuto(TypedDict, total=False): + type: Required[Literal["container_auto"]] + """Automatically creates a container for this request""" + + file_ids: Optional[SequenceNotStr[str]] + """An optional list of uploaded files to make available to your code.""" + + memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]] + """The memory limit for the container.""" + + network_policy: Optional[ToolShellEnvironmentContainerAutoNetworkPolicy] + """Network access policy for the container.""" + + skills: Optional[Iterable[ToolShellEnvironmentContainerAutoSkill]] + """An optional list of skills referenced by id or inline data.""" + + +class ToolShellEnvironmentContainerReference(TypedDict, total=False): + container_id: Required[str] + """The ID of the referenced container.""" + + type: Required[Literal["container_reference"]] + """References a container created with the /v1/containers endpoint""" + + +class ToolShellEnvironmentLocalSkill(TypedDict, total=False): + description: Required[str] + """The description of the skill.""" + + name: Required[str] + """The name of the skill.""" + + path: Required[str] + """The path to the directory containing the skill.""" + + +class ToolShellEnvironmentLocal(TypedDict, total=False): + type: Required[Literal["local"]] + """Use a local computer environment.""" + + skills: Optional[Iterable[ToolShellEnvironmentLocalSkill]] + """An optional list of skills.""" + + +ToolShellEnvironment: TypeAlias = Union[ + ToolShellEnvironmentContainerAuto, ToolShellEnvironmentContainerReference, ToolShellEnvironmentLocal +] + + +class ToolShell(TypedDict, total=False): + """A Responses shell tool. + + Use a hosted container or return local shell results with response.item.create. Domain secrets are not supported. + """ + + type: Required[Literal["shell"]] + + environment: Optional[ToolShellEnvironment] + + +class ToolImageGeneration(TypedDict, total=False): + type: Required[Literal["image_generation"]] + + +class ToolMcp(TypedDict, total=False): + type: Required[Literal["mcp"]] + + +class ToolCustom(TypedDict, total=False): + type: Required[Literal["custom"]] + + +class ToolNamespace(TypedDict, total=False): + type: Required[Literal["namespace"]] + + +class ToolSearch(TypedDict, total=False): + type: Required[Literal["tool_search"]] + + +class ToolProgrammaticToolCalling(TypedDict, total=False): + type: Required[Literal["programmatic_tool_calling"]] + + +class ToolComputer(TypedDict, total=False): + type: Required[Literal["computer"]] + + +class ToolApplyPatch(TypedDict, total=False): + type: Required[Literal["apply_patch"]] + + +Tool: TypeAlias = Union[ + FunctionToolParam, + ToolWebSearch, + ToolFileSearch, + ToolCodeInterpreter, + ToolShell, + ToolImageGeneration, + ToolMcp, + ToolCustom, + ToolNamespace, + ToolSearch, + ToolProgrammaticToolCalling, + ToolComputer, + ToolApplyPatch, +] class ResponsesDelegationUpdateConfigParam(TypedDict, total=False): diff --git a/tests/lib/live/test_delegation_transport.py b/tests/lib/live/test_delegation_transport.py new file mode 100644 index 0000000000..fc442e9901 --- /dev/null +++ b/tests/lib/live/test_delegation_transport.py @@ -0,0 +1,113 @@ +from __future__ import annotations + +import json + +import httpx2 +import pytest +from websockets.sync.server import ServerConnection + +from openai import OpenAI +from openai.types.live import SessionStartedEvent, SessionUpdatedEvent +from openai.types.live.session_resource import DelegationResponses +from openai.types.live.responses_delegation_config import ( + ToolShell, + ToolShellEnvironmentLocal, + ToolShellEnvironmentContainerAuto, + ToolChoiceLiveAllowedToolsChoiceParam, + ToolShellEnvironmentContainerAutoSkillSkillReference, + ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist, +) + +from ..responses.test_websocket_session import script_server + + +def test_live_delegation_response_fields_survive_transport(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setenv("NO_PROXY", "127.0.0.1") + monkeypatch.setenv("no_proxy", "127.0.0.1") + + def send_session(socket: ServerConnection, event_type: str, fields: dict[str, object]) -> None: + socket.send( + json.dumps( + { + "type": event_type, + "event_id": "event_fixture", + "session": { + "id": "live_fixture", + "model": "gpt-live-1", + "status": "active", + "expires_at": 123, + "delegation": {"type": "responses", "responses": {"model": "model_fixture", **fields}}, + }, + } + ) + ) + + def script(socket: ServerConnection) -> None: + assert json.loads(socket.recv(timeout=5))["type"] == "session.start" + send_session( + socket, + "session.started", + { + "tool_choice": {"type": "allowed_tools", "mode": "required", "tools": [{"type": "file_search"}]}, + "tools": [ + { + "type": "shell", + "environment": { + "type": "container_auto", + "file_ids": ["file_fixture"], + "memory_limit": "4g", + "network_policy": {"type": "allowlist", "allowed_domains": ["example.test"]}, + "skills": [{"type": "skill_reference", "skill_id": "skill_fixture", "version": "2"}], + }, + }, + { + "type": "shell", + "environment": { + "type": "local", + "skills": [{"name": "fixture", "description": "test skill", "path": "/fixture"}], + }, + }, + ], + }, + ) + for fields in ({"tools": None, "tool_choice": None}, {}): + assert json.loads(socket.recv(timeout=5))["type"] == "session.update" + send_session(socket, "session.updated", fields) + + with script_server(script) as url: + with OpenAI(api_key="fake-live-key", base_url=url, http_client=httpx2.Client(trust_env=False)) as client: + with client.live.connect() as connection: + connection.session.start(session={"model": "gpt-live-1"}) + started = connection.recv() + updates = [] + for _ in range(2): + connection.session.update(session={}) + updates.append(connection.recv()) + + assert isinstance(started, SessionStartedEvent) + assert isinstance(started.session.delegation, DelegationResponses) + responses = started.session.delegation.responses + assert isinstance(responses.tool_choice, ToolChoiceLiveAllowedToolsChoiceParam) + assert responses.tool_choice.mode == "required" + assert responses.tool_choice.tools[0].type == "file_search" + assert responses.tools is not None + hosted, local = responses.tools + assert isinstance(hosted, ToolShell) + assert isinstance(hosted.environment, ToolShellEnvironmentContainerAuto) + assert hosted.environment.file_ids == ["file_fixture"] + assert hosted.environment.memory_limit == "4g" + assert isinstance(hosted.environment.network_policy, ToolShellEnvironmentContainerAutoNetworkPolicyAllowlist) + assert hosted.environment.network_policy.allowed_domains == ["example.test"] + assert hosted.environment.skills is not None + assert isinstance(hosted.environment.skills[0], ToolShellEnvironmentContainerAutoSkillSkillReference) + assert hosted.environment.skills[0].version == "2" + assert isinstance(local, ToolShell) + assert isinstance(local.environment, ToolShellEnvironmentLocal) + assert local.environment.skills is not None + assert local.environment.skills[0].path == "/fixture" + + for updated in updates: + assert isinstance(updated, SessionUpdatedEvent) + assert isinstance(updated.session.delegation, DelegationResponses) + assert updated.session.delegation.responses.tool_choice is None + assert updated.session.delegation.responses.tools is None