fix(speech-to-text): send keyterms as repeated multipart form fields - #824
Closed
fern-api[bot] wants to merge 1 commit into
Closed
fern-api[bot] wants to merge 1 commit into
fern-api[bot] wants to merge 1 commit into
Conversation
Member
|
Superseded by #825 (since the regression is not contained to the |
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.
Summary
Stopgap fix so
speech_to_text.convert(keyterms=[...])works without upgrading the Python SDK generator (this repo is on generator4.64.1).keyterms(anOptional[List[str]]multipart body property) was serialized as a single JSON-encoded form field:The API validates each keyterm individually, so the whole JSON-array string is treated as one keyword and rejected (400
invalid_keyword/invalid_keyword_length;[ ] "are also unsupported characters). This is the elevenlabs-python#819 regression.Change
Pass the list straight through
jsonable_encoderso httpx emits repeated form fields (keyterms=hello,keyterms=world), matching pre-2.59.0 behavior and what the API expects:This is byte-for-byte what Fern's Python generator
>=5.22.2now emits (upstream fix: fern-api/fern#17226), so the manual edit and the eventual generator upgrade converge.Files changed (2)
src/elevenlabs/speech_to_text/raw_client.py— sync + asyncconvert(2 lines)..fernignore— addraw_client.pyso SDK regeneration won't overwrite this patch while staying on generator 4.64.1.Notes
keyterms; other fields (entity_detection,additional_formats, etc.) are unchanged.>=5.22.2, this patch becomes redundant and the.fernignoreentry can be removed.Note
Low Risk
Narrow request-encoding fix for an optional STT parameter; no auth, billing, or broader API surface changes.
Overview
Fixes
speech_to_text.convert(keyterms=[...])failing with API 400s (invalid_keyword/invalid_keyword_length) becausekeytermswas sent as one JSON-encoded multipart field instead of repeatedkeyterms=fields per term.In
src/elevenlabs/speech_to_text/raw_client.py, sync and asyncconvertnow passjsonable_encoder(keyterms)(or omit when unset) instead ofjson.dumps(jsonable_encoder(keyterms)), so httpx emits the repeated form fields the API validates individually. Other multipart fields are unchanged..fernignorenow includesraw_client.pyso Fern regeneration on generator 4.64.1 does not revert this stopgap until the SDK bumps to generator ≥5.22.2.Reviewed by Cursor Bugbot for commit 4220b3c. Bugbot is set up for automated code reviews on this repo. Configure here.