@unboundcx/sdk 4.13.101 → 4.13.102
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 +2 -0
- package/package.json +1 -1
- package/services/ai/tts.js +26 -2
package/README.md
CHANGED
|
@@ -377,6 +377,8 @@ const audio = await api.ai.tts.create({
|
|
|
377
377
|
text: 'Hello, this is a test message',
|
|
378
378
|
voice: 'en-US-Standard-A',
|
|
379
379
|
audioEncoding: 'MP3',
|
|
380
|
+
// optional, telemetry-only attribution — never affects caching/output:
|
|
381
|
+
// taskId, sipCallId, botId
|
|
380
382
|
});
|
|
381
383
|
|
|
382
384
|
// Speech-to-Text - File/Storage Transcription
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.102",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
package/services/ai/tts.js
CHANGED
|
@@ -25,6 +25,9 @@ export class TextToSpeechService {
|
|
|
25
25
|
* @param {number} [params.volumeGainDb]
|
|
26
26
|
* @param {string[]} [params.effectsProfileIds]
|
|
27
27
|
* @param {boolean} [params.createAccessKey]
|
|
28
|
+
* @param {string} [params.taskId] Telemetry-only attribution; never affects caching/output.
|
|
29
|
+
* @param {string} [params.sipCallId] Telemetry-only attribution; never affects caching/output.
|
|
30
|
+
* @param {string} [params.botId] Telemetry-only attribution; never affects caching/output.
|
|
28
31
|
* @returns {Promise<Object>} `{ id, storageId, url? }`
|
|
29
32
|
*/
|
|
30
33
|
async create({
|
|
@@ -38,6 +41,9 @@ export class TextToSpeechService {
|
|
|
38
41
|
volumeGainDb,
|
|
39
42
|
effectsProfileIds,
|
|
40
43
|
createAccessKey,
|
|
44
|
+
taskId,
|
|
45
|
+
sipCallId,
|
|
46
|
+
botId,
|
|
41
47
|
}) {
|
|
42
48
|
this.sdk.validateParams(
|
|
43
49
|
{
|
|
@@ -51,6 +57,9 @@ export class TextToSpeechService {
|
|
|
51
57
|
volumeGainDb,
|
|
52
58
|
effectsProfileIds,
|
|
53
59
|
createAccessKey,
|
|
60
|
+
taskId,
|
|
61
|
+
sipCallId,
|
|
62
|
+
botId,
|
|
54
63
|
},
|
|
55
64
|
{
|
|
56
65
|
text: { type: 'string', required: true },
|
|
@@ -63,6 +72,9 @@ export class TextToSpeechService {
|
|
|
63
72
|
volumeGainDb: { type: 'number', required: false },
|
|
64
73
|
effectsProfileIds: { type: 'array', required: false },
|
|
65
74
|
createAccessKey: { type: 'boolean', required: false },
|
|
75
|
+
taskId: { type: 'string', required: false },
|
|
76
|
+
sipCallId: { type: 'string', required: false },
|
|
77
|
+
botId: { type: 'string', required: false },
|
|
66
78
|
},
|
|
67
79
|
);
|
|
68
80
|
|
|
@@ -76,6 +88,9 @@ export class TextToSpeechService {
|
|
|
76
88
|
if (volumeGainDb) ttsData.volumeGainDb = volumeGainDb;
|
|
77
89
|
if (effectsProfileIds) ttsData.effectsProfileIds = effectsProfileIds;
|
|
78
90
|
if (createAccessKey) ttsData.createAccessKey = createAccessKey;
|
|
91
|
+
if (taskId !== undefined) ttsData.taskId = taskId;
|
|
92
|
+
if (sipCallId !== undefined) ttsData.sipCallId = sipCallId;
|
|
93
|
+
if (botId !== undefined) ttsData.botId = botId;
|
|
79
94
|
|
|
80
95
|
const params = {
|
|
81
96
|
body: ttsData,
|
|
@@ -112,25 +127,34 @@ export class TextToSpeechService {
|
|
|
112
127
|
* @param {string} params.text
|
|
113
128
|
* @param {string} [params.voice]
|
|
114
129
|
* @param {string} [params.languageCode]
|
|
130
|
+
* @param {string} [params.taskId] Telemetry-only attribution; never affects caching/output.
|
|
131
|
+
* @param {string} [params.sipCallId] Telemetry-only attribution; never affects caching/output.
|
|
132
|
+
* @param {string} [params.botId] Telemetry-only attribution; never affects caching/output.
|
|
115
133
|
* @returns {Promise<{body: ReadableStream, headers: Headers, status: number}>}
|
|
116
134
|
* @example
|
|
117
135
|
* const result = await sdk.ai.tts.stream({ text: 'Hi there', voice: 'hannah' });
|
|
118
136
|
* const nodeStream = Readable.fromWeb(result.body);
|
|
119
137
|
* nodeStream.pipe(ffmpegProcess.stdin);
|
|
120
138
|
*/
|
|
121
|
-
async stream({ text, voice, languageCode }) {
|
|
139
|
+
async stream({ text, voice, languageCode, taskId, sipCallId, botId }) {
|
|
122
140
|
this.sdk.validateParams(
|
|
123
|
-
{ text, voice, languageCode },
|
|
141
|
+
{ text, voice, languageCode, taskId, sipCallId, botId },
|
|
124
142
|
{
|
|
125
143
|
text: { type: 'string', required: true },
|
|
126
144
|
voice: { type: 'string', required: false },
|
|
127
145
|
languageCode: { type: 'string', required: false },
|
|
146
|
+
taskId: { type: 'string', required: false },
|
|
147
|
+
sipCallId: { type: 'string', required: false },
|
|
148
|
+
botId: { type: 'string', required: false },
|
|
128
149
|
},
|
|
129
150
|
);
|
|
130
151
|
|
|
131
152
|
const ttsData = { text };
|
|
132
153
|
if (voice) ttsData.voice = voice;
|
|
133
154
|
if (languageCode) ttsData.languageCode = languageCode;
|
|
155
|
+
if (taskId !== undefined) ttsData.taskId = taskId;
|
|
156
|
+
if (sipCallId !== undefined) ttsData.sipCallId = sipCallId;
|
|
157
|
+
if (botId !== undefined) ttsData.botId = botId;
|
|
134
158
|
|
|
135
159
|
const params = {
|
|
136
160
|
body: ttsData,
|