dv-pipecat-ai 0.0.82.dev815__py3-none-any.whl → 0.0.82.dev857__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.

Files changed (106) hide show
  1. {dv_pipecat_ai-0.0.82.dev815.dist-info → dv_pipecat_ai-0.0.82.dev857.dist-info}/METADATA +8 -3
  2. {dv_pipecat_ai-0.0.82.dev815.dist-info → dv_pipecat_ai-0.0.82.dev857.dist-info}/RECORD +106 -79
  3. pipecat/adapters/base_llm_adapter.py +44 -6
  4. pipecat/adapters/services/anthropic_adapter.py +302 -2
  5. pipecat/adapters/services/aws_nova_sonic_adapter.py +40 -2
  6. pipecat/adapters/services/bedrock_adapter.py +40 -2
  7. pipecat/adapters/services/gemini_adapter.py +276 -6
  8. pipecat/adapters/services/open_ai_adapter.py +88 -7
  9. pipecat/adapters/services/open_ai_realtime_adapter.py +39 -1
  10. pipecat/audio/dtmf/__init__.py +0 -0
  11. pipecat/audio/dtmf/types.py +47 -0
  12. pipecat/audio/dtmf/utils.py +70 -0
  13. pipecat/audio/filters/aic_filter.py +199 -0
  14. pipecat/audio/utils.py +9 -7
  15. pipecat/extensions/ivr/__init__.py +0 -0
  16. pipecat/extensions/ivr/ivr_navigator.py +452 -0
  17. pipecat/frames/frames.py +156 -43
  18. pipecat/pipeline/llm_switcher.py +76 -0
  19. pipecat/pipeline/parallel_pipeline.py +3 -3
  20. pipecat/pipeline/service_switcher.py +144 -0
  21. pipecat/pipeline/task.py +68 -28
  22. pipecat/pipeline/task_observer.py +10 -0
  23. pipecat/processors/aggregators/dtmf_aggregator.py +2 -2
  24. pipecat/processors/aggregators/llm_context.py +277 -0
  25. pipecat/processors/aggregators/llm_response.py +48 -15
  26. pipecat/processors/aggregators/llm_response_universal.py +840 -0
  27. pipecat/processors/aggregators/openai_llm_context.py +3 -3
  28. pipecat/processors/dtmf_aggregator.py +0 -2
  29. pipecat/processors/filters/stt_mute_filter.py +0 -2
  30. pipecat/processors/frame_processor.py +18 -11
  31. pipecat/processors/frameworks/rtvi.py +17 -10
  32. pipecat/processors/metrics/sentry.py +2 -0
  33. pipecat/runner/daily.py +137 -36
  34. pipecat/runner/run.py +1 -1
  35. pipecat/runner/utils.py +7 -7
  36. pipecat/serializers/asterisk.py +20 -4
  37. pipecat/serializers/exotel.py +1 -1
  38. pipecat/serializers/plivo.py +1 -1
  39. pipecat/serializers/telnyx.py +1 -1
  40. pipecat/serializers/twilio.py +1 -1
  41. pipecat/services/__init__.py +2 -2
  42. pipecat/services/anthropic/llm.py +113 -28
  43. pipecat/services/asyncai/tts.py +4 -0
  44. pipecat/services/aws/llm.py +82 -8
  45. pipecat/services/aws/tts.py +0 -10
  46. pipecat/services/aws_nova_sonic/aws.py +5 -0
  47. pipecat/services/cartesia/tts.py +28 -16
  48. pipecat/services/cerebras/llm.py +15 -10
  49. pipecat/services/deepgram/stt.py +8 -0
  50. pipecat/services/deepseek/llm.py +13 -8
  51. pipecat/services/fireworks/llm.py +13 -8
  52. pipecat/services/fish/tts.py +8 -6
  53. pipecat/services/gemini_multimodal_live/gemini.py +5 -0
  54. pipecat/services/gladia/config.py +7 -1
  55. pipecat/services/gladia/stt.py +23 -15
  56. pipecat/services/google/llm.py +159 -59
  57. pipecat/services/google/llm_openai.py +18 -3
  58. pipecat/services/grok/llm.py +2 -1
  59. pipecat/services/llm_service.py +38 -3
  60. pipecat/services/mem0/memory.py +2 -1
  61. pipecat/services/mistral/llm.py +5 -6
  62. pipecat/services/nim/llm.py +2 -1
  63. pipecat/services/openai/base_llm.py +88 -26
  64. pipecat/services/openai/image.py +6 -1
  65. pipecat/services/openai_realtime_beta/openai.py +5 -2
  66. pipecat/services/openpipe/llm.py +6 -8
  67. pipecat/services/perplexity/llm.py +13 -8
  68. pipecat/services/playht/tts.py +9 -6
  69. pipecat/services/rime/tts.py +1 -1
  70. pipecat/services/sambanova/llm.py +18 -13
  71. pipecat/services/sarvam/tts.py +415 -10
  72. pipecat/services/speechmatics/stt.py +2 -2
  73. pipecat/services/tavus/video.py +1 -1
  74. pipecat/services/tts_service.py +15 -5
  75. pipecat/services/vistaar/llm.py +2 -5
  76. pipecat/transports/base_input.py +32 -19
  77. pipecat/transports/base_output.py +39 -5
  78. pipecat/transports/daily/__init__.py +0 -0
  79. pipecat/transports/daily/transport.py +2371 -0
  80. pipecat/transports/daily/utils.py +410 -0
  81. pipecat/transports/livekit/__init__.py +0 -0
  82. pipecat/transports/livekit/transport.py +1042 -0
  83. pipecat/transports/network/fastapi_websocket.py +12 -546
  84. pipecat/transports/network/small_webrtc.py +12 -922
  85. pipecat/transports/network/webrtc_connection.py +9 -595
  86. pipecat/transports/network/websocket_client.py +12 -481
  87. pipecat/transports/network/websocket_server.py +12 -487
  88. pipecat/transports/services/daily.py +9 -2334
  89. pipecat/transports/services/helpers/daily_rest.py +12 -396
  90. pipecat/transports/services/livekit.py +12 -975
  91. pipecat/transports/services/tavus.py +12 -757
  92. pipecat/transports/smallwebrtc/__init__.py +0 -0
  93. pipecat/transports/smallwebrtc/connection.py +612 -0
  94. pipecat/transports/smallwebrtc/transport.py +936 -0
  95. pipecat/transports/tavus/__init__.py +0 -0
  96. pipecat/transports/tavus/transport.py +770 -0
  97. pipecat/transports/websocket/__init__.py +0 -0
  98. pipecat/transports/websocket/client.py +494 -0
  99. pipecat/transports/websocket/fastapi.py +559 -0
  100. pipecat/transports/websocket/server.py +500 -0
  101. pipecat/transports/whatsapp/__init__.py +0 -0
  102. pipecat/transports/whatsapp/api.py +345 -0
  103. pipecat/transports/whatsapp/client.py +364 -0
  104. {dv_pipecat_ai-0.0.82.dev815.dist-info → dv_pipecat_ai-0.0.82.dev857.dist-info}/WHEEL +0 -0
  105. {dv_pipecat_ai-0.0.82.dev815.dist-info → dv_pipecat_ai-0.0.82.dev857.dist-info}/licenses/LICENSE +0 -0
  106. {dv_pipecat_ai-0.0.82.dev815.dist-info → dv_pipecat_ai-0.0.82.dev857.dist-info}/top_level.txt +0 -0
