Skip to content

fix(mistral): keep seed=0 and the caller's extra_body - #475

Open
pcbeingused333 wants to merge 3 commits into
posit-dev:mainfrom
pcbeingused333:fixer3/fix/mistral-seed-extra-body
Open

pcbeingused333 wants to merge 3 commits into
posit-dev:mainfrom
pcbeingused333:fixer3/fix/mistral-seed-extra-body

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

MistralProvider._chat_perform_args translates seed into Mistral's random_seed through extra_body, with two problems:

  • The check was if seed := kwargs2.pop("seed", None), so seed=0 was falsy and the seed was dropped silently. ChatMistral(seed=0) sent no random_seed.
  • It assigned kwargs2["extra_body"] = {"random_seed": seed}, replacing any extra_body passed through kwargs (for example Mistral's safe_prompt).

Now any non-None seed is sent, and random_seed is merged into the existing extra_body. A non-integer seed still raises the same error.

Tests. Two tests in tests/test_provider_mistral.py check the request arguments for seed=0 and for a seed combined with a user extra_body; both fail on main and pass here, and the rest of that file passes. No request was made to the Mistral API.

This change was made with Claude Code.

🤖 Generated with Claude Code

pcbeingused333 and others added 3 commits October 21, 2026 03:19
ChatMistral translated `seed` to `extra_body={"random_seed": seed}` under a
truthiness check, so seed=0 was dropped, and it assigned a fresh extra_body,
discarding any extra_body supplied through kwargs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts:
#	CHANGELOG.md

This branch has not been deployed

No deployments
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.

1 participant