feat: support speed, stability and similarity_boost in TtsOverrides - #65
Open
Darnasis wants to merge 1 commit into
Open
feat: support speed, stability and similarity_boost in TtsOverrides#65Darnasis wants to merge 1 commit into
Darnasis wants to merge 1 commit into
Conversation
`conversation_config_override.tts` accepts `voice_id`, `speed`, `stability` and `similarity_boost`, and agents expose a Security -> Overrides toggle for each. The Kotlin SDK could only express `voice_id`, so the other three were unreachable from Android even with the toggles enabled — there was no way to start a conversation at a different speed. - TtsOverrides gains speed, stability and similarityBoost (all nullable). - ConversationOverridesBuilder serializes them, keeping the existing omit-when-null behaviour so a partially-populated TtsOverrides never widens into explicit nulls. Adds ConversationOverridesBuilderTest, the first coverage of constructOverrides: per-field serialization, snake_case key mapping, omit-when-null, an entirely empty TtsOverrides emitting no `tts` object, and agent overrides still serializing alongside tts. org.json was already a test dependency, so no build changes were needed. `./gradlew :elevenlabs-sdk:testDebugUnitTest` passes.
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.
Problem
conversation_config_override.ttsacceptsvoice_id,speed,stabilityandsimilarity_boost, and agents expose a Security → Overrides toggle for each one. The Kotlin SDK can only expressvoice_id:So on Android the other three are unreachable even with the toggles enabled — there is no way to start a conversation at a different speed. The Python/JS SDKs and the docs' own override examples all support the full block, so this reads as an Android gap rather than an intentional limit.
Concretely: we build a voice tutor whose users set a speech-rate preference. We can apply their chosen voice, but not their chosen speed, purely because the field cannot be expressed.
Change
TtsOverridesgainsspeed,stabilityandsimilarityBoost, all nullable, defaulting tonull— source- and binary-compatible for existing callers, who keep constructingTtsOverrides(voiceId = ...)unchanged.ConversationOverridesBuilderserializes them with the documented snake_case keys, keeping the existing omit-when-null behaviour so a partially-populatedTtsOverridesnever widens into explicit nulls (the docs specifically ask callers to omit rather than send nulls).Tests
Adds
ConversationOverridesBuilderTest— as far as I can tell the first coverage ofconstructOverrides:similarity_boostsnake_case mappingTtsOverrides(speed = 1.1)emits exactly one keyTtsOverridesemits nottsobject at all (existing behaviour, now pinned)ttsorg.jsonwas already atestImplementationdependency, so no build changes were needed../gradlew :elevenlabs-sdk:testDebugUnitTestpasses (7/7 new, existing suite green).Notes
Happy to adjust naming (
similarityBoostfollows the existing camelCase-in-Kotlin / snake_case-on-the-wire convention used byvoiceIdandfirstMessage) or to narrow the change tospeedalone if you'd prefer a smaller surface.