@framers/agentos-ext-streaming-tts-elevenlabs 0.2.2 → 0.2.3
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.
- package/README.md +61 -0
- package/manifest.json +1 -1
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# ElevenLabs streaming speech synthesis
|
|
2
|
+
|
|
3
|
+
This pack gives an agent a streaming speech synthesis provider using the ElevenLabs WebSocket API through `ws`. It sends text tokens and emits MP3 audio chunks.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @framers/agentos-ext-streaming-tts-elevenlabs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependency: `@framers/agentos` (`>=0.10.40`).
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { AgentOS } from '@framers/agentos';
|
|
17
|
+
|
|
18
|
+
const agentos = await AgentOS.create({
|
|
19
|
+
extensionManifest: {
|
|
20
|
+
packs: [
|
|
21
|
+
{
|
|
22
|
+
package: '@framers/agentos-ext-streaming-tts-elevenlabs',
|
|
23
|
+
options: { voiceId: '21m00Tcm4TlvDq8ikWAM' },
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
extensionSecrets: {
|
|
28
|
+
ELEVENLABS_API_KEY: process.env.ELEVENLABS_API_KEY!,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
Voice settings in `startSession({ providerOptions: ... })` override pack options.
|
|
36
|
+
|
|
37
|
+
| Option | Secret id | Environment variable | Required | Default |
|
|
38
|
+
| --- | --- | --- | --- | --- |
|
|
39
|
+
| `apiKey` (provider config; options spread also accepts it at runtime) | `ELEVENLABS_API_KEY` | None | Yes, provider interface | Empty string in pack factory |
|
|
40
|
+
| `voiceId` | None | None | No | `'21m00Tcm4TlvDq8ikWAM'` |
|
|
41
|
+
| `modelId` | None | None | No | `'eleven_turbo_v2'` |
|
|
42
|
+
| `stability` | None | None | No | `0.5` |
|
|
43
|
+
| `similarityBoost` | None | None | No | `0.75` |
|
|
44
|
+
| `style` | None | None | No | `0.0` |
|
|
45
|
+
| `useSpeakerBoost` | None | None | No | `true` |
|
|
46
|
+
|
|
47
|
+
## Notes
|
|
48
|
+
|
|
49
|
+
The pack registers an enabled `streaming-tts-provider` with provider id `elevenlabs-streaming-tts`. `createElevenLabsStreamingTTS` also creates a standalone provider from an API key and optional voice settings.
|
|
50
|
+
|
|
51
|
+
`startSession` opens a WebSocket to ElevenLabs. On opening, it sends the API key and voice settings, then drains queued messages. `pushTokens` sends text and also sends the accumulated segment with `flush: true` when sentence punctuation arrives. `flush` sends remaining text and an empty end-of-stream message; it resolves when messages are queued, without waiting for audio completion.
|
|
52
|
+
|
|
53
|
+
Binary messages emit `audio_chunk` with MP3 bytes and empty associated text. A JSON `isFinal` message emits `utterance_complete`. Duration fields are estimates from the pending text rather than measurements of the audio. Other JSON messages, including alignment data, are ignored.
|
|
54
|
+
|
|
55
|
+
`cancel` closes the socket and emits `cancelled` with pending text. `close` closes the socket and emits `close`. The generic session `language` field is not forwarded. No reconnect or explicit timeout is implemented.
|
|
56
|
+
|
|
57
|
+
The factory uses an empty key when the secret is absent, unless the runtime options spread overrides `apiKey`. It does not validate credentials or read environment variables.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
Apache-2.0
|
package/manifest.json
CHANGED
package/package.json
CHANGED