Repository navigation
chore(deps): bump inference-gateway/sdk to v1.38.0 - #1262
Merged
Merged
Conversation
regenerate fake sdk client with the five new sfx/music/video methods, delegate them in the anthropic messages adapter, and adapt the speech service to the per-endpoint response format enums
inference-gateway-maintainer
Bot
marked this pull request as ready for review
September 22, 2026 15:16
inference-gateway-maintainer
Bot
requested a review
from a team
as a code owner
September 22, 2026 15:16
4 tasks
Contributor
|
🎉 This PR is included in version 0.205.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
edenreich
added a commit
that referenced
this pull request
Sep 22, 2026
Resolves #1261 ## Summary Adds a `TextToMusic` tool that composes a music clip from a text prompt through the gateway's Music API (`sdk.Client.CreateMusic`, `response_format: mp3`), mirroring the `TextToSpeech` / `TextToSFX` shape: `prompt`, optional `seconds` (maps to `duration_seconds`), optional `instrumental`, and `output_path` (bare file name). The tool is gated by `text_to_music.enabled` (default false) and reports `path` and `prompt`. Output is MP3: the gateway music providers do not serve wav (ElevenLabs offers mp3, opus and pcm), verified against the real provider. It builds on the SDK v1.38.0 bump from PR #1262 (`CreateMusic` with per-endpoint `CreateMusicRequestResponseFormatMp3`). Note on the mock gateway: the tokenless mock gateway does NOT serve `POST /v1/audio/music`, so the integration test pins the real behavior of a gateway without the endpoint - the tool call fails with a one-line error naming the configured model (`music generation with elevenlabs/music_v2_5 failed: ...`), the agent run still completes, and no partial file is left behind. The gap is tracked as inference-gateway/tokenless#59. Note on the shared helper: the issue pointed at the `output_path` helper from #1227 (TextToSFX), which has not landed yet, so this PR extracts `resolveMediaOutputPath` out of `TextToSpeechTool` in `internal/agent/tools/text_to_speech.go` (behavior-preserving refactor plus the `prefix` parameter); #1227 can reuse it. ## Changes - Domain: `MusicService` port in `internal/agent/domain/media.go` (error-only `Compose(ctx, prompt, outPath, seconds, instrumental)` signature) next to the speech port. - Infrastructure: `internal/agent/infrastructure/music_service.go` implementing `MusicService` via `sdk.Client.CreateMusic` with `CreateMusicRequestResponseFormatMp3`, writing the returned MP3 to the configured output dir. - Tool: `internal/agent/tools/text_to_music.go` - definition, validation, execution and formatting; failures (provider error, gateway without the endpoint, invalid `output_path`) surface as one-line failed results and leave no partial file (timestamped targets are removed on failure, caller-named targets are left untouched). - Config: top-level `text_to_music` block (`enabled` default false, `model` default `elevenlabs/music_v2_5`, `output_dir` default `~/.infer/tmp/music`, `require_approval`) plus prompts entry; `INFER_TEXT_TO_MUSIC_*` env overrides come from the reflective env loader. - Wiring: registry and container wired with the new tool; counterfeiter fake `tests/mocks/agentdomain/fake_music_service.go` added to `mocks:generate`. - Shared helper: `resolveMediaOutputPath` extracted from `TextToSpeechTool` so `output_path` rejects directories, absolute paths and `..` through one function. - Tests: unit tests for validation/execution/formatting/registry gating with the fake service, an infrastructure test with `tests/mocks/sdk` `FakeClient`, config tests, and an integration test running the tool against the mock gateway. - Docs: new `docs/text-to-music.md` page mirroring `text-to-speech.md` (enabling, env overrides, gateway requirements, tool usage, troubleshooting), linked from the README, `docs/tools-reference.md` and `docs/directory-structure.md`; `docs/configuration-reference.md` updated; a `[DOCS]` ticket is filed against inference-gateway/docs. - Gateway: `Config.NeedsGatewayAudio()` gates `AUDIO_ENABLED=true` (and the audio-restart probe) on gateway-engine speech **or** music. Before this, enabling `text_to_music` alone started the local gateway without `/v1/audio/music` and every call 404'd. ## Review follow-ups (later commits) - `refactor(tools)`: `Validate` folded back to the TextToSpeech shape (invalid `output_path` is an argument error, like speech), `seconds`/`instrumental` pointers passed straight to the SDK request, zero-value `TextToMusic` block dropped from `DefaultConfig`, one shared `fakeWav()` test helper. - `docs(tools)`: the `docs/text-to-music.md` page above. - `fix(gateway)`: the `AUDIO_ENABLED` gap above, with a "music only" row in `TestNeedsAudioRestart`. - `fix(tools)`: live test against ElevenLabs showed the hardcoded wav format fails every call with a 400, so the tool now requests MP3, writes `.mp3` and drops the WAV-only duration readout. The same test showed `resolveMediaOutputPath` only created the output directory on the timestamped branch, so a caller-named `output_path` failed with ENOENT on a fresh machine; it now creates it on both branches, which fixes TextToSpeech too. ## Follow-ups - inference-gateway/tokenless#59: serve `POST /v1/audio/music` in the mock gateway so integration coverage can assert a successful clip. - inference-gateway/docs#719: `[DOCS]` ticket mirroring this change on the docs website. - inference-gateway/desktop#251: allow `TextToMusic` in the video-editing skill and add a `music` lane. - Downstream repos affected: inference-gateway/docs, inference-gateway/tokenless, inference-gateway/desktop. --------- Co-authored-by: inference-gateway-maintainer[bot] <246577062+inference-gateway-maintainer[bot]@users.noreply.github.com> Co-authored-by: Eden Reich <[email protected]>
7 tasks
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.
Resolves #1260
Summary
Bumps
github.com/inference-gateway/sdkfrom v1.37.2 to v1.38.0, which adds five newsdk.Clientmethods (SFX, music and video generation). This is the prerequisite for #1227 (TextToSFX), #1257 (TextToVideo) and #1261 (TextToMusic). Gateway v0.54.0 serves all of these with the ElevenLabs provider.Because
sdk.Clientgrew, the committed counterfeiter fake no longer compiled until regenerated, and thesdk.Clientcompile-time assertion in the Anthropic Messages adapter failed - both are fixed here.no docs ticket: internal-only refactor
Changes
go.mod/go.sum: pingithub.com/inference-gateway/sdk v1.38.0(go mod tidyclean)tests/mocks/sdk/fake_client.go: regenerated withtask mocks:generate; the fake now implementsCreateSFX,CreateMusic,CreateVideo,RetrieveVideoandDownloadVideoContentinternal/platform/adapters/anthropic_messages.go: five thin delegation methods on the decorator (same pattern as the existingCreateSpeechpassthrough), restoring thevar _ sdk.Clientassertioninternal/agent/infrastructure/speech_service.go(+test): v1.38.0 replaced the shared audio format constants with per-endpoint enums, sosdk.Wavbecomessdk.CreateSpeechRequestResponseFormatWavVerification
task precommit:runpasses (golangci-lint: 0 issues)task testpasses (all packages,-tags purego)