Skip to content

fix(tts): accept latency "low"; save to a file first in the README quick start - #204

Merged
lumpinif merged 2 commits into
mainfrom
fix/sweep-sdk-1202
Dec 2, 2026
Merged

lumpinif merged 2 commits into
mainfrom
fix/sweep-sdk-1202

Conversation

@lumpinif

@lumpinif lumpinif commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Before.

  • LatencyMode was Literal["normal", "balanced"], so TTSConfig(latency="low") and TTSRequest(latency="low") raised a validation error. The API accepts "low" (OpenAPI enum low, normal, balanced), and the TypeScript SDK offers it.
  • The README quick start called play(audio) first. play runs ffplay and raises DependencyError when it is missing, so the first example failed on a clean machine or server after a paid request.

After.

  • LatencyMode is Literal["low", "normal", "balanced"]. The docstrings say what low does (S3 Pro model card plus a live check):
    • it gives earlier first audio on s3-pro;
    • it is not available on s3-pro-free, which accepts it without a speed-up;
    • s2.1-pro showed no speed-up either.
  • The quick start (sync and async) saves to output.mp3. Playing is an optional block that reads that file and names what it needs: ffplay on PATH, or the [utils] extra with use_ffmpeg=False (plus PortAudio on Linux). The [utils] install comment says what it adds.

How verified.

  • Live, 2026-12-02, median time to first audio, 8 runs: s3-pro 0.26 s with low vs 0.29 s with balanced. s3-pro-free and s2.1-pro: no measurable difference. All return 200.
  • Through the SDK, convert(latency="low"), TTSConfig(latency="low") and stream_websocket(..., latency="low") all succeed.
  • The README quick start ran verbatim on a PATH without ffplay.
  • Unit tests: LatencyMode names all three values; config and request accept each one and reject an unknown one; "low" reaches the request body from a parameter and from config.
  • CI steps run locally: format, lint, ty, 781 tests, build.

Who wrote the changed lines.

  • LatencyMode and the docstrings: James Ding (2025-11, SDK rewrite).
  • Quick start: James Ding / abersheeran.
  • The README [utils] line: Felix Lu.

The legacy fish_audio_sdk package is not changed; it gets no updates.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • New Features
    • Added support for the "low" latency option, which can provide earlier first audio on s3-pro.
  • Documentation
    • Clarified latency options and documented audio playback requirements, including setup for playback without FFmpeg.
    • Updated quick-start examples to save generated audio instead of playing it inline.

The API accepts latency "low" (OpenAPI enum: low, normal, balanced), and
the TypeScript SDK already offers it, but LatencyMode only allowed
"normal" and "balanced", so TTSConfig and TTSRequest rejected it.

What the docstrings say about "low" follows the S3 Pro model card and a
live check on 2026-12-02 (median time to first audio bytes, 8 runs):
s3-pro 0.26 s with low vs 0.29 s with balanced; s3-pro-free accepts it
without a speed-up (the model card: not available there); s2.1-pro
showed no speed-up either.
play() runs ffplay and raises DependencyError when it is not on PATH,
so the first example failed on a clean machine after a paid request.
The quick start now saves to output.mp3. Playing is an optional block
that reads that file and names its requirements (ffplay, or the [utils]
extra with use_ffmpeg=False, plus PortAudio on Linux). The [utils]
install comment says what it adds.
Copilot AI lite review requested due to automatic review settings December 2, 2026 19:07
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-12-02T19:07:36.538018Z
We couldn’t complete this review. Comment @codex review to try again.
a96a84d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The TTSRequest docstring contradicts the newly supported "low" option, which could mislead users and generated documentation.

1 open issue
What changed in this PR

Adds support for the API’s "low" latency mode and updates the README quick start to save audio before optional playback.

Changes:

  • Expands latency typing, validation, and request handling.
  • Updates TTS documentation and latency examples.
  • Adds tests for latency values and payload propagation.
  • Revises README playback and dependency guidance.
File Description
tests/​unit/​test_types.py Tests accepted and rejected latency values and configuration handling.
tests/​unit/​test_tts.py Tests propagation of the "low" latency value in TTS request payloads.
src/​fishaudio/​types/​tts.py Updates TTS model latency documentation and supported values.
src/​fishaudio/​types/​shared.py Adds "low" to the LatencyMode type.
src/​fishaudio/​resources/​tts.py Documents the "low" latency option across TTS methods.
README.md Revises quick-start examples to save generated audio before optional playback.

Review effort: Lite

Comment on lines 132 to +133
latency: Generation mode. Options: "normal", "balanced". Default: "balanced"
"low" is also accepted; it gives earlier first audio on s3-pro.
@codecov

codecov Bot commented Dec 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/fishaudio/resources/tts.py 96.63% <ø> (ø)
src/fishaudio/types/shared.py 100.00% <100.00%> (ø)
src/fishaudio/types/tts.py 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PR adds low to the TTS latency type, documents it across TTS methods and models, and tests validation and serialization. It also updates README playback examples to save audio and documents optional playback requirements.

Changes: TTS latency mode

Layer / File(s) Summary
Latency mode contract and documentation
src/fishaudio/types/shared.py, src/fishaudio/types/tts.py, src/fishaudio/resources/tts.py, README.md
LatencyMode now includes low. TTS method and model documentation, and the README latency example, describe the mode.
Latency mode validation and serialization
tests/unit/test_types.py, tests/unit/test_tts.py
Tests check the accepted latency values, model validation, rejection of fastest, and serialization of low when supplied directly or through TTSConfig.

Playback documentation

Layer / File(s) Summary
Audio saving and optional playback
README.md
The synchronous and asynchronous examples save generated audio. A new section documents the ffplay requirement and the [utils] setup for playback without FFmpeg.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: leng-yue, abersheeran

Merge Risk: Minimal · up to a96a8

This change lets the SDK accept the "low" latency mode and updates the README quick start to save audio before offering optional playback. It is a small, low-risk change that is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names two changes: accepting latency "low" in the TTS SDK (the core change, backed by LatencyMode, TTSConfig, TTSRequest, and tests) and saving to a file first in the README quick start (a d…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names two changes: accepting latency "low" in the TTS SDK (the core change, backed by LatencyMode, TTSConfig, TTSRequest, and tests) and saving to a file first in the README quick start (a documentation change also present in the diff). The title is specific and matches the changeset, and it is consistent with the PR objectives. It uses a conventional commit prefix and no vague wording.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2588b372-5231-499a-8927-d602396ca85e
Commits

Reviewing files that changed from the base of the PR and between fc049f3 and a96a84d.

Files selected for processing: 6

  • README.md
  • src/fishaudio/resources/tts.py
  • src/fishaudio/types/shared.py
  • src/fishaudio/types/tts.py
  • tests/unit/test_tts.py
  • tests/unit/test_types.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@lumpinif
lumpinif merged commit 01a82d2 into main Dec 2, 2026
28 checks passed
@lumpinif
lumpinif deleted the fix/sweep-sdk-1202 branch December 2, 2026 19: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.

2 participants