Skip to content

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
octo-patch:fix/issue-6593-xai-grok-unsupported-penalty-params
Open

fix: skip presence_penalty and frequency_penalty for Grok-3-mini and Grok-4 models#6749
octo-patch wants to merge 1 commit intoChatGPTNextWeb:mainfrom
octo-patch:fix/issue-6593-xai-grok-unsupported-penalty-params

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #6593

Problem

xAI's grok-3-mini and grok-4 model families do not accept presence_penalty and frequency_penalty parameters. 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-mini or grok-4 patterns and remove presence_penalty and frequency_penalty from the request payload before sending. Other xAI models (e.g., grok-2, grok-beta) continue to receive these parameters as before.

Testing

  • Configure NextChat with an xAI API key and select grok-3-mini or grok-4 as the model
  • Chat should work without API errors related to unsupported parameters
  • Other Grok models (grok-2, grok-beta) are unaffected

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 使用Grok-3-mini或者Grok-4(手动配置)模型时,程序默认传入presence_penalty和frequency_penalty参数导致报错

1 participant