@databricks/sdk-knowledgeassistants 0.1.0-dev.3 → 0.1.0-dev.4
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/model.d.ts +14 -12
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +18 -20
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +2 -1
- package/dist/v1/utils.js.map +1 -1
- package/package.json +4 -5
- package/src/v1/client.ts +0 -652
- package/src/v1/index.ts +0 -39
- package/src/v1/model.ts +0 -751
- package/src/v1/transport.ts +0 -73
- package/src/v1/utils.ts +0 -156
package/src/v1/model.ts
DELETED
|
@@ -1,751 +0,0 @@
|
|
|
1
|
-
// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
import {Temporal} from '@js-temporal/polyfill';
|
|
4
|
-
import {FieldMask} from '@databricks/sdk-core/wkt';
|
|
5
|
-
import type {FieldMaskSchema} from '@databricks/sdk-core/wkt';
|
|
6
|
-
import {z} from 'zod';
|
|
7
|
-
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested enum name.
|
|
9
|
-
export enum KnowledgeAssistant_State {
|
|
10
|
-
STATE_UNSPECIFIED = 'STATE_UNSPECIFIED',
|
|
11
|
-
CREATING = 'CREATING',
|
|
12
|
-
ACTIVE = 'ACTIVE',
|
|
13
|
-
FAILED = 'FAILED',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested enum name.
|
|
17
|
-
export enum KnowledgeSource_State {
|
|
18
|
-
STATE_UNSPECIFIED = 'STATE_UNSPECIFIED',
|
|
19
|
-
UPDATING = 'UPDATING',
|
|
20
|
-
UPDATED = 'UPDATED',
|
|
21
|
-
FAILED_UPDATE = 'FAILED_UPDATE',
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** Create an example. */
|
|
25
|
-
export interface CreateExampleRequest {
|
|
26
|
-
/**
|
|
27
|
-
* Parent resource where this example will be created.
|
|
28
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}
|
|
29
|
-
*/
|
|
30
|
-
parent?: string | undefined;
|
|
31
|
-
/** The example to create under the parent Knowledge Assistant. */
|
|
32
|
-
example?: Example | undefined;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface CreateKnowledgeAssistantRequest {
|
|
36
|
-
/** The Knowledge Assistant to create. */
|
|
37
|
-
knowledgeAssistant?: KnowledgeAssistant | undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface CreateKnowledgeSourceRequest {
|
|
41
|
-
/**
|
|
42
|
-
* Parent resource where this source will be created.
|
|
43
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}
|
|
44
|
-
*/
|
|
45
|
-
parent?: string | undefined;
|
|
46
|
-
knowledgeSource?: KnowledgeSource | undefined;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Delete an example. */
|
|
50
|
-
export interface DeleteExampleRequest {
|
|
51
|
-
/**
|
|
52
|
-
* The resource name of the example to delete.
|
|
53
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}/examples/{example_id}
|
|
54
|
-
*/
|
|
55
|
-
name?: string | undefined;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** A request to delete a Knowledge Assistant. */
|
|
59
|
-
export interface DeleteKnowledgeAssistantRequest {
|
|
60
|
-
/**
|
|
61
|
-
* The resource name of the knowledge assistant to be deleted.
|
|
62
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}
|
|
63
|
-
*/
|
|
64
|
-
name?: string | undefined;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface DeleteKnowledgeSourceRequest {
|
|
68
|
-
/**
|
|
69
|
-
* The resource name of the Knowledge Source to delete.
|
|
70
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}/knowledge-sources/{knowledge_source_id}
|
|
71
|
-
*/
|
|
72
|
-
name?: string | undefined;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* An example associated with a Knowledge Assistant.
|
|
77
|
-
* Contains a question and guidelines for how the assistant should respond.
|
|
78
|
-
*/
|
|
79
|
-
export interface Example {
|
|
80
|
-
/**
|
|
81
|
-
* Full resource name:
|
|
82
|
-
* knowledge-assistants/{knowledge_assistant_id}/examples/{example_id}
|
|
83
|
-
*/
|
|
84
|
-
name?: string | undefined;
|
|
85
|
-
/** The example question. */
|
|
86
|
-
question?: string | undefined;
|
|
87
|
-
/**
|
|
88
|
-
* Guidelines for answering the question. Optional — examples may be created
|
|
89
|
-
* with just a question; the front-end form does not require guidelines.
|
|
90
|
-
*/
|
|
91
|
-
guidelines?: string[] | undefined;
|
|
92
|
-
/** The universally unique identifier (UUID) of the example. */
|
|
93
|
-
exampleId?: string | undefined;
|
|
94
|
-
/** Timestamp when this example was created. */
|
|
95
|
-
createTime?: Temporal.Instant | undefined;
|
|
96
|
-
/** Timestamp when this example was last updated. */
|
|
97
|
-
updateTime?: Temporal.Instant | undefined;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/** FileTableSpec specifies a file table source configuration. */
|
|
101
|
-
export interface FileTableSpec {
|
|
102
|
-
/** Full UC name of the table, in the format of {CATALOG}.{SCHEMA}.{TABLE_NAME}. */
|
|
103
|
-
tableName?: string | undefined;
|
|
104
|
-
/** The name of the column containing BINARY file content to be indexed. */
|
|
105
|
-
fileCol?: string | undefined;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** FilesSpec specifies a files source configuration. */
|
|
109
|
-
export interface FilesSpec {
|
|
110
|
-
/** A UC volume path that includes a list of files. */
|
|
111
|
-
path?: string | undefined;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/** Get an example. */
|
|
115
|
-
export interface GetExampleRequest {
|
|
116
|
-
/**
|
|
117
|
-
* The resource name of the example.
|
|
118
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}/examples/{example_id}
|
|
119
|
-
*/
|
|
120
|
-
name?: string | undefined;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/** A request to retrieve a Knowledge Assistant. */
|
|
124
|
-
export interface GetKnowledgeAssistantRequest {
|
|
125
|
-
/**
|
|
126
|
-
* The resource name of the knowledge assistant.
|
|
127
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}
|
|
128
|
-
*/
|
|
129
|
-
name?: string | undefined;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface GetKnowledgeSourceRequest {
|
|
133
|
-
/**
|
|
134
|
-
* The resource name of the Knowledge Source.
|
|
135
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}/knowledge-sources/{knowledge_source_id}
|
|
136
|
-
*/
|
|
137
|
-
name?: string | undefined;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** IndexSpec specifies a vector search index source configuration. */
|
|
141
|
-
export interface IndexSpec {
|
|
142
|
-
/** Full UC name of the vector search index, in the format of {CATALOG}.{SCHEMA}.{INDEX_NAME}. */
|
|
143
|
-
indexName?: string | undefined;
|
|
144
|
-
/** The column that includes the document text for retrieval. */
|
|
145
|
-
textCol?: string | undefined;
|
|
146
|
-
/** The column that specifies a link or reference to where the information came from. */
|
|
147
|
-
docUriCol?: string | undefined;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Entity message that represents a knowledge assistant.
|
|
152
|
-
* Note: REQUIRED annotations below represent create-time requirements.
|
|
153
|
-
* For updates, required fields are determined by the update mask.
|
|
154
|
-
*/
|
|
155
|
-
export interface KnowledgeAssistant {
|
|
156
|
-
/**
|
|
157
|
-
* The resource name of the Knowledge Assistant.
|
|
158
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}
|
|
159
|
-
*/
|
|
160
|
-
name?: string | undefined;
|
|
161
|
-
/** State of the Knowledge Assistant. Not returned in List responses. */
|
|
162
|
-
state?: KnowledgeAssistant_State | undefined;
|
|
163
|
-
/** Deprecated: use knowledge_assistant_id instead. */
|
|
164
|
-
id?: string | undefined;
|
|
165
|
-
/**
|
|
166
|
-
* The display name of the Knowledge Assistant, unique at workspace level.
|
|
167
|
-
* Required when creating a Knowledge Assistant.
|
|
168
|
-
* When updating a Knowledge Assistant, optional unless included in
|
|
169
|
-
* update_mask.
|
|
170
|
-
*/
|
|
171
|
-
displayName?: string | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* Description of what this agent can do (user-facing).
|
|
174
|
-
* Required when creating a Knowledge Assistant.
|
|
175
|
-
* When updating a Knowledge Assistant, optional unless included in
|
|
176
|
-
* update_mask.
|
|
177
|
-
*/
|
|
178
|
-
description?: string | undefined;
|
|
179
|
-
/**
|
|
180
|
-
* Additional global instructions on how the agent should generate answers.
|
|
181
|
-
* Optional on create and update.
|
|
182
|
-
* When updating a Knowledge Assistant, include this field in update_mask to
|
|
183
|
-
* modify it.
|
|
184
|
-
*/
|
|
185
|
-
instructions?: string | undefined;
|
|
186
|
-
/** The creator of the Knowledge Assistant. */
|
|
187
|
-
creator?: string | undefined;
|
|
188
|
-
/** Creation timestamp. */
|
|
189
|
-
createTime?: Temporal.Instant | undefined;
|
|
190
|
-
/** The name of the knowledge assistant agent endpoint. */
|
|
191
|
-
endpointName?: string | undefined;
|
|
192
|
-
/** The MLflow experiment ID. */
|
|
193
|
-
experimentId?: string | undefined;
|
|
194
|
-
/** Error details when the Knowledge Assistant is in FAILED state. */
|
|
195
|
-
errorInfo?: string | undefined;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* KnowledgeSource represents a source of knowledge for the KnowledgeAssistant.
|
|
200
|
-
* Used in create/update requests and returned in Get/List responses.
|
|
201
|
-
* Note: REQUIRED annotations below represent create-time requirements.
|
|
202
|
-
* For updates, required fields are determined by the update mask.
|
|
203
|
-
*/
|
|
204
|
-
export interface KnowledgeSource {
|
|
205
|
-
/**
|
|
206
|
-
* Full resource name:
|
|
207
|
-
* knowledge-assistants/{knowledge_assistant_id}/knowledge-sources/{knowledge_source_id}
|
|
208
|
-
*/
|
|
209
|
-
name?: string | undefined;
|
|
210
|
-
/**
|
|
211
|
-
* Human-readable display name of the knowledge source.
|
|
212
|
-
* Required when creating a Knowledge Source.
|
|
213
|
-
* When updating a Knowledge Source, optional unless included in update_mask.
|
|
214
|
-
*/
|
|
215
|
-
displayName?: string | undefined;
|
|
216
|
-
/**
|
|
217
|
-
* Description of the knowledge source.
|
|
218
|
-
* Required when creating a Knowledge Source.
|
|
219
|
-
* When updating a Knowledge Source, optional unless included in update_mask.
|
|
220
|
-
*/
|
|
221
|
-
description?: string | undefined;
|
|
222
|
-
/**
|
|
223
|
-
* The type of the source: "index", "files", or "file_table".
|
|
224
|
-
* Required when creating a Knowledge Source.
|
|
225
|
-
* When updating a Knowledge Source, this field is ignored.
|
|
226
|
-
*/
|
|
227
|
-
sourceType?: string | undefined;
|
|
228
|
-
/** Specification for the knowledge source type. */
|
|
229
|
-
spec?:
|
|
230
|
-
| {$case: 'index'; index: IndexSpec}
|
|
231
|
-
| {$case: 'files'; files: FilesSpec}
|
|
232
|
-
| {$case: 'fileTable'; fileTable: FileTableSpec}
|
|
233
|
-
| undefined;
|
|
234
|
-
state?: KnowledgeSource_State | undefined;
|
|
235
|
-
id?: string | undefined;
|
|
236
|
-
/** Timestamp representing the cutoff before which content in this knowledge source is being ingested. */
|
|
237
|
-
knowledgeCutoffTime?: Temporal.Instant | undefined;
|
|
238
|
-
/** Timestamp when this knowledge source was created. */
|
|
239
|
-
createTime?: Temporal.Instant | undefined;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/** List examples. */
|
|
243
|
-
export interface ListExamplesRequest {
|
|
244
|
-
/**
|
|
245
|
-
* Parent resource to list from.
|
|
246
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}
|
|
247
|
-
*/
|
|
248
|
-
parent?: string | undefined;
|
|
249
|
-
/**
|
|
250
|
-
* The maximum number of examples to return.
|
|
251
|
-
* If unspecified, at most 100 examples will be returned.
|
|
252
|
-
* The maximum value is 100; values above 100 will be coerced to 100.
|
|
253
|
-
*/
|
|
254
|
-
pageSize?: number | undefined;
|
|
255
|
-
/**
|
|
256
|
-
* A page token, received from a previous `ListExamples` call.
|
|
257
|
-
* Provide this to retrieve the subsequent page.
|
|
258
|
-
* If unspecified, the first page will be returned.
|
|
259
|
-
*/
|
|
260
|
-
pageToken?: string | undefined;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/** A list of Knowledge Assistant examples. */
|
|
264
|
-
export interface ListExamplesResponse {
|
|
265
|
-
examples?: Example[] | undefined;
|
|
266
|
-
nextPageToken?: string | undefined;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/** A request to list Knowledge Assistants. */
|
|
270
|
-
export interface ListKnowledgeAssistantsRequest {
|
|
271
|
-
/**
|
|
272
|
-
* The maximum number of knowledge assistants to return.
|
|
273
|
-
* If unspecified, at most 100 knowledge assistants will be returned.
|
|
274
|
-
* The maximum value is 100; values above 100 will be coerced to 100.
|
|
275
|
-
*/
|
|
276
|
-
pageSize?: number | undefined;
|
|
277
|
-
/**
|
|
278
|
-
* A page token, received from a previous `ListKnowledgeAssistants` call.
|
|
279
|
-
* Provide this to retrieve the subsequent page.
|
|
280
|
-
* If unspecified, the first page will be returned.
|
|
281
|
-
*/
|
|
282
|
-
pageToken?: string | undefined;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/** A list of Knowledge Assistants. */
|
|
286
|
-
export interface ListKnowledgeAssistantsResponse {
|
|
287
|
-
knowledgeAssistants?: KnowledgeAssistant[] | undefined;
|
|
288
|
-
/**
|
|
289
|
-
* A token that can be sent as `page_token` to retrieve the next page.
|
|
290
|
-
* If this field is omitted, there are no subsequent pages.
|
|
291
|
-
*/
|
|
292
|
-
nextPageToken?: string | undefined;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export interface ListKnowledgeSourcesRequest {
|
|
296
|
-
/**
|
|
297
|
-
* Parent resource to list from.
|
|
298
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}
|
|
299
|
-
*/
|
|
300
|
-
parent?: string | undefined;
|
|
301
|
-
pageSize?: number | undefined;
|
|
302
|
-
pageToken?: string | undefined;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export interface ListKnowledgeSourcesResponse {
|
|
306
|
-
knowledgeSources?: KnowledgeSource[] | undefined;
|
|
307
|
-
nextPageToken?: string | undefined;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export interface SyncKnowledgeSourcesRequest {
|
|
311
|
-
/**
|
|
312
|
-
* The resource name of the Knowledge Assistant.
|
|
313
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}
|
|
314
|
-
*/
|
|
315
|
-
name?: string | undefined;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/** Update an example. */
|
|
319
|
-
export interface UpdateExampleRequest {
|
|
320
|
-
/**
|
|
321
|
-
* The resource name of the example to update.
|
|
322
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}/examples/{example_id}
|
|
323
|
-
*/
|
|
324
|
-
name?: string | undefined;
|
|
325
|
-
example?: Example | undefined;
|
|
326
|
-
/**
|
|
327
|
-
* Comma-delimited list of fields to update on the example.
|
|
328
|
-
* Allowed values: `question`, `guidelines`.
|
|
329
|
-
* Examples:
|
|
330
|
-
* - `question`
|
|
331
|
-
* - `question,guidelines`
|
|
332
|
-
*/
|
|
333
|
-
updateMask?: FieldMask<Example> | undefined;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
export interface UpdateKnowledgeAssistantRequest {
|
|
337
|
-
/**
|
|
338
|
-
* The Knowledge Assistant update payload.
|
|
339
|
-
* Only fields listed in update_mask are updated.
|
|
340
|
-
* REQUIRED annotations on Knowledge Assistant fields describe create-time
|
|
341
|
-
* requirements and do not mean all those fields are required for update.
|
|
342
|
-
*/
|
|
343
|
-
knowledgeAssistant?: KnowledgeAssistant | undefined;
|
|
344
|
-
/**
|
|
345
|
-
* Comma-delimited list of fields to update on the Knowledge Assistant.
|
|
346
|
-
* Allowed values: `display_name`, `description`, `instructions`.
|
|
347
|
-
* Examples:
|
|
348
|
-
* - `display_name`
|
|
349
|
-
* - `description,instructions`
|
|
350
|
-
*/
|
|
351
|
-
updateMask?: FieldMask<KnowledgeAssistant> | undefined;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
export interface UpdateKnowledgeSourceRequest {
|
|
355
|
-
/**
|
|
356
|
-
* The resource name of the Knowledge Source to update.
|
|
357
|
-
* Format: knowledge-assistants/{knowledge_assistant_id}/knowledge-sources/{knowledge_source_id}
|
|
358
|
-
*/
|
|
359
|
-
name?: string | undefined;
|
|
360
|
-
/**
|
|
361
|
-
* The Knowledge Source update payload.
|
|
362
|
-
* Only fields listed in update_mask are updated.
|
|
363
|
-
* REQUIRED annotations on Knowledge Source fields describe create-time
|
|
364
|
-
* requirements and do not mean all those fields are required for update.
|
|
365
|
-
*/
|
|
366
|
-
knowledgeSource?: KnowledgeSource | undefined;
|
|
367
|
-
/**
|
|
368
|
-
* Comma-delimited list of fields to update on the Knowledge Source.
|
|
369
|
-
* Allowed values: `display_name`, `description`.
|
|
370
|
-
* Examples:
|
|
371
|
-
* - `display_name`
|
|
372
|
-
* - `display_name,description`
|
|
373
|
-
*/
|
|
374
|
-
updateMask?: FieldMask<KnowledgeSource> | undefined;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
export const unmarshalExampleSchema: z.ZodType<Example> = z
|
|
378
|
-
.object({
|
|
379
|
-
name: z.string().optional(),
|
|
380
|
-
question: z.string().optional(),
|
|
381
|
-
guidelines: z.array(z.string()).optional(),
|
|
382
|
-
example_id: z.string().optional(),
|
|
383
|
-
create_time: z
|
|
384
|
-
.string()
|
|
385
|
-
.transform(s => Temporal.Instant.from(s))
|
|
386
|
-
.optional(),
|
|
387
|
-
update_time: z
|
|
388
|
-
.string()
|
|
389
|
-
.transform(s => Temporal.Instant.from(s))
|
|
390
|
-
.optional(),
|
|
391
|
-
})
|
|
392
|
-
.transform(d => ({
|
|
393
|
-
name: d.name,
|
|
394
|
-
question: d.question,
|
|
395
|
-
guidelines: d.guidelines,
|
|
396
|
-
exampleId: d.example_id,
|
|
397
|
-
createTime: d.create_time,
|
|
398
|
-
updateTime: d.update_time,
|
|
399
|
-
}));
|
|
400
|
-
|
|
401
|
-
export const unmarshalFileTableSpecSchema: z.ZodType<FileTableSpec> = z
|
|
402
|
-
.object({
|
|
403
|
-
table_name: z.string().optional(),
|
|
404
|
-
file_col: z.string().optional(),
|
|
405
|
-
})
|
|
406
|
-
.transform(d => ({
|
|
407
|
-
tableName: d.table_name,
|
|
408
|
-
fileCol: d.file_col,
|
|
409
|
-
}));
|
|
410
|
-
|
|
411
|
-
export const unmarshalFilesSpecSchema: z.ZodType<FilesSpec> = z
|
|
412
|
-
.object({
|
|
413
|
-
path: z.string().optional(),
|
|
414
|
-
})
|
|
415
|
-
.transform(d => ({
|
|
416
|
-
path: d.path,
|
|
417
|
-
}));
|
|
418
|
-
|
|
419
|
-
export const unmarshalIndexSpecSchema: z.ZodType<IndexSpec> = z
|
|
420
|
-
.object({
|
|
421
|
-
index_name: z.string().optional(),
|
|
422
|
-
text_col: z.string().optional(),
|
|
423
|
-
doc_uri_col: z.string().optional(),
|
|
424
|
-
})
|
|
425
|
-
.transform(d => ({
|
|
426
|
-
indexName: d.index_name,
|
|
427
|
-
textCol: d.text_col,
|
|
428
|
-
docUriCol: d.doc_uri_col,
|
|
429
|
-
}));
|
|
430
|
-
|
|
431
|
-
export const unmarshalKnowledgeAssistantSchema: z.ZodType<KnowledgeAssistant> =
|
|
432
|
-
z
|
|
433
|
-
.object({
|
|
434
|
-
name: z.string().optional(),
|
|
435
|
-
state: z.enum(KnowledgeAssistant_State).optional(),
|
|
436
|
-
id: z.string().optional(),
|
|
437
|
-
display_name: z.string().optional(),
|
|
438
|
-
description: z.string().optional(),
|
|
439
|
-
instructions: z.string().optional(),
|
|
440
|
-
creator: z.string().optional(),
|
|
441
|
-
create_time: z
|
|
442
|
-
.string()
|
|
443
|
-
.transform(s => Temporal.Instant.from(s))
|
|
444
|
-
.optional(),
|
|
445
|
-
endpoint_name: z.string().optional(),
|
|
446
|
-
experiment_id: z.string().optional(),
|
|
447
|
-
error_info: z.string().optional(),
|
|
448
|
-
})
|
|
449
|
-
.transform(d => ({
|
|
450
|
-
name: d.name,
|
|
451
|
-
state: d.state,
|
|
452
|
-
id: d.id,
|
|
453
|
-
displayName: d.display_name,
|
|
454
|
-
description: d.description,
|
|
455
|
-
instructions: d.instructions,
|
|
456
|
-
creator: d.creator,
|
|
457
|
-
createTime: d.create_time,
|
|
458
|
-
endpointName: d.endpoint_name,
|
|
459
|
-
experimentId: d.experiment_id,
|
|
460
|
-
errorInfo: d.error_info,
|
|
461
|
-
}));
|
|
462
|
-
|
|
463
|
-
export const unmarshalKnowledgeSourceSchema: z.ZodType<KnowledgeSource> = z
|
|
464
|
-
.object({
|
|
465
|
-
name: z.string().optional(),
|
|
466
|
-
display_name: z.string().optional(),
|
|
467
|
-
description: z.string().optional(),
|
|
468
|
-
source_type: z.string().optional(),
|
|
469
|
-
index: z.lazy(() => unmarshalIndexSpecSchema).optional(),
|
|
470
|
-
files: z.lazy(() => unmarshalFilesSpecSchema).optional(),
|
|
471
|
-
file_table: z.lazy(() => unmarshalFileTableSpecSchema).optional(),
|
|
472
|
-
state: z.enum(KnowledgeSource_State).optional(),
|
|
473
|
-
id: z.string().optional(),
|
|
474
|
-
knowledge_cutoff_time: z
|
|
475
|
-
.string()
|
|
476
|
-
.transform(s => Temporal.Instant.from(s))
|
|
477
|
-
.optional(),
|
|
478
|
-
create_time: z
|
|
479
|
-
.string()
|
|
480
|
-
.transform(s => Temporal.Instant.from(s))
|
|
481
|
-
.optional(),
|
|
482
|
-
})
|
|
483
|
-
.transform(d => ({
|
|
484
|
-
name: d.name,
|
|
485
|
-
displayName: d.display_name,
|
|
486
|
-
description: d.description,
|
|
487
|
-
sourceType: d.source_type,
|
|
488
|
-
spec:
|
|
489
|
-
d.index !== undefined
|
|
490
|
-
? {$case: 'index' as const, index: d.index}
|
|
491
|
-
: d.files !== undefined
|
|
492
|
-
? {$case: 'files' as const, files: d.files}
|
|
493
|
-
: d.file_table !== undefined
|
|
494
|
-
? {$case: 'fileTable' as const, fileTable: d.file_table}
|
|
495
|
-
: undefined,
|
|
496
|
-
state: d.state,
|
|
497
|
-
id: d.id,
|
|
498
|
-
knowledgeCutoffTime: d.knowledge_cutoff_time,
|
|
499
|
-
createTime: d.create_time,
|
|
500
|
-
}));
|
|
501
|
-
|
|
502
|
-
export const unmarshalListExamplesResponseSchema: z.ZodType<ListExamplesResponse> =
|
|
503
|
-
z
|
|
504
|
-
.object({
|
|
505
|
-
examples: z.array(z.lazy(() => unmarshalExampleSchema)).optional(),
|
|
506
|
-
next_page_token: z.string().optional(),
|
|
507
|
-
})
|
|
508
|
-
.transform(d => ({
|
|
509
|
-
examples: d.examples,
|
|
510
|
-
nextPageToken: d.next_page_token,
|
|
511
|
-
}));
|
|
512
|
-
|
|
513
|
-
export const unmarshalListKnowledgeAssistantsResponseSchema: z.ZodType<ListKnowledgeAssistantsResponse> =
|
|
514
|
-
z
|
|
515
|
-
.object({
|
|
516
|
-
knowledge_assistants: z
|
|
517
|
-
.array(z.lazy(() => unmarshalKnowledgeAssistantSchema))
|
|
518
|
-
.optional(),
|
|
519
|
-
next_page_token: z.string().optional(),
|
|
520
|
-
})
|
|
521
|
-
.transform(d => ({
|
|
522
|
-
knowledgeAssistants: d.knowledge_assistants,
|
|
523
|
-
nextPageToken: d.next_page_token,
|
|
524
|
-
}));
|
|
525
|
-
|
|
526
|
-
export const unmarshalListKnowledgeSourcesResponseSchema: z.ZodType<ListKnowledgeSourcesResponse> =
|
|
527
|
-
z
|
|
528
|
-
.object({
|
|
529
|
-
knowledge_sources: z
|
|
530
|
-
.array(z.lazy(() => unmarshalKnowledgeSourceSchema))
|
|
531
|
-
.optional(),
|
|
532
|
-
next_page_token: z.string().optional(),
|
|
533
|
-
})
|
|
534
|
-
.transform(d => ({
|
|
535
|
-
knowledgeSources: d.knowledge_sources,
|
|
536
|
-
nextPageToken: d.next_page_token,
|
|
537
|
-
}));
|
|
538
|
-
|
|
539
|
-
export const marshalExampleSchema: z.ZodType = z
|
|
540
|
-
.object({
|
|
541
|
-
name: z.string().optional(),
|
|
542
|
-
question: z.string().optional(),
|
|
543
|
-
guidelines: z.array(z.string()).optional(),
|
|
544
|
-
exampleId: z.string().optional(),
|
|
545
|
-
createTime: z
|
|
546
|
-
.any()
|
|
547
|
-
.transform((d: Temporal.Instant) => d.toString())
|
|
548
|
-
.optional(),
|
|
549
|
-
updateTime: z
|
|
550
|
-
.any()
|
|
551
|
-
.transform((d: Temporal.Instant) => d.toString())
|
|
552
|
-
.optional(),
|
|
553
|
-
})
|
|
554
|
-
.transform(d => ({
|
|
555
|
-
name: d.name,
|
|
556
|
-
question: d.question,
|
|
557
|
-
guidelines: d.guidelines,
|
|
558
|
-
example_id: d.exampleId,
|
|
559
|
-
create_time: d.createTime,
|
|
560
|
-
update_time: d.updateTime,
|
|
561
|
-
}));
|
|
562
|
-
|
|
563
|
-
export const marshalFileTableSpecSchema: z.ZodType = z
|
|
564
|
-
.object({
|
|
565
|
-
tableName: z.string().optional(),
|
|
566
|
-
fileCol: z.string().optional(),
|
|
567
|
-
})
|
|
568
|
-
.transform(d => ({
|
|
569
|
-
table_name: d.tableName,
|
|
570
|
-
file_col: d.fileCol,
|
|
571
|
-
}));
|
|
572
|
-
|
|
573
|
-
export const marshalFilesSpecSchema: z.ZodType = z
|
|
574
|
-
.object({
|
|
575
|
-
path: z.string().optional(),
|
|
576
|
-
})
|
|
577
|
-
.transform(d => ({
|
|
578
|
-
path: d.path,
|
|
579
|
-
}));
|
|
580
|
-
|
|
581
|
-
export const marshalIndexSpecSchema: z.ZodType = z
|
|
582
|
-
.object({
|
|
583
|
-
indexName: z.string().optional(),
|
|
584
|
-
textCol: z.string().optional(),
|
|
585
|
-
docUriCol: z.string().optional(),
|
|
586
|
-
})
|
|
587
|
-
.transform(d => ({
|
|
588
|
-
index_name: d.indexName,
|
|
589
|
-
text_col: d.textCol,
|
|
590
|
-
doc_uri_col: d.docUriCol,
|
|
591
|
-
}));
|
|
592
|
-
|
|
593
|
-
export const marshalKnowledgeAssistantSchema: z.ZodType = z
|
|
594
|
-
.object({
|
|
595
|
-
name: z.string().optional(),
|
|
596
|
-
state: z.enum(KnowledgeAssistant_State).optional(),
|
|
597
|
-
id: z.string().optional(),
|
|
598
|
-
displayName: z.string().optional(),
|
|
599
|
-
description: z.string().optional(),
|
|
600
|
-
instructions: z.string().optional(),
|
|
601
|
-
creator: z.string().optional(),
|
|
602
|
-
createTime: z
|
|
603
|
-
.any()
|
|
604
|
-
.transform((d: Temporal.Instant) => d.toString())
|
|
605
|
-
.optional(),
|
|
606
|
-
endpointName: z.string().optional(),
|
|
607
|
-
experimentId: z.string().optional(),
|
|
608
|
-
errorInfo: z.string().optional(),
|
|
609
|
-
})
|
|
610
|
-
.transform(d => ({
|
|
611
|
-
name: d.name,
|
|
612
|
-
state: d.state,
|
|
613
|
-
id: d.id,
|
|
614
|
-
display_name: d.displayName,
|
|
615
|
-
description: d.description,
|
|
616
|
-
instructions: d.instructions,
|
|
617
|
-
creator: d.creator,
|
|
618
|
-
create_time: d.createTime,
|
|
619
|
-
endpoint_name: d.endpointName,
|
|
620
|
-
experiment_id: d.experimentId,
|
|
621
|
-
error_info: d.errorInfo,
|
|
622
|
-
}));
|
|
623
|
-
|
|
624
|
-
export const marshalKnowledgeSourceSchema: z.ZodType = z
|
|
625
|
-
.object({
|
|
626
|
-
name: z.string().optional(),
|
|
627
|
-
displayName: z.string().optional(),
|
|
628
|
-
description: z.string().optional(),
|
|
629
|
-
sourceType: z.string().optional(),
|
|
630
|
-
spec: z
|
|
631
|
-
.discriminatedUnion('$case', [
|
|
632
|
-
z.object({
|
|
633
|
-
$case: z.literal('index'),
|
|
634
|
-
index: z.lazy(() => marshalIndexSpecSchema),
|
|
635
|
-
}),
|
|
636
|
-
z.object({
|
|
637
|
-
$case: z.literal('files'),
|
|
638
|
-
files: z.lazy(() => marshalFilesSpecSchema),
|
|
639
|
-
}),
|
|
640
|
-
z.object({
|
|
641
|
-
$case: z.literal('fileTable'),
|
|
642
|
-
fileTable: z.lazy(() => marshalFileTableSpecSchema),
|
|
643
|
-
}),
|
|
644
|
-
])
|
|
645
|
-
.optional(),
|
|
646
|
-
state: z.enum(KnowledgeSource_State).optional(),
|
|
647
|
-
id: z.string().optional(),
|
|
648
|
-
knowledgeCutoffTime: z
|
|
649
|
-
.any()
|
|
650
|
-
.transform((d: Temporal.Instant) => d.toString())
|
|
651
|
-
.optional(),
|
|
652
|
-
createTime: z
|
|
653
|
-
.any()
|
|
654
|
-
.transform((d: Temporal.Instant) => d.toString())
|
|
655
|
-
.optional(),
|
|
656
|
-
})
|
|
657
|
-
.transform(d => ({
|
|
658
|
-
name: d.name,
|
|
659
|
-
display_name: d.displayName,
|
|
660
|
-
description: d.description,
|
|
661
|
-
source_type: d.sourceType,
|
|
662
|
-
...(d.spec?.$case === 'index' && {index: d.spec.index}),
|
|
663
|
-
...(d.spec?.$case === 'files' && {files: d.spec.files}),
|
|
664
|
-
...(d.spec?.$case === 'fileTable' && {file_table: d.spec.fileTable}),
|
|
665
|
-
state: d.state,
|
|
666
|
-
id: d.id,
|
|
667
|
-
knowledge_cutoff_time: d.knowledgeCutoffTime,
|
|
668
|
-
create_time: d.createTime,
|
|
669
|
-
}));
|
|
670
|
-
|
|
671
|
-
export const marshalSyncKnowledgeSourcesRequestSchema: z.ZodType = z
|
|
672
|
-
.object({
|
|
673
|
-
name: z.string().optional(),
|
|
674
|
-
})
|
|
675
|
-
.transform(d => ({
|
|
676
|
-
name: d.name,
|
|
677
|
-
}));
|
|
678
|
-
|
|
679
|
-
const exampleFieldMaskSchema: FieldMaskSchema = {
|
|
680
|
-
createTime: {wire: 'create_time'},
|
|
681
|
-
exampleId: {wire: 'example_id'},
|
|
682
|
-
guidelines: {wire: 'guidelines'},
|
|
683
|
-
name: {wire: 'name'},
|
|
684
|
-
question: {wire: 'question'},
|
|
685
|
-
updateTime: {wire: 'update_time'},
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
export function exampleFieldMask(...paths: string[]): FieldMask<Example> {
|
|
689
|
-
return FieldMask.build<Example>(paths, exampleFieldMaskSchema);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
const fileTableSpecFieldMaskSchema: FieldMaskSchema = {
|
|
693
|
-
fileCol: {wire: 'file_col'},
|
|
694
|
-
tableName: {wire: 'table_name'},
|
|
695
|
-
};
|
|
696
|
-
|
|
697
|
-
const filesSpecFieldMaskSchema: FieldMaskSchema = {
|
|
698
|
-
path: {wire: 'path'},
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
const indexSpecFieldMaskSchema: FieldMaskSchema = {
|
|
702
|
-
docUriCol: {wire: 'doc_uri_col'},
|
|
703
|
-
indexName: {wire: 'index_name'},
|
|
704
|
-
textCol: {wire: 'text_col'},
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
const knowledgeAssistantFieldMaskSchema: FieldMaskSchema = {
|
|
708
|
-
createTime: {wire: 'create_time'},
|
|
709
|
-
creator: {wire: 'creator'},
|
|
710
|
-
description: {wire: 'description'},
|
|
711
|
-
displayName: {wire: 'display_name'},
|
|
712
|
-
endpointName: {wire: 'endpoint_name'},
|
|
713
|
-
errorInfo: {wire: 'error_info'},
|
|
714
|
-
experimentId: {wire: 'experiment_id'},
|
|
715
|
-
id: {wire: 'id'},
|
|
716
|
-
instructions: {wire: 'instructions'},
|
|
717
|
-
name: {wire: 'name'},
|
|
718
|
-
state: {wire: 'state'},
|
|
719
|
-
};
|
|
720
|
-
|
|
721
|
-
export function knowledgeAssistantFieldMask(
|
|
722
|
-
...paths: string[]
|
|
723
|
-
): FieldMask<KnowledgeAssistant> {
|
|
724
|
-
return FieldMask.build<KnowledgeAssistant>(
|
|
725
|
-
paths,
|
|
726
|
-
knowledgeAssistantFieldMaskSchema
|
|
727
|
-
);
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
const knowledgeSourceFieldMaskSchema: FieldMaskSchema = {
|
|
731
|
-
createTime: {wire: 'create_time'},
|
|
732
|
-
description: {wire: 'description'},
|
|
733
|
-
displayName: {wire: 'display_name'},
|
|
734
|
-
fileTable: {wire: 'file_table', children: () => fileTableSpecFieldMaskSchema},
|
|
735
|
-
files: {wire: 'files', children: () => filesSpecFieldMaskSchema},
|
|
736
|
-
id: {wire: 'id'},
|
|
737
|
-
index: {wire: 'index', children: () => indexSpecFieldMaskSchema},
|
|
738
|
-
knowledgeCutoffTime: {wire: 'knowledge_cutoff_time'},
|
|
739
|
-
name: {wire: 'name'},
|
|
740
|
-
sourceType: {wire: 'source_type'},
|
|
741
|
-
state: {wire: 'state'},
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
export function knowledgeSourceFieldMask(
|
|
745
|
-
...paths: string[]
|
|
746
|
-
): FieldMask<KnowledgeSource> {
|
|
747
|
-
return FieldMask.build<KnowledgeSource>(
|
|
748
|
-
paths,
|
|
749
|
-
knowledgeSourceFieldMaskSchema
|
|
750
|
-
);
|
|
751
|
-
}
|