@databricks/sdk-genie 0.34.0 → 0.35.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/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/v1/client.d.ts +167 -163
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +804 -1049
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +3 -7
- package/dist/v1/index.js +4 -7
- package/dist/v1/model.d.ts +1615 -1639
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +926 -1622
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +21 -17
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +60 -69
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts +22 -19
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +114 -145
- package/dist/v1/utils.js.map +1 -1
- package/package.json +5 -5
- package/dist/v1/index.d.ts.map +0 -1
- package/dist/v1/index.js.map +0 -1
package/dist/v1/client.js
CHANGED
|
@@ -1,1052 +1,807 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { resolveClientConfig } from "./transport.js";
|
|
2
|
+
import { StillRunningError, buildHttpRequest, executeCall, executeHttpCall, executeWait, marshalRequest, parseResponse, sendAndCheckError } from "./utils.js";
|
|
3
|
+
import { name, version } from "../package.js";
|
|
4
|
+
import { MessageStatus_MessageStatus, marshalGenieCreateConversationMessageRequestSchema, marshalGenieCreateEvalRunRequestSchema, marshalGenieCreateMessageCommentRequestSchema, marshalGenieCreateSpaceRequestSchema, marshalGenieExecuteMessageAttachmentQueryRequestSchema, marshalGenieExecuteMessageQueryRequestSchema, marshalGenieGenerateDownloadFullQueryResultRequestSchema, marshalGenieSendMessageFeedbackRequestSchema, marshalGenieStartConversationRequestSchema, marshalGenieUpdateSpaceRequestSchema, unmarshalGenieEvalResultDetailsSchema, unmarshalGenieEvalRunResponseSchema, unmarshalGenieGenerateDownloadFullQueryResultResponseSchema, unmarshalGenieGetDownloadFullQueryResultResponseSchema, unmarshalGenieGetMessageQueryResultResponseSchema, unmarshalGenieListConversationCommentsResponseSchema, unmarshalGenieListConversationMessagesResponseSchema, unmarshalGenieListConversationsResponseSchema, unmarshalGenieListEvalResultsResponseSchema, unmarshalGenieListEvalRunsResponseSchema, unmarshalGenieListMessageCommentsResponseSchema, unmarshalGenieListSpacesResponseSchema, unmarshalGenieMessageCommentSchema, unmarshalGenieMessageSchema, unmarshalGenieSpaceSchema, unmarshalGenieStartConversationResponseSchema } from "./model.js";
|
|
5
|
+
import { VERSION } from "@databricks/sdk-auth";
|
|
6
|
+
import { createDefault } from "@databricks/sdk-core/clientinfo";
|
|
7
|
+
import { NoOpLogger } from "@databricks/sdk-core/logger";
|
|
8
|
+
|
|
9
|
+
//#region src/v1/client.ts
|
|
10
10
|
const PACKAGE_SEGMENT = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
|
|
12
|
+
value: version
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
};
|
|
808
|
-
await executeCall(call, options);
|
|
809
|
-
if (resp === undefined) {
|
|
810
|
-
throw new Error('operation completed without a result.');
|
|
811
|
-
}
|
|
812
|
-
return resp;
|
|
813
|
-
}
|
|
814
|
-
/** Send feedback for a message. */
|
|
815
|
-
async genieSendMessageFeedback(req, options) {
|
|
816
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
817
|
-
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/conversations/${req.conversationId ?? ''}/messages/${req.messageId ?? ''}/feedback`;
|
|
818
|
-
const body = marshalRequest(req, marshalGenieSendMessageFeedbackRequestSchema);
|
|
819
|
-
const call = async (callSignal) => {
|
|
820
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
821
|
-
if (workspaceId !== undefined) {
|
|
822
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
823
|
-
}
|
|
824
|
-
headers.set('User-Agent', this.userAgent);
|
|
825
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
826
|
-
await executeHttpCall({
|
|
827
|
-
request: httpReq,
|
|
828
|
-
httpClient,
|
|
829
|
-
logger: this.logger,
|
|
830
|
-
});
|
|
831
|
-
};
|
|
832
|
-
await executeCall(call, options);
|
|
833
|
-
}
|
|
834
|
-
/** Start a new conversation. */
|
|
835
|
-
async genieStartConversationBase(req, options) {
|
|
836
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
837
|
-
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/start-conversation`;
|
|
838
|
-
const body = marshalRequest(req, marshalGenieStartConversationRequestSchema);
|
|
839
|
-
let resp;
|
|
840
|
-
const call = async (callSignal) => {
|
|
841
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
842
|
-
if (workspaceId !== undefined) {
|
|
843
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
844
|
-
}
|
|
845
|
-
headers.set('User-Agent', this.userAgent);
|
|
846
|
-
const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
|
|
847
|
-
const respBody = await executeHttpCall({
|
|
848
|
-
request: httpReq,
|
|
849
|
-
httpClient,
|
|
850
|
-
logger: this.logger,
|
|
851
|
-
});
|
|
852
|
-
resp = parseResponse(respBody, unmarshalGenieStartConversationResponseSchema);
|
|
853
|
-
};
|
|
854
|
-
await executeCall(call, options);
|
|
855
|
-
if (resp === undefined) {
|
|
856
|
-
throw new Error('operation completed without a result.');
|
|
857
|
-
}
|
|
858
|
-
return resp;
|
|
859
|
-
}
|
|
860
|
-
/** Start a new conversation. */
|
|
861
|
-
async genieStartConversation(req, options) {
|
|
862
|
-
const resp = await this.genieStartConversationBase(req, options);
|
|
863
|
-
if (resp.messageId === undefined) {
|
|
864
|
-
throw new Error('response field messageId required for polling is missing');
|
|
865
|
-
}
|
|
866
|
-
if (resp.conversationId === undefined) {
|
|
867
|
-
throw new Error('response field conversationId required for polling is missing');
|
|
868
|
-
}
|
|
869
|
-
if (req.spaceId === undefined) {
|
|
870
|
-
throw new Error('request field spaceId required for polling is missing');
|
|
871
|
-
}
|
|
872
|
-
return new GenieStartConversationWaiter(this, resp.messageId, resp.conversationId, req.spaceId);
|
|
873
|
-
}
|
|
874
|
-
/** Move a Genie Space to the trash. */
|
|
875
|
-
async genieTrashSpace(req, options) {
|
|
876
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
877
|
-
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ''}`;
|
|
878
|
-
const call = async (callSignal) => {
|
|
879
|
-
const headers = new Headers();
|
|
880
|
-
if (workspaceId !== undefined) {
|
|
881
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
882
|
-
}
|
|
883
|
-
headers.set('User-Agent', this.userAgent);
|
|
884
|
-
const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
|
|
885
|
-
await executeHttpCall({
|
|
886
|
-
request: httpReq,
|
|
887
|
-
httpClient,
|
|
888
|
-
logger: this.logger,
|
|
889
|
-
});
|
|
890
|
-
};
|
|
891
|
-
await executeCall(call, options);
|
|
892
|
-
}
|
|
893
|
-
/** Updates a Genie space with a serialized payload. */
|
|
894
|
-
async updateSpace(req, options) {
|
|
895
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
896
|
-
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ''}`;
|
|
897
|
-
const body = marshalRequest(req, marshalGenieUpdateSpaceRequestSchema);
|
|
898
|
-
let resp;
|
|
899
|
-
const call = async (callSignal) => {
|
|
900
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
901
|
-
if (workspaceId !== undefined) {
|
|
902
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
903
|
-
}
|
|
904
|
-
headers.set('User-Agent', this.userAgent);
|
|
905
|
-
const httpReq = buildHttpRequest('PATCH', url, headers, callSignal, body);
|
|
906
|
-
const respBody = await executeHttpCall({
|
|
907
|
-
request: httpReq,
|
|
908
|
-
httpClient,
|
|
909
|
-
logger: this.logger,
|
|
910
|
-
});
|
|
911
|
-
resp = parseResponse(respBody, unmarshalGenieSpaceSchema);
|
|
912
|
-
};
|
|
913
|
-
await executeCall(call, options);
|
|
914
|
-
if (resp === undefined) {
|
|
915
|
-
throw new Error('operation completed without a result.');
|
|
916
|
-
}
|
|
917
|
-
return resp;
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
export class GenieCreateConversationMessageWaiter {
|
|
921
|
-
client;
|
|
922
|
-
messageId;
|
|
923
|
-
conversationId;
|
|
924
|
-
spaceId;
|
|
925
|
-
constructor(client, messageId, conversationId, spaceId) {
|
|
926
|
-
this.client = client;
|
|
927
|
-
this.messageId = messageId;
|
|
928
|
-
this.conversationId = conversationId;
|
|
929
|
-
this.spaceId = spaceId;
|
|
930
|
-
}
|
|
931
|
-
/**
|
|
932
|
-
* Polls until the operation reaches a terminal state.
|
|
933
|
-
*
|
|
934
|
-
* Throws if a failure state is reached.
|
|
935
|
-
*/
|
|
936
|
-
async wait(options) {
|
|
937
|
-
let result;
|
|
938
|
-
const call = async (callSignal) => {
|
|
939
|
-
const pollResp = await this.client.genieGetConversationMessage({
|
|
940
|
-
messageId: this.messageId,
|
|
941
|
-
conversationId: this.conversationId,
|
|
942
|
-
spaceId: this.spaceId,
|
|
943
|
-
}, callSignal !== undefined ? { signal: callSignal } : undefined);
|
|
944
|
-
const status = pollResp.status;
|
|
945
|
-
if (status === undefined) {
|
|
946
|
-
throw new Error('response missing required status field');
|
|
947
|
-
}
|
|
948
|
-
switch (status) {
|
|
949
|
-
case MessageStatus_MessageStatus.COMPLETED:
|
|
950
|
-
result = pollResp;
|
|
951
|
-
return;
|
|
952
|
-
case MessageStatus_MessageStatus.FAILED: {
|
|
953
|
-
const msg = '(no message)';
|
|
954
|
-
throw new Error(`terminal state ${status}: ${msg}`);
|
|
955
|
-
}
|
|
956
|
-
default:
|
|
957
|
-
throw new StillRunningError();
|
|
958
|
-
}
|
|
959
|
-
};
|
|
960
|
-
await executeWait(call, options);
|
|
961
|
-
if (result === undefined) {
|
|
962
|
-
throw new Error('operation completed without a result.');
|
|
963
|
-
}
|
|
964
|
-
return result;
|
|
965
|
-
}
|
|
966
|
-
/** Checks whether the operation has reached a terminal state. */
|
|
967
|
-
async done(options) {
|
|
968
|
-
const pollResp = await this.client.genieGetConversationMessage({
|
|
969
|
-
messageId: this.messageId,
|
|
970
|
-
conversationId: this.conversationId,
|
|
971
|
-
spaceId: this.spaceId,
|
|
972
|
-
}, options);
|
|
973
|
-
const status = pollResp.status;
|
|
974
|
-
if (status === undefined) {
|
|
975
|
-
throw new Error('response missing required status field');
|
|
976
|
-
}
|
|
977
|
-
switch (status) {
|
|
978
|
-
case MessageStatus_MessageStatus.COMPLETED:
|
|
979
|
-
case MessageStatus_MessageStatus.FAILED:
|
|
980
|
-
return true;
|
|
981
|
-
default:
|
|
982
|
-
return false;
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
export class GenieStartConversationWaiter {
|
|
987
|
-
client;
|
|
988
|
-
messageId;
|
|
989
|
-
conversationId;
|
|
990
|
-
spaceId;
|
|
991
|
-
constructor(client, messageId, conversationId, spaceId) {
|
|
992
|
-
this.client = client;
|
|
993
|
-
this.messageId = messageId;
|
|
994
|
-
this.conversationId = conversationId;
|
|
995
|
-
this.spaceId = spaceId;
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* Polls until the operation reaches a terminal state.
|
|
999
|
-
*
|
|
1000
|
-
* Throws if a failure state is reached.
|
|
1001
|
-
*/
|
|
1002
|
-
async wait(options) {
|
|
1003
|
-
let result;
|
|
1004
|
-
const call = async (callSignal) => {
|
|
1005
|
-
const pollResp = await this.client.genieGetConversationMessage({
|
|
1006
|
-
messageId: this.messageId,
|
|
1007
|
-
conversationId: this.conversationId,
|
|
1008
|
-
spaceId: this.spaceId,
|
|
1009
|
-
}, callSignal !== undefined ? { signal: callSignal } : undefined);
|
|
1010
|
-
const status = pollResp.status;
|
|
1011
|
-
if (status === undefined) {
|
|
1012
|
-
throw new Error('response missing required status field');
|
|
1013
|
-
}
|
|
1014
|
-
switch (status) {
|
|
1015
|
-
case MessageStatus_MessageStatus.COMPLETED:
|
|
1016
|
-
result = pollResp;
|
|
1017
|
-
return;
|
|
1018
|
-
case MessageStatus_MessageStatus.FAILED: {
|
|
1019
|
-
const msg = '(no message)';
|
|
1020
|
-
throw new Error(`terminal state ${status}: ${msg}`);
|
|
1021
|
-
}
|
|
1022
|
-
default:
|
|
1023
|
-
throw new StillRunningError();
|
|
1024
|
-
}
|
|
1025
|
-
};
|
|
1026
|
-
await executeWait(call, options);
|
|
1027
|
-
if (result === undefined) {
|
|
1028
|
-
throw new Error('operation completed without a result.');
|
|
1029
|
-
}
|
|
1030
|
-
return result;
|
|
1031
|
-
}
|
|
1032
|
-
/** Checks whether the operation has reached a terminal state. */
|
|
1033
|
-
async done(options) {
|
|
1034
|
-
const pollResp = await this.client.genieGetConversationMessage({
|
|
1035
|
-
messageId: this.messageId,
|
|
1036
|
-
conversationId: this.conversationId,
|
|
1037
|
-
spaceId: this.spaceId,
|
|
1038
|
-
}, options);
|
|
1039
|
-
const status = pollResp.status;
|
|
1040
|
-
if (status === undefined) {
|
|
1041
|
-
throw new Error('response missing required status field');
|
|
1042
|
-
}
|
|
1043
|
-
switch (status) {
|
|
1044
|
-
case MessageStatus_MessageStatus.COMPLETED:
|
|
1045
|
-
case MessageStatus_MessageStatus.FAILED:
|
|
1046
|
-
return true;
|
|
1047
|
-
default:
|
|
1048
|
-
return false;
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
14
|
+
var GenieClient = class {
|
|
15
|
+
options;
|
|
16
|
+
logger;
|
|
17
|
+
userAgent;
|
|
18
|
+
config;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.logger = options.logger ?? new NoOpLogger();
|
|
22
|
+
this.userAgent = createDefault().with(PACKAGE_SEGMENT).with({
|
|
23
|
+
key: "sdk-js-auth",
|
|
24
|
+
value: VERSION
|
|
25
|
+
}).with({
|
|
26
|
+
key: "auth",
|
|
27
|
+
value: options.credentials?.name() ?? "default"
|
|
28
|
+
}).toString();
|
|
29
|
+
}
|
|
30
|
+
resolveConfig() {
|
|
31
|
+
this.config ??= resolveClientConfig(this.options);
|
|
32
|
+
return this.config;
|
|
33
|
+
}
|
|
34
|
+
/** Creates a Genie space from a serialized payload. */
|
|
35
|
+
async createSpace(req, options) {
|
|
36
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
37
|
+
const url = `${host}/api/2.0/genie/spaces`;
|
|
38
|
+
const body = marshalRequest(req, marshalGenieCreateSpaceRequestSchema);
|
|
39
|
+
let resp;
|
|
40
|
+
const call = async (callSignal) => {
|
|
41
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
42
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
43
|
+
headers.set("User-Agent", this.userAgent);
|
|
44
|
+
resp = parseResponse(await executeHttpCall({
|
|
45
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
46
|
+
httpClient,
|
|
47
|
+
logger: this.logger
|
|
48
|
+
}), unmarshalGenieSpaceSchema);
|
|
49
|
+
};
|
|
50
|
+
await executeCall(call, options);
|
|
51
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
52
|
+
return resp;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Download a rendered image of a message visualization attachment.
|
|
56
|
+
* The response body is the raw PNG image, not a JSON payload.
|
|
57
|
+
* This is only available if the attachment is a visualization and the message status is `COMPLETED`.
|
|
58
|
+
* This endpoint is not supported for Private Link workspaces.
|
|
59
|
+
*/
|
|
60
|
+
async downloadMessageAttachmentVisualization(req, options) {
|
|
61
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
62
|
+
const url = `${host}/api/2.0/genie/${req.name ?? ""}/download-visualization`;
|
|
63
|
+
let resp;
|
|
64
|
+
const call = async (callSignal) => {
|
|
65
|
+
const headers = new Headers();
|
|
66
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
67
|
+
headers.set("User-Agent", this.userAgent);
|
|
68
|
+
resp = { contents: (await sendAndCheckError({
|
|
69
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
70
|
+
httpClient,
|
|
71
|
+
logger: this.logger
|
|
72
|
+
})).body ?? void 0 };
|
|
73
|
+
};
|
|
74
|
+
await executeCall(call, options);
|
|
75
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
76
|
+
return resp;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Create new message in a [conversation](:method:genie/startconversation).
|
|
80
|
+
* The AI response uses all previously created messages in the conversation to respond.
|
|
81
|
+
*/
|
|
82
|
+
async genieCreateConversationMessageBase(req, options) {
|
|
83
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
84
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages`;
|
|
85
|
+
const body = marshalRequest(req, marshalGenieCreateConversationMessageRequestSchema);
|
|
86
|
+
let resp;
|
|
87
|
+
const call = async (callSignal) => {
|
|
88
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
89
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
90
|
+
headers.set("User-Agent", this.userAgent);
|
|
91
|
+
resp = parseResponse(await executeHttpCall({
|
|
92
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
93
|
+
httpClient,
|
|
94
|
+
logger: this.logger
|
|
95
|
+
}), unmarshalGenieMessageSchema);
|
|
96
|
+
};
|
|
97
|
+
await executeCall(call, options);
|
|
98
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
99
|
+
return resp;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create new message in a [conversation](:method:genie/startconversation).
|
|
103
|
+
* The AI response uses all previously created messages in the conversation to respond.
|
|
104
|
+
*/
|
|
105
|
+
async genieCreateConversationMessage(req, options) {
|
|
106
|
+
const resp = await this.genieCreateConversationMessageBase(req, options);
|
|
107
|
+
if (resp.messageId === void 0) throw new Error("response field messageId required for polling is missing");
|
|
108
|
+
if (req.conversationId === void 0) throw new Error("request field conversationId required for polling is missing");
|
|
109
|
+
if (req.spaceId === void 0) throw new Error("request field spaceId required for polling is missing");
|
|
110
|
+
return new GenieCreateConversationMessageWaiter(this, resp.messageId, req.conversationId, req.spaceId);
|
|
111
|
+
}
|
|
112
|
+
/** Create and run evaluations for multiple benchmark questions in a Genie space. */
|
|
113
|
+
async genieCreateEvalRun(req, options) {
|
|
114
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
115
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs`;
|
|
116
|
+
const body = marshalRequest(req, marshalGenieCreateEvalRunRequestSchema);
|
|
117
|
+
let resp;
|
|
118
|
+
const call = async (callSignal) => {
|
|
119
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
120
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
121
|
+
headers.set("User-Agent", this.userAgent);
|
|
122
|
+
resp = parseResponse(await executeHttpCall({
|
|
123
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
124
|
+
httpClient,
|
|
125
|
+
logger: this.logger
|
|
126
|
+
}), unmarshalGenieEvalRunResponseSchema);
|
|
127
|
+
};
|
|
128
|
+
await executeCall(call, options);
|
|
129
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
130
|
+
return resp;
|
|
131
|
+
}
|
|
132
|
+
/** Create a comment on a conversation message. */
|
|
133
|
+
async genieCreateMessageComment(req, options) {
|
|
134
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
135
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/comments`;
|
|
136
|
+
const body = marshalRequest(req, marshalGenieCreateMessageCommentRequestSchema);
|
|
137
|
+
let resp;
|
|
138
|
+
const call = async (callSignal) => {
|
|
139
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
140
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
141
|
+
headers.set("User-Agent", this.userAgent);
|
|
142
|
+
resp = parseResponse(await executeHttpCall({
|
|
143
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
144
|
+
httpClient,
|
|
145
|
+
logger: this.logger
|
|
146
|
+
}), unmarshalGenieMessageCommentSchema);
|
|
147
|
+
};
|
|
148
|
+
await executeCall(call, options);
|
|
149
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
150
|
+
return resp;
|
|
151
|
+
}
|
|
152
|
+
/** Delete a conversation. */
|
|
153
|
+
async genieDeleteConversation(req, options) {
|
|
154
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
155
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}`;
|
|
156
|
+
const call = async (callSignal) => {
|
|
157
|
+
const headers = new Headers();
|
|
158
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
159
|
+
headers.set("User-Agent", this.userAgent);
|
|
160
|
+
await executeHttpCall({
|
|
161
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
162
|
+
httpClient,
|
|
163
|
+
logger: this.logger
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
await executeCall(call, options);
|
|
167
|
+
}
|
|
168
|
+
/** Delete a conversation message. */
|
|
169
|
+
async genieDeleteConversationMessage(req, options) {
|
|
170
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
171
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}`;
|
|
172
|
+
const call = async (callSignal) => {
|
|
173
|
+
const headers = new Headers();
|
|
174
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
175
|
+
headers.set("User-Agent", this.userAgent);
|
|
176
|
+
await executeHttpCall({
|
|
177
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
178
|
+
httpClient,
|
|
179
|
+
logger: this.logger
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
await executeCall(call, options);
|
|
183
|
+
}
|
|
184
|
+
/** Execute the SQL for a message query attachment. Use this API when the query attachment has expired and needs to be re-executed. */
|
|
185
|
+
async genieExecuteMessageAttachmentQuery(req, options) {
|
|
186
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
187
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/attachments/${req.attachmentId ?? ""}/execute-query`;
|
|
188
|
+
const body = marshalRequest(req, marshalGenieExecuteMessageAttachmentQueryRequestSchema);
|
|
189
|
+
let resp;
|
|
190
|
+
const call = async (callSignal) => {
|
|
191
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
192
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
193
|
+
headers.set("User-Agent", this.userAgent);
|
|
194
|
+
resp = parseResponse(await executeHttpCall({
|
|
195
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
196
|
+
httpClient,
|
|
197
|
+
logger: this.logger
|
|
198
|
+
}), unmarshalGenieGetMessageQueryResultResponseSchema);
|
|
199
|
+
};
|
|
200
|
+
await executeCall(call, options);
|
|
201
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
202
|
+
return resp;
|
|
203
|
+
}
|
|
204
|
+
/** DEPRECATED: Use [Execute Message Attachment Query](:method:genie/executemessageattachmentquery) instead. */
|
|
205
|
+
async genieExecuteMessageQuery(req, options) {
|
|
206
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
207
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/execute-query`;
|
|
208
|
+
const body = marshalRequest(req, marshalGenieExecuteMessageQueryRequestSchema);
|
|
209
|
+
let resp;
|
|
210
|
+
const call = async (callSignal) => {
|
|
211
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
212
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
213
|
+
headers.set("User-Agent", this.userAgent);
|
|
214
|
+
resp = parseResponse(await executeHttpCall({
|
|
215
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
216
|
+
httpClient,
|
|
217
|
+
logger: this.logger
|
|
218
|
+
}), unmarshalGenieGetMessageQueryResultResponseSchema);
|
|
219
|
+
};
|
|
220
|
+
await executeCall(call, options);
|
|
221
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
222
|
+
return resp;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Initiates a new SQL execution and returns a `download_id` and `download_id_signature` that you can use to track the progress of the download.
|
|
226
|
+
* The query result is stored in an external link and can be retrieved using the [Get Download Full Query Result](:method:genie/getdownloadfullqueryresult) API.
|
|
227
|
+
* Both `download_id` and `download_id_signature` must be provided when calling the Get endpoint.
|
|
228
|
+
*
|
|
229
|
+
* ----
|
|
230
|
+
*
|
|
231
|
+
* ### **Warning: Databricks strongly recommends that you protect the URLs that are returned by the `EXTERNAL_LINKS` disposition.**
|
|
232
|
+
*
|
|
233
|
+
* When you use the `EXTERNAL_LINKS` disposition, a
|
|
234
|
+
* short-lived, URL is generated, which can be
|
|
235
|
+
* used to download the results directly
|
|
236
|
+
* from . As a
|
|
237
|
+
* short-lived is
|
|
238
|
+
* embedded in this URL, you should protect
|
|
239
|
+
* the URL.
|
|
240
|
+
*
|
|
241
|
+
* Because URLs are already generated with
|
|
242
|
+
* embedded temporary s,
|
|
243
|
+
* you must not set an `Authorization` header in the download requests.
|
|
244
|
+
*
|
|
245
|
+
* See [Execute Statement](:method:statementexecution/executestatement) for more details.
|
|
246
|
+
*
|
|
247
|
+
* ----
|
|
248
|
+
*/
|
|
249
|
+
async genieGenerateDownloadFullQueryResult(req, options) {
|
|
250
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
251
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/attachments/${req.attachmentId ?? ""}/downloads`;
|
|
252
|
+
const body = marshalRequest(req, marshalGenieGenerateDownloadFullQueryResultRequestSchema);
|
|
253
|
+
let resp;
|
|
254
|
+
const call = async (callSignal) => {
|
|
255
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
256
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
257
|
+
headers.set("User-Agent", this.userAgent);
|
|
258
|
+
resp = parseResponse(await executeHttpCall({
|
|
259
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
260
|
+
httpClient,
|
|
261
|
+
logger: this.logger
|
|
262
|
+
}), unmarshalGenieGenerateDownloadFullQueryResultResponseSchema);
|
|
263
|
+
};
|
|
264
|
+
await executeCall(call, options);
|
|
265
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
266
|
+
return resp;
|
|
267
|
+
}
|
|
268
|
+
/** Get message from conversation. */
|
|
269
|
+
async genieGetConversationMessage(req, options) {
|
|
270
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
271
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}`;
|
|
272
|
+
let resp;
|
|
273
|
+
const call = async (callSignal) => {
|
|
274
|
+
const headers = new Headers();
|
|
275
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
276
|
+
headers.set("User-Agent", this.userAgent);
|
|
277
|
+
resp = parseResponse(await executeHttpCall({
|
|
278
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
279
|
+
httpClient,
|
|
280
|
+
logger: this.logger
|
|
281
|
+
}), unmarshalGenieMessageSchema);
|
|
282
|
+
};
|
|
283
|
+
await executeCall(call, options);
|
|
284
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
285
|
+
return resp;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* After [Generating a Full Query Result Download](:method:genie/generatedownloadfullqueryresult) and successfully receiving a `download_id` and `download_id_signature`, use this API to poll the download progress.
|
|
289
|
+
* Both `download_id` and `download_id_signature` are required to call this endpoint.
|
|
290
|
+
* When the download is complete, the API returns the result in the `EXTERNAL_LINKS` disposition, containing one or more external links to the query result files.
|
|
291
|
+
*
|
|
292
|
+
* ----
|
|
293
|
+
*
|
|
294
|
+
* ### **Warning: Databricks strongly recommends that you protect the URLs that are returned by the `EXTERNAL_LINKS` disposition.**
|
|
295
|
+
*
|
|
296
|
+
* When you use the `EXTERNAL_LINKS` disposition, a
|
|
297
|
+
* short-lived, URL is generated, which can be
|
|
298
|
+
* used to download the results directly
|
|
299
|
+
* from . As a
|
|
300
|
+
* short-lived is
|
|
301
|
+
* embedded in this URL, you should protect
|
|
302
|
+
* the URL.
|
|
303
|
+
*
|
|
304
|
+
* Because URLs are already generated with
|
|
305
|
+
* embedded temporary s,
|
|
306
|
+
* you must not set an `Authorization` header in the download requests.
|
|
307
|
+
*
|
|
308
|
+
* See [Execute Statement](:method:statementexecution/executestatement) for more details.
|
|
309
|
+
*
|
|
310
|
+
* ----
|
|
311
|
+
*/
|
|
312
|
+
async genieGetDownloadFullQueryResult(req, options) {
|
|
313
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
314
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/attachments/${req.attachmentId ?? ""}/downloads/${req.downloadId ?? ""}`;
|
|
315
|
+
const params = new URLSearchParams();
|
|
316
|
+
if (req.downloadIdSignature !== void 0) params.append("download_id_signature", req.downloadIdSignature);
|
|
317
|
+
const query = params.toString();
|
|
318
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
319
|
+
let resp;
|
|
320
|
+
const call = async (callSignal) => {
|
|
321
|
+
const headers = new Headers();
|
|
322
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
323
|
+
headers.set("User-Agent", this.userAgent);
|
|
324
|
+
resp = parseResponse(await executeHttpCall({
|
|
325
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
326
|
+
httpClient,
|
|
327
|
+
logger: this.logger
|
|
328
|
+
}), unmarshalGenieGetDownloadFullQueryResultResponseSchema);
|
|
329
|
+
};
|
|
330
|
+
await executeCall(call, options);
|
|
331
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
332
|
+
return resp;
|
|
333
|
+
}
|
|
334
|
+
/** Get details for evaluation results. */
|
|
335
|
+
async genieGetEvalResultDetails(req, options) {
|
|
336
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
337
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs/${req.evalRunId ?? ""}/results/${req.resultId ?? ""}`;
|
|
338
|
+
let resp;
|
|
339
|
+
const call = async (callSignal) => {
|
|
340
|
+
const headers = new Headers();
|
|
341
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
342
|
+
headers.set("User-Agent", this.userAgent);
|
|
343
|
+
resp = parseResponse(await executeHttpCall({
|
|
344
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
345
|
+
httpClient,
|
|
346
|
+
logger: this.logger
|
|
347
|
+
}), unmarshalGenieEvalResultDetailsSchema);
|
|
348
|
+
};
|
|
349
|
+
await executeCall(call, options);
|
|
350
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
351
|
+
return resp;
|
|
352
|
+
}
|
|
353
|
+
/** Get evaluation run details. */
|
|
354
|
+
async genieGetEvalRun(req, options) {
|
|
355
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
356
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs/${req.evalRunId ?? ""}`;
|
|
357
|
+
let resp;
|
|
358
|
+
const call = async (callSignal) => {
|
|
359
|
+
const headers = new Headers();
|
|
360
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
361
|
+
headers.set("User-Agent", this.userAgent);
|
|
362
|
+
resp = parseResponse(await executeHttpCall({
|
|
363
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
364
|
+
httpClient,
|
|
365
|
+
logger: this.logger
|
|
366
|
+
}), unmarshalGenieEvalRunResponseSchema);
|
|
367
|
+
};
|
|
368
|
+
await executeCall(call, options);
|
|
369
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
370
|
+
return resp;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Get the result of SQL query if the message has a query attachment.
|
|
374
|
+
* This is only available if a message has a query attachment and the message status is `EXECUTING_QUERY` OR `COMPLETED`.
|
|
375
|
+
*/
|
|
376
|
+
async genieGetMessageAttachmentQueryResult(req, options) {
|
|
377
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
378
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/attachments/${req.attachmentId ?? ""}/query-result`;
|
|
379
|
+
let resp;
|
|
380
|
+
const call = async (callSignal) => {
|
|
381
|
+
const headers = new Headers();
|
|
382
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
383
|
+
headers.set("User-Agent", this.userAgent);
|
|
384
|
+
resp = parseResponse(await executeHttpCall({
|
|
385
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
386
|
+
httpClient,
|
|
387
|
+
logger: this.logger
|
|
388
|
+
}), unmarshalGenieGetMessageQueryResultResponseSchema);
|
|
389
|
+
};
|
|
390
|
+
await executeCall(call, options);
|
|
391
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
392
|
+
return resp;
|
|
393
|
+
}
|
|
394
|
+
/** DEPRECATED: Use [Get Message Attachment Query Result](:method:genie/getmessageattachmentqueryresult) instead. */
|
|
395
|
+
async genieGetMessageQueryResult(req, options) {
|
|
396
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
397
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/query-result`;
|
|
398
|
+
let resp;
|
|
399
|
+
const call = async (callSignal) => {
|
|
400
|
+
const headers = new Headers();
|
|
401
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
402
|
+
headers.set("User-Agent", this.userAgent);
|
|
403
|
+
resp = parseResponse(await executeHttpCall({
|
|
404
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
405
|
+
httpClient,
|
|
406
|
+
logger: this.logger
|
|
407
|
+
}), unmarshalGenieGetMessageQueryResultResponseSchema);
|
|
408
|
+
};
|
|
409
|
+
await executeCall(call, options);
|
|
410
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
411
|
+
return resp;
|
|
412
|
+
}
|
|
413
|
+
/** DEPRECATED: Use [Get Message Attachment Query Result](:method:genie/getmessageattachmentqueryresult) instead. */
|
|
414
|
+
async genieGetQueryResultByAttachment(req, options) {
|
|
415
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
416
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/query-result/${req.attachmentId ?? ""}`;
|
|
417
|
+
let resp;
|
|
418
|
+
const call = async (callSignal) => {
|
|
419
|
+
const headers = new Headers();
|
|
420
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
421
|
+
headers.set("User-Agent", this.userAgent);
|
|
422
|
+
resp = parseResponse(await executeHttpCall({
|
|
423
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
424
|
+
httpClient,
|
|
425
|
+
logger: this.logger
|
|
426
|
+
}), unmarshalGenieGetMessageQueryResultResponseSchema);
|
|
427
|
+
};
|
|
428
|
+
await executeCall(call, options);
|
|
429
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
430
|
+
return resp;
|
|
431
|
+
}
|
|
432
|
+
/** Get details of a Genie Space. */
|
|
433
|
+
async genieGetSpace(req, options) {
|
|
434
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
435
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}`;
|
|
436
|
+
const params = new URLSearchParams();
|
|
437
|
+
if (req.includeSerializedSpace !== void 0) params.append("include_serialized_space", String(req.includeSerializedSpace));
|
|
438
|
+
const query = params.toString();
|
|
439
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
440
|
+
let resp;
|
|
441
|
+
const call = async (callSignal) => {
|
|
442
|
+
const headers = new Headers();
|
|
443
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
444
|
+
headers.set("User-Agent", this.userAgent);
|
|
445
|
+
resp = parseResponse(await executeHttpCall({
|
|
446
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
447
|
+
httpClient,
|
|
448
|
+
logger: this.logger
|
|
449
|
+
}), unmarshalGenieSpaceSchema);
|
|
450
|
+
};
|
|
451
|
+
await executeCall(call, options);
|
|
452
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
453
|
+
return resp;
|
|
454
|
+
}
|
|
455
|
+
/** List all comments across all messages in a conversation. */
|
|
456
|
+
async genieListConversationComments(req, options) {
|
|
457
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
458
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/list-comments`;
|
|
459
|
+
const params = new URLSearchParams();
|
|
460
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
461
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
462
|
+
const query = params.toString();
|
|
463
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
464
|
+
let resp;
|
|
465
|
+
const call = async (callSignal) => {
|
|
466
|
+
const headers = new Headers();
|
|
467
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
468
|
+
headers.set("User-Agent", this.userAgent);
|
|
469
|
+
resp = parseResponse(await executeHttpCall({
|
|
470
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
471
|
+
httpClient,
|
|
472
|
+
logger: this.logger
|
|
473
|
+
}), unmarshalGenieListConversationCommentsResponseSchema);
|
|
474
|
+
};
|
|
475
|
+
await executeCall(call, options);
|
|
476
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
477
|
+
return resp;
|
|
478
|
+
}
|
|
479
|
+
/** List messages in a conversation */
|
|
480
|
+
async genieListConversationMessages(req, options) {
|
|
481
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
482
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages`;
|
|
483
|
+
const params = new URLSearchParams();
|
|
484
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
485
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
486
|
+
const query = params.toString();
|
|
487
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
488
|
+
let resp;
|
|
489
|
+
const call = async (callSignal) => {
|
|
490
|
+
const headers = new Headers();
|
|
491
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
492
|
+
headers.set("User-Agent", this.userAgent);
|
|
493
|
+
resp = parseResponse(await executeHttpCall({
|
|
494
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
495
|
+
httpClient,
|
|
496
|
+
logger: this.logger
|
|
497
|
+
}), unmarshalGenieListConversationMessagesResponseSchema);
|
|
498
|
+
};
|
|
499
|
+
await executeCall(call, options);
|
|
500
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
501
|
+
return resp;
|
|
502
|
+
}
|
|
503
|
+
/** Get a list of conversations in a Genie Space. */
|
|
504
|
+
async genieListConversations(req, options) {
|
|
505
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
506
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations`;
|
|
507
|
+
const params = new URLSearchParams();
|
|
508
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
509
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
510
|
+
if (req.includeAll !== void 0) params.append("include_all", String(req.includeAll));
|
|
511
|
+
const query = params.toString();
|
|
512
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
513
|
+
let resp;
|
|
514
|
+
const call = async (callSignal) => {
|
|
515
|
+
const headers = new Headers();
|
|
516
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
517
|
+
headers.set("User-Agent", this.userAgent);
|
|
518
|
+
resp = parseResponse(await executeHttpCall({
|
|
519
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
520
|
+
httpClient,
|
|
521
|
+
logger: this.logger
|
|
522
|
+
}), unmarshalGenieListConversationsResponseSchema);
|
|
523
|
+
};
|
|
524
|
+
await executeCall(call, options);
|
|
525
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
526
|
+
return resp;
|
|
527
|
+
}
|
|
528
|
+
/** List evaluation results for a specific evaluation run. */
|
|
529
|
+
async genieListEvalResults(req, options) {
|
|
530
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
531
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs/${req.evalRunId ?? ""}/results`;
|
|
532
|
+
const params = new URLSearchParams();
|
|
533
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
534
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
535
|
+
const query = params.toString();
|
|
536
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
537
|
+
let resp;
|
|
538
|
+
const call = async (callSignal) => {
|
|
539
|
+
const headers = new Headers();
|
|
540
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
541
|
+
headers.set("User-Agent", this.userAgent);
|
|
542
|
+
resp = parseResponse(await executeHttpCall({
|
|
543
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
544
|
+
httpClient,
|
|
545
|
+
logger: this.logger
|
|
546
|
+
}), unmarshalGenieListEvalResultsResponseSchema);
|
|
547
|
+
};
|
|
548
|
+
await executeCall(call, options);
|
|
549
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
550
|
+
return resp;
|
|
551
|
+
}
|
|
552
|
+
/** Lists all evaluation runs in a space. */
|
|
553
|
+
async genieListEvalRuns(req, options) {
|
|
554
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
555
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/eval-runs`;
|
|
556
|
+
const params = new URLSearchParams();
|
|
557
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
558
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
559
|
+
const query = params.toString();
|
|
560
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
561
|
+
let resp;
|
|
562
|
+
const call = async (callSignal) => {
|
|
563
|
+
const headers = new Headers();
|
|
564
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
565
|
+
headers.set("User-Agent", this.userAgent);
|
|
566
|
+
resp = parseResponse(await executeHttpCall({
|
|
567
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
568
|
+
httpClient,
|
|
569
|
+
logger: this.logger
|
|
570
|
+
}), unmarshalGenieListEvalRunsResponseSchema);
|
|
571
|
+
};
|
|
572
|
+
await executeCall(call, options);
|
|
573
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
574
|
+
return resp;
|
|
575
|
+
}
|
|
576
|
+
/** List comments on a specific conversation message. */
|
|
577
|
+
async genieListMessageComments(req, options) {
|
|
578
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
579
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/comments`;
|
|
580
|
+
const params = new URLSearchParams();
|
|
581
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
582
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
583
|
+
const query = params.toString();
|
|
584
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
585
|
+
let resp;
|
|
586
|
+
const call = async (callSignal) => {
|
|
587
|
+
const headers = new Headers();
|
|
588
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
589
|
+
headers.set("User-Agent", this.userAgent);
|
|
590
|
+
resp = parseResponse(await executeHttpCall({
|
|
591
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
592
|
+
httpClient,
|
|
593
|
+
logger: this.logger
|
|
594
|
+
}), unmarshalGenieListMessageCommentsResponseSchema);
|
|
595
|
+
};
|
|
596
|
+
await executeCall(call, options);
|
|
597
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
598
|
+
return resp;
|
|
599
|
+
}
|
|
600
|
+
/** Get list of Genie Spaces. */
|
|
601
|
+
async genieListSpaces(req, options) {
|
|
602
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
603
|
+
const url = `${host}/api/2.0/genie/spaces`;
|
|
604
|
+
const params = new URLSearchParams();
|
|
605
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
606
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
607
|
+
const query = params.toString();
|
|
608
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
609
|
+
let resp;
|
|
610
|
+
const call = async (callSignal) => {
|
|
611
|
+
const headers = new Headers();
|
|
612
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
613
|
+
headers.set("User-Agent", this.userAgent);
|
|
614
|
+
resp = parseResponse(await executeHttpCall({
|
|
615
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
616
|
+
httpClient,
|
|
617
|
+
logger: this.logger
|
|
618
|
+
}), unmarshalGenieListSpacesResponseSchema);
|
|
619
|
+
};
|
|
620
|
+
await executeCall(call, options);
|
|
621
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
622
|
+
return resp;
|
|
623
|
+
}
|
|
624
|
+
/** Send feedback for a message. */
|
|
625
|
+
async genieSendMessageFeedback(req, options) {
|
|
626
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
627
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/conversations/${req.conversationId ?? ""}/messages/${req.messageId ?? ""}/feedback`;
|
|
628
|
+
const body = marshalRequest(req, marshalGenieSendMessageFeedbackRequestSchema);
|
|
629
|
+
const call = async (callSignal) => {
|
|
630
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
631
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
632
|
+
headers.set("User-Agent", this.userAgent);
|
|
633
|
+
await executeHttpCall({
|
|
634
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
635
|
+
httpClient,
|
|
636
|
+
logger: this.logger
|
|
637
|
+
});
|
|
638
|
+
};
|
|
639
|
+
await executeCall(call, options);
|
|
640
|
+
}
|
|
641
|
+
/** Start a new conversation. */
|
|
642
|
+
async genieStartConversationBase(req, options) {
|
|
643
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
644
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}/start-conversation`;
|
|
645
|
+
const body = marshalRequest(req, marshalGenieStartConversationRequestSchema);
|
|
646
|
+
let resp;
|
|
647
|
+
const call = async (callSignal) => {
|
|
648
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
649
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
650
|
+
headers.set("User-Agent", this.userAgent);
|
|
651
|
+
resp = parseResponse(await executeHttpCall({
|
|
652
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
653
|
+
httpClient,
|
|
654
|
+
logger: this.logger
|
|
655
|
+
}), unmarshalGenieStartConversationResponseSchema);
|
|
656
|
+
};
|
|
657
|
+
await executeCall(call, options);
|
|
658
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
659
|
+
return resp;
|
|
660
|
+
}
|
|
661
|
+
/** Start a new conversation. */
|
|
662
|
+
async genieStartConversation(req, options) {
|
|
663
|
+
const resp = await this.genieStartConversationBase(req, options);
|
|
664
|
+
if (resp.messageId === void 0) throw new Error("response field messageId required for polling is missing");
|
|
665
|
+
if (resp.conversationId === void 0) throw new Error("response field conversationId required for polling is missing");
|
|
666
|
+
if (req.spaceId === void 0) throw new Error("request field spaceId required for polling is missing");
|
|
667
|
+
return new GenieStartConversationWaiter(this, resp.messageId, resp.conversationId, req.spaceId);
|
|
668
|
+
}
|
|
669
|
+
/** Move a Genie Space to the trash. */
|
|
670
|
+
async genieTrashSpace(req, options) {
|
|
671
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
672
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}`;
|
|
673
|
+
const call = async (callSignal) => {
|
|
674
|
+
const headers = new Headers();
|
|
675
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
676
|
+
headers.set("User-Agent", this.userAgent);
|
|
677
|
+
await executeHttpCall({
|
|
678
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
679
|
+
httpClient,
|
|
680
|
+
logger: this.logger
|
|
681
|
+
});
|
|
682
|
+
};
|
|
683
|
+
await executeCall(call, options);
|
|
684
|
+
}
|
|
685
|
+
/** Updates a Genie space with a serialized payload. */
|
|
686
|
+
async updateSpace(req, options) {
|
|
687
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
688
|
+
const url = `${host}/api/2.0/genie/spaces/${req.spaceId ?? ""}`;
|
|
689
|
+
const body = marshalRequest(req, marshalGenieUpdateSpaceRequestSchema);
|
|
690
|
+
let resp;
|
|
691
|
+
const call = async (callSignal) => {
|
|
692
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
693
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
694
|
+
headers.set("User-Agent", this.userAgent);
|
|
695
|
+
resp = parseResponse(await executeHttpCall({
|
|
696
|
+
request: buildHttpRequest("PATCH", url, headers, callSignal, body),
|
|
697
|
+
httpClient,
|
|
698
|
+
logger: this.logger
|
|
699
|
+
}), unmarshalGenieSpaceSchema);
|
|
700
|
+
};
|
|
701
|
+
await executeCall(call, options);
|
|
702
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
703
|
+
return resp;
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
var GenieCreateConversationMessageWaiter = class {
|
|
707
|
+
constructor(client, messageId, conversationId, spaceId) {
|
|
708
|
+
this.client = client;
|
|
709
|
+
this.messageId = messageId;
|
|
710
|
+
this.conversationId = conversationId;
|
|
711
|
+
this.spaceId = spaceId;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Polls until the operation reaches a terminal state.
|
|
715
|
+
*
|
|
716
|
+
* Throws if a failure state is reached.
|
|
717
|
+
*/
|
|
718
|
+
async wait(options) {
|
|
719
|
+
let result;
|
|
720
|
+
const call = async (callSignal) => {
|
|
721
|
+
const pollResp = await this.client.genieGetConversationMessage({
|
|
722
|
+
messageId: this.messageId,
|
|
723
|
+
conversationId: this.conversationId,
|
|
724
|
+
spaceId: this.spaceId
|
|
725
|
+
}, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
726
|
+
const status = pollResp.status;
|
|
727
|
+
if (status === void 0) throw new Error("response missing required status field");
|
|
728
|
+
switch (status) {
|
|
729
|
+
case MessageStatus_MessageStatus.COMPLETED:
|
|
730
|
+
result = pollResp;
|
|
731
|
+
return;
|
|
732
|
+
case MessageStatus_MessageStatus.FAILED: throw new Error(`terminal state ${status}: (no message)`);
|
|
733
|
+
default: throw new StillRunningError();
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
await executeWait(call, options);
|
|
737
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
738
|
+
return result;
|
|
739
|
+
}
|
|
740
|
+
/** Checks whether the operation has reached a terminal state. */
|
|
741
|
+
async done(options) {
|
|
742
|
+
const status = (await this.client.genieGetConversationMessage({
|
|
743
|
+
messageId: this.messageId,
|
|
744
|
+
conversationId: this.conversationId,
|
|
745
|
+
spaceId: this.spaceId
|
|
746
|
+
}, options)).status;
|
|
747
|
+
if (status === void 0) throw new Error("response missing required status field");
|
|
748
|
+
switch (status) {
|
|
749
|
+
case MessageStatus_MessageStatus.COMPLETED:
|
|
750
|
+
case MessageStatus_MessageStatus.FAILED: return true;
|
|
751
|
+
default: return false;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
var GenieStartConversationWaiter = class {
|
|
756
|
+
constructor(client, messageId, conversationId, spaceId) {
|
|
757
|
+
this.client = client;
|
|
758
|
+
this.messageId = messageId;
|
|
759
|
+
this.conversationId = conversationId;
|
|
760
|
+
this.spaceId = spaceId;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Polls until the operation reaches a terminal state.
|
|
764
|
+
*
|
|
765
|
+
* Throws if a failure state is reached.
|
|
766
|
+
*/
|
|
767
|
+
async wait(options) {
|
|
768
|
+
let result;
|
|
769
|
+
const call = async (callSignal) => {
|
|
770
|
+
const pollResp = await this.client.genieGetConversationMessage({
|
|
771
|
+
messageId: this.messageId,
|
|
772
|
+
conversationId: this.conversationId,
|
|
773
|
+
spaceId: this.spaceId
|
|
774
|
+
}, callSignal !== void 0 ? { signal: callSignal } : void 0);
|
|
775
|
+
const status = pollResp.status;
|
|
776
|
+
if (status === void 0) throw new Error("response missing required status field");
|
|
777
|
+
switch (status) {
|
|
778
|
+
case MessageStatus_MessageStatus.COMPLETED:
|
|
779
|
+
result = pollResp;
|
|
780
|
+
return;
|
|
781
|
+
case MessageStatus_MessageStatus.FAILED: throw new Error(`terminal state ${status}: (no message)`);
|
|
782
|
+
default: throw new StillRunningError();
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
await executeWait(call, options);
|
|
786
|
+
if (result === void 0) throw new Error("operation completed without a result.");
|
|
787
|
+
return result;
|
|
788
|
+
}
|
|
789
|
+
/** Checks whether the operation has reached a terminal state. */
|
|
790
|
+
async done(options) {
|
|
791
|
+
const status = (await this.client.genieGetConversationMessage({
|
|
792
|
+
messageId: this.messageId,
|
|
793
|
+
conversationId: this.conversationId,
|
|
794
|
+
spaceId: this.spaceId
|
|
795
|
+
}, options)).status;
|
|
796
|
+
if (status === void 0) throw new Error("response missing required status field");
|
|
797
|
+
switch (status) {
|
|
798
|
+
case MessageStatus_MessageStatus.COMPLETED:
|
|
799
|
+
case MessageStatus_MessageStatus.FAILED: return true;
|
|
800
|
+
default: return false;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
//#endregion
|
|
806
|
+
export { GenieClient, GenieCreateConversationMessageWaiter, GenieStartConversationWaiter };
|
|
1052
807
|
//# sourceMappingURL=client.js.map
|