ToolChoiceAllowed interface

限制模型可用的工具於預先定義的集合。

Extends

屬性

mode

限制模型可用的工具於預先定義的集合。 auto 讓模型能從允許的工具中選擇並產生訊息。 required 需要模型呼叫一個或多個允許的工具。

tools

一份模型應被允許呼叫的工具定義清單。 對於回應 API,工具定義清單可能如下:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
type

允許的工具配置類型。 一律為 allowed_tools

屬性詳細資料

mode

限制模型可用的工具於預先定義的集合。 auto 讓模型能從允許的工具中選擇並產生訊息。 required 需要模型呼叫一個或多個允許的工具。

mode: "auto" | "required"

屬性值

"auto" | "required"

tools

一份模型應被允許呼叫的工具定義清單。 對於回應 API,工具定義清單可能如下:

[
  { "type": "function", "name": "get_weather" },
  { "type": "mcp", "server_label": "deepwiki" },
  { "type": "image_generation" }
]
tools: Record<string, unknown>[]

屬性值

Record<string, unknown>[]

type

允許的工具配置類型。 一律為 allowed_tools

type: "allowed_tools"

屬性值

"allowed_tools"