@unboundcx/sdk 4.13.101 → 4.13.103
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 +5 -0
- package/package.json +1 -1
- package/services/ai/tts.js +26 -2
- package/services/ai.js +8 -0
package/README.md
CHANGED
|
@@ -370,6 +370,9 @@ const response = await api.ai.generative.chat({
|
|
|
370
370
|
model: 'gpt-4',
|
|
371
371
|
temperature: 0.7,
|
|
372
372
|
method: 'openai',
|
|
373
|
+
// optional, telemetry-only attribution — never affects the prompt,
|
|
374
|
+
// session, caching, or response (contracts §9):
|
|
375
|
+
// usageContext: { feature: 'sentiment', taskId, sipCallId, queueId, cdrId }
|
|
373
376
|
});
|
|
374
377
|
|
|
375
378
|
// Text-to-Speech
|
|
@@ -377,6 +380,8 @@ const audio = await api.ai.tts.create({
|
|
|
377
380
|
text: 'Hello, this is a test message',
|
|
378
381
|
voice: 'en-US-Standard-A',
|
|
379
382
|
audioEncoding: 'MP3',
|
|
383
|
+
// optional, telemetry-only attribution — never affects caching/output:
|
|
384
|
+
// taskId, sipCallId, botId
|
|
380
385
|
});
|
|
381
386
|
|
|
382
387
|
// 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.103",
|
|
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,
|
package/services/ai.js
CHANGED
|
@@ -85,6 +85,7 @@ export class GenerativeService {
|
|
|
85
85
|
meta,
|
|
86
86
|
qualityCheck,
|
|
87
87
|
isPublic,
|
|
88
|
+
usageContext,
|
|
88
89
|
}) {
|
|
89
90
|
this.sdk.validateParams(
|
|
90
91
|
{
|
|
@@ -112,6 +113,7 @@ export class GenerativeService {
|
|
|
112
113
|
meta,
|
|
113
114
|
qualityCheck,
|
|
114
115
|
isPublic,
|
|
116
|
+
usageContext,
|
|
115
117
|
},
|
|
116
118
|
{
|
|
117
119
|
prompt: { type: 'string', required: false },
|
|
@@ -138,6 +140,9 @@ export class GenerativeService {
|
|
|
138
140
|
meta: { type: 'object', required: false },
|
|
139
141
|
qualityCheck: { type: 'boolean', required: false },
|
|
140
142
|
isPublic: { type: 'boolean', required: false },
|
|
143
|
+
// Telemetry-only (contracts §9): { feature?, taskId?, sipCallId?,
|
|
144
|
+
// queueId?, cdrId? } -- never affects the prompt/session/cache/response.
|
|
145
|
+
usageContext: { type: 'object', required: false },
|
|
141
146
|
},
|
|
142
147
|
);
|
|
143
148
|
|
|
@@ -168,6 +173,9 @@ export class GenerativeService {
|
|
|
168
173
|
meta,
|
|
169
174
|
qualityCheck,
|
|
170
175
|
isPublic,
|
|
176
|
+
// Only included when the caller actually passed one -- keeps the
|
|
177
|
+
// wire payload identical to today for every existing caller.
|
|
178
|
+
...(usageContext !== undefined ? { usageContext } : {}),
|
|
171
179
|
},
|
|
172
180
|
// Return raw response for streaming to allow client-side stream handling
|
|
173
181
|
returnRawResponse: stream === true,
|