Repository navigation
Python: Fix Mistral AI seed setting being rejected by the SDK - #14677
Open
alexcastgonz (pcbeingused333) wants to merge 1 commit into
Open
alexcastgonz (pcbeingused333) wants to merge 1 commit into
alexcastgonz (pcbeingused333) wants to merge 1 commit into
Conversation
alexcastgonz (pcbeingused333)
deployed
to
github-app-auth
October 29, 2026 10:15 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the Mistral seed-parameter mapping change.
No open issues 🎉
What changed in this PR
This PR fixes seed handling in the Python Mistral AI connector by sending the SDK-supported random_seed parameter instead of seed.
Changes:
- Maps
seedtorandom_seed, preserving an explicitly suppliedrandom_seed. - Adds unit tests for seed mapping and explicit-value precedence.
- Updates streaming and non-streaming service tests to expect
random_seed.
| File | Description |
|---|---|
python/tests/unit/connectors/ai/mistral_ai/test_mistralai_request_settings.py |
Adds seed mapping and precedence tests. |
python/tests/unit/connectors/ai/mistral_ai/services/test_mistralai_chat_completion.py |
Updates expected SDK arguments for both completion modes. |
python/semantic_kernel/connectors/ai/mistral_ai/prompt_execution_settings/mistral_ai_prompt_execution_settings.py |
Converts seed to random_seed when preparing request settings. |
Review effort: Balanced
This branch was successfully deployed
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.
ChatRequest.Seedwas serialized for Mistral asseed, but Mistral's chat completions take the value asrandom_seed, so a seed set on the request did not reach the model as the deterministic-sampling seed.random_seedcould only be set throughChatRequestVendorMistralExtensions.RandomSeed.The Mistral request now maps
Seedtorandom_seedand no longer sendsseed.ChatRequestVendorMistralExtensions.RandomSeedstill takes precedence when set (before, the extension unconditionally overwrote the field, so a null extension value is now ignored instead of clearing the mapped seed).Added
MistralChatSeedTests(no network):Seedbecomesrandom_seedwithoutseed; the extension value wins overSeed; an extensions object withoutRandomSeedkeeps the seed; no seed sends neither field. Three of the four fail onmaster.This change was made with the help of an AI assistant (Claude Code); the tests were run locally on net8.0.