[Bugfix] Accept 'speaker' as alias for 'voice' in TTS speech API (#2424)
Signed-off-by: marksverdhei <marksverdhei@hotmail.com> Signed-off-by: marksverdhai <249650165+marksverdhai@users.noreply.github.com> Co-authored-by: marksverdhai <249650165+marksverdhai@users.noreply.github.com>
This commit is contained in:
1 parent
408365fa0d
commit
feefdaee9f
4 files changed
+255
-16
No files matched your search
@@ -2,7 +2,7 @@ import math
|
||||
from typing import Literal
|
||||
|
||||
import numpy as np
|
||||
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||
from pydantic import AliasChoices, BaseModel, Field, field_validator, model_validator
|
||||
|
||||
_MAX_EMBEDDING_DIM = 8192
|
||||
|
||||
@@ -10,8 +10,12 @@ _MAX_EMBEDDING_DIM = 8192
|
||||
class OpenAICreateSpeechRequest(BaseModel):
|
||||
input: str
|
||||
model: str | None = None
|
||||
# Accept both "voice" (OpenAI convention) and "speaker" (model/internal
|
||||
# convention) as input keys. Intentionally global — all TTS backends
|
||||
# (Qwen3-TTS, Voxtral, Fish Speech) use this field for the speaker name.
|
||||
voice: str | None = Field(
|
||||
default=None,
|
||||
validation_alias=AliasChoices("voice", "speaker"),
|
||||
description="Speaker/voice to use. For Qwen3-TTS: vivian, ryan, aiden, etc.",
|
||||
)
|
||||
instructions: str | None = Field(
|
||||
|
||||
Reference in new issue
Block a user