Merge pull request #893 from pipecat-ai/mb/changelog-11L
Added an `auto_mode` input parameter to `ElevenLabsTTSService`
This commit is contained in:
@@ -12,12 +12,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Added `DailyTransport.send_dtmf()` to send dial-out DTMF tones.
|
- Added `DailyTransport.send_dtmf()` to send dial-out DTMF tones.
|
||||||
|
|
||||||
- Added `DailyTransport.sip_call_transfer()` to forward SIP and PSTN calls to
|
- Added `DailyTransport.sip_call_transfer()` to forward SIP and PSTN calls to
|
||||||
another address or number. For example, transfer a SIP call to a different
|
another address or number. For example, transfer a SIP call to a different
|
||||||
SIP address or transfer a PSTN phone number to a different PSTN phone number.
|
SIP address or transfer a PSTN phone number to a different PSTN phone number.
|
||||||
|
|
||||||
- Added `DailyTransport.sip_refer()` to transfer incoming SIP/PSTN calls from
|
- Added `DailyTransport.sip_refer()` to transfer incoming SIP/PSTN calls from
|
||||||
outside Daily to another SIP/PSTN address.
|
outside Daily to another SIP/PSTN address.
|
||||||
|
|
||||||
|
- Added an `auto_mode` input parameter to `ElevenLabsTTSService`. `auto_mode`
|
||||||
|
is set to `True` by default. Enabling this setting disables the chunk
|
||||||
|
schedule and all buffers, which reduces latency.
|
||||||
|
|
||||||
- Added `KoalaFilter` which implement on device noise reduction using Koala
|
- Added `KoalaFilter` which implement on device noise reduction using Koala
|
||||||
Noise Suppression.
|
Noise Suppression.
|
||||||
(see https://picovoice.ai/platform/koala/)
|
(see https://picovoice.ai/platform/koala/)
|
||||||
@@ -51,6 +55,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- The default model for `ElevenLabsTTSService` is now `eleven_flash_v2_5`.
|
||||||
|
|
||||||
- `OpenAIRealtimeBetaLLMService` now takes a `model` parameter in the
|
- `OpenAIRealtimeBetaLLMService` now takes a `model` parameter in the
|
||||||
constructor.
|
constructor.
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ except ModuleNotFoundError as e:
|
|||||||
|
|
||||||
ElevenLabsOutputFormat = Literal["pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100"]
|
ElevenLabsOutputFormat = Literal["pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100"]
|
||||||
|
|
||||||
|
ELEVENLABS_MULTILINGUAL_MODELS = {
|
||||||
|
"eleven_turbo_v2_5",
|
||||||
|
"eleven_multilingual_v2",
|
||||||
|
"eleven_flash_v2_5",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def language_to_elevenlabs_language(language: Language) -> str | None:
|
def language_to_elevenlabs_language(language: Language) -> str | None:
|
||||||
BASE_LANGUAGES = {
|
BASE_LANGUAGES = {
|
||||||
@@ -135,6 +141,7 @@ class ElevenLabsTTSService(WordTTSService):
|
|||||||
similarity_boost: Optional[float] = None
|
similarity_boost: Optional[float] = None
|
||||||
style: Optional[float] = None
|
style: Optional[float] = None
|
||||||
use_speaker_boost: Optional[bool] = None
|
use_speaker_boost: Optional[bool] = None
|
||||||
|
auto_mode: Optional[bool] = True
|
||||||
|
|
||||||
@model_validator(mode="after")
|
@model_validator(mode="after")
|
||||||
def validate_voice_settings(self):
|
def validate_voice_settings(self):
|
||||||
@@ -151,7 +158,7 @@ class ElevenLabsTTSService(WordTTSService):
|
|||||||
*,
|
*,
|
||||||
api_key: str,
|
api_key: str,
|
||||||
voice_id: str,
|
voice_id: str,
|
||||||
model: str = "eleven_turbo_v2_5",
|
model: str = "eleven_flash_v2_5",
|
||||||
url: str = "wss://api.elevenlabs.io",
|
url: str = "wss://api.elevenlabs.io",
|
||||||
output_format: ElevenLabsOutputFormat = "pcm_24000",
|
output_format: ElevenLabsOutputFormat = "pcm_24000",
|
||||||
params: InputParams = InputParams(),
|
params: InputParams = InputParams(),
|
||||||
@@ -193,6 +200,7 @@ class ElevenLabsTTSService(WordTTSService):
|
|||||||
"similarity_boost": params.similarity_boost,
|
"similarity_boost": params.similarity_boost,
|
||||||
"style": params.style,
|
"style": params.style,
|
||||||
"use_speaker_boost": params.use_speaker_boost,
|
"use_speaker_boost": params.use_speaker_boost,
|
||||||
|
"auto_mode": str(params.auto_mode).lower(),
|
||||||
}
|
}
|
||||||
self.set_model_name(model)
|
self.set_model_name(model)
|
||||||
self.set_voice(voice_id)
|
self.set_voice(voice_id)
|
||||||
@@ -312,18 +320,18 @@ class ElevenLabsTTSService(WordTTSService):
|
|||||||
voice_id = self._voice_id
|
voice_id = self._voice_id
|
||||||
model = self.model_name
|
model = self.model_name
|
||||||
output_format = self._settings["output_format"]
|
output_format = self._settings["output_format"]
|
||||||
url = f"{self._url}/v1/text-to-speech/{voice_id}/stream-input?model_id={model}&output_format={output_format}&auto_mode=true"
|
url = f"{self._url}/v1/text-to-speech/{voice_id}/stream-input?model_id={model}&output_format={output_format}&auto_mode={self._settings['auto_mode']}"
|
||||||
|
|
||||||
if self._settings["optimize_streaming_latency"]:
|
if self._settings["optimize_streaming_latency"]:
|
||||||
url += f"&optimize_streaming_latency={self._settings['optimize_streaming_latency']}"
|
url += f"&optimize_streaming_latency={self._settings['optimize_streaming_latency']}"
|
||||||
|
|
||||||
# Language can only be used with the 'eleven_turbo_v2_5' model
|
# Language can only be used with the ELEVENLABS_MULTILINGUAL_MODELS
|
||||||
language = self._settings["language"]
|
language = self._settings["language"]
|
||||||
if model == "eleven_turbo_v2_5":
|
if model in ELEVENLABS_MULTILINGUAL_MODELS:
|
||||||
url += f"&language_code={language}"
|
url += f"&language_code={language}"
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Language code [{language}] not applied. Language codes can only be used with the 'eleven_turbo_v2_5' model."
|
f"Language code [{language}] not applied. Language codes can only be used with multilingual models: {', '.join(sorted(ELEVENLABS_MULTILINGUAL_MODELS))}"
|
||||||
)
|
)
|
||||||
|
|
||||||
self._websocket = await websockets.connect(url)
|
self._websocket = await websockets.connect(url)
|
||||||
|
|||||||
Reference in New Issue
Block a user