File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -802,6 +802,9 @@ export const GoogleChatCompleteStreamChunkTransform: (
802
802
...( ! strictOpenAiCompliance && {
803
803
safetyRatings : generation . safetyRatings ,
804
804
} ) ,
805
+ ...( ! strictOpenAiCompliance && generation . groundingMetadata
806
+ ? { groundingMetadata : generation . groundingMetadata }
807
+ : { } ) ,
805
808
} ;
806
809
} ) ?? [ ] ,
807
810
usage : usageMetadata ,
Original file line number Diff line number Diff line change @@ -520,8 +520,15 @@ export const GoogleChatCompleteResponseTransform: (
520
520
521
521
export const GoogleChatCompleteStreamChunkTransform : (
522
522
response : string ,
523
- fallbackId : string
524
- ) => string = ( responseChunk , fallbackId ) => {
523
+ fallbackId : string ,
524
+ streamState : any ,
525
+ strictOpenAiCompliance : boolean
526
+ ) => string = (
527
+ responseChunk ,
528
+ fallbackId ,
529
+ _streamState ,
530
+ strictOpenAiCompliance
531
+ ) => {
525
532
let chunk = responseChunk . trim ( ) ;
526
533
if ( chunk . startsWith ( '[' ) ) {
527
534
chunk = chunk . slice ( 1 ) ;
@@ -578,6 +585,9 @@ export const GoogleChatCompleteStreamChunkTransform: (
578
585
delta : message ,
579
586
index : generation . index ?? index ,
580
587
finish_reason : generation . finishReason ,
588
+ ...( ! strictOpenAiCompliance && generation . groundingMetadata
589
+ ? { groundingMetadata : generation . groundingMetadata }
590
+ : { } ) ,
581
591
} ;
582
592
} ) ?? [ ] ,
583
593
usage : {
You can’t perform that action at this time.
0 commit comments