Skip to content

fix(openai_compat): omit reasoning_content for Mistral requests#2019

Open
Alix-007 wants to merge 2 commits intosipeed:mainfrom
Alix-007:fix/issue-1502-mistral-extra-content
Open

fix(openai_compat): omit reasoning_content for Mistral requests#2019
Alix-007 wants to merge 2 commits intosipeed:mainfrom
Alix-007:fix/issue-1502-mistral-extra-content

Conversation

@Alix-007
Copy link
Contributor

Problem

  • Mistral chat-completions rejects unknown message fields and returns a 422 error ("Extra inputs are not permitted") when reasoning_content is present in history messages.
  • openai_compat currently serializes reasoning_content unconditionally, which breaks Mistral compatibility.

Fix

  • In openai_compat, sanitize outbound messages for Mistral hosts by omitting reasoning_content before serialization.
  • Keep behavior unchanged for other OpenAI-compatible providers.
  • Add focused regression tests for Mistral omission and host detection.

Validation

  • go test ./pkg/providers/openai_compat -run "TestProviderChat_OmitsReasoningContentForMistral|TestProviderChat_PreservesReasoningContentInHistory|TestIsReasoningContentUnsupportedHost"

Closes #1502

@sipeed-bot sipeed-bot bot added type: bug Something isn't working domain: provider go Pull requests that update go code labels Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: provider go Pull requests that update go code type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Mistral integration fails with "Extra inputs..."

1 participant