@15gifts/sdk 0.1.0 → 0.2.0
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/dist/index.d.mts +443 -33
- package/dist/index.d.ts +443 -33
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,23 @@ import { Client as Client$1 } from 'openapi-fetch';
|
|
|
5
5
|
* Do not make direct changes to the file.
|
|
6
6
|
*/
|
|
7
7
|
interface paths$1 {
|
|
8
|
+
'/api/conversation/v2': {
|
|
9
|
+
parameters: {
|
|
10
|
+
query?: never;
|
|
11
|
+
header?: never;
|
|
12
|
+
path?: never;
|
|
13
|
+
cookie?: never;
|
|
14
|
+
};
|
|
15
|
+
get?: never;
|
|
16
|
+
put?: never;
|
|
17
|
+
/** Generate Conversation Json Response */
|
|
18
|
+
post: operations['generate_conversation_json_response_api_conversation_v2_post'];
|
|
19
|
+
delete?: never;
|
|
20
|
+
options?: never;
|
|
21
|
+
head?: never;
|
|
22
|
+
patch?: never;
|
|
23
|
+
trace?: never;
|
|
24
|
+
};
|
|
8
25
|
'/api/v1/conversation/': {
|
|
9
26
|
parameters: {
|
|
10
27
|
query?: never;
|
|
@@ -15,15 +32,10 @@ interface paths$1 {
|
|
|
15
32
|
get?: never;
|
|
16
33
|
put?: never;
|
|
17
34
|
/**
|
|
18
|
-
* Generate Conversation Response
|
|
19
|
-
* @
|
|
20
|
-
* The opening message should be the message that is displayed to the user when the engine is first opened, this is currently generated by the frontend,
|
|
21
|
-
* this message forms part of the conversation history, not that if the conversation id is not null then the opening message is ignored.
|
|
22
|
-
*
|
|
23
|
-
* This endpoint meets the contract that is outlined in
|
|
24
|
-
* [here](https://15gifts.atlassian.net/wiki/spaces/AI/pages/4319346722/Contracts+between+Conversation+Speech+Bowser+and+User+Experience+Admin+Rayman+teams).
|
|
35
|
+
* Generate Conversation Streaming Response
|
|
36
|
+
* @deprecated
|
|
25
37
|
*/
|
|
26
|
-
post: operations['
|
|
38
|
+
post: operations['generate_conversation_streaming_response_api_v1_conversation__post'];
|
|
27
39
|
delete?: never;
|
|
28
40
|
options?: never;
|
|
29
41
|
head?: never;
|
|
@@ -33,6 +45,73 @@ interface paths$1 {
|
|
|
33
45
|
}
|
|
34
46
|
interface components {
|
|
35
47
|
schemas: {
|
|
48
|
+
/** ActionsMatchedByTriggeredBranchesRecord */
|
|
49
|
+
ActionsMatchedByTriggeredBranchesRecord: {
|
|
50
|
+
/**
|
|
51
|
+
* Id
|
|
52
|
+
* @default actions_matched_by_triggered_branches
|
|
53
|
+
* @constant
|
|
54
|
+
* @enum {string}
|
|
55
|
+
*/
|
|
56
|
+
id: 'actions_matched_by_triggered_branches';
|
|
57
|
+
/**
|
|
58
|
+
* Timestamp
|
|
59
|
+
* Format: date-time
|
|
60
|
+
*/
|
|
61
|
+
timestamp?: string;
|
|
62
|
+
/** Data */
|
|
63
|
+
data: [string, string[]][];
|
|
64
|
+
};
|
|
65
|
+
/** ApplicationVersionRecord */
|
|
66
|
+
ApplicationVersionRecord: {
|
|
67
|
+
/**
|
|
68
|
+
* Id
|
|
69
|
+
* @default application_version
|
|
70
|
+
* @constant
|
|
71
|
+
* @enum {string}
|
|
72
|
+
*/
|
|
73
|
+
id: 'application_version';
|
|
74
|
+
/**
|
|
75
|
+
* Timestamp
|
|
76
|
+
* Format: date-time
|
|
77
|
+
*/
|
|
78
|
+
timestamp?: string;
|
|
79
|
+
/** Data */
|
|
80
|
+
data: string;
|
|
81
|
+
};
|
|
82
|
+
/** ContextChunksRecord */
|
|
83
|
+
ContextChunksRecord: {
|
|
84
|
+
/**
|
|
85
|
+
* Id
|
|
86
|
+
* @default context_chunks
|
|
87
|
+
* @constant
|
|
88
|
+
* @enum {string}
|
|
89
|
+
*/
|
|
90
|
+
id: 'context_chunks';
|
|
91
|
+
/**
|
|
92
|
+
* Timestamp
|
|
93
|
+
* Format: date-time
|
|
94
|
+
*/
|
|
95
|
+
timestamp?: string;
|
|
96
|
+
/** Data */
|
|
97
|
+
data: components['schemas']['ProductInformationChunkQueryResult'][];
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* ConversationHistoryRequest
|
|
101
|
+
* @description A request to retrieve the conversation history
|
|
102
|
+
*/
|
|
103
|
+
ConversationHistoryRequest: {
|
|
104
|
+
/**
|
|
105
|
+
* Start Date
|
|
106
|
+
* @description The start date of the conversation history in YYYY-MM-DD HH:MM:SS format
|
|
107
|
+
*/
|
|
108
|
+
start_date: string;
|
|
109
|
+
/**
|
|
110
|
+
* End Date
|
|
111
|
+
* @description The end date of the conversation history in YYYY-MM-DD HH:MM:SS format
|
|
112
|
+
*/
|
|
113
|
+
end_date: string | null;
|
|
114
|
+
};
|
|
36
115
|
/** ConversationRequest */
|
|
37
116
|
ConversationRequest: {
|
|
38
117
|
/**
|
|
@@ -67,11 +146,252 @@ interface components {
|
|
|
67
146
|
*/
|
|
68
147
|
sessionId: string;
|
|
69
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* ConversationResponseDebugChunk
|
|
151
|
+
* @description Model for the debug chunk returned in the streaming response by the conversation endpoint.
|
|
152
|
+
*/
|
|
153
|
+
ConversationResponseDebugChunk: {
|
|
154
|
+
/**
|
|
155
|
+
* Type
|
|
156
|
+
* @default DEBUG
|
|
157
|
+
* @constant
|
|
158
|
+
* @enum {string}
|
|
159
|
+
*/
|
|
160
|
+
type: 'DEBUG';
|
|
161
|
+
/**
|
|
162
|
+
* Conversationid
|
|
163
|
+
* Format: uuid
|
|
164
|
+
* @description Unique identifier for the conversation. If an id is given in the request, the same id is returned in the response.
|
|
165
|
+
*/
|
|
166
|
+
conversationId: string;
|
|
167
|
+
/**
|
|
168
|
+
* Records
|
|
169
|
+
* @description List of debug records.
|
|
170
|
+
*/
|
|
171
|
+
records: (components['schemas']['EmbeddingTokenCountRecord'] | components['schemas']['SystemPromptRecord'] | components['schemas']['TriggeredBranchesRecord'] | components['schemas']['ActionsMatchedByTriggeredBranchesRecord'] | components['schemas']['RunActionDetailsRecord'] | components['schemas']['MaxCosineSimilarityScoresRecord'] | components['schemas']['LLMTokenCountRecord'] | components['schemas']['ContextChunksRecord'] | components['schemas']['ApplicationVersionRecord'] | components['schemas']['DBVersionRecord'] | components['schemas']['PhraseTokenProbabilitiesRecord'] | components['schemas']['ConversationTurnIDRecord'])[];
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* ConversationResponseMessageChunk
|
|
175
|
+
* @description Model for the message chunk returned in the streaming response by the conversation endpoint.
|
|
176
|
+
*/
|
|
177
|
+
ConversationResponseMessageChunk: {
|
|
178
|
+
/**
|
|
179
|
+
* Type
|
|
180
|
+
* @default MESSAGE
|
|
181
|
+
* @constant
|
|
182
|
+
* @enum {string}
|
|
183
|
+
*/
|
|
184
|
+
type: 'MESSAGE';
|
|
185
|
+
/**
|
|
186
|
+
* Conversationid
|
|
187
|
+
* Format: uuid
|
|
188
|
+
* @description Unique identifier for the conversation. If an id is given in the request, the same id is returned in the response.
|
|
189
|
+
*/
|
|
190
|
+
conversationId: string;
|
|
191
|
+
/**
|
|
192
|
+
* Message
|
|
193
|
+
* @description Message for the conversation.
|
|
194
|
+
*/
|
|
195
|
+
message: string;
|
|
196
|
+
};
|
|
197
|
+
/** ConversationTurnIDRecord */
|
|
198
|
+
ConversationTurnIDRecord: {
|
|
199
|
+
/**
|
|
200
|
+
* Id
|
|
201
|
+
* @default conversation_turn_id
|
|
202
|
+
* @constant
|
|
203
|
+
* @enum {string}
|
|
204
|
+
*/
|
|
205
|
+
id: 'conversation_turn_id';
|
|
206
|
+
/**
|
|
207
|
+
* Timestamp
|
|
208
|
+
* Format: date-time
|
|
209
|
+
*/
|
|
210
|
+
timestamp?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Conversation Turn Id
|
|
213
|
+
* Format: uuid
|
|
214
|
+
*/
|
|
215
|
+
conversation_turn_id: string;
|
|
216
|
+
};
|
|
217
|
+
/** DBVersionRecord */
|
|
218
|
+
DBVersionRecord: {
|
|
219
|
+
/**
|
|
220
|
+
* Id
|
|
221
|
+
* @default db_version
|
|
222
|
+
* @constant
|
|
223
|
+
* @enum {string}
|
|
224
|
+
*/
|
|
225
|
+
id: 'db_version';
|
|
226
|
+
/**
|
|
227
|
+
* Timestamp
|
|
228
|
+
* Format: date-time
|
|
229
|
+
*/
|
|
230
|
+
timestamp?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Db Version
|
|
233
|
+
* Format: uuid
|
|
234
|
+
*/
|
|
235
|
+
db_version: string;
|
|
236
|
+
};
|
|
237
|
+
/** EmbeddingTokenCountRecord */
|
|
238
|
+
EmbeddingTokenCountRecord: {
|
|
239
|
+
/**
|
|
240
|
+
* Id
|
|
241
|
+
* @default embedding_token_count
|
|
242
|
+
* @constant
|
|
243
|
+
* @enum {string}
|
|
244
|
+
*/
|
|
245
|
+
id: 'embedding_token_count';
|
|
246
|
+
/**
|
|
247
|
+
* Timestamp
|
|
248
|
+
* Format: date-time
|
|
249
|
+
*/
|
|
250
|
+
timestamp?: string;
|
|
251
|
+
data: components['schemas']['app__debug_stash__types__EmbeddingTokenCountRecord__Data'];
|
|
252
|
+
};
|
|
70
253
|
/** HTTPValidationError */
|
|
71
254
|
HTTPValidationError: {
|
|
72
255
|
/** Detail */
|
|
73
256
|
detail?: components['schemas']['ValidationError'][];
|
|
74
257
|
};
|
|
258
|
+
/**
|
|
259
|
+
* IndustryEnum
|
|
260
|
+
* @constant
|
|
261
|
+
* @enum {string}
|
|
262
|
+
*/
|
|
263
|
+
IndustryEnum: 'telco';
|
|
264
|
+
/** LLMTokenCountRecord */
|
|
265
|
+
LLMTokenCountRecord: {
|
|
266
|
+
/**
|
|
267
|
+
* Id
|
|
268
|
+
* @default llm_token_count
|
|
269
|
+
* @constant
|
|
270
|
+
* @enum {string}
|
|
271
|
+
*/
|
|
272
|
+
id: 'llm_token_count';
|
|
273
|
+
/**
|
|
274
|
+
* Timestamp
|
|
275
|
+
* Format: date-time
|
|
276
|
+
*/
|
|
277
|
+
timestamp?: string;
|
|
278
|
+
data: components['schemas']['app__debug_stash__types__LLMTokenCountRecord__Data'];
|
|
279
|
+
};
|
|
280
|
+
/** MaxCosineSimilarityScoresRecord */
|
|
281
|
+
MaxCosineSimilarityScoresRecord: {
|
|
282
|
+
/**
|
|
283
|
+
* Id
|
|
284
|
+
* @default max_cosine_similarity_scores
|
|
285
|
+
* @constant
|
|
286
|
+
* @enum {string}
|
|
287
|
+
*/
|
|
288
|
+
id: 'max_cosine_similarity_scores';
|
|
289
|
+
/**
|
|
290
|
+
* Timestamp
|
|
291
|
+
* Format: date-time
|
|
292
|
+
*/
|
|
293
|
+
timestamp?: string;
|
|
294
|
+
/** Data */
|
|
295
|
+
data: {
|
|
296
|
+
[key: string]: number;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
/** PhraseTokenProbabilitiesRecord */
|
|
300
|
+
PhraseTokenProbabilitiesRecord: {
|
|
301
|
+
/**
|
|
302
|
+
* Id
|
|
303
|
+
* @default phrase_token_probabilities
|
|
304
|
+
* @constant
|
|
305
|
+
* @enum {string}
|
|
306
|
+
*/
|
|
307
|
+
id: 'phrase_token_probabilities';
|
|
308
|
+
/**
|
|
309
|
+
* Timestamp
|
|
310
|
+
* Format: date-time
|
|
311
|
+
*/
|
|
312
|
+
timestamp?: string;
|
|
313
|
+
/** Phrase Token Probabilities */
|
|
314
|
+
phrase_token_probabilities: components['schemas']['RootModel_list_TokenProbabilityRecord__'][];
|
|
315
|
+
};
|
|
316
|
+
/** ProductInformationChunkMetadata */
|
|
317
|
+
ProductInformationChunkMetadata: {
|
|
318
|
+
/** Model */
|
|
319
|
+
model: string;
|
|
320
|
+
/** Brand */
|
|
321
|
+
brand: string;
|
|
322
|
+
};
|
|
323
|
+
/** ProductInformationChunkQueryResult */
|
|
324
|
+
ProductInformationChunkQueryResult: {
|
|
325
|
+
/** Text */
|
|
326
|
+
text: string;
|
|
327
|
+
/** Customer Id */
|
|
328
|
+
customer_id: string;
|
|
329
|
+
metadata: components['schemas']['ProductInformationChunkMetadata'];
|
|
330
|
+
industry: components['schemas']['IndustryEnum'];
|
|
331
|
+
/** Similarity Score */
|
|
332
|
+
similarity_score: number;
|
|
333
|
+
};
|
|
334
|
+
/** RootModel[list[TokenProbabilityRecord]] */
|
|
335
|
+
RootModel_list_TokenProbabilityRecord__: components['schemas']['TokenProbabilityRecord'][];
|
|
336
|
+
/** RunActionDetailsRecord */
|
|
337
|
+
RunActionDetailsRecord: {
|
|
338
|
+
/**
|
|
339
|
+
* Id
|
|
340
|
+
* @default run_action_details
|
|
341
|
+
* @constant
|
|
342
|
+
* @enum {string}
|
|
343
|
+
*/
|
|
344
|
+
id: 'run_action_details';
|
|
345
|
+
/**
|
|
346
|
+
* Timestamp
|
|
347
|
+
* Format: date-time
|
|
348
|
+
*/
|
|
349
|
+
timestamp?: string;
|
|
350
|
+
data: components['schemas']['app__debug_stash__types__RunActionDetailsRecord__Data'];
|
|
351
|
+
};
|
|
352
|
+
/** SystemPromptRecord */
|
|
353
|
+
SystemPromptRecord: {
|
|
354
|
+
/**
|
|
355
|
+
* Id
|
|
356
|
+
* @default system_prompt
|
|
357
|
+
* @constant
|
|
358
|
+
* @enum {string}
|
|
359
|
+
*/
|
|
360
|
+
id: 'system_prompt';
|
|
361
|
+
/**
|
|
362
|
+
* Timestamp
|
|
363
|
+
* Format: date-time
|
|
364
|
+
*/
|
|
365
|
+
timestamp?: string;
|
|
366
|
+
/** Data */
|
|
367
|
+
data: string;
|
|
368
|
+
};
|
|
369
|
+
/** TokenProbabilityRecord */
|
|
370
|
+
TokenProbabilityRecord: {
|
|
371
|
+
/** Token */
|
|
372
|
+
token: string;
|
|
373
|
+
/** Probability */
|
|
374
|
+
probability: number;
|
|
375
|
+
/** Log Probability */
|
|
376
|
+
log_probability: number;
|
|
377
|
+
};
|
|
378
|
+
/** TriggeredBranchesRecord */
|
|
379
|
+
TriggeredBranchesRecord: {
|
|
380
|
+
/**
|
|
381
|
+
* Id
|
|
382
|
+
* @default triggered_branches
|
|
383
|
+
* @constant
|
|
384
|
+
* @enum {string}
|
|
385
|
+
*/
|
|
386
|
+
id: 'triggered_branches';
|
|
387
|
+
/**
|
|
388
|
+
* Timestamp
|
|
389
|
+
* Format: date-time
|
|
390
|
+
*/
|
|
391
|
+
timestamp?: string;
|
|
392
|
+
/** Data */
|
|
393
|
+
data: string[];
|
|
394
|
+
};
|
|
75
395
|
/** ValidationError */
|
|
76
396
|
ValidationError: {
|
|
77
397
|
/** Location */
|
|
@@ -81,6 +401,35 @@ interface components {
|
|
|
81
401
|
/** Error Type */
|
|
82
402
|
type: string;
|
|
83
403
|
};
|
|
404
|
+
/** Data */
|
|
405
|
+
app__debug_stash__types__EmbeddingTokenCountRecord__Data: {
|
|
406
|
+
/** Token Count */
|
|
407
|
+
token_count: number;
|
|
408
|
+
/** Model */
|
|
409
|
+
model: string;
|
|
410
|
+
/** Embedded Text */
|
|
411
|
+
embedded_text: string;
|
|
412
|
+
};
|
|
413
|
+
/** Data */
|
|
414
|
+
app__debug_stash__types__LLMTokenCountRecord__Data: {
|
|
415
|
+
/** Input Token Count */
|
|
416
|
+
input_token_count: number;
|
|
417
|
+
/** Output Token Count */
|
|
418
|
+
output_token_count: number;
|
|
419
|
+
/** Response Text */
|
|
420
|
+
response_text: string;
|
|
421
|
+
/** Input Messages */
|
|
422
|
+
input_messages: string;
|
|
423
|
+
/** Model */
|
|
424
|
+
model: string;
|
|
425
|
+
};
|
|
426
|
+
/** Data */
|
|
427
|
+
app__debug_stash__types__RunActionDetailsRecord__Data: {
|
|
428
|
+
/** Action Type */
|
|
429
|
+
action_type: string;
|
|
430
|
+
/** Branch Type */
|
|
431
|
+
branch_type: string;
|
|
432
|
+
};
|
|
84
433
|
};
|
|
85
434
|
responses: never;
|
|
86
435
|
parameters: never;
|
|
@@ -89,7 +438,52 @@ interface components {
|
|
|
89
438
|
pathItems: never;
|
|
90
439
|
}
|
|
91
440
|
interface operations {
|
|
92
|
-
|
|
441
|
+
generate_conversation_json_response_api_conversation_v2_post: {
|
|
442
|
+
parameters: {
|
|
443
|
+
query?: never;
|
|
444
|
+
header?: {
|
|
445
|
+
'user-agent'?: string;
|
|
446
|
+
/**
|
|
447
|
+
* @description Comma-separated list of feature flags (flags might require elevated permissions)
|
|
448
|
+
* @example debug,no-decision-forest
|
|
449
|
+
*/
|
|
450
|
+
'x-feature-flags'?: string | null;
|
|
451
|
+
/**
|
|
452
|
+
* @description the version of the sdk version that is being used
|
|
453
|
+
* @example 1.0.0
|
|
454
|
+
*/
|
|
455
|
+
'x-sdk-version'?: string | null;
|
|
456
|
+
};
|
|
457
|
+
path?: never;
|
|
458
|
+
cookie?: never;
|
|
459
|
+
};
|
|
460
|
+
requestBody: {
|
|
461
|
+
content: {
|
|
462
|
+
'application/json': components['schemas']['ConversationRequest'];
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
responses: {
|
|
466
|
+
/** @description A successful response from the conversation service */
|
|
467
|
+
200: {
|
|
468
|
+
headers: {
|
|
469
|
+
[name: string]: unknown;
|
|
470
|
+
};
|
|
471
|
+
content: {
|
|
472
|
+
'application/json': components['schemas']['ConversationResponseMessageChunk'] | components['schemas']['ConversationResponseDebugChunk'];
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
/** @description Validation Error */
|
|
476
|
+
422: {
|
|
477
|
+
headers: {
|
|
478
|
+
[name: string]: unknown;
|
|
479
|
+
};
|
|
480
|
+
content: {
|
|
481
|
+
'application/json': components['schemas']['HTTPValidationError'];
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
generate_conversation_streaming_response_api_v1_conversation__post: {
|
|
93
487
|
parameters: {
|
|
94
488
|
query?: never;
|
|
95
489
|
header?: {
|
|
@@ -99,6 +493,11 @@ interface operations {
|
|
|
99
493
|
* @example debug,no-decision-forest
|
|
100
494
|
*/
|
|
101
495
|
'x-feature-flags'?: string | null;
|
|
496
|
+
/**
|
|
497
|
+
* @description The version of the SDK version that is being used
|
|
498
|
+
* @example 1.0.0
|
|
499
|
+
*/
|
|
500
|
+
'x-sdk-version'?: string | null;
|
|
102
501
|
};
|
|
103
502
|
path?: never;
|
|
104
503
|
cookie?: never;
|
|
@@ -579,7 +978,9 @@ interface paths {
|
|
|
579
978
|
};
|
|
580
979
|
}
|
|
581
980
|
|
|
582
|
-
type
|
|
981
|
+
type ConversationApiRequest = components['schemas']['ConversationRequest'];
|
|
982
|
+
type ApiMessage = components['schemas']['ConversationResponseMessageChunk'];
|
|
983
|
+
type ApiDebug = components['schemas']['ConversationResponseDebugChunk'];
|
|
583
984
|
/**
|
|
584
985
|
* Configuration options for initializing the client.
|
|
585
986
|
*/
|
|
@@ -587,7 +988,7 @@ interface Config {
|
|
|
587
988
|
/**
|
|
588
989
|
* The customer ID associated with the conversation.
|
|
589
990
|
*/
|
|
590
|
-
customerId:
|
|
991
|
+
customerId: ConversationApiRequest['customerId'];
|
|
591
992
|
/**
|
|
592
993
|
* Optional fetch function to use for making HTTP requests.
|
|
593
994
|
* If not provided, the default `fetch` implementation will be used.
|
|
@@ -622,19 +1023,19 @@ interface Identity {
|
|
|
622
1023
|
/**
|
|
623
1024
|
* The customer ID.
|
|
624
1025
|
*/
|
|
625
|
-
customerId:
|
|
1026
|
+
customerId: ConversationApiRequest['customerId'];
|
|
626
1027
|
/**
|
|
627
1028
|
* The conversation ID.
|
|
628
1029
|
*/
|
|
629
|
-
conversationId:
|
|
1030
|
+
conversationId: ConversationApiRequest['conversationId'];
|
|
630
1031
|
/**
|
|
631
1032
|
* The session ID associated with the user.
|
|
632
1033
|
*/
|
|
633
|
-
sessionId:
|
|
1034
|
+
sessionId: ConversationApiRequest['sessionId'];
|
|
634
1035
|
/**
|
|
635
1036
|
* The user ID.
|
|
636
1037
|
*/
|
|
637
|
-
userId:
|
|
1038
|
+
userId: ConversationApiRequest['userId'];
|
|
638
1039
|
}
|
|
639
1040
|
/**
|
|
640
1041
|
* Message within a conversation.
|
|
@@ -643,19 +1044,29 @@ interface Message {
|
|
|
643
1044
|
/**
|
|
644
1045
|
* The conversation ID to which the message belongs.
|
|
645
1046
|
*/
|
|
646
|
-
conversationId:
|
|
1047
|
+
conversationId: ApiMessage['conversationId'];
|
|
647
1048
|
/**
|
|
648
|
-
*
|
|
1049
|
+
* The message content.
|
|
649
1050
|
*/
|
|
650
|
-
|
|
1051
|
+
message: ApiMessage['message'];
|
|
651
1052
|
/**
|
|
652
|
-
* The message
|
|
1053
|
+
* The message type.
|
|
1054
|
+
*/
|
|
1055
|
+
type: ApiMessage['type'];
|
|
1056
|
+
}
|
|
1057
|
+
interface DebugResponse {
|
|
1058
|
+
/**
|
|
1059
|
+
* The conversation ID to which the message belongs.
|
|
1060
|
+
*/
|
|
1061
|
+
conversationId: ApiDebug['conversationId'];
|
|
1062
|
+
/**
|
|
1063
|
+
* The debug records.
|
|
653
1064
|
*/
|
|
654
|
-
|
|
1065
|
+
records: ApiDebug['records'];
|
|
655
1066
|
/**
|
|
656
1067
|
* The message type.
|
|
657
1068
|
*/
|
|
658
|
-
type:
|
|
1069
|
+
type: ApiDebug['type'];
|
|
659
1070
|
}
|
|
660
1071
|
|
|
661
1072
|
/**
|
|
@@ -668,7 +1079,7 @@ declare class Client {
|
|
|
668
1079
|
* @example
|
|
669
1080
|
* ```ts
|
|
670
1081
|
* const client = new Client({ customerId: 'YOUR_CUSTOMER_ID' })
|
|
671
|
-
* const { data } = await client.endpoint.conversation.
|
|
1082
|
+
* const { data } = await client.endpoint.conversation.POST('/api/conversation/v2')
|
|
672
1083
|
* ```
|
|
673
1084
|
*/
|
|
674
1085
|
endpoint: Endpoint;
|
|
@@ -713,28 +1124,27 @@ declare class Client {
|
|
|
713
1124
|
* Sends a message in the conversation, optionally with an opening message.
|
|
714
1125
|
*
|
|
715
1126
|
* @param options - An object containing the opening message and the user message.
|
|
716
|
-
* @returns A promise that resolves to
|
|
1127
|
+
* @returns A promise that resolves to a message or a debug record.
|
|
1128
|
+
* If the message is a debug record, it will throw an error.
|
|
717
1129
|
*
|
|
718
1130
|
* @example
|
|
719
1131
|
* ```ts
|
|
720
|
-
* const
|
|
721
|
-
* openingMessage: 'Hello!',
|
|
1132
|
+
* const newMessage = await client.sendMessage({
|
|
1133
|
+
* openingMessage: 'Hello! How can I help you?',
|
|
722
1134
|
* userMessage: 'How can I get support?',
|
|
723
1135
|
* })
|
|
724
1136
|
*
|
|
725
|
-
* if (
|
|
726
|
-
*
|
|
727
|
-
* console.log('Received message:', message)
|
|
728
|
-
* }
|
|
1137
|
+
* if (newMessages) {
|
|
1138
|
+
* console.log('Received messages:', newMessages)
|
|
729
1139
|
* } else {
|
|
730
1140
|
* console.log('No message received')
|
|
731
1141
|
* }
|
|
732
1142
|
* ```
|
|
733
1143
|
*/
|
|
734
1144
|
sendMessage({ openingMessage, userMessage, }: {
|
|
735
|
-
openingMessage?:
|
|
736
|
-
userMessage:
|
|
737
|
-
}): Promise<
|
|
1145
|
+
openingMessage?: ConversationApiRequest['openingMessage'];
|
|
1146
|
+
userMessage: ConversationApiRequest['userMessage'];
|
|
1147
|
+
}): Promise<Message | undefined>;
|
|
738
1148
|
}
|
|
739
1149
|
|
|
740
1150
|
/**
|
|
@@ -856,4 +1266,4 @@ declare const getUserId: () => string | null;
|
|
|
856
1266
|
*/
|
|
857
1267
|
declare const setUserId: (userId: string) => void;
|
|
858
1268
|
|
|
859
|
-
export { CONVERSATION_ID, Client, type Config, type Endpoint, type Identity, type Message, SESSION_ID, TTL, USER_ID, deleteConversationId, getConversationId, getSessionId, getUserId, setConversationId, setSessionId, setUserId };
|
|
1269
|
+
export { CONVERSATION_ID, Client, type Config, type ConversationApiRequest, type DebugResponse, type Endpoint, type Identity, type Message, SESSION_ID, TTL, USER_ID, deleteConversationId, getConversationId, getSessionId, getUserId, setConversationId, setSessionId, setUserId };
|