@@ -56,14 +56,13 @@ export interface IdentifiedSchema<A, I, R> extends Schema.Schema<A, I, R> {
56
56
* - `auto` (default): The model can decide whether or not to call tools, as well as which tools to call.
57
57
* - `required`: The model **must** call a tool but can decide which tool will be called.
58
58
* - `none`: The model **must not** call a tool.
59
- * - `{ type: " tool", name : <tool_name> }`: The model must call the specified tool.
59
+ * - `{ tool: <tool_name> }`: The model must call the specified tool.
60
60
*
61
61
* @since 1.0.0
62
62
* @category Models
63
63
*/
64
64
export type ToolChoice < Tool extends AiTool . Any > = "auto" | "none" | "required" | {
65
- readonly type : "tool"
66
- readonly name : Tool [ "name" ]
65
+ readonly tool : Tool [ "name" ]
67
66
}
68
67
69
68
/**
@@ -95,7 +94,7 @@ export interface GenerateTextOptions<Tools extends AiTool.Any> {
95
94
* - `auto` (default): The model can decide whether or not to call tools, as well as which tools to call.
96
95
* - `required`: The model **must** call a tool but can decide which tool will be called.
97
96
* - `none`: The model **must not** call a tool.
98
- * - `{ type: " tool", name : <tool_name> }`: The model must call the specified tool.
97
+ * - `{ tool: <tool_name> }`: The model must call the specified tool.
99
98
*/
100
99
readonly toolChoice ?: ToolChoice < Tools >
101
100
@@ -286,7 +285,7 @@ export interface AiLanguageModelOptions {
286
285
* - `auto` (default): The model can decide whether or not to call tools, as well as which tools to call.
287
286
* - `required`: The model **must** call a tool but can decide which tool will be called.
288
287
* - `none`: The model **must not** call a tool.
289
- * - `{ type: " tool", name : <tool_name> }`: The model must call the specified tool.
288
+ * - `{ tool: <tool_name> }`: The model must call the specified tool.
290
289
*/
291
290
readonly toolChoice : ToolChoice < any >
292
291
/**
@@ -383,7 +382,7 @@ export const make = <Config>(opts: {
383
382
const system = Option . fromNullable ( options . system )
384
383
const decode = Schema . decodeUnknown ( options . schema )
385
384
const tool = convertStructured ( toolCallId , options . schema )
386
- const toolChoice = { type : " tool" , name : tool . name } as const
385
+ const toolChoice = { tool : tool . name } as const
387
386
const response = yield * opts . generateText ( { prompt, system, tools : [ tool ] , toolChoice, span } )
388
387
const toolCallPart = response . parts . find ( ( part ) : part is AiResponse . ToolCallPart =>
389
388
part . _tag === "ToolCallPart" && part . name === toolCallId
0 commit comments