pipecat-deepdub 0.1.0__tar.gz
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.
- pipecat_deepdub-0.1.0/.env.example +5 -0
- pipecat_deepdub-0.1.0/.gitignore +43 -0
- pipecat_deepdub-0.1.0/CHANGELOG.md +27 -0
- pipecat_deepdub-0.1.0/LICENSE +21 -0
- pipecat_deepdub-0.1.0/PKG-INFO +175 -0
- pipecat_deepdub-0.1.0/README.md +153 -0
- pipecat_deepdub-0.1.0/examples/foundational/deepdub-voice-agent.py +122 -0
- pipecat_deepdub-0.1.0/pyproject.toml +72 -0
- pipecat_deepdub-0.1.0/src/pipecat_deepdub/__init__.py +17 -0
- pipecat_deepdub-0.1.0/src/pipecat_deepdub/models.py +133 -0
- pipecat_deepdub-0.1.0/src/pipecat_deepdub/stt.py +498 -0
- pipecat_deepdub-0.1.0/src/pipecat_deepdub/tts.py +532 -0
- pipecat_deepdub-0.1.0/tests/__init__.py +0 -0
- pipecat_deepdub-0.1.0/tests/test_stt.py +218 -0
- pipecat_deepdub-0.1.0/tests/test_tts.py +306 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
*.egg
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
*.whl
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
ENV/
|
|
17
|
+
|
|
18
|
+
# IDE
|
|
19
|
+
.idea/
|
|
20
|
+
.vscode/
|
|
21
|
+
*.swp
|
|
22
|
+
*.swo
|
|
23
|
+
*~
|
|
24
|
+
.cursor/*
|
|
25
|
+
|
|
26
|
+
# Environment
|
|
27
|
+
.env
|
|
28
|
+
.env.local
|
|
29
|
+
|
|
30
|
+
# OS
|
|
31
|
+
.DS_Store
|
|
32
|
+
Thumbs.db
|
|
33
|
+
|
|
34
|
+
# Testing
|
|
35
|
+
.pytest_cache/
|
|
36
|
+
.ruff_cache/
|
|
37
|
+
htmlcov/
|
|
38
|
+
.coverage
|
|
39
|
+
.coverage.*
|
|
40
|
+
tests/output/
|
|
41
|
+
|
|
42
|
+
# Build
|
|
43
|
+
*.lock
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-11-26
|
|
9
|
+
|
|
10
|
+
First release of `pipecat-deepdub`, which replaces `pipecat-deepdub-tts`.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `DeepdubTTSService` for Pipecat 1.x: streams LLM tokens to Deepdub over one WebSocket
|
|
15
|
+
and streams the audio back. Interruptions cancel the reply without reconnecting,
|
|
16
|
+
replies queued behind it wait their turn, and voice, locale and model changes apply
|
|
17
|
+
to the open connection.
|
|
18
|
+
- `DeepdubSTTService`: real-time English and Hebrew transcription with interim results,
|
|
19
|
+
fast finalization on VAD stop, or Deepdub's own turn detection.
|
|
20
|
+
- EU endpoints for both services.
|
|
21
|
+
- Foundational example `examples/foundational/deepdub-voice-agent.py`.
|
|
22
|
+
|
|
23
|
+
### Removed
|
|
24
|
+
|
|
25
|
+
- The `pipecat-deepdub-tts` package and its Pipecat 0.0.x support.
|
|
26
|
+
- `temperature`, `variance`, `tempo`, `prompt_boost` and accent options, which Deepdub's
|
|
27
|
+
streaming endpoint ignores.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Deepdub AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pipecat-deepdub
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Deepdub text-to-speech and speech-to-text services for Pipecat
|
|
5
|
+
Project-URL: Repository, https://github.com/deepdub-ai/pipecat
|
|
6
|
+
Project-URL: Issues, https://github.com/deepdub-ai/pipecat/issues
|
|
7
|
+
Project-URL: Changelog, https://github.com/deepdub-ai/pipecat/blob/main/CHANGELOG.md
|
|
8
|
+
Author-email: Deepdub AI <info@deepdub.ai>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: deepdub,pipecat,speech-to-text,stt,text-to-speech,tts,voice-ai
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Requires-Dist: pipecat-ai<2,>=1.17.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Pipecat Deepdub
|
|
24
|
+
|
|
25
|
+
[Deepdub](https://deepdub.ai/) text-to-speech and speech-to-text for [Pipecat](https://github.com/pipecat-ai/pipecat), the open-source framework for voice and multimodal AI agents.
|
|
26
|
+
|
|
27
|
+
- **`DeepdubTTSService`** streams LLM tokens to Deepdub's emotional TTS (`dd-etts-4.0`) and streams the audio back over one WebSocket. Interruptions cancel the reply in place, without reconnecting.
|
|
28
|
+
- **`DeepdubSTTService`** streams microphone audio to Deepdub's real-time speech-to-text and returns interim and final transcripts in English and Hebrew.
|
|
29
|
+
|
|
30
|
+
This integration is built and maintained by [Deepdub](https://deepdub.ai/).
|
|
31
|
+
|
|
32
|
+
**Tested with Pipecat v1.17.0.**
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv add pipecat-deepdub
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
or
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install pipecat-deepdub
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Get an API key from [Deepdub](https://deepdub.ai/). Both services take it as `api_key`.
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import os
|
|
52
|
+
|
|
53
|
+
from pipecat_deepdub import DeepdubSTTService, DeepdubTTSService
|
|
54
|
+
|
|
55
|
+
stt = DeepdubSTTService(api_key=os.environ["DEEPDUB_API_KEY"])
|
|
56
|
+
|
|
57
|
+
tts = DeepdubTTSService(
|
|
58
|
+
api_key=os.environ["DEEPDUB_API_KEY"],
|
|
59
|
+
settings=DeepdubTTSService.Settings(
|
|
60
|
+
voice="b2abb241-ac92-48bf-a890-fec03f43e209",
|
|
61
|
+
language="en-US",
|
|
62
|
+
),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
pipeline = Pipeline(
|
|
66
|
+
[
|
|
67
|
+
transport.input(),
|
|
68
|
+
stt,
|
|
69
|
+
user_aggregator,
|
|
70
|
+
llm,
|
|
71
|
+
tts,
|
|
72
|
+
transport.output(),
|
|
73
|
+
assistant_aggregator,
|
|
74
|
+
]
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Change the voice, locale or model mid-conversation with a `TTSUpdateSettingsFrame`. The TTS service reconfigures the open connection, so the change takes effect from the next text without a reconnect:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from pipecat.frames.frames import TTSUpdateSettingsFrame
|
|
82
|
+
|
|
83
|
+
await worker.queue_frame(
|
|
84
|
+
TTSUpdateSettingsFrame(delta=DeepdubTTSService.Settings(language="he-IL"))
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Text-to-speech
|
|
89
|
+
|
|
90
|
+
`DeepdubTTSService(api_key, url=..., sample_rate=None, enable_logging=None, turn_timeout=10.0, settings=None)`
|
|
91
|
+
|
|
92
|
+
| Parameter | Default | Description |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| `api_key` | required | Deepdub API key. |
|
|
95
|
+
| `url` | `wss://wss.deepdub.ai/ws` | Streaming endpoint. Use `wss://wss.eu.deepdub.ai/ws` to process data in the EU. |
|
|
96
|
+
| `sample_rate` | pipeline rate | Output rate in Hz. Deepdub streams 8000, 16000, 22050, 24000, 32000, 36000, 44100 or 48000 Hz; other rates are resampled from the next one up. |
|
|
97
|
+
| `enable_logging` | Deepdub default (on) | Set to `False` to keep this session's text out of Deepdub's server-side logs. |
|
|
98
|
+
| `turn_timeout` | `10.0` | Seconds to wait for audio after a reply is complete before reporting an error. |
|
|
99
|
+
|
|
100
|
+
`DeepdubTTSService.Settings`:
|
|
101
|
+
|
|
102
|
+
| Setting | Default | Description |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| `model` | `dd-etts-4.0` | Deepdub TTS model. |
|
|
105
|
+
| `voice` | `b2abb241-ac92-48bf-a890-fec03f43e209` | Voice prompt ID. |
|
|
106
|
+
| `language` | `en-US` | Locale to speak, such as `he-IL` or `fr-FR`. A Pipecat `Language` works too: `Language.HE` maps to `he-IL`. |
|
|
107
|
+
| `target_gender` | none | `"male"` or `"female"`, for language-specific handling such as Hebrew diacritics. |
|
|
108
|
+
| `accept_emojis` | Deepdub default (off) | Whether flag and emotion emojis switch locale or emotion instead of being spoken. |
|
|
109
|
+
|
|
110
|
+
### Speech-to-text
|
|
111
|
+
|
|
112
|
+
`DeepdubSTTService(api_key, url=..., sample_rate=None, vad_force_turn_endpoint=True, should_interrupt=True, settings=None)`
|
|
113
|
+
|
|
114
|
+
| Parameter | Default | Description |
|
|
115
|
+
|---|---|---|
|
|
116
|
+
| `api_key` | required | Deepdub API key. |
|
|
117
|
+
| `url` | `wss://wsgw.deepdub.ai/transcribe-websocket` | Speech-to-text endpoint. Use `wss://wsgw.eu.deepdub.ai/transcribe-websocket` for the EU. |
|
|
118
|
+
| `sample_rate` | pipeline rate | Input rate in Hz. |
|
|
119
|
+
| `vad_force_turn_endpoint` | `True` | When `True`, Pipecat's turn strategies end the user's turn and a VAD stop asks Deepdub to finalize the transcript at once. When `False`, Deepdub's endpoint detection ends the turn. |
|
|
120
|
+
| `should_interrupt` | `True` | Whether the user speaking interrupts the bot, when Deepdub detects turns. |
|
|
121
|
+
|
|
122
|
+
`DeepdubSTTService.Settings`:
|
|
123
|
+
|
|
124
|
+
| Setting | Default | Description |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| `model` | `stt-egf` | Deepdub STT model. |
|
|
127
|
+
| `language` | auto | `"en"` or `"he"` (or `Language.EN` / `Language.HE`). Unset, Deepdub detects the language of each utterance. |
|
|
128
|
+
| `language_hints_strict` | Deepdub default (off) | Recognize only `language`, instead of preferring it. |
|
|
129
|
+
| `context_terms` | none | Words and names to recognize reliably, such as product names. |
|
|
130
|
+
| `context_text` | none | Background text about the conversation. |
|
|
131
|
+
| `max_endpoint_delay_ms` | Deepdub default | Longest wait after speech stops before Deepdub reports an endpoint, 500 to 3000. |
|
|
132
|
+
| `client_reference_id` | none | Your own identifier for the session. |
|
|
133
|
+
|
|
134
|
+
## Running the example
|
|
135
|
+
|
|
136
|
+
[`examples/foundational/deepdub-voice-agent.py`](examples/foundational/deepdub-voice-agent.py) is a voice agent that listens and speaks with Deepdub and answers with OpenAI.
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
git clone https://github.com/deepdub-ai/pipecat.git pipecat-deepdub
|
|
140
|
+
cd pipecat-deepdub
|
|
141
|
+
uv sync --group example
|
|
142
|
+
cp .env.example .env # then add DEEPDUB_API_KEY and OPENAI_API_KEY
|
|
143
|
+
uv run examples/foundational/deepdub-voice-agent.py
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Open http://localhost:7860/client, allow the microphone, and talk. Interrupt the bot mid-sentence to hear it stop. To run it over Daily or Twilio instead, pass `--transport daily` or `--transport twilio`.
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
uv sync --all-groups
|
|
152
|
+
uv run pytest
|
|
153
|
+
uv run ruff check && uv run ruff format --check
|
|
154
|
+
uv run pyright
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The tests run against a local fake of each Deepdub endpoint, so they need no API key.
|
|
158
|
+
|
|
159
|
+
## Migrating from `pipecat-deepdub-tts`
|
|
160
|
+
|
|
161
|
+
`pipecat-deepdub` replaces `pipecat-deepdub-tts`, which supported Pipecat 0.0.x.
|
|
162
|
+
|
|
163
|
+
- Install `pipecat-deepdub` and import from `pipecat_deepdub`.
|
|
164
|
+
- `voice_id`, `model` and `params=InputParams(locale=...)` are now `settings=DeepdubTTSService.Settings(voice=..., model=..., language=...)`.
|
|
165
|
+
- `temperature`, `variance`, `tempo`, `prompt_boost` and the accent options are gone: Deepdub's streaming endpoint ignores them.
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT. See [LICENSE](LICENSE).
|
|
170
|
+
|
|
171
|
+
## Support
|
|
172
|
+
|
|
173
|
+
- [GitHub issues](https://github.com/deepdub-ai/pipecat/issues)
|
|
174
|
+
- [Deepdub API documentation](https://docs.deepdub.ai)
|
|
175
|
+
- [Pipecat Discord](https://discord.gg/pipecat)
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Pipecat Deepdub
|
|
2
|
+
|
|
3
|
+
[Deepdub](https://deepdub.ai/) text-to-speech and speech-to-text for [Pipecat](https://github.com/pipecat-ai/pipecat), the open-source framework for voice and multimodal AI agents.
|
|
4
|
+
|
|
5
|
+
- **`DeepdubTTSService`** streams LLM tokens to Deepdub's emotional TTS (`dd-etts-4.0`) and streams the audio back over one WebSocket. Interruptions cancel the reply in place, without reconnecting.
|
|
6
|
+
- **`DeepdubSTTService`** streams microphone audio to Deepdub's real-time speech-to-text and returns interim and final transcripts in English and Hebrew.
|
|
7
|
+
|
|
8
|
+
This integration is built and maintained by [Deepdub](https://deepdub.ai/).
|
|
9
|
+
|
|
10
|
+
**Tested with Pipecat v1.17.0.**
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
uv add pipecat-deepdub
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install pipecat-deepdub
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Get an API key from [Deepdub](https://deepdub.ai/). Both services take it as `api_key`.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import os
|
|
30
|
+
|
|
31
|
+
from pipecat_deepdub import DeepdubSTTService, DeepdubTTSService
|
|
32
|
+
|
|
33
|
+
stt = DeepdubSTTService(api_key=os.environ["DEEPDUB_API_KEY"])
|
|
34
|
+
|
|
35
|
+
tts = DeepdubTTSService(
|
|
36
|
+
api_key=os.environ["DEEPDUB_API_KEY"],
|
|
37
|
+
settings=DeepdubTTSService.Settings(
|
|
38
|
+
voice="b2abb241-ac92-48bf-a890-fec03f43e209",
|
|
39
|
+
language="en-US",
|
|
40
|
+
),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
pipeline = Pipeline(
|
|
44
|
+
[
|
|
45
|
+
transport.input(),
|
|
46
|
+
stt,
|
|
47
|
+
user_aggregator,
|
|
48
|
+
llm,
|
|
49
|
+
tts,
|
|
50
|
+
transport.output(),
|
|
51
|
+
assistant_aggregator,
|
|
52
|
+
]
|
|
53
|
+
)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Change the voice, locale or model mid-conversation with a `TTSUpdateSettingsFrame`. The TTS service reconfigures the open connection, so the change takes effect from the next text without a reconnect:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from pipecat.frames.frames import TTSUpdateSettingsFrame
|
|
60
|
+
|
|
61
|
+
await worker.queue_frame(
|
|
62
|
+
TTSUpdateSettingsFrame(delta=DeepdubTTSService.Settings(language="he-IL"))
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Text-to-speech
|
|
67
|
+
|
|
68
|
+
`DeepdubTTSService(api_key, url=..., sample_rate=None, enable_logging=None, turn_timeout=10.0, settings=None)`
|
|
69
|
+
|
|
70
|
+
| Parameter | Default | Description |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| `api_key` | required | Deepdub API key. |
|
|
73
|
+
| `url` | `wss://wss.deepdub.ai/ws` | Streaming endpoint. Use `wss://wss.eu.deepdub.ai/ws` to process data in the EU. |
|
|
74
|
+
| `sample_rate` | pipeline rate | Output rate in Hz. Deepdub streams 8000, 16000, 22050, 24000, 32000, 36000, 44100 or 48000 Hz; other rates are resampled from the next one up. |
|
|
75
|
+
| `enable_logging` | Deepdub default (on) | Set to `False` to keep this session's text out of Deepdub's server-side logs. |
|
|
76
|
+
| `turn_timeout` | `10.0` | Seconds to wait for audio after a reply is complete before reporting an error. |
|
|
77
|
+
|
|
78
|
+
`DeepdubTTSService.Settings`:
|
|
79
|
+
|
|
80
|
+
| Setting | Default | Description |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| `model` | `dd-etts-4.0` | Deepdub TTS model. |
|
|
83
|
+
| `voice` | `b2abb241-ac92-48bf-a890-fec03f43e209` | Voice prompt ID. |
|
|
84
|
+
| `language` | `en-US` | Locale to speak, such as `he-IL` or `fr-FR`. A Pipecat `Language` works too: `Language.HE` maps to `he-IL`. |
|
|
85
|
+
| `target_gender` | none | `"male"` or `"female"`, for language-specific handling such as Hebrew diacritics. |
|
|
86
|
+
| `accept_emojis` | Deepdub default (off) | Whether flag and emotion emojis switch locale or emotion instead of being spoken. |
|
|
87
|
+
|
|
88
|
+
### Speech-to-text
|
|
89
|
+
|
|
90
|
+
`DeepdubSTTService(api_key, url=..., sample_rate=None, vad_force_turn_endpoint=True, should_interrupt=True, settings=None)`
|
|
91
|
+
|
|
92
|
+
| Parameter | Default | Description |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| `api_key` | required | Deepdub API key. |
|
|
95
|
+
| `url` | `wss://wsgw.deepdub.ai/transcribe-websocket` | Speech-to-text endpoint. Use `wss://wsgw.eu.deepdub.ai/transcribe-websocket` for the EU. |
|
|
96
|
+
| `sample_rate` | pipeline rate | Input rate in Hz. |
|
|
97
|
+
| `vad_force_turn_endpoint` | `True` | When `True`, Pipecat's turn strategies end the user's turn and a VAD stop asks Deepdub to finalize the transcript at once. When `False`, Deepdub's endpoint detection ends the turn. |
|
|
98
|
+
| `should_interrupt` | `True` | Whether the user speaking interrupts the bot, when Deepdub detects turns. |
|
|
99
|
+
|
|
100
|
+
`DeepdubSTTService.Settings`:
|
|
101
|
+
|
|
102
|
+
| Setting | Default | Description |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| `model` | `stt-egf` | Deepdub STT model. |
|
|
105
|
+
| `language` | auto | `"en"` or `"he"` (or `Language.EN` / `Language.HE`). Unset, Deepdub detects the language of each utterance. |
|
|
106
|
+
| `language_hints_strict` | Deepdub default (off) | Recognize only `language`, instead of preferring it. |
|
|
107
|
+
| `context_terms` | none | Words and names to recognize reliably, such as product names. |
|
|
108
|
+
| `context_text` | none | Background text about the conversation. |
|
|
109
|
+
| `max_endpoint_delay_ms` | Deepdub default | Longest wait after speech stops before Deepdub reports an endpoint, 500 to 3000. |
|
|
110
|
+
| `client_reference_id` | none | Your own identifier for the session. |
|
|
111
|
+
|
|
112
|
+
## Running the example
|
|
113
|
+
|
|
114
|
+
[`examples/foundational/deepdub-voice-agent.py`](examples/foundational/deepdub-voice-agent.py) is a voice agent that listens and speaks with Deepdub and answers with OpenAI.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
git clone https://github.com/deepdub-ai/pipecat.git pipecat-deepdub
|
|
118
|
+
cd pipecat-deepdub
|
|
119
|
+
uv sync --group example
|
|
120
|
+
cp .env.example .env # then add DEEPDUB_API_KEY and OPENAI_API_KEY
|
|
121
|
+
uv run examples/foundational/deepdub-voice-agent.py
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Open http://localhost:7860/client, allow the microphone, and talk. Interrupt the bot mid-sentence to hear it stop. To run it over Daily or Twilio instead, pass `--transport daily` or `--transport twilio`.
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
uv sync --all-groups
|
|
130
|
+
uv run pytest
|
|
131
|
+
uv run ruff check && uv run ruff format --check
|
|
132
|
+
uv run pyright
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The tests run against a local fake of each Deepdub endpoint, so they need no API key.
|
|
136
|
+
|
|
137
|
+
## Migrating from `pipecat-deepdub-tts`
|
|
138
|
+
|
|
139
|
+
`pipecat-deepdub` replaces `pipecat-deepdub-tts`, which supported Pipecat 0.0.x.
|
|
140
|
+
|
|
141
|
+
- Install `pipecat-deepdub` and import from `pipecat_deepdub`.
|
|
142
|
+
- `voice_id`, `model` and `params=InputParams(locale=...)` are now `settings=DeepdubTTSService.Settings(voice=..., model=..., language=...)`.
|
|
143
|
+
- `temperature`, `variance`, `tempo`, `prompt_boost` and the accent options are gone: Deepdub's streaming endpoint ignores them.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT. See [LICENSE](LICENSE).
|
|
148
|
+
|
|
149
|
+
## Support
|
|
150
|
+
|
|
151
|
+
- [GitHub issues](https://github.com/deepdub-ai/pipecat/issues)
|
|
152
|
+
- [Deepdub API documentation](https://docs.deepdub.ai)
|
|
153
|
+
- [Pipecat Discord](https://discord.gg/pipecat)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2025-2026, Deepdub AI
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
"""A voice agent that listens and speaks with Deepdub, and thinks with OpenAI.
|
|
8
|
+
|
|
9
|
+
Run it, open http://localhost:7860/client in a browser, and talk. Interrupt the
|
|
10
|
+
bot mid-sentence: it stops, and Deepdub cancels the rest of the reply.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
|
|
15
|
+
from dotenv import load_dotenv
|
|
16
|
+
from loguru import logger
|
|
17
|
+
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
|
18
|
+
from pipecat.frames.frames import LLMRunFrame
|
|
19
|
+
from pipecat.pipeline.pipeline import Pipeline
|
|
20
|
+
from pipecat.pipeline.worker import PipelineParams, PipelineWorker, ProcessorUnusablePolicy
|
|
21
|
+
from pipecat.processors.aggregators.llm_context import LLMContext
|
|
22
|
+
from pipecat.processors.aggregators.llm_response_universal import (
|
|
23
|
+
LLMContextAggregatorPair,
|
|
24
|
+
LLMUserAggregatorParams,
|
|
25
|
+
)
|
|
26
|
+
from pipecat.runner.types import RunnerArguments
|
|
27
|
+
from pipecat.runner.utils import create_transport
|
|
28
|
+
from pipecat.services.openai.llm import OpenAILLMService
|
|
29
|
+
from pipecat.transports.base_transport import BaseTransport, TransportParams
|
|
30
|
+
from pipecat.transports.daily.transport import DailyParams
|
|
31
|
+
from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams
|
|
32
|
+
from pipecat.workers.runner import WorkerRunner
|
|
33
|
+
|
|
34
|
+
from pipecat_deepdub import DeepdubSTTService, DeepdubTTSService
|
|
35
|
+
|
|
36
|
+
load_dotenv(override=True)
|
|
37
|
+
|
|
38
|
+
transport_params = {
|
|
39
|
+
"daily": lambda: DailyParams(audio_in_enabled=True, audio_out_enabled=True),
|
|
40
|
+
"twilio": lambda: FastAPIWebsocketParams(audio_in_enabled=True, audio_out_enabled=True),
|
|
41
|
+
"webrtc": lambda: TransportParams(audio_in_enabled=True, audio_out_enabled=True),
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
|
46
|
+
logger.info("Starting bot")
|
|
47
|
+
|
|
48
|
+
stt = DeepdubSTTService(api_key=os.environ["DEEPDUB_API_KEY"])
|
|
49
|
+
|
|
50
|
+
tts = DeepdubTTSService(
|
|
51
|
+
api_key=os.environ["DEEPDUB_API_KEY"],
|
|
52
|
+
settings=DeepdubTTSService.Settings(
|
|
53
|
+
voice=os.getenv("DEEPDUB_VOICE_PROMPT_ID") or "b2abb241-ac92-48bf-a890-fec03f43e209",
|
|
54
|
+
),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
llm = OpenAILLMService(
|
|
58
|
+
api_key=os.environ["OPENAI_API_KEY"],
|
|
59
|
+
settings=OpenAILLMService.Settings(
|
|
60
|
+
system_instruction=(
|
|
61
|
+
"You are a helpful assistant in a voice conversation. Your responses will be "
|
|
62
|
+
"spoken aloud, so avoid emojis, bullet points, or other formatting that can't "
|
|
63
|
+
"be spoken. Respond to what the user said in a creative, helpful, and brief way."
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
context = LLMContext()
|
|
69
|
+
user_aggregator, assistant_aggregator = LLMContextAggregatorPair(
|
|
70
|
+
context,
|
|
71
|
+
user_params=LLMUserAggregatorParams(vad_analyzer=SileroVADAnalyzer()),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
pipeline = Pipeline(
|
|
75
|
+
[
|
|
76
|
+
transport.input(),
|
|
77
|
+
stt,
|
|
78
|
+
user_aggregator,
|
|
79
|
+
llm,
|
|
80
|
+
tts,
|
|
81
|
+
transport.output(),
|
|
82
|
+
assistant_aggregator,
|
|
83
|
+
]
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
worker = PipelineWorker(
|
|
87
|
+
pipeline,
|
|
88
|
+
params=PipelineParams(enable_metrics=True, enable_usage_metrics=True),
|
|
89
|
+
idle_timeout_secs=runner_args.pipeline_idle_timeout_secs,
|
|
90
|
+
processor_unusable_policy=ProcessorUnusablePolicy.END,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
runner = WorkerRunner(handle_sigint=runner_args.handle_sigint)
|
|
94
|
+
|
|
95
|
+
await runner.add_workers(worker)
|
|
96
|
+
|
|
97
|
+
@transport.event_handler("on_client_connected")
|
|
98
|
+
async def on_client_connected(transport, client):
|
|
99
|
+
logger.info("Client connected")
|
|
100
|
+
context.add_message(
|
|
101
|
+
{"role": "developer", "content": "Please introduce yourself to the user."}
|
|
102
|
+
)
|
|
103
|
+
await worker.queue_frames([LLMRunFrame()])
|
|
104
|
+
|
|
105
|
+
@transport.event_handler("on_client_disconnected")
|
|
106
|
+
async def on_client_disconnected(transport, client):
|
|
107
|
+
logger.info("Client disconnected")
|
|
108
|
+
await runner.cancel()
|
|
109
|
+
|
|
110
|
+
await runner.run()
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
async def bot(runner_args: RunnerArguments):
|
|
114
|
+
"""Main bot entry point compatible with Pipecat Cloud."""
|
|
115
|
+
transport = await create_transport(runner_args, transport_params)
|
|
116
|
+
await run_bot(transport, runner_args)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
if __name__ == "__main__":
|
|
120
|
+
from pipecat.runner.run import main
|
|
121
|
+
|
|
122
|
+
main()
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pipecat-deepdub"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Deepdub text-to-speech and speech-to-text services for Pipecat"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Deepdub AI", email = "info@deepdub.ai"},
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.11"
|
|
15
|
+
keywords = ["deepdub", "pipecat", "text-to-speech", "speech-to-text", "tts", "stt", "voice-ai"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Multimedia :: Sound/Audio :: Speech",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"pipecat-ai>=1.17.0,<2",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Repository = "https://github.com/deepdub-ai/pipecat"
|
|
31
|
+
Issues = "https://github.com/deepdub-ai/pipecat/issues"
|
|
32
|
+
Changelog = "https://github.com/deepdub-ai/pipecat/blob/main/CHANGELOG.md"
|
|
33
|
+
|
|
34
|
+
[dependency-groups]
|
|
35
|
+
dev = [
|
|
36
|
+
"pyright>=1.1.400",
|
|
37
|
+
"pytest>=8.0.0",
|
|
38
|
+
"pytest-asyncio>=0.23.0",
|
|
39
|
+
"ruff>=0.11.0",
|
|
40
|
+
]
|
|
41
|
+
example = [
|
|
42
|
+
"pipecat-ai[daily,openai,runner,silero,webrtc,websocket]>=1.17.0,<2",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[tool.hatch.build.targets.wheel]
|
|
46
|
+
packages = ["src/pipecat_deepdub"]
|
|
47
|
+
|
|
48
|
+
[tool.pytest.ini_options]
|
|
49
|
+
testpaths = ["tests"]
|
|
50
|
+
asyncio_mode = "auto"
|
|
51
|
+
|
|
52
|
+
[tool.ruff]
|
|
53
|
+
line-length = 100
|
|
54
|
+
target-version = "py311"
|
|
55
|
+
|
|
56
|
+
[tool.ruff.lint]
|
|
57
|
+
select = ["D", "E", "F", "I", "UP"]
|
|
58
|
+
ignore = ["D105", "D107"]
|
|
59
|
+
|
|
60
|
+
[tool.ruff.lint.per-file-ignores]
|
|
61
|
+
"tests/*" = ["D"]
|
|
62
|
+
"examples/*" = ["D"]
|
|
63
|
+
|
|
64
|
+
[tool.ruff.lint.pydocstyle]
|
|
65
|
+
convention = "google"
|
|
66
|
+
|
|
67
|
+
[tool.pyright]
|
|
68
|
+
include = ["src"]
|
|
69
|
+
typeCheckingMode = "basic"
|
|
70
|
+
pythonVersion = "3.11"
|
|
71
|
+
venvPath = "."
|
|
72
|
+
venv = ".venv"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2025-2026, Deepdub AI
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
"""Deepdub text-to-speech and speech-to-text services for Pipecat."""
|
|
8
|
+
|
|
9
|
+
from pipecat_deepdub.stt import DeepdubSTTService, DeepdubSTTSettings
|
|
10
|
+
from pipecat_deepdub.tts import DeepdubTTSService, DeepdubTTSSettings
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"DeepdubSTTService",
|
|
14
|
+
"DeepdubSTTSettings",
|
|
15
|
+
"DeepdubTTSService",
|
|
16
|
+
"DeepdubTTSSettings",
|
|
17
|
+
]
|