Skip to content

Commit 314cd8d

Browse files
committed
fix(core): default tool-call input to {} when undefined in convertToModelMessages
When a tool has no parameters, the UI message part omits `input`. convertToModelMessages propagated this omission, causing OpenAI to reject the request with "Missing required parameter: arguments". Now defaults to empty object. Fixes #14349
1 parent 6e706db commit 314cd8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/ai/src/ui/convert-to-model-messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export async function convertToModelMessages<UI_MESSAGE extends UIMessage>(
206206
part.state === 'output-error'
207207
? (part.input ??
208208
('rawInput' in part ? part.rawInput : undefined))
209-
: part.input,
209+
: (part.input ?? {}),
210210
providerExecuted: part.providerExecuted,
211211
...(part.callProviderMetadata != null
212212
? { providerOptions: part.callProviderMetadata }

0 commit comments

Comments
 (0)