fix: Gemini 2.5 requests fail when frequency or presence penalties are configured (#18051)
## Background Gemini 2.5 Flash, Flash-Lite, and Pro returned HTTP 400 INVALID_ARGUMENT when frequencyPenalty or presencePenalty was configured through @ai-sdk/google. ## Root Cause GoogleLanguageModel forwarded penalty settings unconditionally. Fixture and live API reproductions confirmed that Gemini 2.5 rejects those request fields while equivalent requests without them succeed. ## Summary Gemini 2.5 requests now omit unsupported penalty settings and return unsupported warnings. Gemini 2.0 forwarding remains unchanged, and a patch changeset was added. ## Testing Added regression cases for both penalties across Gemini 2.5 Pro, Flash, and Flash-Lite, plus coverage confirming Gemini 2.0 still receives both settings. ## End-to-end Validation - `pnpm -C packages/google build` followed by `pnpm -C examples/ai-functions exec tsx -e <live validation>`: all six Gemini 2.5 requests omitted penalties, emitted the expected warnings, and returned HTTP 200. ## Related Issues Fixes #8943 Closes #17862 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: lgrammel <lars.grammel@gmail.com> Co-authored-by: ndaidong <1809619+ndaidong@users.noreply.github.com> Co-authored-by: Lars Grammel <205036+lgrammel@users.noreply.github.com> Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
e9bc6182b524192db835a145003dd75fc329c90d
Parent: 3ad9da9
Committed by GitHub <noreply@github.com>
on 8/27/2026, 5:49:31 PM