Skip to content

chore(deps): bump inference-gateway/sdk to v1.38.0 - #1262

Merged
edenreich merged 1 commit into
mainfrom
fix/issue-1260
Sep 22, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/issue-1260

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Resolves #1260

Summary

Bumps github.com/inference-gateway/sdk from v1.37.2 to v1.38.0, which adds five new sdk.Client methods (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.Client grew, the committed counterfeiter fake no longer compiled until regenerated, and the sdk.Client compile-time assertion in the Anthropic Messages adapter failed - both are fixed here.

no docs ticket: internal-only refactor

Changes

  • go.mod/go.sum: pin github.com/inference-gateway/sdk v1.38.0 (go mod tidy clean)
  • tests/mocks/sdk/fake_client.go: regenerated with task mocks:generate; the fake now implements CreateSFX, CreateMusic, CreateVideo, RetrieveVideo and DownloadVideoContent
  • internal/platform/adapters/anthropic_messages.go: five thin delegation methods on the decorator (same pattern as the existing CreateSpeech passthrough), restoring the var _ sdk.Client assertion
  • internal/agent/infrastructure/speech_service.go (+test): v1.38.0 replaced the shared audio format constants with per-endpoint enums, so sdk.Wav becomes sdk.CreateSpeechRequestResponseFormatWav

Verification

  • task precommit:run passes (golangci-lint: 0 issues)
  • task test passes (all packages, -tags purego)

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
inference-gateway-maintainer Bot marked this pull request as ready for review September 22, 2026 15:16
@inference-gateway-maintainer
inference-gateway-maintainer Bot requested a review from a team as a code owner September 22, 2026 15:16
@edenreich
edenreich merged commit ed4072e into main Sep 22, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1260 branch September 22, 2026 15:26
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.205.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Sep 22, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TASK] Bump inference-gateway/sdk to v1.38.0 (sfx, music, video client methods)

1 participant