diff --git a/src/endpoints/backends/chat-completions.js b/src/endpoints/backends/chat-completions.js index 1e7cc1867..cef8b906d 100644 --- a/src/endpoints/backends/chat-completions.js +++ b/src/endpoints/backends/chat-completions.js @@ -334,7 +334,7 @@ async function sendMakerSuiteRequest(request, response) { } const responseContent = candidates[0].content ?? candidates[0].output; - const responseText = typeof responseContent === 'string' ? responseContent : responseContent.parts?.[0]?.text; + const responseText = typeof responseContent === 'string' ? responseContent : responseContent?.parts?.[0]?.text; if (!responseText) { let message = 'MakerSuite Candidate text empty'; console.log(message, generateResponseJson);