Skip to content

Commit a5360d4

Browse files
committed
feat: allow tool_call to be object for granular capabilities
- Update schema to accept boolean OR object for tool_call - Add streaming and coerces_types optional fields - Update meta.llama3-3-70b-instruct-v1:0 as example - Documents Bedrock streaming limitation and type coercion Addresses provider-specific tool calling limitations documented in: - AWS re:Post (streaming, type coercion issues) - langchain-aws #140, #354 - pydantic-ai #1649 100% backward compatible at TOML level - existing tool_call = true/false still valid
1 parent 8379242 commit a5360d4

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

packages/core/src/schema.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ export const Model = z
77
attachment: z.boolean(),
88
reasoning: z.boolean(),
99
temperature: z.boolean(),
10-
tool_call: z.boolean(),
10+
tool_call: z
11+
.union([
12+
z.boolean(),
13+
z
14+
.object({
15+
supported: z.boolean(),
16+
streaming: z.boolean().optional(),
17+
coerces_types: z.boolean().optional(),
18+
})
19+
.strict(),
20+
])
21+
.describe(
22+
"Supports tool calling. Can be a boolean or an object for granular capabilities.",
23+
),
1124
knowledge: z
1225
.string()
1326
.regex(/^\d{4}-\d{2}(-\d{2})?$/, {
@@ -71,7 +84,7 @@ export const Model = z
7184
{
7285
message: "Cannot set cost.reasoning when reasoning is false",
7386
path: ["cost", "reasoning"],
74-
}
87+
},
7588
);
7689

7790
export type Model = z.infer<typeof Model>;
@@ -87,7 +100,7 @@ export const Provider = z
87100
.string()
88101
.min(
89102
1,
90-
"Please provide a link to the provider documentation where models are listed"
103+
"Please provide a link to the provider documentation where models are listed",
91104
),
92105
models: z.record(Model),
93106
})
@@ -103,6 +116,6 @@ export const Provider = z
103116
message:
104117
"'api' field is required if and only if npm is '@ai-sdk/openai-compatible'",
105118
path: ["api"],
106-
}
119+
},
107120
);
108121
export type Provider = z.infer<typeof Provider>;

providers/amazon-bedrock/models/meta.llama3-3-70b-instruct-v1:0.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ attachment = false
55
reasoning = false
66
temperature = true
77
knowledge = "2023-12"
8-
tool_call = true
98
open_weights = true
109

10+
[tool_call]
11+
supported = true
12+
streaming = false
13+
coerces_types = true
14+
1115
[cost]
1216
input = 0.72
1317
output = 0.72

0 commit comments

Comments
 (0)