Skip to content

Add MiniMax text-to-speech support - #852

Merged
AbirAbbas merged 2 commits into
Agent-Field:mainfrom
octo-patch:octo/20260801-tts-tool-recvqK8wsJVRwG
Aug 5, 2026
Merged

Add MiniMax text-to-speech support#852
AbirAbbas merged 2 commits into
Agent-Field:mainfrom
octo-patch:octo/20260801-tts-tool-recvqK8wsJVRwG

Conversation

@octo-patch

Copy link
Copy Markdown
Contributor

Reason: Add native MiniMax text-to-speech support through the existing media provider route.

  • Send regional /t2a_v2 requests with the current default model, speech options, and hex or URL response handling.
  • Route minimax/ audio models to the media provider while preserving provider validation errors.
  • Add focused coverage for request construction, regional endpoints, response parsing, validation, and high-level routing.

Checks:

  • uvx --from ruff==0.15.22 ruff check .
  • uvx --from ruff==0.15.22 ruff format --check agentfield/media_providers.py agentfield/agent_ai.py tests/test_minimax_audio.py tests/test_minimax_video.py
  • uv run --frozen --extra dev ./scripts/run_pytest.sh tests/test_minimax_audio.py tests/test_minimax_video.py tests/test_media_providers.py tests/test_agent_ai.py --no-cov

@octo-patch
octo-patch requested review from a team and AbirAbbas as code owners August 1, 2026 04:32
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Performance

SDK Memory Δ Latency Δ Tests Status
Python 9.0 KB - 0.30 µs -14%

✓ No regressions detected

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage gate

Thresholds from .coverage-gate.toml: per-surface ≥ 84%, aggregate ≥ 85%, max per-surface regression ≤ 1.0 pp, max aggregate regression ≤ 0.50 pp.

Surface Current Baseline Δ
control-plane 87.10% 87.40% ↓ -0.30 pp 🟡
sdk-go 92.70% 92.00% ↑ +0.70 pp 🟢
sdk-python 93.82% 93.73% ↑ +0.09 pp 🟢
sdk-typescript 91.08% 90.42% ↑ +0.66 pp 🟢
web-ui 84.76% 84.79% ↓ -0.03 pp 🟡
aggregate 85.62% 85.75% ↓ -0.13 pp 🟡

✅ Gate passed

No surface regressed past the allowed threshold and the aggregate stayed above the floor.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

📐 Patch coverage gate

Threshold: 80% on lines this PR touches vs origin/main (from .coverage-gate.toml:thresholds.min_patch).

Surface Touched lines Patch coverage Status
control-plane 0 ➖ no changes
sdk-go 0 ➖ no changes
sdk-python 0 ➖ no changes
sdk-typescript 0 ➖ no changes
web-ui 0 ➖ no changes

✅ Patch gate passed

Every surface whose lines were touched by this PR has patch coverage at or above the threshold.

@AbirAbbas AbirAbbas 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.

Took this over along with your other two MiniMax PRs since they'd gone quiet.

This was the cleanest of the three. I ran TTS end-to-end against a mocked transport and confirmed the /t2a_v2 request shape for both the global and China endpoints, both the hex and URL response paths, and every validation branch — all behaved correctly. I also checked the agent_ai.py routing change specifically, since that touches the public high-level API: minimax/ audio models reach the media provider and nothing else changed route.

On the test_minimax_video.py edit — I checked it isn't weakening anything. It only removes the now-obsolete assertion that generate_audio() raises NotImplementedError, which this PR makes untrue. Fine as-is.

Two small things I pushed a commit for:

The ai_generate_audio docstring still listed only LiteLLM and Fal.ai and documented only OpenAI voices, so there was no way for a caller to discover MiniMax support or realize the alloy default doesn't apply to it. Updated that and ai_with_audio with a minimax/speech-2.8-hd example.

The validation test only covered four of the branches this PR adds. I verified the uncovered ones behave correctly by hand, but a regression in any of them would have passed the suite — so I parameterized it to cover invalid output_format, speed-without-voice, missing voice_id, empty model, HTTP and API errors, malformed JSON, incomplete status, absent audio, and invalid hex. No production change was needed for that.

Heads up that #853 conflicts with this one in supported_modalities and the shared video test. This one goes first; I'll reconcile #853 on top.

@AbirAbbas
AbirAbbas added this pull request to the merge queue Aug 5, 2026
Merged via the queue into Agent-Field:main with commit 63f573b Aug 5, 2026
23 checks passed
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