diff --git a/src/ax/ai/google-gemini/api.ts b/src/ax/ai/google-gemini/api.ts index 2c36af2..804f693 100644 --- a/src/ax/ai/google-gemini/api.ts +++ b/src/ax/ai/google-gemini/api.ts @@ -378,6 +378,10 @@ export class AxAIGoogleGemini extends AxBaseAI< throw new Error('Finish reason: RECITATION'); } + if (!candidate.content.parts) { + return result; + } + for (const part of candidate.content.parts) { if ('text' in part) { result.content = part.text;