@databricks/sdk-supervisoragents 0.0.0-dev → 0.1.0-dev.2

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.
@@ -0,0 +1,633 @@
1
+ // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
+
3
+ import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
4
+ import {createDefault} from '@databricks/sdk-core/clientinfo';
5
+ import type {Logger} from '@databricks/sdk-core/logger';
6
+ import {NoOpLogger} from '@databricks/sdk-core/logger';
7
+ import type {CallOptions} from '@databricks/sdk-options/call';
8
+ import type {ClientOptions} from '@databricks/sdk-options/client';
9
+ import type {HttpClient} from '@databricks/sdk-core/http';
10
+ import {newHttpClient} from './transport';
11
+ import {
12
+ buildHttpRequest,
13
+ executeCall,
14
+ executeHttpCall,
15
+ marshalRequest,
16
+ parseResponse,
17
+ } from './utils';
18
+ import pkgJson from '../../package.json' with {type: 'json'};
19
+ import type {
20
+ CreateExampleRequest,
21
+ CreateSupervisorAgentRequest,
22
+ CreateToolRequest,
23
+ DeleteExampleRequest,
24
+ DeleteSupervisorAgentRequest,
25
+ DeleteToolRequest,
26
+ Example,
27
+ GetExampleRequest,
28
+ GetSupervisorAgentRequest,
29
+ GetToolRequest,
30
+ ListExamplesRequest,
31
+ ListExamplesResponse,
32
+ ListSupervisorAgentsRequest,
33
+ ListSupervisorAgentsResponse,
34
+ ListToolsRequest,
35
+ ListToolsResponse,
36
+ SupervisorAgent,
37
+ Tool,
38
+ UpdateExampleRequest,
39
+ UpdateSupervisorAgentRequest,
40
+ UpdateToolRequest,
41
+ } from './model';
42
+ import {
43
+ marshalExampleSchema,
44
+ marshalSupervisorAgentSchema,
45
+ marshalToolSchema,
46
+ unmarshalExampleSchema,
47
+ unmarshalListExamplesResponseSchema,
48
+ unmarshalListSupervisorAgentsResponseSchema,
49
+ unmarshalListToolsResponseSchema,
50
+ unmarshalSupervisorAgentSchema,
51
+ unmarshalToolSchema,
52
+ } from './model';
53
+
54
+ // Package identity segment for this client to be used in the User-Agent header.
55
+ const PACKAGE_SEGMENT = {
56
+ key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
57
+ value: pkgJson.version,
58
+ };
59
+
60
+ export class SupervisorAgentsClient {
61
+ private readonly host: string;
62
+ // Workspace ID used to route workspace-level calls on unified hosts (SPOG).
63
+ // When set, workspace-level methods send X-Databricks-Org-Id on every
64
+ // request.
65
+ private readonly workspaceId: string | undefined;
66
+ private readonly httpClient: HttpClient;
67
+ private readonly logger: Logger;
68
+ // User-Agent header value. Composed once at construction from
69
+ // createDefault() merged with this package's identity and the active
70
+ // credential's name.
71
+ private readonly userAgent: string;
72
+
73
+ constructor(options: ClientOptions) {
74
+ if (options.host === undefined) {
75
+ throw new Error('Host is required.');
76
+ }
77
+ this.host = options.host.replace(/\/$/, '');
78
+ this.workspaceId = options.workspaceId;
79
+ this.logger = options.logger ?? new NoOpLogger();
80
+ const info = createDefault()
81
+ .with(PACKAGE_SEGMENT)
82
+ .with({key: 'sdk-js-auth', value: AUTH_VERSION})
83
+ .with({key: 'auth', value: options.credentials?.name() ?? 'default'});
84
+ this.userAgent = info.toString();
85
+ this.httpClient = newHttpClient(options);
86
+ }
87
+
88
+ /** Creates an example for a Supervisor Agent. */
89
+ async createExample(
90
+ req: CreateExampleRequest,
91
+ options?: CallOptions
92
+ ): Promise<Example> {
93
+ const url = `${this.host}/api/2.1/${req.parent ?? ''}/examples`;
94
+ const body = marshalRequest(req.example, marshalExampleSchema);
95
+ let resp: Example | undefined;
96
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
97
+ const headers = new Headers({'Content-Type': 'application/json'});
98
+ if (this.workspaceId !== undefined) {
99
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
100
+ }
101
+ headers.set('User-Agent', this.userAgent);
102
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
103
+ const respBody = await executeHttpCall({
104
+ request: httpReq,
105
+ httpClient: this.httpClient,
106
+ logger: this.logger,
107
+ });
108
+ resp = parseResponse(respBody, unmarshalExampleSchema);
109
+ };
110
+ await executeCall(call, options);
111
+ if (resp === undefined) {
112
+ throw new Error('operation completed without a result.');
113
+ }
114
+ return resp;
115
+ }
116
+
117
+ /** Creates a new Supervisor Agent. */
118
+ async createSupervisorAgent(
119
+ req: CreateSupervisorAgentRequest,
120
+ options?: CallOptions
121
+ ): Promise<SupervisorAgent> {
122
+ const url = `${this.host}/api/2.1/supervisor-agents`;
123
+ const body = marshalRequest(
124
+ req.supervisorAgent,
125
+ marshalSupervisorAgentSchema
126
+ );
127
+ let resp: SupervisorAgent | undefined;
128
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
129
+ const headers = new Headers({'Content-Type': 'application/json'});
130
+ if (this.workspaceId !== undefined) {
131
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
132
+ }
133
+ headers.set('User-Agent', this.userAgent);
134
+ const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
135
+ const respBody = await executeHttpCall({
136
+ request: httpReq,
137
+ httpClient: this.httpClient,
138
+ logger: this.logger,
139
+ });
140
+ resp = parseResponse(respBody, unmarshalSupervisorAgentSchema);
141
+ };
142
+ await executeCall(call, options);
143
+ if (resp === undefined) {
144
+ throw new Error('operation completed without a result.');
145
+ }
146
+ return resp;
147
+ }
148
+
149
+ /** Creates a Tool under a Supervisor Agent. Specify one of "genie_space", "knowledge_assistant", "uc_function", "uc_connection", "app", "volume", "dashboard", "table", "vector_search_index", "catalog", "schema", "supervisor_agent", "web_search", "skill" in the request body. The legacy values "lakeview_dashboard" and "uc_table" are also accepted and remain equivalent to "dashboard" and "table" respectively. */
150
+ async createTool(
151
+ req: CreateToolRequest,
152
+ options?: CallOptions
153
+ ): Promise<Tool> {
154
+ const url = `${this.host}/api/2.1/${req.parent ?? ''}/tools`;
155
+ const params = new URLSearchParams();
156
+ if (req.toolId !== undefined) {
157
+ params.append('tool_id', req.toolId);
158
+ }
159
+ const query = params.toString();
160
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
161
+ const body = marshalRequest(req.tool, marshalToolSchema);
162
+ let resp: Tool | undefined;
163
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
164
+ const headers = new Headers({'Content-Type': 'application/json'});
165
+ if (this.workspaceId !== undefined) {
166
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
167
+ }
168
+ headers.set('User-Agent', this.userAgent);
169
+ const httpReq = buildHttpRequest(
170
+ 'POST',
171
+ fullUrl,
172
+ headers,
173
+ callSignal,
174
+ body
175
+ );
176
+ const respBody = await executeHttpCall({
177
+ request: httpReq,
178
+ httpClient: this.httpClient,
179
+ logger: this.logger,
180
+ });
181
+ resp = parseResponse(respBody, unmarshalToolSchema);
182
+ };
183
+ await executeCall(call, options);
184
+ if (resp === undefined) {
185
+ throw new Error('operation completed without a result.');
186
+ }
187
+ return resp;
188
+ }
189
+
190
+ /** Deletes an example from a Supervisor Agent. */
191
+ async deleteExample(
192
+ req: DeleteExampleRequest,
193
+ options?: CallOptions
194
+ ): Promise<void> {
195
+ const url = `${this.host}/api/2.1/${req.name ?? ''}`;
196
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
197
+ const headers = new Headers();
198
+ if (this.workspaceId !== undefined) {
199
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
200
+ }
201
+ headers.set('User-Agent', this.userAgent);
202
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
203
+ await executeHttpCall({
204
+ request: httpReq,
205
+ httpClient: this.httpClient,
206
+ logger: this.logger,
207
+ });
208
+ };
209
+ await executeCall(call, options);
210
+ }
211
+
212
+ /** Deletes a Supervisor Agent. */
213
+ async deleteSupervisorAgent(
214
+ req: DeleteSupervisorAgentRequest,
215
+ options?: CallOptions
216
+ ): Promise<void> {
217
+ const url = `${this.host}/api/2.1/${req.name ?? ''}`;
218
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
219
+ const headers = new Headers();
220
+ if (this.workspaceId !== undefined) {
221
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
222
+ }
223
+ headers.set('User-Agent', this.userAgent);
224
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
225
+ await executeHttpCall({
226
+ request: httpReq,
227
+ httpClient: this.httpClient,
228
+ logger: this.logger,
229
+ });
230
+ };
231
+ await executeCall(call, options);
232
+ }
233
+
234
+ /** Deletes a Tool. */
235
+ async deleteTool(
236
+ req: DeleteToolRequest,
237
+ options?: CallOptions
238
+ ): Promise<void> {
239
+ const url = `${this.host}/api/2.1/${req.name ?? ''}`;
240
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
241
+ const headers = new Headers();
242
+ if (this.workspaceId !== undefined) {
243
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
244
+ }
245
+ headers.set('User-Agent', this.userAgent);
246
+ const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
247
+ await executeHttpCall({
248
+ request: httpReq,
249
+ httpClient: this.httpClient,
250
+ logger: this.logger,
251
+ });
252
+ };
253
+ await executeCall(call, options);
254
+ }
255
+
256
+ /** Gets an example from a Supervisor Agent. */
257
+ async getExample(
258
+ req: GetExampleRequest,
259
+ options?: CallOptions
260
+ ): Promise<Example> {
261
+ const url = `${this.host}/api/2.1/${req.name ?? ''}`;
262
+ let resp: Example | undefined;
263
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
264
+ const headers = new Headers();
265
+ if (this.workspaceId !== undefined) {
266
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
267
+ }
268
+ headers.set('User-Agent', this.userAgent);
269
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
270
+ const respBody = await executeHttpCall({
271
+ request: httpReq,
272
+ httpClient: this.httpClient,
273
+ logger: this.logger,
274
+ });
275
+ resp = parseResponse(respBody, unmarshalExampleSchema);
276
+ };
277
+ await executeCall(call, options);
278
+ if (resp === undefined) {
279
+ throw new Error('operation completed without a result.');
280
+ }
281
+ return resp;
282
+ }
283
+
284
+ /** Gets a Supervisor Agent. */
285
+ async getSupervisorAgent(
286
+ req: GetSupervisorAgentRequest,
287
+ options?: CallOptions
288
+ ): Promise<SupervisorAgent> {
289
+ const url = `${this.host}/api/2.1/${req.name ?? ''}`;
290
+ let resp: SupervisorAgent | undefined;
291
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
292
+ const headers = new Headers();
293
+ if (this.workspaceId !== undefined) {
294
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
295
+ }
296
+ headers.set('User-Agent', this.userAgent);
297
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
298
+ const respBody = await executeHttpCall({
299
+ request: httpReq,
300
+ httpClient: this.httpClient,
301
+ logger: this.logger,
302
+ });
303
+ resp = parseResponse(respBody, unmarshalSupervisorAgentSchema);
304
+ };
305
+ await executeCall(call, options);
306
+ if (resp === undefined) {
307
+ throw new Error('operation completed without a result.');
308
+ }
309
+ return resp;
310
+ }
311
+
312
+ /** Gets a Tool. */
313
+ async getTool(req: GetToolRequest, options?: CallOptions): Promise<Tool> {
314
+ const url = `${this.host}/api/2.1/${req.name ?? ''}`;
315
+ let resp: Tool | undefined;
316
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
317
+ const headers = new Headers();
318
+ if (this.workspaceId !== undefined) {
319
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
320
+ }
321
+ headers.set('User-Agent', this.userAgent);
322
+ const httpReq = buildHttpRequest('GET', url, headers, callSignal);
323
+ const respBody = await executeHttpCall({
324
+ request: httpReq,
325
+ httpClient: this.httpClient,
326
+ logger: this.logger,
327
+ });
328
+ resp = parseResponse(respBody, unmarshalToolSchema);
329
+ };
330
+ await executeCall(call, options);
331
+ if (resp === undefined) {
332
+ throw new Error('operation completed without a result.');
333
+ }
334
+ return resp;
335
+ }
336
+
337
+ /** Lists examples under a Supervisor Agent. */
338
+ async listExamples(
339
+ req: ListExamplesRequest,
340
+ options?: CallOptions
341
+ ): Promise<ListExamplesResponse> {
342
+ const url = `${this.host}/api/2.1/${req.parent ?? ''}/examples`;
343
+ const params = new URLSearchParams();
344
+ if (req.pageSize !== undefined) {
345
+ params.append('page_size', String(req.pageSize));
346
+ }
347
+ if (req.pageToken !== undefined) {
348
+ params.append('page_token', req.pageToken);
349
+ }
350
+ const query = params.toString();
351
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
352
+ let resp: ListExamplesResponse | undefined;
353
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
354
+ const headers = new Headers();
355
+ if (this.workspaceId !== undefined) {
356
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
357
+ }
358
+ headers.set('User-Agent', this.userAgent);
359
+ const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
360
+ const respBody = await executeHttpCall({
361
+ request: httpReq,
362
+ httpClient: this.httpClient,
363
+ logger: this.logger,
364
+ });
365
+ resp = parseResponse(respBody, unmarshalListExamplesResponseSchema);
366
+ };
367
+ await executeCall(call, options);
368
+ if (resp === undefined) {
369
+ throw new Error('operation completed without a result.');
370
+ }
371
+ return resp;
372
+ }
373
+
374
+ async *listExamplesIter(
375
+ req: ListExamplesRequest,
376
+ options?: CallOptions
377
+ ): AsyncGenerator<Example> {
378
+ const pageReq: ListExamplesRequest = {...req};
379
+ for (;;) {
380
+ const resp = await this.listExamples(pageReq, options);
381
+ for (const item of resp.examples ?? []) {
382
+ yield item;
383
+ }
384
+ if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
385
+ return;
386
+ }
387
+ pageReq.pageToken = resp.nextPageToken;
388
+ }
389
+ }
390
+
391
+ /** Lists Supervisor Agents. */
392
+ async listSupervisorAgents(
393
+ req: ListSupervisorAgentsRequest,
394
+ options?: CallOptions
395
+ ): Promise<ListSupervisorAgentsResponse> {
396
+ const url = `${this.host}/api/2.1/supervisor-agents`;
397
+ const params = new URLSearchParams();
398
+ if (req.pageSize !== undefined) {
399
+ params.append('page_size', String(req.pageSize));
400
+ }
401
+ if (req.pageToken !== undefined) {
402
+ params.append('page_token', req.pageToken);
403
+ }
404
+ const query = params.toString();
405
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
406
+ let resp: ListSupervisorAgentsResponse | undefined;
407
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
408
+ const headers = new Headers();
409
+ if (this.workspaceId !== undefined) {
410
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
411
+ }
412
+ headers.set('User-Agent', this.userAgent);
413
+ const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
414
+ const respBody = await executeHttpCall({
415
+ request: httpReq,
416
+ httpClient: this.httpClient,
417
+ logger: this.logger,
418
+ });
419
+ resp = parseResponse(
420
+ respBody,
421
+ unmarshalListSupervisorAgentsResponseSchema
422
+ );
423
+ };
424
+ await executeCall(call, options);
425
+ if (resp === undefined) {
426
+ throw new Error('operation completed without a result.');
427
+ }
428
+ return resp;
429
+ }
430
+
431
+ async *listSupervisorAgentsIter(
432
+ req: ListSupervisorAgentsRequest,
433
+ options?: CallOptions
434
+ ): AsyncGenerator<SupervisorAgent> {
435
+ const pageReq: ListSupervisorAgentsRequest = {...req};
436
+ for (;;) {
437
+ const resp = await this.listSupervisorAgents(pageReq, options);
438
+ for (const item of resp.supervisorAgents ?? []) {
439
+ yield item;
440
+ }
441
+ if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
442
+ return;
443
+ }
444
+ pageReq.pageToken = resp.nextPageToken;
445
+ }
446
+ }
447
+
448
+ /** Lists Tools under a Supervisor Agent. */
449
+ async listTools(
450
+ req: ListToolsRequest,
451
+ options?: CallOptions
452
+ ): Promise<ListToolsResponse> {
453
+ const url = `${this.host}/api/2.1/${req.parent ?? ''}/tools`;
454
+ const params = new URLSearchParams();
455
+ if (req.pageSize !== undefined) {
456
+ params.append('page_size', String(req.pageSize));
457
+ }
458
+ if (req.pageToken !== undefined) {
459
+ params.append('page_token', req.pageToken);
460
+ }
461
+ const query = params.toString();
462
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
463
+ let resp: ListToolsResponse | undefined;
464
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
465
+ const headers = new Headers();
466
+ if (this.workspaceId !== undefined) {
467
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
468
+ }
469
+ headers.set('User-Agent', this.userAgent);
470
+ const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
471
+ const respBody = await executeHttpCall({
472
+ request: httpReq,
473
+ httpClient: this.httpClient,
474
+ logger: this.logger,
475
+ });
476
+ resp = parseResponse(respBody, unmarshalListToolsResponseSchema);
477
+ };
478
+ await executeCall(call, options);
479
+ if (resp === undefined) {
480
+ throw new Error('operation completed without a result.');
481
+ }
482
+ return resp;
483
+ }
484
+
485
+ async *listToolsIter(
486
+ req: ListToolsRequest,
487
+ options?: CallOptions
488
+ ): AsyncGenerator<Tool> {
489
+ const pageReq: ListToolsRequest = {...req};
490
+ for (;;) {
491
+ const resp = await this.listTools(pageReq, options);
492
+ for (const item of resp.tools ?? []) {
493
+ yield item;
494
+ }
495
+ if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
496
+ return;
497
+ }
498
+ pageReq.pageToken = resp.nextPageToken;
499
+ }
500
+ }
501
+
502
+ /** Updates an example in a Supervisor Agent. */
503
+ async updateExample(
504
+ req: UpdateExampleRequest,
505
+ options?: CallOptions
506
+ ): Promise<Example> {
507
+ const url = `${this.host}/api/2.1/${req.name ?? ''}`;
508
+ const params = new URLSearchParams();
509
+ if (req.updateMask !== undefined) {
510
+ params.append('update_mask', req.updateMask.toString());
511
+ }
512
+ const query = params.toString();
513
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
514
+ const body = marshalRequest(req.example, marshalExampleSchema);
515
+ let resp: Example | undefined;
516
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
517
+ const headers = new Headers({'Content-Type': 'application/json'});
518
+ if (this.workspaceId !== undefined) {
519
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
520
+ }
521
+ headers.set('User-Agent', this.userAgent);
522
+ const httpReq = buildHttpRequest(
523
+ 'PATCH',
524
+ fullUrl,
525
+ headers,
526
+ callSignal,
527
+ body
528
+ );
529
+ const respBody = await executeHttpCall({
530
+ request: httpReq,
531
+ httpClient: this.httpClient,
532
+ logger: this.logger,
533
+ });
534
+ resp = parseResponse(respBody, unmarshalExampleSchema);
535
+ };
536
+ await executeCall(call, options);
537
+ if (resp === undefined) {
538
+ throw new Error('operation completed without a result.');
539
+ }
540
+ return resp;
541
+ }
542
+
543
+ /**
544
+ * Updates a Supervisor Agent. The fields that are required depend on the paths specified in `update_mask`.
545
+ * Only fields included in the mask will be updated.
546
+ */
547
+ async updateSupervisorAgent(
548
+ req: UpdateSupervisorAgentRequest,
549
+ options?: CallOptions
550
+ ): Promise<SupervisorAgent> {
551
+ const url = `${this.host}/api/2.1/${req.supervisorAgent?.name ?? ''}`;
552
+ const params = new URLSearchParams();
553
+ if (req.updateMask !== undefined) {
554
+ params.append('update_mask', req.updateMask.toString());
555
+ }
556
+ const query = params.toString();
557
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
558
+ const body = marshalRequest(
559
+ req.supervisorAgent,
560
+ marshalSupervisorAgentSchema
561
+ );
562
+ let resp: SupervisorAgent | undefined;
563
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
564
+ const headers = new Headers({'Content-Type': 'application/json'});
565
+ if (this.workspaceId !== undefined) {
566
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
567
+ }
568
+ headers.set('User-Agent', this.userAgent);
569
+ const httpReq = buildHttpRequest(
570
+ 'PATCH',
571
+ fullUrl,
572
+ headers,
573
+ callSignal,
574
+ body
575
+ );
576
+ const respBody = await executeHttpCall({
577
+ request: httpReq,
578
+ httpClient: this.httpClient,
579
+ logger: this.logger,
580
+ });
581
+ resp = parseResponse(respBody, unmarshalSupervisorAgentSchema);
582
+ };
583
+ await executeCall(call, options);
584
+ if (resp === undefined) {
585
+ throw new Error('operation completed without a result.');
586
+ }
587
+ return resp;
588
+ }
589
+
590
+ /**
591
+ * Updates a Tool. Only the `description` field can be updated.
592
+ * To change immutable fields such as tool type, spec, or tool ID, delete the tool and recreate it.
593
+ */
594
+ async updateTool(
595
+ req: UpdateToolRequest,
596
+ options?: CallOptions
597
+ ): Promise<Tool> {
598
+ const url = `${this.host}/api/2.1/${req.tool?.name ?? ''}`;
599
+ const params = new URLSearchParams();
600
+ if (req.updateMask !== undefined) {
601
+ params.append('update_mask', req.updateMask.toString());
602
+ }
603
+ const query = params.toString();
604
+ const fullUrl = query !== '' ? `${url}?${query}` : url;
605
+ const body = marshalRequest(req.tool, marshalToolSchema);
606
+ let resp: Tool | undefined;
607
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
608
+ const headers = new Headers({'Content-Type': 'application/json'});
609
+ if (this.workspaceId !== undefined) {
610
+ headers.set('X-Databricks-Org-Id', this.workspaceId);
611
+ }
612
+ headers.set('User-Agent', this.userAgent);
613
+ const httpReq = buildHttpRequest(
614
+ 'PATCH',
615
+ fullUrl,
616
+ headers,
617
+ callSignal,
618
+ body
619
+ );
620
+ const respBody = await executeHttpCall({
621
+ request: httpReq,
622
+ httpClient: this.httpClient,
623
+ logger: this.logger,
624
+ });
625
+ resp = parseResponse(respBody, unmarshalToolSchema);
626
+ };
627
+ await executeCall(call, options);
628
+ if (resp === undefined) {
629
+ throw new Error('operation completed without a result.');
630
+ }
631
+ return resp;
632
+ }
633
+ }
@@ -0,0 +1,39 @@
1
+ // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
+
3
+ export {SupervisorAgentsClient} from './client';
4
+
5
+ export type {
6
+ App,
7
+ CreateExampleRequest,
8
+ CreateSupervisorAgentRequest,
9
+ CreateToolRequest,
10
+ DeleteExampleRequest,
11
+ DeleteSupervisorAgentRequest,
12
+ DeleteToolRequest,
13
+ Example,
14
+ GenieSpace,
15
+ GetExampleRequest,
16
+ GetSupervisorAgentRequest,
17
+ GetToolRequest,
18
+ KnowledgeAssistant,
19
+ ListExamplesRequest,
20
+ ListExamplesResponse,
21
+ ListSupervisorAgentsRequest,
22
+ ListSupervisorAgentsResponse,
23
+ ListToolsRequest,
24
+ ListToolsResponse,
25
+ SupervisorAgent,
26
+ Tool,
27
+ UcConnection,
28
+ UcFunction,
29
+ UpdateExampleRequest,
30
+ UpdateSupervisorAgentRequest,
31
+ UpdateToolRequest,
32
+ Volume,
33
+ } from './model';
34
+
35
+ export {
36
+ exampleFieldMask,
37
+ supervisorAgentFieldMask,
38
+ toolFieldMask,
39
+ } from './model';