FishTTSService: deprecate model, add reference_id
This commit is contained in:
@@ -62,7 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Added `session_token` parameter to `AWSNovaSonicLLMService`.
|
- Added `session_token` parameter to `AWSNovaSonicLLMService`.
|
||||||
|
|
||||||
- Added Gemini Multimodal Live File API for uploading, fetching, listing, and
|
- Added Gemini Multimodal Live File API for uploading, fetching, listing, and
|
||||||
deleting files. See `26f-gemini-multimodal-live-files-api.py` for example usage.
|
deleting files. See `26f-gemini-multimodal-live-files-api.py` for example usage.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
@@ -83,6 +83,12 @@ deleting files. See `26f-gemini-multimodal-live-files-api.py` for example usage.
|
|||||||
|
|
||||||
- Fixed a `AWSNovaSonicLLMService` issue introduced in 0.0.72.
|
- Fixed a `AWSNovaSonicLLMService` issue introduced in 0.0.72.
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
|
||||||
|
- In `FishTTSService`, deprecated `model` and replaced with `reference_id`.
|
||||||
|
This change is to better align with Fish Audio's variable naming and to
|
||||||
|
reduce confusion about what functionality the variable controls.
|
||||||
|
|
||||||
## [0.0.73] - 2025-06-26
|
## [0.0.73] - 2025-06-26
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ class FishAudioTTSService(InterruptibleTTSService):
|
|||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
api_key: str,
|
api_key: str,
|
||||||
model: str, # This is the reference_id
|
reference_id: Optional[str] = None, # This is the voice ID
|
||||||
|
model: Optional[str] = None, # Deprecated
|
||||||
output_format: FishAudioOutputFormat = "pcm",
|
output_format: FishAudioOutputFormat = "pcm",
|
||||||
sample_rate: Optional[int] = None,
|
sample_rate: Optional[int] = None,
|
||||||
params: Optional[InputParams] = None,
|
params: Optional[InputParams] = None,
|
||||||
@@ -81,7 +82,13 @@ class FishAudioTTSService(InterruptibleTTSService):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
api_key: Fish Audio API key for authentication.
|
api_key: Fish Audio API key for authentication.
|
||||||
model: Reference ID of the voice model to use for synthesis.
|
reference_id: Reference ID of the voice model to use for synthesis.
|
||||||
|
model: Deprecated. Reference ID of the voice model to use for synthesis.
|
||||||
|
|
||||||
|
.. deprecated:: 0.0.74
|
||||||
|
The `model` parameter is deprecated and will be removed in version 0.1.0.
|
||||||
|
Use `reference_id` instead to specify the voice model.
|
||||||
|
|
||||||
output_format: Audio output format. Defaults to "pcm".
|
output_format: Audio output format. Defaults to "pcm".
|
||||||
sample_rate: Audio sample rate. If None, uses default.
|
sample_rate: Audio sample rate. If None, uses default.
|
||||||
params: Additional input parameters for voice customization.
|
params: Additional input parameters for voice customization.
|
||||||
@@ -96,6 +103,26 @@ class FishAudioTTSService(InterruptibleTTSService):
|
|||||||
|
|
||||||
params = params or FishAudioTTSService.InputParams()
|
params = params or FishAudioTTSService.InputParams()
|
||||||
|
|
||||||
|
# Validation for model and reference_id parameters
|
||||||
|
if model and reference_id:
|
||||||
|
raise ValueError(
|
||||||
|
"Cannot specify both 'model' and 'reference_id'. Use 'reference_id' only."
|
||||||
|
)
|
||||||
|
|
||||||
|
if model is None and reference_id is None:
|
||||||
|
raise ValueError("Must specify 'reference_id' (or deprecated 'model') parameter.")
|
||||||
|
|
||||||
|
if model:
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
warnings.warn(
|
||||||
|
"Parameter 'model' is deprecated and will be removed in a future version. "
|
||||||
|
"Use 'reference_id' instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
reference_id = model
|
||||||
|
|
||||||
self._api_key = api_key
|
self._api_key = api_key
|
||||||
self._base_url = "wss://api.fish.audio/v1/tts/live"
|
self._base_url = "wss://api.fish.audio/v1/tts/live"
|
||||||
self._websocket = None
|
self._websocket = None
|
||||||
@@ -111,11 +138,9 @@ class FishAudioTTSService(InterruptibleTTSService):
|
|||||||
"speed": params.prosody_speed,
|
"speed": params.prosody_speed,
|
||||||
"volume": params.prosody_volume,
|
"volume": params.prosody_volume,
|
||||||
},
|
},
|
||||||
"reference_id": model,
|
"reference_id": reference_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
self.set_model_name(model)
|
|
||||||
|
|
||||||
def can_generate_metrics(self) -> bool:
|
def can_generate_metrics(self) -> bool:
|
||||||
"""Check if this service can generate processing metrics.
|
"""Check if this service can generate processing metrics.
|
||||||
|
|
||||||
@@ -124,16 +149,6 @@ class FishAudioTTSService(InterruptibleTTSService):
|
|||||||
"""
|
"""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def set_model(self, model: str):
|
|
||||||
"""Set the TTS model (reference ID).
|
|
||||||
|
|
||||||
Args:
|
|
||||||
model: The reference ID of the voice model to use.
|
|
||||||
"""
|
|
||||||
self._settings["reference_id"] = model
|
|
||||||
await super().set_model(model)
|
|
||||||
logger.info(f"Switching TTS model to: [{model}]")
|
|
||||||
|
|
||||||
async def start(self, frame: StartFrame):
|
async def start(self, frame: StartFrame):
|
||||||
"""Start the Fish Audio TTS service.
|
"""Start the Fish Audio TTS service.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user