Skip to content

Commit 08975f7

Browse files
committed
fix: add tool use event handling in Bedrock messages transformer
1 parent 6eb689b commit 08975f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/providers/bedrock/messages.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,14 @@ export const BedrockConverseMessagesStreamChunkTransform = (
548548
const contentBlockStartEvent: RawContentBlockStartEvent = JSON.parse(
549549
ANTHROPIC_CONTENT_BLOCK_START_EVENT
550550
);
551+
if (parsedChunk.start?.toolUse) {
552+
contentBlockStartEvent.content_block = {
553+
type: 'tool_use',
554+
id: parsedChunk.start.toolUse.toolUseId,
555+
name: parsedChunk.start.toolUse.name,
556+
input: parsedChunk.start.toolUse.input || {},
557+
};
558+
}
551559
contentBlockStartEvent.index = parsedChunk.contentBlockIndex;
552560
returnChunk += `event: content_block_start\ndata: ${JSON.stringify(contentBlockStartEvent)}\n\n`;
553561
const contentBlockDeltaEvent = transformContentBlock(parsedChunk);

0 commit comments

Comments
 (0)