Files
LocalAI/core/schema/elevenlabs_test.go
T
mudler-agentandEttore Di Giacinto 08871b1a6a feat(audio): add YuE2 music generation (#12617)
* feat(audio): forward sound generation params

Pass string-valued sound generation parameters from the public request to
the audio backend. Typed fields retain precedence over colliding generic
parameters, and source audio remains unavailable in the public schema.

Assisted-by: nib:gpt-5.6-sol
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* feat(gallery): add YuE2 music model

Assisted-by: nib:gpt-5.6-sol
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* docs(audio): document YuE2 sound generation

Assisted-by: nib:gpt-5.6-sol
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* fix(audio): reserve source input parameter

Assisted-by: nib:gpt-5.6-sol
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
2026-10-11 00:26:10 +02:00

35 lines
1.1 KiB
Go

package schema_test
import (
"encoding/json"
"reflect"
"strings"
"github.com/mudler/LocalAI/core/schema"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("ElevenLabs sound generation request", func() {
It("accepts string parameters", func() {
var request schema.ElevenLabsSoundGenerationRequest
Expect(json.Unmarshal([]byte(`{"text":"song","params":{"style":"jazz","cot":"true"}}`), &request)).To(Succeed())
Expect(request.Params).To(Equal(map[string]string{"style": "jazz", "cot": "true"}))
})
It("rejects non-string parameter values", func() {
var request schema.ElevenLabsSoundGenerationRequest
err := json.Unmarshal([]byte(`{"text":"song","params":{"cot":true}}`), &request)
Expect(err).To(MatchError(ContainSubstring("cannot unmarshal bool into Go struct field ElevenLabsSoundGenerationRequest.params of type string")))
})
It("does not expose source audio", func() {
requestType := reflect.TypeOf(schema.ElevenLabsSoundGenerationRequest{})
for i := 0; i < requestType.NumField(); i++ {
field := requestType.Field(i)
Expect(strings.Split(field.Tag.Get("json"), ",")[0]).ToNot(Equal("src"))
}
})
})