File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -529,8 +529,8 @@ export const BedrockChatCompleteResponseTransform: (
529
529
}
530
530
531
531
if ( 'output' in response ) {
532
- const cacheReadInputTokens = response . usage . cacheReadInputTokens || 0 ;
533
- const cacheWriteInputTokens = response . usage . cacheWriteInputTokens || 0 ;
532
+ const cacheReadInputTokens = response . usage ? .cacheReadInputTokens || 0 ;
533
+ const cacheWriteInputTokens = response . usage ? .cacheWriteInputTokens || 0 ;
534
534
535
535
let content : string = '' ;
536
536
content = response . output . message . content
@@ -574,7 +574,7 @@ export const BedrockChatCompleteResponseTransform: (
574
574
cached_tokens : cacheReadInputTokens ,
575
575
} ,
576
576
// we only want to be sending this for anthropic models and this is not openai compliant
577
- ...( ( cacheReadInputTokens || cacheWriteInputTokens ) && {
577
+ ...( ( cacheReadInputTokens > 0 || cacheWriteInputTokens > 0 ) && {
578
578
cache_read_input_tokens : cacheReadInputTokens ,
579
579
cache_creation_input_tokens : cacheWriteInputTokens ,
580
580
} ) ,
You can’t perform that action at this time.
0 commit comments