Skip to content

feat: video_analysis resource and CLI command (0.14.0 / cli 0.13.0) - #30

Merged
spencer-zqian merged 1 commit into
mainfrom
feat/video-analysis
Aug 17, 2026
Merged

feat: video_analysis resource and CLI command (0.14.0 / cli 0.13.0)#30
spencer-zqian merged 1 commit into
mainfrom
feat/video-analysis

Conversation

@spencer-zqian

Copy link
Copy Markdown
Contributor

Propagates POST /v1/video-analysis to the Python SDK and the CLI.

What's new

  • client.video_analysis.submit() / .analyze() (plus the async twins), taking exactly one of video / video_url plus optional prompt and variants_num.
  • VideoAnalysisResult, AnalysisSegment, AnalysisVariation types, and parse_video_analysis_result for callers who poll tasks.wait themselves.
  • sonilo video-analysis --video clip.mp4 --prompt ... --variants 2.

Why the surface differs from every other endpoint

video-analysis is the first Sonilo product whose result is not media: it generates nothing and there is no file to download. The result is a work order — a time-aligned segments plan plus one prompt per requested variation, each ready to hand straight to video_to_music, video_to_sfx, video_to_sound or their video-to-video counterparts.

So:

  • the method is analyze(), not generate(), and VideoAnalysisResult has no save() — persisting the brief is the caller's business;
  • the CLI prints the brief to stdout as JSON so it can be piped into the next command, and writes a file only when --output asks for one.

Notes

  • Both list fields are coerced entry-by-entry and malformed entries dropped, matching how parse_dubbing_result coerces outputs.
  • The 1-5 variants_num bound and the 2000-char prompt bound are not re-checked client-side; the backend owns them.
  • sonilo-cli's narrow pin on the core moves to >=0.14.0,<0.15.

Testing

pytest (268), pytest sonilo-cli (149), pytest sonilo-video-kit (53) — all green. 15 new tests cover the parser, the request builder, file upload, polling, and every CLI path.

Propagates POST /v1/video-analysis to the SDK and the CLI.

video-analysis is the first Sonilo product whose result is not media: it
generates nothing and there is no file to download. The result is a work
order — a time-aligned `segments` plan plus one `prompt` per requested
variation, each ready to hand straight to video_to_music, video_to_sfx,
video_to_sound or their video-to-video counterparts.

That shapes the surface in two places:

- The resource method is `analyze()`, not `generate()`, and
  VideoAnalysisResult has no `save()`. Every other resource returns
  something you download; this one never does, so persisting the brief is
  the caller's business.
- The CLI prints the brief to stdout as JSON so it can be piped into the
  next command, and writes a file only when `--output` asks for one. Every
  other command's default is a media file on disk.

Both list fields are coerced entry-by-entry and malformed entries dropped,
for the same reason parse_dubbing_result coerces `outputs`: a
differently-shaped entry from a later backend change should surface as a
missing item, not an AttributeError deep in the caller's loop.

The 1-5 variants_num bound and the 2000-char prompt bound are deliberately
not re-checked client-side — the backend owns them, and a hardcoded copy
would make this SDK reject values a later API widens.

sonilo-cli's narrow pin on the core moves to >=0.14.0,<0.15 with the bump.
@sapient-app

sapient-app Bot commented Aug 17, 2026

Copy link
Copy Markdown

Lightsage docs evals

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

@spencer-zqian
spencer-zqian merged commit 30cb690 into main Aug 17, 2026
2 checks passed
@spencer-zqian
spencer-zqian deleted the feat/video-analysis branch August 17, 2026 04:20
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