@databricks/sdk-vectorsearch 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,797 @@
1
+ // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
+ import { z } from 'zod';
3
+ const jsonValueSchema = z.lazy(() => z.union([
4
+ z.null(),
5
+ z.number(),
6
+ z.string(),
7
+ z.boolean(),
8
+ z.record(z.string(), jsonValueSchema),
9
+ z.array(jsonValueSchema),
10
+ ]));
11
+ /** Type of endpoint. */
12
+ export var EndpointType;
13
+ (function (EndpointType) {
14
+ EndpointType["STORAGE_OPTIMIZED"] = "STORAGE_OPTIMIZED";
15
+ EndpointType["STANDARD"] = "STANDARD";
16
+ })(EndpointType || (EndpointType = {}));
17
+ /**
18
+ * The subtype of the AI Search index, determining the indexing and retrieval strategy.
19
+ * - `VECTOR`: Not supported. Use `HYBRID` instead.
20
+ * - `FULL_TEXT`: An index that uses full-text search without vector embeddings.
21
+ * - `HYBRID`: An index that uses vector embeddings for similarity search and hybrid search.
22
+ */
23
+ export var IndexSubtype;
24
+ (function (IndexSubtype) {
25
+ IndexSubtype["VECTOR"] = "VECTOR";
26
+ IndexSubtype["FULL_TEXT"] = "FULL_TEXT";
27
+ IndexSubtype["HYBRID"] = "HYBRID";
28
+ })(IndexSubtype || (IndexSubtype = {}));
29
+ /**
30
+ * Pipeline execution mode.
31
+ * - `TRIGGERED`: If the pipeline uses the triggered execution mode, the system stops processing after successfully refreshing the source table in the pipeline once, ensuring the table is updated based on the data available when the update started.
32
+ * - `CONTINUOUS`: If the pipeline uses continuous execution, the pipeline processes new data as it arrives in the source table to keep vector index fresh.
33
+ */
34
+ export var PipelineType;
35
+ (function (PipelineType) {
36
+ PipelineType["TRIGGERED"] = "TRIGGERED";
37
+ PipelineType["CONTINUOUS"] = "CONTINUOUS";
38
+ })(PipelineType || (PipelineType = {}));
39
+ export var ScalingChangeState;
40
+ (function (ScalingChangeState) {
41
+ ScalingChangeState["SCALING_CHANGE_UNSPECIFIED"] = "SCALING_CHANGE_UNSPECIFIED";
42
+ ScalingChangeState["SCALING_CHANGE_APPLIED"] = "SCALING_CHANGE_APPLIED";
43
+ ScalingChangeState["SCALING_CHANGE_IN_PROGRESS"] = "SCALING_CHANGE_IN_PROGRESS";
44
+ })(ScalingChangeState || (ScalingChangeState = {}));
45
+ export var UpsertDeleteDataStatus;
46
+ (function (UpsertDeleteDataStatus) {
47
+ UpsertDeleteDataStatus["SUCCESS"] = "SUCCESS";
48
+ UpsertDeleteDataStatus["PARTIAL_SUCCESS"] = "PARTIAL_SUCCESS";
49
+ UpsertDeleteDataStatus["FAILURE"] = "FAILURE";
50
+ })(UpsertDeleteDataStatus || (UpsertDeleteDataStatus = {}));
51
+ /**
52
+ * There are 2 types of AI Search indexes:
53
+ * - `DELTA_SYNC`: An index that automatically syncs with a source Delta Table, automatically and incrementally updating the index as the underlying data in the Delta Table changes.
54
+ * - `DIRECT_ACCESS`: An index that supports direct read and write of vectors and metadata through our REST and SDK APIs. With this model, the user manages index updates.
55
+ */
56
+ export var VectorIndexType;
57
+ (function (VectorIndexType) {
58
+ VectorIndexType["DELTA_SYNC"] = "DELTA_SYNC";
59
+ VectorIndexType["DIRECT_ACCESS"] = "DIRECT_ACCESS";
60
+ })(VectorIndexType || (VectorIndexType = {}));
61
+ /** Current state of the endpoint */
62
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested enum name.
63
+ export var EndpointStatus_State;
64
+ (function (EndpointStatus_State) {
65
+ EndpointStatus_State["PROVISIONING"] = "PROVISIONING";
66
+ EndpointStatus_State["ONLINE"] = "ONLINE";
67
+ EndpointStatus_State["OFFLINE"] = "OFFLINE";
68
+ /**
69
+ * After the endpoint is ready, it can be in one of the following states:
70
+ * - RED_STATE: The endpoint is unhealthy and needs to be investigated.
71
+ * - YELLOW_STATE: The endpoint is healthy but needs to be monitored.
72
+ * - ONLINE: The endpoint is healthy and ready to serve traffic.
73
+ */
74
+ EndpointStatus_State["RED_STATE"] = "RED_STATE";
75
+ EndpointStatus_State["YELLOW_STATE"] = "YELLOW_STATE";
76
+ /**
77
+ * The endpoint is being deleted or has been deleted. Associated resources
78
+ * are being cleaned up; once cleanup completes the endpoint will no longer
79
+ * be retrievable.
80
+ */
81
+ EndpointStatus_State["DELETED"] = "DELETED";
82
+ })(EndpointStatus_State || (EndpointStatus_State = {}));
83
+ export const unmarshalColumnInfoSchema = z
84
+ .object({
85
+ name: z.string().optional(),
86
+ type_text: z.string().optional(),
87
+ })
88
+ .transform(d => ({
89
+ name: d.name,
90
+ typeText: d.type_text,
91
+ }));
92
+ export const unmarshalCustomTagSchema = z
93
+ .object({
94
+ key: z.string().optional(),
95
+ value: z.string().optional(),
96
+ })
97
+ .transform(d => ({
98
+ key: d.key,
99
+ value: d.value,
100
+ }));
101
+ export const unmarshalDeleteDataVectorIndexResponseSchema = z
102
+ .object({
103
+ status: z.enum(UpsertDeleteDataStatus).optional(),
104
+ result: z.lazy(() => unmarshalUpsertDeleteDataResultSchema).optional(),
105
+ })
106
+ .transform(d => ({
107
+ status: d.status,
108
+ result: d.result,
109
+ }));
110
+ export const unmarshalDeleteEndpointResponseSchema = z.object({});
111
+ export const unmarshalDeleteVectorIndexResponseSchema = z.object({});
112
+ export const unmarshalDeltaSyncVectorIndexSpecSchema = z
113
+ .object({
114
+ source_table: z.string().optional(),
115
+ embedding_source_columns: z
116
+ .array(z.lazy(() => unmarshalEmbeddingSourceColumnSchema))
117
+ .optional(),
118
+ embedding_vector_columns: z
119
+ .array(z.lazy(() => unmarshalEmbeddingVectorColumnSchema))
120
+ .optional(),
121
+ pipeline_type: z.enum(PipelineType).optional(),
122
+ pipeline_id: z.string().optional(),
123
+ embedding_writeback_table: z.string().optional(),
124
+ columns_to_sync: z.array(z.string()).optional(),
125
+ columns_to_index: z.array(z.string()).optional(),
126
+ })
127
+ .transform(d => ({
128
+ sourceTable: d.source_table,
129
+ embeddingSourceColumns: d.embedding_source_columns,
130
+ embeddingVectorColumns: d.embedding_vector_columns,
131
+ pipelineType: d.pipeline_type,
132
+ pipelineId: d.pipeline_id,
133
+ embeddingWritebackTable: d.embedding_writeback_table,
134
+ columnsToSync: d.columns_to_sync,
135
+ columnsToIndex: d.columns_to_index,
136
+ }));
137
+ export const unmarshalDirectAccessVectorIndexSpecSchema = z
138
+ .object({
139
+ embedding_vector_columns: z
140
+ .array(z.lazy(() => unmarshalEmbeddingVectorColumnSchema))
141
+ .optional(),
142
+ schema_json: z.string().optional(),
143
+ embedding_source_columns: z
144
+ .array(z.lazy(() => unmarshalEmbeddingSourceColumnSchema))
145
+ .optional(),
146
+ })
147
+ .transform(d => ({
148
+ embeddingVectorColumns: d.embedding_vector_columns,
149
+ schemaJson: d.schema_json,
150
+ embeddingSourceColumns: d.embedding_source_columns,
151
+ }));
152
+ export const unmarshalEmbeddingSourceColumnSchema = z
153
+ .object({
154
+ name: z.string().optional(),
155
+ embedding_model_endpoint_name: z.string().optional(),
156
+ model_endpoint_name_for_query: z.string().optional(),
157
+ })
158
+ .transform(d => ({
159
+ name: d.name,
160
+ embeddingConfig: d.embedding_model_endpoint_name !== undefined
161
+ ? {
162
+ $case: 'embeddingModelEndpointName',
163
+ embeddingModelEndpointName: d.embedding_model_endpoint_name,
164
+ }
165
+ : undefined,
166
+ modelEndpointNameForQuery: d.model_endpoint_name_for_query,
167
+ }));
168
+ export const unmarshalEmbeddingVectorColumnSchema = z
169
+ .object({
170
+ name: z.string().optional(),
171
+ embedding_dimension: z.number().optional(),
172
+ })
173
+ .transform(d => ({
174
+ name: d.name,
175
+ embeddingDimension: d.embedding_dimension,
176
+ }));
177
+ export const unmarshalEndpointSchema = z
178
+ .object({
179
+ name: z.string().optional(),
180
+ creator: z.string().optional(),
181
+ creation_timestamp: z
182
+ .union([z.number(), z.bigint()])
183
+ .transform(v => BigInt(v))
184
+ .optional(),
185
+ last_updated_timestamp: z
186
+ .union([z.number(), z.bigint()])
187
+ .transform(v => BigInt(v))
188
+ .optional(),
189
+ endpoint_type: z.enum(EndpointType).optional(),
190
+ last_updated_user: z.string().optional(),
191
+ id: z.string().optional(),
192
+ endpoint_status: z.lazy(() => unmarshalEndpointStatusSchema).optional(),
193
+ num_indexes: z.number().optional(),
194
+ budget_policy_id: z.string().optional(),
195
+ effective_budget_policy_id: z.string().optional(),
196
+ custom_tags: z.array(z.lazy(() => unmarshalCustomTagSchema)).optional(),
197
+ scaling_info: z.lazy(() => unmarshalEndpointScalingInfoSchema).optional(),
198
+ })
199
+ .transform(d => ({
200
+ name: d.name,
201
+ creator: d.creator,
202
+ creationTimestamp: d.creation_timestamp,
203
+ lastUpdatedTimestamp: d.last_updated_timestamp,
204
+ endpointType: d.endpoint_type,
205
+ lastUpdatedUser: d.last_updated_user,
206
+ id: d.id,
207
+ endpointStatus: d.endpoint_status,
208
+ numIndexes: d.num_indexes,
209
+ budgetPolicyId: d.budget_policy_id,
210
+ effectiveBudgetPolicyId: d.effective_budget_policy_id,
211
+ customTags: d.custom_tags,
212
+ scalingInfo: d.scaling_info,
213
+ }));
214
+ export const unmarshalEndpointScalingInfoSchema = z
215
+ .object({
216
+ state: z.enum(ScalingChangeState).optional(),
217
+ requested_target_qps: z
218
+ .union([z.number(), z.bigint()])
219
+ .transform(v => BigInt(v))
220
+ .optional(),
221
+ })
222
+ .transform(d => ({
223
+ state: d.state,
224
+ requestedTargetQps: d.requested_target_qps,
225
+ }));
226
+ export const unmarshalEndpointStatusSchema = z
227
+ .object({
228
+ state: z.enum(EndpointStatus_State).optional(),
229
+ message: z.string().optional(),
230
+ })
231
+ .transform(d => ({
232
+ state: d.state,
233
+ message: d.message,
234
+ }));
235
+ export const unmarshalListEndpointResponseSchema = z
236
+ .object({
237
+ endpoints: z.array(z.lazy(() => unmarshalEndpointSchema)).optional(),
238
+ next_page_token: z.string().optional(),
239
+ })
240
+ .transform(d => ({
241
+ endpoints: d.endpoints,
242
+ nextPageToken: d.next_page_token,
243
+ }));
244
+ export const unmarshalListValueSchema = z
245
+ .object({
246
+ values: z.array(z.lazy(() => unmarshalValueSchema)).optional(),
247
+ })
248
+ .transform(d => ({
249
+ values: d.values,
250
+ }));
251
+ export const unmarshalListVectorIndexResponseSchema = z
252
+ .object({
253
+ vector_indexes: z
254
+ .array(z.lazy(() => unmarshalMiniVectorIndexSchema))
255
+ .optional(),
256
+ next_page_token: z.string().optional(),
257
+ })
258
+ .transform(d => ({
259
+ vectorIndexes: d.vector_indexes,
260
+ nextPageToken: d.next_page_token,
261
+ }));
262
+ export const unmarshalMapStringValueEntrySchema = z
263
+ .object({
264
+ key: z.string().optional(),
265
+ value: z.lazy(() => unmarshalValueSchema).optional(),
266
+ })
267
+ .transform(d => ({
268
+ key: d.key,
269
+ value: d.value,
270
+ }));
271
+ export const unmarshalMetricSchema = z
272
+ .object({
273
+ name: z.string().optional(),
274
+ labels: z.array(z.lazy(() => unmarshalMetricLabelSchema)).optional(),
275
+ percentile: z.number().optional(),
276
+ })
277
+ .transform(d => ({
278
+ name: d.name,
279
+ labels: d.labels,
280
+ percentile: d.percentile,
281
+ }));
282
+ export const unmarshalMetricLabelSchema = z
283
+ .object({
284
+ name: z.string().optional(),
285
+ value: z.string().optional(),
286
+ })
287
+ .transform(d => ({
288
+ name: d.name,
289
+ value: d.value,
290
+ }));
291
+ export const unmarshalMetricValueSchema = z
292
+ .object({
293
+ timestamp: z
294
+ .union([z.number(), z.bigint()])
295
+ .transform(v => BigInt(v))
296
+ .optional(),
297
+ value: z.number().optional(),
298
+ })
299
+ .transform(d => ({
300
+ timestamp: d.timestamp,
301
+ value: d.value,
302
+ }));
303
+ export const unmarshalMetricValuesSchema = z
304
+ .object({
305
+ metric: z.lazy(() => unmarshalMetricSchema).optional(),
306
+ values: z.array(z.lazy(() => unmarshalMetricValueSchema)).optional(),
307
+ })
308
+ .transform(d => ({
309
+ metric: d.metric,
310
+ values: d.values,
311
+ }));
312
+ export const unmarshalMiniVectorIndexSchema = z
313
+ .object({
314
+ name: z.string().optional(),
315
+ endpoint_name: z.string().optional(),
316
+ primary_key: z.string().optional(),
317
+ index_type: z.enum(VectorIndexType).optional(),
318
+ direct_access_index_spec: z
319
+ .lazy(() => unmarshalDirectAccessVectorIndexSpecSchema)
320
+ .optional(),
321
+ delta_sync_index_spec: z
322
+ .lazy(() => unmarshalDeltaSyncVectorIndexSpecSchema)
323
+ .optional(),
324
+ status: z.lazy(() => unmarshalVectorIndexStatusSchema).optional(),
325
+ creator: z.string().optional(),
326
+ index_subtype: z.enum(IndexSubtype).optional(),
327
+ })
328
+ .transform(d => ({
329
+ name: d.name,
330
+ endpointName: d.endpoint_name,
331
+ primaryKey: d.primary_key,
332
+ indexType: d.index_type,
333
+ indexSpec: d.direct_access_index_spec !== undefined
334
+ ? {
335
+ $case: 'directAccessIndexSpec',
336
+ directAccessIndexSpec: d.direct_access_index_spec,
337
+ }
338
+ : d.delta_sync_index_spec !== undefined
339
+ ? {
340
+ $case: 'deltaSyncIndexSpec',
341
+ deltaSyncIndexSpec: d.delta_sync_index_spec,
342
+ }
343
+ : undefined,
344
+ status: d.status,
345
+ creator: d.creator,
346
+ indexSubtype: d.index_subtype,
347
+ }));
348
+ export const unmarshalPatchEndpointBudgetPolicyResponseSchema = z
349
+ .object({
350
+ budget_policy_id: z.string().optional(),
351
+ effective_budget_policy_id: z.string().optional(),
352
+ })
353
+ .transform(d => ({
354
+ budgetPolicyId: d.budget_policy_id,
355
+ effectiveBudgetPolicyId: d.effective_budget_policy_id,
356
+ }));
357
+ export const unmarshalQueryVectorIndexResponseSchema = z
358
+ .object({
359
+ manifest: z.lazy(() => unmarshalResultManifestSchema).optional(),
360
+ result: z.lazy(() => unmarshalResultDataSchema).optional(),
361
+ next_page_token: z.string().optional(),
362
+ })
363
+ .transform(d => ({
364
+ manifest: d.manifest,
365
+ result: d.result,
366
+ nextPageToken: d.next_page_token,
367
+ }));
368
+ export const unmarshalResultDataSchema = z
369
+ .object({
370
+ row_count: z.number().optional(),
371
+ data_array: z.array(z.array(jsonValueSchema)).optional(),
372
+ })
373
+ .transform(d => ({
374
+ rowCount: d.row_count,
375
+ dataArray: d.data_array,
376
+ }));
377
+ export const unmarshalResultManifestSchema = z
378
+ .object({
379
+ column_count: z.number().optional(),
380
+ columns: z.array(z.lazy(() => unmarshalColumnInfoSchema)).optional(),
381
+ })
382
+ .transform(d => ({
383
+ columnCount: d.column_count,
384
+ columns: d.columns,
385
+ }));
386
+ export const unmarshalRetrieveUserVisibleMetricsResponseSchema = z
387
+ .object({
388
+ metric_values: z
389
+ .array(z.lazy(() => unmarshalMetricValuesSchema))
390
+ .optional(),
391
+ next_page_token: z.string().optional(),
392
+ })
393
+ .transform(d => ({
394
+ metricValues: d.metric_values,
395
+ nextPageToken: d.next_page_token,
396
+ }));
397
+ export const unmarshalScanVectorIndexResponseSchema = z
398
+ .object({
399
+ data: z.array(z.lazy(() => unmarshalStructSchema)).optional(),
400
+ last_primary_key: z.string().optional(),
401
+ })
402
+ .transform(d => ({
403
+ data: d.data,
404
+ lastPrimaryKey: d.last_primary_key,
405
+ }));
406
+ export const unmarshalStructSchema = z
407
+ .object({
408
+ fields: z
409
+ .array(z.lazy(() => unmarshalMapStringValueEntrySchema))
410
+ .optional(),
411
+ })
412
+ .transform(d => ({
413
+ fields: d.fields,
414
+ }));
415
+ export const unmarshalSyncVectorIndexResponseSchema = z.object({});
416
+ export const unmarshalUpdateEndpointCustomTagsResponseSchema = z
417
+ .object({
418
+ name: z.string().optional(),
419
+ custom_tags: z.array(z.lazy(() => unmarshalCustomTagSchema)).optional(),
420
+ })
421
+ .transform(d => ({
422
+ name: d.name,
423
+ customTags: d.custom_tags,
424
+ }));
425
+ export const unmarshalUpsertDataVectorIndexResponseSchema = z
426
+ .object({
427
+ status: z.enum(UpsertDeleteDataStatus).optional(),
428
+ result: z.lazy(() => unmarshalUpsertDeleteDataResultSchema).optional(),
429
+ })
430
+ .transform(d => ({
431
+ status: d.status,
432
+ result: d.result,
433
+ }));
434
+ export const unmarshalUpsertDeleteDataResultSchema = z
435
+ .object({
436
+ success_row_count: z
437
+ .union([z.number(), z.bigint()])
438
+ .transform(v => BigInt(v))
439
+ .optional(),
440
+ failed_primary_keys: z.array(z.string()).optional(),
441
+ })
442
+ .transform(d => ({
443
+ successRowCount: d.success_row_count,
444
+ failedPrimaryKeys: d.failed_primary_keys,
445
+ }));
446
+ export const unmarshalValueSchema = z
447
+ .object({
448
+ number_value: z.number().optional(),
449
+ string_value: z.string().optional(),
450
+ bool_value: z.boolean().optional(),
451
+ struct_value: z.lazy(() => unmarshalStructSchema).optional(),
452
+ list_value: z.lazy(() => unmarshalListValueSchema).optional(),
453
+ })
454
+ .transform(d => ({
455
+ kind: d.number_value !== undefined
456
+ ? { $case: 'numberValue', numberValue: d.number_value }
457
+ : d.string_value !== undefined
458
+ ? { $case: 'stringValue', stringValue: d.string_value }
459
+ : d.bool_value !== undefined
460
+ ? { $case: 'boolValue', boolValue: d.bool_value }
461
+ : d.struct_value !== undefined
462
+ ? { $case: 'structValue', structValue: d.struct_value }
463
+ : d.list_value !== undefined
464
+ ? { $case: 'listValue', listValue: d.list_value }
465
+ : undefined,
466
+ }));
467
+ export const unmarshalVectorIndexSchema = z
468
+ .object({
469
+ name: z.string().optional(),
470
+ endpoint_name: z.string().optional(),
471
+ primary_key: z.string().optional(),
472
+ index_type: z.enum(VectorIndexType).optional(),
473
+ direct_access_index_spec: z
474
+ .lazy(() => unmarshalDirectAccessVectorIndexSpecSchema)
475
+ .optional(),
476
+ delta_sync_index_spec: z
477
+ .lazy(() => unmarshalDeltaSyncVectorIndexSpecSchema)
478
+ .optional(),
479
+ status: z.lazy(() => unmarshalVectorIndexStatusSchema).optional(),
480
+ creator: z.string().optional(),
481
+ index_subtype: z.enum(IndexSubtype).optional(),
482
+ })
483
+ .transform(d => ({
484
+ name: d.name,
485
+ endpointName: d.endpoint_name,
486
+ primaryKey: d.primary_key,
487
+ indexType: d.index_type,
488
+ indexSpec: d.direct_access_index_spec !== undefined
489
+ ? {
490
+ $case: 'directAccessIndexSpec',
491
+ directAccessIndexSpec: d.direct_access_index_spec,
492
+ }
493
+ : d.delta_sync_index_spec !== undefined
494
+ ? {
495
+ $case: 'deltaSyncIndexSpec',
496
+ deltaSyncIndexSpec: d.delta_sync_index_spec,
497
+ }
498
+ : undefined,
499
+ status: d.status,
500
+ creator: d.creator,
501
+ indexSubtype: d.index_subtype,
502
+ }));
503
+ export const unmarshalVectorIndexStatusSchema = z
504
+ .object({
505
+ message: z.string().optional(),
506
+ indexed_row_count: z
507
+ .union([z.number(), z.bigint()])
508
+ .transform(v => BigInt(v))
509
+ .optional(),
510
+ ready: z.boolean().optional(),
511
+ index_url: z.string().optional(),
512
+ })
513
+ .transform(d => ({
514
+ message: d.message,
515
+ indexedRowCount: d.indexed_row_count,
516
+ ready: d.ready,
517
+ indexUrl: d.index_url,
518
+ }));
519
+ export const marshalCreateEndpointRequestSchema = z
520
+ .object({
521
+ name: z.string().optional(),
522
+ endpointType: z.enum(EndpointType).optional(),
523
+ budgetPolicyId: z.string().optional(),
524
+ usagePolicyId: z.string().optional(),
525
+ targetQps: z.bigint().optional(),
526
+ })
527
+ .transform(d => ({
528
+ name: d.name,
529
+ endpoint_type: d.endpointType,
530
+ budget_policy_id: d.budgetPolicyId,
531
+ usage_policy_id: d.usagePolicyId,
532
+ target_qps: d.targetQps,
533
+ }));
534
+ export const marshalCreateVectorIndexRequestSchema = z
535
+ .object({
536
+ name: z.string().optional(),
537
+ endpointName: z.string().optional(),
538
+ primaryKey: z.string().optional(),
539
+ indexType: z.enum(VectorIndexType).optional(),
540
+ indexSpec: z
541
+ .discriminatedUnion('$case', [
542
+ z.object({
543
+ $case: z.literal('directAccessIndexSpec'),
544
+ directAccessIndexSpec: z.lazy(() => marshalDirectAccessVectorIndexSpecSchema),
545
+ }),
546
+ z.object({
547
+ $case: z.literal('deltaSyncIndexSpec'),
548
+ deltaSyncIndexSpec: z.lazy(() => marshalDeltaSyncVectorIndexSpecRequestSchema),
549
+ }),
550
+ ])
551
+ .optional(),
552
+ indexSubtype: z.enum(IndexSubtype).optional(),
553
+ })
554
+ .transform(d => ({
555
+ name: d.name,
556
+ endpoint_name: d.endpointName,
557
+ primary_key: d.primaryKey,
558
+ index_type: d.indexType,
559
+ ...(d.indexSpec?.$case === 'directAccessIndexSpec' && {
560
+ direct_access_index_spec: d.indexSpec.directAccessIndexSpec,
561
+ }),
562
+ ...(d.indexSpec?.$case === 'deltaSyncIndexSpec' && {
563
+ delta_sync_index_spec: d.indexSpec.deltaSyncIndexSpec,
564
+ }),
565
+ index_subtype: d.indexSubtype,
566
+ }));
567
+ export const marshalCustomTagSchema = z
568
+ .object({
569
+ key: z.string().optional(),
570
+ value: z.string().optional(),
571
+ })
572
+ .transform(d => ({
573
+ key: d.key,
574
+ value: d.value,
575
+ }));
576
+ export const marshalDeltaSyncVectorIndexSpecRequestSchema = z
577
+ .object({
578
+ sourceTable: z.string().optional(),
579
+ embeddingSourceColumns: z
580
+ .array(z.lazy(() => marshalEmbeddingSourceColumnSchema))
581
+ .optional(),
582
+ embeddingVectorColumns: z
583
+ .array(z.lazy(() => marshalEmbeddingVectorColumnSchema))
584
+ .optional(),
585
+ pipelineType: z.enum(PipelineType).optional(),
586
+ pipelineId: z.string().optional(),
587
+ embeddingWritebackTable: z.string().optional(),
588
+ columnsToSync: z.array(z.string()).optional(),
589
+ columnsToIndex: z.array(z.string()).optional(),
590
+ })
591
+ .transform(d => ({
592
+ source_table: d.sourceTable,
593
+ embedding_source_columns: d.embeddingSourceColumns,
594
+ embedding_vector_columns: d.embeddingVectorColumns,
595
+ pipeline_type: d.pipelineType,
596
+ pipeline_id: d.pipelineId,
597
+ embedding_writeback_table: d.embeddingWritebackTable,
598
+ columns_to_sync: d.columnsToSync,
599
+ columns_to_index: d.columnsToIndex,
600
+ }));
601
+ export const marshalDirectAccessVectorIndexSpecSchema = z
602
+ .object({
603
+ embeddingVectorColumns: z
604
+ .array(z.lazy(() => marshalEmbeddingVectorColumnSchema))
605
+ .optional(),
606
+ schemaJson: z.string().optional(),
607
+ embeddingSourceColumns: z
608
+ .array(z.lazy(() => marshalEmbeddingSourceColumnSchema))
609
+ .optional(),
610
+ })
611
+ .transform(d => ({
612
+ embedding_vector_columns: d.embeddingVectorColumns,
613
+ schema_json: d.schemaJson,
614
+ embedding_source_columns: d.embeddingSourceColumns,
615
+ }));
616
+ export const marshalEmbeddingSourceColumnSchema = z
617
+ .object({
618
+ name: z.string().optional(),
619
+ embeddingConfig: z
620
+ .discriminatedUnion('$case', [
621
+ z.object({
622
+ $case: z.literal('embeddingModelEndpointName'),
623
+ embeddingModelEndpointName: z.string(),
624
+ }),
625
+ ])
626
+ .optional(),
627
+ modelEndpointNameForQuery: z.string().optional(),
628
+ })
629
+ .transform(d => ({
630
+ name: d.name,
631
+ ...(d.embeddingConfig?.$case === 'embeddingModelEndpointName' && {
632
+ embedding_model_endpoint_name: d.embeddingConfig.embeddingModelEndpointName,
633
+ }),
634
+ model_endpoint_name_for_query: d.modelEndpointNameForQuery,
635
+ }));
636
+ export const marshalEmbeddingVectorColumnSchema = z
637
+ .object({
638
+ name: z.string().optional(),
639
+ embeddingDimension: z.number().optional(),
640
+ })
641
+ .transform(d => ({
642
+ name: d.name,
643
+ embedding_dimension: d.embeddingDimension,
644
+ }));
645
+ export const marshalMetricSchema = z
646
+ .object({
647
+ name: z.string().optional(),
648
+ labels: z.array(z.lazy(() => marshalMetricLabelSchema)).optional(),
649
+ percentile: z.number().optional(),
650
+ })
651
+ .transform(d => ({
652
+ name: d.name,
653
+ labels: d.labels,
654
+ percentile: d.percentile,
655
+ }));
656
+ export const marshalMetricLabelSchema = z
657
+ .object({
658
+ name: z.string().optional(),
659
+ value: z.string().optional(),
660
+ })
661
+ .transform(d => ({
662
+ name: d.name,
663
+ value: d.value,
664
+ }));
665
+ export const marshalPatchEndpointBudgetPolicyRequestSchema = z
666
+ .object({
667
+ name: z.string().optional(),
668
+ budgetPolicyId: z.string().optional(),
669
+ })
670
+ .transform(d => ({
671
+ name: d.name,
672
+ budget_policy_id: d.budgetPolicyId,
673
+ }));
674
+ export const marshalPatchEndpointRequestSchema = z
675
+ .object({
676
+ name: z.string().optional(),
677
+ targetQps: z.bigint().optional(),
678
+ })
679
+ .transform(d => ({
680
+ name: d.name,
681
+ target_qps: d.targetQps,
682
+ }));
683
+ export const marshalQueryVectorIndexNextPageRequestSchema = z
684
+ .object({
685
+ name: z.string().optional(),
686
+ endpointName: z.string().optional(),
687
+ pageToken: z.string().optional(),
688
+ })
689
+ .transform(d => ({
690
+ name: d.name,
691
+ endpoint_name: d.endpointName,
692
+ page_token: d.pageToken,
693
+ }));
694
+ export const marshalQueryVectorIndexRequestSchema = z
695
+ .object({
696
+ name: z.string().optional(),
697
+ numResults: z.number().optional(),
698
+ columns: z.array(z.string()).optional(),
699
+ filtersJson: z.string().optional(),
700
+ queryVector: z.array(z.number()).optional(),
701
+ queryText: z.string().optional(),
702
+ scoreThreshold: z.number().optional(),
703
+ queryType: z.string().optional(),
704
+ columnsToRerank: z.array(z.string()).optional(),
705
+ reranker: z.lazy(() => marshalRerankerConfigSchema).optional(),
706
+ })
707
+ .transform(d => ({
708
+ name: d.name,
709
+ num_results: d.numResults,
710
+ columns: d.columns,
711
+ filters_json: d.filtersJson,
712
+ query_vector: d.queryVector,
713
+ query_text: d.queryText,
714
+ score_threshold: d.scoreThreshold,
715
+ query_type: d.queryType,
716
+ columns_to_rerank: d.columnsToRerank,
717
+ reranker: d.reranker,
718
+ }));
719
+ export const marshalRerankerConfigSchema = z
720
+ .object({
721
+ model: z.string().optional(),
722
+ parameters: z
723
+ .lazy(() => marshalRerankerConfig_RerankerParametersSchema)
724
+ .optional(),
725
+ })
726
+ .transform(d => ({
727
+ model: d.model,
728
+ parameters: d.parameters,
729
+ }));
730
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name.
731
+ export const marshalRerankerConfig_RerankerParametersSchema = z
732
+ .object({
733
+ columnsToRerank: z.array(z.string()).optional(),
734
+ })
735
+ .transform(d => ({
736
+ columns_to_rerank: d.columnsToRerank,
737
+ }));
738
+ export const marshalRetrieveUserVisibleMetricsRequestSchema = z
739
+ .object({
740
+ name: z.string().optional(),
741
+ startTime: z
742
+ .any()
743
+ .transform((d) => d.toString())
744
+ .optional(),
745
+ endTime: z
746
+ .any()
747
+ .transform((d) => d.toString())
748
+ .optional(),
749
+ granularityInSeconds: z.number().optional(),
750
+ metrics: z.array(z.lazy(() => marshalMetricSchema)).optional(),
751
+ pageToken: z.string().optional(),
752
+ })
753
+ .transform(d => ({
754
+ name: d.name,
755
+ start_time: d.startTime,
756
+ end_time: d.endTime,
757
+ granularity_in_seconds: d.granularityInSeconds,
758
+ metrics: d.metrics,
759
+ page_token: d.pageToken,
760
+ }));
761
+ export const marshalScanVectorIndexRequestSchema = z
762
+ .object({
763
+ name: z.string().optional(),
764
+ numResults: z.number().optional(),
765
+ lastPrimaryKey: z.string().optional(),
766
+ })
767
+ .transform(d => ({
768
+ name: d.name,
769
+ num_results: d.numResults,
770
+ last_primary_key: d.lastPrimaryKey,
771
+ }));
772
+ export const marshalSyncVectorIndexRequestSchema = z
773
+ .object({
774
+ name: z.string().optional(),
775
+ })
776
+ .transform(d => ({
777
+ name: d.name,
778
+ }));
779
+ export const marshalUpdateEndpointCustomTagsRequestSchema = z
780
+ .object({
781
+ name: z.string().optional(),
782
+ customTags: z.array(z.lazy(() => marshalCustomTagSchema)).optional(),
783
+ })
784
+ .transform(d => ({
785
+ name: d.name,
786
+ custom_tags: d.customTags,
787
+ }));
788
+ export const marshalUpsertDataVectorIndexRequestSchema = z
789
+ .object({
790
+ name: z.string().optional(),
791
+ inputsJson: z.string().optional(),
792
+ })
793
+ .transform(d => ({
794
+ name: d.name,
795
+ inputs_json: d.inputsJson,
796
+ }));
797
+ //# sourceMappingURL=model.js.map