pipecat-chariot 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_chariot-0.1.0/.env.example +9 -0
- pipecat_chariot-0.1.0/.gitignore +11 -0
- pipecat_chariot-0.1.0/CHANGELOG.md +28 -0
- pipecat_chariot-0.1.0/LICENSE +21 -0
- pipecat_chariot-0.1.0/PKG-INFO +187 -0
- pipecat_chariot-0.1.0/README.md +140 -0
- pipecat_chariot-0.1.0/docs/chariot.mdx +177 -0
- pipecat_chariot-0.1.0/examples/voice_chariot.py +140 -0
- pipecat_chariot-0.1.0/pyproject.toml +48 -0
- pipecat_chariot-0.1.0/src/pipecat_chariot/__init__.py +21 -0
- pipecat_chariot-0.1.0/src/pipecat_chariot/tts.py +481 -0
- pipecat_chariot-0.1.0/tests/test_tts.py +379 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Chariot: get a key at platform.chariot.in
|
|
2
|
+
CHARIOT_API_KEY=your-api-key-here
|
|
3
|
+
|
|
4
|
+
# Optional. Without it the service uses a Chariot stock voice.
|
|
5
|
+
# List voices: GET https://api.chariot.in/v1/voices
|
|
6
|
+
CHARIOT_VOICE_ID=your-voice-uuid
|
|
7
|
+
|
|
8
|
+
# The example uses OpenAI for speech-to-text and the LLM.
|
|
9
|
+
OPENAI_API_KEY=your-openai-key-here
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `pipecat-chariot` are documented here.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
6
|
+
this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0]
|
|
9
|
+
|
|
10
|
+
Initial release.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `ChariotTTSService`, a streaming Pipecat `TTSService` over Chariot's
|
|
15
|
+
text-to-speech WebSocket API.
|
|
16
|
+
- Optional `model` and `speed`, both omitted from the request when unset so
|
|
17
|
+
the account default applies and a newly released model needs no upgrade.
|
|
18
|
+
- Persistent connection reused across turns, with a keepalive that holds the
|
|
19
|
+
session open through quiet stretches.
|
|
20
|
+
- Interruption handling through `InterruptibleTTSService`: closing the socket
|
|
21
|
+
stops server side generation immediately.
|
|
22
|
+
- Runtime voice switching through `TTSUpdateSettingsFrame`.
|
|
23
|
+
- Segmentation of over long utterances at word boundaries, so a long reply is
|
|
24
|
+
spoken as contiguous audio.
|
|
25
|
+
- A Chariot stock voice as the default, so the service runs with just an API key.
|
|
26
|
+
- Foundational voice example and unit tests.
|
|
27
|
+
|
|
28
|
+
Tested with Pipecat v1.10.0.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chariot 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,187 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pipecat-chariot
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Chariot text-to-speech for Pipecat
|
|
5
|
+
Project-URL: Homepage, https://chariot.in
|
|
6
|
+
Project-URL: Documentation, https://docs.chariot.in/api-reference/introduction
|
|
7
|
+
Project-URL: Repository, https://github.com/Chariot-AI/pipecat-chariot
|
|
8
|
+
Project-URL: Changelog, https://github.com/Chariot-AI/pipecat-chariot/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Chariot AI
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 Chariot AI
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Keywords: chariot,indian-languages,pipecat,text-to-speech,tts,voice
|
|
33
|
+
Classifier: Development Status :: 4 - Beta
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
38
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
39
|
+
Requires-Python: >=3.11
|
|
40
|
+
Requires-Dist: pipecat-ai<2,>=1.7
|
|
41
|
+
Requires-Dist: websockets>=13.1
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: pytest-asyncio>=1.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# pipecat-chariot
|
|
49
|
+
|
|
50
|
+
Chariot text-to-speech for [Pipecat](https://github.com/pipecat-ai/pipecat).
|
|
51
|
+
|
|
52
|
+
`ChariotTTSService` is a drop-in Pipecat `TTSService` backed by [Chariot](https://chariot.in), which serves lifelike voices for Indian languages and English. Audio streams back as 16-bit mono PCM while the server is still generating, so playback starts before synthesis finishes.
|
|
53
|
+
|
|
54
|
+
This integration is built and maintained by Chariot, the company providing the service.
|
|
55
|
+
|
|
56
|
+
## Pipecat compatibility
|
|
57
|
+
|
|
58
|
+
Tested with Pipecat v1.10.0. The package requires `pipecat-ai>=1.7,<2` and Python 3.11 or newer, which is Pipecat's own floor.
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv add pipecat-chariot
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
or
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install pipecat-chariot
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Prerequisites
|
|
73
|
+
|
|
74
|
+
1. Create an account at [platform.chariot.in](https://platform.chariot.in). New accounts include free credits.
|
|
75
|
+
2. Copy an API key from the console.
|
|
76
|
+
3. Optionally pick a voice from `GET https://api.chariot.in/v1/voices`. Without one the service uses a Chariot stock voice, so the example below runs on the API key alone.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
export CHARIOT_API_KEY="your-api-key"
|
|
80
|
+
export CHARIOT_VOICE_ID="your-voice-uuid" # optional
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import os
|
|
87
|
+
|
|
88
|
+
from pipecat.pipeline.pipeline import Pipeline
|
|
89
|
+
from pipecat_chariot import ChariotTTSService
|
|
90
|
+
|
|
91
|
+
tts = ChariotTTSService(
|
|
92
|
+
api_key=os.getenv("CHARIOT_API_KEY"),
|
|
93
|
+
settings=ChariotTTSService.Settings(
|
|
94
|
+
voice=os.getenv("CHARIOT_VOICE_ID"),
|
|
95
|
+
),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
pipeline = Pipeline(
|
|
99
|
+
[
|
|
100
|
+
transport.input(),
|
|
101
|
+
stt,
|
|
102
|
+
user_aggregator,
|
|
103
|
+
llm,
|
|
104
|
+
tts,
|
|
105
|
+
transport.output(),
|
|
106
|
+
assistant_aggregator,
|
|
107
|
+
]
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Configuration
|
|
112
|
+
|
|
113
|
+
### Constructor parameters
|
|
114
|
+
|
|
115
|
+
| Parameter | Type | Default | Description |
|
|
116
|
+
|---|---|---|---|
|
|
117
|
+
| `api_key` | `str` | required | Chariot API key. Falls back to `CHARIOT_API_KEY`. |
|
|
118
|
+
| `voice_id` | `str \| None` | stock voice | Voice UUID from `GET /v1/voices`. `settings.voice` takes precedence. |
|
|
119
|
+
| `base_url` | `str` | `wss://api.chariot.in` | Override for a non-production endpoint. |
|
|
120
|
+
| `sample_rate` | `int \| None` | `44100` | Output rate in Hz. Chariot streams 44.1 kHz; a mismatch logs a warning. |
|
|
121
|
+
| `model` | `str \| None` | account default | Chariot TTS model. `settings.model` takes precedence. |
|
|
122
|
+
| `speed` | `float \| None` | voice as recorded | Speaking rate, 0.5 to 2.0. `settings.speed` takes precedence. |
|
|
123
|
+
| `optimize_streaming_latency` | `int` | `0` | Latency optimization level, 0 to 4. Higher trades quality passes for speed. |
|
|
124
|
+
|
|
125
|
+
### Settings
|
|
126
|
+
|
|
127
|
+
Pass through `ChariotTTSService.Settings(...)`. Updatable at runtime with `TTSUpdateSettingsFrame`.
|
|
128
|
+
|
|
129
|
+
| Parameter | Type | Default | Description |
|
|
130
|
+
|---|---|---|---|
|
|
131
|
+
| `voice` | `str` | stock voice | Voice UUID. |
|
|
132
|
+
| `model` | `str \| None` | account default | Chariot TTS model. |
|
|
133
|
+
| `speed` | `float \| None` | voice as recorded | Speaking rate, 0.5 to 2.0. |
|
|
134
|
+
|
|
135
|
+
Voice, model and speed are fixed for the life of a session, because the voice
|
|
136
|
+
codes they select are sent once at connect. Changing any of them reconnects,
|
|
137
|
+
which the service handles for you. Leaving model or speed unset uses your
|
|
138
|
+
account default, so a newly released model works without upgrading this
|
|
139
|
+
package.
|
|
140
|
+
|
|
141
|
+
There is no language parameter. Any voice speaks any supported language, so the audio follows the text.
|
|
142
|
+
|
|
143
|
+
## Run the example
|
|
144
|
+
|
|
145
|
+
The example is a full voice agent: Chariot speaks, and you can interrupt it mid-sentence.
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
git clone https://github.com/Chariot-AI/pipecat-chariot.git
|
|
149
|
+
cd pipecat-chariot
|
|
150
|
+
uv venv && uv pip install -e ".[dev]"
|
|
151
|
+
uv pip install "pipecat-ai[openai,silero,webrtc,runner]"
|
|
152
|
+
cp .env.example .env # add CHARIOT_API_KEY and OPENAI_API_KEY
|
|
153
|
+
uv run python examples/voice_chariot.py
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The example runs in the browser over WebRTC, so it needs no third party
|
|
157
|
+
transport account. Open the URL it prints, allow the microphone, and talk.
|
|
158
|
+
Speech to text and the LLM use OpenAI; swap in any Pipecat services you prefer.
|
|
159
|
+
|
|
160
|
+
`ChariotTTSService` itself is transport agnostic. It sits between the LLM and
|
|
161
|
+
`transport.output()` and never sees the transport, so it works with any of
|
|
162
|
+
them: Daily, LiveKit, telephony, WebSocket. The example demos WebRTC because
|
|
163
|
+
that needs no account; to try another, add its key to `transport_params` and
|
|
164
|
+
install its extra.
|
|
165
|
+
|
|
166
|
+
## How it behaves
|
|
167
|
+
|
|
168
|
+
- **Streaming**: audio frames are yielded while the server is still generating. Output is 16-bit mono PCM at 44.1 kHz, and every frame carries the rate the server declares in its `audio.start` event.
|
|
169
|
+
- **Interruptions**: built on `InterruptibleTTSService`, the base class for websocket TTS services that support neither context IDs nor a cancel message. On interruption the socket is closed, which stops server side generation immediately.
|
|
170
|
+
- **Long text**: the server caps its un-flushed buffer, so an over long utterance is sent as several word boundary segments, each flushed on its own. One generation segment per flush, contiguous audio.
|
|
171
|
+
- **Keepalive**: a flush with nothing buffered is a server side no-op that still resets the idle timeout, so a quiet stretch does not drop the connection.
|
|
172
|
+
- **Turn boundaries**: `audio.done` marks the end of one flushed segment, not the end of the turn. The turn closes when the LLM turn has completed and every segment sent has come back, so a multi sentence reply is never cut short and `BotStoppedSpeakingFrame` still tracks the real end of audio.
|
|
173
|
+
- **Errors**: failures surface as Pipecat `ErrorFrame`s rather than hanging the pipeline. An exhausted credit balance is reported as exactly that.
|
|
174
|
+
|
|
175
|
+
## Tests
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
uv run pytest
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Changelog
|
|
182
|
+
|
|
183
|
+
See [CHANGELOG.md](CHANGELOG.md).
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# pipecat-chariot
|
|
2
|
+
|
|
3
|
+
Chariot text-to-speech for [Pipecat](https://github.com/pipecat-ai/pipecat).
|
|
4
|
+
|
|
5
|
+
`ChariotTTSService` is a drop-in Pipecat `TTSService` backed by [Chariot](https://chariot.in), which serves lifelike voices for Indian languages and English. Audio streams back as 16-bit mono PCM while the server is still generating, so playback starts before synthesis finishes.
|
|
6
|
+
|
|
7
|
+
This integration is built and maintained by Chariot, the company providing the service.
|
|
8
|
+
|
|
9
|
+
## Pipecat compatibility
|
|
10
|
+
|
|
11
|
+
Tested with Pipecat v1.10.0. The package requires `pipecat-ai>=1.7,<2` and Python 3.11 or newer, which is Pipecat's own floor.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uv add pipecat-chariot
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
or
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install pipecat-chariot
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Prerequisites
|
|
26
|
+
|
|
27
|
+
1. Create an account at [platform.chariot.in](https://platform.chariot.in). New accounts include free credits.
|
|
28
|
+
2. Copy an API key from the console.
|
|
29
|
+
3. Optionally pick a voice from `GET https://api.chariot.in/v1/voices`. Without one the service uses a Chariot stock voice, so the example below runs on the API key alone.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
export CHARIOT_API_KEY="your-api-key"
|
|
33
|
+
export CHARIOT_VOICE_ID="your-voice-uuid" # optional
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import os
|
|
40
|
+
|
|
41
|
+
from pipecat.pipeline.pipeline import Pipeline
|
|
42
|
+
from pipecat_chariot import ChariotTTSService
|
|
43
|
+
|
|
44
|
+
tts = ChariotTTSService(
|
|
45
|
+
api_key=os.getenv("CHARIOT_API_KEY"),
|
|
46
|
+
settings=ChariotTTSService.Settings(
|
|
47
|
+
voice=os.getenv("CHARIOT_VOICE_ID"),
|
|
48
|
+
),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
pipeline = Pipeline(
|
|
52
|
+
[
|
|
53
|
+
transport.input(),
|
|
54
|
+
stt,
|
|
55
|
+
user_aggregator,
|
|
56
|
+
llm,
|
|
57
|
+
tts,
|
|
58
|
+
transport.output(),
|
|
59
|
+
assistant_aggregator,
|
|
60
|
+
]
|
|
61
|
+
)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Configuration
|
|
65
|
+
|
|
66
|
+
### Constructor parameters
|
|
67
|
+
|
|
68
|
+
| Parameter | Type | Default | Description |
|
|
69
|
+
|---|---|---|---|
|
|
70
|
+
| `api_key` | `str` | required | Chariot API key. Falls back to `CHARIOT_API_KEY`. |
|
|
71
|
+
| `voice_id` | `str \| None` | stock voice | Voice UUID from `GET /v1/voices`. `settings.voice` takes precedence. |
|
|
72
|
+
| `base_url` | `str` | `wss://api.chariot.in` | Override for a non-production endpoint. |
|
|
73
|
+
| `sample_rate` | `int \| None` | `44100` | Output rate in Hz. Chariot streams 44.1 kHz; a mismatch logs a warning. |
|
|
74
|
+
| `model` | `str \| None` | account default | Chariot TTS model. `settings.model` takes precedence. |
|
|
75
|
+
| `speed` | `float \| None` | voice as recorded | Speaking rate, 0.5 to 2.0. `settings.speed` takes precedence. |
|
|
76
|
+
| `optimize_streaming_latency` | `int` | `0` | Latency optimization level, 0 to 4. Higher trades quality passes for speed. |
|
|
77
|
+
|
|
78
|
+
### Settings
|
|
79
|
+
|
|
80
|
+
Pass through `ChariotTTSService.Settings(...)`. Updatable at runtime with `TTSUpdateSettingsFrame`.
|
|
81
|
+
|
|
82
|
+
| Parameter | Type | Default | Description |
|
|
83
|
+
|---|---|---|---|
|
|
84
|
+
| `voice` | `str` | stock voice | Voice UUID. |
|
|
85
|
+
| `model` | `str \| None` | account default | Chariot TTS model. |
|
|
86
|
+
| `speed` | `float \| None` | voice as recorded | Speaking rate, 0.5 to 2.0. |
|
|
87
|
+
|
|
88
|
+
Voice, model and speed are fixed for the life of a session, because the voice
|
|
89
|
+
codes they select are sent once at connect. Changing any of them reconnects,
|
|
90
|
+
which the service handles for you. Leaving model or speed unset uses your
|
|
91
|
+
account default, so a newly released model works without upgrading this
|
|
92
|
+
package.
|
|
93
|
+
|
|
94
|
+
There is no language parameter. Any voice speaks any supported language, so the audio follows the text.
|
|
95
|
+
|
|
96
|
+
## Run the example
|
|
97
|
+
|
|
98
|
+
The example is a full voice agent: Chariot speaks, and you can interrupt it mid-sentence.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git clone https://github.com/Chariot-AI/pipecat-chariot.git
|
|
102
|
+
cd pipecat-chariot
|
|
103
|
+
uv venv && uv pip install -e ".[dev]"
|
|
104
|
+
uv pip install "pipecat-ai[openai,silero,webrtc,runner]"
|
|
105
|
+
cp .env.example .env # add CHARIOT_API_KEY and OPENAI_API_KEY
|
|
106
|
+
uv run python examples/voice_chariot.py
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The example runs in the browser over WebRTC, so it needs no third party
|
|
110
|
+
transport account. Open the URL it prints, allow the microphone, and talk.
|
|
111
|
+
Speech to text and the LLM use OpenAI; swap in any Pipecat services you prefer.
|
|
112
|
+
|
|
113
|
+
`ChariotTTSService` itself is transport agnostic. It sits between the LLM and
|
|
114
|
+
`transport.output()` and never sees the transport, so it works with any of
|
|
115
|
+
them: Daily, LiveKit, telephony, WebSocket. The example demos WebRTC because
|
|
116
|
+
that needs no account; to try another, add its key to `transport_params` and
|
|
117
|
+
install its extra.
|
|
118
|
+
|
|
119
|
+
## How it behaves
|
|
120
|
+
|
|
121
|
+
- **Streaming**: audio frames are yielded while the server is still generating. Output is 16-bit mono PCM at 44.1 kHz, and every frame carries the rate the server declares in its `audio.start` event.
|
|
122
|
+
- **Interruptions**: built on `InterruptibleTTSService`, the base class for websocket TTS services that support neither context IDs nor a cancel message. On interruption the socket is closed, which stops server side generation immediately.
|
|
123
|
+
- **Long text**: the server caps its un-flushed buffer, so an over long utterance is sent as several word boundary segments, each flushed on its own. One generation segment per flush, contiguous audio.
|
|
124
|
+
- **Keepalive**: a flush with nothing buffered is a server side no-op that still resets the idle timeout, so a quiet stretch does not drop the connection.
|
|
125
|
+
- **Turn boundaries**: `audio.done` marks the end of one flushed segment, not the end of the turn. The turn closes when the LLM turn has completed and every segment sent has come back, so a multi sentence reply is never cut short and `BotStoppedSpeakingFrame` still tracks the real end of audio.
|
|
126
|
+
- **Errors**: failures surface as Pipecat `ErrorFrame`s rather than hanging the pipeline. An exhausted credit balance is reported as exactly that.
|
|
127
|
+
|
|
128
|
+
## Tests
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
uv run pytest
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Changelog
|
|
135
|
+
|
|
136
|
+
See [CHANGELOG.md](CHANGELOG.md).
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Chariot Text-to-Speech"
|
|
3
|
+
sidebarTitle: "Chariot"
|
|
4
|
+
description: "ChariotTTSService streams Indian-language and English speech from Chariot's WebSocket API."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { CommunityMaintained } from "/snippets/community-maintained.mdx";
|
|
8
|
+
|
|
9
|
+
<CommunityMaintained
|
|
10
|
+
maintainer="Chariot-AI"
|
|
11
|
+
maintainerUrl="https://github.com/Chariot-AI"
|
|
12
|
+
repo="https://github.com/Chariot-AI/pipecat-chariot"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
`ChariotTTSService` synthesizes speech using [Chariot](https://chariot.in), which
|
|
18
|
+
serves lifelike voices for Indian languages and English.
|
|
19
|
+
|
|
20
|
+
The service keeps one WebSocket open across turns and streams audio as it
|
|
21
|
+
arrives. Any voice speaks any supported language, so the audio follows the text
|
|
22
|
+
rather than the voice, and there is no language parameter to set.
|
|
23
|
+
|
|
24
|
+
<CardGroup cols={2}>
|
|
25
|
+
<Card
|
|
26
|
+
title="Source Repository"
|
|
27
|
+
icon="github"
|
|
28
|
+
href="https://github.com/Chariot-AI/pipecat-chariot"
|
|
29
|
+
>
|
|
30
|
+
Package source, the voice example, and issue tracker
|
|
31
|
+
</Card>
|
|
32
|
+
<Card
|
|
33
|
+
title="PyPI Package"
|
|
34
|
+
icon="cube"
|
|
35
|
+
href="https://pypi.org/project/pipecat-chariot/"
|
|
36
|
+
>
|
|
37
|
+
The `pipecat-chariot` package on PyPI
|
|
38
|
+
</Card>
|
|
39
|
+
<Card title="Chariot" icon="book" href="https://docs.chariot.in/api-reference/introduction">
|
|
40
|
+
API reference, voices, and supported languages
|
|
41
|
+
</Card>
|
|
42
|
+
<Card title="API Keys" icon="key" href="https://platform.chariot.in">
|
|
43
|
+
Create an account and manage your Chariot API keys
|
|
44
|
+
</Card>
|
|
45
|
+
</CardGroup>
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
Install the community package. It is published separately from `pipecat-ai`:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
uv add pipecat-chariot
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Prerequisites
|
|
56
|
+
|
|
57
|
+
### Account and API key
|
|
58
|
+
|
|
59
|
+
1. Create an account at [platform.chariot.in](https://platform.chariot.in). New accounts include free credits.
|
|
60
|
+
2. Copy an API key from the console.
|
|
61
|
+
|
|
62
|
+
Set it in the environment:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
export CHARIOT_API_KEY="your-api-key"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Voices
|
|
69
|
+
|
|
70
|
+
List available voices with `GET https://api.chariot.in/v1/voices`. A voice id is
|
|
71
|
+
optional: without one the service uses a Chariot stock voice, so the example
|
|
72
|
+
runs on the API key alone.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
export CHARIOT_VOICE_ID="your-voice-uuid"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Configuration
|
|
79
|
+
|
|
80
|
+
<ParamField path="api_key" type="str" default="None">
|
|
81
|
+
Chariot API key. If omitted, the service reads `CHARIOT_API_KEY`.
|
|
82
|
+
</ParamField>
|
|
83
|
+
|
|
84
|
+
<ParamField path="voice_id" type="str" default="None">
|
|
85
|
+
Voice UUID from `GET /v1/voices`. `settings.voice` takes precedence. Defaults
|
|
86
|
+
to a Chariot stock voice when neither is given.
|
|
87
|
+
</ParamField>
|
|
88
|
+
|
|
89
|
+
<ParamField path="base_url" type="str" default="wss://api.chariot.in">
|
|
90
|
+
Override this only for a non-production Chariot endpoint.
|
|
91
|
+
</ParamField>
|
|
92
|
+
|
|
93
|
+
<ParamField path="sample_rate" type="int" default="44100">
|
|
94
|
+
Output rate in Hz. Chariot streams 44.1 kHz; the rate declared by the server
|
|
95
|
+
is applied to every audio frame, and a mismatch logs a warning.
|
|
96
|
+
</ParamField>
|
|
97
|
+
|
|
98
|
+
<ParamField path="model" type="str" default="None">
|
|
99
|
+
Chariot TTS model. Leave unset to use your account default, so a newly
|
|
100
|
+
released model works without upgrading the package. `settings.model` takes
|
|
101
|
+
precedence.
|
|
102
|
+
</ParamField>
|
|
103
|
+
|
|
104
|
+
<ParamField path="speed" type="float" default="None">
|
|
105
|
+
Speaking rate from `0.5` to `2.0`, where `1.0` is the voice as recorded.
|
|
106
|
+
Availability is per voice. `settings.speed` takes precedence.
|
|
107
|
+
</ParamField>
|
|
108
|
+
|
|
109
|
+
<ParamField path="optimize_streaming_latency" type="int" default="0">
|
|
110
|
+
Latency optimization level from `0` to `4`. `0` applies all quality passes;
|
|
111
|
+
higher values trade quality passes for lower latency.
|
|
112
|
+
</ParamField>
|
|
113
|
+
|
|
114
|
+
### Settings
|
|
115
|
+
|
|
116
|
+
Pass these through `ChariotTTSService.Settings(...)`. They can also be updated
|
|
117
|
+
while the pipeline is running with `TTSUpdateSettingsFrame`.
|
|
118
|
+
|
|
119
|
+
| Parameter | Type | Default | Description |
|
|
120
|
+
| --------- | ------- | ------------------- | -------------------------------------------- |
|
|
121
|
+
| `voice` | `str` | stock voice | Voice UUID. |
|
|
122
|
+
| `model` | `str` | account default | Chariot TTS model. |
|
|
123
|
+
| `speed` | `float` | voice as recorded | Speaking rate from 0.5 to 2.0. |
|
|
124
|
+
|
|
125
|
+
<Note>
|
|
126
|
+
Voice, model and speed are fixed for the life of a session, because the voice
|
|
127
|
+
codes they select are sent once at connect. Changing any of them reconnects,
|
|
128
|
+
which the service handles for you.
|
|
129
|
+
</Note>
|
|
130
|
+
|
|
131
|
+
<Note>
|
|
132
|
+
There is no language setting. Any Chariot voice speaks any supported language,
|
|
133
|
+
so the language of the audio follows the text you send.
|
|
134
|
+
</Note>
|
|
135
|
+
|
|
136
|
+
## Usage
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
import os
|
|
140
|
+
|
|
141
|
+
from pipecat.pipeline.pipeline import Pipeline
|
|
142
|
+
from pipecat.pipeline.worker import PipelineParams, PipelineWorker
|
|
143
|
+
from pipecat_chariot import ChariotTTSService
|
|
144
|
+
|
|
145
|
+
tts = ChariotTTSService(
|
|
146
|
+
api_key=os.getenv("CHARIOT_API_KEY"),
|
|
147
|
+
settings=ChariotTTSService.Settings(
|
|
148
|
+
voice=os.getenv("CHARIOT_VOICE_ID"),
|
|
149
|
+
),
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
pipeline = Pipeline(
|
|
153
|
+
[
|
|
154
|
+
transport.input(),
|
|
155
|
+
stt,
|
|
156
|
+
context_aggregator.user(),
|
|
157
|
+
llm,
|
|
158
|
+
tts,
|
|
159
|
+
transport.output(),
|
|
160
|
+
context_aggregator.assistant(),
|
|
161
|
+
]
|
|
162
|
+
)
|
|
163
|
+
worker = PipelineWorker(pipeline, params=PipelineParams(allow_interruptions=True))
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Interruptions
|
|
167
|
+
|
|
168
|
+
Chariot's WebSocket API supports neither context IDs nor a cancel message, so the
|
|
169
|
+
service is built on `InterruptibleTTSService`. When the user barges in, the
|
|
170
|
+
socket is closed, which stops server side generation immediately, and the next
|
|
171
|
+
turn reconnects. Nothing needs configuring.
|
|
172
|
+
|
|
173
|
+
## Compatibility
|
|
174
|
+
|
|
175
|
+
Last tested with Pipecat v1.10.0 (`pipecat-ai>=1.7,<2`). See the
|
|
176
|
+
[changelog](https://github.com/Chariot-AI/pipecat-chariot/blob/main/CHANGELOG.md)
|
|
177
|
+
for updates.
|