Skip to content

feat: add variants_num for multi-variant music generation (0.8.0) - #20

Merged
spencer-zqian merged 1 commit into
mainfrom
feat/variants-num
Jul 28, 2026
Merged

feat: add variants_num for multi-variant music generation (0.8.0)#20
spencer-zqian merged 1 commit into
mainfrom
feat/variants-num

Conversation

@spencer-zqian

Copy link
Copy Markdown
Contributor

Summary

Propagates the backend's new variants_num parameter (sonilo-api-dashboard PR #175) to the Python SDK and CLI. Bumps the core package to 0.8.0; sonilo-video-kit is 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_num accepted 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).
  • Result types extended additively:
    • MusicResult.audio[] entries can carry their own title; the top-level title still means variant 0's.
    • VideoResult gains videos[]; video remains a permanent alias for videos[0], and save() is unchanged.
    • SoundResult gains outputs[]; the existing top-level output_url / output_type / output_bytes / music / music_processed / sfx remain aliases for outputs[0].
    • variants_num surfaced on task results (the API sends it only above 1).
  • On the two streaming endpoints, variants_num > 1 requires async mode, matching how output_format="wav" and preserve_speech are already handled here.
  • CLI: --variants on 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) and 86 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.

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-app

sapient-app Bot commented Jul 28, 2026

Copy link
Copy Markdown

Sapient docs evals

Waiting 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: d11f28e
Status: waiting for staging docs URL

@spencer-zqian
spencer-zqian merged commit 94ac30d into main Jul 28, 2026
2 checks passed
@spencer-zqian
spencer-zqian deleted the feat/variants-num branch July 28, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant