Make duration optional on text-to-music and text-to-sfx - #41
Merged
Merged
Conversation
The API resolves an omitted duration itself, so the client's job is to leave the field out rather than invent a number: * text-to-music infers the length from the prompt, or from `segments` when they are given (the last segment's start plus 30 seconds). * text-to-sfx generates its own default length (8 seconds). Both builders sent `duration` unconditionally, so passing None would have put the literal string "None" on the wire; they now omit the field. text-to-sfx's duration is also a float now, not an int: the API's minimum is 0.5 seconds, and the shortest effects -- a latch, a click, a single footstep -- run well under a second. sonilo 0.17.0 -> 0.18.0, sonilo-cli 0.16.0 -> 0.17.0, with the CLI's narrow core pin widened to match. `--duration` is optional on both CLI commands.
Lightsage docs evalsWaiting for the staging docs URL before running evals. Lightsage 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.
Follows the API change shipped on 2026-09-14:
durationis optional onPOST /v1/text-to-musicandPOST /v1/text-to-sfx, and text-to-sfx's minimum dropped from 1 second to 0.5.What the API does with an absent duration
segmentsare given, uses the last segment'sstartplus 30 seconds.Neither is something the client can or should guess, so the only correct client behaviour is to leave the field out.
Changes
build_t2m_data,build_t2m_async_dataandbuild_sfx_t2s_dataomitdurationwhen it is None. They previously built{"duration": str(duration)}unconditionally, so a None would have gone on the wire as the literal string"None".durationis keyword-only on every resource method, so widening it toOptional[...] = Nonechanges no call signature.durationis now a float, not an int: the API's floor is 0.5 sec and the shortest effects run well under a second.str(0.5)already produced"0.5", which is covered by a regression test.--durationis optional ontext-to-musicandtext-to-sfx; the latter istype=float.Versions
sonilo0.17.0 → 0.18.0,sonilo-cli0.16.0 → 0.17.0. The CLI's narrow core pin is widened tosonilo>=0.18.0,<0.19in the same PR, and bothpyproject.tomland_version.pyare bumped on each package.Tests
Four new cases in
tests/test_requests.py— each builder omits an absent duration, and a fractional sfx duration survives as"0.5". Suites: 320 passed (core) and 167 passed (CLI).