Fix seed field not bridged in SpeechRequest OpenAI conversion#262
Merged
Conversation
`SpeechRequest.to_openai` emitted the mistral-common field name `random_seed` instead of OpenAI's `seed`, and `SpeechRequest.from_openai` only copied keys that are model fields, so an OpenAI request's `seed` was silently dropped (`random_seed` stayed `None`). The sibling `TranscriptionRequest` already bridges the two names in both directions. Translate `random_seed` <-> `seed` in both converters so a seed survives the round trip and an OpenAI-style request with `seed` is honored.
juliendenize
approved these changes
Jul 15, 2026
juliendenize
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the contribution, made a minor update and will merge :)
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.
No linked issue — found by reading the code.
The bug
SpeechRequestuses the field namerandom_seed, while the OpenAI request format usesseed. Neither converter bridges the two:to_openai()returns the rawmodel_dump, so it emitsrandom_seed(a mistral-common-internal name) instead ofseed.from_openai()keeps only keys that are model fields, so an OpenAI request'sseedis never mapped torandom_seedand is silently dropped:Smoking gun
The sibling
TranscriptionRequestalready bridges the two names in both directions:SpeechRequestdoes neither, so it is inconsistent with its sibling.Fix
Translate
random_seed⇄seedin bothSpeechRequest.to_openaiandSpeechRequest.from_openai, mirroringTranscriptionRequest. A seed now survives the round trip and an OpenAI-style request withseedis honored.Testing
Added
test_convert_speech_request_seed, assertingto_openai()emitsseed(notrandom_seed) andfrom_openai({"seed": ...})setsrandom_seed. It fails before the change (KeyError: 'seed') and passes after; the fulltests/test_converters.pysuite passes (104 passed).ruff check/ruff format --checkare clean.