dv-pipecat-ai 0.0.85.dev853__py3-none-any.whl → 0.0.85.dev856__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dv-pipecat-ai might be problematic. Click here for more details.
- {dv_pipecat_ai-0.0.85.dev853.dist-info → dv_pipecat_ai-0.0.85.dev856.dist-info}/METADATA +1 -1
- {dv_pipecat_ai-0.0.85.dev853.dist-info → dv_pipecat_ai-0.0.85.dev856.dist-info}/RECORD +8 -8
- pipecat/services/elevenlabs/stt.py +6 -40
- pipecat/services/openai/base_llm.py +28 -7
- pipecat/transcriptions/language.py +50 -0
- {dv_pipecat_ai-0.0.85.dev853.dist-info → dv_pipecat_ai-0.0.85.dev856.dist-info}/WHEEL +0 -0
- {dv_pipecat_ai-0.0.85.dev853.dist-info → dv_pipecat_ai-0.0.85.dev856.dist-info}/licenses/LICENSE +0 -0
- {dv_pipecat_ai-0.0.85.dev853.dist-info → dv_pipecat_ai-0.0.85.dev856.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
dv_pipecat_ai-0.0.85.
|
|
1
|
+
dv_pipecat_ai-0.0.85.dev856.dist-info/licenses/LICENSE,sha256=DWY2QGf2eMCFhuu2ChairtT6CB7BEFffNVhXWc4Od08,1301
|
|
2
2
|
pipecat/__init__.py,sha256=j0Xm6adxHhd7D06dIyyPV_GlBYLlBnTAERVvD_jAARQ,861
|
|
3
3
|
pipecat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
pipecat/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -217,7 +217,7 @@ pipecat/services/deepgram/flux/stt.py,sha256=yCZodrHAOShgYy_GbdviX8iAuh36dBgDL41
|
|
|
217
217
|
pipecat/services/deepseek/__init__.py,sha256=bU5z_oNGzgrF_YpsD9pYIMtEibeZFaUobbRjJ9WcYyE,259
|
|
218
218
|
pipecat/services/deepseek/llm.py,sha256=5KjpU2blmhUTM3LcRE1ymdsk6OmoFkIzeQgyNOGwQh8,3112
|
|
219
219
|
pipecat/services/elevenlabs/__init__.py,sha256=cMx5v0HEMh4WetMm5byR9tIjG6_wNVs9UxqWyB3tjlM,313
|
|
220
|
-
pipecat/services/elevenlabs/stt.py,sha256=
|
|
220
|
+
pipecat/services/elevenlabs/stt.py,sha256=c-6GDeyZCMcXu4FmcG0vugBRsUnq8Iz_L9XX_Y_8TlM,29453
|
|
221
221
|
pipecat/services/elevenlabs/tts.py,sha256=skUndgUatx2F5rjg2tBZLutB8k9B9Cjy-cUeglCDdwc,45314
|
|
222
222
|
pipecat/services/fal/__init__.py,sha256=z_kfZETvUcKy68Lyvni4B-RtdkOvz3J3eh6sFDVKq6M,278
|
|
223
223
|
pipecat/services/fal/image.py,sha256=vArKLKrIGoZfw_xeZY_E7zbUzfzVsScj-R7mOmVqjRQ,4585
|
|
@@ -280,7 +280,7 @@ pipecat/services/nim/llm.py,sha256=o4WPGI6kOmSiMV7WwOZ0cNEAoq9hW4Aqs2R8X7c9i94,4
|
|
|
280
280
|
pipecat/services/ollama/__init__.py,sha256=aw-25zYsR8LR74OFFlMKMTnJjaKwOzdPWVsClueNRkI,255
|
|
281
281
|
pipecat/services/ollama/llm.py,sha256=rfpG92LRHGJlpENKhF6ld8CLVS9DxlKW-WRVNldOIGs,1605
|
|
282
282
|
pipecat/services/openai/__init__.py,sha256=V0ZVa8PzEm3hmcStYICbAsYwfgk4ytZ6kiQoq9UZPmI,354
|
|
283
|
-
pipecat/services/openai/base_llm.py,sha256=
|
|
283
|
+
pipecat/services/openai/base_llm.py,sha256=mrHRwYL-0lYr0BhJMg_ByTfqY2no6T8DOrhqMDztBlY,21518
|
|
284
284
|
pipecat/services/openai/image.py,sha256=3e3h-dVQ6DQuQE7fp8akXwRMd-oYOdGuZg7RCOjHu9A,2994
|
|
285
285
|
pipecat/services/openai/llm.py,sha256=_aKtz1VebSFUUenT3tH6mBW9pSCm65_u45cDu_dkTzs,7396
|
|
286
286
|
pipecat/services/openai/stt.py,sha256=Idf0k73kxFyDgNRBt62MFpoKKNsBV9bwvJteJ6MGWzQ,2419
|
|
@@ -351,7 +351,7 @@ pipecat/sync/event_notifier.py,sha256=h50fC-RBGaGldWZx_wpgOmMIwJiq0PeNwQq5GPmfRR
|
|
|
351
351
|
pipecat/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
352
352
|
pipecat/tests/utils.py,sha256=DEHDQV8uhCuKIqoHUPGVdUoCiKqTCG9zv5GqLXWWwvY,7870
|
|
353
353
|
pipecat/transcriptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
354
|
-
pipecat/transcriptions/language.py,sha256
|
|
354
|
+
pipecat/transcriptions/language.py,sha256=9kqmqCJF2NUTksWn0TH7-huRwtDqQzzALKzF1CnK_cY,10106
|
|
355
355
|
pipecat/transports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
356
356
|
pipecat/transports/base_input.py,sha256=AkdE-j9UksjIrUGJc7laMOaknXgOS7L22D5sehZ-6ew,20176
|
|
357
357
|
pipecat/transports/base_output.py,sha256=T_NfU38sT6wKxXF1jA7hW5eLhTK11pundQBxAojswW8,36723
|
|
@@ -416,7 +416,7 @@ pipecat/utils/tracing/service_decorators.py,sha256=fwzxFpi8DJl6BJbK74G0UEB4ccMJg
|
|
|
416
416
|
pipecat/utils/tracing/setup.py,sha256=7TEgPNpq6M8lww8OQvf0P9FzYc5A30xICGklVA-fua0,2892
|
|
417
417
|
pipecat/utils/tracing/turn_context_provider.py,sha256=ikon3plFOx0XbMrH6DdeHttNpb-U0gzMZIm3bWLc9eI,2485
|
|
418
418
|
pipecat/utils/tracing/turn_trace_observer.py,sha256=dma16SBJpYSOE58YDWy89QzHyQFc_9gQZszKeWixuwc,9725
|
|
419
|
-
dv_pipecat_ai-0.0.85.
|
|
420
|
-
dv_pipecat_ai-0.0.85.
|
|
421
|
-
dv_pipecat_ai-0.0.85.
|
|
422
|
-
dv_pipecat_ai-0.0.85.
|
|
419
|
+
dv_pipecat_ai-0.0.85.dev856.dist-info/METADATA,sha256=61LBrVZvlHne5jwbVTqjC0ZEtrErzfnhK5IXbIHs0Sk,32955
|
|
420
|
+
dv_pipecat_ai-0.0.85.dev856.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
421
|
+
dv_pipecat_ai-0.0.85.dev856.dist-info/top_level.txt,sha256=kQzG20CxGf-nSsHmtXHx3hY2-8zHA3jYg8jk0TajqXc,8
|
|
422
|
+
dv_pipecat_ai-0.0.85.dev856.dist-info/RECORD,,
|
|
@@ -34,7 +34,7 @@ from pipecat.frames.frames import (
|
|
|
34
34
|
)
|
|
35
35
|
from pipecat.processors.frame_processor import FrameDirection
|
|
36
36
|
from pipecat.services.stt_service import SegmentedSTTService, WebsocketSTTService
|
|
37
|
-
from pipecat.transcriptions.language import Language
|
|
37
|
+
from pipecat.transcriptions.language import Language, resolve_language
|
|
38
38
|
from pipecat.utils.time import time_now_iso8601
|
|
39
39
|
from pipecat.utils.tracing.service_decorators import traced_stt
|
|
40
40
|
|
|
@@ -61,7 +61,7 @@ def language_to_elevenlabs_language(language: Language) -> Optional[str]:
|
|
|
61
61
|
Returns:
|
|
62
62
|
The corresponding ElevenLabs language code, or None if not supported.
|
|
63
63
|
"""
|
|
64
|
-
|
|
64
|
+
LANGUAGE_MAP = {
|
|
65
65
|
Language.AF: "afr", # Afrikaans
|
|
66
66
|
Language.AM: "amh", # Amharic
|
|
67
67
|
Language.AR: "ara", # Arabic
|
|
@@ -163,21 +163,7 @@ def language_to_elevenlabs_language(language: Language) -> Optional[str]:
|
|
|
163
163
|
Language.ZU: "zul", # Zulu
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
# If not found in base languages, try to find the base language from a variant
|
|
169
|
-
# For example, Language.EN_US (value "en-US") -> Language("en") -> "eng"
|
|
170
|
-
if not result:
|
|
171
|
-
lang_str = str(language.value)
|
|
172
|
-
base_code = lang_str.split("-")[0] # Get "en" from "en-US"
|
|
173
|
-
try:
|
|
174
|
-
base_language = Language(base_code)
|
|
175
|
-
result = BASE_LANGUAGES.get(base_language)
|
|
176
|
-
except (ValueError, KeyError):
|
|
177
|
-
# If base language not found in Language enum, return None
|
|
178
|
-
result = None
|
|
179
|
-
|
|
180
|
-
return result
|
|
166
|
+
return resolve_language(language, LANGUAGE_MAP, use_base_code=False)
|
|
181
167
|
|
|
182
168
|
|
|
183
169
|
class ElevenLabsSTTService(SegmentedSTTService):
|
|
@@ -365,8 +351,8 @@ class ElevenLabsSTTService(SegmentedSTTService):
|
|
|
365
351
|
)
|
|
366
352
|
|
|
367
353
|
except Exception as e:
|
|
368
|
-
logger.error(f"
|
|
369
|
-
yield ErrorFrame(f"
|
|
354
|
+
logger.error(f"{self} exception: {e}")
|
|
355
|
+
yield ErrorFrame(error=f"{self} error: {e}")
|
|
370
356
|
|
|
371
357
|
|
|
372
358
|
def audio_format_from_sample_rate(sample_rate: int) -> str:
|
|
@@ -414,12 +400,6 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
|
|
|
414
400
|
|
|
415
401
|
By default, uses manual commit strategy where Pipecat's VAD controls when to
|
|
416
402
|
commit transcript segments, providing consistency with other STT services.
|
|
417
|
-
|
|
418
|
-
Important:
|
|
419
|
-
When using manual commit strategy with Pipecat's VAD, it is recommended to set
|
|
420
|
-
the VAD `stop_secs` parameter to at least 0.5 seconds. Lower values may result
|
|
421
|
-
in incomplete transcriptions due to a known limitation in the ElevenLabs model
|
|
422
|
-
where audio sent near the commit boundary may not be fully processed.
|
|
423
403
|
"""
|
|
424
404
|
|
|
425
405
|
class InputParams(BaseModel):
|
|
@@ -436,11 +416,6 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
|
|
|
436
416
|
Only used when commit_strategy is VAD. None uses ElevenLabs default.
|
|
437
417
|
min_silence_duration_ms: Minimum silence duration for VAD (50-2000ms).
|
|
438
418
|
Only used when commit_strategy is VAD. None uses ElevenLabs default.
|
|
439
|
-
|
|
440
|
-
Note:
|
|
441
|
-
When using manual commit strategy, ensure Pipecat's VAD `stop_secs` is set to
|
|
442
|
-
at least 0.5 seconds to avoid incomplete transcriptions. This is a known
|
|
443
|
-
limitation of the ElevenLabs model.
|
|
444
419
|
"""
|
|
445
420
|
|
|
446
421
|
language_code: Optional[str] = None
|
|
@@ -469,10 +444,6 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
|
|
|
469
444
|
sample_rate: Audio sample rate in Hz. If not provided, uses the pipeline's rate.
|
|
470
445
|
params: Configuration parameters for the STT service.
|
|
471
446
|
**kwargs: Additional arguments passed to WebsocketSTTService.
|
|
472
|
-
|
|
473
|
-
Note:
|
|
474
|
-
When using manual commit strategy (default), configure Pipecat's VAD with
|
|
475
|
-
`stop_secs` of at least 0.5 seconds to ensure complete transcriptions.
|
|
476
447
|
"""
|
|
477
448
|
super().__init__(
|
|
478
449
|
sample_rate=sample_rate,
|
|
@@ -746,12 +717,7 @@ class ElevenLabsRealtimeSTTService(WebsocketSTTService):
|
|
|
746
717
|
logger.error(f"ElevenLabs input error: {error_msg}")
|
|
747
718
|
await self.push_error(ErrorFrame(f"Input error: {error_msg}"))
|
|
748
719
|
|
|
749
|
-
elif message_type in [
|
|
750
|
-
"auth_error",
|
|
751
|
-
"quota_exceeded",
|
|
752
|
-
"transcriber_error",
|
|
753
|
-
"error",
|
|
754
|
-
]:
|
|
720
|
+
elif message_type in ["auth_error", "quota_exceeded", "transcriber_error", "error"]:
|
|
755
721
|
error_msg = data.get("error", data.get("message", "Unknown error"))
|
|
756
722
|
logger.error(f"ElevenLabs error ({message_type}): {error_msg}")
|
|
757
723
|
await self.push_error(ErrorFrame(f"{message_type}: {error_msg}"))
|
|
@@ -18,6 +18,7 @@ from openai import (
|
|
|
18
18
|
APITimeoutError,
|
|
19
19
|
AsyncOpenAI,
|
|
20
20
|
AsyncStream,
|
|
21
|
+
BadRequestError,
|
|
21
22
|
DefaultAsyncHttpxClient,
|
|
22
23
|
)
|
|
23
24
|
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam
|
|
@@ -100,6 +101,7 @@ class BaseOpenAILLMService(LLMService):
|
|
|
100
101
|
params: Optional[InputParams] = None,
|
|
101
102
|
retry_timeout_secs: Optional[float] = 5.0,
|
|
102
103
|
retry_on_timeout: Optional[bool] = False,
|
|
104
|
+
enable_warmup: bool = False,
|
|
103
105
|
**kwargs,
|
|
104
106
|
):
|
|
105
107
|
"""Initialize the BaseOpenAILLMService.
|
|
@@ -114,6 +116,7 @@ class BaseOpenAILLMService(LLMService):
|
|
|
114
116
|
params: Input parameters for model configuration and behavior.
|
|
115
117
|
retry_timeout_secs: Request timeout in seconds. Defaults to 5.0 seconds.
|
|
116
118
|
retry_on_timeout: Whether to retry the request once if it times out.
|
|
119
|
+
enable_warmup: Whether to enable LLM cache warmup. Defaults to False.
|
|
117
120
|
**kwargs: Additional arguments passed to the parent LLMService.
|
|
118
121
|
"""
|
|
119
122
|
super().__init__(**kwargs)
|
|
@@ -133,6 +136,7 @@ class BaseOpenAILLMService(LLMService):
|
|
|
133
136
|
}
|
|
134
137
|
self._retry_timeout_secs = retry_timeout_secs
|
|
135
138
|
self._retry_on_timeout = retry_on_timeout
|
|
139
|
+
self._enable_warmup = enable_warmup
|
|
136
140
|
self.set_model_name(model)
|
|
137
141
|
self._client = self.create_client(
|
|
138
142
|
api_key=api_key,
|
|
@@ -477,6 +481,11 @@ class BaseOpenAILLMService(LLMService):
|
|
|
477
481
|
await self.stop_processing_metrics()
|
|
478
482
|
await self.push_frame(LLMFullResponseEndFrame())
|
|
479
483
|
|
|
484
|
+
def _is_gpt5_model(self) -> bool:
|
|
485
|
+
"""Check if the current model is a GPT-5 series model that requires max_completion_tokens."""
|
|
486
|
+
model = (self.model_name or "").lower()
|
|
487
|
+
return model.startswith("gpt-5")
|
|
488
|
+
|
|
480
489
|
async def _handle_warmup_frame(self, frame: WarmupLLMFrame):
|
|
481
490
|
"""Handle WarmupLLMFrame to prime the LLM cache without emitting responses.
|
|
482
491
|
|
|
@@ -486,18 +495,30 @@ class BaseOpenAILLMService(LLMService):
|
|
|
486
495
|
Args:
|
|
487
496
|
frame: WarmupLLMFrame containing the messages to cache.
|
|
488
497
|
"""
|
|
498
|
+
# Skip warmup if disabled
|
|
499
|
+
if not self._enable_warmup:
|
|
500
|
+
self.logger.debug("LLM warmup is disabled, skipping")
|
|
501
|
+
return
|
|
502
|
+
|
|
489
503
|
try:
|
|
490
504
|
# Use the provided messages for warmup
|
|
491
505
|
messages: List[ChatCompletionMessageParam] = frame.messages # type: ignore
|
|
492
506
|
|
|
493
507
|
# Make a non-streaming call to warm the cache
|
|
494
|
-
# We use a minimal
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
stream
|
|
500
|
-
|
|
508
|
+
# We use a minimal token limit to reduce latency and cost
|
|
509
|
+
# GPT-5 series models require max_completion_tokens instead of max_tokens
|
|
510
|
+
warmup_params = {
|
|
511
|
+
"model": self.model_name,
|
|
512
|
+
"messages": messages,
|
|
513
|
+
"stream": False,
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
if self._is_gpt5_model():
|
|
517
|
+
warmup_params["max_completion_tokens"] = 10
|
|
518
|
+
else:
|
|
519
|
+
warmup_params["max_tokens"] = 10
|
|
520
|
+
|
|
521
|
+
await self._client.chat.completions.create(**warmup_params)
|
|
501
522
|
|
|
502
523
|
self.logger.info("LLM cache warmed successfully")
|
|
503
524
|
# Intentionally don't emit any frames - this is a silent warmup
|
|
@@ -569,3 +569,53 @@ class Language(StrEnum):
|
|
|
569
569
|
# Zulu
|
|
570
570
|
ZU = "zu"
|
|
571
571
|
ZU_ZA = "zu-ZA"
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
def resolve_language(
|
|
575
|
+
language: Language, language_map: dict[Language, str], use_base_code: bool = True
|
|
576
|
+
) -> str:
|
|
577
|
+
"""Resolve a Language enum to a service-specific language code.
|
|
578
|
+
|
|
579
|
+
Checks the language map first, then falls back to extracting the appropriate
|
|
580
|
+
code format with a warning if not found in the verified list.
|
|
581
|
+
|
|
582
|
+
Args:
|
|
583
|
+
language: The Language enum value to convert.
|
|
584
|
+
language_map: Dictionary mapping Language enums to service language codes.
|
|
585
|
+
use_base_code: If True, extracts base code (e.g., 'en' from 'en-US').
|
|
586
|
+
If False, uses full language code as-is.
|
|
587
|
+
|
|
588
|
+
Returns:
|
|
589
|
+
The resolved language code for the service.
|
|
590
|
+
|
|
591
|
+
Examples::
|
|
592
|
+
|
|
593
|
+
# Service expecting base codes (e.g., Cartesia)
|
|
594
|
+
>>> LANGUAGE_MAP = {Language.EN: "en", Language.ES: "es"}
|
|
595
|
+
>>> resolve_language(Language.EN_US, LANGUAGE_MAP, use_base_code=True)
|
|
596
|
+
# Logs: "Language en-US not verified. Using base code 'en'."
|
|
597
|
+
"en"
|
|
598
|
+
|
|
599
|
+
# Service expecting full codes (e.g., AWS)
|
|
600
|
+
>>> LANGUAGE_MAP = {Language.EN_US: "en-US", Language.ES_ES: "es-ES"}
|
|
601
|
+
>>> resolve_language(Language.EN_GB, LANGUAGE_MAP, use_base_code=False)
|
|
602
|
+
# Logs: "Language en-GB not verified. Using 'en-GB'."
|
|
603
|
+
"en-GB"
|
|
604
|
+
"""
|
|
605
|
+
# Check if language is in the verified map
|
|
606
|
+
result = language_map.get(language)
|
|
607
|
+
|
|
608
|
+
if result is not None:
|
|
609
|
+
return result
|
|
610
|
+
|
|
611
|
+
# Not in map - fall back with warning
|
|
612
|
+
lang_str = str(language.value)
|
|
613
|
+
|
|
614
|
+
if use_base_code:
|
|
615
|
+
# Extract base code (e.g., "en" from "en-US")
|
|
616
|
+
base_code = lang_str.split("-")[0].lower()
|
|
617
|
+
# logger.warning(f"Language {language.value} not verified. Using base code '{base_code}'.")
|
|
618
|
+
return base_code
|
|
619
|
+
else:
|
|
620
|
+
# logger.warning(f"Language {language.value} not verified. Using '{lang_str}'.")
|
|
621
|
+
return lang_str
|
|
File without changes
|
{dv_pipecat_ai-0.0.85.dev853.dist-info → dv_pipecat_ai-0.0.85.dev856.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{dv_pipecat_ai-0.0.85.dev853.dist-info → dv_pipecat_ai-0.0.85.dev856.dist-info}/top_level.txt
RENAMED
|
File without changes
|