fix(llm): forward frequencyPenalty, presencePenalty, seed to Gemini#33326
Open
Robin1987China wants to merge 1 commit into
Open
fix(llm): forward frequencyPenalty, presencePenalty, seed to Gemini#33326Robin1987China wants to merge 1 commit into
Robin1987China wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #33325
Type of change
What does this PR do?
GenerationOptionsdefinesfrequencyPenalty,presencePenalty, andseedas user-settable generation parameters, and the OpenAI-chat protocol forwards all three. The Gemini protocol dropped them:GeminiGenerationConfigonly declaredmaxOutputTokens / temperature / topP / topK / stopSequences / thinkingConfig, and the request builder forwarded only those.Gemini's
generateContentgenerationConfigsupports all three, so values a user set were honored on OpenAI but silently ignored on Gemini. This PR adds the three fields toGeminiGenerationConfigand 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?
frequencyPenalty/presencePenalty/seedappear in the preparedgenerationConfigwhen 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