File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -136,12 +136,17 @@ const transformAndAppendThinkingMessageItem = (
136
136
} ;
137
137
138
138
const getMessageContent = ( message : Message ) => {
139
- if ( ! message . content && ! message . tool_calls ) return [ ] ;
139
+ if ( ! message . content && ! message . tool_calls && ! message . tool_call_id )
140
+ return [ ] ;
140
141
if ( message . role === 'tool' ) {
142
+ const toolResultContent = getMessageTextContentArray ( message ) ;
141
143
return [
142
144
{
143
145
toolResult : {
144
- content : getMessageTextContentArray ( message ) ,
146
+ ...( toolResultContent . length &&
147
+ ( toolResultContent [ 0 ] as { text : string } ) ?. text
148
+ ? { content : toolResultContent }
149
+ : { content : [ ] } ) , // Bedrock allows empty array but does not allow empty string in content.
145
150
toolUseId : message . tool_call_id ,
146
151
} ,
147
152
} ,
You can’t perform that action at this time.
0 commit comments