Skip to content

Commit ccc9f3e

Browse files
authored
Correctly return tool input when creating the message
For tool calls which had no arguments, the tool input was returned as empty string which does not work for some models. fixes #15455
1 parent 11d0c9e commit ccc9f3e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/ai-chat/src/common/chat-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ export class ToolCallChatResponseContentImpl implements ToolCallChatResponseCont
10431043
actor: 'ai',
10441044
type: 'tool_use',
10451045
id: this.id ?? '',
1046-
input: (this.arguments && JSON.parse(this.arguments)) ?? undefined,
1046+
input: this.arguments && this.arguments.length !== 0 ? JSON.parse(this.arguments) : {},
10471047
name: this.name ?? ''
10481048
}, {
10491049
actor: 'user',

0 commit comments

Comments
 (0)