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

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