fix: skip presence_penalty and frequency_penalty for Grok-3-mini and Grok-4 models#6749
Open
octo-patch wants to merge 1 commit intoChatGPTNextWeb:mainfrom
Open
Conversation
…Grok-4 models (fixes ChatGPTNextWeb#6593) xAI's Grok-3-mini and Grok-4 models do not accept the presence_penalty and frequency_penalty request parameters. Sending these params causes an API error. This change detects these model families and removes the unsupported parameters from the request payload.
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.
Fixes #6593
Problem
xAI's
grok-3-miniandgrok-4model families do not acceptpresence_penaltyandfrequency_penaltyparameters. When NextChat sends requests to these models with the default model config, the xAI API returns an error because these parameters are unsupported.Solution
Detect models matching
grok-3-miniorgrok-4patterns and removepresence_penaltyandfrequency_penaltyfrom the request payload before sending. Other xAI models (e.g.,grok-2,grok-beta) continue to receive these parameters as before.Testing
grok-3-miniorgrok-4as the model