Skip to content

Commit a7e1132

Browse files
committed
feat: add support for tool_choice to repsponses api
Signed-off-by: Jaideep Rao <[email protected]>
1 parent 4341c4c commit a7e1132

File tree

14 files changed

+48858
-1
lines changed

14 files changed

+48858
-1
lines changed

client-sdks/stainless/openapi.yml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6688,6 +6688,155 @@ components:
66886688
- $ref: '#/components/schemas/OpenAIResponseInputFunctionToolCallOutput'
66896689
- $ref: '#/components/schemas/OpenAIResponseMCPApprovalResponse'
66906690
- $ref: '#/components/schemas/OpenAIResponseMessage'
6691+
OpenAIResponseInputToolChoice:
6692+
oneOf:
6693+
- type: string
6694+
enum:
6695+
- auto
6696+
- required
6697+
- none
6698+
title: OpenAIResponseInputToolChoiceMode
6699+
- oneOf:
6700+
- $ref: '#/components/schemas/OpenAIResponseInputToolChoiceAllowedTools'
6701+
- $ref: '#/components/schemas/OpenAIResponseInputToolChoiceFileSearch'
6702+
- $ref: '#/components/schemas/OpenAIResponseInputToolChoiceWebSearch'
6703+
- $ref: '#/components/schemas/OpenAIResponseInputToolChoiceFunctionTool'
6704+
- $ref: '#/components/schemas/OpenAIResponseInputToolChoiceMCPTool'
6705+
- $ref: '#/components/schemas/OpenAIResponseInputToolChoiceCustomTool'
6706+
discriminator:
6707+
propertyName: type
6708+
mapping:
6709+
allowed_tools: '#/components/schemas/OpenAIResponseInputToolChoiceAllowedTools'
6710+
file_search: '#/components/schemas/OpenAIResponseInputToolChoiceFileSearch'
6711+
web_search_preview: '#/components/schemas/OpenAIResponseInputToolChoiceWebSearch'
6712+
function: '#/components/schemas/OpenAIResponseInputToolChoiceFunctionTool'
6713+
mcp: '#/components/schemas/OpenAIResponseInputToolChoiceMCPTool'
6714+
custom: '#/components/schemas/OpenAIResponseInputToolChoiceCustomTool'
6715+
"OpenAIResponseInputToolChoiceAllowedTools":
6716+
type: object
6717+
properties:
6718+
mode:
6719+
type: string
6720+
enum:
6721+
- auto
6722+
- required
6723+
default: auto
6724+
description: >-
6725+
Constrains the tools available to the model to a pre-defined set
6726+
tools:
6727+
type: array
6728+
items:
6729+
type: object
6730+
additionalProperties:
6731+
type: string
6732+
description: >-
6733+
A list of tool definitions that the model should be allowed to call
6734+
type:
6735+
type: string
6736+
const: allowed_tools
6737+
default: allowed_tools
6738+
description: >-
6739+
Tool choice type identifier, always "allowed_tools"
6740+
additionalProperties: false
6741+
required:
6742+
- mode
6743+
- tools
6744+
- type
6745+
title: >-
6746+
OpenAIResponseInputToolChoiceAllowedTools
6747+
description: >-
6748+
Constrains the tools available to the model to a pre-defined set.
6749+
OpenAIResponseInputToolChoiceCustomTool:
6750+
type: object
6751+
properties:
6752+
type:
6753+
type: string
6754+
const: custom
6755+
default: custom
6756+
description: >-
6757+
Tool choice type identifier, always "custom"
6758+
name:
6759+
type: string
6760+
description: The name of the custom tool to call.
6761+
additionalProperties: false
6762+
required:
6763+
- type
6764+
- name
6765+
title: OpenAIResponseInputToolChoiceCustomTool
6766+
description: Forces the model to call a custom tool.
6767+
OpenAIResponseInputToolChoiceFileSearch:
6768+
type: object
6769+
properties:
6770+
type:
6771+
type: string
6772+
const: file_search
6773+
default: file_search
6774+
description: >-
6775+
Tool choice type identifier, always "file_search"
6776+
additionalProperties: false
6777+
required:
6778+
- type
6779+
title: OpenAIResponseInputToolChoiceFileSearch
6780+
description: >-
6781+
Indicates that the model should use file search to generate a response.
6782+
"OpenAIResponseInputToolChoiceFunctionTool":
6783+
type: object
6784+
properties:
6785+
name:
6786+
type: string
6787+
description: The name of the function to call
6788+
type:
6789+
type: string
6790+
const: function
6791+
default: function
6792+
description: >-
6793+
Tool choice type identifier, always "function"
6794+
additionalProperties: false
6795+
required:
6796+
- name
6797+
- type
6798+
title: >-
6799+
OpenAIResponseInputToolChoiceFunctionTool
6800+
description: >-
6801+
Forces the model to call a specific function.
6802+
OpenAIResponseInputToolChoiceMCPTool:
6803+
type: object
6804+
properties:
6805+
server_label:
6806+
type: string
6807+
description: The label of the MCP server to use.
6808+
type:
6809+
type: string
6810+
const: mcp
6811+
default: mcp
6812+
description: >-
6813+
Tool choice type identifier, always "mcp"
6814+
name:
6815+
type: string
6816+
description: >-
6817+
(Optional) The name of the tool to call on the server.
6818+
additionalProperties: false
6819+
required:
6820+
- server_label
6821+
- type
6822+
title: OpenAIResponseInputToolChoiceMCPTool
6823+
description: >-
6824+
Forces the model to call a specific tool on a remote MCP server
6825+
OpenAIResponseInputToolChoiceWebSearch:
6826+
type: object
6827+
properties:
6828+
type:
6829+
type: string
6830+
const: web_search_preview
6831+
default: web_search_preview
6832+
description: >-
6833+
Tool choice type identifier, always "web_search_preview"
6834+
additionalProperties: false
6835+
required:
6836+
- type
6837+
title: OpenAIResponseInputToolChoiceWebSearch
6838+
description: >-
6839+
Indicates that the model should use web search to generate a response.
66916840
OpenAIResponseInputToolFileSearch:
66926841
type: object
66936842
properties:
@@ -6870,6 +7019,10 @@ components:
68707019
$ref: '#/components/schemas/OpenAIResponseTool'
68717020
description: >-
68727021
(Optional) An array of tools the model may call while generating a response.
7022+
tool_choice:
7023+
$ref: '#/components/schemas/OpenAIResponseInputToolChoice'
7024+
description: >-
7025+
(Optional) Tool choice configuration for the response.
68737026
truncation:
68747027
type: string
68757028
description: >-
@@ -7228,6 +7381,8 @@ components:
72287381
type: number
72297382
text:
72307383
$ref: '#/components/schemas/OpenAIResponseText'
7384+
tool_choice:
7385+
$ref: '#/components/schemas/OpenAIResponseInputToolChoice'
72317386
tools:
72327387
type: array
72337388
items:
@@ -7309,6 +7464,10 @@ components:
73097464
$ref: '#/components/schemas/OpenAIResponseTool'
73107465
description: >-
73117466
(Optional) An array of tools the model may call while generating a response.
7467+
tool_choice:
7468+
$ref: '#/components/schemas/OpenAIResponseInputToolChoice'
7469+
description: >-
7470+
(Optional) Tool choice configuration for the response.
73127471
truncation:
73137472
type: string
73147473
description: >-

0 commit comments

Comments
 (0)