Skip to content

fix(llm): forward frequencyPenalty, presencePenalty, seed to Gemini#33326

Open
Robin1987China wants to merge 1 commit into
anomalyco:devfrom
Robin1987China:gemini-generation-params
Open

fix(llm): forward frequencyPenalty, presencePenalty, seed to Gemini#33326
Robin1987China wants to merge 1 commit into
anomalyco:devfrom
Robin1987China:gemini-generation-params

Conversation

@Robin1987China

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #33325

Type of change

  • Bug fix

What does this PR do?

GenerationOptions defines frequencyPenalty, presencePenalty, and seed as user-settable generation parameters, and the OpenAI-chat protocol forwards all three. The Gemini protocol dropped them: GeminiGenerationConfig only declared maxOutputTokens / temperature / topP / topK / stopSequences / thinkingConfig, and the request builder forwarded only those.

Gemini's generateContent generationConfig supports all three, so values a user set were honored on OpenAI but silently ignored on Gemini. This PR adds the three fields to GeminiGenerationConfig and forwards them in the request builder, gated by the existing all-undefined guard so unset requests are unchanged.

How did you verify your code works?

  • Added a test asserting frequencyPenalty / presencePenalty / seed appear in the prepared generationConfig when set.
  • bun test test/provider/gemini.test.ts — 20 pass (existing "prepares Gemini target" test confirms the unset case still omits them).
  • bun typecheck (packages/llm) — clean.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

GenerationOptions defines frequencyPenalty, presencePenalty, and seed as
user-settable generation parameters, and the OpenAI-chat protocol forwards
all three. The Gemini protocol dropped them: GeminiGenerationConfig only
declared maxOutputTokens/temperature/topP/topK/stopSequences/thinkingConfig
and the request builder forwarded only those.

Gemini's generateContent generationConfig supports all three, so values a
user sets were honored on OpenAI but silently ignored on Gemini. Add the
three fields to the schema and forward them, gated by the existing
all-undefined guard so unset requests are unchanged.

Closes anomalyco#33325
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gemini protocol drops frequencyPenalty, presencePenalty, and seed generation options

1 participant