@databricks/sdk-genie 0.1.0-dev.1 → 0.1.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v1/client.d.ts +9 -8
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +36 -53
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +1 -1
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +1 -1
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +3 -5
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts +14 -2
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +19 -1
- package/dist/v1/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/v1/client.ts +74 -91
- package/src/v1/index.ts +1 -1
- package/src/v1/transport.ts +3 -5
- package/src/v1/utils.ts +27 -3
package/src/v1/client.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
|
|
4
|
-
import type {Call} from '@databricks/sdk-core/api';
|
|
5
|
-
import {retryOn} from '@databricks/sdk-core/api';
|
|
6
4
|
import {createDefault} from '@databricks/sdk-core/clientinfo';
|
|
7
5
|
import type {Logger} from '@databricks/sdk-core/logger';
|
|
8
6
|
import {NoOpLogger} from '@databricks/sdk-core/logger';
|
|
9
7
|
import type {CallOptions} from '@databricks/sdk-options/call';
|
|
10
8
|
import type {ClientOptions} from '@databricks/sdk-options/client';
|
|
9
|
+
import type {LroOptions} from '@databricks/sdk-options/lro';
|
|
11
10
|
import type {HttpClient} from '@databricks/sdk-core/http';
|
|
12
11
|
import {newHttpClient} from './transport';
|
|
13
12
|
import {
|
|
@@ -16,6 +15,8 @@ import {
|
|
|
16
15
|
executeHttpCall,
|
|
17
16
|
marshalRequest,
|
|
18
17
|
parseResponse,
|
|
18
|
+
executeWait,
|
|
19
|
+
StillRunningError,
|
|
19
20
|
} from './utils';
|
|
20
21
|
import pkgJson from '../../package.json' with {type: 'json'};
|
|
21
22
|
import type {
|
|
@@ -100,9 +101,7 @@ const PACKAGE_SEGMENT = {
|
|
|
100
101
|
value: pkgJson.version,
|
|
101
102
|
};
|
|
102
103
|
|
|
103
|
-
class
|
|
104
|
-
|
|
105
|
-
export class Client {
|
|
104
|
+
export class GenieClient {
|
|
106
105
|
private readonly host: string;
|
|
107
106
|
// Workspace ID used to route workspace-level calls on unified hosts (SPOG).
|
|
108
107
|
// When set, workspace-level methods send X-Databricks-Org-Id on every
|
|
@@ -122,12 +121,10 @@ export class Client {
|
|
|
122
121
|
this.host = options.host.replace(/\/$/, '');
|
|
123
122
|
this.workspaceId = options.workspaceId;
|
|
124
123
|
this.logger = options.logger ?? new NoOpLogger();
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
.with({key: 'auth', value: options.credentials.name()});
|
|
130
|
-
}
|
|
124
|
+
const info = createDefault()
|
|
125
|
+
.with(PACKAGE_SEGMENT)
|
|
126
|
+
.with({key: 'sdk-js-auth', value: AUTH_VERSION})
|
|
127
|
+
.with({key: 'auth', value: options.credentials?.name() ?? 'default'});
|
|
131
128
|
this.userAgent = info.toString();
|
|
132
129
|
this.httpClient = newHttpClient(options);
|
|
133
130
|
}
|
|
@@ -140,7 +137,7 @@ export class Client {
|
|
|
140
137
|
const url = `${this.host}/api/2.0/genie/spaces`;
|
|
141
138
|
const body = marshalRequest(req, marshalGenieCreateSpaceRequestSchema);
|
|
142
139
|
let resp: GenieSpace | undefined;
|
|
143
|
-
const call
|
|
140
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
144
141
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
145
142
|
if (this.workspaceId !== undefined) {
|
|
146
143
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -156,7 +153,7 @@ export class Client {
|
|
|
156
153
|
};
|
|
157
154
|
await executeCall(call, options);
|
|
158
155
|
if (resp === undefined) {
|
|
159
|
-
throw new Error('
|
|
156
|
+
throw new Error('operation completed without a result.');
|
|
160
157
|
}
|
|
161
158
|
return resp;
|
|
162
159
|
}
|
|
@@ -165,7 +162,7 @@ export class Client {
|
|
|
165
162
|
* Create new message in a [conversation](:method:genie/startconversation).
|
|
166
163
|
* The AI response uses all previously created messages in the conversation to respond.
|
|
167
164
|
*/
|
|
168
|
-
async genieCreateConversationMessage(
|
|
165
|
+
private async genieCreateConversationMessage(
|
|
169
166
|
req: GenieCreateConversationMessageRequest,
|
|
170
167
|
options?: CallOptions
|
|
171
168
|
): Promise<GenieMessage> {
|
|
@@ -175,7 +172,7 @@ export class Client {
|
|
|
175
172
|
marshalGenieCreateConversationMessageRequestSchema
|
|
176
173
|
);
|
|
177
174
|
let resp: GenieMessage | undefined;
|
|
178
|
-
const call
|
|
175
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
179
176
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
180
177
|
if (this.workspaceId !== undefined) {
|
|
181
178
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -191,7 +188,7 @@ export class Client {
|
|
|
191
188
|
};
|
|
192
189
|
await executeCall(call, options);
|
|
193
190
|
if (resp === undefined) {
|
|
194
|
-
throw new Error('
|
|
191
|
+
throw new Error('operation completed without a result.');
|
|
195
192
|
}
|
|
196
193
|
return resp;
|
|
197
194
|
}
|
|
@@ -230,7 +227,7 @@ export class Client {
|
|
|
230
227
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/eval-runs`;
|
|
231
228
|
const body = marshalRequest(req, marshalGenieCreateEvalRunRequestSchema);
|
|
232
229
|
let resp: GenieEvalRunResponse | undefined;
|
|
233
|
-
const call
|
|
230
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
234
231
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
235
232
|
if (this.workspaceId !== undefined) {
|
|
236
233
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -246,7 +243,7 @@ export class Client {
|
|
|
246
243
|
};
|
|
247
244
|
await executeCall(call, options);
|
|
248
245
|
if (resp === undefined) {
|
|
249
|
-
throw new Error('
|
|
246
|
+
throw new Error('operation completed without a result.');
|
|
250
247
|
}
|
|
251
248
|
return resp;
|
|
252
249
|
}
|
|
@@ -262,7 +259,7 @@ export class Client {
|
|
|
262
259
|
marshalGenieCreateMessageCommentRequestSchema
|
|
263
260
|
);
|
|
264
261
|
let resp: GenieMessageComment | undefined;
|
|
265
|
-
const call
|
|
262
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
266
263
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
267
264
|
if (this.workspaceId !== undefined) {
|
|
268
265
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -278,7 +275,7 @@ export class Client {
|
|
|
278
275
|
};
|
|
279
276
|
await executeCall(call, options);
|
|
280
277
|
if (resp === undefined) {
|
|
281
|
-
throw new Error('
|
|
278
|
+
throw new Error('operation completed without a result.');
|
|
282
279
|
}
|
|
283
280
|
return resp;
|
|
284
281
|
}
|
|
@@ -289,7 +286,7 @@ export class Client {
|
|
|
289
286
|
options?: CallOptions
|
|
290
287
|
): Promise<void> {
|
|
291
288
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/conversations/${req.conversationId ?? ''}`;
|
|
292
|
-
const call
|
|
289
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
293
290
|
const headers = new Headers();
|
|
294
291
|
if (this.workspaceId !== undefined) {
|
|
295
292
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -311,7 +308,7 @@ export class Client {
|
|
|
311
308
|
options?: CallOptions
|
|
312
309
|
): Promise<void> {
|
|
313
310
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/conversations/${req.conversationId ?? ''}/messages/${req.messageId ?? ''}`;
|
|
314
|
-
const call
|
|
311
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
315
312
|
const headers = new Headers();
|
|
316
313
|
if (this.workspaceId !== undefined) {
|
|
317
314
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -338,7 +335,7 @@ export class Client {
|
|
|
338
335
|
marshalGenieExecuteMessageAttachmentQueryRequestSchema
|
|
339
336
|
);
|
|
340
337
|
let resp: GenieGetMessageQueryResultResponse | undefined;
|
|
341
|
-
const call
|
|
338
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
342
339
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
343
340
|
if (this.workspaceId !== undefined) {
|
|
344
341
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -357,7 +354,7 @@ export class Client {
|
|
|
357
354
|
};
|
|
358
355
|
await executeCall(call, options);
|
|
359
356
|
if (resp === undefined) {
|
|
360
|
-
throw new Error('
|
|
357
|
+
throw new Error('operation completed without a result.');
|
|
361
358
|
}
|
|
362
359
|
return resp;
|
|
363
360
|
}
|
|
@@ -373,7 +370,7 @@ export class Client {
|
|
|
373
370
|
marshalGenieExecuteMessageQueryRequestSchema
|
|
374
371
|
);
|
|
375
372
|
let resp: GenieGetMessageQueryResultResponse | undefined;
|
|
376
|
-
const call
|
|
373
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
377
374
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
378
375
|
if (this.workspaceId !== undefined) {
|
|
379
376
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -392,7 +389,7 @@ export class Client {
|
|
|
392
389
|
};
|
|
393
390
|
await executeCall(call, options);
|
|
394
391
|
if (resp === undefined) {
|
|
395
|
-
throw new Error('
|
|
392
|
+
throw new Error('operation completed without a result.');
|
|
396
393
|
}
|
|
397
394
|
return resp;
|
|
398
395
|
}
|
|
@@ -432,7 +429,7 @@ export class Client {
|
|
|
432
429
|
marshalGenieGenerateDownloadFullQueryResultRequestSchema
|
|
433
430
|
);
|
|
434
431
|
let resp: GenieGenerateDownloadFullQueryResultResponse | undefined;
|
|
435
|
-
const call
|
|
432
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
436
433
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
437
434
|
if (this.workspaceId !== undefined) {
|
|
438
435
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -451,7 +448,7 @@ export class Client {
|
|
|
451
448
|
};
|
|
452
449
|
await executeCall(call, options);
|
|
453
450
|
if (resp === undefined) {
|
|
454
|
-
throw new Error('
|
|
451
|
+
throw new Error('operation completed without a result.');
|
|
455
452
|
}
|
|
456
453
|
return resp;
|
|
457
454
|
}
|
|
@@ -463,7 +460,7 @@ export class Client {
|
|
|
463
460
|
): Promise<GenieMessage> {
|
|
464
461
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/conversations/${req.conversationId ?? ''}/messages/${req.messageId ?? ''}`;
|
|
465
462
|
let resp: GenieMessage | undefined;
|
|
466
|
-
const call
|
|
463
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
467
464
|
const headers = new Headers();
|
|
468
465
|
if (this.workspaceId !== undefined) {
|
|
469
466
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -479,7 +476,7 @@ export class Client {
|
|
|
479
476
|
};
|
|
480
477
|
await executeCall(call, options);
|
|
481
478
|
if (resp === undefined) {
|
|
482
|
-
throw new Error('
|
|
479
|
+
throw new Error('operation completed without a result.');
|
|
483
480
|
}
|
|
484
481
|
return resp;
|
|
485
482
|
}
|
|
@@ -521,7 +518,7 @@ export class Client {
|
|
|
521
518
|
const query = params.toString();
|
|
522
519
|
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
523
520
|
let resp: GenieGetDownloadFullQueryResultResponse | undefined;
|
|
524
|
-
const call
|
|
521
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
525
522
|
const headers = new Headers();
|
|
526
523
|
if (this.workspaceId !== undefined) {
|
|
527
524
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -540,7 +537,7 @@ export class Client {
|
|
|
540
537
|
};
|
|
541
538
|
await executeCall(call, options);
|
|
542
539
|
if (resp === undefined) {
|
|
543
|
-
throw new Error('
|
|
540
|
+
throw new Error('operation completed without a result.');
|
|
544
541
|
}
|
|
545
542
|
return resp;
|
|
546
543
|
}
|
|
@@ -552,7 +549,7 @@ export class Client {
|
|
|
552
549
|
): Promise<GenieEvalResultDetails> {
|
|
553
550
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/eval-runs/${req.evalRunId ?? ''}/results/${req.resultId ?? ''}`;
|
|
554
551
|
let resp: GenieEvalResultDetails | undefined;
|
|
555
|
-
const call
|
|
552
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
556
553
|
const headers = new Headers();
|
|
557
554
|
if (this.workspaceId !== undefined) {
|
|
558
555
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -568,7 +565,7 @@ export class Client {
|
|
|
568
565
|
};
|
|
569
566
|
await executeCall(call, options);
|
|
570
567
|
if (resp === undefined) {
|
|
571
|
-
throw new Error('
|
|
568
|
+
throw new Error('operation completed without a result.');
|
|
572
569
|
}
|
|
573
570
|
return resp;
|
|
574
571
|
}
|
|
@@ -580,7 +577,7 @@ export class Client {
|
|
|
580
577
|
): Promise<GenieEvalRunResponse> {
|
|
581
578
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/eval-runs/${req.evalRunId ?? ''}`;
|
|
582
579
|
let resp: GenieEvalRunResponse | undefined;
|
|
583
|
-
const call
|
|
580
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
584
581
|
const headers = new Headers();
|
|
585
582
|
if (this.workspaceId !== undefined) {
|
|
586
583
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -596,7 +593,7 @@ export class Client {
|
|
|
596
593
|
};
|
|
597
594
|
await executeCall(call, options);
|
|
598
595
|
if (resp === undefined) {
|
|
599
|
-
throw new Error('
|
|
596
|
+
throw new Error('operation completed without a result.');
|
|
600
597
|
}
|
|
601
598
|
return resp;
|
|
602
599
|
}
|
|
@@ -611,7 +608,7 @@ export class Client {
|
|
|
611
608
|
): Promise<GenieGetMessageQueryResultResponse> {
|
|
612
609
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/conversations/${req.conversationId ?? ''}/messages/${req.messageId ?? ''}/attachments/${req.attachmentId ?? ''}/query-result`;
|
|
613
610
|
let resp: GenieGetMessageQueryResultResponse | undefined;
|
|
614
|
-
const call
|
|
611
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
615
612
|
const headers = new Headers();
|
|
616
613
|
if (this.workspaceId !== undefined) {
|
|
617
614
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -630,7 +627,7 @@ export class Client {
|
|
|
630
627
|
};
|
|
631
628
|
await executeCall(call, options);
|
|
632
629
|
if (resp === undefined) {
|
|
633
|
-
throw new Error('
|
|
630
|
+
throw new Error('operation completed without a result.');
|
|
634
631
|
}
|
|
635
632
|
return resp;
|
|
636
633
|
}
|
|
@@ -642,7 +639,7 @@ export class Client {
|
|
|
642
639
|
): Promise<GenieGetMessageQueryResultResponse> {
|
|
643
640
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/conversations/${req.conversationId ?? ''}/messages/${req.messageId ?? ''}/query-result`;
|
|
644
641
|
let resp: GenieGetMessageQueryResultResponse | undefined;
|
|
645
|
-
const call
|
|
642
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
646
643
|
const headers = new Headers();
|
|
647
644
|
if (this.workspaceId !== undefined) {
|
|
648
645
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -661,7 +658,7 @@ export class Client {
|
|
|
661
658
|
};
|
|
662
659
|
await executeCall(call, options);
|
|
663
660
|
if (resp === undefined) {
|
|
664
|
-
throw new Error('
|
|
661
|
+
throw new Error('operation completed without a result.');
|
|
665
662
|
}
|
|
666
663
|
return resp;
|
|
667
664
|
}
|
|
@@ -673,7 +670,7 @@ export class Client {
|
|
|
673
670
|
): Promise<GenieGetMessageQueryResultResponse> {
|
|
674
671
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}/conversations/${req.conversationId ?? ''}/messages/${req.messageId ?? ''}/query-result/${req.attachmentId ?? ''}`;
|
|
675
672
|
let resp: GenieGetMessageQueryResultResponse | undefined;
|
|
676
|
-
const call
|
|
673
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
677
674
|
const headers = new Headers();
|
|
678
675
|
if (this.workspaceId !== undefined) {
|
|
679
676
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -692,7 +689,7 @@ export class Client {
|
|
|
692
689
|
};
|
|
693
690
|
await executeCall(call, options);
|
|
694
691
|
if (resp === undefined) {
|
|
695
|
-
throw new Error('
|
|
692
|
+
throw new Error('operation completed without a result.');
|
|
696
693
|
}
|
|
697
694
|
return resp;
|
|
698
695
|
}
|
|
@@ -713,7 +710,7 @@ export class Client {
|
|
|
713
710
|
const query = params.toString();
|
|
714
711
|
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
715
712
|
let resp: GenieSpace | undefined;
|
|
716
|
-
const call
|
|
713
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
717
714
|
const headers = new Headers();
|
|
718
715
|
if (this.workspaceId !== undefined) {
|
|
719
716
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -729,7 +726,7 @@ export class Client {
|
|
|
729
726
|
};
|
|
730
727
|
await executeCall(call, options);
|
|
731
728
|
if (resp === undefined) {
|
|
732
|
-
throw new Error('
|
|
729
|
+
throw new Error('operation completed without a result.');
|
|
733
730
|
}
|
|
734
731
|
return resp;
|
|
735
732
|
}
|
|
@@ -750,7 +747,7 @@ export class Client {
|
|
|
750
747
|
const query = params.toString();
|
|
751
748
|
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
752
749
|
let resp: GenieListConversationCommentsResponse | undefined;
|
|
753
|
-
const call
|
|
750
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
754
751
|
const headers = new Headers();
|
|
755
752
|
if (this.workspaceId !== undefined) {
|
|
756
753
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -769,7 +766,7 @@ export class Client {
|
|
|
769
766
|
};
|
|
770
767
|
await executeCall(call, options);
|
|
771
768
|
if (resp === undefined) {
|
|
772
|
-
throw new Error('
|
|
769
|
+
throw new Error('operation completed without a result.');
|
|
773
770
|
}
|
|
774
771
|
return resp;
|
|
775
772
|
}
|
|
@@ -790,7 +787,7 @@ export class Client {
|
|
|
790
787
|
const query = params.toString();
|
|
791
788
|
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
792
789
|
let resp: GenieListConversationMessagesResponse | undefined;
|
|
793
|
-
const call
|
|
790
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
794
791
|
const headers = new Headers();
|
|
795
792
|
if (this.workspaceId !== undefined) {
|
|
796
793
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -809,7 +806,7 @@ export class Client {
|
|
|
809
806
|
};
|
|
810
807
|
await executeCall(call, options);
|
|
811
808
|
if (resp === undefined) {
|
|
812
|
-
throw new Error('
|
|
809
|
+
throw new Error('operation completed without a result.');
|
|
813
810
|
}
|
|
814
811
|
return resp;
|
|
815
812
|
}
|
|
@@ -833,7 +830,7 @@ export class Client {
|
|
|
833
830
|
const query = params.toString();
|
|
834
831
|
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
835
832
|
let resp: GenieListConversationsResponse | undefined;
|
|
836
|
-
const call
|
|
833
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
837
834
|
const headers = new Headers();
|
|
838
835
|
if (this.workspaceId !== undefined) {
|
|
839
836
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -852,7 +849,7 @@ export class Client {
|
|
|
852
849
|
};
|
|
853
850
|
await executeCall(call, options);
|
|
854
851
|
if (resp === undefined) {
|
|
855
|
-
throw new Error('
|
|
852
|
+
throw new Error('operation completed without a result.');
|
|
856
853
|
}
|
|
857
854
|
return resp;
|
|
858
855
|
}
|
|
@@ -873,7 +870,7 @@ export class Client {
|
|
|
873
870
|
const query = params.toString();
|
|
874
871
|
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
875
872
|
let resp: GenieListEvalResultsResponse | undefined;
|
|
876
|
-
const call
|
|
873
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
877
874
|
const headers = new Headers();
|
|
878
875
|
if (this.workspaceId !== undefined) {
|
|
879
876
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -892,7 +889,7 @@ export class Client {
|
|
|
892
889
|
};
|
|
893
890
|
await executeCall(call, options);
|
|
894
891
|
if (resp === undefined) {
|
|
895
|
-
throw new Error('
|
|
892
|
+
throw new Error('operation completed without a result.');
|
|
896
893
|
}
|
|
897
894
|
return resp;
|
|
898
895
|
}
|
|
@@ -913,7 +910,7 @@ export class Client {
|
|
|
913
910
|
const query = params.toString();
|
|
914
911
|
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
915
912
|
let resp: GenieListEvalRunsResponse | undefined;
|
|
916
|
-
const call
|
|
913
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
917
914
|
const headers = new Headers();
|
|
918
915
|
if (this.workspaceId !== undefined) {
|
|
919
916
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -929,7 +926,7 @@ export class Client {
|
|
|
929
926
|
};
|
|
930
927
|
await executeCall(call, options);
|
|
931
928
|
if (resp === undefined) {
|
|
932
|
-
throw new Error('
|
|
929
|
+
throw new Error('operation completed without a result.');
|
|
933
930
|
}
|
|
934
931
|
return resp;
|
|
935
932
|
}
|
|
@@ -950,7 +947,7 @@ export class Client {
|
|
|
950
947
|
const query = params.toString();
|
|
951
948
|
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
952
949
|
let resp: GenieListMessageCommentsResponse | undefined;
|
|
953
|
-
const call
|
|
950
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
954
951
|
const headers = new Headers();
|
|
955
952
|
if (this.workspaceId !== undefined) {
|
|
956
953
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -969,7 +966,7 @@ export class Client {
|
|
|
969
966
|
};
|
|
970
967
|
await executeCall(call, options);
|
|
971
968
|
if (resp === undefined) {
|
|
972
|
-
throw new Error('
|
|
969
|
+
throw new Error('operation completed without a result.');
|
|
973
970
|
}
|
|
974
971
|
return resp;
|
|
975
972
|
}
|
|
@@ -990,7 +987,7 @@ export class Client {
|
|
|
990
987
|
const query = params.toString();
|
|
991
988
|
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
992
989
|
let resp: GenieListSpacesResponse | undefined;
|
|
993
|
-
const call
|
|
990
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
994
991
|
const headers = new Headers();
|
|
995
992
|
if (this.workspaceId !== undefined) {
|
|
996
993
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -1006,7 +1003,7 @@ export class Client {
|
|
|
1006
1003
|
};
|
|
1007
1004
|
await executeCall(call, options);
|
|
1008
1005
|
if (resp === undefined) {
|
|
1009
|
-
throw new Error('
|
|
1006
|
+
throw new Error('operation completed without a result.');
|
|
1010
1007
|
}
|
|
1011
1008
|
return resp;
|
|
1012
1009
|
}
|
|
@@ -1021,7 +1018,7 @@ export class Client {
|
|
|
1021
1018
|
req,
|
|
1022
1019
|
marshalGenieSendMessageFeedbackRequestSchema
|
|
1023
1020
|
);
|
|
1024
|
-
const call
|
|
1021
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1025
1022
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
1026
1023
|
if (this.workspaceId !== undefined) {
|
|
1027
1024
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -1038,7 +1035,7 @@ export class Client {
|
|
|
1038
1035
|
}
|
|
1039
1036
|
|
|
1040
1037
|
/** Start a new conversation. */
|
|
1041
|
-
async genieStartConversation(
|
|
1038
|
+
private async genieStartConversation(
|
|
1042
1039
|
req: GenieStartConversationMessageRequest,
|
|
1043
1040
|
options?: CallOptions
|
|
1044
1041
|
): Promise<GenieStartConversationResponse> {
|
|
@@ -1048,7 +1045,7 @@ export class Client {
|
|
|
1048
1045
|
marshalGenieStartConversationMessageRequestSchema
|
|
1049
1046
|
);
|
|
1050
1047
|
let resp: GenieStartConversationResponse | undefined;
|
|
1051
|
-
const call
|
|
1048
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1052
1049
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
1053
1050
|
if (this.workspaceId !== undefined) {
|
|
1054
1051
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -1067,7 +1064,7 @@ export class Client {
|
|
|
1067
1064
|
};
|
|
1068
1065
|
await executeCall(call, options);
|
|
1069
1066
|
if (resp === undefined) {
|
|
1070
|
-
throw new Error('
|
|
1067
|
+
throw new Error('operation completed without a result.');
|
|
1071
1068
|
}
|
|
1072
1069
|
return resp;
|
|
1073
1070
|
}
|
|
@@ -1104,7 +1101,7 @@ export class Client {
|
|
|
1104
1101
|
options?: CallOptions
|
|
1105
1102
|
): Promise<void> {
|
|
1106
1103
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}`;
|
|
1107
|
-
const call
|
|
1104
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1108
1105
|
const headers = new Headers();
|
|
1109
1106
|
if (this.workspaceId !== undefined) {
|
|
1110
1107
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -1128,7 +1125,7 @@ export class Client {
|
|
|
1128
1125
|
const url = `${this.host}/api/2.0/genie/spaces/${req.spaceId ?? ''}`;
|
|
1129
1126
|
const body = marshalRequest(req, marshalGenieUpdateSpaceRequestSchema);
|
|
1130
1127
|
let resp: GenieSpace | undefined;
|
|
1131
|
-
const call
|
|
1128
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1132
1129
|
const headers = new Headers({'Content-Type': 'application/json'});
|
|
1133
1130
|
if (this.workspaceId !== undefined) {
|
|
1134
1131
|
headers.set('X-Databricks-Org-Id', this.workspaceId);
|
|
@@ -1144,7 +1141,7 @@ export class Client {
|
|
|
1144
1141
|
};
|
|
1145
1142
|
await executeCall(call, options);
|
|
1146
1143
|
if (resp === undefined) {
|
|
1147
|
-
throw new Error('
|
|
1144
|
+
throw new Error('operation completed without a result.');
|
|
1148
1145
|
}
|
|
1149
1146
|
return resp;
|
|
1150
1147
|
}
|
|
@@ -1152,7 +1149,7 @@ export class Client {
|
|
|
1152
1149
|
|
|
1153
1150
|
export class GenieCreateConversationMessageWaiter {
|
|
1154
1151
|
constructor(
|
|
1155
|
-
private readonly client:
|
|
1152
|
+
private readonly client: GenieClient,
|
|
1156
1153
|
readonly messageId: string,
|
|
1157
1154
|
readonly conversationId: string,
|
|
1158
1155
|
readonly spaceId: string
|
|
@@ -1163,17 +1160,17 @@ export class GenieCreateConversationMessageWaiter {
|
|
|
1163
1160
|
*
|
|
1164
1161
|
* Throws if a failure state is reached.
|
|
1165
1162
|
*/
|
|
1166
|
-
async wait(options?:
|
|
1163
|
+
async wait(options?: LroOptions): Promise<GenieMessage> {
|
|
1167
1164
|
let result: GenieMessage | undefined;
|
|
1168
1165
|
|
|
1169
|
-
const call
|
|
1166
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1170
1167
|
const pollResp = await this.client.genieGetConversationMessage(
|
|
1171
1168
|
{
|
|
1172
1169
|
messageId: this.messageId,
|
|
1173
1170
|
conversationId: this.conversationId,
|
|
1174
1171
|
spaceId: this.spaceId,
|
|
1175
1172
|
},
|
|
1176
|
-
|
|
1173
|
+
callSignal !== undefined ? {signal: callSignal} : undefined
|
|
1177
1174
|
);
|
|
1178
1175
|
|
|
1179
1176
|
const status = pollResp.status;
|
|
@@ -1194,16 +1191,9 @@ export class GenieCreateConversationMessageWaiter {
|
|
|
1194
1191
|
}
|
|
1195
1192
|
};
|
|
1196
1193
|
|
|
1197
|
-
|
|
1198
|
-
...(options?.signal !== undefined && {signal: options.signal}),
|
|
1199
|
-
retrier: () =>
|
|
1200
|
-
retryOn({}, (err: Error) => {
|
|
1201
|
-
return err instanceof StillRunningError;
|
|
1202
|
-
}),
|
|
1203
|
-
};
|
|
1204
|
-
await executeCall(call, retryOptions);
|
|
1194
|
+
await executeWait(call, options);
|
|
1205
1195
|
if (result === undefined) {
|
|
1206
|
-
throw new Error('
|
|
1196
|
+
throw new Error('operation completed without a result.');
|
|
1207
1197
|
}
|
|
1208
1198
|
return result;
|
|
1209
1199
|
}
|
|
@@ -1236,7 +1226,7 @@ export class GenieCreateConversationMessageWaiter {
|
|
|
1236
1226
|
|
|
1237
1227
|
export class GenieStartConversationWaiter {
|
|
1238
1228
|
constructor(
|
|
1239
|
-
private readonly client:
|
|
1229
|
+
private readonly client: GenieClient,
|
|
1240
1230
|
readonly messageId: string,
|
|
1241
1231
|
readonly conversationId: string,
|
|
1242
1232
|
readonly spaceId: string
|
|
@@ -1247,17 +1237,17 @@ export class GenieStartConversationWaiter {
|
|
|
1247
1237
|
*
|
|
1248
1238
|
* Throws if a failure state is reached.
|
|
1249
1239
|
*/
|
|
1250
|
-
async wait(options?:
|
|
1240
|
+
async wait(options?: LroOptions): Promise<GenieMessage> {
|
|
1251
1241
|
let result: GenieMessage | undefined;
|
|
1252
1242
|
|
|
1253
|
-
const call
|
|
1243
|
+
const call = async (callSignal?: AbortSignal): Promise<void> => {
|
|
1254
1244
|
const pollResp = await this.client.genieGetConversationMessage(
|
|
1255
1245
|
{
|
|
1256
1246
|
messageId: this.messageId,
|
|
1257
1247
|
conversationId: this.conversationId,
|
|
1258
1248
|
spaceId: this.spaceId,
|
|
1259
1249
|
},
|
|
1260
|
-
|
|
1250
|
+
callSignal !== undefined ? {signal: callSignal} : undefined
|
|
1261
1251
|
);
|
|
1262
1252
|
|
|
1263
1253
|
const status = pollResp.status;
|
|
@@ -1278,16 +1268,9 @@ export class GenieStartConversationWaiter {
|
|
|
1278
1268
|
}
|
|
1279
1269
|
};
|
|
1280
1270
|
|
|
1281
|
-
|
|
1282
|
-
...(options?.signal !== undefined && {signal: options.signal}),
|
|
1283
|
-
retrier: () =>
|
|
1284
|
-
retryOn({}, (err: Error) => {
|
|
1285
|
-
return err instanceof StillRunningError;
|
|
1286
|
-
}),
|
|
1287
|
-
};
|
|
1288
|
-
await executeCall(call, retryOptions);
|
|
1271
|
+
await executeWait(call, options);
|
|
1289
1272
|
if (result === undefined) {
|
|
1290
|
-
throw new Error('
|
|
1273
|
+
throw new Error('operation completed without a result.');
|
|
1291
1274
|
}
|
|
1292
1275
|
return result;
|
|
1293
1276
|
}
|
package/src/v1/index.ts
CHANGED
package/src/v1/transport.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import type {Credentials} from '@databricks/sdk-auth';
|
|
4
|
+
import {defaultCredentials} from '@databricks/sdk-auth/credentials';
|
|
4
5
|
import type {
|
|
5
6
|
HttpClient,
|
|
6
7
|
HttpRequest,
|
|
@@ -24,13 +25,10 @@ export function newHttpClient(options?: ClientOptions): HttpClient {
|
|
|
24
25
|
return opts.httpClient;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
// TODO: Load default credentials from profile.
|
|
29
|
-
throw new Error('no credentials provided');
|
|
30
|
-
}
|
|
28
|
+
const credentials = opts.credentials ?? defaultCredentials();
|
|
31
29
|
|
|
32
30
|
const base = newFetchHttpClient();
|
|
33
|
-
let client: HttpClient = new AuthHttpClient(base,
|
|
31
|
+
let client: HttpClient = new AuthHttpClient(base, credentials);
|
|
34
32
|
|
|
35
33
|
if (opts.timeout !== undefined) {
|
|
36
34
|
client = new TimeoutHttpClient(client, opts.timeout);
|