Skip to content

Commit 701fe67

Browse files
committed
fix: use Claude Sonnet 4.5 with toolChoice required for reliable tool calling in tests
- Update tests to use anthropic/claude-sonnet-4.5 instead of gpt-4o-mini - Add toolChoice: 'required' to force tool usage - Fix type error in model-result.ts (use 'as' instead of 'satisfies') These changes ensure more reliable tool calling in CI tests.
1 parent bbab16a commit 701fe67

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/lib/model-result.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ export class ModelResult {
178178
// Since request is CallModelInput, we need to filter out tools/stopWhen
179179
// eslint-disable-next-line @typescript-eslint/no-unused-vars
180180
const { tools, stopWhen, ...rest } = this.options.request;
181-
// Use satisfies to validate type compatibility while maintaining the target type
182-
baseRequest = rest as ResolvedCallModelInput satisfies ResolvedCallModelInput;
181+
// Cast to ResolvedCallModelInput - we know it's resolved if hasAsyncFunctions returned false
182+
baseRequest = rest as ResolvedCallModelInput;
183183
}
184184

185185
// Store resolved request with stream mode

tests/e2e/call-model.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,14 @@ describe('callModel E2E Tests', () => {
9696

9797
it('should accept chat-style tools (ToolDefinitionJson)', async () => {
9898
const response = client.callModel({
99-
model: 'qwen/qwen3-vl-8b-instruct',
99+
model: 'anthropic/claude-sonnet-4.5',
100100
input: fromChatMessages([
101101
{
102102
role: 'user',
103-
content: "What's the weather in Paris? Use the get_weather tool.",
103+
content: "What's the weather in Paris?",
104104
},
105105
]),
106+
toolChoice: 'required',
106107
tools: [
107108
{
108109
type: ToolType.Function,
@@ -575,13 +576,14 @@ describe('callModel E2E Tests', () => {
575576

576577
it('should include OpenResponsesFunctionCallOutput with correct shape when tools are executed', async () => {
577578
const response = client.callModel({
578-
model: 'openai/gpt-4o-mini',
579+
model: 'anthropic/claude-sonnet-4.5',
579580
input: fromChatMessages([
580581
{
581582
role: 'user',
582-
content: "What's the weather in Tokyo? Use the get_weather tool.",
583+
content: "What's the weather in Tokyo?",
583584
},
584585
]),
586+
toolChoice: 'required',
585587
tools: [
586588
{
587589
type: ToolType.Function,

0 commit comments

Comments
 (0)