feat: add variants_num for multi-variant music generation (0.8.0) - #20
Merged
Conversation
Propagates the backend's variants_num (1-10, default 1) to text_to_music/video_to_music (async-only, like output_format="wav"), video_to_video_music, video_to_sound, and video_to_video_sound. - audio[] entries gain an optional per-variant title; MusicResult grows variants_num, echoed by tasks.get only when > 1. - VideoResult grows videos[] additively; video stays a permanent alias for videos[0], and save()/asave() grow an optional index= to pick a variant. - SoundResult grows outputs[] (new SoundOutput dataclass) additively; the existing top-level output/stem fields stay aliases for outputs[0], and save()/asave()/save_stem()/asave_stem() grow the same optional index=. - sonilo-cli gets --variants on the five affected commands, fanning a single --output into indexed files (out.0.ext, out.1.ext, ...) above 1; bumped to 0.6.0 with its sonilo pin widened to >=0.8.0,<0.9. pytest: 217 passed (core), 86 passed (sonilo-cli), 53 passed (sonilo-video-kit, unaffected — pin already <1.0).
Sapient docs evalsWaiting for the staging docs URL before running evals. Sapient will start the selected PR evals automatically when GitHub reports a successful docs deployment for this PR. This usually happens within 15 minutes. Commit: |
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
Propagates the backend's new
variants_numparameter (sonilo-api-dashboard PR #175) to the Python SDK and CLI. Bumps the core package to 0.8.0;sonilo-video-kitis untouched.variants_num(integer, 1–10, default 1) makes one request produce N genuinely distinct music variants, each with its own title. Cost scales linearly with N, and values above 1 are never covered by the free trial.What changed
variants_numaccepted on the five music methods:text_to_music,video_to_music,video_to_video_music,video_to_sound,video_to_video_sound(sync and async clients).MusicResult.audio[]entries can carry their owntitle; the top-leveltitlestill means variant 0's.VideoResultgainsvideos[];videoremains a permanent alias forvideos[0], andsave()is unchanged.SoundResultgainsoutputs[]; the existing top-leveloutput_url/output_type/output_bytes/music/music_processed/sfxremain aliases foroutputs[0].variants_numsurfaced on task results (the API sends it only above 1).variants_num > 1requires async mode, matching howoutput_format="wav"andpreserve_speechare already handled here.--variantson the corresponding commands, writing one file per variant.Compatibility
Strictly additive. Existing code that reads
video,output_url, or the other singular fields is unaffected — those keep their current meaning and point at variant 0. The result parsers pick fields explicitly and ignore unknown keys, so a client on an older SDK talking to the new API also keeps working.Testing
217 passed(core,PYTHONPATH=src pytest) and86 passed(CLI) — observed locally. Tests are mocked at the transport layer; this has not been exercised against a live backend, so a smoke test against a real multi-variant task is worth doing before release.