File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
libs/providers/langchain-google-genai/src/utils Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @langchain/google-genai " : patch
3+ ---
4+
5+ safe access around custom content parts
Original file line number Diff line number Diff line change @@ -527,7 +527,7 @@ export function mapGenerateContentResultToChatResult(
527527 }
528528 const [ candidate ] = response . candidates ;
529529 const { content : candidateContent , ...generationInfo } = candidate ;
530- const functionCalls = candidateContent . parts . reduce ( ( acc , p ) => {
530+ const functionCalls = candidateContent . parts ? .reduce ( ( acc , p ) => {
531531 if ( "functionCall" in p && p . functionCall ) {
532532 acc . push ( {
533533 ...p ,
@@ -655,7 +655,7 @@ export function convertResponseContentToChatGenerationChunk(
655655 }
656656 const [ candidate ] = response . candidates ;
657657 const { content : candidateContent , ...generationInfo } = candidate ;
658- const functionCalls = candidateContent . parts . reduce ( ( acc , p ) => {
658+ const functionCalls = candidateContent . parts ? .reduce ( ( acc , p ) => {
659659 if ( "functionCall" in p && p . functionCall ) {
660660 acc . push ( {
661661 ...p ,
You can’t perform that action at this time.
0 commit comments