Compare commits

...

7 Commits

Author SHA1 Message Date
Mark Backman
e3df83ca2e fix: voice_settings weren't applying to ElevenLabsTTSService 2025-06-15 16:23:57 -04:00
Filipi da Silva Fuchter
dc640a7591 Merge pull request #2001 from pipecat-ai/filipi/google_stt_reconnection_issue
Fixed an issue with `GoogleSTTService` where it was constantly reconnecting
2025-06-13 08:29:18 -03:00
Filipi Fuchter
1f072d182c Merge branch 'main' into filipi/google_stt_reconnection_issue
# Conflicts:
#	CHANGELOG.md
2025-06-13 08:26:00 -03:00
Mark Backman
1d64e04ed5 Merge pull request #2002 from pipecat-ai/mb/google-fix-ttfb
Fix: GoogleLLMService TTFB
2025-06-12 12:10:01 -04:00
Mark Backman
22f4f0b79e Update 14e example name 2025-06-12 11:45:59 -04:00
Mark Backman
69c63293fb fix: GoogleLLMService TTFB value 2025-06-12 11:43:27 -04:00
Filipi Fuchter
c1db13ceeb Fixed an issue with GoogleSTTService where it was constantly reconnecting before starting to receive audio from the user. 2025-06-12 12:07:33 -03:00
5 changed files with 33 additions and 6 deletions

View File

@@ -5,6 +5,22 @@ All notable changes to **Pipecat** will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Fixed an issue where `voice_settings` weren't being applied to
`ElevenLabsTTSService`.
- Fixed an issue with `GoogleSTTService` where it was constantly reconnecting
before starting to receive audio from the user.
- Fixed an issue where `GoogleLLMService`'s TTFB value was incorrect.
### Other
- Rename `14e-function-calling-gemini.py` to `14e-function-calling-google.py`.
## [0.0.71] - 2025-06-10
### Added

View File

@@ -140,6 +140,8 @@ def build_elevenlabs_voice_settings(
if key in settings and settings[key] is not None:
voice_settings[key] = settings[key]
print(f"Built voice settings: {voice_settings}")
return voice_settings or None
@@ -249,6 +251,7 @@ class ElevenLabsTTSService(AudioContextWordTTSService):
return language_to_elevenlabs_language(language)
def _set_voice_settings(self):
print(f"Setting voice settings for ElevenLabs TTS: {self._settings}")
return build_elevenlabs_voice_settings(self._settings)
async def set_model(self, model: str):
@@ -430,15 +433,20 @@ class ElevenLabsTTSService(AudioContextWordTTSService):
async def _send_text(self, text: str):
if self._websocket:
if not self._context_id:
# Create new context ID
new_context_id = str(uuid.uuid4())
# Register the context with the audio context manager
await self.create_audio_context(new_context_id)
# First message for a new context - need a space to initialize
msg = {"text": " ", "context_id": str(uuid.uuid4())}
msg = {"text": " ", "context_id": new_context_id}
# Add voice settings only in first message for a context
if self._voice_settings:
msg["voice_settings"] = self._voice_settings
await self._websocket.send(json.dumps(msg))
self._context_id = msg["context_id"]
self._context_id = new_context_id
logger.trace(f"Created new context {self._context_id}")
# Now send the actual text content
@@ -471,9 +479,6 @@ class ElevenLabsTTSService(AudioContextWordTTSService):
yield TTSStartedFrame()
self._started = True
self._cumulative_time = 0
# Create new context ID and register it
self._context_id = str(uuid.uuid4())
await self.create_audio_context(self._context_id)
await self._send_text(text)
await self.start_tts_usage_metrics(text)

View File

@@ -555,10 +555,11 @@ class GoogleLLMService(LLMService):
contents=messages,
config=generation_config,
)
await self.stop_ttfb_metrics()
function_calls = []
async for chunk in response:
# Stop TTFB metrics after the first chunk
await self.stop_ttfb_metrics()
if chunk.usage_metadata:
prompt_tokens += chunk.usage_metadata.prompt_token_count or 0
completion_tokens += chunk.usage_metadata.candidates_token_count or 0

View File

@@ -747,6 +747,11 @@ class GoogleSTTService(STTService):
try:
while True:
try:
if self._request_queue.empty():
# wait for 10ms in case we don't have audio
await asyncio.sleep(0.01)
continue
# Start bi-directional streaming
streaming_recognize = await self._client.streaming_recognize(
requests=self._request_generator()