Repository navigation
fix(py/openai): don't send a blank transcription prompt - #136
Merged
Merged
Conversation
The Dev UI sends a " " text part next to attached audio. The STT model forwarded it as `prompt`, which diarization models reject with a 400 and which made gpt-4o-transcribe drop speech. Skip whitespace-only prompts from config or message text.
cabljac
marked this pull request as ready for review
November 17, 2026 15:48
huangjeff5
approved these changes
Nov 17, 2026
This was referenced Nov 18, 2026
Merged
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.
What's new
prompt, whether it comes fromconfig.promptor from message text. Non-blank prompts go out unchanged.config.promptnow falls back to the message text, asNonealready did. Before, the blank was sent._find_textis unchanged, so TTS input is not affected.Why
Transcribing audio from the Dev UI model playground with
gpt-4o-transcribe-diarizefails every time:The Dev UI sends a
" "text part next to attached audio, and the plugin forwarded it asprompt. Withgpt-4o-transcribethe blank prompt also made the model drop the second sentence in 3/3 runs.Tests
packages/genkit-openai/tests/openai_generate_config_test.py:test_generate_openai_stt_omits_blank_promptpins nopromptfield for a" "text part, forconfig={'prompt': ' '}, and for whisper-1 withtranslate: True(/audio/translations). A real message prompt still goes out with a blank config prompt. Fails before the fix.pytest packages/genkit-openai: 497 passed.gpt-4o-transcribe-diarizeandgpt-4o-transcribewith[" ", audio]now return the full transcript.Not in this PR
extra.prompt. A blank prompt passed viaconfig={'extra': {'prompt': ' '}}is still forwarded, sinceextrais unchecked by design._find_textreturns the first non-empty text part, so[" ", "real prompt", audio]sends no prompt (main sent" ").gpt-4o-transcribe-diarizelisted as a transcription model.