From cfe234cb658645133f70d5e05560649b77266a0c Mon Sep 17 00:00:00 2001 From: yair Date: Tue, 24 Jun 2025 13:20:36 +0300 Subject: [PATCH] fix tool call with no args --- .gitignore | 5 ++++- src/handlers/bedrock.ts | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 105a52f..08fdf91 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,7 @@ /dist -*.tsbuildinfo \ No newline at end of file +*.tsbuildinfo + +.idea/ +*.iml diff --git a/src/handlers/bedrock.ts b/src/handlers/bedrock.ts index 268e3fd..43ca65f 100644 --- a/src/handlers/bedrock.ts +++ b/src/handlers/bedrock.ts @@ -492,7 +492,6 @@ async function* createCompletionResponseStreaming( type: 'function', function: { name: stream.contentBlockStart.start.toolUse.name, - arguments: '{}', }, }, ], @@ -544,7 +543,19 @@ async function* createCompletionResponseStreaming( index: 0, finish_reason: finishReason, logprobs: null, - delta, + delta: + finishReason === 'tool_calls' + ? { + tool_calls: [ + { + index: 0, + function: { + arguments: '{}', + }, + }, + ], + } + : delta, }, ], created,