@@ -9,399 +9,15 @@
9
9
  Methods that wrap the Daily API to create rooms, check room URLs, and get meeting tokens.
10
10
  """
11
11
 
12
- import time
13
- from typing import Literal, Optional
14
- from urllib.parse import urlparse
15
-
16
- import aiohttp
17
- from pydantic import BaseModel, Field, ValidationError
18
-
19
-
20
- class DailyRoomSipParams(BaseModel):
21
- """SIP configuration parameters for Daily rooms.
22
-
23
- Parameters:
24
- display_name: Name shown for the SIP endpoint.
25
- video: Whether video is enabled for SIP.
26
- sip_mode: SIP connection mode, typically 'dial-in'.
27
- num_endpoints: Number of allowed SIP endpoints.
28
- """
29
-
30
- display_name: str = "sw-sip-dialin"
31
- video: bool = False
32
- sip_mode: str = "dial-in"
33
- num_endpoints: int = 1
34
-
35
-
36
- class RecordingsBucketConfig(BaseModel):
37
- """Configuration for storing Daily recordings in a custom S3 bucket.
38
-
39
- Refer to the Daily API documentation for more information:
40
- https://docs.daily.co/guides/products/live-streaming-recording/storing-recordings-in-a-custom-s3-bucket
41
-
42
- Parameters:
43
- bucket_name: Name of the S3 bucket for storing recordings.
44
- bucket_region: AWS region where the S3 bucket is located.
45
- assume_role_arn: ARN of the IAM role to assume for S3 access.
46
- allow_api_access: Whether to allow API access to the recordings.
47
- """
48
-
49
- bucket_name: str
50
- bucket_region: str
51
- assume_role_arn: str
52
- allow_api_access: bool = False
53
-
54
-
55
- class TranscriptionBucketConfig(BaseModel):
56
- """Configuration for storing Daily transcription in a custom S3 bucket.
57
-
58
- Refer to the Daily API documentation for more information:
59
- https://docs.daily.co/guides/products/live-streaming-recording/storing-recordings-in-a-custom-s3-bucket
60
-
61
- Parameters:
62
- bucket_name: Name of the S3 bucket for storing transcription.
63
- bucket_region: AWS region where the S3 bucket is located.
64
- assume_role_arn: ARN of the IAM role to assume for S3 access.
65
- allow_api_access: Whether to allow API access to the transcription.
66
- """
67
-
68
- bucket_name: str
69
- bucket_region: str
70
- assume_role_arn: str
71
- allow_api_access: bool = False
72
-
73
-
74
- class DailyRoomProperties(BaseModel, extra="allow"):
75
- """Properties for configuring a Daily room.
76
-
77
- Reference: https://docs.daily.co/reference/rest-api/rooms/create-room#properties
78
-
79
- Parameters:
80
- exp: Optional Unix epoch timestamp for room expiration (e.g., time.time() + 300 for 5 minutes).
81
- enable_chat: Whether chat is enabled in the room.
82
- enable_prejoin_ui: Whether the pre-join UI is enabled.
83
- enable_emoji_reactions: Whether emoji reactions are enabled.
84
- eject_at_room_exp: Whether to remove participants when room expires.
85
- enable_dialout: Whether SIP dial-out is enabled.
86
- enable_recording: Recording settings ('cloud', 'local', 'raw-tracks').
87
- enable_transcription_storage: Whether transcription storage is enabled.
88
- geo: Geographic region for room.
89
- max_participants: Maximum number of participants allowed in the room.
90
- recordings_bucket: Configuration for custom S3 bucket recordings.
91
- transcription_bucket: Configuration for custom S3 bucket transcription.
92
- sip: SIP configuration parameters.
93
- sip_uri: SIP URI information returned by Daily.
94
- start_video_off: Whether video is off by default.
95
- """
96
-
97
- exp: Optional[float] = None
98
- enable_chat: bool = False
99
- enable_prejoin_ui: bool = False
100
- enable_emoji_reactions: bool = False
101
- eject_at_room_exp: bool = False
102
- enable_dialout: Optional[bool] = None
103
- enable_recording: Optional[Literal["cloud", "local", "raw-tracks"]] = None
104
- enable_transcription_storage: Optional[bool] = None
105
- geo: Optional[str] = None
106
- max_participants: Optional[int] = None
107
- recordings_bucket: Optional[RecordingsBucketConfig] = None
108
- transcription_bucket: Optional[TranscriptionBucketConfig] = None
109
- sip: Optional[DailyRoomSipParams] = None
110
- sip_uri: Optional[dict] = None
111
- start_video_off: bool = False
112
-
113
- @property
114
- def sip_endpoint(self) -> str:
115
- """Get the SIP endpoint URI if available.
116
-
117
- Returns:
118
- SIP endpoint URI or empty string if not available.
119
- """
120
- if not self.sip_uri:
121
- return ""
122
- else:
123
- return "sip:%s" % self.sip_uri["endpoint"]
124
-
125
-
126
- class DailyRoomParams(BaseModel):
127
- """Parameters for creating a Daily room.
128
-
129
- Parameters:
130
- name: Optional custom name for the room.
131
- privacy: Room privacy setting ('private' or 'public').
132
- properties: Room configuration properties.
133
- """
134
-
135
- name: Optional[str] = None
136
- privacy: Literal["private", "public"] = "public"
137
- properties: DailyRoomProperties = Field(default_factory=DailyRoomProperties)
138
-
139
-
140
- class DailyRoomObject(BaseModel):
141
- """Represents a Daily room returned by the API.
142
-
143
- Parameters:
144
- id: Unique room identifier.
145
- name: Room name.
146
- api_created: Whether room was created via API.
147
- privacy: Room privacy setting ('private' or 'public').
148
- url: Full URL for joining the room.
149
- created_at: Timestamp of room creation in ISO 8601 format (e.g., "2019-01-26T09:01:22.000Z").
150
- config: Room configuration properties.
151
- """
152
-
153
- id: str
154
- name: str
155
- api_created: bool
156
- privacy: str
157
- url: str
158
- created_at: str
159
- config: DailyRoomProperties
160
-
161
-
162
- class DailyMeetingTokenProperties(BaseModel):
163
- """Properties for configuring a Daily meeting token.
164
-
165
- Refer to the Daily API documentation for more information:
166
- https://docs.daily.co/reference/rest-api/meeting-tokens/create-meeting-token#properties
167
-
168
- Parameters:
169
- room_name: The room for which this token is valid. If not set, the token is valid for all rooms in your domain.
170
- eject_at_token_exp: If True, the user will be ejected from the room when the token expires.
171
- eject_after_elapsed: The number of seconds after which the user will be ejected from the room.
172
- nbf: Not before timestamp - users cannot join with this token before this time.
173
- exp: Expiration time (unix timestamp in seconds). Strongly recommended for security.
174
- is_owner: If True, the token will grant owner privileges in the room.
175
- user_name: The name of the user. This will be added to the token payload.
176
- user_id: A unique identifier for the user. This will be added to the token payload.
177
- enable_screenshare: If True, the user will be able to share their screen.
178
- start_video_off: If True, the user's video will be turned off when they join the room.
179
- start_audio_off: If True, the user's audio will be turned off when they join the room.
180
- enable_recording: Recording settings for the token. Must be one of 'cloud', 'local' or 'raw-tracks'.
181
- enable_prejoin_ui: If True, the user will see the prejoin UI before joining the room.
182
- start_cloud_recording: Start cloud recording when the user joins the room.
183
- permissions: Specifies the initial default permissions for a non-meeting-owner participant.
184
- """
185
-
186
- room_name: Optional[str] = None
187
- eject_at_token_exp: Optional[bool] = None
188
- eject_after_elapsed: Optional[int] = None
189
- nbf: Optional[int] = None
190
- exp: Optional[int] = None
191
- is_owner: Optional[bool] = None
192
- user_name: Optional[str] = None
193
- user_id: Optional[str] = None
194
- enable_screenshare: Optional[bool] = None
195
- start_video_off: Optional[bool] = None
196
- start_audio_off: Optional[bool] = None
197
- enable_recording: Optional[Literal["cloud", "local", "raw-tracks"]] = None
198
- enable_prejoin_ui: Optional[bool] = None
199
- start_cloud_recording: Optional[bool] = None
200
- permissions: Optional[dict] = None
201
-
202
-
203
- class DailyMeetingTokenParams(BaseModel):
204
- """Parameters for creating a Daily meeting token.
205
-
206
- Refer to the Daily API documentation for more information:
207
- https://docs.daily.co/reference/rest-api/meeting-tokens/create-meeting-token#body-params
208
-
209
- Parameters:
210
- properties: Meeting token configuration properties.
211
- """
212
-
213
- properties: DailyMeetingTokenProperties = Field(default_factory=DailyMeetingTokenProperties)
214
-
215
-
216
- class DailyRESTHelper:
217
- """Helper class for interacting with Daily's REST API.
218
-
219
- Provides methods for creating, managing, and accessing Daily rooms.
220
- """
221
-
222
- def __init__(
223
- self,
224
- *,
225
- daily_api_key: str,
226
- daily_api_url: str = "https://api.daily.co/v1",
227
- aiohttp_session: aiohttp.ClientSession,
228
- ):
229
- """Initialize the Daily REST helper.
230
-
231
- Args:
232
- daily_api_key: Your Daily API key.
233
- daily_api_url: Daily API base URL (e.g. "https://api.daily.co/v1").
234
- aiohttp_session: Async HTTP session for making requests.
235
- """
236
- self.daily_api_key = daily_api_key
237
- self.daily_api_url = daily_api_url
238
- self.aiohttp_session = aiohttp_session
239
-
240
- def get_name_from_url(self, room_url: str) -> str:
241
- """Extract room name from a Daily room URL.
242
-
243
- Args:
244
- room_url: Full Daily room URL.
245
-
246
- Returns:
247
- Room name portion of the URL.
248
- """
249
- return urlparse(room_url).path[1:]
250
-
251
- async def get_room_from_url(self, room_url: str) -> DailyRoomObject:
252
- """Get room details from a Daily room URL.
253
-
254
- Args:
255
- room_url: Full Daily room URL.
256
-
257
- Returns:
258
- DailyRoomObject instance for the room.
259
- """
260
- room_name = self.get_name_from_url(room_url)
261
- return await self._get_room_from_name(room_name)
262
-
263
- async def create_room(self, params: DailyRoomParams) -> DailyRoomObject:
264
- """Create a new Daily room.
265
-
266
- Args:
267
- params: Room configuration parameters.
268
-
269
- Returns:
270
- DailyRoomObject instance for the created room.
271
-
272
- Raises:
273
- Exception: If room creation fails or response is invalid.
274
- """
275
- headers = {"Authorization": f"Bearer {self.daily_api_key}"}
276
- json = params.model_dump(exclude_none=True)
277
- async with self.aiohttp_session.post(
278
- f"{self.daily_api_url}/rooms", headers=headers, json=json
279
- ) as r:
280
- if r.status != 200:
281
- text = await r.text()
282
- raise Exception(f"Unable to create room (status: {r.status}): {text}")
283
-
284
- data = await r.json()
285
-
286
- try:
287
- room = DailyRoomObject(**data)
288
- except ValidationError as e:
289
- raise Exception(f"Invalid response: {e}")
290
-
291
- return room
292
-
293
- async def get_token(
294
- self,
295
- room_url: str,
296
- expiry_time: float = 60 * 60,
297
- eject_at_token_exp: bool = False,
298
- owner: bool = True,
299
- params: Optional[DailyMeetingTokenParams] = None,
300
- ) -> str:
301
- """Generate a meeting token for user to join a Daily room.
302
-
303
- Args:
304
- room_url: Daily room URL.
305
- expiry_time: Token validity duration in seconds (default: 1 hour).
306
- eject_at_token_exp: Whether to eject user when token expires.
307
- owner: Whether token has owner privileges.
308
- params: Optional additional token properties. Note that room_name,
309
- exp, and is_owner will be set based on the other function
310
- parameters regardless of values in params.
311
-
312
- Returns:
313
- Meeting token.
314
-
315
- Raises:
316
- Exception: If token generation fails or room URL is missing.
317
- """
318
- if not room_url:
319
- raise Exception(
320
- "No Daily room specified. You must specify a Daily room in order a token to be generated."
321
- )
322
-
323
- expiration: int = int(time.time() + expiry_time)
324
-
325
- room_name = self.get_name_from_url(room_url)
326
-
327
- headers = {"Authorization": f"Bearer {self.daily_api_key}"}
328
-
329
- if params is None:
330
- params = DailyMeetingTokenParams(
331
- properties=DailyMeetingTokenProperties(
332
- room_name=room_name,
333
- is_owner=owner,
334
- exp=expiration,
335
- eject_at_token_exp=eject_at_token_exp,
336
- )
337
- )
338
- else:
339
- params.properties.room_name = room_name
340
- params.properties.exp = expiration
341
- params.properties.eject_at_token_exp = eject_at_token_exp
342
- params.properties.is_owner = owner
343
-
344
- json = params.model_dump(exclude_none=True)
345
-
346
- async with self.aiohttp_session.post(
347
- f"{self.daily_api_url}/meeting-tokens", headers=headers, json=json
348
- ) as r:
349
- if r.status != 200:
350
- text = await r.text()
351
- raise Exception(f"Failed to create meeting token (status: {r.status}): {text}")
352
-
353
- data = await r.json()
354
-
355
- return data["token"]
356
-
357
- async def delete_room_by_url(self, room_url: str) -> bool:
358
- """Delete a room using its URL.
359
-
360
- Args:
361
- room_url: Daily room URL.
362
-
363
- Returns:
364
- True if deletion was successful.
365
- """
366
- room_name = self.get_name_from_url(room_url)
367
- return await self.delete_room_by_name(room_name)
368
-
369
- async def delete_room_by_name(self, room_name: str) -> bool:
370
- """Delete a room using its name.
371
-
372
- Args:
373
- room_name: Name of the room to delete.
374
-
375
- Returns:
376
- True if deletion was successful.
377
-
378
- Raises:
379
- Exception: If deletion fails (excluding 404 Not Found).
380
- """
381
- headers = {"Authorization": f"Bearer {self.daily_api_key}"}
382
- async with self.aiohttp_session.delete(
383
- f"{self.daily_api_url}/rooms/{room_name}", headers=headers
384
- ) as r:
385
- if r.status != 200 and r.status != 404:
386
- text = await r.text()
387
- raise Exception(f"Failed to delete room [{room_name}] (status: {r.status}): {text}")
388
-
389
- return True
390
-
391
- async def _get_room_from_name(self, room_name: str) -> DailyRoomObject:
392
- """Internal method to get room details by name."""
393
- headers = {"Authorization": f"Bearer {self.daily_api_key}"}
394
- async with self.aiohttp_session.get(
395
- f"{self.daily_api_url}/rooms/{room_name}", headers=headers
396
- ) as r:
397
- if r.status != 200:
398
- raise Exception(f"Room not found: {room_name}")
399
-
400
- data = await r.json()
401
-
402
- try:
403
- room = DailyRoomObject(**data)
404
- except ValidationError as e:
405
- raise Exception(f"Invalid response: {e}")
406
-
407
- return room
12
+ import warnings
13
+
14
+ from pipecat.transports.daily.utils import *
15
+
16
+ with warnings.catch_warnings():
17
+ warnings.simplefilter("always")
18
+ warnings.warn(
19
+ "Module `pipecat.transports.services.helpers.daily_rest` is deprecated, "
20
+ "use `pipecat.transports.daily.utils` instead.",
21
+ DeprecationWarning,
22
+ stacklevel=2,
23
+ )